%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/highestratedvideosoftheweek.php

<?php

require_once 'config/config.php';

$p['title'] = '';
$p['desc'] = '';
$p['keywords'] = '';
$p['pagename'] = 'Channels';

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'] = 'Most viewed videos of the week';
	
	$kategoria['szoveg'] = 'Text of most viewed videos of the week';
	
	$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') . "/channels");
		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  vt_video_szavazas_heti vt
			LEFT JOIN video v ON v.id = vt.video_id
			" . $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 ka.storno ='f'
			GROUP BY vt.video_id 
			ORDER BY vt.szazalek DESC, v.datum 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;
	}
}


?>

Zerion Mini Shell 1.0