Minde/Klaidos/JustPageIT/ quest .php
Iš PHP, MySQL.
<?php function get_tree_mas( $setupdata, $lang ) { global $treeclass; if ( $setupdata['tree_cache'] == 0 ) { if ( isset( $setupdata['local_vars']['last_db_update'] ) ) { $last_update_db_time = $setupdata['local_vars']['last_db_update']; } else { $last_update_db_time = $treeclass->get_last_update_db( ); } if ( isset( $setupdata['local_vars']['tree_cache_time'] ) ) { $tree_cache_time = $setupdata['local_vars']['tree_cache_time']; } else { $tree_cache_time = $treeclass->get_tree_cache_time( "guest" ); } if ( isset( $setupdata['cache']['tree']['guest']['type'], $setupdata['cache']['tree']['guest']['path'] ) ) { $cached_tree = $treeclass->get_cached_tree( $setupdata['cache']['tree']['guest']['type'], $setupdata['cache']['tree']['guest']['path'], "guest" ); } else { $cached_tree = $treeclass->get_cached_tree( "0", "0", "guest" ); } if ( $tree_cache_time < $last_update_db_time || !is_array( $cached_tree ) ) { $lang_array1 = $treeclass->gettreetypes( "lang" ); $tree_types = $treeclass->gettreetypes( "tree" ); foreach ( $lang_array1 as $value ) { $treeclass->maketree( 0, strtolower( $value['name'] ), $tree_types, 1 ); $tree_all[strtolower( $value['name'] )] = $treeclass->mas; } if ( isset( $setupdata['cache']['tree']['guest']['type'], $setupdata['cache']['tree']['guest']['path'] ) ) { $treeclass->save_cached_tree( $tree_all, $setupdata['cache']['tree']['guest']['type'], $setupdata['cache']['tree']['guest']['path'], "guest" ); } else { $treeclass->save_cached_tree( $tree_all, "0", "0", "guest" ); } } else { $tree_all = $cached_tree; } } else { $lang_array1 = $treeclass->gettreetypes( "lang" ); $tree_types = $treeclass->gettreetypes( "tree" ); foreach ( $lang_array1 as $value ) { $treeclass->maketree( 0, strtolower( $value['name'] ), $tree_types, 1 ); $tree_all[strtolower( $value['name'] )] = $treeclass->mas; } } while ( !isset( $tree_all[$lang] ) ) { $setupdata['local_vars']['last_db_update'] = $setupdata['local_vars']['tree_cache_time'] + 10000; $tree_all = get_tree_mas( $setupdata, $lang ); } $tree = $tree_all[$lang]; if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { $tree = $tree_all[$lang]; } else { if ( isset( $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $tree = $clientsclass->delete_from_tree_childs_no_permission( $_SESSION['client_login_id'], $tree_all[$lang] ); } else { $tree = $clientsclass->delete_from_tree_childs_no_permission( 0, $tree_all[$lang] ); } } } else { $tree = $tree_all[$lang]; } $tree_array['tree'] = $tree; $tree_array['tree_all'] = $tree_all[$lang]; $tree_array['tree_all_lang'] = $tree_all; return $tree_array; } if ( isset( $_GET['corexajax'] ) ) { $smarty->template_dir = $setupdata['smarty_quest_template_dir']; $smarty->register_object( "ext2", $smarty_ext2 ); $smarty->assign( "_http_path", $setupdata['base_href'] ); $smarty->register_block( "dynamic", "smarty_block_dynamic", false ); $xajax->processrequests( ); $mysqlclass->close_db( ); exit( ); } if ( isset( $setupdata['modules']['siteblocker']['is'] ) && ( $siteblockerclass->get_site_status( ) == 1 || $siteblockerclass->is_site_allow( ) == 1 ) ) { $smarty->template_dir = $setupdata['smarty_admin_template_dir']; $data = $siteblockerclass->get_info( ); $smarty->assign( "data", $data ); $smarty->display( "guest/message.html" ); $mysqlclass->close_db( ); include( $setupdata['core_dir']."/includes/die.php" ); } if ( isset( $setupdata['strip']['guest'] ) ) { if ( $setupdata['strip']['guest'] == "hard" ) { $smarty->register_prefilter( "strip" ); } else if ( $setupdata['strip']['guest'] == "lite" ) { $smarty->load_filter( "pre", "trimwhitespace" ); } } if ( isset( $setupdata['smarty']['output']['guest'] ) && is_array( $setupdata['smarty']['output']['guest'] ) ) { foreach ( $setupdata['smarty']['output']['guest'] as $filter ) { $smarty->load_filter( "output", $filter ); } } $smarty->security = true; $smarty->security_settings = array( "PHP_HANDLING" => false, "PHP_TAGS" => false, "INCLUDE_ANY" => false, "IF_FUNCS" => array( "isset", "count", "is_array" ), "MODIFIER_FUNCS" => array( "urlencode", "urldecode", "htmlspecialchars", "htmlentities", "trim", "stripslashes", "addslashes", "base64_encode", "ucfirst", "strtoupper" ) ); $smarty->secure_dir = array( $setupdata['smarty_guest_template_dir'], $setupdata['smarty_admin_template_dir']."guest" ); include( $setupdata['core_dir']."/includes/setlang.php" ); if ( $_SESSION['lang'] == $setupdata['default_languages'] && !in_array( $_SESSION['lang'], $lang_array2 ) ) { $smarty->template_dir = $setupdata['smarty_admin_template_dir']; $data['text'] = "No current language!"; $data['email'] = "support@justpageit.lt"; $smarty->assign( "data", $data ); $smarty->display( "guest/message.html" ); $mysqlclass->close_db( ); include( $setupdata['core_dir']."/includes/die.php" ); } require( $setupdata['core_dir']."/ext/smarty_ext_guest.php" ); $smarty_ext2 = new smarty_ext_guest( ); $smarty_ext->set_ext2( $smarty_ext2 ); if ( isset( $setupdata['languages_switch'] ) && $setupdata['languages_switch'] == 1 ) { $data['active_langs'] = $treeclass->active_langs; } if ( isset( $setupdata['local_vars']['last_db_update'] ) ) { $setupdata['local_vars']['last_db_update'] = $treeclass->get_last_update_db( ); } if ( isset( $setupdata['cache']['block'], $setupdata['local_vars']['block_cache_time'] ) ) { $setupdata['local_vars']['block_cache_time'] = $treeclass->get_block_cache_time( ); } $treeclass->get_all_blocks( ); if ( !isset( $setupdata['cache']['block']['type'] ) || $setupdata['local_vars']['block_cache_time'] < $setupdata['local_vars']['last_db_update'] ) { $treeclass->get_all_blocks( 1 ); } if ( isset( $_GET['no_info'] ) ) { $no_info = NULL; } else { $no_info = $_GET['no_info']; } if ( $no_info == NULL ) { if ( isset( $_POST['no_info'] ) ) { $no_info = NULL; } else { $no_info = $_POST['no_info']; } } if ( $no_info !== NULL ) { $smarty->template_dir = $setupdata['smarty_guest_template_dir']; $smarty->assign( "_var", $setupdata['vars'] ); $smarty->assign( "_local_var", $setupdata['local_vars'] ); $smarty->register_object( "ext2", $smarty_ext2 ); $smarty->assign( "_http_path", $setupdata['base_href'] ); $_last_update = $treeclass->get_last_update_db( ); $smarty->assign( "_last_update", $_last_update ); $smarty->register_block( "dynamic", "smarty_block_dynamic", false ); $smarty->display( $setupdata['default_quest_template'] ); exit( ); } if ( isset( $setupdata['local_vars']['last_db_update'] ) ) { $last_update_db_time = $setupdata['local_vars']['last_db_update']; } else { $last_update_db_time = $treeclass->get_last_update_db( ); } if ( isset( $setupdata['local_vars']['tree_cache_time'] ) ) { $tree_cache_time = $setupdata['local_vars']['tree_cache_time']; } else { $tree_cache_time = $treeclass->get_tree_cache_time( "guest" ); } if ( isset( $_GET['action'] ) && $_GET['action'] == "error" ) { include( $setupdata['core_dir']."/includes/errors.php" ); } else { if ( isset( $_GET['id'] ) ) { $id = 0; } else { $id = intval( $_GET['id'] ); } if ( $id == 0 ) { unset( $_GET['id'] ); } if ( isset( $id ) && $id != 0 ) { $lang = $treeclass->get_page_lang( $id ); $_SESSION['lang'] = $lang; } $tree = get_tree_mas( $setupdata, $lang ); $tree_all = $tree['tree_all']; $tree_all_lang = $tree['tree_all_lang']; $tree = $tree['tree']; } if ( !isset( $setupdata['not_send_expires_header'] ) || $setupdata['not_send_expires_header'] == 1 || !isset( $_SESSION['client_login_id'] ) || 0 < strlen( $_SESSION['client_login_id'] ) || !isset( $setupdata['smarty_guest_cache'] ) || $setupdata['smarty_guest_cache'] == 1 || $tree_cache_time < $last_update_db_time ) { header( "Date: ".gmdate( "D, d M Y H:i:s", $last_update_db_time )." GMT" ); header( "Last-Modified: ".gmdate( "D, d M Y H:i:s", $last_update_db_time )." GMT" ); header( "X-Powered-By: JustPageIt 1.0" ); header( "Expires: ".gmdate( "D, d M Y H:i:s T", $last_update_db_time - 86400 ) ); } else { if ( $setupdata['tree_cache'] == 0 && $tree_cache_time < $last_update_db_time ) { header( "HTTP/1.1 205 Reset Content" ); } header( "Pragma: cache" ); header( "Cache-Control: private" ); header( "Date: ".gmdate( "D, d M Y H:i:s", $last_update_db_time )." GMT" ); header( "ETag: ".gmdate( "D, d M Y H:i:s", $last_update_db_time )." GMT" ); header( "Last-Modified: ".gmdate( "D, d M Y H:i:s", $last_update_db_time )." GMT" ); header( "X-Powered-By: JustPageIt 2.0" ); header( "Expires: ".gmdate( "D, d M Y H:i:s T", $last_update_db_time + 86400 ) ); } if ( isset( $_GET['id'] ) ) { $id = 0; } else { $id = intval( $_GET['id'] ); } if ( $id == 0 ) { unset( $_GET['id'] ); } if ( isset( $treeclass->active_langs[$lang] ) ) { $id = 0; } if ( isset( $_GET['name'] ) ) { $name = NULL; } else { $name = $_GET['name']; } if ( isset( $_GET['type'] ) ) { $type = NULL; } else { $type = $_GET['type']; } if ( $type == NULL ) { if ( isset( $_POST['type'] ) ) { $type = NULL; } else { $type = $_POST['type']; } } if ( isset( $_GET['show_menu'] ) ) { $show_menu = NULL; } else { $show_menu = $_GET['show_menu']; } if ( isset( $_GET['act'] ) ) { $act = NULL; } else { $act = $_GET['act']; } if ( $act == NULL ) { if ( isset( $_POST['act'] ) ) { $act = NULL; } else { $act = $_POST['act']; } } if ( isset( $_GET['mod'] ) ) { $mod = NULL; } else { $mod = $_GET['mod']; } if ( $mod == NULL ) { if ( isset( $_POST['mod'] ) ) { $mod = NULL; } else { $mod = $_POST['mod']; } } if ( isset( $_GET['form_id'] ) ) { $form_id = NULL; } else { $form_id = $_GET['form_id']; } if ( $form_id == NULL ) { if ( isset( $_POST['form_id'] ) ) { $form_id = NULL; } else { $form_id = $_POST['form_id']; } } if ( isset( $_GET['form_save'] ) ) { $form_save = NULL; } else { $form_save = $_GET['form_save']; } if ( $form_save == NULL ) { if ( isset( $_POST['form_save'] ) ) { $form_save = NULL; } else { $form_save = $_POST['form_save']; } } if ( isset( $_GET['parent'] ) ) { $parent = NULL; } else { $parent = $_GET['parent']; } if ( $parent == NULL ) { if ( isset( $_POST['parent'] ) ) { $parent = NULL; } else { $parent = $_POST['parent']; } } if ( isset( $_GET['query'] ) ) { $query = NULL; } else { $query = $_GET['query']; } if ( $query == NULL ) { if ( isset( $_POST['query'] ) ) { $query = NULL; } else { $query = $_POST['query']; } } if ( isset( $_GET['search_type'] ) ) { $search_type = NULL; } else { $search_type = $_GET['search_type']; } if ( $search_type == NULL ) { if ( isset( $_POST['search_type'] ) ) { $search_type = NULL; } else { $search_type = $_POST['search_type']; } } if ( isset( $_GET['rid'] ) ) { $rid = NULL; } else { $rid = $_GET['rid']; } if ( $rid == NULL ) { if ( isset( $_POST['rid'] ) ) { $rid = NULL; } else { $rid = $_POST['rid']; } } if ( $rid != NULL && isset( $setupdata['modules']['realstate']['is'] ) && file_exists( $setupdata['core_dir']."/modules/realstate/realstate_guest.php" ) ) { include( $setupdata['core_dir']."/modules/realstate/realstate_guest.php" ); } if ( isset( $_GET['pid'] ) ) { $pid = NULL; } else { $pid = $_GET['pid']; } if ( $pid == NULL ) { if ( isset( $_POST['pid'] ) ) { $pid = NULL; } else { $pid = $_POST['pid']; } } if ( $pid != NULL && isset( $setupdata['modules']['shop']['is'] ) && file_exists( $setupdata['core_dir']."/modules/shop/shop_guest.php" ) ) { include( $setupdata['core_dir']."/modules/shop/shop_guest.php" ); } if ( isset( $_GET['cid'] ) ) { $cid = NULL; } else { $cid = $_GET['cid']; } if ( $cid == NULL ) { if ( isset( $_POST['cid'] ) ) { $cid = NULL; } else { $cid = $_POST['cid']; } } if ( $cid != NULL && isset( $setupdata['modules']['contacts']['is'] ) && file_exists( $setupdata['core_dir']."/modules/contacts/contacts_guest.php" ) ) { include( $setupdata['core_dir']."/modules/contacts/contacts_guest.php" ); } if ( isset( $_GET['did'] ) ) { $did = NULL; } else { $did = $_GET['did']; } if ( $did == NULL ) { if ( isset( $_POST['did'] ) ) { $did = NULL; } else { $did = $_POST['did']; } } if ( $did != NULL && isset( $setupdata['modules']['docum']['is'] ) && file_exists( $setupdata['core_dir']."/modules/docum/docum_guest.php" ) ) { include( $setupdata['core_dir']."/modules/docum/docum_guest.php" ); } if ( isset( $_GET['module'] ) ) { $module = NULL; } else { $module = $_GET['module']; } if ( $module == NULL ) { if ( isset( $_POST['module'] ) ) { $module = NULL; } else { $module = $_POST['module']; } } if ( $module != NULL && isset( $setupdata['modules'][$module]['is'], $setupdata['modules']['plugins']['path'] ) && file_exists( $plugin_dir."/modules/".$module."/".$module."_guest.php" ) ) { include( $plugin_dir."/modules/".$module."/".$module."_guest.php" ); } else { if ( $module != NULL && isset( $setupdata['modules'][$module]['is'] ) && file_exists( $setupdata['core_dir']."/modules/".$module."/".$module."_guest.php" ) ) { include( $setupdata['core_dir']."/modules/".$module."/".$module."_guest.php" ); } else { if ( $act == "form_submit" ) { $w_type = ""; if ( $setupdata['captcha'] == "1" ) { if ( !isset( $setupdata['captcha'], $_POST['w_captchacode'] ) || strlen( $_POST['w_captchacode'] ) != 6 || !isset( $_SESSION['captcha'] ) || strlen( $_SESSION['captcha'] ) != 32 ) { $err->adderror( 36 ); $w_type = "error"; } else { $ch1 = md5( "-just-".$_POST['w_captchacode']."-pageit-form-" ); if ( $ch1 != $_SESSION['captcha'] ) { $err->adderror( 36 ); $w_type = "error"; } } } if ( $w_type == "" ) { foreach ( $_POST as $key => $el ) { if ( strpos( $key, "form_data_" ) !== false && strpos( $key, "form_data_" ) == 0 ) { $mail_data[$key] = $el; } else if ( !( strpos( $key, "form_" ) !== false ) || !( strpos( $key, "form_" ) == 0 ) ) { $mail_settings[$key] = $el; } } $form_field_id = $smarty_ext->get_field_id( array( "parent" => $form_id, "name" => "block_form_data" ) ); $form_fields = $treeclass->get_form_elem_data( $form_field_id ); $form_main = $treeclass->get_item_content( $form_id ); $form_valided = true; if ( isset( $_FILES ) && 0 < count( $_FILES ) ) { foreach ( $form_fields as $key => $el ) { if ( !( $form_fields[$key][$key."_req01"]['value'] == "on" ) || !( $form_fields[$key][$key."_type01"]['value'] == "file" ) || isset( $_FILES["form_data_".$key]['error'] ) && $_FILES["form_data_".$key]['error'] == 0 ) { $form_valided = FALSE; } } } if ( $form_valided === FALSE ) { $err->adderror( 23 ); } else { if ( !isset( $form_main['block_form_to']['value'], $form_main['block_form_to']['value'] ) || strlen( $form_main['block_form_to']['value'] ) == 0 || 0 < strlen( $form_main['block_form_to']['value'] ) && isset( $mail_settings['form_to'] ) && $form_main['block_form_to']['value'] == $mail_settings['form_to'] ) { if ( is_array( $form_fields ) && 0 < count( $form_fields ) ) { foreach ( $mail_data as $key => $el ) { $k = substr( $key, 10, 2 ); if ( !( !array_key_exists( $k, $form_fields ) || !isset( $form_fields[$k][$k."_mail01"]['value'] ) || !( $form_fields[$k][$k."_mail01"]['value'] == "on" ) ) ) { continue; } else if ( isset( $mail_settings['form_to'] ) ) { $mail_settings['form_to'] = $el['value']; } else { $mail_settings['form_to'] .= ", ".$el['value']; } } } if ( isset( $_POST['form_no_db'] ) ) { $treeclass->save_form_to_db( $parent, $form_id, $mail_data, $_FILES ); } $smarty->assign( "mail_data", $mail_data ); $smarty->template_dir = $setupdata['smarty_guest_template_dir']; if ( isset( $_POST['form_template'] ) ) { $tempalate = "guest/mail/".$_POST['form_template']; if ( $smarty->template_exists( $tempalate ) ) { $output = $smarty->fetch( $tempalate ); } else { $output = "No html mail template found!"; } } else { $output = "No html mail template found!"; } if ( isset( $_POST['form_template_text'] ) ) { $tempalate = "guest/mail/".$_POST['form_template_text']; if ( $smarty->template_exists( $tempalate ) ) { $output_text = $smarty->fetch( $tempalate ); } else { $output_text = "No text mail template found!"; } } else { $output_text = "No text mail template found!"; } $smarty->clear_assign( "mail_data" ); if ( $mod == "form" ) { if ( isset( $mail_settings['form_from_name'] ) ) { $mail_settings['form_from'] = "\"".trim( $mail_settings['form_from_name'] )."\" <".$mail_settings['form_from'].">"; } if ( isset( $mail_settings['form_to_name'] ) ) { $mail_array = preg_split( "/[\\s,;]+/", $mail_settings['form_to'], -1, PREG_SPLIT_NO_EMPTY ); foreach ( $mail_array as $key => $mail ) { if ( $key == 0 ) { $mail_settings['form_to'] = "\"".trim( $mail_settings['form_to_name'] )."\" <".$mail_array[$key].">"; } else { $mail_settings['form_to'] .= ", ".$mail_array[$key]; } } } } $treeclass->send_form_to_mail( $output, $output_text, $mail_settings, $_FILES ); } } } } else if ( $act == "vote_submit" ) { foreach ( $_POST as $key => $el ) { if ( !( strpos( $key, "vote_data" ) !== false ) || !( strpos( $key, "vote_data" ) == 0 ) ) { if ( isset( $_POST['vote_data'] ) ) { $res = $treeclass->save_vote_to_db( $parent, $_POST['vote_data'] ); } else { $res = 10; } if ( $res != 0 ) { $err->adderror( $res, "vote" ); } else { $treeclass->get_all_blocks( ); if ( isset( $setupdata['cache']['block']['type'] ) && !( $setupdata['local_vars']['block_cache_time'] < $setupdata['local_vars']['last_db_update'] ) ) { $treeclass->get_all_blocks( 1 ); } } } } } else if ( $act == "coments_submit" ) { $w_type = ""; if ( $setupdata['captcha'] == "1" ) { if ( !isset( $setupdata['captcha'], $_POST['w_captchacode'] ) || strlen( $_POST['w_captchacode'] ) != 6 || !isset( $_SESSION['captcha'] ) || strlen( $_SESSION['captcha'] ) != 32 ) { $err->adderror( 36 ); $w_type = "error"; } else { $ch1 = md5( "-just-".$_POST['w_captchacode']."-pageit-form-" ); if ( $ch1 != $_SESSION['captcha'] ) { $err->adderror( 36 ); $w_type = "error"; } } } if ( $w_type == "" ) { $comm_mas = array( ); $comm_type_array = $treeclass->get_comments_fields( $id ); foreach ( $_POST as $key => $el ) { foreach ( $comm_type_array as $k => $field ) { if ( $field['name'] == $key ) { $comm_mas[$key]['name'] = $comm_type_array[$k]['name']; $comm_mas[$key]['type'] = $comm_type_array[$k]['type_of_value']; $comm_mas[$key]['value'] = $el; } } } $treeclass->save_coments_to_db( $parent, $comm_mas ); unset( $comm_mas ); } if ( isset( $_GET['referer'] ) || isset( $_POST['referer'] ) ) { require( $setupdata['core_dir']."/includes/referer.php" ); } else { header( "location: ".$_SERVER['HTTP_REFERER'] ); exit( ); } } if ( $query != NULL && !is_array( $query ) && 0 < strlen( $query ) ) { $data['search'] = $treeclass->tree_search( $query, $search_type ); } else { $data['search'] = ""; } } } $data['path'] = $treeclass->sqlpath( $id ); if ( 0 < $id ) { if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $client_id = $_SESSION['client_login_id']; } else { $client_id = NULL; } if ( $clientsclass->is_client_access_to_page_from_guest( $id, $client_id ) == 1 || isset( $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { if ( 0 < count( $data['path'] ) ) { $data['page'] = $data['path'][count( $data['path'] ) - 1]; if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { $tree = $tree_all; } else if ( isset( $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $tree = $clientsclass->delete_from_tree_childs_no_permission( $_SESSION['client_login_id'], $tree_all ); } else { $tree = $clientsclass->delete_from_tree_childs_no_permission( 0, $tree_all ); } } foreach ( $tree as $tree_stick ) { if ( $tree_stick['id'] == $data['page']['parent'] ) { $data['page']['parent'] = $tree_stick; } } } else { $data['page'] = 0; if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { $tree = $tree_all; } else if ( isset( $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $tree = $clientsclass->delete_from_tree_childs_no_permission( $_SESSION['client_login_id'], $tree_all ); } else { $tree = $clientsclass->delete_from_tree_childs_no_permission( 0, $tree_all ); } } } $data['content'] = $treeclass->get_item_content( $id ); foreach ( $data['content'] as $key => $val ) { $data['content1'][$key] = $val['value']; } $data['elements'] = $treeclass->_get_page_elements_with_content( $id, 1 ); } else { $data['page']['id'] = 0; $data['content'] = array( ); $data['content1'] = array( ); $data['elements'] = array( ); $data['path'] = array( ); if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { $tree = $tree_all; } else { if ( isset( $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $tree = $clientsclass->delete_from_tree_childs_no_permission( $_SESSION['client_login_id'], $tree_all ); } else { $tree = $clientsclass->delete_from_tree_childs_no_permission( 0, $tree_all ); } } } } } else { if ( 0 < count( $data['path'] ) ) { $data['page'] = $data['path'][count( $data['path'] ) - 1]; $tree = $tree_all; foreach ( $tree as $tree_stick ) { if ( $tree_stick['id'] == $data['page']['parent'] ) { $data['page']['parent'] = $tree_stick; } } } else { $data['page'] = 0; $tree = $tree_all; } $data['content'] = $treeclass->get_item_content( $id ); foreach ( $data['content'] as $key => $val ) { $data['content1'][$key] = $val['value']; } $data['elements'] = $treeclass->_get_page_elements_with_content( $id, 1 ); } } else { $data['page']['id'] = 0; if ( $setupdata['modules']['clients']['is'] == 1 ) { if ( isset( $setupdata['modules']['clients']['is'], $clientsclass, $_SESSION['login_user'] ) && 0 < strlen( $_SESSION['login_user'] ) && isset( $_GET['show_blocks'] ) ) { $tree = $tree_all; } else if ( isset( $_SESSION['client_login_id'] ) && 0 < strlen( $_SESSION['client_login_id'] ) ) { $tree = $clientsclass->delete_from_tree_childs_no_permission( $_SESSION['client_login_id'], $tree_all ); } else { $tree = $clientsclass->delete_from_tree_childs_no_permission( 0, $tree_all ); } } } if ( isset( $setupdata['modules']['realstate']['is'], $data['page']['type'], $setupdata['modules']['realstate']['is'] ) ) { $data['rproducts'] = $realstateclass->get_all_products_by_group( $data['content1']['realstate_products_group_id'] ); } if ( isset( $setupdata['modules']['shop']['is'], $data['page']['type'], $setupdata['modules']['shop']['is'] ) ) { $data['products'] = $shopclass->get_all_products_by_group( $data['content1']['shop_products_group_id'] ); } if ( isset( $setupdata['modules']['clients']['is'] ) ) { $client_info = $clientsclass->client_info; if ( !isset( $client_info['main']['id'] ) || $client_info['main']['id'] != $_SESSION['client_login_id'] ) { $clientsclass->get_curent_client_info( ); $client_info = $clientsclass->client_info; } $data['client'] = $client_info; } $data['site'] = $treeclass->_get_site_settings( ); $temp_err = array( ); if ( isset( $_SESSION['errors'] ) ) { $temp_errs = unserialize( $_SESSION['errors'] ); if ( isset( $temp_errs['form_id'] ) ) { $temp_err = $temp_errs['form_id']; unset( $temp_errs['form_id'] ); $_SESSION['errors'] = serialize( $temp_errs ); } else { $temp_err = $temp_errs; } } $data['errors'] = $temp_err; unset( $temp_errs ); unset( $temp_err ); if ( isset( $data['page']['lang'] ) && in_array( $data['page']['lang'], $lang_array2 ) ) { $_SESSION['lang'] = $data['page']['lang']; } if ( isset( $_GET['getxml'] ) ) { $xmlclass->make( $data ); echo $xmlclass->get( ); $mysqlclass->close_db( ); include( $setupdata['core_dir']."/includes/die.php" ); } if ( $is_xajax !== false ) { $xajax->processrequests( ); $smarty->assign( "xajax_javascript", $xajax->getjavascript( "_tvs_system_core_/js/", "xajax.js" ) ); } if ( isset( $_GET['referer'] ) || isset( $_POST['referer'] ) ) { require( $setupdata['core_dir']."/includes/referer.php" ); } else { $smarty->template_dir = $setupdata['smarty_guest_template_dir']; $smarty->assign( "_var", $setupdata['vars'] ); $smarty->assign( "_local_var", $setupdata['local_vars'] ); $smarty->register_object( "ext2", $smarty_ext2 ); $smarty->assign( "tree", $tree ); $smarty->assign( "data", $data ); $smarty->assign( "_http_path", $setupdata['base_href'] ); $_last_update = $treeclass->get_last_update_db( ); if ( isset( $setupdata['local_vars']['last_db_update'] ) ) { $smarty->assign( "_last_update", $setupdata['local_vars']['last_db_update'] ); } else { $smarty->assign( "_last_update", $_last_update ); } if ( !isset( $setupdata['smarty_guest_cache'], $_SESSION['client_login_id'] ) || strlen( $_SESSION['client_login_id'] ) == 0 ) { $smarty->caching = true; $cook = $_COOKIE; foreach ( $_COOKIE as $key => $COOKIE ) { if ( strpos( $key, "vote_cookie_" ) !== false ) { unset( $cook[$key] ); } } if ( isset( $cook['tvs_session_id'] ) ) { unset( $cook['tvs_session_id'] ); } if ( isset( $cook['interface_lang'] ) ) { unset( $cook['interface_lang'] ); } if ( isset( $cook['shop_id'] ) ) { unset( $cook['shop_id'] ); } if ( isset( $cook['login_username'] ) ) { unset( $cook['login_username'] ); } if ( isset( $_SESSION['errors'] ) ) { $error = $_SESSION['errors']; } else { $error = ""; } $cache_id = md5( serialize( array( $_SERVER['REQUEST_URI'], $_GET, $_POST, $cook, $error ) ) ); if ( !isset( $setupdata['local_vars']['smarty_caching_time'] ) || $setupdata['local_vars']['smarty_caching_time'] < $setupdata['local_vars']['last_db_update'] ) { if ( $_SERVER['REMOTE_ADDR'] == "195.14.168.190" ) { $smarty->clear_all_cache( 1 ); } else { $smarty->clear_all_cache( ); } $sql = $mysqlclass->mysql_my_query( "SELECT * FROM `".$setupdata['table_prefix']."local_vars` WHERE `name`='smarty_caching_time'", 562, __FILE__ ); if ( $mysqlclass->mysql_my_num_rows( $sql ) == 0 ) { $sql = $mysqlclass->mysql_my_query( "INSERT INTO `".$setupdata['table_prefix']."local_vars` ( `id` , `name` , `value` ) VALUES ('', 'smarty_caching_time', '".time( )."')", 563, __FILE__ ); } else { $sql = $mysqlclass->mysql_my_query( "UPDATE `".$setupdata['table_prefix']."local_vars` SET `value`='".time( )."' WHERE `name` = 'smarty_caching_time'", 564, __FILE__ ); } } $smarty->caching = true; if ( isset( $_POST['module'] ) && $_POST['module'] == "shop_cart" ) { $smarty->cache_modified_check = true; } $smarty->register_block( "dynamic", "smarty_block_dynamic", false ); $smarty->display( $setupdata['default_quest_template'], $cache_id ); } else { $smarty->caching = false; if ( !isset( $setupdata['smarty_guest_cache'] ) || $setupdata['smarty_guest_cache'] == 1 ) { if ( $_SERVER['REMOTE_ADDR'] == "195.14.168.190" ) { $smarty->clear_all_cache( 2 ); } else { $smarty->clear_all_cache( ); } } $smarty->register_block( "dynamic", "smarty_block_dynamic", false ); $smarty->display( $setupdata['default_quest_template'] ); } } unset( $tree_all ); unset( $tree ); unset( $data ); $err->deleteerrorsession( ); ?>