Esempio n. 1
0
 function show_logs_on_main_page($xcall = false)
 {
     global $TMS, $_PATH;
     if (!$TMS->isSectionDefined('last_modification')) {
         $lang = Common::get_module_lang('admin', $_SESSION['lang'], 'run');
         $TMS->AddFileSection(Common::translate_to(file($_PATH['PATH_ADM'] . 'tpl/run.html'), $lang));
     }
     if ($logs = logger::getLogs()) {
         Common::call_common_instance('users');
         $users =& users_module_common::getInstance();
         $users_list = XARRAY::arr_to_lev($users->load_users_list(), 'id', 'params', 'Name');
         $mod_list = XARRAY::arr_to_keyarr(admin_mod::get_module_list(), 'name', 'alias');
         $actions = $users->collect_module_actions();
         $lm = '';
         foreach ($logs as $log) {
             if ($action = $actions[$log['module']][$log['action']]) {
                 $log['action'] = $action;
             }
             $log['module'] = $mod_list[$log['module']];
             $log['user'] = $users_list[$log['user_id']];
             $log['time'] = date("d.m.y G:i:s", $log['time']);
             $TMS->AddMassReplace('last_modification', $log);
             if (!$xcall) {
                 $TMS->parseSection('last_modification', true);
             } else {
                 $lm .= $TMS->parseSection('last_modification', false, true);
             }
         }
         if ($xcall) {
             return $lm;
         }
     }
 }
Esempio n. 2
0
 function get_last_comments($params)
 {
     global $TDB;
     if ($params['count']) {
         if ($params["cobj"]) {
             $cobjects = $params["cobj"];
         } else {
             if ($params['treads']) {
                 if ($treads = explode(',', $params['treads'])) {
                     $cobjects = array();
                     foreach ($treads as $tread_id) {
                         if ($tchilds = $this->_tree->getChilds($tread_id)) {
                             $cobjects = array_merge($cobjects, XARRAY::askeyval($tchilds, 'id'));
                         }
                     }
                 }
             }
         }
         if ($cobjects) {
             $params["sl"] ? $offset = strval($params["sl"]) : ($offset = "0");
             $params["asc"] == "DSC" ? $order = '-' : ($order = '');
             $query = 'SELECT * FROM comments WHERE Active=1 AND cid in(' . implode(',', $cobjects) . ') ORDER BY ' . $order . 'date desc LIMIT ' . $offset . ', ' . $params['count'] . ';';
             if ($r = $TDB->get_results($query)) {
                 return $r;
             }
         } else {
             return array();
         }
     }
 }
Esempio n. 3
0
 function show_forms_extra($params)
 {
     $this->obj_tree->GetFullBonesUp($params['formsId']);
     if ($this->obj_tree->FullBonesMas) {
         $params['_Extra'] = $params['showformsName'] = implode('/', XARRAY::arr_to_lev($this->obj_tree->FullBonesMas, 'id', 'params', 'Name'));
     }
     $this->obj_tree->FullBonesMas = null;
     return $params;
 }
Esempio n. 4
0
 function to_currency($params)
 {
     if ($curs = $this->_common_obj->get_ishop_currency()) {
         if (!$curs[$params[1]]) {
             $params[1] = $_SESSION['currency']['name'];
         }
         $curs = XARRAY::arr_to_keyarr($curs, 'name', 'rate');
         return $params[0] * ($curs[$params[2]] / $curs[$params[1]]);
     }
 }
Esempio n. 5
0
 function loadRoles($user_id)
 {
     $roles_scheme = array();
     $node = $this->_tree->GetAncestor($user_id);
     if ($node = $this->_tree->getNodeInfo($node)) {
         if (is_array($roles = explode(':', $node['params']['Roles']))) {
             $ms = array();
             foreach ($roles as $role_id) {
                 if ($maccess = XARRAY::arr_to_lev($this->rolesTree->GetChildsParam($role_id, array('is_accesible'), true), 'basic', 'params', 'is_accesible')) {
                     $ms = array_merge(XARRAY::clear_empty_items($maccess), $ms);
                 }
             }
             return array($roles, $ms);
         }
     }
 }
