示例#1
0
 protected function EchoErrorAndDie($msg)
 {
     $json = array();
     $json["success"] = false;
     $json["result"] = "";
     $json["error"] = $msg;
     die(json_echo(false, "", $msg));
 }
示例#2
0
 function entry_autocompletenodename()
 {
     $node_keyword = $_REQUEST['term'];
     if (!$node_keyword) {
         echo '';
     }
     $node_mod = model::load('node');
     $where = array('q' => $node_keyword, 'AND' => array('type_id[!]' => node::NODE_TYPE_SELECT));
     $node_list = $node_mod->select_nodes(array('keywords'), $where, null, 5);
     $res = array();
     foreach ($node_list as $v) {
         $res[] = $v['keywords'];
     }
     json_echo($res);
 }
示例#3
0
文件: log.php 项目: PoppyLi/PCMS
 public function delete()
 {
     $vdata = array('status' => 0, 'msg' => '您并没有权限访问此页面!如需权限,请联系管理员!');
     if ($this->CI->input->is_ajax_request()) {
         header('HTTP/1.1 500 Internal Server Error');
         json_echo($vdata);
         exit;
         return false;
     } else {
         $str = $this->CI->load->view('msg', $vdata, TRUE);
         echo $str;
         exit;
     }
 }
示例#4
0
文件: acl.php 项目: PoppyLi/PCMS
 public function auth()
 {
     $url_param = urlencode(current_url() . '?' . $_SERVER['QUERY_STRING']);
     // 没有 session 时
     if (!$this->CI->session->userdata('gid')) {
         //检测cookie
         if ($this->CI->input->cookie('_rember') and $this->CI->input->cookie('_m')) {
             if (!$this->_cookie_login()) {
                 if ($this->url_model != 'login') {
                     if ($this->CI->input->is_ajax_request()) {
                         $vdata = array('status' => 0, 'msg' => '您的登陆已经失效,请重新登陆');
                         header('HTTP/1.1 500 Internal Server Error');
                         json_echo($vdata);
                         exit;
                         return false;
                     } else {
                         redirect(site_url('login') . "?url=" . $url_param);
                     }
                 }
             } else {
                 if ($this->url_model == 'login') {
                     $url = $this->CI->input->get('url') ? urldecode($this->CI->input->get('url')) : site_url("welcome");
                     redirect($url);
                 }
             }
         } else {
             if ($this->url_model != 'login') {
                 // redirect(site_url('login')."?url=".$_SERVER['REQUEST_URI']);
                 if ($this->CI->input->is_ajax_request()) {
                     $vdata = array('status' => 0, 'msg' => 'err:02 您的登陆已经失效,请重新登陆');
                     header('HTTP/1.1 500 Internal Server Error');
                     json_echo($vdata);
                     exit;
                     return false;
                 } else {
                     redirect(site_url('login') . "?url=" . $url_param);
                 }
             }
         }
     } else {
         // 已登录
         if ($this->url_model == 'login' and $this->url_method != "logout") {
             $url = $this->CI->input->get('url') ? $this->CI->input->get('url') : "welcome";
             redirect(site_url($url));
         } else {
             if ($this->url_model != 'login' and $this->CI->session->userdata('err_oldpwd') and $this->url_model != 'manager' and $this->url_method != "passwd") {
                 // 没有修改密码跳转修改
                 redirect(site_url('manager/passwd'));
             }
         }
         // 检测是否有权限,提示添加,未添加到组的权限
         if (!$this->_purview()) {
             $vdata = array('status' => 0, 'msg' => '您并没有权限访问此页面!如需权限,请联系管理员!');
             if ($this->CI->input->is_ajax_request()) {
                 // 此处不用 output 因为不会去执行控制器方法
                 header('HTTP/1.1 500 Internal Server Error');
                 // 使用 ajax error接收
                 json_echo($vdata);
                 exit;
                 return false;
             } else {
                 $str = $this->CI->load->view('msg', $vdata, TRUE);
                 echo $str;
                 exit;
             }
         }
     }
 }