Ejemplo n.º 1
0
 /**
  * 后台用户登录
  *
  * @author Rocks
  */
 public function login($email = null, $password = null, $verify = null)
 {
     if (IS_POST) {
         $Admin = D('AdminAdmin');
         $adminid = $Admin->login($email, $password);
         if (0 < $adminid) {
             $this->success('登录成功!', U('Home/Index/index'));
         } else {
             switch ($adminid) {
                 case -1:
                     $error = '用户不存在或被禁用!';
                     break;
                 case -2:
                     $error = '密码错误!';
                     break;
                 default:
                     $error = '未知错误!';
                     break;
             }
             $this->error($error);
         }
     } else {
         if (is_admin_login()) {
             $this->redirect('Home/Index/index');
         } else {
             $config = S('DB_CONFIG_DATA');
             if (!$config) {
                 $config = api('SystemConfig/lists');
                 S('DB_CONFIG_DATA', $config);
             }
             C($config);
             $this->display();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * 架构函数 取得模板对象实例
  * @access public
  */
 public function __construct()
 {
     if (is_file('./Conf/user.php')) {
         //已经安装了
         $moduleModel = D('Common/Module');
         /*读取站点配置*/
         $config = api('Config/lists');
         C($config);
         //添加配置
         $module = $moduleModel->getModule(MODULE_NAME);
         if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') {
             if (!C('WEB_SITE_CLOSE')) {
                 header("Content-Type: text/html; charset=utf-8");
                 exit('站点已经关闭,请稍后访问~');
             }
             if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') {
                 $moduleModel->checkCanVisit(MODULE_NAME);
             }
         }
     }
     Hook::listen('action_begin', $this->config);
     //实例化视图类
     $this->view = Think::instance('Think\\View');
     if (!empty($module)) {
         $this->view->assign('MODULE_INFO', $module);
         $this->view->assign('MODULE_ALIAS', $module['alias']);
     }
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
 }
Ejemplo n.º 3
0
 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     /**垂直菜单**/
     $category = D('Category')->getCategory();
     $this->assign('category', $category);
     /**购物车**/
     $cart = D('shopcart')->getcart();
     $this->assign('usercart', $cart);
     /* 热门搜索 */
     $str = M('config')->where('id="40"')->getField("value");
     $hotsearch = explode(",", $str);
     $this->assign('hotsearch', $hotsearch);
     /* 广告位 */
     $adData = D('ad')->getlist();
     $this->assign('adData', $adData);
     /**底部菜单**/
     $footer = D('Category')->getfooter();
     $this->assign('footer', $footer);
     /**所在地**/
     if (!session("user_area")) {
         $arr = get_ip_address();
         $area = $arr->city;
     } else {
         $area = session("user_area");
     }
     $this->assign("user_area", $area);
 }
Ejemplo n.º 4
0
 /**
  * 编辑用户资料
  * @author ChenDenlu <*****@*****.**>
  */
 public function edit($id = 0)
 {
     if (IS_POST) {
         //过滤非编辑字段
         foreach ($_POST as $key => $value) {
             if (!in_array($key, array('nickname', 'cate_group', 'ucpassword', 'id', 'score', 'lastkeyword', 'lastmodel', 'lastclick'))) {
                 unset($_POST[$key]);
             }
         }
         $id = $_POST['id'];
         unset($_POST['id']);
         $updata = array('id' => $id, 'data' => $_POST);
         $info = api('Wxuser/update_info', $updata);
         return false === $info ? $this->error('编辑用户信息失败!') : $this->success('编辑用户信息成功!');
     } else {
         $id = I('id');
         if (empty($id)) {
             $this->error('请选择要查看的用户');
         }
         $info = array();
         $sex = array('0' => '女', '1' => '男');
         /* 获取数据 */
         $info = api('Wxuser/get_info', array('id' => $id));
         $info['sex'] = $sex[$info['sex']];
         $this->assign('info', $info);
         $this->assign('meta_title', '关注者管理');
         $this->display();
     }
 }
