Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.64 KB | None | 0 0
  1. <?php
  2.  
  3. function IndexPage( )
  4. {
  5.     global $smarty;
  6.     global $config;
  7.     global $dbconn;
  8.     global $user;
  9.     global $lang;
  10.     global $multi_lang;
  11.     global $REFERENCES;
  12.     global $pilot_theme;
  13.     if ( isset( $_SERVER['PHP_SELF'] ) )
  14.     {
  15.         $file_name = strtolower( afterlastslash( $_SERVER['PHP_SELF'] ) );
  16.     }
  17.     else
  18.     {
  19.         $file_name = "index.php";
  20.     }
  21.     indexhomepage( "index" );
  22.     createmenu( "index_page_menu" );
  23.     createmenu( "index_user_menu" );
  24.     createmenu( "lang_menu" );
  25.     createmenu( "bottom_menu" );
  26.     sendindexcontent( );
  27.     if ( isset( $_REQUEST['back'], $_SESSION['quick_search_pars'] ) )
  28.     {
  29.         $data = $_SESSION['quick_search_pars'];
  30.         $used_references = array( "realty_type", "description" );
  31.         foreach ( $REFERENCES as $arr )
  32.         {
  33.             if ( in_array( $arr['key'], $used_references ) )
  34.             {
  35.                 $$key = $multi_lang->TableKey( $arr['spr_table'] );
  36.                 if ( !empty( $data[$arr['key']] ) )
  37.                 {
  38.                     $data[$$key] = getbackdata( $data[$arr['key']] );
  39.                 }
  40.             }
  41.         }
  42.         $used_references = array( "realty_type", "description" );
  43.         foreach ( $REFERENCES as $arr )
  44.         {
  45.             if ( in_array( $arr['key'], $used_references ) )
  46.             {
  47.                 $smarty->assign( $arr['key'], getrefsearcharray( $arr['spr_table'], $arr['val_table'], $data ) );
  48.             }
  49.         }
  50.         $search_pref = $data;
  51.         getlocationcontent( $data['country'], $data['region'], 1 );
  52.         $smarty->assign( "search_pref", $search_pref );
  53.     }
  54.     else
  55.     {
  56.         getlocationcontent( "", "", 1 );
  57.         $used_references = array( "realty_type", "description" );
  58.         foreach ( $REFERENCES as $arr )
  59.         {
  60.             if ( in_array( $arr['key'], $used_references ) )
  61.             {
  62.                 $smarty->assign( $arr['key'], getrefsearcharray( $arr['spr_table'], $arr['val_table'], "" ) );
  63.             }
  64.         }
  65.         $data['qsform_more_opt'] = 1;
  66.     }
  67.     $day = isset( $search_pref['move_day'] ) && $search_pref['move_day'] ? $search_pref['move_day'] : date( "d" ) + 1;
  68.     $month = isset( $search_pref['move_month'] ) && $search_pref['move_month'] ? $search_pref['move_month'] : date( "m" );
  69.     $smarty->assign( "day", getdayselect( $day ) );
  70.     $smarty->assign( "month", getmonthselect( $month ) );
  71.     $smarty->assign( "use_search_by_id", getsitesettings( "use_search_by_id" ) );
  72.     $smarty->assign( "use_new_location_search", getsitesettings( "use_new_location_search" ) );
  73.     unset( $_SESSION['quick_search_pars'] );
  74.     unset( $_SESSION['quick_search_arr'] );
  75.     $area_parametres = getorderads( "index", 0 );
  76.     $smarty->assign( "last_ads", 1 );
  77.     if ( $area_parametres['show_type'] != "off" )
  78.     {
  79.         getlastads( "last_ads_num_at_page", 1, "?", $area_parametres['sorter'], $area_parametres['sorter_order'], "", $area_parametres['show_type'], $area_parametres['ads_number'], $file_name );
  80.     }
  81.     $_obfuscate_1DvGWVEU6i_ZgGFlc8kIf9Iuy15DFAÿÿ = getsitesettings( array( "use_radius_search", "radius_search_unit", "radius_search_length" ) );
  82.     $_obfuscate_1DvGWVEU6i_ZgGFlc8kIf9Iuy15DFAÿÿ['radius_search_lengths'] = explode( ",", $_obfuscate_1DvGWVEU6i_ZgGFlc8kIf9Iuy15DFAÿÿ['radius_search_length'] );
  83.     asort( &$_obfuscate_1DvGWVEU6i_ZgGFlc8kIf9Iuy15DFAÿÿ['radius_search_lengths'] );
  84.     $smarty->assign( "radius_search_settings", $_obfuscate_1DvGWVEU6i_ZgGFlc8kIf9Iuy15DFAÿÿ );
  85.     $smarty->assign( "data", $data );
  86.     $smarty->assign( "area_parametres", $area_parametres );
  87.     $smarty->assign( "from_file", "index" );
  88.     $smarty->assign( "file_name", $file_name );
  89.     if ( isset( $_GET['index_preview'] ) && $_GET['index_preview'] == "1" )
  90.     {
  91.         $smarty->assign( "colors", $_GET['colors'] );
  92.     }
  93.     if ( getsitesettings( "use_foreign_listings" ) )
  94.     {
  95.         $smarty->assign( "use_foreign_listings", 1 );
  96.     }
  97.     if ( strpos( $config['index_theme_path'], "/default_theme" ) != 0 )
  98.     {
  99.         $smarty->assign( "is_default_theme", 1 );
  100.     }
  101.     else
  102.     {
  103.         $smarty->assign( "is_default_theme", 0 );
  104.     }
  105.     indexnews( );
  106.     $smarty->display( trimslash( $config['index_theme_path'] ).( "/".$pilot_theme."_theme/index_home_page.tpl" ) );
  107.     exit( );
  108. }
  109.  
  110. function LogoutUser( )
  111. {
  112.     global $smarty;
  113.     global $config;
  114.     global $dbconn;
  115.     global $user;
  116.     $_obfuscate_M2poO71n = "Delete from ".ACTIVE_SESSIONS_TABLE." where id_user='".$user[0]."' and session='".session_id( )."' ";
  117.     $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  118.     unset( $_SESSION['return_list'] );
  119.     sess_delete( session_id( ) );
  120.     if ( isset( $_GET['is_admin'] ) && $_GET['is_admin'] == "1" )
  121.     {
  122.         header( "Location: ".$config['server'].$config['site_root']."/admin" );
  123.     }
  124.     else
  125.     {
  126.         if ( isset( $_GET['site_mode_demo'] ) )
  127.         {
  128.             $_obfuscate_M2poO71n = "UPDATE ".SETTINGS_TABLE." SET value='".intval( $_GET['site_mode_demo'] )."' WHERE name='site_mode'";
  129.             $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  130.         }
  131.         echo "<script>location.href='".$config['server'].$config['site_root']."/'</script>";
  132.     }
  133. }
  134.  
  135. function SendIndexContent( )
  136. {
  137.     global $smarty;
  138.     global $config;
  139.     global $dbconn;
  140.     global $user;
  141.     global $lang_code;
  142.     $_obfuscate_EpN1a6ctiykÿ = 0;
  143.     $_obfuscate_YUmJXIi2PTElnUpfLAÿÿ = getsitesettings( "index_theme_path" );
  144.     $_obfuscate_EpN1a6ctiykÿ = gettemplatenumber( );
  145.     $_obfuscate_M2poO71n = "SELECT value FROM ".TEXT_FIELDS_TABLE.( " WHERE name = 'index_text_".$_obfuscate_EpN1a6ctiykÿ."' AND id_lang='{$lang_code}' " );
  146.     $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  147.     if ( $rs && 0 < $rs->RowCount( ) )
  148.     {
  149.         $row = $rs->GetRowAssoc( FALSE );
  150.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['text'] = $row['value'];
  151.     }
  152.     $_obfuscate_9vPNa5OA35W3s41c = getlongsettings( "index_content_".$_obfuscate_EpN1a6ctiykÿ );
  153.     $_obfuscate__WwKzYz1wAÿÿ = ( array )json_decode( $_obfuscate_9vPNa5OA35W3s41c );
  154.     $_obfuscate_9vPNa5OA35W3s41c = array( );
  155.     foreach ( $_obfuscate__WwKzYz1wAÿÿ as $$key => $_obfuscate_VgKtFegÿ )
  156.     {
  157.         $_obfuscate_9vPNa5OA35W3s41c[$$key] = ( array )$_obfuscate_VgKtFegÿ;
  158.     }
  159.     $_obfuscate__WwKzYz1wAÿÿ = $_obfuscate_9vPNa5OA35W3s41c;
  160.     if ( isset( $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['t'] ) )
  161.     {
  162.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['top'] = $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['t'];
  163.     }
  164.     else
  165.     {
  166.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['top'] = 0;
  167.     }
  168.     if ( isset( $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['l'] ) )
  169.     {
  170.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['left'] = $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['l'];
  171.     }
  172.     else
  173.     {
  174.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['top'] = 0;
  175.     }
  176.     if ( isset( $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['i'] ) )
  177.     {
  178.         $_obfuscate_M2poO71n = "SELECT file_name, type, comments FROM ".UPLOADS_TABLE.( " WHERE id='".$_obfuscate__WwKzYz1wAÿÿ[$lang_code]['i']."' " );
  179.     }
  180.     $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  181.     if ( isset( $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['i'] ) )
  182.     {
  183.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['id'] = $_obfuscate__WwKzYz1wAÿÿ[$lang_code]['i'];
  184.     }
  185.     $_obfuscate_MNh1cC6M = array( );
  186.     $_obfuscate_eqN8fuIoty5m7gÿÿ = getsitesettings( "index_image_".$_obfuscate_EpN1a6ctiykÿ );
  187.     $_obfuscate_uuIq4x2Msxi_LBljJHkÿ = explode( "x", $_obfuscate_eqN8fuIoty5m7gÿÿ );
  188.     $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['width'] = $_obfuscate_uuIq4x2Msxi_LBljJHkÿ[0];
  189.     $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['height'] = $_obfuscate_uuIq4x2Msxi_LBljJHkÿ[1];
  190.     if ( $rs && 0 < $rs->RowCount( ) )
  191.     {
  192.         $row = $rs->GetRowAssoc( FALSE );
  193.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['file_name'] = $row['file_name'];
  194.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['comments'] = $row['comments'];
  195.         if ( strstr( $row['type'], "swf" ) )
  196.         {
  197.             $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['type'] = "swf";
  198.         }
  199.         else if ( strstr( $row['type'], "image" ) )
  200.         {
  201.             $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['type'] = "image";
  202.         }
  203.         else if ( strstr( $row['type'], "flv" ) )
  204.         {
  205.             $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['type'] = "flv";
  206.         }
  207.     }
  208.     else
  209.     {
  210.         $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ['file_name'] = "";
  211.     }
  212.     $_obfuscate_31N3jWpbOcMvbnNwlYÿ = getsitesettings( "thems_uploades" );
  213.     $smarty->assign( "thems_uploades", $_obfuscate_31N3jWpbOcMvbnNwlYÿ );
  214.     $smarty->assign( "index_content", $_obfuscate_7u1xl1Rp2lHiCU1IVwÿÿ );
  215.     return TRUE;
  216. }
  217.  
  218. function IndexNews( )
  219. {
  220.     global $smarty;
  221.     global $dbconn;
  222.     global $config;
  223.     $_obfuscate_M2poO71n = " SELECT COUNT(*) FROM ".NEWS_TABLE.( " WHERE status='1' AND language_id='".$config['default_lang']."'" );
  224.     $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  225.     $_obfuscate_rJxwk7vn4KYsybYÿ = $rs->fields[0];
  226.     $_obfuscate_VN4TB6834EeH = " limit 0, 3";
  227.     if ( 0 < $_obfuscate_rJxwk7vn4KYsybYÿ )
  228.     {
  229.         $_obfuscate_M2poO71n = "\tSELECT DISTINCT id, DATE_FORMAT(date_add,'".$config['date_format']."')  as date_add,\r\n\t\t\t\t\ttitle, news_link, id_channel, channel_link\r\n\t\t\t\t\tFROM ".NEWS_TABLE.( " WHERE status='1' AND language_id='".$config['default_lang']."'\r\n\t\t\t\t\tGROUP BY id ORDER BY date_ts desc, id_channel asc " ).$_obfuscate_VN4TB6834EeH;
  230.         $rs = $dbconn->Execute( $_obfuscate_M2poO71n );
  231.         if ( 0 < $rs->fields[0] )
  232.         {
  233.             $i = 0;
  234.             while ( !$rs->EOF )
  235.             {
  236.                 $row = $rs->GetRowAssoc( FALSE );
  237.                 $_obfuscate_PukCuwÿÿ[$i]['id'] = $row['id'];
  238.                 $_obfuscate_PukCuwÿÿ[$i]['date_add'] = $row['date_add'];
  239.                 $_obfuscate_PukCuwÿÿ[$i]['id_channel'] = $row['id_channel'];
  240.                 $_obfuscate_PukCuwÿÿ[$i]['title'] = stripslashes( unicon( $row['title'] ) );
  241.                 $_obfuscate_PukCuwÿÿ[$i]['news_link'] = $row['news_link'];
  242.                 $_obfuscate_PukCuwÿÿ[$i]['channel_link'] = $row['channel_link'];
  243.                 if ( $_obfuscate_PukCuwÿÿ[$i]['news_link'] == "" )
  244.                 {
  245.                     $_obfuscate_PukCuwÿÿ[$i]['news_link'] = $config['server'].$config['site_root']."/";
  246.                     $_obfuscate_PukCuwÿÿ[$i]['news_link'] .= $_obfuscate_PukCuwÿÿ[$i]['id_channel'] == 0 ? "{$file_name}?sel=read&news_id=".$_obfuscate_PukCuwÿÿ[$i]['id'] : "";
  247.                 }
  248.                 if ( $_obfuscate_PukCuwÿÿ[$i]['channel_link'] == "" )
  249.                 {
  250.                     $_obfuscate_PukCuwÿÿ[$i]['channel_link'] = $config['server'].$config['site_root']."/";
  251.                 }
  252.                 $rs->MoveNext( );
  253.                 ++$i;
  254.             }
  255.         }
  256.         $smarty->assign( "news", $_obfuscate_PukCuwÿÿ );
  257.     }
  258. }
  259.  
  260. include( "./include/config.php" );
  261. include( "./common.php" );
  262. include( "./include/functions_index.php" );
  263. include( "./include/functions_auth.php" );
  264. include( "./include/functions_xml.php" );
  265. include( "./include/class.lang.php" );
  266. include( "./include/class.calendar_event.php" );
  267. include( "./include/functions_common.php" );
  268. crontab( );
  269. if ( isset( $_REQUEST['from_install'] ) && $_REQUEST['from_install'] == 1 )
  270. {
  271.     include( "./include/class.news.php" );
  272.     newsupdater( );
  273.     header( "Location: ".$config['server'].$config['site_root']."/index.php" );
  274. }
  275. checkinstallfolder( );
  276. $user = auth_index_user( );
  277. $sel = isset( $_POST['sel'] ) ? $_POST['sel'] : isset( $_GET['sel'] ) ? $_GET['sel'] : "";
  278. if ( $sel != "logoff" )
  279. {
  280.     if ( isset( $_COOKIE['re_login'], $_COOKIE['re_pass'] ) )
  281.     {
  282.         $strSQL = "SELECT id FROM ".USERS_TABLE." WHERE login='".addslashes( $_COOKIE['re_login'] )."' AND password='".addslashes( $_COOKIE['re_pass'] )."' ";
  283.         $rs = $dbconn->Execute( $strSQL );
  284.         if ( 0 < $rs->fields[0] )
  285.         {
  286.             sess_write( session_id( ), $rs->fields[0] );
  287.             $user = auth_index_user( );
  288.         }
  289.     }
  290. }
  291. else
  292. {
  293.     setcookie( "re_login", "", time( ) - 7200, $config['site_root']."/" );
  294.     setcookie( "re_pass", "", time( ) - 7200, $config['site_root']."/" );
  295. }
  296. @$theme = $_POST['theme'] ? $_POST['theme'] : $_GET['theme'];
  297. if ( $theme )
  298. {
  299.     switch ( $theme )
  300.     {
  301.     case "re0" :
  302.         $templates = "re0_theme";
  303.         break;
  304.     case "re1" :
  305.         $templates = "re1_theme";
  306.         break;
  307.     case "re2" :
  308.         $templates = "re2_theme";
  309.         break;
  310.     case "re3" :
  311.         $templates = "re3_theme";
  312.         break;
  313.     case "re4" :
  314.         $templates = "re4_theme";
  315.         break;
  316.         $templates = "re0_theme";
  317.     }
  318.     $strSQL = "UPDATE ".SETTINGS_TABLE.( " SET value='/templates/".$templates."' WHERE name = 'theme_path'" );
  319.     $rs = $dbconn->Execute( $strSQL );
  320.     $strSQL = "UPDATE ".SETTINGS_TABLE.( " SET value='/".$templates."/css' WHERE name = 'index_theme_css_path'" );
  321.     $rs = $dbconn->Execute( $strSQL );
  322.     $strSQL = "UPDATE ".SETTINGS_TABLE.( " SET value='/".$templates."/images' WHERE name = 'index_theme_images_path'" );
  323.     $rs = $dbconn->Execute( $strSQL );
  324.     $smarty->assign( "pilot_theme", $theme );
  325.     $redirect = str_replace( $config['server'].$config['site_root']."/", "", strip_tags( $_GET['redirect'] ) );
  326.     if ( !$redirect )
  327.     {
  328.         $redirect = "index.php";
  329.     }
  330.     header( "Location: ".$config['server'].$config['site_root']."/".$redirect );
  331. }
  332. ( $config, $dbconn );
  333. $multi_lang = new MultiLang( );
  334. if ( ( $user[4] == 1 || isusermoderator( $user[0] ) ) && $sel != "logoff" && ( !isset( $_REQUEST['view_from_admin'] ) && !( $_REQUEST['view_from_admin'] == 1 ) ) )
  335. {
  336.     echo "<script>location.href='".$config['server'].$config['site_root']."/admin/index.php'</script>";
  337. }
  338. else
  339. {
  340.     if ( intval( $user[0] ) && $user[3] != 1 && $sel == "" && ( !isset( $_REQUEST['view_from_admin'] ) && !( $_REQUEST['view_from_admin'] == 1 ) ) )
  341.     {
  342.         if ( getsitesettings( "use_link_modifications" ) )
  343.         {
  344.             echo "<script>location.href='".$config['server'].$config['site_root']."/homepage/'</script>";
  345.         }
  346.         else
  347.         {
  348.             echo "<script>location.href='".$config['server'].$config['site_root']."/homepage.php'</script>";
  349.         }
  350.     }
  351.     if ( $user[4] == 1 && isset( $_REQUEST['view_from_admin'] ) && $_REQUEST['view_from_admin'] == 1 && $_REQUEST['for_unreg_user'] == 1 )
  352.     {
  353.         $user = auth_guest_read( );
  354.     }
  355. }
  356. switch ( $sel )
  357. {
  358. case "logoff" :
  359.     logoutuser( );
  360.     return 1;
  361. case "quick_form" :
  362.     fromquick( );
  363.     return 1;
  364. }
  365. indexpage( );
  366. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement