%PDF- %PDF-
Direktori : /home/nailstv/public_html/ |
Current File : /home/nailstv/public_html/now-watching.php |
<?php require_once 'config/config.php'; $p['title'] = 'Viewed nail sculpting videos by nail technician visitors'; $p['desc'] = 'List of the videos viewed by the visitors of nails.tv, in viewing order.'; $p['keywords'] = 'nails, fake nails, artificial nails, now watching, video'; $p['pagename'] = 'Csatornák'; if(!empty($uri[1])) { $u = explode('.', $uri[1]); $_GET['id'] = end(explode('-', $u[0])); if(!is_numeric($_GET['id'])){ $_GET['view'] = $_GET['id']; unset($_GET['id']); } } $page = new Page(Registry::get('site'), false, $p); Registry::set('page', $page); $page->assign('content', content($uri)); $page->display('page.tpl.html'); //////////////////////////////////////////////////////////////////////////////// function content($uri) { $db = Registry::get('db'); $c = new Content(); //kategória adatai $kategoria['nev'] = 'Now watching'; $kategoria['szoveg'] = 'A műköröm.tv rendszer most nézett videói.'; $kategoria['control'] = 'false'; //kategória adatai $c->assign('kategoria', $kategoria); if($videok = videok($c)){ //$c->assign('videok', $videok); } else { //eldob header("Location: " . Registry::get('wwwroot') . "/csatornak"); die; } return $c->fetch('csatorna.tpl.html'); } function videok($c) { $db = Registry::get('db'); $sql = "SELECT MAX(id) as max FROM most_nezik"; $max = $db->GetRow($sql); $max = $max['max']-1; $sql = "SELECT DISTINCT video_id FROM most_nezik ORDER BY id DESC LIMIT 0,".$max.""; $videok = $db->GetCol($sql); $videok = implode (',', $videok); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, ka.url, vtvszf.szazalek as ertekeles, k.file, k.id as kep_id FROM video v " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id LEFT JOIN vt_video_szavazas_full vtvszf ON vtvszf.video_id = v.id WHERE v.id IN (".$videok.") AND v.storno = 'f' AND v.aktiv = 't' AND ka.storno ='f' ORDER BY FIELD(v.id, ".$videok.")"; /*$sql = "SELECT v.id, v.cim, v.datum, v.hossz, ka.url, vtvszf.szazalek as ertekeles, k.file, k.id as kep_id FROM most_nezik mn LEFT JOIN video v ON mn.video_id = v.id " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id LEFT JOIN vt_video_szavazas_full vtvszf ON vtvszf.video_id = v.id WHERE v.storno = 'f' AND v.aktiv = 't' AND ka.storno ='f' ORDER BY mn.id DESC";*/ $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current); $pager->setup($r->LastPageNo(), $r->RecordCount(), $limit); $c->assign('n', $r->_maxRecordCount - ($limit * ($pager->current - 1))); $c->assign('pager', $pager->show('pager.tpl.html')); $videok = $r->GetArray(); if(!empty($videok)){ foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String::fancyurl($val['cim']) . '-' . $val['id']; $videok[$key]['hossz'] = substr($val['hossz'], 0, 5); $videok[$key]['ertekeles'] = intval($val['ertekeles']); $videok[$key]['datum'] = str_replace('-','.',$val['datum']); } $c->assign('videok', $videok); return true; } else { return false; } } ?>