public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("mail_server"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['smtp_server'])) { $this->error(L("SMTP_SERVER_EMPTY_TIP")); } if (!check_empty($data['smtp_name'])) { $this->error(L("SMTP_NAME_EMPTY_TIP")); } if (!check_empty($data['smtp_pwd'])) { $this->error(L("SMTP_PWD_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function testOrderDesc() { $this->assertTrue(CComparator::orderDesc(u("Hello there!"), u("Hello there!")) == 0); $this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0); $this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0); $this->assertTrue(CComparator::orderDesc(u("¡Hola señor!"), u("¡Hola señor!")) == 0); $this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0); $this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0); $this->assertTrue(CComparator::orderDesc(a("a", "b", "c"), a("a", "b", "c")) == 0); $this->assertTrue(CComparator::orderDesc(a("b", "b", "c"), a("a", "b", "c")) < 0); $this->assertTrue(CComparator::orderDesc(m(["one" => "a", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) == 0); $this->assertTrue(CComparator::orderDesc(m(["one" => "b", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) < 0); $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1955 12:00:00 PST")) == 0); $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) > 0); $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1985 12:00:01 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) < 0); $this->assertTrue(CComparator::orderDesc(true, true) == 0); $this->assertTrue(CComparator::orderDesc(false, true) > 0); $this->assertTrue(CComparator::orderDesc(true, false) < 0); $this->assertTrue(CComparator::orderDesc(1234, 1234) == 0); $this->assertTrue(CComparator::orderDesc(1234, 5678) > 0); $this->assertTrue(CComparator::orderDesc(5678, 1234) < 0); $this->assertTrue(CComparator::orderDesc(12.34, 12.34) == 0); $this->assertTrue(CComparator::orderDesc(12.34, 56.78) > 0); $this->assertTrue(CComparator::orderDesc(56.78, 12.34) < 0); $this->assertTrue(CComparator::orderDesc(null, null) == 0); $this->assertTrue(CComparator::orderDesc("Hello there!", "Hello there!") == 0); $this->assertTrue(CComparator::orderDesc("A", "B") > 0); $this->assertTrue(CComparator::orderDesc("C", "B") < 0); $this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("a", "b", "c")) == 0); $this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("b", "b", "c")) > 0); $this->assertTrue(CComparator::orderDesc(CArray::fromElements("b", "b", "c"), CArray::fromElements("a", "b", "c")) < 0); $this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) == 0); $this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "b", "two" => "b", "three" => "c"]) > 0); $this->assertTrue(CComparator::orderDesc(["one" => "b", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) < 0); }
public function testWrite() { $filePath = CFile::createTemporary(); CFile::write($filePath, "Hello there!"); $this->assertTrue(u(file_get_contents($filePath))->equals("Hello there!")); CFile::delete($filePath); }
public function post() { if (IS_POST) { $data = json_decode(Request::post('keyword'), TRUE); $data['rank'] = $data['istop'] == 1 ? 255 : min(255, intval($data['rank'])); $data['module'] = v('module.name'); $data['keywords'] = $data['keyword']; $rid = service('WeChat')->rule($data); //调用模块的执行方法 $module = new $this->moduleClass(); //字段验证 if ($msg = $module->fieldsValidate($rid)) { message($msg, 'back', 'error'); } //使模块保存回复内容 $module->fieldsSubmit($rid); message('规则保存成功', u('post', ['rid' => $rid, 'm' => v('module.name')])); } //获取关键词回复 if ($rid = Request::get('rid')) { $data = Db::table('rule')->find($rid); if (empty($data)) { message('回复规则不存在', 'back', 'error'); } $data['keyword'] = Db::table('rule_keyword')->orderBy('id', 'asc')->where('rid', $rid)->get(); View::with('rule', $data); } $module = new $this->moduleClass(); $moduleForm = $module->fieldsDisplay($rid); return view()->with('moduleForm', $moduleForm); }
/** * Build and return admin interface * * Any module providing an admin interface is required to have this function, which * returns a string containing the (x)html of it's admin interface. * @return string */ function getAdminInterface() { $this->addCSS('/modules/Templater/css/templates.css'); $templates = Template::getAllTemplates(); if (!isset($_REQUEST['template_id'])) { $this->smarty->assign('curtemplate', $templates[0]); } else { if (isset($_REQUEST['save'])) { $t = new Template($_REQUEST['template_id']); $t->setData(u($_REQUEST['editor'])); $t->setTimestamp(date('Y-m-d H:i:s')); $t->setId(null); $t->save(); $this->smarty->assign('curtemplate', $t); $templates = Template::getAllTemplates(); } else { if (isset($_REQUEST['switch_template'])) { $this->smarty->clear_assign('curtemplate'); $this->smarty->assign('curtemplate', new Template($_REQUEST['template'])); } else { if (isset($_REQUEST['switch_revision'])) { $this->smarty->clear_assign('curtemplate'); $this->smarty->assign('curtemplate', new Template($_REQUEST['revision'])); } else { $this->smarty->assign('curtemplate', new Template($_REQUEST['template_id'])); } } } } $this->smarty->assign('templates', $templates); return $this->smarty->fetch('admin/templates.tpl'); }
public function insert() { B('FilterString'); $ajax = intval($_REQUEST['ajax']); $data = M(MODULE_NAME)->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error("请输入分类名称"); } $user_level_list = M(MODULE_NAME)->where("point=" . intval($data['point']))->find(); if ($user_level_list) { $this->error('已有相同的"所需信用值"'); } // 更新数据 $log_info = $data['name']; $list = M(MODULE_NAME)->add($data); if (false !== $list) { //成功提示 save_log($log_info . L("INSERT_SUCCESS"), 1); $this->success(L("INSERT_SUCCESS")); } else { //错误提示 save_log($log_info . L("INSERT_FAILED"), 0); $this->error(L("INSERT_FAILED")); } }
public function update() { $data = M(MODULE_NAME)->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error(L("TAGNAME_EMPTY_TIP")); } $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); $log_info = $data['name']; // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 M("TagGroupLink")->where("tag_group_id=" . $data['id'])->delete(); foreach ($_REQUEST['cate_id'] as $cate_id) { if (intval($cate_id) > 0) { $link_data = array(); $link_data['category_id'] = intval($cate_id); $link_data['tag_group_id'] = $data['id']; M("TagGroupLink")->add($link_data); } } clear_auto_cache("store_filter_nav_cache"); save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("levelname"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['levelname'])) { $this->error("请填写星级名称"); } if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $data['level'])) { $this->error("请填写级别"); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 $dbErr = M()->getDbError(); save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0); $this->error(L("UPDATE_FAILED") . $dbErr); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = $data['id'] . l("TOPIC_DATA"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { rm_auto_cache("recommend_forum_topic"); M("TopicCateLink")->where("topic_id=" . $data['id'])->delete(); foreach ($_REQUEST['cate_id'] as $cate_id) { $link_data = array(); $link_data['cate_id'] = $cate_id; $link_data['topic_id'] = $data['id']; M("TopicCateLink")->add($link_data); } syn_topic_match($data['id']); //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { $data = M(MODULE_NAME)->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit")); if (!check_empty($data['name'])) { $this->error(L("POINTNAME_EMPTY_TIP")); } if (M(MODULE_NAME)->where("id<>" . $data['id'] . " and `name`='" . $data['name'] . "'")->count() > 0) { $this->error(L("HAD_POINTGROUP")); } $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); $log_info = $data['name']; // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
function pagesList($type) { global $self, $PG_DIR; $list = array(); $dir = opendir($PG_DIR); while ($file = readdir($dir)) { if (preg_match("/\\.txt\$/", $file)) { $files[] = substr($file, 0, strlen($file) - 4); } } if (is_array($files)) { sort($files); foreach ($files as $file) { $list[] = "<a href=\"{$self}?page=" . u($file) . "\">" . h($file) . "</a>"; } } if ($type == "comma") { $ret = implode(", ", $list); } else { if ($type == "list") { $ret = "<ul><li>" . implode("</li><li>", $list) . "</li></ul>"; } } return $ret; }
/** * 订单来路的图饼展示 */ public function order_referer() { $where = " 1=1 "; $where .= " and type <> 1"; $map['type'] = array("neq", 1); $begin_time = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']); $end_time = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']); if ($end_time == 0) { $where .= " and create_time > " . $begin_time; $map['create_time'] = array("gt", $begin_time); } else { $where .= " and create_time between " . $begin_time . " and " . $end_time; $map['create_time'] = array("between", array($begin_time, $end_time)); } $sql = "select referer,count(id) as ct from " . DB_PREFIX . "deal_order where " . $where . " and referer <> '' group by referer having count(id) > 0 order by ct desc limit 8 "; $total_sql = "select count(*) from " . DB_PREFIX . "deal_order where " . $where; $colors = array("0xAAAAAA", "0x669999", "0xBBBB55", "0xCC6600", "0x9999FF", "0x0066CC", "0x99CCCC", "0x999999", "0xFFCC00", "0x009999", "0x99CC33", "0xFF9900", "0x999966", "0x66CCCC", "0x339966", "0xCCCC33"); $total = intval($GLOBALS['db']->getOne($total_sql)); $list = $GLOBALS['db']->getAll($sql); $items = array(); foreach ($list as $k => $v) { $total -= intval($v['ct']); $items[] = array("value" => intval($v['ct']), "tip" => $v['referer'], "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => $v['referer'])) . "')"); } $items[] = array("value" => $total, "tip" => "直接访问", "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => -1)) . "')"); $data['bg_colour'] = "#ffffff"; $data['elements'] = array(array("type" => "pie", "colours" => $colors, "alpha" => 1, "border" => 2, "start-angle" => 35, "values" => $items)); ajax_return($data); }
public function update() { B('FilterString'); $data = M("ApnsMessages")->create(); $log_info = $data['id']; //开始验证有效性 $this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id']))); if (!check_empty($data['content'])) { $this->error(L("CONTENT_EMPTY_TIP")); } if ($data['send_time'] == '') { $data['send_time'] = get_gmtime(); } $data['send_time'] = to_timespan($data['send_time']); if (intval($_REQUEST['resend']) == 1) { $data['status'] = 0; } $list = M("ApnsMessages")->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $user_names = preg_split("/[ ,]/i", $data['user_names']); $user_ids = ""; foreach ($user_names as $k => $v) { $uid = M("User")->where("user_name = '" . $v . "'")->getField("id"); if ($uid) { $user_ids .= $uid . "|"; } } $data['user_ids'] = $user_ids; $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['title'])) { $this->error(L("MSY_TITLE_EMPTY_TIP")); } if (!check_empty($data['content'])) { $this->error(L("MSY_CONTENT_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("ATTR_NAME_EMPTY_TIP")); } if (!check_empty($data['preset_value']) && $data['input_type'] == 1) { $this->error(L("PRESET_VALUE_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
function displayCatalog($catalog, &$lnk, $deep = 0, $count) { // foreach ($catalog->{u('Группа')} as $group) { $d = array('id' => u2w($group->{u('Ид')}), 'name' => u2w($group->{u('Наименование')})); ?> <tr> <td style="padding-left:<?php echo $deep * 20; ?> px;"> <?php echo $d['name']; ?> <?php //=print_r($count) ?> <?php if (!empty($count[$d['id']])) { ?> [<?php echo $count[$d['id']]; ?> ]<?php } ?> </td> <td> <input style="font-size:7pt;width:50px" name="lnk[<?php echo $d['id']; ?> ]" value="<?php echo !empty($lnk[$d['id']]) ? $lnk[$d['id']] : ''; ?> "> </td> <td style="white-space:nowrap"> <?php echo $d['id']; ?> </td> <td> <?php /*a class="move" rel="<?=$d['id']?>" title="Переместить дочерние узлы" href="#"><img src="/img/pic/move_16.gif"/></a*/ ?> <a class="move_to" rel="<?php echo $d['id']; ?> " title="Переместить дочерние узлы в текущий каталог" href="#"><img src="/img/pic/move_16.gif"/></a> </td> </tr> <?php if (!empty($group->{u('Группы')})) { displayCatalog($group->{u('Группы')}, $lnk, $deep + 1, $count); } } }
function get_is_default($status, $id) { if ($status == 1) { $str = l("IS_DEFAULT_" . $status); } else { $str = l("IS_DEFAULT_" . $status) . " <a href='" . u("DealCity/set_default", array("id" => $id)) . "' style='color:red;'>" . l("SET_DEFAULT") . "</a>"; } return $str; }
/** * Constructor */ public function __construct() { // the config object $config = Zend_Registry::get('config')->social->vk; // auth uri $urn = MyProject_Utils_Client::getUrl() . u(array(), 'vkontakte', true); // parent one parent::__construct($config->id, $config->key, $urn, 'offline'); }
public function logout() { if (isset($_SESSION['admin_info'])) { unset($_SESSION['admin_info']); $this->success('退出登录成功!', u('Login/index')); } else { $this->error('已经退出登录!'); } }
public function main() { if (count(u()->getUriInfo()->getUrlList()) == 1) { $this->__lib('VersionUpdate'); (new VersionUpdate())->update_script(); $this->__view("Control/main.php"); } else { $this->__view("Control/main_show.php"); } }
function uc($url, $vars = '', $suffix = true, $redirect = false, $domain = false) { $uid = empty($_REQUEST['uid']) ? $_SESSION['user_id'] : intval($_REQUEST['uid']); if ($vars == '') { $vars = "&uid=" . $uid; } elseif (is_array($vars)) { $vars['uid'] = $uid; } return u($url, $vars, $suffix, $redirect, $domain); }
function __construct() { parent::__construct(); if (strpos(u()->getUriInfo()->getPath(), "/Show") === 0) { $this->__load_404(); exit; } else { $this->theme = theme(); } }
function template() { global $html, $page, $START_PAGE, $WIKI_TITLE, $TITLE, $self; if (!empty($page) && $this->link_page_title) { $page_nolang = preg_replace("/\\.[A-Za-z]{2}(-[A-Za-z]{2})?\$/", "", $page); $html = template_replace("plugin:WHAT_LINKS_HERE", "<a href=\"{$self}?action=whatlinkshere&page=" . u($page_nolang) . "\" rel=\"nofollow\">What links here?</a>", $html); $html = template_replace("PAGE_TITLE", "<a href=\"{$self}?action=whatlinkshere&page=" . u($page_nolang) . "\" rel=\"nofollow\" title=\"What links to this page?\">" . h($page == $START_PAGE && $page == $TITLE ? $WIKI_TITLE : $TITLE) . "</a>", $html); } if ($_GET["action"] == "whatlinkshere") { $html = template_replace("SHOW_PAGE", "<a href=\"{$self}?page=" . u($page_nolang) . "\" rel=\"nofollow\">{$GLOBALS['T_SHOW_PAGE']}</a>", $html); } }
protected function success($message, $ajax = 0) { if (!$this->get("jumpUrl")) { if ($_SERVER["HTTP_REFERER"]) { $default_jump = $_SERVER["HTTP_REFERER"]; } else { $default_jump = u("Index/main"); } $this->assign("jumpUrl", $default_jump); } parent::success($message, $ajax); }
public function view() { $order_info = M("DealOrder")->getById(intval($_REQUEST['id'])); if (!$order_info) { $this->error("没有该项目的支持"); } $payment_notice_list = M("PaymentNotice")->where("order_id=" . $order_info['id'] . " and is_paid = 1")->findAll(); $this->assign("payment_notice_list", $payment_notice_list); $this->assign("order_info", $order_info); $this->assign("back_list", u("DealOrder/get_pay_list", array("deal_id" => $order_info['deal_id']))); $this->display(); }
function fill_ext_catalog($groups) { $res = array(); foreach ($groups->{u('Группа')} as $group) { $d = array('id' => u2w($group->{u('Ид')}), 'name' => u2w($group->{u('Наименование')}), 'ch' => array()); if (!empty($group->{u('Группы')})) { $d['ch'] = fill_ext_catalog($group->{u('Группы')}); } $res[] = $d; } return $res; }
function getLink($str) { $parts = explode("|", $str); if (empty($parts[1])) { $parts[1] = $parts[0]; } list($name, $link) = $parts; if (substr($link, 0, 4) != "http" && substr($link, 0, 4) != "http" && substr($link, 0, 2) != "./" && $link[0] != "/") { $link = $GLOBALS["self"] . "?page=" . u($link); } return array($link, $parts[0]); }
/** * 默认首页 */ public function main() { if (u()->getUriInfo()->getUrlListLast() !== null) { $this->__load_404(); } else { header("Content-Type: text/html; charset=utf-8"); theme()->set_desc(site_title(false) . " - " . site_desc(false)); theme()->set_keywords(site_keywords()); $this->__view('comm/header.php'); $this->__view('home/home.php'); $this->__view('comm/footer.php'); } }
public function info() { $id = intval($_REQUEST['id']); $res = $this->mall_mod->where("id={$id}")->find(); if ($res) { $res['post_list'] = $this->post_mod->where("mall_id={$res['id']} and status=1 and post_time<=" . time())->limit('0,10')->select(); $this->assign('info', $res); $this->_config_seo(C('pin_seo_config.mall_info'), array('mall_title' => $res['title'], 'seo_title' => $res['seo_title'], 'seo_keywords' => $res['seo_keys'], 'seo_description' => $res['seo_desc'])); } else { $this->error("商城不存在", u('index/index')); } $this->display(); }
protected function _initialize() { $this->user_session = session('user'); $this->assign('user_session', $this->user_session); $this->config = d('Config')->get_config(); $this->config['now_city'] = 2035; $this->assign('config', $this->config); c('config', $this->config); $this->check_admin_file(); $this->system_session = session('system'); if (empty($this->system_session)) { header('Location: ' . u('Login/index')); } $this->assign('system_session', $this->system_session); $this->config = d('Config')->get_config(); $this->assign('config', $this->config); c('config', $this->config); $this->static_path = './tpl/System/Static/'; $this->static_public = './static/'; $this->assign('static_path', $this->static_path); $this->assign('static_public', $this->static_public); $tmerch = d('Admin')->field('menus')->where(array('id' => $this->system_session['id']))->find(); if (empty($tmerch['menus'])) { $this->system_session['menus'] = ''; } else { $this->system_session['menus'] = explode(',', $tmerch['menus']); } $database_system_menu = d('System_menu'); $condition_system_menu['status'] = 1; $condition_system_menu['show'] = 1; $menu_list = $database_system_menu->field(true)->where($condition_system_menu)->order('`sort` DESC,`fid` ASC,`id` ASC')->select(); foreach ($menu_list as $key => $value) { if (strtolower($value['module']) == strtolower(MODULE_NAME) && true == (strtolower($value['action']) == strtolower(ACTION_NAME))) { if (false == empty($this->system_session['menus']) && true == (false == in_array($value['id'], $this->system_session['menus']))) { $this->error('您还没有这个使用权限,联系管理员开通!', u('Index/Index')); } } if (empty($value['area_access']) && true == $this->system_session['area_id']) { continue; } if (false == empty($this->system_session['menus']) && true == (false == in_array($value['id'], $this->system_session['menus']))) { continue; } if (0 == $value['fid']) { $system_menu[$value['id']] = $value; } else { $system_menu[$value['fid']]['menu_list'][] = $value; } } $this->assign('system_menu', $system_menu); }