%PDF- %PDF-
Direktori : /home/nailstv/public_html/ |
Current File : /home/nailstv/public_html/channels.php |
<?php require_once 'config/config.php'; $p['title'] = ''; $p['desc'] = ''; $p['keywords'] = ''; $p['pagename'] = 'Channels'; $url = $_SERVER['REQUEST_URI']; $tokens = explode('/', $url); if($tokens[sizeof($tokens)-1]=="basics" ) { $p['active'] = 'Alapismeretek' ; } else { $p['active'] = 'Csatornák' ; } if($uri[0] == 'basics'){ $_GET['kat_id'] = 1; } else { $_GET['kat_id'] = 2; } if(!empty($uri[1])) { $u = explode('.', $uri[1]); $_GET['id'] = end(explode('-', $u[0])); } $page = new Page(Registry::get('site'), false, $p); Registry::set('page', $page); $page->assign('content', content()); $page->display('page.tpl.html'); //////////////////////////////////////////////////////////////////////////////// function content() { $c = new Content(); //Page::seoFromDb(1); $c->assign('kategoriak', kategoriak()); /* if($_GET['kat_id'] == 1){ $c->assign('csatornak', Page::csatornak('false')); } else { $c->assign('csatornak', Page::csatornak('true')); } */ return $c->fetch('csatornak.tpl.html'); } function kategoriak() { $db = Registry::get('db'); $where = ''; $bind = array($_GET['kat_id']); $sql = "SELECT k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); Registry::get('page')->assign('title', $kat_seo['title']); Registry::get('page')->assign('description', $kat_seo['description']); Registry::get('page')->assign('keywords', $kat_seo['keywords']); if($_GET['kat_id'] == 1){ $where = ' AND k.parent_id != 2 AND k.id != 2 AND k.id != 1'; } else if($_GET['kat_id'] == 2) { $where = ' AND k.parent_id != 1 AND k.id != 1 AND k.id != 2'; } $sql = "SELECT k.id, k.url, k.nev FROM kategoria k WHERE k.storno = 'f' AND k.aktiv = 't' ". $where ." ORDER BY k.sorrend"; $kategoriak = $db->GetArray($sql); foreach($kategoriak as $key=>$val){ $kategoriak[$key]['videok'] = getVideok($val['id']); } return $kategoriak; } function getVideok($kat_id) { $db = Registry::get('db'); $bind = array($kat_id); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, /* COUNT(vn.id) as nezettseg,*/ 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 video_nezettseg vn ON vn.video_id = v.id */ LEFT JOIN vt_video_szavazas_full vtvszf ON vtvszf.video_id = v.id WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' GROUP BY v.id ORDER BY v.sorrend, v.datum DESC LIMIT 0,4"; $videok = $db->GetArray($sql, $bind); $videok = Video::getViews($videok); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String::fancyurl($val['cim']) . '-' . $val['id']; $videok[$key]['hossz'] = substr($val['hossz'], 0, 4); $videok[$key]['ertekeles'] = intval($val['ertekeles']); $videok[$key]['datum'] = str_replace('-','.',$val['datum']); } return $videok; } ?>