Beispiel #1
0
 function logout($params)
 {
     global $TMS;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template']));
     unset($SESSION['siteuser']['userdata']);
     $_SESSION['siteuser']['authorized'] = 0;
     unset($_SESSION['siteuser']['usergroup']);
     unset($_SESSION['siteuser']['usergroupName']);
     $TMS->AddMassReplace('fuser_logout', array('fusers_auth_panel' => $this->needauth($params, true)));
     return $TMS->parseSection('fuser_logout');
 }
Beispiel #2
0
 function get_webpay($params)
 {
     global $TMS;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, 'webpay.paysystem.html'));
     $this->_common_obj->paysystems_tree->FindbyBasic(1, 'webpay', true);
     $webpay_data = $this->_common_obj->paysystems_tree->LastResult['params'];
     $webpay_data['cart_items'] = $_SESSION['siteuser']['cart'];
     $webpay_data['wsb_currency_id'] = "BYR";
     $webpay_data['wsb_seed'] = time();
     $_SESSION['siteuser']['webpay_order_num'] = $webpay_data['wsb_order_num'] = $webpay_data['wsb_seed'] . '-' . substr(session_id(), 0, 6);
     //�������� ������������ ������: 124264917411111111ORDER-123456781BYR2195012345678901234567890
     // ��� ������ ��������� 2 (wsb_version = 2)
     $order = $this->_calculate_order();
     $webpay_data['wsb_total'] = $order['sum'];
     $webpay_data['wsb_signature'] = sha1($webpay_data['wsb_seed'] . $webpay_data['wsb_storeid'] . $webpay_data['wsb_order_num'] . $webpay_data['wsb_test'] . $webpay_data['wsb_currency_id'] . $webpay_data['wsb_total'] . $webpay_data['secret_key']);
     // 7a0142975bc660d219b793c650346af7ffce2473
     $TMS->AddMassReplace('webpay', $webpay_data);
     return $TMS->parseSection('webpay');
 }
Beispiel #3
0
 function show_faq_search($params)
 {
     global $TDB, $TMS;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template']));
     $pages =& pages_module_common::getInstance();
     if ($_POST["faqsearch"]) {
         $value = $_POST["faqsearch"];
     } elseif ($_SESSION["faq"]["last_search"]) {
         $value = $_SESSION["faq"]["last_search"];
     } else {
         $value = '';
     }
     $TMS->AddMassReplace('_search_form', array('action' => $pages->create_page_path($params["Destination_page"]), 'value' => $value));
     return $TMS->parseSection('_search_form');
 }
Beispiel #4
0
 function show_basket_status($parameters)
 {
     global $TMS;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $parameters['Template']));
     $pages =& pages_module_common::getInstance();
     $TMS->AddMassReplace('ishop_basket_status', array('cartPageLink' => $pages->create_page_path($parameters['Basket_Page'])));
     $TMS->AddMassReplace('ishop_basket_status', $this->_calculate_order());
     return $TMS->parseSection('ishop_basket_status');
 }
Beispiel #5
0
 function show_banners_from_group($params)
 {
     global $TMS, $TDB, $_PATH;
     $template = Common::get_site_tpl($this->_module_name, $params['Template']);
     $TMS->AddFileSection($template);
     unset($params["Template"]);
     $banners = $this->_tree->GetChilds($params["category"]);
     if (count($banners) > $params["OnPage"] && $params["OnPage"] != 0) {
         if ($params["OnPage"] == 1) {
             $keys = array(array_rand($banners, $params["OnPage"]));
         } else {
             $keys = array_rand($banners, $params["OnPage"]);
         }
     } else {
         $keys = array_keys($banners);
     }
     $buff = '';
     $i = 1;
     foreach ($keys as $key) {
         $params['_num'] = $i++;
         $buff .= $this->show_banner($banners[$key]['id'], $params);
     }
     $TMS->AddReplace('_banner_group', 'buff', $buff);
     $TMS->AddReplace('_banner_group', '_ARES', $_PATH['WEB_PATH_ARES']);
     $this->skip_stats = false;
     return $TMS->parseSection('_banner_group');
 }