Ejemplo n.º 5
0
 protected function _initialize()
 {
     if (!($city = session('user_city'))) {
         // $ip = $_SERVER['REMOTE_ADDR'];
         $ip = '221.2.170.181';
         //开始取得城市信息
         $city = get_city_by_lee_ip($ip);
         //如果有区域参数,则获取区域id
         $city_id = M('district')->where(array('name' => $city))->getField('id');
         //开始取得城市信息  end
         //把城市信息存到session中
         session('user_city', array('city_name' => $city, 'city_id' => $city_id));
         $this->city_name = $city;
         $this->city_id = $city_id;
     } else {
         $this->city_name = $city['city_name'];
         $this->city_id = $city['city_id'];
     }
     if (is_login()) {
         $this->user_info();
     }
     //header("Content-type:text/html;charset=uft-8");
     /*读取站点配置*/
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
 }
Ejemplo n.º 6
0
 /**
  * 应用信息初始化
  *
  * @access private
  * @return void
  */
 private function initSite()
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     // 添加配置
     // dump($config);
     if (!C('WEB_SITE_CLOSE') && strtolower(MODULE_NAME) != 'admin') {
         $this->error('站点已经关闭,请稍后访问~');
     }
     // 通用表单的控制开关
     $this->assign('add_button', true);
     $this->assign('del_button', true);
     $this->assign('search_button', true);
     $this->assign('check_all', true);
     $this->assign('top_more_button', $this->top_more_button);
     $diff = array('_addons' => 1, '_controller' => 1, '_action' => 1, 'm' => 1, 'id' => 1);
     $GLOBALS['get_param'] = $this->get_param = array_diff_key($_GET, $diff);
     $this->assign('get_param', $this->get_param);
     // js,css的版本
     if (APP_DEBUG) {
         defined('SITE_VERSION') or define('SITE_VERSION', time());
     } else {
         defined('SITE_VERSION') or define('SITE_VERSION', C('SYSTEM_UPDATRE_VERSION'));
     }
     // 版权信息
     $this->assign('system_copy_right', C('COPYRIGHT'));
 }
Ejemplo n.º 7
0
 protected function _initialize()
 {
     /* 读取站点配置和rewrite信息 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     //加载rewrite
     //$this->loadRewrite();
     $nav = D('Category')->getTree();
     $lists = D('Document')->lists(null);
     $this->assign('nav', $nav);
     //栏目
     $this->assign('lists', $lists);
     //列表
     $this->assign('page', D('Document')->page);
     //分页
     /*幻灯片*/
     $type = M('category as d');
     $slidemap['d.pid'] = 11;
     $slide = $type->where($slidemap)->field('d.id,d.title,a.path')->join('zs_picture as a on d.icon=a.id', 'LEFT')->select();
     $this->assign('slide', $slide);
     // dump($slide); die;
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
 }
