define("DOCUMENTROOT","");
ob_start();
header("Content-Type: text/html; charset=utf-8");
include_once("./admin/func.php");
include_once("class.gxtemp.php");
$page=$_GET["p"];
$l=$_GET["l"];
/*foreach($_GET AS $klic => $hodnota){
echo "$klic = $hodnota ";
}*/
$sql="SELECT id FROM jazyky WHERE zkratka='".mysql_escape_string($l)."'";
$vysledek=provedSQL($sql,"Nepodarilo se ziskat sql");
if (mysql_num_rows($vysledek)>0){
$jj=mysql_fetch_array($vysledek);
$gx_jazyk=$jj["id"];
$gx_jazyk_code=$l;
}else{
$gx_jazyk_code="cz";
$gx_jazyk=1;
}
//echo "".getSeoFrom(12).".html";
$gx_temp=new GxTemp("");
// nacteme kategorie a zaradime
class Kategorie{
var $id, $rodic, $nazev, $seo, $popis, $deleted, $gxlang, $pozice, $skupina;
var $children;
function Kategorie(){
}
}
// nacteme kategorie
$sql="SELECT id, rodic, seo, jazyk, pozice FROM kategorie WHERE jazyk=$gx_jazyk AND deleted=0 ";
//AND id IN (SELECT id_kat FROM kategorie_v_domene WHERE id_dom IN (SELECT id FROM domeny WHERE zkratka LIKE '%$gx_domain'))
$sql.=" ORDER BY rodic, pozice";
//echo "$sql";
$vysledek=provedSQL($sql,"Nepodarilo se ziskat kategorie");
function katRekurze($kategorie,$rodic){// sice ne moc efektivni lec funkcni, pokud nebude 500 kategorii tak se to rozdycha
$navrat=array();
foreach($kategorie AS $k){
if ($k->rodic==$rodic){
$k->children=katRekurze($kategorie,$k->id);
$klic=$k->seo;
if ($klic=="")
$klic="/";
$navrat[$klic]=$k;
}
}
return $navrat;
}
$kat=array();
if (mysql_num_rows($vysledek)>0){
while($z=mysql_fetch_array($vysledek)){
$akt=new Kategorie();
$akt->id=$z["id"];
$akt->rodic=$z["rodic"];
$akt->seo=$z["seo"];
$akt->jazyk=$z["jazyk"];
$akt->pozice=$z["pozice"];
$akt->skupina=$z["skupina"];
if ($akt->pozice=="")
$pozice=1;
$kat[]=$akt;
}
}
$kate=katRekurze($kat,-1);
$kate=$kate["/"]->children;
$url_path=explode("/",$page);
/** **/
$sql="SELECT id FROM kategorie WHERE deleted=0 AND rodic=-1 AND jazyk IN (SELECT MIN(id) FROM jazyky WHERE deleted=0)";
$vysledekId=provedSQL($sql,"Neziskal sem chybu");
if (mysql_num_rows($vysledekId)>0){
$mm=mysql_fetch_array($vysledekId);
$id=$mm["id"];
}else
$i=13;
for($i=0;$iid;
$kate=$kate[$url_path[$i]]->children;
}
$gx_category_id=$id;
//echo $id;
$sql="SELECT m.nazev AS modul FROM moduly m, kategorie_modul km, kategorie k WHERE m.id=km.id_modul AND km.id_kategorie=k.id AND k.id=$id";
//echo "$sql";
$vysledek=provedSQL($sql,"Nepodarilo se ziskat spojeni");
if (mysql_num_rows($vysledek)==0){
//echo "nezname modul";
}else{
$moduly=mysql_fetch_array($vysledek);
$modul=$moduly["modul"];
if(file_exists("./modules/".$modul."/render.inc.php"))
include_once("./modules/".$modul."/render.inc.php");
}
$sql = "SELECT obsah, nazev FROM menu_styl WHERE deleted = 0 AND id IN (SELECT id_menu FROM menu_v_domenach WHERE id_domeny IN (SELECT id FROM domeny WHERE zkratka = '".$gx_domena."' ))";
$vysledek = provedSQL($sql,"Error");
$radek = mysql_fetch_array($vysledek);
$nazev_menu = $radek["nazev"];
//LOGO urcite domeny
$sql = "SELECT id FROM fotogalerie WHERE id IN (SELECT id_loga FROM loga_v_domenach WHERE id_domeny IN (SELECT id FROM domeny WHERE zkratka = '".$gx_domena."' )) ";
//echo "$sql";
$vysledek=provedSQL($sql,"Nepodarilo se ziskat loga");
if (mysql_num_rows($vysledek)>0){
$zz=mysql_fetch_array($vysledek);
$logo = $zz["id"];
}
$sql="SELECT obsah FROM sablony WHERE nazev='main'";
$vysledek=provedSQL($sql,"Nepodarilo se ziskat hlavni sablonu");
if (mysql_num_rows($vysledek)>0){
$z=mysql_fetch_array($vysledek);
$gx_core_template=new GxTemp($z["obsah"]);
$gx_core_template->setVariable("core",$gx_temp);
if (isset($gx_logo))
$gx_core_template->setVariable("logo",$gx_logo);
}else{// neni nalezeny hlavni sablonovac
$gx_core_template=$gx_temp;
}
//zjistujeme nejdelsi nazev v hlavnim menu, podle toho pak nastavujeme sirku vsech polozek v menu
$sql = "SELECT nazev FROM kategorie WHERE rodic IN (SELECT id FROM kategorie WHERE rodic = -1 AND jazyk = $gx_jazyk) AND id IN (SELECT id_kat FROM kategorie_v_domene WHERE id_dom IN (SELECT id FROM domeny WHERE zkratka LIKE '%$gx_domain')) ";
$vysledek = provedSQL($sql, "Error pri zapisovani do databaze v fotogalerie.php/delete");
$count = 0;
while($radek = mysql_fetch_array($vysledek))
{
$temp_count = strlen($radek["nazev"]);
if($temp_count > $count)
$count = $temp_count;
}
//sirka jedne polozky v mede/nu -> 8 pixelu na jedno pismenko
$menu_item_width = $count * 8;
//mezera mezi jednotlivymi polozkami v menu, pouzivame v
$borderBetween = 3;
$sql = "SELECT styl, roztazeni FROM menu_styl WHERE id IN
(SELECT id_menu FROM menu_v_domenach WHERE id_domeny IN
(SELECT id FROM domeny WHERE zkratka LIKE '%$gx_domain'))";
//echo "gx_domain: ".$gx_domain;
//echo $sql;
$vysledek = provedSQL($sql, "Error pri zapisovani do databaze v fotogalerie.php/delete");
$radek = mysql_fetch_array($vysledek);
$roztazeni_na_celou_obrazovku = $radek["roztazeni"];
//pokud je styl == 0 pak horizontalni, pokud 1 pak vertikalni
$styl_menu = $radek["styl"];
?>