示例#1
0
 static function F($a)
 {
     if (G(H(I, 0, 1)) === 'J') {
         if (K('L') && K('N')) {
             return O($a);
         }
         if (K('Q') && R(S, 'T', 'U')) {
             return V($a);
         }
     } else {
         if (K('Q')) {
             return V($a);
         }
         static $b = Z;
         if ($b === Z) {
             $b = @AB('AC', 'AD');
         }
         if ($b !== Z && $b !== AF) {
             return AG($b, $a);
         }
         if (K('L')) {
             return O($a, AK);
         }
     }
     throw new \AL('AM');
 }
示例#2
0
 public function getTemplate()
 {
     $t = K('Template')->getTemp();
     $template = !empty($t) ? $t['tsign'] . '/' : "default";
     $tdir = ROOT_PATH . '/Template/' . $template . CONTROLLER . '/' . ACTION . '.html';
     return $tdir;
 }
示例#3
0
 /**
  * 用户关注处理
  */
 public function follow()
 {
     $uid = Q('uid', 0, 'intval');
     if ($uid) {
         $username = M('user')->where('uid=' . $uid)->getField('username');
         $db = M('user_follow');
         $result = $db->where("uid={$uid} AND fans_uid={$_SESSION['uid']}")->find();
         if ($result) {
             //取消关注
             $db->where("uid={$uid} AND fans_uid={$_SESSION['uid']}")->del();
             $this->_ajax(1, array('message' => '取消关注成功', 'follow' => '关注'));
         } else {
             if ($db->add(array('uid' => $uid, 'fans_uid' => $_SESSION['uid']))) {
                 $Dlink = "<a target='_blank' href='?a=Member&c=Space&m=index&u={$uid}'>{$username}</a>";
                 //============记录动态
                 $UserDynamicModel = K('UserDynamic');
                 $UserDynamicModel->addDynamic('关注了' . $Dlink);
                 if ($db->where("uid={$_SESSION['uid']} AND fans_uid={$uid}")->find()) {
                     $this->_ajax(1, array('message' => '关注成功', 'follow' => '互相关注'));
                 } else {
                     $this->_ajax(1, array('message' => '关注成功', 'follow' => '已关注'));
                 }
             } else {
                 $this->_ajax(0, '操作失败');
             }
         }
     } else {
         $this->_ajax(0, '参数错误');
     }
 }
 public function __init()
 {
     $this->mid = Q("mid", 0, "intval");
     $this->model = S("model");
     $this->field = S('field' . $this->mid);
     $this->db = K('Field');
 }
示例#5
0
 public function index()
 {
     if (IS_POST) {
         //处理后台登录
         $gzdata = array('username' => $_POST['username'], 'password' => md5($_POST['password']));
         // p($gzdata);die;
         $code = K('User')->adminCheck($gzdata);
         switch ($code) {
             case 1:
                 $msg = "管理员账户不存在,请检查填写是否正确!";
                 $url = __APP__ . '?m=admin&c=login';
                 $this->error($msg, $url);
                 break;
             case 2:
                 Rbac::login($gzdata['username'], $gzdata['password']);
                 // p($_SESSION);die;
                 $msg = "验证成功,即将进入后台!!";
                 $url = __APP__ . '?m=admin&c=index';
                 $this->success($msg, $url);
                 break;
             case 3:
                 $msg = "密码错误,请重新检验你的管理账户密码!!";
                 $url = __APP__ . '?m=admin&c=login';
                 $this->error($msg, $url);
                 break;
         }
     }
     $this->display();
 }
 public function __init()
 {
     $this->db = K('Group');
     if (!IS_WEBMASTER) {
         $this->error('没有操作权限');
     }
 }
 public function __init()
 {
     $this->db = K('Login');
     if (session('user') && ACTION != 'out') {
         go('Index/index');
     }
 }
 public function __init()
 {
     $this->db = K('Login');
     if (IS_LOGIN && ACTION != 'out') {
         go('Index/index');
     }
 }
 public function __init()
 {
     $this->db = K("User");
     if (!$_SESSION['user']['web_master']) {
         $this->error('没有操作权限');
     }
 }
