%PDF- %PDF-
Mini Shell

Mini Shell

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

<?php

require_once 'config/config.php';

$p['title'] = 'The newest videos on Nails.tv';
$p['desc'] = 'The list of the newest nail tech and  Step-By-Step videos, in chronological order. The newest techniques of nail sculpting.';
$p['keywords'] = 'nail, nails, step by step, latest, videos';
$p['pagename'] = 'Csatornák';

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'] = 'Latest videos';

    $kategoria['szoveg'] = 'A műköröm.tv legújabb videói időrendben.';

    $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 ka.storno ='f'
			GROUP BY v.id 
			ORDER BY 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