Ejemplo n.º 8
0
 /**
  * 前台台控制器初始化
  */
 protected function _initialize()
 {
     // plugin('Fangke');
     /* 读取数据库中的配置 */
     $config = F('DB_CONFIG_DATA');
     if (!$config || APP_DEBUG) {
         $config = api('Config/lists');
         F('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     C('TMPL_PARSE_STRING', array('__STATIC__' => __ROOT__ . '/Public/Static', '__IMG__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/images', '__CSS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/css', '__JS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/js'));
     defined('__DB_PREFIX__') or define('__DB_PREFIX__', C('DB_PREFIX'));
     defined('UID') or define('UID', is_login());
     if (C('WEB_SITE_CLOSE') && UID != 1) {
         $this->show('网站维护中请稍后访问');
         die;
     }
     $str = run_plugin_method('Spider', 'addinfo');
     //var_dump($config);
     if (UID) {
         //登陆的情况
         //赋值当前登陆用户信息
         $uinfo = session('uinfo');
         $map[get_account_type($uinfo['username'])] = $uinfo['username'];
         $jin = __DB_PREFIX__ . "member_group as a on " . __DB_PREFIX__ . "member.member_group_id=a.member_group_id";
         $field = "*," . __DB_PREFIX__ . "member.status as status";
         $user = D('Member')->field($field)->where($map)->join($jin)->find();
         session('uinfo', $user);
         $this->assign('uinfo', $user);
     }
 }
Ejemplo n.º 9
0
 public function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     // define(WEB_SITE_TITLE, C('WEB_SITE_TITLE'));
     // define(TONGJI, C('TONGJI'));
     C('DEFAULT_THEME', C('HOME_DEFAULT_THEME'));
     define(UID, is_login());
     if (UID) {
         $this->my = D('Member')->info(UID);
         $this->assign('my', $this->my);
     }
     $this->mod = MODULE_NAME;
     $this->act = CONTROLLER_NAME;
     $this->pre = C('DB_PREFIX');
     $this->nav();
     $this->friendlink();
     $this->hotArticle();
     $this->metatags();
     $this->searchkeyword();
     $this->support();
     $this->assign('setting', $this->setting);
     $this->assign('mod', strtolower($this->mod));
     $this->assign('act', strtolower($this->act));
     $this->assign('my', $this->my);
 }
 public function init_config($modulename)
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     //添加配置
     C($config);
     $this->init_theme(C('WEB_SITE_THEME'), $modulename);
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     //浏览器参数
     $this->assign('browser_type', session('browser_type'));
     //申明全局变量   默认网站信息
     global $_W;
     $_W = $config;
     $accountmodel = M('Account');
     $map = array();
     $defaultlist = $accountmodel->where(array('account_default' => 'default'))->find();
     $map['account_default'] = array('neq', 'default');
     $otherlist = $accountmodel->where($map)->select();
     //申明全局变量   默认微信公众号信息
     global $_K;
     $_K['DEFAULT'] = $defaultlist;
     $_K['OTHER'] = $otherlist;
     return true;
 }
Ejemplo n.º 11
0
 /**
  * 应用信息初始化
  *
  * @access private
  * @return void
  */
 private function initSite()
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     // 添加配置
     if (!C('WEB_SITE_CLOSE') && strtolower(MODULE_NAME) != 'admin') {
         $this->error('站点已经关闭,请稍后访问~');
     }
     // 通用表单的控制开关
     $this->assign('add_button', true);
     $this->assign('del_button', true);
     $this->assign('search_button', true);
     $this->assign('check_all', true);
     // js,css的版本
     if (APP_DEBUG) {
         defined('SITE_VERSION') or define('SITE_VERSION', time());
     } else {
         defined('SITE_VERSION') or define('SITE_VERSION', C('SYSTEM_UPDATRE_VERSION'));
     }
     // 版权信息
     $this->assign('system_copy_right', C('COPYRIGHT'));
 }
Ejemplo n.º 12
0
 /**
  * Api 路由器
  *
  * @return api()->response();
  *
  * @author AlpFish 2016/7/24 10:55
  */
 public static function run()
 {
     //获取路径
     $path = ab_path(self::$path);
     if (!file_exists($path)) {
         return api('data')->status(500, '服务器Api目录设置错误')->response();
     }
     //获取method
     if (!request('method') && empty(self::$method)) {
         return api('data')->status(400, '缺少请求参数:method')->response();
     }
     $method = self::get_real_method($path);
     //版本处理
     $v = request('version') ? request('version') : self::$version;
     if (!file_exists($path .= $v . '/')) {
         return api('data')->status(404, 'Api版本不正确')->response();
     }
     //路由寻址
     $method = explode('.', $method);
     $count = count($method);
     for ($i = 0; $i <= $count - 3; $i++) {
         $path .= $method[$i] . '/';
     }
     $controller = $method[$count - 2] . self::$suffix;
     $action = $method[$count - 1];
     if (is_file($file = $path . strtolower($controller . self::$suffix . '.php'))) {
         require_once $file;
         if (class_exists($controller) && method_exists($controller, $action)) {
             $class = new $controller();
             return $class->{$action}();
         }
     }
     return api('data')->status(404, '错误的 api 名称:' . request('method'))->response();
 }