Beispiel #6
0
 function show_content($params, $cycl = null)
 {
     global $TMS;
     static $cycles;
     if ($node = $this->_tree->getNodeInfo($params['contentId'])) {
         $this->seoConfirm($node);
         $fd = $this->_common_obj->get_fields_data($params['contentId']);
         if ($params['link']) {
             $fd['link'] = $params['link'];
         }
         $cycles[] = $params['contentId'];
         //Выбор шаблона нестандартного - для анонса или для сервера
         $Template = $params['Template'] ? $params['Template'] : $node['params']['Template'];
         $TMS->delSection('xtr_content');
         $TMS->enableExtendFields(true);
         if (trim($Template)) {
             $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $Template));
             $TMS->AddReplace('xtr_content', 'content_name', $node['basic']);
             if ($TMS->Extended['xtr_content']) {
                 foreach ($TMS->Extended['xtr_content'] as $field_name => $ext) {
                     //здесь рекурсивная сборка статей
                     if ($ext['type'] == 'ARTICLE' && $fd[$field_name]) {
                         //возможно зацикливание статей на вложенности, предотвращаем это
                         if (!in_array($fd[$field_name], $cycles)) {
                             $fd[$field_name] = $this->show_content(array('contentId' => $fd[$field_name]), true);
                             $TMS->delSection('xtr_content');
                             $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $node['params']['Template']));
                         }
                     }
                 }
             }
         }
         if (is_array($fd)) {
             $TMS->AddMassReplace('xtr_content', $fd + array('basic' => $node['basic']));
         }
         //обнуляем буфер цикла
         //отключаем обработку длинных полей
         if (!$cycl) {
             $TMS->enableExtendFields(false);
             $cycles = null;
         }
         $TMS->enableExtendFields(false);
         return $TMS->parseSection('xtr_content');
     }
 }
Beispiel #7
0
 function parse_price_tpl($tpl_file, $is_runtime = false)
 {
     global $TMS;
     $tms = new TMutiSection(true);
     if ($is_runtime) {
         $TMS->AddFileSection(Common::get_module_tpl($this->_module_name, 'edit_price.html'));
     }
     $tms->AddFileSection(Common::get_site_tpl($this->_module_name, $tpl_file));
     if ($tms->Extended) {
         foreach ($tms->Extended['xtr_price'] as $field_name => $ext) {
             switch ($ext['type']) {
                 case 'IMAGE':
                 case 'INPUT':
                     $TMS->AddReplace($ext['type'], '_field_name', $field_name);
                     $TMS->AddMassReplace($ext['type'], $ext);
                     $TMS->ParseSection($ext['type'], true);
                     break;
                 case 'TEXT':
                     $TMS->AddReplace($ext['type'], '_field_name', $field_name);
                     $TMS->AddMassReplace($ext['type'], $ext);
                     $TMS->ParseSection($ext['type'], true);
             }
         }
         $this->result['fields'] = $TMS->ParseSection('fields');
     }
 }
Beispiel #8
0
 function bytag($parameters)
 {
     global $TMS, $REQUEST_ASSOC, $_CONFIG;
     $template = $parameters['TemplateInterval'] ? $parameters['TemplateInterval'] : $parameters['Template'];
     if ((int) $parameters['OnPage'] === 0) {
         $parameters['OnPage'] = $_CONFIG['news']['show_news_per_page'];
     }
     if (!$REQUEST_ASSOC['tag']) {
         $tag = $parameters['tag'];
     } else {
         $tag = $REQUEST_ASSOC['tag'];
     }
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $template));
     if (!($tag = mysql_real_escape_string(urldecode($tag)))) {
         return $TMS->parseSection('news_by_tag_fail');
     }
     $count = $this->get_similar_news($tag, $parameters['OnPage'], 0, false, true);
     if ($count[1]['ncount'] > 0) {
         $news_list = $this->get_similar_news($tag, $parameters['OnPage'], 0);
         $pages =& pages_module_common::getInstance(true);
         if ($parameters['Destination_page']) {
             $news_server_page = $pages->create_page_path($parameters['Destination_page']);
         } else {
             $news_server_page = $TPA->page_link;
         }
         return $this->render_news($news_list, $news_server_page, null, $count[1]['ncount'], $parameters['OnPage']);
     } else {
         return $TMS->parseSection('news_by_tag_fail');
     }
 }
