%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/online-akademia_old.php

<?php

require_once 'config/config.php';

$p['title'] = 'Online Körmösakadémia';
$p['desc'] = 'Online Körmösakadémia';
$p['keywords'] = '';
$p['pagename'] = 'Online Körmösakadémia';

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();

	if(isset($_GET['id'])){
		$db = Registry::get('db');
	
		settype($_GET['id'], 'integer');
		$bind = array($_GET['id']);
		$sql = "SELECT v.id, v.cim, v.datum, v.szoveg, v.leiras, v.title, v.description, v.keywords, v.html
				FROM video_akademia v 
				WHERE v.storno = 'f'
					AND v.aktiv = 't'
					AND v.id = ?";
				
		$row = $db->GetRow($sql, $bind);		

		if(empty($row['id'])) {
			header("Location: " . Registry::get('wwwroot') . "/online-akademia");
			die;
		} else {	
		
			$row['url'] = 'online-akademia/' . String::fancyurl($row['cim']) . '-' . $row['id'];
						
			$c->assign('video', $row);
			$c->assign('kapcs_termekek', kapcs_termekek($row['id'], $c));
			
			$c->assign('fejlec_banner', Page::banner(1,'fejlec'));

			Registry::get('page')->assign('title', $row['title']);
			Registry::get('page')->assign('description', $row['description']);
			Registry::get('page')->assign('keywords', $row['keywords']);

			/* facebook beállítások*/
			
			$links['title'] = $row['cim'];
			$links['url'] = urlencode(Registry::get('wwwroot') . '/'.$row['url']);
			$links['description'] = $row['description'];
			$links['image'] = Registry::get('wwwroot') . '/video/'.$row['id'].'/180_135/' . $row['kep'];

			$row['links'] = $links;

			//to meta
			Registry::get('page')->assign('facebook_share', $row['links']);

			insertNezes($row['id']);
		}

	} else {
		videok($c);
	}
	
    return $c->fetch('csatorna_akademia.tpl.html');
}

function videok($c)
{
	$db = Registry::get('db');
	
	$sql = "SELECT v.id, v.cim, v.datum, v.aktiv, v.szoveg, v.html
			FROM video_akademia v 
			WHERE v.storno = 'f'
			ORDER BY v.sorrend";

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

	foreach($videok as $key=>$val){
		preg_match("|.*?/embed/([\w-]+)|", $val['html'], $m);
 		$videok[$key]['yt_video_id'] = $m[1];
		$videok[$key]['url'] = 'online-akademia/' . String::fancyurl($val['cim']) . '-' . $val['id'];
		$videok[$key]['datum'] = str_replace('-','.',$val['datum']);
	}
		
	$c->assign('videok', $videok);
	
	return;
}

function kapcs_termekek($id, $c)
{
	$db = Registry::get('db');

	$bind = array($id);
	
	$sql = "SELECT t.nev, t.link
			FROM termekek t
			WHERE t.storno = 'f'
				AND t.aktiv = 't'
				AND t.video_id = ? 
				AND t.tipus = 'akademia'
			ORDER BY t.sorrend";
			
	$termekek = $db->GetArray($sql, $bind);	
	
	if(empty($termekek)){
		$c->assign('jobb_banner', Page::banner(2,'jobb'));
	}

	return $termekek;
}

function insertNezes($id)
{
	$db = Registry::get('db');
	
	$most = date("Y-m-d H:i:s");
	$sql = "INSERT INTO `video_akademia_nezettseg`(`video_id`, `datum`) VALUES ('". $id ."','". $most ."')";

	$db->query($sql);
	
	return;
}

?>

Zerion Mini Shell 1.0