Example #1
0
 public function loginAction()
 {
     $username = strip_tags(trim($this->getRequest()->getParam('username')));
     $password = md5(strip_tags(trim($this->getRequest()->getParam('password'))));
     $UserMapper = new Application_Model_UserMapper();
     $arr = $UserMapper->checkUser($username, $password);
     if (!empty($arr)) {
         if ($arr[0]['Activate'] == 1) {
             $DeptMapper = new Application_Model_DepartmentMapper();
             $DeptID = $arr[0]['Department'];
             $arrDept = $DeptMapper->findDept($DeptID);
             if (!empty($arrDept)) {
                 $DeptCode = $arrDept[0]['DeptCode'];
                 $DeptName = $arrDept[0]['DeptName'];
             }
             $session = new Zend_Session_Namespace('user');
             $session->UserID = $arr[0]['UID'];
             $session->UserName = $arr[0]['UserName'];
             $session->RealName = $arr[0]['RealName'];
             $session->DeptID = $arr[0]['Department'];
             $session->DeptCode = $DeptCode;
             $session->DeptName = $DeptName;
             $session->Type = $arr[0]['Type'];
             $session->LastLoginTime = $arr[0]['LastLoginTime'];
             if ($this->getRequest()->getParam('remember') == "on") {
                 $session->setExpirationSeconds(3600);
             } else {
                 $session->setExpirationSeconds(1800);
             }
             $res = $UserMapper->updateLastLoginTime($arr[0]['UID']);
             $this->_redirect('/admin');
         } else {
             $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"未授权用户!\");location.href = \"/login\";</script>";
             echo $string;
             exit;
         }
     } else {
         $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"登陆失败!\");location.href = \"/login\";</script>";
         echo $string;
         exit;
     }
 }
Example #2
0
 public function articleAction()
 {
     $ID = $this->_request->getParam("id");
     if (!empty($ID)) {
         $ArticleMapper = new Application_Model_ArticleMapper();
         $arrArticle = $ArticleMapper->findArticleById($ID);
         session_start();
         //开启session并在下面进行判断,以便在前台不显示未审核的文章
         if ($arrArticle[0]['Published'] >= 1 || isset($_SESSION['user']['Type'])) {
             //点击量+1
             if (!isset($_SESSION['user']['Type'])) {
                 $ArticleMapper->clickArticle($ID);
             }
             $DeptMapper = new Application_Model_DepartmentMapper();
             $arr = $DeptMapper->findDept($arrArticle[0]['DeptID']);
             $this->view->arrDept = $arr;
             $ColumnMapper = new Application_Model_ColumnMapper();
             $arr = $ColumnMapper->findColumn($arrArticle[0]['ColumnID']);
             $this->view->arrPageColumn = $arr;
             $arr = $ColumnMapper->findallColumn();
             $this->view->arrColumn = $arr;
             $this->view->arrArticle = $arrArticle;
             $DeptID = $arrArticle[0]['DeptID'] ? $arrArticle[0]['DeptID'] : -1;
             $arrListrdxw = $ArticleMapper->findArticleForList('publish', $DeptID, 1, -1);
             $arrListbbfc = $ArticleMapper->findArticleForList('publish', $DeptID, 2, -1);
             $arrListhdkj = $ArticleMapper->findArticleForList('publish', $DeptID, 3, -1);
             $arrListczzl = $ArticleMapper->findArticleForList('publish', $DeptID, 4, -1);
             $arrListcysh = $ArticleMapper->findArticleForList('publish', $DeptID, 5, -1);
             $arrListcgxy = $ArticleMapper->findArticleForList('publish', $DeptID, 6, -1);
             $this->view->arrListrdxw = $arrListrdxw;
             $this->view->arrListbbfc = $arrListbbfc;
             $this->view->arrListhdkj = $arrListhdkj;
             $this->view->arrListczzl = $arrListczzl;
             $this->view->arrListcysh = $arrListcysh;
             $this->view->arrListcgxy = $arrListcgxy;
         } else {
             $this->_redirect('/pengbei', array('code' => 301));
             exit;
         }
     } else {
         $this->_redirect('/pengbei');
         exit;
     }
 }
Example #3
0
 /**
  * 文章退稿
  */
 public function rejectarticleAction()
 {
     $ID = $this->getRequest()->getParam('id');
     $type = $this->_request->getParam("type");
     $this->_helper->layout->disableLayout();
     if ($type == 'post') {
         if (!empty($ID)) {
             if ($this->getRequest()->getParam('problem_format') == "on") {
                 $Reason = "缩进存在问题,";
             } else {
                 $Reason = "";
             }
             if ($this->getRequest()->getParam('problem_image') == "on") {
                 $Reason .= "图片存在问题,";
             } else {
                 $Reason .= "";
             }
             if ($this->getRequest()->getParam('problem_content') == "on") {
                 $Reason .= "内容存在问题,";
             } else {
                 $Reason .= "";
             }
             $Reason .= $this->getRequest()->getParam('reason');
             $ArticleMapper = new Application_Model_ArticleMapper();
             $res = $ArticleMapper->rejectArticle($ID, $Reason);
             if (!isset($res)) {
                 $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿失败 %>_<%\");history.back();</script>";
                 echo $string;
                 exit;
             } else {
                 $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿成功!\");location.href = \"/admin/listarticle\";</script>";
                 echo $string;
                 exit;
             }
         } else {
             $string = "<meta http-equiv='content-type' content='text/html; charset=UTF-8'><script language=\"JavaScript\">alert(\"退稿失败 %>_<%\");history.back();</script>";
             echo $string;
             exit;
         }
     } else {
         $this->view->ID = $ID;
         $ArticleMapper = new Application_Model_ArticleMapper();
         $arrArticle = $ArticleMapper->findArticleById($ID);
         if (!empty($arrArticle)) {
             $DeptMapper = new Application_Model_DepartmentMapper();
             $arr = $DeptMapper->findDept($arrArticle[0]['DeptID']);
             $this->view->DeptName = $arr[0]['DeptName'];
             $ColumnMapper = new Application_Model_UserMapper();
             $arr = $ColumnMapper->findUserByID($arrArticle[0]['WriterID']);
             $this->view->RealName = $arr[0]['RealName'];
             $this->view->Title = $arrArticle[0]['Title'];
             $this->view->Date = date('Y-m-d', $arrArticle[0]['WriteTime']);
         } else {
             echo "非法访问";
             exit;
         }
     }
 }