| 1 |
public function errorAction(){ $errors $this->_getParam('error_handler'); switch ($errors->type) { case end_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case end_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: $this->getResponse()- setHttpResponseCode(404); $this->view->message 'Page not found'; break; default: $this->getResponse()->setHttpResponseCode(500); |
| 2 |
$this->view->message 'Application error'; |
| 3 |
break; |
| 4 |
} |
| 5 |
$this->view->exception $errors->exception; |
| 6 |
$this->view->request $errors->request; |
| 7 |
} |
| 8 |
public function __construct($uri null) |
| 9 |
{ |
| 10 |
if (null ! $uri) { |
| 11 |
if (!$uri instanceof Zend_Uri) { |
| 12 |
$uri Zend_Uri::factory($uri); |
| 13 |
} |
| 14 |
if ($uri->valid()) { |
| 15 |
$path $uri->getPath(); |
| 16 |
$query $uri->getQuery(); |
| 17 |
if (!empty($query)) { |
| 18 |
$path . '?' . $query; |
| 19 |
} |
| 20 |
$this->setRequestUri($path); |
| 21 |
} else { |
| 22 |
require_once 'Zend_Controller_Request_Exception.php'; |
| 23 |
throw new Zend_Controller_Request_Exception('Invalid URI provided to constructor'); |
| 24 |
} |
| 25 |
} else { |
| 26 |
$this->setRequestUri(); |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
public function setPost($spec, $value null) |
| 31 |
{ |
| 32 |
if ((null $value) && !is_array($spec)) { |
| 33 |
require_once 'Zend_Controller_Exception.php'; |
| 34 |
throw new Zend_Controller_Exception('Invalid value passed to setPost(); must be either array of values or key_value pair'); |
| 35 |
} |
Комментарии