%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/favoritos.php

<?php

require_once 'config/config.php';

$p['title'] = 'Colección de vídeos populares de uñas artificiales';
$p['desc'] = 'Los videos favoritos de  usuarios registrados "Paso a paso" . Videos de uñas artificiales. ';
$p['keywords'] = 'Favoritos, uñas postizas, videos, uñas, manicuras';
$p['pagename'] = 'Kezdőlap';

if(!empty($uri[1])) {
    $u = explode('-', $uri[1]);
    $_GET['id'] = $u[0];

}

if(!empty($uri[2]) && $uri[2] == 'delete') {
    $_GET['delete'] = 1;
}

$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();
    $db = Registry::get('db');

    Page::seoFromDb(1);

    if(!empty($_SESSION[Registry::get('site')]['user_id'])){
        $c->assign('kedvencek', kedvencek($_SESSION[Registry::get('site')]['user_id']));
    }

    if(isset($_GET['id']) && isset($_GET['delete']))
    {
        settype($_GET['id'], 'integer');

        $bind = array($_GET['id']);
        $sql = "DELETE FROM kedvencek WHERE video_id = ?";
        $db->query($sql, $bind);

        header("Location: " . $_SERVER['HTTP_REFERER']);
        die;
    }

    return $c->fetch('kedvencek.tpl.html');
}

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

    $bind = array($user_id);

    $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 kedvencek ke
			LEFT JOIN video v ON v.id = ke.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'
				AND ke.felhasznalo_id = ?
			GROUP BY v.id 
			ORDER BY ke.datum DESC";

    $kedvencek = $db->GetArray($sql, $bind);

    if(!empty($kedvencek)){
        foreach($kedvencek as $key=>$val){
            $kedvencek[$key]['url'] = $val['url'] . '/' . String2::fancyurl($val['cim']) . '-' . $val['id'];
            $kedvencek[$key]['hossz'] = substr($val['hossz'], 0, 5);
            $kedvencek[$key]['ertekeles'] = intval($val['ertekeles']);
            $kedvencek[$key]['datum'] = str_replace('-','.',$val['datum']);
        }
    }

    return $kedvencek;
}

?>

Zerion Mini Shell 1.0