Beispiel #9
0
 function parse_content_tpl($params)
 {
     global $TMS, $Adm;
     $tms = new TMutiSection(true);
     $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'edit_content')), true), true);
     $tms->AddFileSection(Common::get_site_tpl($this->_module_name, $params['tpl_file']));
     if ($tms->Extended) {
         foreach ($tms->Extended['xtr_content'] as $field_name => $ext) {
             switch ($ext['type']) {
                 case 'ARTICLE':
                     if ($cnt = $this->_tree->Search('', true, array('obj_type' => array('_CONTENT', '_CONTENTGROUP')))) {
                         while (list($id, $cntObj) = each($cnt)) {
                             if ($cntObj['obj_type'] == '_CONTENT') {
                                 $cntNew[$id] = $cnt[$cntObj['ancestor']]['basic'] . '/' . $cntObj['basic'];
                             }
                         }
                         if ($cntNew) {
                             asort($cntNew);
                             $articlesList = XHTML::as_select_opt($cntNew);
                         }
                     }
                     $TMS->AddReplace($ext['type'], '_field_initial', $articlesList);
                     $TMS->AddReplace($ext['type'], '_field_name', $field_name);
                     $TMS->AddMassReplace($ext['type'], $ext);
                     $TMS->parseSection($ext['type'], true);
                     break;
                 case 'IMAGE':
                 case 'TEXT':
                 case 'INPUT':
                     $TMS->AddReplace($ext['type'], '_field_name', $field_name);
                     $TMS->AddMassReplace($ext['type'], $ext);
                     $TMS->parseSection($ext['type'], true);
                     break;
             }
         }
         $this->result['fields'] = $TMS->parseSection('fields');
     }
 }
Beispiel #10
0
 function show_search_form($parameters)
 {
     global $TMS;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $parameters['Template']));
     $pages =& pages_module_common::getInstance(true);
     if ($parameters['Destination_page']) {
         $search_server_page = $pages->create_page_path($parameters['Destination_page'], false, 'find');
     }
     $TMS->AddReplace('xtr_search', 'action', $search_server_page);
     return $TMS->parseSection('xtr_search');
 }
Beispiel #11
0
 function show_search_form($params)
 {
     global $TMS, $TPA;
     static $property_sets;
     $psets =& $this->_common_obj->property_sets;
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['SearchTemplate']));
     if ($params["SearchProperty_set"]) {
         $TMS->AddReplace('_catalog_show_search', 'SearchProperty_set', $params["SearchProperty_set"]);
     }
     if ($params["ancestor"]) {
         $TMS->AddReplace('_catalog_show_search', 'ancestor', $params["ancestor"]);
     }
     // ??
     Common::call_common_instance('pages');
     $pages =& pages_module_common::getInstance();
     $cat_action = $pages->create_page_path($params['Destination_page']) . '/~catsearch/';
     $TMS->AddReplace('_catalog_show_search', 'action', $cat_action);
     if (!empty($_POST['search'])) {
         $spack = $_POST['search'];
     } elseif ($_SESSION['catalog']['last_search_form']) {
         $spack = $_SESSION['catalog']['last_search_form'];
     }
     if (is_array($spack)) {
         foreach ($spack as $group => $value) {
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     $fields_values[$group . '_' . $k] = $v;
                 }
             }
         }
     }
     $_SESSION['catalog']['last_search_form'] = $spack;
     $sform = $this->_common_obj->search_forms_tree->GetNodeParam($params["SearchForm"]);
     $TMS->AddReplace('_catalog_show_search', 'SFromName', $sform["Name"]);
     $i = 0;
     if ($sfields = $this->_common_obj->search_forms_tree->GetChildsParam($params['SearchForm'], '%')) {
         foreach ($sfields as $sfid => $sfield) {
             //DebugBreak();
             if (!$property_sets[$sfield['property_set']]) {
                 if (!$psets[$sfield['property_set']]) {
                     $psets[$sfield['property_set']] = $this->_common_obj->get_properties($sfield['property_set']);
                 }
                 $prp = $psets[$sfield['property_set']];
                 if ($prp) {
                     $property_sets[$sfield['property_set']] = array(array_flip(XARRAY::arr_to_lev($prp, 'id', 'params', 'Name')), $prp);
                 } else {
                     $property_sets[$sfield['property_set']] = array();
                 }
             }
             $section = '_catalog_search_' . $sfield['criteria'];
             $psets = $property_sets[$sfield['property_set']][1][$property_sets[$sfield['property_set']][0][$sfield['property']]]['params'];
             if ($psets['catselector']) {
                 $sfield = $sfield + array('catselector' => $psets['catselector']);
             }
             $sfield = $sfield + array('type' => $psets['Type']);
             switch ($sfield['criteria']) {
                 case 'interval':
                     $sfield = $sfield + array('from' => 'search[from][' . $sfield['property'] . ']', 'to' => 'search[to][' . $sfield['property'] . ']', 'from_value' => $fields_values['from_' . $sfield['property']], 'to_value' => $fields_values['to_' . $sfield['property']]);
                     break;
                 case 'larger':
                     $sfield = $sfield + array('input_name' => 'search[from][' . $sfield['property'] . ']', 'value' => $fields_values['from_' . $sfield['property']]);
                     break;
                 case 'less':
                     $sfield = $sfield + array('input_name' => 'search[to][' . $sfield['property'] . ']', 'value' => $fields_values['to_' . $sfield['property']]);
                     break;
                 case 'equal':
                     $evalues = $params["search_objects"][$sfield['property']];
                     if ($evalues) {
                         $sfield['E_values'] = $evalues;
                     }
                     $sfield = $sfield + array('input_name' => 'search[' . $sfield['criteria'] . '][' . $sfield['property'] . ']', 'value' => $fields_values[$sfield['criteria'] . '_' . $sfield['property']]);
                     break;
                 case 'rlike':
                 case 'lrlike':
                 case 'rwords':
                     $sfield = $sfield + array('input_name' => 'search[' . $sfield['criteria'] . '][' . $sfield['property'] . ']', 'value' => $fields_values[$sfield['criteria'] . '_' . $sfield['property']]);
                     break;
             }
             $sfield["_num"] = $i++;
             //DebugBreak();
             $TMS->AddMassReplace($section, $sfield);
             $TMS->parseSection($section, true);
             $TMS->clear_section_fields($section);
         }
     }
     //if ($params[""])$TMS->AddMassReplace('_catalog_show_search', $fields_values);
     $TMS->AddMassReplace('_catalog_show_search', $fields_values);
     return $TMS->parseSection('_catalog_show_search');
 }
