0) ? intval($_GET['id']) : $_CONFIG['pages']['main_page_id']; /* * zjisteni a overeni id stranky */ $result = mysql_query(" SELECT * FROM pages WHERE id = " .$pageId ." LIMIT 1 "); // pokud stranka existuje if(mysql_num_rows($result) == 1) { $pageInfo = mysql_fetch_array($result); // podivam se jestli existuje nejaka defaultni podrazena stranka, v tom pripade pouziji jeji $pageId if(!is_null($pageInfo['default_child_id'])) { $result = mysql_query(" SELECT * FROM pages WHERE id = " .$pageInfo['default_child_id'] ." AND parent = " .$pageId ." LIMIT 1 "); if(mysql_num_rows($result) == 1) { $pageId = $pageInfo['default_child_id']; $pageInfo = mysql_fetch_array($result); } } } // pokud stranka neexistuje else { $result = mysql_query(" SELECT * FROM pages WHERE id = " .$_CONFIG['pages']['main_page_id'] ." LIMIT 1 "); $pageInfo = mysql_fetch_array($result); $pageId = $_CONFIG['pages']['main_page_id']; } // Pokud je stránka neverjná, tak overim jestli mam pristup if($pageInfo['public'] == '0') { if(isset($_SESSION['id']) && isset($_SESSION['surname']) && isset($_SESSION['first_name'])) { $result = mysql_query(" SELECT * FROM access_list WHERE user_id = " .$_SESSION['id'] ." AND page_id = " .$pageId ." LIMIT 1 "); $userHasAccess = (mysql_num_rows($result) == 1) ? true : false; // pokud má právo na stránku tak zapísu ze se na ni podíval if($userHasAccess) { $sql = "UPDATE access_list SET seen = '1' WHERE user_id = " .$_SESSION['id'] . " AND page_id = " . $pageId ." LIMIT 1"; $result = mysql_query($sql); } } else $userHasAccess = false; } else $userHasAccess = true; // Pokud nemá přístup, tak ho presunu na defaultní stránku if(!$userHasAccess) header("Location:./?id=" .$_CONFIG['pages']['main_page_id']); $pageContent = ""; // ziskani obsahu clanku $pageContent .= getArticle($pageInfo['id']); // ziskani specialniho obsahu stranek (fotogalerie atp...) if(!is_null($pageInfo['include'])) { $pageContent .= getSpecialPageContent($pageInfo['include']); } headerContent($pageInfo['title']); ?>