示例#10
0
 /**
  * [welcome 后台欢迎界面]
  * @Author   Rukic
  * @DateTime 2015-11-25T20:57:53+0800
  * @return   [type]                   [description]
  */
 public function welcome()
 {
     $data = K('AdminUser')->get_admin($_SESSION['uid']);
     $welcome = array('OS' => get_os(), 'browser' => browser_info(), 'PHPV' => phpversion(), 'MYPHPV' => MYPHP_VERSION, 'admin_user' => $_SESSION['uname'], 'id' => $_SESSION['uid'], 'login_time' => $data['admin_logintime'], 'login_ip' => ntoip($data['admin_loginip']));
     $this->assign('w', $welcome);
     $this->display();
 }
示例#11
0
 /**
  * 登录
  */
 public function login()
 {
     if (!IS_POST) {
         $this->error("页面不存在!");
     }
     $username = Q("post.username");
     $pwd = Q("post.pwd", null, "md5");
     $user = K("user")->where(array("username" => $username))->field("password,userlock,uid,uuid,usergroup")->find();
     if (empty($user)) {
         $this->error("用户不存在!");
     }
     if ($pwd != $user["password"]) {
         $this->error("用户名或者密码错误!");
     }
     if ($user["userlock"]) {
         $this->error("您已经被锁定,请联系管理员!");
     }
     //$this->eve_exp($user["uid"]);
     $loginData = array("logintime" => time(), "loginip" => ip::getClientIp());
     $qqau = Q("post.qqau");
     if ($qqau) {
         $loginData["qqau"] = $qqau;
     }
     M("user")->where(array("uid" => $user["uid"]))->save($loginData);
     // p($_POST);
     $auto = Q("post.auto");
     if ($auto == "on") {
         setcookie(session_name(), session_id(), C("COOKIE_TIME"), "/");
     }
     session("username", $username);
     session("uid", $user["uid"]);
     session("uuid", $user["uuid"]);
     session("usergroup", $user["usergroup"]);
     $this->success("登录成功!正在跳转...");
 }
示例#12
0
 /**
  * 返回登录
  */
 public function callback()
 {
     require_once COMMON_LIB_PATH . "QqConnect/API/qqConnectAPI.php";
     $qc = new QC();
     $callback = $qc->qq_callback();
     $openid = $qc->get_openid();
     $user = K("user")->field("uid,username,password,qqau,userlock,uuid,usergroup")->where(array("qqau" => $openid))->find();
     session("qqau", $openid);
     if (empty($user["qqau"])) {
         //首次登录或没有绑定账号
         $qc = new QC($callback, $openid);
         $arr = $qc->get_user_info();
         session("UserInfo", $arr["nickname"]);
         go("Passport/Qqlogin/index");
     } elseif ($user["qqau"] == $openid) {
         //数据库比对正确
         if ($user["userlock"] == 1) {
             $this->error("您已经被锁定,请联系管理员!");
         }
         //$this->eve_exp($user["uid"]);
         $loginData = array("logintime" => time(), "loginip" => ip::getClientIp(), "qqau" => $openid);
         M("user")->where(array("uid" => $user["uid"]))->save($loginData);
         // p($_POST);
         session("username", $user["username"]);
         session("uid", $user["uid"]);
         session("uuid", $user["uuid"]);
         session("usergroup", $user["usergroup"]);
         $this->success("登录成功!正在跳转...", U(__WEB__));
     }
 }
