%PDF- %PDF-
Direktori : /home/nailstv/public_html/es.nails.tv/ |
Current File : /home/nailstv/public_html/es.nails.tv/csatorna.php |
<?php $_start = microtime(true); require_once 'config/config.php'; $p['title'] = ''; $p['desc'] = ''; $p['keywords'] = ''; $p['pagename'] = 'Csatornák'; if(!empty($uri[1])) { $u = explode('.', $uri[1]); $tmp = explode('-', $u[0]); $_GET['id'] = end($tmp); 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,$_start)); $page->display('page.tpl.html'); //////////////////////////////////////////////////////////////////////////////// function content($uri,$_start) { $db = Registry::get('db'); $c = new Content(); if(isset($_GET['id'])){ $db = Registry::get('db'); settype($_GET['id'], 'integer'); $bind = array($_GET['id']); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.file, v.file_mp4,v.file_subtitle, v.osszes_nezettseg as nezettseg, ka.url, v.szoveg, v.leiras, v.osszes_ertekeles as ertekeles, v.file, k.file as kep, k.id as kep_id, v.title, v.description, v.keywords, ka.nev as kategoria_nev, ka.url as kategoria_url FROM video v " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id WHERE v.storno = 'f' AND v.aktiv = 't' AND v.id = ? GROUP BY v.id"; $row = $db->GetRow($sql, $bind); if(empty($row['id'])) { header("Location: " . Registry::get('wwwroot') . "/csatornak"); die; } else { //mobile_detect require_once 'include/Mobile_Detect.php'; $detect = new Mobile_Detect; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); if(($detect->isMobile() || $detect->isTablet())){ $row['file'] = $row['file_mp4']; $c->assign('isios', true); } $row['url'] = $row['url'] . '/' . String2::fancyurl($row['cim']) . '-' . $row['id']; $row['hossz'] = substr($row['hossz'], 0, 5); $row['ertekeles'] = intval($row['ertekeles']); $row['datum'] = str_replace('-','.',$row['datum']); $row['cimkek'] = getCimkek($row['id']); $c->assign('video', $row); $c->assign('kapcs_videok', kapcs_videok($row['id'])); $c->assign('kapcs_termekek', kapcs_termekek($row['id'], $c)); $c->assign('hasonlo_videok', hasonlo_videok($row['id'])); $c->assign('fejlec_banner', Page::banner(1,'fejlec')); Registry::get('page')->assign('title', $row['title']); Registry::get('page')->assign('description', $row['description']); Registry::get('page')->assign('keywords', $row['keywords']); /* facebook beállítások*/ $links['title'] = $row['cim']; $links['url'] = urlencode(Registry::get('wwwroot') . '/'.$row['url']); $links['description'] = $row['description']; $links['image'] = Registry::get('wwwroot') . '/video/'.$row['id'].'/180_135/' . $row['kep']; $row['links'] = $links; //to meta Registry::get('page')->assign('facebook_share', $row['links']); insertNezes($row['id']); } } elseif(!empty($_GET['view'])){ // nézetek $bind = array($uri[0]); $sql = "SELECT id FROM kategoria WHERE url = ? AND aktiv = 't' AND storno = 'f'"; $row = $db->GetRow($sql, $bind); if(!empty($row['id'])){ kategoria($row['id'], $c); switch($_GET['view']){ case 'uj': getVideosByDatum($row['id'], $c); break; case 'nezettseg': $tabla = 'vt_video_nezettseg_full'; getVideosByNezettseg($row['id'], $c, $tabla); break; case 'nezettseghavi': $tabla = 'vt_video_nezettseg_havi'; getVideosByNezettseg($row['id'], $c, $tabla); break; case 'nezettsegheti': $tabla = 'vt_video_nezettseg_heti'; getVideosByNezettseg($row['id'], $c, $tabla); break; case 'nezettsegnapi': $tabla = 'vt_video_nezettseg_napi'; getVideosByNezettseg($row['id'], $c, $tabla); break; case 'ertekeles': $tabla = 'vt_video_szavazas_full'; getVideosByErtekeles($row['id'], $c, $tabla); break; case 'ertekeleshavi': $tabla = 'vt_video_szavazas_havi'; getVideosByErtekeles($row['id'], $c, $tabla); break; case 'ertekelesheti': $tabla = 'vt_video_szavazas_heti'; getVideosByErtekeles($row['id'], $c, $tabla); break; case 'ertekelesnapi': $tabla = 'vt_video_szavazas_napi'; getVideosByErtekeles($row['id'], $c, $tabla); break; case 'szavazat': getVideosBySzavazatszam($row['id'], $c, 'full'); break; case 'szavazathavi': getVideosBySzavazatszam($row['id'], $c, 'month'); break; case 'szavazatheti': getVideosBySzavazatszam($row['id'], $c, 'week'); break; case 'szavazatnapi': getVideosBySzavazatszam($row['id'], $c, 'day'); break; case 'kedvenc': $tabla = 'vt_video_kedvenc_full'; getVideosByKedvencszam($row['id'], $c, $tabla); break; case 'kedvenchavi': $tabla = 'vt_video_kedvenc_havi'; getVideosByKedvencszam($row['id'], $c, $tabla); break; case 'kedvencheti': $tabla = 'vt_video_kedvenc_heti'; getVideosByKedvencszam($row['id'], $c, $tabla); break; case 'kedvencnapi': $tabla = 'vt_video_kedvenc_napi'; getVideosByKedvencszam($row['id'], $c, $tabla); break; default: die('????'); break; } } else { //eldob header("Location: " . Registry::get('wwwroot') . "/csatornak"); die; } } else { $bind = array($uri[0]); $sql = "SELECT id, title, description, keywords FROM kategoria WHERE url = ? AND aktiv = 't' AND storno = 'f'"; $row = $db->GetRow($sql, $bind); if(!empty($row['id'])){ $bind = array($row['id']); $sql = "SELECT id FROM kategoria WHERE parent_id = ?"; $fokategoria = $db->GetArray($sql, $bind); } Registry::get('page')->assign('title', $row['title']); Registry::get('page')->assign('description', $row['description']); Registry::get('page')->assign('keywords', $row['keywords']); if(!empty($row['id']) && empty($fokategoria)){ //alkategória - videó lista $kat = kategoria($row['id'], $c); videok($kat['id'], $c); } elseif(!empty($row['id']) && !empty($fokategoria)) { //főkategória kategoria($row['id'], $c, false); $c->assign('alkategoriak', kategoriaList($row['id'])); } else { //eldob header("Location: " . Registry::get('wwwroot') . "/csatornak"); die; } } return $c->fetch('csatorna.tpl.html'); } function kategoriaList($parent_id) { $db = Registry::get('db'); $bind = array($parent_id); $sql = "SELECT k.nev, k.szoveg, k.file, k.url FROM kategoria k WHERE k.storno = 'f' AND k.aktiv = 't' AND k.parent_id = ?"; $alkategoriak = $db->GetArray($sql, $bind); return $alkategoriak; } function kategoria($id, $c) { $db = Registry::get('db'); $bind = array($id); $where = ''; $sql = "SELECT * FROM kategoria WHERE id = ? AND storno = 'f' AND aktiv = 't' ".$where.""; $kat = $db->GetRow($sql, $bind); $c->assign('kategoria', $kat); return $kat; } function videok($kat_id, $c) { $db = Registry::get('db'); $bind = array($kat_id); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, ka.url, v.osszes_ertekeles 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 WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' ORDER BY v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); return; } function kapcs_videok($id) { $db = Registry::get('db'); $bind = array($id); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_ertekeles as ertekeles, ka.url, v.osszes_nezettseg as nezettseg, k.file, k.id as kep_id FROM video_to_video vtv LEFT JOIN video v ON v.id = vtv.kapcs_video_id " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id WHERE v.storno = 'f' AND v.aktiv = 't' AND vtv.video_id = ? AND ka.storno = 'f' GROUP BY v.id ORDER BY v.sorrend"; $videok = $db->GetArray($sql, $bind); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id']; $videok[$key]['hossz'] = substr($val['hossz'], 0, 5); $videok[$key]['ertekeles'] = intval($val['ertekeles']); } return $videok; } function getProductUrl($id = null) { if(!isset($id)) return ''; $db = Db::kdb('csbolt'); $s = 1; $bind = array($id); $sql = "SELECT t.id, td.nev AS termek_nev, ks.url AS kategoria_url, ts.url AS url FROM termek t LEFT JOIN termek_seo ts ON ts.termek_id = t.id LEFT JOIN termek_detail td ON td.termek_id = t.id LEFT JOIN kategoria_seo ks ON t.kategoria_id = ks.kategoria_id WHERE t.storno = 'f' AND ts.portal_id = 2 AND ks.portal_id = 2 AND t.id = ? ORDER BY t.sorrend "; $termek = $db->GetRow($sql, $bind); if(!isset($termek['kategoria_url']) && !isset($termek['id'])) return false; if(!empty($termek['url'])) $url = $termek['url']; else $url = strtolower(String2::fancyurl($termek['nev'])); $product_url = 'http://www.bestnails.es/webshop/'. $termek['kategoria_url'] . '/' . $url . '-' . $termek['id']; $product_url = str_replace(' ', '', $product_url); return trim($product_url); } function getCategoryUrl($id = null) { if(!isset($id)) return ''; $db = Db::kdb('csbolt'); //$bind = array($id, $id, $id); $bind = array($id); $sql = "SELECT kd.kategoria_id, ks.url FROM kategoria k LEFT JOIN kategoria_detail kd ON k.id = kd.kategoria_id AND kd.portal_id = 2 LEFT JOIN kategoria_seo ks ON k.id = ks.kategoria_id AND ks.portal_id = 2 WHERE k.id = ?"; $row = $db->GetRow($sql, $bind); return 'http://www.bestnails.es/webshop/'.$row['url']; } function getProductPicture($id = null,$type = 'termek') { if(!isset($id)) return ''; $db = Db::kdb('csbolt'); $bind = array($id); $sql = "SELECT k.file FROM termek t INNER JOIN kep k ON k.galeria_id = t.id AND k.tipus = '".$type."' AND def='t' WHERE t.storno = 'f' AND t.id = ? LIMIT 1 "; $termekek = $db->GetArray($sql, $bind); if(isset($termekek[0]['file'])) return 'http://www.bestnails.es/webshop/img/galeria/'.$termekek[0]['file']; else return false; } function kapcs_termekek($id, $c) { $db = Registry::get('db'); $kdb = Db::kdb('csbolt'); $bind = array($id); /*k.file AS kep, kp.kepzes_id FROM kepzes e " . $db->joinDefPic('kepzes', 'e') . "*/ $sql = "SELECT t.id,t.nev, t.link,t.kep_link, t.ext_id,t.ext_id_cat FROM termekek t WHERE t.storno = 'f' AND t.aktiv = 't' AND t.video_id = ? ORDER BY t.sorrend"; $termekek = $db->GetArray($sql, $bind); $product_ids = array(); foreach( $termekek as $termek) { $e = explode('-',$termek['link']); $product_ids[] = intval(end($e)); } $sql2 = " SELECT galeria_id,file FROM `kep` WHERE `galeria_id` IN(".implode(',',$product_ids).") AND tipus = 'termek' AND `def` = 't' "; $r2 = $kdb->GetAssoc( $sql2 ); foreach($termekek as &$termek) { $e = explode('-',$termek['link']); $p_id = intval(end($e)); if(isset($r2[$p_id])) $termek['kep'] = $r2[$p_id]; if(!empty($termek['ext_id_cat'])) { $termek['link'] = getCategoryUrl($termek['ext_id_cat']); $termek['kep'] = getProductPicture($termek['ext_id_cat'],'kategoria'); } else if(!empty($termek['ext_id'])) { $termek['link'] = getProductUrl($termek['ext_id']); $termek['kep'] = getProductPicture($termek['ext_id']); } } if(empty($termekek)){ $c->assign('jobb_banner', Page::banner(2,'jobb')); } return $termekek; } function hasonlo_videok($id) { $db = Registry::get('db'); $bind = array($id); $sql = "SELECT v.cim FROM video v WHERE v.id = ?"; $alap_video = $db->GetRow($sql, $bind); $alap_video = explode(' ', $alap_video['cim']); $alap_video = array_unique($alap_video); $kulcsszavak = $alap_video; $vagott_szavak = array_slice($kulcsszavak, 0, 3); $kulcsszavak = $vagott_szavak; $query_parts = array(); $nelegyenbenne = array('köröm', 'műköröm', 'zselé', 'porcelán'); //print_r($kulcsszavak); print '<br>'; $vedd_ki = false; foreach($kulcsszavak as $key=>$val){ if(in_array($val, $nelegyenbenne)){ unset($kulcsszavak[$key]); $vedd_ki = true; } if(mb_strlen($val, 'UTF-8')<5){ unset($kulcsszavak[$key]); continue; } if(!$vedd_ki){ $query_parts[] = "'%".$db->qStr($val)."%'"; } $vedd_ki = false; } //print_r($kulcsszavak); print '<br>'; die; //$keres1 = implode(' OR v.keres LIKE ', $query_parts); foreach($query_parts as $k=>$v){ if($v=="'%%'"){ unset($query_parts[$k]); } } $keres2 = implode(' OR v.cim LIKE ', $query_parts); $bind[] = $id; // $bind[] = $id; $sql = "SELECT v.id, v.cim, v.datum, v.hossz, ka.url, v.osszes_ertekeles as ertekeles, v.osszes_nezettseg as nezettseg, k.file, k.id as kep_id FROM video v " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id WHERE v.storno = 'f' AND (v.cim LIKE {$keres2} AND v.id != ? AND v.aktiv = 't') AND v.id != ? AND ka.storno = 'f' AND v.aktiv = 't' ORDER BY v.datum DESC, v.sorrend LIMIT 0,8"; $hasonlo = $db->GetArray($sql, $bind); if(!empty($hasonlo)) { foreach($hasonlo as $key=>$val){ $hasonlo[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id']; $hasonlo[$key]['hossz'] = substr($val['hossz'], 0, 5); $hasonlo[$key]['ertekeles'] = intval($val['ertekeles']); $hasonlo[$key]['datum'] = str_replace('-','.',$val['datum']); $bind = array($val['id']); $sql = "SELECT COUNT(vn.id) as nezettseg FROM video v LEFT JOIN video_nezettseg vn ON vn.video_id = v.id WHERE v.id = ?"; $row = $db->GetRow($sql, $bind); $hasonlo[$key]['nezettseg'] = $row['nezettseg']; } } return $hasonlo; } function insertNezes($id) { $db = Registry::get('db'); $most = date("Y-m-d H:i:s"); $sql = "INSERT INTO `video_nezettseg`(`video_id`, `datum`) VALUES ('". $id ."','". $most ."')"; $db->query($sql); $sql = "INSERT INTO `most_nezik`(`video_id`) VALUES ('". $id ."')"; $db->query($sql); $sql = "UPDATE video SET osszes_nezettseg = osszes_nezettseg + 1, napi_nezettseg= napi_nezettseg + 1, heti_nezettseg = heti_nezettseg + 1 , havi_nezettseg = havi_nezettseg + 1 WHERE id = '". $id ."'"; $db->query($sql); return; } function getCimkek($id) { $db = Registry::get('db'); $bind = array($id); $sql = "SELECT c.nev, c.url, c.id FROM cimke_to_video ctv LEFT JOIN cimkek c ON c.id = ctv.cimkek_id WHERE ctv.video_id = ? AND c.storno = 'f' AND c.aktiv = 't'"; $cimkek = $db->GetArray($sql, $bind); return $cimkek; } function getVideosByDatum($kat_id, $c) { $db = Registry::get('db'); $bind = array($kat_id); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_ertekeles as ertekeles, v.osszes_nezettseg as nezettseg, k.file, k.id as kep_id FROM video v " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' GROUP BY v.id ORDER BY v.datum DESC, v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); $sql = "SELECT k.nev, k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); $title = "Vídeos más recientes - " . $kat_seo['nev']; $keywords = "Vídeos más recientes, " . strtolower($kat_seo['nev']); $description = "Vídeos más recientes - " . $kat_seo['nev'] . ". Videos más recientes de uñas artificiales Paso a paso."; Registry::get('page')->assign('title', $title); Registry::get('page')->assign('description', $description); Registry::get('page')->assign('keywords', $keywords); return; } function getVideosByNezettseg($kat_id, $c, $tabla) { $db = Registry::get('db'); $bind = array($kat_id); if(empty($tabla)){ $tabe = "vt_video_nezettseg_full"; } $sql = "SELECT k.nev, k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); switch($tabla){ case 'vt_video_nezettseg_full': $title = "Videos más vistos - " . $kat_seo['nev']; $keywords = "Videos más vistos, " . strtolower($kat_seo['nev']); $description = "Videos más vistos - " . $kat_seo['nev'] . ". Vídeos más vistos por categoría."; $order = "osszes_nezettseg"; break; case 'vt_video_nezettseg_havi': $title = "Vídeos del mes más vistos - " . $kat_seo['nev']; $keywords = "Vídeos del mes más vistos, " . strtolower($kat_seo['nev']); $description = "Vídeos del mes más vistos - " . $kat_seo['nev'] . ". Los videos más vistos según indicador mensual de audiencia."; $order = "havi_nezettseg"; break; case 'vt_video_nezettseg_heti': $title = $kat_seo['nev'] . " - Los videos más vistos de la semana"; $keywords = strtolower($kat_seo['nev']) . ", Los videos más vistos de la semana"; $description = $kat_seo['nev'] . " - Los videos más vistos de la semana. Videos tutoriales Paso a paso basados en las calificaciones de la semana pasada."; $order = "heti_nezettseg"; break; case 'vt_video_nezettseg_napi': $title = "Los videos mas vistos del día - " . $kat_seo['nev']; $keywords = "Los videos mas vistos del día, " . strtolower($kat_seo['nev']); $description = "Los videos mas vistos del día - " . $kat_seo['nev'] . ". Los videos tutoriales paso a paso más vistos en las últimas 24 horas."; $order = "napi_nezettseg"; break; default: $title = "Los videos más populares - " . $kat_seo['nev']; $keywords = "Los videos más populares, " . strtolower($kat_seo['nev']); $description = "Los videos más populares - " . $kat_seo['nev'] . ". Los vídeos más vistos en su categoría"; $order = "osszes_nezettseg"; break; } Registry::get('page')->assign('title', $title); Registry::get('page')->assign('description', $description); Registry::get('page')->assign('keywords', $keywords); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, ka.url, v.osszes_ertekeles 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.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' GROUP BY v.id ORDER BY ".$order." DESC, v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); return; } function getVideosByErtekeles($kat_id, $c, $tabla) { $db = Registry::get('db'); $bind = array($kat_id); if(empty($tabla)){ $tabe = "vt_video_szavazat_full"; } $sql = "SELECT k.nev, k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); switch($tabla){ case 'vt_video_szavazas_full': $title = "Los vídeos más votados - " . $kat_seo['nev']; $keywords = "Los vídeos más votados, " . strtolower($kat_seo['nev']); $description = "Los vídeos más votados - " . $kat_seo['nev'] . ". Los mejores videos de Es.nails.tv en base a los votos de la audiencia."; $from ="osszes_ertekeles"; $from2 ="osszes_szavazas"; break; case 'vt_video_szavazas_havi': $title = "Los mejores videos del mes - " . $kat_seo['nev']; $keywords = "Los mejores videos del mes, " . strtolower($kat_seo['nev']); $description = "Los mejores videos del mes - " . $kat_seo['nev'] . " En la categoría. Estrellas del mes. Videos Paso a paso."; $from = "havi_ertekeles"; $from2 ="havi_szavazas"; break; case 'vt_video_szavazas_heti': $title = $kat_seo['nev'] . " - Los mejor video de la semana"; $keywords = strtolower($kat_seo['nev']) . ", Los mejor video de la semana"; $description = $kat_seo['nev'] . " - Los mejor video de la semana. El mejor video tutorial Paso a Paso mejor valorado por los usuarios."; $from = "heti_ertekeles"; $from2 ="heti_szavazas"; break; case 'vt_video_szavazas_napi': $title = "Videos Top 24 - " . $kat_seo['nev']; $keywords = "Videos Top 24, " . strtolower($kat_seo['nev']); $description = "Videos Top 24 - " . $kat_seo['nev'] . ". El mejor vídeo de dias anteriores en su categoría según los votos de los usuarios"; $from = "napi_ertekeles"; $from2 ="napi_szavazas"; break; default: $title = "Los vídeos más votados - " . $kat_seo['nev']; $keywords = "Los vídeos más votados, " . strtolower($kat_seo['nev']); $description = "Los vídeos más votados - " . $kat_seo['nev'] . ". El mejor video de Es.nails.tv según los votos del público."; $from ="osszes_ertekeles"; $from2 ="osszes_szavazas"; break; } Registry::get('page')->assign('title', $title); Registry::get('page')->assign('description', $description); Registry::get('page')->assign('keywords', $keywords); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, ka.url, v.osszes_ertekeles 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 WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' ORDER BY ertekeles DESC, ".$from2." DESC, v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); return; } function getVideosBySzavazatszam($kat_id, $c, $ido) { $db = Registry::get('db'); $bind = array($kat_id); if(empty($tabla)){ $tabe = "vt_video_szavazat_full"; } if($ido == 'full' || empty($ido)){ $where = ''; } else { $where = ' AND ((vsz.datum > (now() - interval 1 '.$ido.')) OR vsz.datum IS NULL)'; } $sql = "SELECT k.nev, k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); switch($ido){ case 'full': $title = "El video más votado - " . $kat_seo['nev']; $keywords = "El video más votado, " . strtolower($kat_seo['nev']); $description = "El video más votado - " . $kat_seo['nev'] . ". El primer video basado en el número de votos y orden cronológico."; $from ="osszes_szavazas"; break; case 'month': $title = "El video con mayor número de votos del mes - " . $kat_seo['nev']; $keywords = "El video con mayor número de votos del mes, " . strtolower($kat_seo['nev']); $description = "El video con mayor número de votos del mes - " . $kat_seo['nev'] . " El video con mayor número de votos del mes recibidos en orden de votos."; $from ="havi_szavazas"; break; case 'week': $title = $kat_seo['nev'] . " Video - El más votado de la semana"; $keywords = strtolower($kat_seo['nev']) . " Video, El más votado de la semana."; $description = $kat_seo['nev'] . " Video - El más votado de la semana. Colocado por los usuarios en base a los votos de la semana pasada."; $from ="heti_szavazas"; break; case 'day': $title = "Mayor puntuación diaria - " . $kat_seo['nev'] . " videos"; $keywords = "Mayor puntuación diaria, " . strtolower($kat_seo['nev']) . " videos"; $description = "Mayor puntuación diaria - " . $kat_seo['nev'] . " En las últimas 24 horas el video tutorial Paso a paso más votado."; $from ="napi_szavazas"; break; default: $title = "El video que ha recibido más votos - " . $kat_seo['nev']; $keywords = "El video que ha recibido más votos, " . strtolower($kat_seo['nev']); $description = "El video que ha recibido más votos - " . $kat_seo['nev'] . " El primer video basado en el número de votos y orden cronológico."; $from ="osszes_szavazas"; break; } Registry::get('page')->assign('title', $title); Registry::get('page')->assign('description', $description); Registry::get('page')->assign('keywords', $keywords); $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, v.osszes_szavazas as szavazatok, ka.url, v.osszes_ertekeles 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 WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' ORDER BY v.".$from." DESC, ertekeles DESC, v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); return; } function getVideosByKedvencszam($kat_id, $c, $tabla) { $db = Registry::get('db'); $bind = array($kat_id); if(empty($tabla)){ $tabe = "vt_video_kedvenc_full"; } $sql = "SELECT v.id, v.cim, v.datum, v.hossz, v.osszes_nezettseg as nezettseg, ka.url, v.osszes_ertekeles as ertekeles, k.file, k.id as kep_id FROM ".$tabla." vnf LEFT JOIN video v ON vnf.video_id = v.id " . $db->joinDefPic('video', 'v') . " LEFT JOIN kategoria ka ON ka.id = v.kategoria_id WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' GROUP BY v.id ORDER BY vnf.kedvenc DESC, ertekeles DESC, v.sorrend"; $pager = new Pager; $limit = 20; $r = $db->PageExecute($sql, $limit, $pager->current, $bind); $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(); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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']); } if(empty($videok)) { $videok = getVideok($kat_id); } $c->assign('videok', $videok); $sql = "SELECT k.nev, k.title, k.description, k.keywords FROM kategoria k WHERE k.storno = 'f' AND k.id = ?"; $kat_seo = $db->GetRow($sql, $bind); switch($tabla){ case 'vt_video_kedvenc_full': $title = "Vídeos favoritos - " . $kat_seo['nev']; $keywords = "Vídeos favoritos, " . strtolower($kat_seo['nev']); $description = "Vídeos favoritos - " . $kat_seo['nev'] . ". El video tutorial Paso a paso más popular según usuarios registrados en Es.nails.tv"; break; case 'vt_video_kedvenc_havi': $title = $kat_seo['nev'] . " - Videos favoritos mensuales"; $keywords = strtolower($kat_seo['nev']) . ", Videos favoritos mensuales"; $description = $kat_seo['nev'] . " - Vídeo favorito del mes. Los videos más valorados por los usuarios registrados en Es.nails.tv del mes pasado."; break; case 'vt_video_kedvenc_heti': $title = "Favoritos semanales - " . $kat_seo['nev'] . " videos"; $keywords = "Favoritos semanales, " . strtolower($kat_seo['nev']) . ", videos"; $description = "Favoritos semanales - " . $kat_seo['nev'] . " videos. Los videos colocados como favoritos esta semana en Es.nails.tv"; break; case 'vt_video_kedvenc_napi': $title = "Videos más populares del día - " . $kat_seo['nev']; $keywords = "Videos más populares del día, " . strtolower($kat_seo['nev']); $description = "Videos más populares del día - " . $kat_seo['nev'] . ". Videos tutoriales Paso a Paso en orden en base a la popularidad del día."; break; default: $title = "Vídeos favoritos - " . $kat_seo['nev']; $keywords = "Vídeos favoritos, " . strtolower($kat_seo['nev']); $description = "Vídeos favoritos - " . $kat_seo['nev'] . ". El video tutorial Paso a paso más popular según usuarios registrados en Es.nails.tv"; break; } // // Registry::get('page')->assign('title', $title); Registry::get('page')->assign('description', $description); Registry::get('page')->assign('keywords', $keywords); return; } 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, ka.url, v.osszes_ertekeles 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 WHERE v.storno = 'f' AND v.aktiv = 't' AND v.kategoria_id = ? AND ka.storno = 'f' ORDER BY v.sorrend, v.datum DESC LIMIT 0,4"; $videok = $db->GetArray($sql, $bind); foreach($videok as $key=>$val){ $videok[$key]['url'] = $val['url'] . '/' . String2::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; } echo '<!--'.(microtime(true)-$_start).'sec -->'; // die(); ?>