Beispiel #12
0
 function catalogExport($params)
 {
     global $TMS, $_PATH;
     $this->_tree->recursiveChildCollect($params['id'], '%', array('obj_type' => array('_CATGROUP', '_CATOBJ')), $order = 'ASC', array('_CATGROUP', '_CATOBJ'));
     $p = array();
     $idc = array($params['id'] => $this->_tree->getNodeInfo($params['id']));
     if ($params['Property_sets']) {
         $p += array('Property_set' => $params['Property_sets']);
     }
     $this->exportSettings = $p;
     if (is_array($this->_tree->EXPcache)) {
         $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template']));
         $this->recursiveExport($params['id'], 1);
         if ($params['encoding'] != 'utf8') {
             $s = XCODE::utf2win($TMS->parseSection('export_head'), $params['encoding']);
         } else {
             $s = $TMS->parseSection('export_head');
         }
         if (XFILES::filewrite($_PATH['PATH_EXPORT'] . $params['filename'], $s)) {
             $this->result['uploadfile'] = $_PATH['WEB_PATH_EXPORT'] . $params['filename'];
         } else {
             $this->result['ERROR'] = 2;
         }
         //cant_write_file
     } else {
         $this->result['ERROR'] = 1;
     }
     //objects not found
 }
Beispiel #13
0
 function show_guestbook($params)
 {
     global $TMS, $TPA, $REQUEST_ASSOC, $TDB;
     $sl = isset($REQUEST_ASSOC['sl']) ? (int) $REQUEST_ASSOC['sl'] : 0;
     $params["sl"] = $sl;
     $node = $this->_tree->getNodeInfo($params["treads"]);
     $cobjects = $this->_tree->GetChilds($params["treads"]);
     $found = $this->_tree->Search(array('CobjectId' => $TPA->page_node["id"], 'Module' => 'pages'), false);
     $cobj = array();
     for ($i = 0; $i < count($found); $i++) {
         for ($j = 0; $j < count($cobjects); $j++) {
             if ($found[$i] == $cobjects[$j]["id"]) {
                 $cobj[] = $found[$i];
                 break;
             }
         }
     }
     if (is_array($cobj) && count($cobj)) {
         $query = 'select count(*) as xcount from comments where Active=1 and cid in (' . implode(',', $cobj) . ');';
         if ($r = $TDB->get_results($query)) {
             $total = (int) $r[1]["xcount"];
         } else {
             $total = 0;
         }
     } else {
         $total = 0;
     }
     $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template']));
     $TMS->AddMassReplace("_send_comment_form", array("tread_id" => $params["treads"], "tread" => $node["basic"], "node_id" => $TPA->page_node["id"]));
     $TMS->AddMassReplace("_guestbook", array("Alias" => $node["params"]["Alias"], "Total" => $total, "Moderation" => $node["params"]["Moderation"], "Captcha" => $node["params"]["Captcha"]));
     if ($total) {
         $comments = $this->get_last_comments($params);
         Common::parse_nav_pages($total, $params["count"], $sl, $TPA->page_link . '/~guestbook');
         foreach ($comments as $comment) {
             $TMS->AddMassReplace('_comment', $comment);
             $TMS->parseSection('_comment', true);
         }
     } else {
         $TMS->parseSection('_empty', true);
     }
     $TMS->parseSection('_send_comment_form', true);
     return $TMS->parseSection('_guestbook');
 }