Esempio n. 6
0
 function get_fields_data($id)
 {
     return XARRAY::arr_to_lev($this->obj_tree->GetChildsParam($id, array('field_value'), true), 'basic', 'params', 'field_value');
 }
Esempio n. 7
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_search_form':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('search', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), null, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('search_server'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection('show_search_form');
                 break;
             case 'search_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection('search_server');
                 break;
         }
     }
 }
Esempio n. 8
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_categories':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['folder'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_categories.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'show_folder_questions':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['folder'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'show_faq_server':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_question.html'));
                 $this->result['action_properties_form']['qTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_category.html'));
                 $this->result['action_properties_form']['cTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $root = $this->_tree->GetChildsParam(1);
                 $this->result['action_properties_form']['root'] = XHTML::arr_select_opt(XARRAY::askeyval($root, 'Name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_selected_category':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_category.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_faq_search':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_search_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_faq_search_server':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['MDestination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_faq_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_search_results.html'));
                 $this->result['action_properties_form']['MTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Esempio n. 9
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_content':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 //включает xlist
                 $this->result['xlist'] = true;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_content');
                 break;
             case 'show_content_announce':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('show_content', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['aTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['show_category_with_link_contents_list'] = Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 //включает xlist
                 $this->result['xlist'] = true;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_content_announce');
                 break;
             case 'show_contents_list':
                 $this->result['action_properties'] = true;
                 $categories = $this->result['Category'] = $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['xTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Category'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), false, true);
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['xlist'] = false;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_contents_list');
                 break;
             case 'show_contentgroups_list':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('content', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('content_server'), 'id', 'params', 'Name'), false, true);
                 //$this->result['xlist']                         =true;
                 $this->lct['action_properties'] = $TMS->parseSection('show_contentgroups_list');
                 break;
             case 'content_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_content.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['xlist'] = false;
                 $this->result['action_template'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection('content_server');
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 break;
         }
     }
 }
Esempio n. 10
0
File: core.php Progetto: umaxfun/x4m
 function buildPage($pagePath, $innerAccess = false)
 {
     global $_PATH;
     global $REQUEST_VARS, $REQUEST_ASSOC, $_COMMON_SITE_CONF;
     $this->_EVM->fire('agregator:start', $pagePath);
     if (!$innerAccess && ($url = $this->rewrite($pagePath))) {
         return $this->buildPage($url, true);
     }
     $this->modules_out = null;
     $this->globalFields = array();
     $_SESSION['pages']['previous_page_path'] = $_SESSION['pages']['current_page_full_path'];
     $_SESSION['pages']['current_page_full_path'] = $pagePath;
     if ($pos = strpos($pagePath, '@')) {
         $_SESSION['pages']['current_page_no_filter'] = substr($pagePath, 0, $pos - 1);
     }
     if (isset($_SESSION['fronted']['enabled'])) {
         $this->frontEditMode = true;
     }
     //отделяем переменные и action
     if (preg_match("/(\\;|\\)|\\'|\"|\\!|\\<|\\>|union)/", urldecode($pagePath))) {
         return false;
     }
     $pathExploded = explode('~', $pagePath);
     $_SESSION['pages']['current_page_path'] = $pathExploded[0];
     if (!isset($pathExploded[1]) && ($pos = strpos($pathExploded[0], '@'))) {
         $pathExploded[1] = substr($pathExploded[0], $pos - 1);
         $pathExploded[0] = substr($pathExploded[0], 0, $pos);
     }
     if (isset($pathExploded[1])) {
         $this->pageParams = $pathExploded[1];
         //разбор переменных GET оформление ассоциативных массивов arrayname/key=value&key1=value
         $this->requestVarsDetect($this->pageParams);
         $_SESSION['pages']['current_get_params'] = substr($this->pageParams, 1 + strpos($this->pageParams, '/'));
     }
     if (isset($pathExploded[0])) {
         if (preg_match('/[0-9a-z_\\-\\/]/', $pathExploded[0])) {
             $treePath = XARRAY::clearEmptyItems(explode('/', $pathExploded[0]), true);
         } else {
             return false;
         }
     }
     /*
      *   action всегда  $REQUEST_VARS[0];
      *  приоритет action из $REQUEST_VARS[0] всегда выше чем у модуля по умолчанию если данное дествие разрешено
      */
     //вызов модуля страниц
     $pages = xCore::moduleFactory('pages.front');
     //    $pages->createTest();
     if (!$pages->getPageIdByPath($pathExploded[0])) {
         return false;
     }
     //кросспост
     if ($_SESSION['POST']) {
         $_POST = $_SESSION['POST'];
         unset($_SESSION['POST']);
     }
     xCore::callCommonInstance('templates');
     $templates = templatesCommon::getInstance();
     if (!$pages->page['params']['Template']) {
         return;
     }
     $templates->refreshMainTpls();
     $this->mainTemplate = $templates->getTpl($pages->page['params']['Template'], HTTP_HOST);
     $slotzCrotch = $pages->getSlotzCrotch($this->mainTemplate['slotz']);
     //добываем модули слотов ветвления
     if (!empty($pages->modulesOrder)) {
         foreach ($pages->modulesOrder as $moduleId => $priority) {
             if ($module = $pages->execModules[$moduleId]) {
                 //всегда 1 экземпляр на уровне factory
                 if (is_object($moduleObject = xCore::moduleFactory($module['params']['Type'] . '.front'))) {
                     $moduleObject->requestActionSet($this->request_action);
                     $moduleTimeStart = Common::getmicrotime();
                     $modulesOut[$moduleId] = $moduleObject->execute($module['params']);
                     $modules_crotch[$mk]['params']['__moduleExecutionTime'] = Common::getmicrotime() - $moduleTimeStart;
                 }
             }
         }
     }
     global $time;
     $y = Common::getmicrotime();
     echo $y - $time . ' modules ready ';
     while (list($slot, $modules) = each($slotzCrotch)) {
         foreach ($modules as $moduleId) {
             if (!$this->frontEditMode) {
                 $this->slotzOut[$slot] .= $modulesOut[$moduleId];
             } else {
                 /*                        while (list($module_id, $mout) = each($out))
                                         {
                                             $out[$module_id] = '<map etime="' . $modules_crotch[$module_id]['_etime'] . '" template="' . $modules_crotch[$module_id]['Template'] . '" alias="' . $modules_crotch[$module_id]['Alias'] . '" mtype="' . $modules_crotch[$module_id]['type'] . '" class="__module" id="_m' . $module_id . '">' . $mout . '</map>';
                                         }
                                         $this->modules_out[$slot] = '<form  alias="' . $tpl_slotz_all[$slot]['SlotAlias'] . '" class="__slot" id="_s' . $tpl_slotz_id[$slot] . '">' . implode('', $out) . '</form>';    
                 */
             }
         }
     }
     /*  if (($this->frontEditMode) && ($tpl_slotz_all))
         {
             //добавляем пустые слоты для FED
             foreach ($tpl_slotz_all as $slot => $source)
             {
                 $this->modules_out[$slot] = '<form alias="' . $tpl_slotz_all[$slot]['SlotAlias'] . '" class="__slot" id="_s' . $tpl_slotz_id[$slot] . '"> </form>';
             }
         }*/
     return true;
 }
Esempio n. 11
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_gallery_list':
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $galleries = $this->_tree->GetChilds(1, 'ASC', 0, 0, '_GALLERY');
                 $sel_galleries = array(array("value" => "", "text" => ""));
                 foreach ($galleries as $gallery) {
                     $node = $this->_tree->GetNodeParam($gallery["id"]);
                     $sel_galleries[] = array("value" => $gallery["id"], "text" => $node["Name"]);
                 }
                 $this->result['action_properties_form']['GalleryStartId'] = $sel_galleries;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers(array('show_gallery_server', 'show_selected_gallery')), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_selected_album':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $pppp = $pages->get_page_module_servers('show_search_results');
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $albums = $this->_tree->GetChilds();
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_from_folder':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('gallery');
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $pppp = $pages->get_page_module_servers('show_search_results');
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $albums = $this->_tree->GetChilds();
                 $this->result['action_properties_form']['GalleryStart'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_gallery_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('gallery');
                 $this->result['xlist'] = null;
                 $this->result['action_properties_form']['MTemplate'] = $this->get_template_list($this->_module_name, array('.show_selected_album.html'));
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_results':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array(''));
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Esempio n. 12
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         switch ($parameters['Action']) {
             case 'show_subscribe_form':
                 $this->result['xlist'] = true;
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['news_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('subscriber_page'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 break;
             case 'subscriber_page':
                 $albums = $this->_tree->GetChilds();
                 $this->result['action_properties_form']['subscribeStart'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = false;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['aTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 break;
         }
     }
 }
Esempio n. 13
0
 function getConnectedObjs($id, $only_params = false)
 {
     static $con_cache;
     if (!$con_cache[$id]) {
         $con_cache[$id] = $this->obj_tree->GetChildsParam($id, '%', true, array('obj_type' => array('_CATCONNOBJ')));
     }
     $c = $con_cache[$id];
     if (!$only_params && $c) {
         $con_ids = XARRAY::arr_to_lev($c, 'id', 'params', 'id');
         if ($con_ids = $this->obj_tree->GetNodesByIdArray($con_ids, null, true)) {
             $c = array();
             while (list($k, $v) = each($con_ids)) {
                 $c[$k] = $this->property_set_to_properties($v['params']['Property_set'], $v, $prefix, true, $this);
             }
         }
     }
     return $c;
 }
Esempio n. 14
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_forms':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $files = Common::get_module_template_list('forms', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Template_group'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Template1'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             default:
                 break;
         }
     }
 }
