修改了错误控制器,使用Layout控制错误显示、增加了权限错误提示页面
This commit is contained in:
parent
141a6b3cd2
commit
54b357b701
|
@ -2,33 +2,45 @@
|
|||
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
function preDispatch()
|
||||
{
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->db=Zend_Registry::get('db');
|
||||
}
|
||||
|
||||
public function errorAction()
|
||||
{
|
||||
$errors = $this->_getParam('error_handler');
|
||||
|
||||
|
||||
switch ($errors->type) {
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
|
||||
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
||||
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
|
||||
|
||||
// 404 error -- controller or action not found
|
||||
$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
|
||||
|
||||
$content =<<<EOH
|
||||
<h1>Error!</h1>
|
||||
<p>The page you requested was not found.</p>
|
||||
EOH;
|
||||
$title = "您所访问的页面未找到";
|
||||
$content = '您所访问的页面未找到<br />
|
||||
The page you requested was not found.';
|
||||
break;
|
||||
default:
|
||||
|
||||
default:
|
||||
// application error
|
||||
$content =<<<EOH
|
||||
<h1>Error!</h1>
|
||||
<p>An unexpected error occurred. Please try again later.</p>
|
||||
EOH;
|
||||
$title = "服务器内部错误";
|
||||
$content = '服务器开了小差,请稍后再试或联系管理员<br />
|
||||
An unexpected error occurred. Please try again later.';
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear previous content
|
||||
$this->getResponse()->clearBody();
|
||||
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->content = $content;
|
||||
}
|
||||
|
||||
public function authorityAction(){
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headTitle('权限错误');
|
||||
?>
|
||||
<div id="page">
|
||||
<div class="wrapper">
|
||||
<h1>您没有权限进行此操作</h1>
|
||||
<hr />
|
||||
<p>
|
||||
您所在的用户组没有进行此操作的权限,如过需要获取该权限需要联系管理员
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,3 +1,16 @@
|
|||
<?php
|
||||
echo $this->content;
|
||||
?>
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headTitle($this->title);
|
||||
?>
|
||||
<div id="page">
|
||||
<div class="wrapper">
|
||||
<h1>错误提示 - 服务器错误</h1>
|
||||
<hr />
|
||||
<p>
|
||||
<?php
|
||||
echo $this->content;
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue