* @author $Author: aknyazev $ * @version $Revision: 1.7 $ $Date: 2009/05/20 11:26:29 $ **/ include "./include/config.php"; include "./common.php"; include "./include/functions_index.php"; include "./include/functions_common.php"; include "./include/functions_auth.php"; include "./include/functions_xml.php"; include "./include/class.lang.php"; include "./include/class.calendar_event.php"; include "./include/class.info_manager.php"; include "./include/class.info_manager_club.php"; if (isset($_REQUEST["from_install"]) && $_REQUEST["from_install"] == 1) { include "./include/class.news.php"; NewsUpdater(); header("Location: ".$config["server"].$config["site_root"]."/index.php"); } CheckInstallFolder(); $user = auth_index_user(); @$sel = $_POST["sel"]?$_POST["sel"]:$_GET["sel"]; if ($sel!='logoff'){ if ( isset($_COOKIE["re_login"]) && isset($_COOKIE["re_pass"]) ){ $strSQL = "SELECT id FROM ".USERS_TABLE." WHERE login='".addslashes($_COOKIE["re_login"])."' AND password='".addslashes($_COOKIE["re_pass"])."' "; $rs = $dbconn->Execute($strSQL); if ($rs->fields[0]>0){ sess_write(session_id(), $rs->fields[0]); $user = auth_index_user(); } } } else { sess_delete(session_id()); setcookie("re_login", '', time()-7200); setcookie("re_pass", '', time()-7200); } $info_manager = new InfoManager(); //echo $config["default_lang"]; $sections = $info_manager->GetSectionsList($config["default_lang"], "index_info", true); $index_info_array = array(); $i = 1; foreach($sections as $key=>$value) { $index_info_array[$i]["id"] = $value["id"]; $i++; } $smarty->assign("index_info_array", $index_info_array); //print_r($sections); //print_r($index_info_array); if (isset($_REQUEST["info_page"])) { $info_page = $_REQUEST["info_page"]; } else { $info_page = 1; } $smarty->assign("info_page", $info_page); $section = $info_manager->GetSection($index_info_array[$info_page]["id"]); //print_r($section); $smarty->assign("section", $section); $multi_lang = new MultiLang($config, $dbconn); if($user[4]==1 && $sel!='logoff' && !(isset($_REQUEST["view_from_admin"]) && $_REQUEST["view_from_admin"] == 1)){ echo ""; } else { if(intval($user[0]) && $user[3] != 1 && $sel == "" && !(isset($_REQUEST["view_from_admin"]) && $_REQUEST["view_from_admin"] == 1)){ echo ""; } if($user[4]==1 && (isset($_REQUEST["view_from_admin"]) && $_REQUEST["view_from_admin"] == 1)){ if ($_REQUEST["for_unreg_user"] == 1) { $user = auth_guest_read(); } } } switch($sel){ case "logoff": LogoutUser(); break; case "quick_form" : FromQuick(); break; case "info_page": InfoPage(); break; case "info_page1": InfoPage1(); break; default: IndexPage(); } function InfoPage() { global $smarty, $config, $dbconn, $user, $lang, $multi_lang, $REFERENCES; $id = intval($_REQUEST["id"]); $info_page = $id; if ($info_page < 1) $info_page = 1; $text_sections = array( "1" => array("for_seller"=>35, "feedback"=>36), "2" => array("for_seller"=>31, "feedback"=>32), ); $file_name = (isset($_SERVER["PHP_SELF"]))?strtolower(AfterLastSlash($_SERVER["PHP_SELF"])):"index.php"; IndexHomePage('index', "index_1"); CreateMenu('index_top_menu'); CreateMenu('index_user_menu'); CreateMenu('homepage_top_menu'); CreateMenu('homepage_user_menu'); CreateMenu('lang_menu'); CreateMenu('bottom_menu'); CreateMenu('rental_menu'); if (GetSiteSettings("use_pilot_module_banners")) { Banners('info'); } if (!$id) { $rs = $dbconn->Execute("SELECT MIN(id) FROM ".INFO_SECTION_TABLE." WHERE status='1' AND menu_position='index_info' AND language_id='".$config["default_lang"]."'"); $id = $rs->fields[0]; } if (!$id) { header("Location: ".$config["server"].$config["site_root"]."/index.php"); exit(); } $info_manager = new InfoManager(); // get sections list $current_lang_id = (isset($_REQUEST["language_id"]) && !empty($_REQUEST["language_id"])) ? $_REQUEST["language_id"] : $config["default_lang"]; $sections = $info_manager->GetSectionsList($config["default_lang"], "index_info", true); $sections_extra = $info_manager->GetSectionsList($config["default_lang"], "index_extra", true); $smarty->assign("sections", $sections); $smarty->assign("sections_extra", $sections_extra); $smarty->assign("id", $id); $section = $info_manager->GetSection($id); $subsections = $info_manager->GetSubsectionsList($id, true); $smarty->assign("section", $section); $smarty->assign("subsections", $subsections); $for_seller_section = $info_manager->GetSection($text_sections[$current_lang_id]["for_seller"]); $feedback_section = $info_manager->GetSection($text_sections[$current_lang_id]["feedback"]); $smarty->assign("for_seller_section", $for_seller_section); $smarty->assign("feedback_section", $feedback_section); if (strpos($config["index_theme_path"], "/default_theme") != 0){ $smarty->assign("is_default_theme", 1); }else{ $smarty->assign("is_default_theme", 0); } /////news $strSQL = "SELECT id, DATE_FORMAT(date_add,'".$config["date_format"]."') as date_add, news_text, title, news_link, channel_name, channel_link, id_channel, forum_link, url, date_add as date_sort FROM ".NEWS_TABLE." WHERE status='1' AND language_id='".$config["default_lang"]."' GROUP BY id ORDER BY date_sort DESC, id_channel asc LIMIT 0, 2"; $rs = $dbconn->Execute($strSQL); if ($rs->fields[0]>0){ while(!$rs->EOF){ $row = $rs->GetRowAssoc(false); if ($row["id_channel"] != 0) { $row["news_text"] = nl2br(stripslashes($row["news_text"])); } else { // $row["news_text"] = substr(nl2br(stripslashes($row["news_text"])), 0, GetSiteSettings("news_short_length"))."..."; $row["news_text"] = utf8_substr(stripslashes($row["news_text"]), 0, GetSiteSettings("news_short_length"))."..."; } $row["title"] = stripslashes($row["title"]); $row["channel_name"] = stripslashes($row["channel_name"]); if ($row["news_link"] == ''){ if ($row['url'] == '') { $row["news_link"] = $config["server"].$config["site_root"]."/"; $row["news_link"] .= ($row["id_channel"] == 0) ? "news.php?sel=read&news_id=".$row["id"] : ""; } else { $row["news_link"] = $config["server"].$config["site_root"]."/news/".$row['url']."-".$row["id"].".html"; } } if ($row["channel_link"] == ''){ $row["channel_link"] = $config["server"].$config["site_root"]."/"; } $news[] = $row; $rs->MoveNext(); } $smarty->assign("news", $news); } $smarty->display(TrimSlash($config["index_theme_path"])."/index_info_page.tpl"); } function IndexPage(){ global $smarty, $config, $dbconn, $user, $lang, $multi_lang, $REFERENCES; if(isset($_SERVER["PHP_SELF"])) $file_name = strtolower(AfterLastSlash($_SERVER["PHP_SELF"])); else $file_name = "index.php"; IndexHomePage('index'); CreateMenu('index_page_menu'); CreateMenu('index_user_menu'); CreateMenu('lang_menu'); CreateMenu('bottom_menu'); $smarty->assign("add_to_location_back", "http://www.prostomore.ru/quick_search.php?sel=searchn"); if (isset($_REQUEST["back"]) && intval($_REQUEST["back"]) == 1 && isset($_SESSION["quick_search_pars"])) { /** * Load search settings */ $data = $_SESSION["quick_search_pars"]; $used_references = array("realty_type", "description"); foreach ($REFERENCES as $arr) { if (in_array($arr["key"], $used_references)) { $key = $multi_lang->TableKey($arr["spr_table"]); if (!empty($data[$arr["key"]])) { $data[$key] = GetBackData($data[$arr["key"]]); } } } $used_references = array("realty_type", "description"); foreach ($REFERENCES as $arr) { if (in_array($arr["key"], $used_references)) { $smarty->assign($arr["key"], GetRefSearchArray($arr["spr_table"], $arr["val_table"], $data)); } } $search_pref = $data; GetLocationContent($data["country"], $data["region"]); $smarty->assign("search_pref", $search_pref); } else { GetLocationContent(); $used_references = array("realty_type", "description"); foreach ($REFERENCES as $arr) { if (in_array($arr["key"], $used_references)) { $smarty->assign($arr["key"], GetRefSearchArray($arr["spr_table"], $arr["val_table"], '')); } } $data["qsform_more_opt"] = 1; } $day = (isset($search_pref["move_day"]) && $search_pref["move_day"]) ? $search_pref["move_day"] : date("d")+1; $month = (isset($search_pref["move_month"]) && $search_pref["move_month"]) ? $search_pref["move_month"]: date("m"); $year = date("Y"); $smarty->assign("year", GetYearSelect($year, 3, $year+2)); $smarty->assign("day", GetDaySelect($day)); $smarty->assign("month", GetMonthSelect($month)); $smarty->assign("use_search_by_id", GetSiteSettings("use_search_by_id")); unset($_SESSION["quick_search_pars"]); unset($_SESSION["quick_search_arr"]); // Get parametres of showing ads for unregistered users from TABLE_SHOW_ADS_AREA $area_parametres = GetOrderAds("index",0); $smarty->assign("last_ads",1); if ($area_parametres["show_type"] != "off") { GetLastAds("last_ads_num_at_page", 1, "?", $area_parametres["sorter"], $area_parametres["sorter_order"], "", $area_parametres["show_type"], $area_parametres["ads_number"], $file_name, "list"); } $smarty->assign("data", $data); $smarty->assign("area_parametres", $area_parametres); $smarty->assign("from_file", "index"); $smarty->assign("file_name", $file_name); if (strpos($config["index_theme_path"], "/default_theme") != 0){ $smarty->assign("is_default_theme", 1); }else{ $smarty->assign("is_default_theme", 0); } /////news $strSQL = "SELECT id, DATE_FORMAT(date_add,'".$config["date_format"]."') as date_add, news_text, title, news_link, channel_name, channel_link, id_channel, forum_link, url, date_add as date_sort FROM ".NEWS_TABLE." WHERE status='1' AND language_id='".$config["default_lang"]."' ORDER BY date_sort DESC, id_channel asc LIMIT 0, 1"; $rs = $dbconn->Execute($strSQL); $row = $rs->GetRowAssoc(false); $news["id"] = $row["id"]; $news["date_add"] = $row["date_add"]; $news["forum_link"] = $row["forum_link"]; $news["id_channel"] = $row["id_channel"]; if ($news["id_channel"] != 0) { $news["news_text"] = nl2br(stripslashes($row["news_text"])); } else { //$news["news_text"] = utf8_substr(stripslashes($row["news_text"]), 0, GetSiteSettings("news_short_length"))."..."; $news["news_text"] = utf8_substr(strip_tags($row["news_text"]), 0, GetSiteSettings("news_short_length"))."..."; } $news["title"] = stripslashes($row["title"]); $news["channel_name"] = stripslashes($row["channel_name"]); $news["news_link"] = $row["news_link"]; $news["channel_link"] = $row["channel_link"]; if ($news["news_link"] == ''){ if ($row['url'] == '') { $news["news_link"] = $config["server"].$config["site_root"]."/"; $news["news_link"] .= ($row["id_channel"] == 0) ? "news.php?sel=read&news_id=".$row["id"] : ""; } else { $news["news_link"] = $config["server"].$config["site_root"]."/news/".$row['url']."-".$row["id"].".html"; } } if ($news["channel_link"] == ''){ $news["channel_link"] = $config["server"].$config["site_root"]."/"; } $smarty->assign("news", $news); $smarty->display(TrimSlash($config["index_theme_path"])."/arenda_page.tpl"); exit; } function LogoutUser(){ global $smarty, $config, $dbconn, $user; $strSQL = "Delete from ".ACTIVE_SESSIONS_TABLE." where id_user='".$user[0]."' and session='".session_id()."' "; $rs = $dbconn->Execute($strSQL); echo ""; return; } /* function InfoPage1() { global $smarty, $config, $dbconn, $user, $lang, $multi_lang, $REFERENCES; $id = intval($_REQUEST["id"]); $info_page = $id; if ($info_page < 1) $info_page = 1; if(isset($_SERVER["PHP_SELF"])) $file_name = strtolower(AfterLastSlash($_SERVER["PHP_SELF"])); else $file_name = "index.php"; IndexHomePage('index'); CreateMenu('index_page_menu'); CreateMenu('index_user_menu'); CreateMenu('lang_menu'); CreateMenu('bottom_menu'); $info_manager = new InfoManager(); //echo $config["default_lang"]; $sections = $info_manager->GetSectionsList($config["default_lang"], "index_info", true); $index_info_array = array(); $i = 1; foreach($sections as $key=>$value) { $index_info_array[$i]["id"] = $value["id"]; $i++; } $smarty->assign("index_info_array", $index_info_array); //print_r($sections); //print_r($index_info_array); $smarty->assign("info_page", $info_page); $section = $info_manager->GetSection($index_info_array[$info_page]["id"]); //print_r($section); $smarty->assign("section", $section); if (strpos($config["index_theme_path"], "/default_theme") != 0){ $smarty->assign("is_default_theme", 1); }else{ $smarty->assign("is_default_theme", 0); } //$smarty->assign("section_name", "index_info"); $smarty->display(TrimSlash($config["index_theme_path"])."/index_info_page1.tpl"); } */ ?>