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; } } }
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]]); } }
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', '_'); } }
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; } } }
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; } } }
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; } } }
function get_categories($flows, $category_selected, $ext = true, $sec_flow = 'ctg_id') { $this->result[$flows][$sec_flow] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'Name'), $category_selected, $ext); }
function getDiscountScheme($id) { return XARRAY::arr_to_keyarr(XARRAY::askeyval($this->discount_scheme_tree->GetChildsParam($id, '%', true), 'params'), 'catid', 'discount'); }
function show_webpay($params) { if ($currencies = $this->_common_obj->get_ishop_currency()) { $this->result['data']['webpay_ishop_currency'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($currencies, 'name', 'alias'), $this->result['data']['webpay_ishop_currency']); } }
function load_categories($category_selected) { $this->result['votes_data']['category'] = XHTML::arr_select_opt(XARRAY::arr_to_keyarr($this->_tree->GetChilds(1), 'id', 'basic'), $category_selected, true); }
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; } } }
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; } } }
function show_react_menu($params, $putt_off_called) { global $TMS, $TPA, $REQUEST_ASSOC; $this->prev_start_node = null; if (!$putt_off_called) { return; } $TMS->AddFileSection(Common::get_fmodule_tpl_path($this->_module_name, $params['Template'])); Common::call_common_instance('pages'); $pages = pages_module_common::getInstance(); if ($d = $pages->get_module_by_action($params['CatObjDestination_page'], 'show_catalog_server')) { $ance = $d['params']['showBasicPointId']; } if ($REQUEST_ASSOC['id']) { $id = $this->getIdByBasic($REQUEST_ASSOC['id']); } else { $id = $this->get_requested_basic_id($ance); } if (!$id && $REQUEST_ASSOC['@ancestor']['ancestor']) { $id = $REQUEST_ASSOC['@ancestor']['ancestor']; } $anc = $this->_tree->GetAncestor($id); if ($params['ObjectInRows']) { $this->devide_by_rows = (int) $params['ObjectInRows']; } if ($params['showGroupId'] == $anc) { $category = (int) $id; } else { $this->_tree->GetFullBonesUp($id); $fbu = (array) XARRAY::arr_to_keyarr($this->_tree->FullBonesMas, 'id', 'id'); array_unshift($fbu, 1); $key = array_search($params['showGroupId'], $fbu); if ($key !== false) { $category = $fbu[$key + 1]; } } if (!$category) { $category = $this->menu_builds_from['id']; } $this->_tree->FullBonesMas = null; $obj_type = array('_CATGROUP'); if ($params['ShowObj']) { $obj_type[] = '_CATOBJ'; } $this->_sel_arr = $select_obj_type['obj_type'] = $obj_type; if (!is_array($this->_tree->EXPcache[$category])) { $this->_tree->EXPcache = null; $this->_tree->recursiveChildCollectFast(1, $obj_type, 'ASC', 0, true); $this->_tree->recursiveChildCollect($category, '%', array('obj_type' => $obj_type), 'ASC', '_CATGROUP', $params['Levels']); } $this->menu_ancestor = $this->_tree->getNodeInfo($category); $pages =& pages_module_common::getInstance(); $params['CatObjDestination_page'] = $pages->create_page_path($params['CatObjDestination_page']); $menu =& $this->render_multi_level_menu($this->_tree->EXPcache, $category, $TPA->page_link, 0, $ance); return $menu; }
function load_catgroup_data($parameters) { $node = $this->_tree->getNodeInfo($parameters['group_id']); $this->result['catgroup_data'] = $node['params']; if ($groups = $this->_tree->GetChildsParam($parameters['group_id'], array('Name'), false, array('obj_type' => array('_CATGROUP')))) { $this->result['catgroup_data']['StartGroup'] = XHTML::arr_select_opt(XARRAY::askeyval($groups, 'Name'), $node['params']['StartGroup'], true); } $this->result['catgroup_data']['Basic'] = $node['basic']; $this->currentId = $this->result['catgroup_data']['Property_set']; if ($this->result['catgroup_data']['pset'] = $this->result['catgroup_data']['Property_set']) { $this->property_set_to_properties($this->result['catgroup_data']['pset'], $node['params'], 'properties'); $this->get_property_sets('catgroup_data', 'Property_set', $this->result['catgroup_data']['Property_set']); } if (is_array($this->result['properties'])) { $this->result['catgroup_data'] = array_diff_assoc($this->result['catgroup_data'], $this->result['properties']['props']); } if ($obj_conn_params = XARRAY::arr_to_keyarr($this->_common_obj->getConnectedObjs($parameters['group_id'], true), 'id', 'params')) { $names = XARRAY::arr_to_lev($this->_common_obj->getConnectedObjs($parameters['group_id']), 'id', 'props', 'Name'); while (list($k, $v) = each($obj_conn_params)) { $obj_conn_params[$k]['ConName'] = $names[$v['id']]; } } $this->result['connobjs'] = $obj_conn_params; $this->get_property_sets('catgroup_data', 'Property_set_default', $this->result['catgroup_data']['Property_set_default']); }