Ejemplo n.º 13
0
 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     $sub_menu = array('left' => array(array('tab' => 'home', 'title' => '首页', 'href' => U('blog/index/index'))));
     $category = D('Category')->getTree();
     $this->assign('categories', $category);
     //栏目
     //dump($category);exit;
     foreach ($category as $cat) {
         if ($cat['_']) {
             $children = array();
             $children[] = array('tab' => 'cat_' . $cat['id'], 'title' => '全部', 'href' => U('blog/article/lists', array('category' => $cat['id'])));
             foreach ($cat['_'] as $child) {
                 $children[] = array('tab' => 'cat_' . $cat['id'], 'title' => $child['title'], 'href' => U('blog/article/lists', array('category' => $child['id'])));
             }
         }
         $menu_item = array('children' => $children, 'tab' => 'cat_' . $cat['id'], 'title' => $cat['title'], 'href' => U('blog/article/lists', array('category' => $cat['id'])));
         $sub_menu['left'][] = $menu_item;
         unset($children);
     }
     $this->assign('sub_menu', $sub_menu);
     $this->setTitle('博客');
 }
Ejemplo n.º 14
0
 /**
  * 主题管理首页
  */
 public function index($themes_dir = '')
 {
     if (!$themes_dir) {
         $themes_dir = AMANGO_FILE_ROOT . '/Application/Home/' . C('default_v_layer') . '/';
     }
     $dirs = array_map('basename', glob($themes_dir . '*', GLOB_ONLYDIR));
     if ($dirs === FALSE || !file_exists($themes_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     //读取已有参数
     $WEB_SITE_THEME = M('Config')->where(array('name' => 'WEB_SITE_THEME'))->getField('value');
     $newthemelist = array();
     //过滤非英文字符串
     foreach ($dirs as $key => $value) {
         $tpl_info = array();
         if (preg_match('/[^\\x00-\\x80]/', $value)) {
             unset($dirs[$key]);
         } else {
             $tpl_info = api('System/getThemeinfo', array('themename' => $value, 'config' => ''));
             //基础信息
             $newthemelist[$key] = $tpl_info['INFO'];
             $newthemelist[$key]['config'] = $tpl_info['CONFIG'];
             //使用状态
             if ($value != $WEB_SITE_THEME) {
                 $newthemelist[$key]['uninstall'] = 1;
             }
         }
     }
     $this->assign('meta_title', '主题管理');
     $this->assign('themes', count($newthemelist));
     $this->assign('_list', $newthemelist);
     $this->display();
 }
Ejemplo n.º 15
0
 /**
  * 前台台控制器初始化
  */
 protected function _initialize()
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config || APP_DEBUG) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     //trace($config);
     C($config);
     //添加配置
     //定义数据表前缀
     defined('DBPREFIX') or define('DBPREFIX', C('DB_PREFIX'));
     defined('__DB_PREFIX__') or define('__DB_PREFIX__', C('DB_PREFIX'));
     C('TMPL_PARSE_STRING', array('__STATIC__' => __ROOT__ . '/Public/Static', '__IMG__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/images', '__CSS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/css', '__JS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/js'));
     define('UID', 1);
     //过滤掉支付接口的异步通知url
     if (CONTROLLER_NAME != 'Buy' && ACTION_NAME != 'dopayok') {
         defined('UID') or define('UID', auto_login());
         if (!UID) {
             //没有登陆的情况
             if (IS_AJAX) {
                 $this->error($this->fetch('Public/ajaxlogin'));
             } else {
                 redirect(U('Public/login'));
             }
         } else {
             //赋值当前登陆用户信息
             $map['member_id'] = UID;
             $user = D('MemberView')->where($map)->find();
             $this->uinfo = $user;
         }
     }
 }