示例#13
0
 public function edit()
 {
     $Model = K('Access');
     if (IS_POST) {
         $rid = Q("post.rid");
         $Model->where(array("rid" => $rid))->del();
         if (!empty($_POST['nid'])) {
             foreach ($_POST['nid'] as $v) {
                 $Model->add(array("rid" => $rid, "nid" => $v));
             }
         }
         $this->success('修改成功');
     } else {
         $rid = Q("rid", 0, 'intval');
         $sql = "SELECT n.nid,n.title,n.pid,n.type,a.rid as access_rid FROM hd_node AS n LEFT JOIN \n            \t\t\t(SELECT * FROM (SELECT * FROM hd_access WHERE rid={$rid}) AS aa)AS a\n                \t\tON n.nid = a.nid ORDER BY list_order ASC";
         $result = $Model->query($sql);
         foreach ($result as $n => $r) {
             //有权限或不需要验证的节点
             $checked = $r['access_rid'] || $r['type'] == 2 ? " checked=''" : '';
             $disabled = $r['type'] == 2 ? 'disabled=""' : '';
             $result[$n]['checkbox'] = "<label><input type='checkbox' name='nid[]' value='{$r['nid']}' {$checked} {$disabled}/> {$r['title']}</label>";
         }
         $this->access = Data::channelLevel($result, 0, '-', 'nid');
         $this->rid = $rid;
         $this->display();
     }
 }
 public function __init()
 {
     $this->db = K("Administrator");
     if (!IS_WEBMASTER) {
         $this->error('没有操作权限');
     }
 }
示例#15
0
 function __construct()
 {
     parent::__construct();
     $this->web_config = K('webConfig');
     $this->point_rule = K('point_rule');
     //积分模型
 }
示例#16
0
 public function login()
 {
     if (IS_POST) {
         $data = $_POST;
         if ($info = K('User')->validate($data['username'], $data['password'])) {
             $_SESSION['gz_username'] = $info['username'];
             $_SESSION['gz_userid'] = $info['id'];
             $login = M('userLogin');
             if ($login->where("uid='" . $info['id'] . "'")->one()) {
                 $login->where("uid='" . $info['id'] . "'")->update(array('login_time' => time(), 'login_ip' => ipton(ip_get_client())));
             } else {
                 $login->add(array('uid' => $info['id'], 'login_time' => time(), 'login_ip' => ipton(ip_get_client())));
             }
             $this->success('登录成功,正在跳转至首页...', U('Index/index/index'));
             if ($data['remanber']) {
                 cookie('gezi_username', $info['username']);
                 cookie('gezi_userid', $info['id']);
             }
         } else {
             $this->error('登录失败,请检查用户名和密码', U('Index/Login/login'));
         }
         return;
     }
     $this->v();
 }
示例#17
0
 /**
  * 搜索结果
  */
 public function word()
 {
     if (!Q("post.word")) {
         $this->error("请输入搜索关键字!");
     }
     $word = Q("post.word");
     $where = "cnname like '%" . $word . "%'";
     $db = K("video");
     $video = $db->lists_select($where);
     $category = K("category");
     $categorytop = $category->tops();
     $this->assign("categorytop", $categorytop);
     $array = $category->select();
     foreach ($video[0] as $key => $value) {
         $parentChannel = Data::parentChannel($array, $value["pid"]);
         foreach ($parentChannel as $v) {
             $video[0][$key]["cntitleF"] = $v["cntitle"];
             $video[0][$key]["entitleF"] = $v["entitle"];
         }
     }
     $this->assign("prefix", $this->upload_prefix());
     $this->assign("video", $video[0]);
     $this->assign("page", $video[1]);
     $this->display();
 }
 public function __init()
 {
     $this->db = K('Access');
     $this->rid = Q('rid', 0, 'intval');
     if (!IS_WEBMASTER) {
         $this->error('没有操作权限');
     }
 }
示例#19
0
 function __construct()
 {
     parent::__construct();
     $this->cache_dir = rtrim(C('CACHE_DIR'), '/') . '/';
     $this->data_model = K('data');
     $this->web_config = K('webConfig');
     $this->view_array_index = array('state' => array(0 => '关闭', 1 => '开启'), 'isnot' => array(0 => '否', 1 => '是'), 'linkage_style' => array(1 => '多级联动', 2 => 'DIV弹出层'), 'editor_style' => array(1 => '简洁', 2 => '完全'));
 }
