define('BASE_HREF', ""); include(BASE_HREF."include/301.php"); include(BASE_HREF."include/ini.php"); include(BASE_HREF."include/lang.php"); // -------------------- Log Out ---------------- if(isset($_REQUEST['logout'])) { session_destroy(); unset($_SESSION); if(isset($_COOKIE['jpid'])) { setcookie("jpid", "", 0, "/"); unset($_COOKIE['jpid']); } } // -------------------- HTTP_POST_VARS ---------------- if((isset($_POST['form']) and is_array($_POST['form'])) or (isset($_POST['s_form']) and is_array($_POST['s_form']))) { $_SESSION['request'] = $_REQUEST; header("HTTP/1.1 301 Moved Permanently"); header ("Location: ".$_SERVER['REQUEST_URI']); exit; } elseif(isset($_SESSION['request'])) { $_REQUEST = $_SESSION['request']; unset($_SESSION['request']); } // ----------------------------------- var init $ps = isset($_REQUEST['ps']) ? (int)$_REQUEST['ps'] : 0; if(isset($_SESSION['set_cookie']) and $_SESSION['set_cookie'] == 'vote') { setcookie('vote', 'true', time()+60*60*24*10); unset($_SESSION['set_cookie']); $_COOKIE['vote'] = true; } if(!isset($_REQUEST['lang']) or !in_array($_REQUEST['lang'], array_keys($language))) $lang = language_default; else $lang = $_REQUEST['lang']; $ini_arr['pr_lang'] = $lang == language_default ? "" : $lang."-"; define('LANG', $lang); unset($lang); if(isset($_REQUEST['page'])) { if($_REQUEST['page'] == "registr" and isset($_SESSION['sess_id'])) $_REQUEST['page'] = "user_data"; $query = "SELECT id, alias, user_only FROM ".prdb."menu WHERE alias='".mysqli_real_escape_string($GLOBALS['dbLink'], $_REQUEST['page'])."'"; $result = mysqli_query($GLOBALS['dbLink'], $query) or die(mysqli_error($GLOBALS['dbLink'])."
".$query); if(mysqli_num_rows($result)) { $row = mysqli_fetch_row($result); if ($row[2] and !isset($_SESSION['sess_id'])) { get_page_id("no-access"); } else { $page_id = $row[0]; $alias = $row[1]; } } else { header("HTTP/1.0 404 Not Found"); get_page_id("page-404"); } } if(!isset($page_id)) { $query = "SELECT ".prdb."menu.id, ".prdb."menu.alias FROM ".prdb."menu, ".prdb."menu_pages WHERE ".prdb."menu.id=".prdb."menu_pages.id AND parent_id=0 ORDER BY p_id LIMIT 0,1"; $result = mysqli_query($GLOBALS['dbLink'], $query) or die(mysqli_error($GLOBALS['dbLink'])."
".$query); if(mysqli_num_rows($result)) { $row = mysqli_fetch_row($result); $page_id = $row[0]; $alias = $row[1]; } else exit($word[LANG][10]); } // ----------------------------------- make page $query = "SELECT parent_id, type, template, name, title, description, keywords, content, lang, comment, page_ini_arr, ".($ini_arr['is_tags'] ? "tags, " : "")." DATE_FORMAT(".prdb."menu.date_in, '%d.%m.%Y %H:%i') AS f_date_in, DATE_FORMAT(".prdb."menu.date_in, '%d.%m.%Y') AS f_date FROM ".prdb."menu, ".prdb."menu_pages, ".prdb."pages WHERE ".prdb."menu.id=".prdb."menu_pages.id AND ".prdb."menu.id='".$page_id."' AND ".prdb."menu.id=".prdb."pages.id"; $result = mysqli_query($GLOBALS['dbLink'], $query) or die(mysqli_error()."
".$query); if(!mysqli_num_rows($result)) { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://jp.test/page-404.htm"); exit; } while($row = mysqli_fetch_assoc($result)) $row_arr[$row['lang']] = $row; if(empty($row_arr[LANG]['content'])) { foreach($language as $key => $value) { if(!empty($row_arr[$key]['content'])) { $row_page = $row_arr[$key]; break; } } } if(!isset($row_page)) { if(isset($row_arr[LANG])) $row_page = $row_arr[LANG]; else $row_page = $row_arr[language_default]; } if(!empty($row_page['page_ini_arr'])) $row_page['ini_arr'] = unserialize($row_page['page_ini_arr']); $content_arr['HEAD'] = ""; $content_arr['FOOT'] = ""; $content_arr['ONLOAD'] = ""; $content_arr['TPL_FILE'] = isset($_REQUEST['prn']) ? "print" : $row_page['template']; $content_arr['TITLE'] = (empty($row_page['title']) ? $row_page['name']." ".$ini_arr['title'.LANG] : $row_page['title']); $content_arr['NAME_SITE'] = $ini_arr['title'.LANG]; $content_arr['DESCRIPTION'] = empty($row_page['description']) ? $ini_arr['description'.LANG] : $row_page['description']; $content_arr['KEYWORDS'] = empty($row_page['keywords']) ? $ini_arr['keywords'.LANG] : $row_page['keywords']; $content_arr['FEED'] = ""; $content_arr['HEADER'] = ""; $content_arr['FOOTER'] = ""; include(BASE_HREF."templates/".USER_TEMPLATE_DIR."tpl_func.php"); $res_str .= "
" . $row_page['content'] . "
"; $is_comment = true; // ------------------------------------- include modules if(isset($TYPE_ARR['news'])) { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/news.php"); } if(isset($TYPE_ARR['vote'])) { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/vote.php"); } if(!empty($content_arr['VOTE'])) $content_arr['VOTE'] = "
".$content_arr['VOTE']; if(isset($_REQUEST['search_query'])) { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/search.php"); } elseif($row_page['type'] == 'list') { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/list.php"); $res_str .= page_list($page_id); } elseif($row_page['type'] == 'people') { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/people.php"); $res_str .= module_people($page_id); } elseif($row_page['type'] == 'form') { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/form.php"); if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'form' and isset($_REQUEST['form']) and is_array($_REQUEST['form'])) $res_str = process_form($_REQUEST['form']); else $res_str .= make_form(); } elseif($row_page['type'] == 'gallery' or $row_page['type'] == 'article') { if($row_page['type'] == 'article') { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/article.php"); } include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/gallery.php"); $res_str .= module_gallery($page_id); } elseif($row_page['type'] == 'vote') { $res_str .= module_vote(); } elseif($row_page['type'] == 'news') { if(isset($_REQUEST['cal_list']) and !empty($_REQUEST['cal_list'])) $res_str = cal_list($_REQUEST['cal_list']); else { $content_arr['FEED'] = ""; $res_str = module_news($ps); } } elseif($row_page['type'] == 'news_1') { if(isset($TYPE_ARR['gallery'])) include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/gallery.php"); $res_str = one_news($ps); } if(isset($MODULE_ARR) and array_key_exists($alias, $MODULE_ARR) and file_exists(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/".$alias.".php")) include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/".$alias.".php"); make_protect_page(); if($ini_arr['is_comment'] and $row_page['comment']) { include(BASE_HREF."templates/".USER_TEMPLATE_DIR."modules/comment.php"); if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'comment' and isset($_REQUEST['form']) and is_array($_REQUEST['form'])) $res_str .= process_comment($_REQUEST['form']); else $res_str .= list_comment().form_comment(); } make_panel_content_arr($page_id); // ----------------------------------- make stat if(isset($_SERVER['REMOTE_ADDR'])) { $is_stat = false; $query = "SELECT COUNT(*) FROM ".prdb."stat WHERE dns='".$_SERVER['REMOTE_ADDR']."' AND DATE_ADD(NOW(), INTERVAL -".(isset($ini_arr['min_stat']) ? $ini_arr['min_stat'] : 10)." MINUTE)".$query); $row = mysqli_fetch_row($result); if(!$row[0]) { $query = "UPDATE ".prdb."menu SET counter=counter+1 WHERE alias='".$alias."'"; $result = mysqli_query($GLOBALS['dbLink'], $query) or die(mysqli_error($GLOBALS['dbLink'])."
".$query); $is_stat = true; } if($is_stat) { $query = "INSERT INTO ".prdb."stat SET alias='".$alias."', date_in=NOW(), dns='".$_SERVER['REMOTE_ADDR']."', referer='".(isset($_SERVER['HTTP_REFERER']) ? mysqli_real_escape_string($GLOBALS['dbLink'], $_SERVER['HTTP_REFERER']) : "")."'"; $result = mysqli_query($GLOBALS['dbLink'], $query) or die(mysqli_error($GLOBALS['dbLink'])."
".$query); } } // ----------------------------------- last if(empty($res_str)) $content_arr['CONTENT'] = "
".$word[LANG][9]."
"; elseif($alias != "home") $content_arr['CONTENT'] = make_main_content($res_str); else $content_arr['CONTENT'] = $res_str; echo make_page(USER_TEMPLATE_DIR, $content_arr); // --------------------------- function