Ejemplo n.º 16
0
 public function _initialize()
 {
     /* # 验证是否开启 */
     json_decode(json_encode(model('Xdata')->get('admin_Mobile:setting')), false)->switch or $this->error('手机版已经关闭无法访问', '3', U('public/Index/index'));
     // 登录验证
     if (!$this->mid) {
         $publicAccess = (include APPS_PATH . '/w3g/Conf/access.inc.php');
         $publicAccess = $publicAccess['access'];
         if (!($publicAccess[APP_NAME . '/' . MODULE_NAME . '/' . ACTION_NAME] === true || $publicAccess[APP_NAME . '/' . MODULE_NAME . '/*'] === true || $publicAccess[APP_NAME . '/*/*'] === true)) {
             redirect(U('w3g/Public/login'));
             exit;
         }
     }
     global $ts;
     // 站点名称
     $this->_title = $ts['site']['site_name'] . ' 3G版';
     $this->assign('site_name', $this->_title);
     // 分页
     $_GET['page'] = $_POST['page'] ? intval($_POST['page']) : intval($_GET['page']);
     $this->_page = $_GET['page'] > 0 ? $_GET['page'] : 1;
     $this->assign('page', $this->_page);
     $this->_item_count = 10;
     $this->assign('item_count', $this->_item_count);
     // 来源类型
     // if(is_iphone()){
     // $this->_type_wap = 3;
     // }elseif(is_android()){
     // $this->_type_wap = 2;
     // }else{
     $this->_type_wap = 1;
     // }
     $this->_from_type = array('0' => '网站', '1' => '3G版', '2' => 'Android客户端', '3' => 'iPhone客户端');
     $this->assign('from_type', $this->_from_type);
     // 关注状态
     $this->_follow_status = array('eachfollow' => '相互关注', 'havefollow' => '已关注', 'unfollow' => '未关注');
     $this->assign('follow_status', $this->_follow_status);
     // 当前URL
     $this->_self_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     if (isset($_POST['key'])) {
         $this->_self_url .= "&key={$_POST['key']}";
         $this->_self_url .= isset($_POST['user']) ? '&user=1' : '&weibo=1';
     }
     $this->assign('self_url', $this->_self_url);
     // 是否为owner
     $this->assign('is_owner', $this->uid == $this->mid ? '1' : '0');
     $data['user_id'] = $this->uid;
     $data['page'] = $this->_page;
     // 用户资料
     $this->profile = api('User')->data($data)->show();
     $this->assign('profile', $this->profile);
     $logo = '';
     if ($logo = model('Xdata')->get('admin_Mobile:w3gLogo')) {
         $logo = getAttachUrlByAttachId($logo['logo']);
     }
     $this->assign('logo', $logo);
 }
Ejemplo n.º 17
0
 /**
  * 后台控制器初始化
  */
 protected function _initialize()
 {
     // 修复 编辑公众号等级插件权限的”好人“、”环境“bug
     $addons = M('addons')->where(array('status' => 1))->field('id,title')->select();
     $tmpStr = "";
     foreach ($addons as $k => $v) {
         $tmpStr .= $v['id'] . ":" . $v['title'] . "\r\n";
     }
     M('attribute')->where(array('name' => 'addon_status'))->save(array('extra' => $tmpStr));
     // 修复bug end 2015/3/27 艾逗笔
     // 获取当前用户ID
     if (defined('UID')) {
         return;
     }
     define('UID', is_login());
     if (!UID) {
         // 还没登录 跳转到登录页面
         $this->redirect('Public/login');
     }
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     // 是否是超级管理员
     define('IS_ROOT', is_administrator());
     if (!IS_ROOT && C('ADMIN_ALLOW_IP')) {
         // 检查IP地址访问
         if (!in_array(get_client_ip(), explode(',', C('ADMIN_ALLOW_IP')))) {
             $this->error('403:禁止访问');
         }
     }
     // 检测系统权限
     if (!IS_ROOT) {
         $access = $this->accessControl();
         if (false === $access) {
             $this->error('403:禁止访问');
         } elseif (null === $access) {
             //检测访问权限
             $rule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME);
             if (!checkRule($rule)) {
                 $this->error('未授权访问!');
             } else {
                 // 检测分类及内容有关的各项动态权限
                 $dynamic = $this->checkDynamic();
                 if (false === $dynamic) {
                     $this->error('未授权访问!');
                 }
             }
         }
     }
     $this->assign('__MENU__', $this->getMenus());
 }
Ejemplo n.º 18
0
 protected function _initialize()
 {
     /*读取站点配置*/
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error(L('_ERROR_WEBSITE_CLOSED_'));
     }
 }
