function add_comment_catalog($params) { Common::call_common_instance('catalog'); $catalog = catalog_module_common::getInstance(); $marker = $catalog->obj_tree->ReadNodeParam($params['id'], 'Name'); $this->result["result_code"] = $this->_addcomment(array('CobjectId' => $params['id'], 'tread' => $params['tread'], 'Module' => 'catalog', 'Marker' => $marker), $params['comment']); }
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 show_gallery_list($params) { global $TMS, $REQUEST_ASSOC, $_WEBPATH; Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(); $destination = $pages->create_page_path($params['page']); $TMS->AddFileSection(Common::get_fmodule_tpl_path('gallery', $params['Template'])); $albums = $this->_tree->GetChilds($params["GalleryStartId"]); $album_info = $this->_tree->GetChildsParam($params["GalleryStartId"], array('Name', 'gallery_short', 'thumb_width', 'Avatar', 'isOuterLink', 'info', 'counter', 'basic')); if (!$albums) { return $TMS->parseSection('gallery_empty'); } $sl = $REQUEST_ASSOC['sl'] ? $REQUEST_ASSOC['sl'] : 0; Common::parse_nav_pages(count($albums), $params['count'], $sl, $destination . '/~show_gallery_list'); $i = 0; foreach ($albums as $album) { $id = $album["id"]; $a = $album_info[$id]; $a['basic'] = $album['basic']; $album['basic'] ? $a['link'] = $destination . '/~show_album/' . $album['basic'] : ($a['link'] = $destination . '/~show_album/' . $id); $a['inRow'] = (int) $params["Levels"]; $a['_num'] = $i++; $TMS->AddMassReplace('item', $a); $TMS->parseSection('item', true); } $TMS->AddMassReplace('galleries', $this->_tree->GetNodeParam($params["GalleryStartId"])); return $TMS->parseSection('galleries', true); }
function subscribe($params) { Common::call_common_instance('pages'); $pages = pages_module_common::getInstance(); $params = array_merge($params, $pages->obj_tree->getNodeInfo($params['mod_id'])); $pm = $pages->get_page_modules($params['params']['page'], null, 'subscribe'); reset($pm); $pm = current($pm); $this->result['content'] = $this->subscriber_page(array_merge($params, array('aTemplate' => $pm['params']['aTemplate']))); }
function get_author($id, $type) { if (!$id) { return; } if ($type == 'fusers') { Common::call_common_instance('fusers'); $ci = fusers_module_common::getInstance(); } elseif ($type == 'users') { Common::call_common_instance('users'); $ci = users_module_common::getInstance(); } return $ci->obj_tree->getNodeInfo($id); }
function show_faq_search_server($params) { global $TDB, $TMS, $TPA, $REQUEST_ASSOC; Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(); $TMS->AddFileSection(Common::get_fmodule_tpl_path('faq', $params["MTemplate"])); if (isset($REQUEST_ASSOC['sl'])) { $request = $_SESSION["faq"]["last_search"]; } else { $request = urldecode($_POST["faqsearch"]); } if (!$request) { return $TMS->parseSection('_no_request'); } $_SESSION["faq"]["last_search"] = $request; $words = explode(' ', $request); $OM = array(); $sfields = array('question', 'answer', 'sanswer'); $first = true; foreach ($words as $word) { $value = trim(mysql_real_escape_string($word)); $cond = array(); foreach ($sfields as $sfield) { $cond[] = " `" . $sfield . "` LIKE '%" . $value . "%' "; } $query = "SELECT `id` FROM `faq` WHERE (" . implode('OR', $cond) . ") AND `active`=1;"; $r = $TDB->get_results($query, 'ARRAY_N'); if (!count($r)) { $TMS->AddReplace('_no_results', 'request', $request); return $TMS->parseSection('_no_results'); } $Mas = array(); foreach ($r as $v) { $Mas[] = $v[0]; } if ($first) { $OM = $Mas; } else { $OM = array_intersect($OM, $Mas); } if (!count($OM)) { $TMS->AddReplace('_no_results', 'request', $request); return $TMS->parseSection('_no_results'); } $first = false; } $sl = $REQUEST_ASSOC['sl'] ? (int) $REQUEST_ASSOC['sl'] : 0; $dst = $pages->create_page_path($params["MDestination_page"]); $total = count($OM); if ($params["OnPage"] < $total && $params["OnPage"]) { $OM = array_slice($OM, $sl, $params["OnPage"]); Common::parse_nav_pages($total, $params["OnPage"], $sl, $TPA->page_link . '/~faqsearch'); } $query = "SELECT * FROM `faq` WHERE `id` in ('" . implode("', '", $OM) . "');"; $questions = $TDB->get_results($query); foreach ($questions as $question) { $question["timestamp"] = strtotime($question["date"]); $question["Link"] = $dst . "/~show_question/qid/" . $question["id"]; $question["Destination"] = $dst; $TMS->AddMassReplace('_search_list_item', $question); $TMS->parseSection('_search_list_item', true); } $TMS->AddMassReplace('_faq_search_results', array("total" => $total, "Destination" => $dst)); return $TMS->parseSection('_faq_search_results'); }
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; } } }
function showUserMenu($params) { //global $this->_TMS, $TDB, $TPA; $menu = $TDB->get_results('select pages, header from user_menu where id=' . $params['menu']); $pages = $menu[1]['pages']; $pages1 = explode(',', $pages); $w = array(); $x = array_keys($pages1); $items = $this->_tree->GetNodesByIdArray($pages1); $cur_page_id = $TPA->page_node['id']; $cur_page_basic = $TPA->page_node['basic']; foreach ($x as $x1) { $w[$pages1[$x1]] = $x1; } foreach ($items as $i) { $key = $w[$i['id']]; $arr[$key] = array('id' => $i['id'], 'text' => $i['params']['Name'], 'obj_type' => $i['obj_type'], 'Icon' => $i["params"]["Icon"], 'basic' => $i["basic"], 'Comment' => $i["params"]["Comment"], 'StartPage' => $i["params"]["StartPage"]); } ksort($arr); Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(); $this->_TMS->AddFileSection(Common::get_fmodule_tpl_path('menu', $params['Template'])); $i = 0; $umenu = ''; foreach ($arr as $p) { if ($p['obj_type'] != '_LINK') { $alink = $pages->create_page_path($p['id']); } else { $alink = $items[$p['id']]['params']['Link']; } $selected = ''; if ($p["id"] == $TPA->page_node["id"] || $p['obj_type'] == '_GROUP' && $TPA->page_node['id'] == $p['StartPage']) { $selected = 'selected_'; } $r = array('link' => $alink, 'basic' => $p["basic"], 'caption' => $p['text'], '_num' => $i, 'oddeven' => $i % 2, 'Icon' => $p['Icon'], 'Comment' => $p['Comment']); if ($i == 0 && $this->_TMS->isSectionDefined('_menu_item_first_' . $selected . 'level0')) { $this->_TMS->AddMassReplace('_menu_item_first_' . $selected . 'level0', $r); $umenu .= $this->_TMS->parseSection('_menu_item_first_' . $selected . 'level0'); } elseif ($i == sizeof($arr) - 1 && $this->_TMS->isSectionDefined('_menu_item_last_' . $selected . 'level0')) { $this->_TMS->AddMassReplace('_menu_item_last_' . $selected . 'level0', $r); $umenu .= $this->_TMS->parseSection('_menu_item_last_' . $selected . 'level0'); } else { $this->_TMS->AddMassReplace('_menu_item_middle_' . $selected . 'level0', $r); $umenu .= $this->_TMS->parseSection('_menu_item_middle_' . $selected . 'level0'); } $i++; } $this->_TMS->AddReplace('_menu_main_level0', 'menu_buff', $umenu); $this->_TMS->AddReplace('_menu_main_level0', 'header', $menu[1]['header']); $menu = $this->_TMS->parseSection('_menu_main_level0'); return $menu; }
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; } } }
function load_faqs($parameters) { Common::call_common_instance('faq'); $faq =& faq_module_common::getInstance(true); $r = $faq->obj_tree->GetChildsParam(1, array('Name', 'basic')); $faqs = array(); foreach ($r as $key => $f) { $faqs[] = array("id" => $key, "basic" => $f["basic"]); } $this->result["faqs"] = $faqs; }
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 _add($id, $count = 1, $rq_hash = null, $ishop_ext_data = array(), $prevent_rq_hash = null) { $realid = $id; if ($ishop_ext_data['generate_id_from']) { if ($gi = explode(',', $ishop_ext_data['generate_id_from'])) { foreach ($gi as $g) { $g_text .= $ishop_ext_data[$g]; } $id = md5($g_text); } } if ($prevent_rq_hash) { $rq_hash = $_SESSION['siteuser']['cart'][$id]['hash']; } if (isset($_SESSION['siteuser']['cart'][$id]) && $_SESSION['siteuser']['cart'][$id]['hash'] == $rq_hash) { $_SESSION['siteuser']['cart'][$id]['count'] += $count; //меняем хеш для единичного заказа $_SESSION['siteuser']['cart'][$id]['hash'] = Common::GenerateHash(); } elseif (!$_SESSION['siteuser']['cart'][$id]) { $tunes = $this->_common_obj->get_tunes(); Common::call_common_instance('catalog'); $catalog =& catalog_module_common::getInstance(); if ($cat_node = $catalog->obj_tree->getNodeInfo($realid)) { //$props=$catalog->property_set_to_properties($cat_node['params']['Property_set'],$cat_node,'',true,null,0,true); $props = $catalog->property_set_to_properties($cat_node['params']['Property_set'], $cat_node, '', true); $props['props']['__realid'] = $realid; if ($ishop_ext_data['generate_name_from']) { if ($nm = explode(',', $ishop_ext_data['generate_name_from'])) { foreach ($nm as $n) { $name .= $ishop_ext_data[$n] . ' '; } } $props['props'][$tunes['NameProperty']] = $name; } if ($ishop_ext_data['outer_price']) { $props['props'][$tunes['PriceProperty']] = $ishop_ext_data['outer_price']; } if (strpos($props['props'][$tunes['PriceProperty']], ',') or strpos($props['props'][$tunes['PriceProperty']], ' ')) { $props['props'][$tunes['PriceProperty']] = (double) str_replace(array(',', ' '), array('.', ''), $cat_node['params'][$tunes['PriceProperty']]); } else { $props['props'][$tunes['PriceProperty']] = $cat_node['params'][$tunes['PriceProperty']]; } $_SESSION['siteuser']['cart'][$id]['count'] = $count; $_SESSION['siteuser']['cart'][$id]['hash'] = Common::GenerateHash(); $_SESSION['siteuser']['cart'][$id]['ext_data'] = $ishop_ext_data; $_SESSION['siteuser']['cart'][$id]['details'] = $props; } } }
function load_xlist_link_pages($parameters) { Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(true); $TD = Common::inc_module_factory('TTreeSource'); $options['startNode'] = $parameters['anc_id']; $options['shownodesWithObjType'] = array('_PAGE', '_LINK', '_GROUP', '_ROOT'); $options['columnsAsParameters'] = array('name' => 'Name'); $options['columnsAsStructs'] = array('image' => 'obj_type'); $options['transformResults']['image'] = array('_GROUP' => 'group', '_PAGE' => 'page', '_LINK' => 'page', '_ROOT' => 'group'); $options['selectable'] = array('image' => array('_PAGE', '_LINK', '_GROUP', '_ROOT')); $this->result['data_set'] = null; $TD->init_from_source($pages->obj_tree); $TD->setOptions($options); $TD->CreateView($parameters['anc_id']); $this->result = array_merge_recursive($TD->result, $this->result); }
function price_objects_render($cat_id, $level = 0, $hashed_links = 0, $show_counters = 0, $max_level = 0) { global $TMS, $_PATH, $TPA; $buff = ''; $category = $this->_tree->getNodeInfo($cat_id); $items = $this->_tree->GetChildsParam($cat_id, array('file_name', 'basic', 'LastModified', 'description', 'image', 'hashed_link', 'hash', 'hidden', 'DisableAccess', 'counter'), true); Common::is_module_exists("fusers") ? $fusers_exists = true : ($fusers_exists = false); $session = ENHANCE::get_session(''); $fusers = false; if ($category["params"]["DisableAccess"] && $fusers_exists) { Common::call_common_instance('fusers'); $fusers = fusers_module_common::getInstance(); $found = false; if ($session["siteuser"]["usergroup"]) { $found = $fusers->get_node_rights($cat_id, $this->_module_name, $session["siteuser"]["usergroup"]); } if (!$found) { return $TMS->parseSection('_doc_list_no_access'); } } $TMS->AddReplace('_doc_list_level_' . $level, 'cat_name', $category["basic"]); if ($items != false) { foreach ($items as $item) { if ($item["params"]["hidden"]) { continue; } if ($item["obj_type"] == '_PRICEGROUP') { if ($level < $max_level - 1 || !$max_level) { if ($hashed_links || $category["params"]["hashed_link"]) { $buff .= $this->price_objects_render($item['id'], $level + 1, 1, $show_counters); } else { $buff .= $this->price_objects_render($item['id'], $level + 1, 0, $show_counters); } } continue; } if (!file_exists($f = PATH_ . $item['params']['file_name'])) { $buff .= $TMS->parseSection('_file_not_found'); continue; } if ($item['params']['DisableAccess'] && $fusers_exists) { if (!$fusers) { Common::call_common_instance('fusers'); $fusers = fusers_module_common::getInstance(); } $found = false; if ($session["siteuser"]["usergroup"]) { $found = $fusers->get_node_rights($item['id'], $this->_module_name, $session["siteuser"]["usergroup"]); } if (!$found) { $buff .= $TMS->parseSection('_file_no_access'); } } $stat = stat($f); if ($hashed_links || $item["params"]["hashed_link"] || $category["params"]["hashed_link"]) { $alink = $TPA->page_link . '/~download/link/' . $item["params"]["hash"]; $item['params']['counter'] ? $acounter = $item['params']['counter'] : ($acounter = 0); } else { $alink = $_PATH['WEBPATH_MEDIA'] . $item['params']['file_name']; $acounter = ''; } $TMS->AddMassReplace('_doc_list_item_level_' . $level, array("link" => $alink, "counter" => $acounter, "type" => pathinfo($item['params']['file_name'], PATHINFO_EXTENSION), "caption" => $item['params']['basic'], "image" => $a['image'] = $item['params']['image'], "description" => $item['params']['description'], "time" => date('d.m.Y', $item['params']['LastModified']), "show_counters" => $show_counters, "size" => XFILES::format_size($stat['size']))); $buff .= $TMS->parseSection('_doc_list_item_level_' . $level); } } $TMS->AddReplace("_doc_list_level_" . $level, "buff", $buff); $TMS->AddReplace("_doc_list_level_" . $level, "show_counters", $show_counters); $TMS->AddMassReplace('_doc_list_level_' . $level, $category['params']); $menu = $TMS->parseSection('_doc_list_level_' . $level); return $menu; }
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; } } }
function show_vote($params) { global $TMS, $TDB; $TMS->AddFileSection(Common::get_fmodule_tpl_path('votes', $params['Template'])); $a = $this->_tree->getNodeInfo($params['votesId']); Common::call_common_instance('pages'); if ($a["id"] === null) { return $TMS->parseSection('vote_deleted'); } $pages =& pages_module_common::getInstance(); $link = $pages->create_page_path($params['page']); $a['results_link'] = $link . '/~showvresult/id/' . $params['votesId']; $a['action'] = $link . '/~addvote/id/' . $params['votesId']; if ($this->check_date($a['params']['date1'], $a['params']['date2'])) { $variants = $this->get_variants($params['votesId']); $multi = 0; if ($a['params']['vote_multiple'] == 1) { $rrr = 'check'; $multi = 1; } else { $rrr = 'radio'; } $TMS->AddReplace('multiple', 'value', $multi); $TMS->parseSection('multiple', true); $tmp = ''; foreach ($variants as $v) { $TMS->AddMassReplace($rrr, $v); $tmp .= $TMS->parseSection($rrr); } $TMS->AddReplace('vote', 'inputs', $tmp); if ($a['params']['another_variant'] == 1) { $TMS->AddMassReplace('another_variant_' . $rrr, $v); $tmp = $TMS->parseSection('another_variant_' . $rrr); $TMS->AddReplace('vote', 'another', $tmp); } $TMS->AddMassReplace('vote', $a['params']); $TMS->AddMassReplace('vote', $a); return $TMS->parseSection('vote'); } else { $a['show_results'] = $link . '/~showvresult/id/' . $params['votesId']; $TMS->AddMassReplace('vote_completed', $a); $TMS->AddMassReplace('vote_completed', $a['params']); return $menu = $TMS->parseSection('vote_completed'); } }
function set_access($params) { Common::call_common_instance('fusers'); $fusers = fusers_module_common::getInstance(); if ($params['access']) { unset($params['access']['Name']); $params['access']['AuthRedirId'] = $params['access']['LinkId']; $this->reinit_page($params['id'], '%SAME%', $params['access']); } if ($params['groups']) { if ($results = $fusers->get_node_rights($params['id'], $this->_module_name)) { foreach ($results as $k => $v) { $fusers->obj_tree->DelNode($k); } } foreach ($params['groups'] as $gr_key => $gr_) { if ($gr_) { $fusers->init_scheme_item(str_replace('_', '', $gr_key), array('Module' => 'pages', 'Node' => $params['id'], 'Rights' => 1)); } } } }
function show_content_announce($params) { Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(); $params['Template'] = $params['aTemplate']; $params['link'] = $pages->create_page_path($params['page']) . '/~show_article/cid/' . $params['contentId']; return $this->show_content($params); }
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'); }
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; 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']); } } }
function removeUser($subscribe_id, $email, $params) { global $TDB, $TMS; Common::call_common_instance('pages'); $pages =& pages_module_common::getInstance(); $link = $pages->create_page_path((int) $params['params']['page']); if ($link) { $hash = md5(time()); $query = "SELECT * FROM subscribers_list WHERE email = '" . $email . "'"; if ($results = $TDB->get_results($query)) { $subscribe_id = (int) $params['subscribe_id']; $subscr = $this->_tree->getNodeParam($subscribe_id); $TMS->AddMassReplace('unsubscribe_message', array('link' => $link . '/~complete_unsubscribe/code/' . $hash . '/id/' . $subscribe_id, 'subscribe' => $subscr['basic'])); $message = $TMS->parseSection('unsubscribe_message'); $TMS->AddMassReplace('unsubscribe_message_header', array('subscribe' => $subscr['basic'])); $header = $TMS->parseSection('unsubscribe_message_header'); $this->sendMail($email, $message, $header, $subscr['from']); } $query = "UPDATE subscribers_list SET code = '" . $hash . "' WHERE email = '" . $email . "'"; $TDB->get_results($query); return $TDB->result; } return false; }
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; } } }