/** * Select main settings * * @access public * @return array */ public function get_settings() { $this->db->cache_on(); $this->db->where('s_name', 'main'); $query = $this->db->get('settings', 1); if ($query->num_rows() == 1) { $arr = $query->row_array(); $lang_arr = get_main_lang(); $meta = $this->db->where('lang_ident', $lang_arr['id'])->limit(1)->get('settings_i18n')->result_array(); $arr['site_short_title'] = $meta[0]['short_name']; $arr['site_title'] = $meta[0]['name']; $arr['site_description'] = $meta[0]['description']; $arr['site_keywords'] = $meta[0]['keywords']; $this->db->cache_off(); return $arr; } $this->db->cache_off(); return FALSE; }
function get_page($id) { $lang_id = get_main_lang('id'); $lang_identif = get_main_lang('identif'); /* @var $ci MY_Controller */ $ci =& get_instance(); $ci->db->limit(1); $ci->db->select('CONCAT_WS("", content.cat_url, content.url) as full_url, content.id, content.title, prev_text, publish_date, showed, comments_count, author', FALSE); if ($lang_identif == $ci->uri->segment(1)) { $ci->db->where('lang_alias', $id); $ci->db->where('lang', $lang_id); } else { $ci->db->where('id', $id); } $query = $ci->db->get('content'); if ($query->num_rows() == 1) { return $query->row_array(); } return FALSE; }
/** * Select main settings * * @access public * @return array */ public function get_settings() { //$this->db->cache_on(); //!!! Відключив через кешування запитів і повернення неправильних даних $this->db->where('s_name', 'main'); $query = $this->db->get('settings', 1); if ($query and $query->num_rows() == 1) { $arr = $query->row_array(); $lang_arr = get_main_lang(); $meta = $this->db->where('lang_ident', $lang_arr['id'])->limit(1)->get('settings_i18n')->result_array(); $arr['site_short_title'] = $meta[0]['short_name']; $arr['site_title'] = $meta[0]['name']; $arr['site_description'] = $meta[0]['description']; $arr['site_keywords'] = $meta[0]['keywords']; $this->db->cache_off(); return $arr; } else { show_error($this->db->_error_message()); } $this->db->cache_off(); return FALSE; }
* ============================================================================ * 网站地址: http://www.beescms.com * 您只能在不用于商业目的的前提下对程序代码进行修改和使用; * 不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ */ if (!file_exists("../data/install.lock") || !file_exists("../data/confing.php")) { header("location:../install/index.php"); exit; } define('CMS', true); require_once '../includes/init.php'; require_once '../includes/fun.php'; require_once '../includes/lib.php'; $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : 'book'; $lang = isset($_REQUEST['lang']) ? htmlspecialchars(fl_value($_REQUEST['lang'])) : get_main_lang(); if (file_exists(LANG_PATH . 'lang_' . $lang . '.php')) { include LANG_PATH . 'lang_' . $lang . '.php'; } //语言包缓存,数组$language if (file_exists(DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php')) { include DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php'; } //当前语言下的栏目 $_confing = get_confing($lang); $tpl->template_dir = TP_PATH . $_confing['web_template'] . '/'; //模板路径 $tpl->template_lang = $lang; //语言 $tpl->template_is_cache = 0; //缓存
/** * Recursive function to display menu ul list * TODO: Rewrite this part of code to display valid html list * * @param array $menu_array * @access public */ public function display_menu($menu_array) { $array_keys = array_keys($menu_array); $start_index = $array_keys[0]; $end_index = $array_keys[count($array_keys) - 1]; foreach ($menu_array as $item) { if (!$item['hidden']) { $arranged_items_count = count($this->arranged_menu_array); $this->arranged_menu_array[$arranged_items_count]['level'] = $this->cur_level; $this->arranged_menu_array[$arranged_items_count]['tpl'] = $item['tpl']; // Translate title if (isset($item['lang_title_' . $this->config->item('cur_lang')])) { $item['title'] = $item['lang_title_' . $this->config->item('cur_lang')]; } if ($item['item_type'] != 'url') { $site_url = site_url($item['link']); } else { $site_url = $item['link']; } if ($this->activate_by_sub_urls === TRUE) { $exp = explode('/', trim_slashes($this->uri->uri_string())); $exp2 = explode('/', trim_slashes($item['link'])); $matches = 0; foreach ($exp2 as $k => $v) { if ($v == $exp[$k]) { $matches++; } } if ($matches == count($exp2)) { $active_cur = TRUE; } else { $active_cur = FALSE; } } if ($this->cur_level < $item['expand_level']) { $this->expand[$item['id']] = TRUE; } // to expand tree if ($site_url == $this->current_uri or $active_cur === TRUE) { $this->expand[$item['id']] = TRUE; $is_active = TRUE; $this->arranged_menu_array[$arranged_items_count]['is_active'] = TRUE; } else { // Make link active if link is / and no segments in url // if ($item['link'] == '/' AND $this->uri->total_segments() == 0) { if ($item['link'] == '/' and get_main_lang('identif') == $this->uri->segment(1) and $this->uri->total_segments() == 1 or $item['link'] == '/' and get_main_lang('identif') != $this->uri->segment(1) and $this->uri->total_segments() == 0 or $item['item_type'] == 'url' and $item['link'] != '/' and strstr($_SERVER['REQUEST_URI'], $item['link'])) { $is_active = TRUE; $this->arranged_menu_array[$arranged_items_count]['is_active'] = TRUE; } else { $is_active = FALSE; $this->arranged_menu_array[$arranged_items_count]['is_active'] = FALSE; } } //$item['item_type'] == 'url' ? $href = $item['link'] : $href = site_url($item['link']); //echo $item['item_type']; if ($item['item_type'] == 'url' && strstr($item['link'], 'http://') or $item['item_type'] == 'url' && strstr($item['link'], 'www')) { $href = $item['link']; } else { $href = rtrim(site_url($item['link']), '/'); } $this->arranged_menu_array[$arranged_items_count]['link'] = $href; $this->arranged_menu_array[$arranged_items_count]['id'] = $item['id']; $this->arranged_menu_array[$arranged_items_count]['title'] = $item['title']; $this->arranged_menu_array[$arranged_items_count]['image'] = $item['image']; if (!is_array($item['add_data'])) { $item['add_data'] = unserialize($item['add_data']); $item['add_data']['newpage'] == '1' ? $this->arranged_menu_array[$arranged_items_count]['target'] = 'target="_blank"' : ($this->arranged_menu_array[$arranged_items_count]['target'] = 'target="_self"'); } else { $item['add_data']['newpage'] == '1' ? $this->arranged_menu_array[$arranged_items_count]['target'] = 'target="_blank"' : ($this->arranged_menu_array[$arranged_items_count]['target'] = 'target="_self"'); } if ($menu_array[$start_index]['position'] != $item['position'] and $menu_array[$end_index]['position'] != $item['position']) { $this->arranged_menu_array[$arranged_items_count]['edge'] = "default"; } if ($menu_array[$start_index]['position'] == $item['position'] and $menu_array[$end_index]['position'] != $item['position']) { $this->arranged_menu_array[$arranged_items_count]['edge'] = "first"; } if ($menu_array[$start_index]['position'] != $item['position'] and $menu_array[$end_index]['position'] == $item['position']) { $this->arranged_menu_array[$arranged_items_count]['edge'] = "last"; } if ($menu_array[$start_index]['position'] == $item['position'] and $menu_array[$end_index]['position'] == $item['position']) { $this->arranged_menu_array[$arranged_items_count]['edge'] = "one"; } $sub_menus = $this->_get_sub_menus($item['id']); $this->arranged_menu_array[$arranged_items_count]['has_childs'] = count($sub_menus) > 0 ? 1 : 0; if (isset($this->expand[$item['id']]) and $this->expand[$item['id']] == TRUE and count($sub_menus) > 0) { $this->cur_level++; array_push($this->stack, $arranged_items_count); $this->display_menu($sub_menus); } else { $this->_prepare_item_tpl($arranged_items_count); } } } $wrapper = ""; $stack_item = array_pop($this->stack); for ($i = $stack_item + 1; $i <= $arranged_items_count; $i++) { if ($this->arranged_menu_array[$i]['level'] <= $this->arranged_menu_array[$stack_item]['level'] + 1) { $wrapper .= $this->arranged_menu_array[$i]['html'] . "\n"; } } $this->_prepare_item_tpl($stack_item, $wrapper); $this->cur_level--; }