Ejemplo n.º 19
0
 protected function _initialize()
 {
     /*读取站点配置*/
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
 }
Ejemplo n.º 20
0
 public function _initialize()
 {
     $this->dbname = 'menu';
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
 }
Ejemplo n.º 21
0
 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE') && $_SESSION[C('USER_AUTH_KEY')] != 1) {
         $this->error('站点已经关闭,请稍后访问~', '', 1000);
     }
     $a = D('Member')->need_login();
     $field = array('uid', 'username', 'nickname', 'name', 'email', 'space_url', 'reg_time', 'last_login_time', 'signature', 'avatar32', 'avatar64', 'avatar128', 'avatar256');
     $userinfo = query_user($field, $_SESSION['cs_home']['user_auth']['uid']);
     $roleauth = getmroleauth();
     checkscore($_SESSION['cs_home']['user_auth']['uid']);
     $mymail['status'] = 1;
     $mymail['is_read'] = 0;
     $mymail['to_uid'] = $_SESSION['cs_home']['user_auth']['uid'];
     $mymailcount = M('Message')->where($mymail)->count();
     $userinfo['mymailcount'] = empty($mymailcount) ? '' : $mymailcount;
     $isadmin = is_admin($_SESSION['cs_home']['user_auth']['uid']);
     $this->assign('isadmin', $isadmin);
     $this->assign('user_auth', session('user_auth'));
     $this->assign('uid', getnowUid());
     $this->assign('userinfo', $userinfo);
     $this->assign('roleauth', $roleauth);
     //得到会员组权限
     $cname = strtolower(CONTROLLER_NAME);
     $aname = strtolower(ACTION_NAME);
     $this->assign('aname', $aname);
     $this->assign('cname', $cname);
     $cate = new CategoryApi();
     $clist = $cate->get_catelist(0);
     $clistnum = $cate->get_editcnum();
     $this->assign('clist', $clist);
     $nosigncate = M('Cate')->where(array('status' => 1, 'type' => 1))->select();
     $m = D('cate');
     $catelist = $m->field('*,CONCAT(spid,id) as path2')->where(array('type' => 1, 'status' => 1))->order('path2')->select();
     $t = new tree();
     $catelistarr = $t->unlimitCategoryFormat($catelist);
     $catehtml = $t->treeFormat($catelistarr);
     $this->assign('catehtml', $catehtml);
     $this->assign('nosigncate', $nosigncate);
     $this->assign('clistnum', $clistnum);
     $nav = D('nav')->where(array('status' => 1))->order('sort desc')->select();
     foreach ($nav as $key => $vo) {
         $nav[$key]['url'] = navurl($vo['id'], $vo['type']);
         $nav[$key]['active'] = navactive($vo['id'], $vo['type']);
         if ($vo['win']) {
             $nav[$key]['target'] = '_blank';
         } else {
             $nav[$key]['target'] = '_self';
         }
     }
     $this->assign('nav', $nav);
 }
