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; } }
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; } }
/** * 自定义统计发帖量 */ public function periodstatisticsAction() { $this->_helper->layout->disableLayout(); $type = $this->_request->getParam("type"); $this->view->type = $type; if ($_SESSION['user']['Type'] != 3 && $_SESSION['user']['DeptID'] == 0) { } else { echo "非法访问"; exit; } if ($type == "post") { $BeginDay = $this->_request->getParam("beginday"); $EndDay = $this->_request->getParam("endday"); $BeginStamp = strtotime($BeginDay . ' 00:00:00'); $EndStamp = strtotime($EndDay . ' 23:59:59'); $TodayEndStamp = strtotime(date('Y-m-d') . ' 23:59:59'); // 判断日期是否错误 if ($EndStamp - $BeginStamp < 86399 || $EndStamp > $TodayEndStamp) { echo "<br><center><h3 style=\"color:red\">日期选择错误</h3></center>"; exit; } else { $ArticleMapper = new Application_Model_ArticleMapper(); $PubData = $ArticleMapper->countArticleByStamp($BeginStamp, $EndStamp, 1); $UnPubData = $ArticleMapper->countArticleByStamp($BeginStamp, $EndStamp, 0); $DeptMapper = new Application_Model_DepartmentMapper(); $arrDept = $DeptMapper->findAllDept(); $countDept = count($arrDept); if ($PubData['count'] || $UnPubData['count']) { echo "<table><thead><tr><th>学院名称</th><th>已发表</th><th>未发表</th><th>总数</th></tr></thead><tbody>"; $css[0] = " class=\"alt-row\""; $css[1] = null; for ($i = 0; $i < $countDept; $i++) { $TotalData = $PubData[$i] + $UnPubData[$i]; echo "<tr" . $css[$i % 2] . ">"; echo "<td><a href=\"/admin/listarticle/dept/" . $arrDept[$i]['DeptCode'] . "/from/" . $BeginStamp . "/until/" . $EndStamp . "\" title=\"查看文章\" target=\"_blank\">" . $arrDept[$i]['DeptName'] . "</a></td>"; echo "<td>" . $PubData[$i] . "</td>"; echo "<td>" . $UnPubData[$i] . "</td>"; echo "<td>" . $TotalData . "</td>"; echo "</tr>"; } $TotalPub = $PubData['count']; $TotalUnPub = $UnPubData['count']; $Total = $TotalPub + $TotalUnPub; echo "<tr class=\"alt-row\">\n\t\t\t\t\t\t\t<td><a href=\"/admin/listarticle/from/" . $BeginStamp . "/until/" . $EndStamp . "\" title=\"查看文章\" target=\"_blank\" style=\"color:#555555;\">总计</a></td>\n\t\t\t\t\t\t\t<td>{$TotalPub}</td>\n\t\t\t\t\t\t\t<td>{$TotalUnPub}</td>\n\t\t\t\t\t\t\t<td>{$Total}</td>\n\t\t\t\t\t\t </tr>"; echo "</tbody></table>"; exit; } else { echo "<br><center><h3>期间没有文章发表...</h3></center>"; exit; } } } else { $NowOfWeek = date("w") ? date("w") : 7; $PrevWeekEndStamp = strtotime(date('Y-m-d', time() - 86400 * ($NowOfWeek - 1)) . ' 00:00:00') - 1; $PrevWeekBeginStamp = $PrevWeekEndStamp - 604799; $PrevWeekBeginDay = date('Y-m-d', $PrevWeekBeginStamp); $PrevWeekEndDay = date('Y-m-d', $PrevWeekEndStamp); $this->view->PrevWeekBeginDay = $PrevWeekBeginDay; $this->view->PrevWeekEndDay = $PrevWeekEndDay; } }