public function __construct($r = array()) { $this->allowed_methods = array('views'); if (lib::client_is_internal_host()) { $this->allowed_methods[] = 'views_demo'; } parent::__construct($r); }
public static function log_exception($e) { $msg = $e->getMessage(); $code = $e->getCode(); $html = isset($_SERVER['SERVER_SOFTWARE']); if (method_exists($e, "getStatement")) { $msg .= ($html ? "<br/>" : "\n") . $e->getStatement(); } error_log($msg); if ($html) { $msg = preg_replace("/\n/", "<br />", $msg); print "<h2>" . get_class($e) . " (code {$code})</h2><tt>{$msg}</tt>\n"; } else { print get_class($e) . " (code {$code})\n{$msg}\n"; } $showtb = $html && ($_SERVER['show_traceback_in_browser'] && lib::client_is_internal_host()); if ($showtb) { if ($html) { print "<hr/>Traceback: <pre>"; } } error_log("cwd is " . getcwd()); # FIXME should use the getTrace() method instead for easier/more-accurate formatting $x = $e->getTraceAsString(); foreach (explode("\n", $x) as $l) { $l = preg_replace('@(\\d) ' . $_SERVER['filebase'] . '/(.+)@', '\\1 \\2', $l); error_log($l); if ($showtb) { print "{$l}\n"; } } if ($showtb) { print "</pre>"; } }