%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/ru.nails.tv/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/ru.nails.tv/kezdooldal.php

<?php

require_once 'config/config.php';

$p['title'] = 'Nailtube TV - видео';
$p['desc'] = 'Видеоканал ногтей. Наращивания ногтей, дизайн  ногтей. Шаг за шагом видео для ногтей. Коллекция  видео.';
$p['keywords'] = 'видео ногти, видео, шаг за шагом,  наращивания ногтей, дизайн ногтей';
$p['pagename'] = 'Kezdőlap';

$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('kiemelt', kiemelt_videok());
	$c->assign('video_ajanlott', ajalott_videok());
	$c->assign('video_most_nezik', mostnezik());
	$c->assign('video_legujabb', legujabb());
	$c->assign('video_heti_legtobbszor', heti_legtobbszor());
	$c->assign('video_heti_legjobb', video_heti_legjobb());
	
    return $c->fetch('index.tpl.html');
}



function kiemelt_videok()
{
	$db = Registry::get('db');

	$sql = "SELECT v.id, v.cim, v.datum, v.hossz, COUNT(vn.id) as nezettseg, ka.url, ka.url as kat_url, ka.nev as kat, vtvszf.szazalek as ertekeles, v.file, k.file as kep, 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.kiemelt = 't'
				AND ka.storno ='f'
				AND k.file IS NOT NULL
			GROUP BY v.id 
			ORDER BY v.sorrend
			LIMIT 0,4";

	$kiem = $db->GetArray($sql);		

	foreach($kiem as $key=>$val){
		$kiem[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$kiem[$key]['hossz'] = substr($val['hossz'], 0, 5);
		$kiem[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $kiem;
}

function ajalott_videok()
{
	$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'
				AND k.file IS NOT NULL
			GROUP BY v.id 
			ORDER BY v.sorrend
			LIMIT 0,5";

	$ajanlott = $db->GetArray($sql);		

	foreach($ajanlott as $key=>$val){
		$ajanlott[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$ajanlott[$key]['hossz'] = substr($val['hossz'], 0, 5);
		$ajanlott[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $ajanlott;
}

function mostnezik()
{
	$db = Registry::get('db');
	
	$sql = "SELECT DISTINCT video_id FROM most_nezik ORDER BY id DESC LIMIT 0,5";
	$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.")";
		
	$most = $db->GetArray($sql);	

	foreach($most as $key=>$val){
		$most[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$most[$key]['hossz'] = substr($val['hossz'], 0, 5);
		
		$most[$key]['nezettseg'] = getNezettseg($val['id']);
		$most[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $most;
}

function getNezettseg($id)
{
	$db = Registry::get('db');
	
	$bind = array($id);
	
	$sql = "SELECT COUNT(vn.id) as nezettseg
			FROM video_nezettseg vn
			WHERE vn.video_id = ?";
	$row = $db->GetRow($sql, $bind);
	
	return $row['nezettseg'];
}

function legujabb()
{
	$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 ka.storno ='f'
			GROUP BY v.id 
			ORDER BY v.datum DESC
			LIMIT 0,5";
			
	$legujabb = $db->GetArray($sql);		
	
	foreach($legujabb as $key=>$val){
		$legujabb[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$legujabb[$key]['hossz'] = substr($val['hossz'], 0, 5);
		$legujabb[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $legujabb;
}

function heti_legtobbszor()
{
	$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_nezettseg_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.nezettseg DESC, v.datum DESC
			LIMIT 0,5";
			
	$heti_legtobbszor = $db->GetArray($sql);		
	
	foreach($heti_legtobbszor as $key=>$val){
		$heti_legtobbszor[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$heti_legtobbszor[$key]['hossz'] = substr($val['hossz'], 0, 5);
		$heti_legtobbszor[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $heti_legtobbszor;
}

function video_heti_legjobb()
{
	$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
			LIMIT 0,5";
			
	$legjobb = $db->GetArray($sql);		

	foreach($legjobb as $key=>$val){
		$legjobb[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
		$legjobb[$key]['hossz'] = substr($val['hossz'], 0, 5);
		$legjobb[$key]['ertekeles'] = intval($val['ertekeles']);
	}
	
	return $legjobb;
}

?>

Zerion Mini Shell 1.0