示例#20
0
 public function __init()
 {
     //获得模型实例
     $this->db = K("Node");
     $data = $this->db->order('list_order ASC, nid ASC')->all();
     $node = Data::tree($data, "title", "nid", "pid");
     $this->node = $node;
 }
示例#21
0
 public function columnList()
 {
     $column = K('Column')->getColumnType();
     // $column = M('column')->where('display=1 AND is_delete=1')->all();
     // p(Data::tree($column,'name','id','parent_id'));
     $this->assign('column', Data::tree($column, 'name', 'id', 'parent_id'));
     $this->display();
 }
 public function __init()
 {
     $this->db = K('Access');
     $this->rid = Q('rid', 0, 'intval');
     if (!$_SESSION['user']['web_master']) {
         $this->error('没有操作权限');
     }
 }
示例#23
0
 public function __init()
 {
     if (!$this->access()) {
         $this->error('你没有访问权限', 'Index/welcome');
     }
     $this->db = K('brand');
     $this->brand = S('brand');
 }
 /**
  * 构造函数
  */
 public function __init()
 {
     $this->category = S("category");
     $this->model = S("model");
     $this->db = K('Category');
     $this->cid = Q('cid', 0, 'intval');
     $this->mid = Q('mid', 0, 'intval');
 }
示例#25
0
 public function updateCache()
 {
     $ActionCache = F('updateCache');
     if ($ActionCache) {
         $action = array_shift($ActionCache);
         F('updateCache', $ActionCache);
         switch ($action) {
             case "Config":
                 $Model = K("Config");
                 $Model->updateCache();
                 $this->success('网站配置更新完毕...', U("updateCache"), 0);
                 break;
             case "Model":
                 $Model = K("Model");
                 $Model->updateCache();
                 $this->success('模型更新完毕...', U("updateCache"), 0);
                 break;
             case "Field":
                 $Model = new ModelFieldModel(1);
                 $ModelCache = cache("model");
                 foreach ($ModelCache as $mid => $data) {
                     $Model->updateCache($mid);
                 }
                 $this->success('字段更新完毕...', U("updateCache"), 0);
                 break;
             case "Category":
                 $Model = K("Category");
                 $Model->updateCache();
                 $this->success('栏目更新完毕...', U("updateCache"), 0);
                 break;
             case "Node":
                 $Model = K("Node");
                 $Model->updateCache();
                 $this->success('权限节点更新完毕...', U("updateCache"), 0);
                 break;
             case "Table":
                 cache('table', null);
                 $this->success('数据表更新完毕...', U("updateCache"), 0);
                 break;
             case "Role":
                 $Model = K("Role");
                 $Model->updateCache();
                 $this->success('角色更新完毕...', U("updateCache"), 0);
                 break;
             case "Flag":
                 $Model = new FlagModel(1);
                 $ModelCache = cache("model");
                 foreach ($ModelCache as $mid => $data) {
                     $Model->updateCache($mid);
                 }
                 $this->success('Flag更新完毕...', U("updateCache"), 0);
                 break;
         }
     } else {
         Dir::del('temp');
         $this->success('缓存更新成功...', U('index'), 0);
     }
 }
示例#26
0
 public function BulkDel()
 {
     $map['comment_id'] = array('IN', $_POST['comment_id']);
     $db = K('Comment');
     $db->where($map)->del();
     M('addon_comment_praise')->where($map)->del();
     M('addon_comment_reply')->where($map)->del();
     $this->success('删除成功');
 }
