/** * central starting point. * to be called in htdocs/index.php */ function launch() { $env_explore = $this->initializeGlobalState(); try { // find an app and run it. $this->chooseAndRunApplication($env_explore); } catch (Exception $e) { ExceptionLogger::logException($e); $debug = true; if (class_exists('PVars') && !($debug = PVars::get()->debug)) { $debug = false; } if (class_exists('ExceptionPage') && $debug) { $page = new ExceptionPage(); $page->exception = $e; $page->render(); } elseif ($debug) { echo ' <h2>A terrible ' . get_class($e) . ' was thrown</h2> <p>RoxLauncher is feeling sorry.</p> <pre>'; print_r($e); echo ' </pre>'; } else { echo <<<HTML <html> <head><title>BeWelcome</title></head> <body style="width:100%; margin: 0; padding: 0; background: #f7f7f7 url(../images/bggrey.png) top left "> <div style="background: #f37000; border-bottom: 1px solid white; height: 49px"> <div style="margin:0 auto; width:960px;"> <div style="margin:0 auto;"><img style="padding: 7px;" src="../images/logo_index_top.png" /></div> </div> </div> <div style="margin:0 auto; width:960px;"><h1>Well,</h1> <p>this is awkward. We couldn't serve your page.</p> <p>You might have found a bug or our server is currently updating some really important stuff to keep it secure.</p> <p>Please try again in a minute or two.</p></div></div> </html> HTML; } } }
public function dataRetention() { if ($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') { header("Location: " . PVars::getObj('env')->baseuri); exit(0); } ob_start(); try { $this->model->removeMembers(); } catch (Exception $e) { ExceptionLogger::logException($e); header("Location: " . PVars::getObj('env')->baseuri); exit(0); } ob_end_clean(); exit(0); }
/** * normally the $pdo should be injected. * If it's not, this function creates a new one out of the blue.. */ protected function get_pdo() { if ($this->pdo == null) { $dbConfig = PVars::getObj('config_rdbms'); try { $this->pdo = new PDO($dbConfig->dsn, $dbConfig->user, $dbConfig->password, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } catch (PDOException $e) { ExceptionLogger::logException($e); $this->pdo = null; } } return $this->pdo; }
/** * Construct the parent and call the logger * * @param string $message An explanatory message explaining why the exception was thrown * @param int $code The error code for the exception. Zero is the default * @param string $module The module to which the exception applies * @param string $severity The severity of the error. Possible values defined in $cfg['Logger']['levels'] * */ public function __construct($message = null, $code = 0, $module = null, $severity = null) { ExceptionLogger::logMessage($this, $module, $severity); parent::__construct($message, $code); }
private function __construct() { ExceptionLogger::initialize(); ErrorLogger::initialize(); }