include("funkcije.php"); $lang = $_GET['lang']; $lng="_en"; $neki="_en"; if ($lang!="en") { $lang="si"; $lng=""; $neki="_slo"; } $page = (int)$_GET['id']; $sub = (int)$_GET['sub']; if ($page==0) { $page=getAtributiStrani(2); } else { $page=getAtributiStrani($page); } if ($sub!=0) { $sub=getAtributiStrani($sub); } else { $firstson = get_last_son($page['stranid']); if ($firstson!=$page['stranid']) { $sub=getAtributiStrani($firstson); } else { $sub=0; } } if (isset($_POST['geslo'])) { if ($_POST['geslo']==$page['geslo']) { $allow=true; $_SESSION['ostroge_allow']=true; } } function getTopMostParent($id) { $host = 'localhost'; $user = 'ostrogeCMS'; $pass = 'CMSostroge1_'; $dbname = 'ostrogeCMS'; $mysqli = new mysqli($host, $user, $pass, $dbname); $mysqli->set_charset("utf8"); $query="SELECT parent FROM stran WHERE stranid = ".$id; $result = $mysqli->query($query); $line=$result->fetch_array(MYSQLI_ASSOC); if ($line['parent']==0) { return $id; } else return getTopMostParent($line['parent']); } $topMostParent = getTopMostParent($page['stranid']); function get_last_son($id) { $host = 'localhost'; $user = 'ostrogeCMS'; $pass = 'CMSostroge1_'; $dbname = 'ostrogeCMS'; $mysqli = new mysqli($host, $user, $pass, $dbname); $mysqli->set_charset("utf8"); $query="SELECT * FROM stran WHERE parent = ".$id." AND deleted = 0 AND skrij = 0 ORDER BY red DESC LIMIT 1"; $result = $mysqli->query($query); if ($line=$result->fetch_array(MYSQLI_ASSOC)) { return $line['stranid']; } else { return $id; } } function get_first_son($id) { $host = 'localhost'; $user = 'ostrogeCMS'; $pass = 'CMSostroge1_'; $dbname = 'ostrogeCMS'; $mysqli = new mysqli($host, $user, $pass, $dbname); $mysqli->set_charset("utf8"); $query="SELECT * FROM stran WHERE parent = ".$id." AND deleted = 0 AND skrij = 0 ORDER BY red ASC LIMIT 1"; $result = $mysqli->query($query); if ($line=$result->fetch_array(MYSQLI_ASSOC)) { return $line['stranid']; } else { return $id; } } function get_proper_slika($topmost) { if ($topmost==1) { return "druscina"; } if ($topmost==3) { return "galerija"; } if ($topmost==11) { return "povezave"; } if ($topmost==12) { return "kontakt"; } } function add_querystring_var($url, $key, $value) { $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); if (strpos($url, '?') === false) { return ($url . '?' . $key . '=' . $value); } else { return ($url . '&' . $key . '=' . $value); } } function remove_querystring_var($url, $key) { $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); return ($url); } ?>