public function __toString() { $wa_url = wa()->getRootUrl(); $app_settings_model = new waAppSettingsModel(); $account_name = $app_settings_model->get('webasyst', 'name', 'Webasyst'); $wa_header = wa_header(); $t = "_ws"; $html = ""; if (!waRequest::isXMLHttpRequest()) { $html .= <<<HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>{$t("Welcome")} — {$account_name}</title> <link href="{$wa_url}wa-content/css/wa/wa-1.0.css" rel="stylesheet"> <!--[if IE 8]><link type="text/css" href="{$wa_url}wa-content/css/wa/wa-1.0.ie8.css" rel="stylesheet"><![endif]--> <!--[if IE 7]><link type="text/css" href="{$wa_url}wa-content/css/wa/wa-1.0.ie7.css" rel="stylesheet"><![endif]--> <script src="{$wa_url}wa-content/js/jquery/jquery-1.7.1.min.js"></script> </head> <body> {$wa_header} <div id="wa-app" class="block double-padded"> HTML; } else { $response = new waResponse(); $response->setStatus(403); $response->sendHeaders(); } $html .= <<<HTML <h1>{$t("Error")} #403</h1> <div style="border:1px solid #EAEAEA;padding:10px; margin:10px 0"> <p style="color:red; font-weight: bold">{$t("You have no permission to access this page.")}</p> <p>{$t("Please refer to your system administrator.")}</p> </div> HTML; if (!waRequest::isXMLHttpRequest()) { $html .= "</div></body></html>"; } return $html; }
public function __toString() { $message = nl2br($this->getMessage()); if (wa()->getApp()) { $app = wa()->getAppInfo(); $backend_url = waSystem::getInstance()->getConfig()->getBackendUrl(true); } else { $app = array(); } if (!waSystem::getInstance()->getConfig()->isDebug()) { $env = wa()->getEnv(); $file = $code = $this->getCode(); if (!$code || !file_exists(dirname(__FILE__) . '/data/' . $code . '.php')) { $file = 'error'; } include dirname(__FILE__) . '/data/' . $file . '.php'; exit; } if (waSystem::getInstance()->getEnv() == 'cli') { return date("Y-m-d H:i:s") . " php " . implode(" ", waRequest::server('argv')) . "\n" . "Error: {$this->getMessage()}\nwith code {$this->getCode()} in '{$this->getFile()}' around line {$this->getLine()}:{$this->getFileContext()}\n" . $this->getTraceAsString() . "\n"; } elseif ($this->code == 404) { $response = new waResponse(); $response->setStatus(404); $response->sendHeaders(); } $result = <<<HTML <div style="width:99%; position:relative"> <h2 id='Title'>{$message}</h2> <div id="Context" style="display: block;"><h3>Error with code {$this->getCode()} in '{$this->getFile()}' around line {$this->getLine()}:</h3><pre>{$this->getFileContext()}</pre></div> <div id="Trace"><h2>Call stack</h2><pre>{$this->getTraceAsString()}</pre></div> <div id="Request"><h2>Request</h2><pre> HTML; $result .= var_export($_REQUEST, true); $result .= "</pre></div></div>\n<div><h2>Params</h2><pre>"; $result .= var_export(waRequest::param(), true); $result .= "</pre></div></div>"; return $result; }
<?php $response = new waResponse(); if (!$response->setStatus($code)) { $response->setStatus(500); } $response->sendHeaders(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo _ws('Error'); ?> #<?php echo $code; ?> </title> <link href="<?php echo wa_url(); ?> wa-content/css/wa/wa-1.0.css" rel="stylesheet" type="text/css" /> <script src="<?php echo wa_url(); ?> wa-content/js/jquery/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="<?php echo wa_url(); ?> wa-content/js/jquery-wa/wa.dialog.js" type="text/javascript"></script>
public function __toString() { try { $wa = wa(); $additional_info = ''; } catch (Exception $e) { $wa = null; $additional_info = $e->getMessage(); } $message = nl2br($this->getMessage()); if ($wa && waSystem::getApp()) { $app = $wa->getAppInfo(); $backend_url = $wa->getConfig()->getBackendUrl(true); } else { $app = array(); } if (!waSystemConfig::isDebug() && $wa) { $env = $wa->getEnv(); $file = $code = $this->getCode(); if (!$code || !file_exists(dirname(__FILE__) . '/data/' . $code . '.php')) { $file = 'error'; } include dirname(__FILE__) . '/data/' . $file . '.php'; exit; } if ($wa && $wa->getEnv() == 'cli' || !$wa && php_sapi_name() == 'cli') { return date("Y-m-d H:i:s") . " php " . implode(" ", waRequest::server('argv')) . "\n" . "Error: {$this->getMessage()}\nwith code {$this->getCode()} in '{$this->getFile()}' around line {$this->getLine()}:{$this->getFileContext()}\n" . $this->getTraceAsString() . "\n" . ($additional_info ? "Error while initializing waSystem during error generation: " . $additional_info . "\n" : ''); } elseif ($this->code == 404) { $response = new waResponse(); $response->setStatus(404); $response->sendHeaders(); } $request = htmlentities(var_export($_REQUEST, true), ENT_NOQUOTES, 'utf-8'); $params = htmlentities(var_export(waRequest::param(), true), ENT_NOQUOTES, 'utf-8'); $context = htmlentities($this->getFileContext(), ENT_NOQUOTES, 'utf-8'); $trace = htmlentities($this->getTraceAsString(), ENT_NOQUOTES, 'utf-8'); $result = <<<HTML <div style="width:99%; position:relative; text-align: left;"> \t<h2 id='Title'>{$message}</h2> \t<div id="Context" style="display: block;"> \t\t<h3>Error with code {$this->getCode()} in '{$this->getFile()}' around line {$this->getLine()}:</h3> \t\t<pre>{$context}</pre> \t</div> \t<div id="Trace"> \t\t<h2>Call stack</h2> \t\t<pre>{$trace}</pre> \t</div> \t<div id="Request"> \t\t<h2>Request</h2> \t\t<pre>{$request}</pre> </div> </div> <div style="text-align: left;"> <h2>Params</h2> <pre>{$params}</pre> </div> HTML; if ($additional_info) { $additional_info = htmlentities($additional_info, ENT_NOQUOTES, 'utf-8'); $result .= <<<HTML <div style="text-align: left;"> <h2>Error while initializing waSystem during error generation</h2> <pre>{$additional_info}</pre> </div> HTML; } return $result; }