Ejemplo n.º 22
0
 protected function _initialize()
 {
     get_naps_bot() !== false && die('');
     //不让蜘蛛抓取
     // 获取当前用户ID
     $uid = is_login();
     if ($uid) {
         defined('UID') or define('UID', $uid);
     } else {
         $login = A('Public');
         $uid = $login->autologin();
         $uid > 0 ? define('UID', $uid) : redirect(U('Public/login'));
     }
     defined('IS_ADMIN') or UID == 1 ? define('IS_ADMIN', true) : define('IS_ADMIN', false);
     //先读取缓存配置
     $config = F('DB_CONFIG_DATA');
     if (!$config || APP_DEBUG) {
         $config = api('Config/lists');
         F('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     if (!defined('MAIN_IFRAME')) {
         if (I('mainmenu') == 'true') {
             define('MAIN_IFRAME', 'true');
             C('SHOW_PAGE_TRACE', false);
         } else {
             define('MAIN_IFRAME', 'false');
         }
     }
     $this->assign('MAIN_IFRAME', MAIN_IFRAME);
     //定义数据表前缀
     defined('__DB_PREFIX__') or define('__DB_PREFIX__', C('DB_PREFIX'));
     //主题默认为空
     C('DEFAULT_THEME', '');
     //检查访问权限
     import('Ainiku.Auth');
     $this->auth = new \Ainiku\Auth();
     if (!$this->auth->check()) {
         $this->error('啊哦,没有此权限,请联系管理员!', U(session('uinfo')['admin_index']));
     }
     $this->addForward();
     //设置全局的模板变量
     $this->assign('meta_title', '首页');
     $this->assign('uinfo', session('uinfo'));
     //防止重复请求,如果是主框架请求就只输出个目录菜单
     $this->getMainNav();
     // if (MAIN_IFRAME == 'true' || (CONTROLLER_NAME == 'Index' && ACTION_NAME == 'index')) {
     // 	//取主导航
     // 	$this->getMainNav();
     // 	$this->display(CONTROLLER_NAME . '/' . ACTION_NAME);
     // 	die();
     // }
 }
Ejemplo n.º 23
0
 public function _initialize()
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
 }
Ejemplo n.º 24
0
 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     $this->assign('logined', is_login() > 0 ? 'true' : 'false');
 }
Ejemplo n.º 25
0
 protected function _initialize()
 {
     $a = D('Common/Member')->need_login();
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
 }
Ejemplo n.º 26
0
 /**
  * 后台控制器初始化
  */
 protected function _initialize()
 {
     // 获取当前用户ID
     define('UID', is_login());
     if (!UID) {
         // 还没登录 跳转到登录页面
         $this->redirect('Public/login');
     }
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     // 是否是超级管理员
     define('IS_ROOT', is_administrator());
     if (!IS_ROOT && C('ADMIN_ALLOW_IP')) {
         // 检查IP地址访问
         if (!in_array(get_client_ip(), explode(',', C('ADMIN_ALLOW_IP')))) {
             $this->error('403:禁止访问');
         }
     }
     // 检测访问权限
     $access = $this->accessControl();
     if ($access === false) {
         $this->error('403:禁止访问');
     } elseif ($access === null) {
         $dynamic = $this->checkDynamic();
         //检测分类栏目有关的各项动态权限
         if ($dynamic === null) {
             //检测非动态权限
             $rule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME);
             if (!$this->checkRule($rule, array('in', '1,2'))) {
                 $this->error('未授权访问!');
             }
         } elseif ($dynamic === false) {
             $this->error('未授权访问!');
         }
     }
     /**
      * 芒果智能 左侧菜单
      * @return control
      * @author Kevin
      */
     if (strtolower(CONTROLLER_NAME) !== 'think') {
         cookie('amangocontroller', CONTROLLER_NAME);
     }
     $controller = cookie('amangocontroller') ? cookie('amangocontroller') : CONTROLLER_NAME;
     //dump($controller);die;
     $this->assign('__MENU__', $this->getMenus($controller));
     //dump($controller));die;
 }
Ejemplo n.º 27
0
 public function imgUploadAlbum($gid, $aid, $imageURL, $imageText)
 {
     $imageText = str_replace(' ', '%20', $imageText);
     $data = array("file1" => "@" . $this->imgSave($imageURL));
     $server = api("photos.getUploadServer", "album_id={$aid}&group_id={$gid}");
     $res = curlPost($server->response->upload_url, $data);
     $upload = json_decode($res);
     $save = api("photos.save", "group_id={$gid}&caption={$imageText}&album_id={$upload->aid}&server={$upload->server}&photos_list={$upload->photos_list}&hash={$upload->hash}");
     return $save;
     //return $save->response[0]->id;
 }
Ejemplo n.º 28
0
 public function __construct()
 {
     parent::__construct();
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     /*添加配置*/
 }
Ejemplo n.º 29
0
 public function _initialize()
 {
     // if(!session('uid')){
     // redirect(U('public/login'));
     // }
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
 }
 protected function _initialize()
 {
     /* 读取站点配置和rewrite信息 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     //加载rewrite
     //$this->loadRewrite();
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
 }