session_start();
ini_set("memory_limit","128M");
ini_set("max_input_time",600);
ini_set("max_execution_time",300);
include "app_top.php";
$db = getDB();
include "design.php";
include "model/static.php";
include "model/vyrobny_program.php";
include "model/domy.php";
include "model/foto.php";
switch($_GET['first']) {
case "admin":
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="prefabytca.sk administracia"');
header('HTTP/1.0 401 Unauthorized');
echo '
Nepovolený prístup!
';
exit;
} else {
if($_SERVER['PHP_AUTH_USER'] == "admin" && $_SERVER['PHP_AUTH_PW'] == "julma31dni") {
$_SESSION['admin'] = "ano";
switch($_GET['second']) {
case "static":
$STATIC = new Static_class($db, BASE, (isset($_GET['third']) ? $_GET['third'] : null));
if($_GET['fourth'] != "save") htmlHeader("Administrácia podstránok");
if(isset($_GET['third'])) {
if($_GET['fourth'] == "save") $STATIC->save();
else $STATIC->showForm();
} else $STATIC->displayAll();
if($_GET['fourth'] != "save") htmlFooter(1);
break;
case "foto":
if(!ISSET($_GET['fourth'])) $_GET['fourth'] = null;
if(!ISSET($_GET['third'])) $_GET['third'] = null;
$foto = new Foto(BASE, $db, "photos/");
htmlHeader("Administrácia fotogalérií");
$foto->invoke($_GET['third'], $_GET['fourth']);
htmlFooter(1);
break;
case "cennik":
if($_POST['sent'] == "Uložiť") {
$error = ""; $error2 = "";
if(is_uploaded_file($_FILES['cennik']['tmp_name'])) {
if(copy($_FILES['cennik']['tmp_name'], 'cennikPrefa.pdf')) $error = "OK";
else $error = "NOK";
}
if(is_uploaded_file($_FILES['katalog']['tmp_name'])) {
if(copy($_FILES['katalog']['tmp_name'], 'katalogPrefa.pdf')) $error2 = "OK";
else $error2 = "NOK";
}
if($error != "") $o = "?error=".$error;
else $o = "?error=NOT";
if($error2 != "") $o .= "&error2=".$error2;
else $o .= "&error2=NOT";
header("Location: ".BASE."admin/cennik/".$o);
} else {
htmlHeader("Administrácia cenníku");
echo "Vyberte nový súbor cenníku alebo katalógu
\n";
if($_GET['error'] == "OK") okBox("Cenník bol úspešne nahratý!");
elseif($_GET['error'] == "NOK") errorBox("Cenník sa nepodarilo nahrať! Skúste znovu prosím.");
elseif($_GET['error'] == "NOT") okBox("Cenník nebol zmenený.");
if($_GET['error2'] == "OK") okBox("Katalóg bol úspešne nahratý!");
elseif($_GET['error2'] == "NOK") errorBox("Katalóg sa nepodarilo nahrať! Skúste znovu prosím.");
elseif($_GET['error2'] == "NOT") okBox("Katalóg nebol zmenený.");
echo "\n";
htmlFooter(1);
}
break;
case "vp":
$VP = new VyrobnyProgram($db, BASE, (isset($_GET['third']) ? $_GET['third'] : null));
if($_GET['fourth'] != "save" && $_GET['fourth'] != "delete") htmlHeader("Administrácia položiek výrobného programu");
if(isset($_GET['third'])) {
if($_GET['fourth'] == "save") $VP->save();
elseif($_GET['fourth'] == "delete") $VP->delete();
elseif($_GET['fourth'] == "deleteImage") $VP->deleteImage($_GET['file']);
else $VP->showForm();
} else $VP->displayAll();
if($_GET['fourth'] != "save" && $_GET['fourth'] != "delete") htmlFooter(1);
break;
case "domy":
$VP = new Domy($db, BASE, (isset($_GET['third']) ? $_GET['third'] : null));
if($_GET['fourth'] != "save" && $_GET['fourth'] != "delete" && $_GET['fourth'] != "deleteImage") htmlHeader("Administrácia domov");
if(isset($_GET['third'])) {
if($_GET['fourth'] == "save") $VP->save();
elseif($_GET['fourth'] == "delete") $VP->delete();
elseif($_GET['fourth'] == "deleteImage") $VP->deleteImage($_GET['fifth']);
else $VP->showForm();
} else $VP->displayAll();
if($_GET['fourth'] != "save" && $_GET['fourth'] != "delete" && $_GET['fourth'] != "deleteImage") htmlFooter(1);
break;
default:
htmlHeader("Administrácia stránok");
echo "Vitajte v administrácii
Vyberte si čo chcete administrovať z ľavého menu.
";
htmlFooter(1);
}
} else {
header('WWW-Authenticate: Basic realm="prefabytca.sk administracia - zle zadane meno/heslo"');
header('HTTP/1.0 401 Unauthorized');
echo 'Nepovolený prístup!
';
exit;
}
}
break;
case "kontakt":
include "views/kontakt.php";
break;
case "vp":
$VP = new VyrobnyProgram($db, BASE, $_GET['third']);
$VP->displayStatic();
break;
case "certifikaty":
case "keramicke-rodinne-domy":
case "keramicke-rodinne-domy-vyhody":
case "keramicke-rodinne-domy-system-liapor":
case "keramicke-rodinne-domy-konstrukcny-system":
case "protihlukove-steny-liadur":
case "protihlukove-steny-liadur-projekt":
case "protihlukove-steny-liadur-vykresy":
$STATIC = new Static_class($db, BASE, $_GET['first']);
$STATIC->displayStatic();
break;
case "protihlukove-steny-liadur-fotogalerie":
if(!ISSET($_GET['second'])) $_GET['second'] = null;
include "modules/foto.php";
$foto = new Foto(BASE, getDB(), "photos/");
$_GET['first'] = 'protihlukove-steny';
htmlHeader("Protihlukové steny Liadur - fotogalérie ");
$foto->invoke("zobrazgaleriu");
htmlFooter(2);
break;
case "referencie-domy":
case "referencie-protihlukove-steny":
case "referencie-zamkove-dlazby":
case "referencie-ostatne":
if(!ISSET($_GET['second'])) $_GET['second'] = null;
switch($_GET['first']) {
case "referencie-domy": $title="Rodinné domy"; break;
case "referencie-protihlukove-steny": $title="Protihlukové steny"; break;
case "referencie-zamkove-dlazby": $title="Zámkové dlažby"; break;
case "referencie-ostatne": $title="Ostatné"; break;
}
$foto = new Foto(BASE, getDB(), "photos/");
htmlHeader("Naše referencie ".$title);
$foto->invoke("zobrazgaleriu");
htmlFooter(6);
break;
case "showgallery":
$foto = new Foto(BASE, getDB(), "photos/", $_GET['second']);
htmlHeader("Gallery ".$foto->galleryName($_GET['second']));
$foto->invoke("zobrazgaleriu");
htmlFooter(-1);
break;
case "showbyphotos":
$foto = new Foto(BASE, getDB(), "photos/", $_GET['second']);
htmlHeader("Gallery ".$foto->galleryName($_GET['second']));
$foto->invoke("showbyphotos");
htmlFooter(-1);
break;
case "keramicke-rodinne-domy-katalog":
$DOMY = new Domy($db, BASE, $_GET['second']);
if(isset($_GET['second'])) $DOMY->displayStatic();
else $DOMY->displayAllForUser();
break;
case "":
$res = $db->query("SELECT nadpis, obsah, image FROM static WHERE adresa='home'");
$obj = $res->fetch_object();
if($obj->image == "") $obj->image = null;
htmlHeader("výroba prefabrikátov, zámková dlažba, obrubníky, rúry, stropné systémy", $obj->image);
echo "";
echo "".$obj->nadpis."
\n".$obj->obsah;
htmlFooter(2);
break;
case "waiting":
htmlHeader("Stránka vo výstavbe", null);
echo "Stránka je vo výstavbe
V tejto sekcii ešte prebiehajú úpravy!
Čoskoro sa môžete tešiť na ďalšie informácie.
";
htmlFooter(0);
break;
default:
htmlHeader("Stránka neexistuje", null);
echo "Adresa neexistuje
Zadaná adresa nebola na serveri nájdená.
Môžete pokračovať na homepage.
";
htmlFooter(0);
}
?>