public function render() { // If not defined, assume the most secure bet if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) { return parent::render(); } else { return \Error::errorPage($this->code); } }
public function render() { if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) { http_response_code($this->data['error']['code']); echo json_encode($this->data); exit; } else { \Error::errorPage($this->data->error->code); } }
public function render() { if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) { http_response_code($this->data['error']['code']); $error = $this->data['error']; $this->displayError($error); exit; } else { \Error::errorPage($this->data->error->code); } }
public function download($document_id) { require_once 'HTTP/Download.php'; PHPWS_Core::initModClass('filecabinet', 'Document.php'); $document = new PHPWS_Document($document_id); if (empty($document->id)) { $message = 'Document id:' . $document_id; if (!empty($_SERVER['HTTP_REFERER'])) { $message .= ' request from ' . $_SERVER['HTTP_REFERER']; } PHPWS_Error::log(FC_DOCUMENT_NOT_FOUND, 'filecabinet', 'Cabinet_Action::download', $message); Error::errorPage('404'); } $folder = new Folder($document->folder_id); if (!$folder->allow()) { $content = dgettext('filecabinet', 'Sorry, the file you requested is off limits.'); Layout::add($content); return; } $file_path = $document->getPath(); if (!is_file($file_path)) { $message = $file_path; if (!empty($_SERVER['HTTP_REFERER'])) { $message .= ' request from ' . $_SERVER['HTTP_REFERER']; } PHPWS_Error::log(FC_DOCUMENT_NOT_FOUND, 'filecabinet', 'Cabinet_Action::download', $message); Error::errorPage('404'); } $file_name = preg_replace('/[^\\w]/', '-', $document->getTitle()); $file_name = preg_replace('/-{2,}/', '-', $file_name); $file_name = preg_replace('/-$/', '', $file_name); $file_name .= '.' . $document->getExtension(); $document->downloaded++; $document->save(); $dl = new HTTP_Download(); $dl->setFile($file_path); $dl->setCache(true); $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $file_name); $dl->setContentType($document->file_type); $dl->send(); exit; }
<?php /** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ if (!defined('PHPWS_SOURCE_DIR')) { Error::errorPage(403); } if ($_REQUEST['module'] != 'layout' || !isset($_REQUEST['action'])) { Error::errorPage('404'); } if ($_REQUEST['action'] == 'ckeditor') { Layout::ckeditor(); exit; } if (!Current_User::allow('layout')) { Current_User::disallow(); } PHPWS_Core::initModClass('layout', 'LayoutAdmin.php'); switch ($_REQUEST['action']) { case 'admin': Layout_Admin::admin(); break; default: PHPWS_Core::errorPage('404'); } // END action switch
public static function denied() { Error::errorPage('403'); }