Esempio n. 15
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_last_comments':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $childs = $this->_tree->GetChildsParam(1, array('Alias'));
                 $childs = XARRAY::askeyval($childs, 'Alias');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), null, true);
                 $this->result['action_properties_form']['treads'] = XHTML::arr_select_opt($childs, null);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Esempio n. 16
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         Common::call_common_instance('pages');
         $pages =& pages_module_common::getInstance();
         if ($this->ishop) {
             $this->result['action_properties_form']['BasketPage'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_ishop_basket'), 'id', 'params', 'Name'), false, true);
             $TMS->parseSection('ishop', true);
         }
         switch ($parameters['Action']) {
             case 'show_level_catmenu':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $this->result['action_properties_form']['Cat_destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 break;
             case 'show_catalog_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html', '.show_object.html', '.show_category.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['CategoryTemplate'] = $tpls;
                 $this->result['action_properties_form']['ObjectTemplate'] = $tpls;
                 $this->result['url_point_xlist'] = true;
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_results':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['ResultTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_search_form':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['SearchTemplate'] = $tpls;
                 $this->result['action_properties_form']['SearchForm'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->search_forms_tree->GetChildsParam(1, '%'), 'Name'), false, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_smart_search_form':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['SearchTemplate'] = $tpls;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_search_results'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_branch_info':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Template'] = $tpls;
                 $this->result['action_properties_form']['SearchForm'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->search_forms_tree->GetChildsParam(1, '%'), 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_filter':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->result['action_properties_form']['FilterTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_comparsion':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['ComparsionTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_category':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['InnerCategoryTemplate'] = $tpls;
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'catalog_filter_results':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $tpls = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['ResultTemplate'] = $tpls;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_react_menu':
                 $this->result['action_properties'] = true;
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['CatObjDestination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_catalog_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list('catalog', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Esempio n. 17
0
 function get_template_list($module_name, $actions)
 {
     $files = Common::get_module_template_list($module_name, $actions);
     $files_aliases = array();
     foreach ($files as $file) {
         for ($i = 0; $i < count($actions); $i++) {
             $file = str_replace($actions[$i], '', $file);
         }
         $files_aliases[] = $file;
     }
     return XHTML::arr_select_opt(XARRAY::combine($files_aliases, $files), $se, true);
 }
Esempio n. 18
0
 public function getPageIdByPath($path)
 {
     global $REQUEST_VARS;
     $treePath = XARRAY::clearEmptyItems(explode('/', $path), true);
     $this->root = $this->_tree->getNodeInfo(1);
     $this->domain = $this->_tree->selectStruct('*')->selectParams('*')->where(array('@basic', '=', HTTP_HOST), array('@ancestor', '=', 1))->run();
     $this->domain = $this->domain[0];
     $langVersions = $this->getLangVersions($this->domain['id']);
     $langVersionsStack = XARRAY::arr_to_keyarr($langVersions, 'id', 'basic');
     if (!$treePath) {
         if (!$this->domain['params']['StartPage']) {
             return;
         }
         //здесь заглушка - по умолчанию должен выбирать первую языковую версию если другое не указано
         $this->langVersion = $langVersions[$langVersionsStack[$this->domain['params']['StartPage']]];
         if (!$this->langVersion['params']['StartPage']) {
             return;
         }
         //здесь заглушка - по умолчанию должен выбирать первую страницу
         $this->page = $this->_tree->getNodeInfo($this->langVersion['params']['StartPage']);
         if ($this->pageFinalPoint() === false) {
             return false;
         } else {
             return true;
         }
     } else {
         if (($lang = array_search($treePath[0], $langVersionsStack) !== false) && $langVersions[$treePath[0]]) {
             $this->langVersion = $langVersions[$treePath[0]];
         } else {
             foreach ($langVersions as $lKey => $lVersion) {
                 if ($this->domain['params']['StartPage'] == $lVersion['id']) {
                     $this->langVersion = $langVersions[$lKey];
                 }
             }
             reset($langVersions);
             if (!$this->langVersion) {
                 $this->langVersion = current($langVersions);
             }
             array_unshift($treePath, $this->langVersion['basic']);
             $this->_commonObj->nativeLangVersion = $this->langVersion['basic'];
         }
         array_unshift($treePath, HTTP_HOST);
         if (!($node = $this->_tree->idByBasicPath($treePath, array('_DOMAIN', '_LVERSION', '_PAGE', '_GROUP'), true))) {
             return false;
         }
         $this->page = $this->_tree->getNodeInfo($node['id']);
         if ($this->page['obj_type'] == '_PAGE') {
             if ($this->_tree->readNodeParam($this->page['ancestor'], 'StartPage') == $this->page['id']) {
                 if (xRegistry::get('TPA')->pathParams) {
                     $pathParams = '/~' . xRegistry::get('TPA')->pathParams;
                 }
                 $this->move_301_permanent(CHOST . '/' . $this->_commonObj->createPagePath($this->page['id'], true) . $pathParams);
             }
         }
         if ($this->pageFinalPoint() === false) {
             return false;
         } else {
             $bones = array_slice($this->page['path'], 3);
             $bones[] = $this->page['id'];
             if (!empty($bones)) {
                 $this->bones = $this->_tree->selectStruct('*')->selectParams('*')->getBasicPath('/', true)->where(array('@id', '=', $bones))->format('keyval', 'id')->run();
             }
             array_unshift($this->bones, $this->langVersion);
             return true;
         }
     }
 }
Esempio n. 19
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_selected_banner':
                 $this->result['action_properties'] = true;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html', '.show_random_banner.html'));
                 $this->result['xlist'] = true;
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_random_banner':
                 $this->result['action_properties'] = true;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html', '.show_selected_banner.html'));
                 $this->result['action_properties']['category'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_banners_from_group':
                 $this->result['action_properties'] = true;
                 $this->result['action_properties_form']['Template'] = $this->get_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties']['category'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
         }
     }
 }
Esempio n. 20
0
 function win2utf($s, $force = false)
 {
     global $_COMMON_SITE_CONF;
     static $Encoding;
     if ($_COMMON_SITE_CONF['site_encoding'] == 'utf-8' && !$force) {
         return $s;
     }
     if (!$force) {
         $force = $_COMMON_SITE_CONF['site_encoding'];
     }
     if (!is_object($Encoding)) {
         $Encoding = new ConvertCharset($force, "utf-8", $Entities);
     }
     if (is_array($s)) {
         XARRAY::array_walk_recursive2($s, 'winutf_recursive', $force);
         return $s;
     }
     if (!($m = $Encoding->Convert($s))) {
         $m = $str;
     }
     return $m;
 }
Esempio n. 21
0
 function get_childs($params)
 {
     if (!$params[0]['obj_type']) {
         $obj_type = array('obj_type' => array('_CATOBJ', '_CATGROUP'));
     }
     if ($nodes = $this->_tree->GetChildsParam($params[0]['id'], '%', true, $obj_type)) {
         switch ($params[0]['as']) {
             case 'options':
                 return XHTML::as_select_opt(XARRAY::arr_to_lev($nodes, 'id', 'params', 'Name'), $params[0]['selected']);
                 break;
             default:
                 return $nodes;
         }
     }
 }
Esempio n. 22
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_level_menu':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('menu', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_level_menu2':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('menu', array('.' . $parameters['Action'] . '.html'));
                 $this->result['xlist'] = true;
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_map':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('menu', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_user_menu':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list('menu', array('.show_level_menu.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 $this->result['action_properties_form']['menu'] = $this->generate_select_umenus();
                 break;
             case 'show_path':
                 $this->result['action_properties'] = true;
                 $TMS->AddFileSection(Common::get_module_tpl($this->_module_name, 'ainterface.html'));
                 $files = Common::get_module_template_list('menu', array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
         }
     }
 }
Esempio n. 23
0
 function get_action_properties($parameters)
 {
     global $TMS, $Adm;
     if (array_key_exists($parameters['Action'], $this->_common_obj->get_actions())) {
         $TMS->AddFileSection($Adm->load_module_tpls($this->_module_name, array(array('tpl_name' => 'ainterface')), true), true);
         switch ($parameters['Action']) {
             case 'show_news_by_author':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 Common::call_common_instance('users');
                 $users =& users_module_common::getInstance();
                 $this->result['action_properties_form']['author_id'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($users->load_users_list(true), 'id', 'params', 'Name'), false, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_interval':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->get_categories('action_properties_form', null, true, 'Category');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_archive':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->get_categories('action_properties_form', null, true, 'Category');
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_categories':
                 $this->result['action_properties'] = true;
                 Common::call_common_instance('pages');
                 $pages =& pages_module_common::getInstance();
                 $this->result['action_properties_form']['Destination_page'] = XHTML::arr_select_opt(XARRAY::arr_to_lev($pages->get_page_module_servers('show_news_server'), 'id', 'params', 'Name'), false, true);
                 $files = Common::get_module_template_list($this->_module_name, array('.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Template'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->result['action_properties_form']['TemplateInterval'] = $this->result['action_properties_form']['Template'];
                 $this->result['action_properties_form']['TemplateSingle'] = $this->result['action_properties_form']['Template'];
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
                 break;
             case 'show_news_server':
                 $this->result['action_properties'] = true;
                 $files = Common::get_module_template_list($this->_module_name, array('.show_news_interval.html', '.' . $parameters['Action'] . '.html'));
                 $this->result['action_properties_form']['Default_action'] = XHTML::arr_select_opt(XARRAY::askeyval($this->_common_obj->get_non_server_actions(), 'front_name'), null, true);
                 $this->result['action_properties_form']['MTemplate'] = XHTML::arr_select_opt(XARRAY::combine($files, $files), $se, true);
                 $this->lct['action_properties'] = $TMS->parseSection($parameters['Action']);
         }
     }
 }
Esempio n. 24
0
 function edit_role($data)
 {
     $modules = Common::get_module_list();
     $this->result['roles_editor']['Name'] = $this->_rolesTree->ReadNodeParam($data['id'], 'Name');
     if ($data['id'] && ($maccess = $this->_rolesTree->GetChildsParam($data['id'], array('is_accesible'), true, array('obj_type' => array('_MODULE'))))) {
         $maccess = XARRAY::arr_to_lev($maccess, 'basic', 'params', 'is_accesible');
         foreach ($modules as $module) {
             $this->result['maccess'][$module['name']] = $maccess[$module['name']] ? 1 : 0;
         }
     } else {
         $this->result['maccess'] = XARRAY::arr_to_keyarr($modules, 'name', '_');
     }
 }
Esempio n. 25
0
 function getDiscountScheme($id)
 {
     return XARRAY::arr_to_keyarr(XARRAY::askeyval($this->discount_scheme_tree->GetChildsParam($id, '%', true), 'params'), 'catid', 'discount');
 }
Esempio n. 26
0
 function build_content($content_id)
 {
     global $TMS;
     $fields = XARRAY::arr_to_lev($this->_tree->GetChildsParam($id, array('field_value'), true), 'basic', 'params', 'field_value');
 }
Esempio n. 27
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');
 }