This repository has been archived by the owner on Nov 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
67 lines (57 loc) · 2.42 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
$pageTitle = "Početna stranica";
require_once './control/_page.php';
///////// LOGIRANJE ZA DESKTOP KORISNIKE /////////
$isLoggedIn = false;
$loginUser = null;
if (isset($_COOKIE["user"])) {
$loginUser["username"] = $_COOKIE["user"];
$smarty->assign("setRemember", true);
}
// Za test:
if (isset($_POST['testing'])) {
try {
if (isset($_POST["admin"])) {
$isLoggedIn = UserControl::LogIn("mmatijevi", "test1");
} elseif (isset($_POST["moderator"])) {
$isLoggedIn = UserControl::LogIn("aanic2", "anica2");
} elseif (isset($_POST["registered"])) {
$isLoggedIn = UserControl::LogIn("mmatijac3", "matejftw3");
}
} catch (Exception $e) {
$smarty->assign("message", $e->getMessage());
} finally {
if ($isLoggedIn === USER_CONTROL_SUCCESS) {
header("Location: {$relativePath}index.php");
exit();
}
}
// Pravi login:
} elseif (isset($_POST['login'])) {
require_once("./control/login.php");
}
///////// LOGIRANJE ZA DESKTOP KORISNIKE /////////
try {
$dbObj = new DB();
$acceptanceStats = $dbObj->SelectPrepared("SELECT k.naziv, COUNT(*) as count, s.naziv as status FROM steta INNER JOIN kategorija_stete k ON k.id_kategorija_stete = steta.id_kategorija_stete INNER JOIN status_stete s ON steta.id_status_stete = s.id_status_stete GROUP BY k.naziv, s.id_status_stete ORDER BY k.naziv ASC;");
$smarty->assign("acceptanceStats", $acceptanceStats);
} catch (Exception $e) {
$smarty->assign("errorGlobal", $e->getMessage());
}
$paging = new PagingControl("javni_poziv as jp", "jp.id_javni_poziv, jp.naziv, jp.opis, jp.datum_otvaranja, jp.datum_zatvaranja, jp.zatvoren, k.ilustracija as kategorija_ilustracija, k.naziv as kategorija_naziv", "INNER JOIN kategorija_stete k ON jp.id_kategorija_stete = k.id_kategorija_stete ORDER BY jp.zatvoren ASC, jp.datum_otvaranja DESC");
try {
$javniPozivi = $paging->getData();
$smarty->assign("javniPozivi", $javniPozivi);
} catch (Exception $e) {
$smarty->assign("errorGlobal", $e->getMessage());
}
$smarty->display("header.tpl");
$smarty->display("index.tpl");
if (isset($_SESSION["user"]) == false) {
$smarty->assign("loginUser", Prevent::XSS($loginUser));
$smarty->display("login-floating.tpl");
}
if (isset($paging)) {
$paging->displayControls();
}
$smarty->display("footer.tpl");