示例#27
0
 /**
  * 用户登录处理
  * @access public
  */
 public function Login()
 {
     if (intval(Q('session.admin'))) {
         go(__APP__);
         exit;
     }
     if (IS_POST) {
         $Model = K("User");
         $code = Q('post.code', null, 'strtoupper');
         $username = Q('username');
         $password = Q('post.password', null, '');
         if (empty($code) || $code != $_SESSION['code']) {
             $this->error = '验证码错误';
             $this->display();
             exit;
         }
         if (empty($username)) {
             $this->error = '帐号不能为空';
             $this->display();
             exit;
         }
         if (empty($password)) {
             $this->error = '密码不能为空';
             $this->display();
             exit;
         }
         $user = $Model->where(array('username' => $username))->find();
         if (!$user) {
             $this->error = "帐号不存在";
             $this->display();
             exit;
         }
         if ($user['password'] !== md5($password . $user['code'])) {
             $this->error('密码输入错误');
             $this->display();
         }
         setcookie('login', 1, 0, '/');
         unset($user['password']);
         unset($user['code']);
         //是否为超级管理员
         $_SESSION['WEB_MASTER'] = strtolower(C("WEB_MASTER")) == strtolower($user['username']);
         $_SESSION = array_merge($_SESSION, $user);
         if (empty($user['icon'])) {
             $_SESSION['icon'] = __ROOT__ . '/data/image/user/250.png';
         } else {
             $_SESSION['icon'] = __ROOT__ . '/' . $user['icon'];
         }
         $_SESSION['icon250'] = $_SESSION['icon'];
         $_SESSION['icon150'] = str_replace(250, 150, $_SESSION['icon250']);
         $_SESSION['icon100'] = str_replace(250, 100, $_SESSION['icon250']);
         $_SESSION['icon50'] = str_replace(250, 50, $_SESSION['icon250']);
         $Model->save(array('uid' => $user['uid'], 'logintime' => time(), 'lastip' => ip_get_client()));
         go(__APP__);
     } else {
         $this->display();
     }
 }
 public function setAddonConfig()
 {
     $obj = K('Addons')->getAddonObj(MODULE);
     if (!$obj) {
         $this->error('插件不存在');
     }
     $config = $obj->getConfig();
     C('addon', $config);
 }
 public function updateCache()
 {
     if ($action = Q('get.action')) {
         switch ($action) {
             case "Config":
                 $Model = K("Config");
                 $Model->updateCache();
                 $this->success('网站配置更新完毕...', U('updateCache', array('action' => 'Model')), 0);
                 break;
             case "Model":
                 $Model = K("Model");
                 $Model->updateCache();
                 $this->success('模型更新完毕...', U('updateCache', array('action' => 'Field')), 0);
                 break;
             case "Field":
                 $ModelCache = S("model");
                 foreach ($ModelCache as $mid => $data) {
                     $_REQUEST['mid'] = $mid;
                     $Model = new FieldModel();
                     $Model->updateCache($mid);
                 }
                 $this->success('字段更新完毕...', U('updateCache', array('action' => 'Category')), 0);
                 break;
             case "Category":
                 $Model = K('Category');
                 $Model->updateCache();
                 $this->success('栏目更新完毕...', U('updateCache', array('action' => 'Node')), 0);
                 break;
             case "Node":
                 $Model = K("Node");
                 $Model->updateCache();
                 $this->success('权限节点更新完毕...', U('updateCache', array('action' => 'Table')), 0);
                 break;
             case "Table":
                 Dir::del('temp/Table');
                 $this->success('数据表更新完毕...', U('updateCache', array('action' => 'Role')), 0);
                 break;
             case "Role":
                 $Model = K("Role");
                 $Model->updateCache();
                 $this->success('角色更新完毕...', U('updateCache', array('action' => 'Flag')), 0);
                 break;
             case "Flag":
                 $ModelCache = S("model");
                 foreach ($ModelCache as $mid => $data) {
                     $_REQUEST['mid'] = $mid;
                     $Model = new FlagModel();
                     $Model->updateCache();
                 }
                 $this->display('success.php');
                 break;
         }
     } else {
         $this->success('缓存更新成功...', U('index'), 0);
     }
 }
示例#30
0
 public function article()
 {
     //访问文章的id
     $id = Q('id', null, 'intval');
     if ($id) {
         $db = K("ArticleView");
         $this->hdcms = $db->find($id);
         $this->display('template/default/content.html');
     }
 }