%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/es.nails.tv/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/es.nails.tv/recently-viewed.php

<?php

require_once 'config/config.php';

$p['title'] = 'Nail technician videos viewed by nail artist visitors';
$p['desc'] = 'The list of the videos viewed by the visitor nail artists of Nails.tv.';
$p['keywords'] = 'nail, nails, nail sculpting, nail decoration, videos';
$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'] = 'Recently viewed';
	
	$kategoria['szoveg'] = 'Recently viewed videos of Nails.tv.';
	
	$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 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'] . '/' . 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']);
		}
		
		$c->assign('videok', $videok);
		
		return true;
	} else {
		return false;
	}
}


?>

Zerion Mini Shell 1.0