public function handleError($app, $errno, $message, $file, $line) { $aError = compact('errno', 'message', 'file', 'line'); Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email); Pico::cfg()->use_debug_log and dbglogr($aError); return $this->error($app, $aError, PICOWA_DEBUG_MODE); }
public static function cfg($oCfg = null) { if (is_null($oCfg)) { return self::$cfg; } self::$cfg = $oCfg; }
public function handleException($app, $exception) { $aError = array('type' => get_class($exception), 'code' => $exception->getCode(), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine()); Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email); Pico::cfg()->use_debug_log and dbglogr($aError); $aError['trace'] = $exception->getTraceAsString(); return $this->error($app, $aError, PICOWA_DEBUG_MODE); }
protected function initializeSession() { ini_set('session.serialize_handler', 'php'); ini_set('session.name', Pico::cfg()->session_name); ini_set('session.cookie_lifetime', Pico::cfg()->cookie_lifetime); ini_set('session.auto_start', 0); ini_set('session.save_path', PICOWA_TEMP_PATH . 'sessions'); }
public function handleError($errno, $message, $file, $line) { $aError = compact($errno, $message, $file, $line); Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email); Pico::cfg()->use_debug_log and dbglog(print_r($aError, true)); header("HTTP/1.0 500 Server Error"); PICOWA_DEBUG_MODE and print_r($aError); echo $this->render('500'); die; }
define('PICOWA_MOUNT_POINT', substr($reqUrl, 0, -strlen($url) - 1)); define('PICOWA_REQUEST_URL', '/' . $url); } /** * Include Picowa Autoload */ if (!(include PICOWA_LIB_PATH . 'AutoLoad.php')) { trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'AutoLoad.php' . ".", E_USER_ERROR); } /** * Environment Constants */ $oCfg = PwComponentFactory::set('PwComponentBuilder')->build('PwConfig', array('production' => array('server' => '', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 1, 'use_debug_log' => 1, 'use_error_handler' => 1, 'builder' => 'PwComponentBuilder'), 'development' => array('server' => '127.0.0.1', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 0, 'use_debug_log' => 0, 'use_error_handler' => 0, 'builder' => 'PwComponentBuilder')), 'picowa_config'); // define debug mode if (!defined('PICOWA_DEBUG_MODE')) { $devServer = $oCfg->development('server'); $prdServer = $oCfg->production('server'); $debugMode = 0; if ($devServer !== '' && ($_SERVER['SERVER_ADDR'] === $devServer || $_SERVER['SERVER_NAME'] === $devServer)) { $debugMode = 1; } else { if ($prdServer !== '' && ($_SERVER['SERVER_ADDR'] === $prdServer || $_SERVER['SERVER_NAME'] === $prdServer)) { $debugMode = 0; } } define('PICOWA_DEBUG_MODE', $debugMode); } $configKey = PICOWA_DEBUG_MODE ? 'development' : 'production'; PwComponentFactory::set($oCfg->{$configKey}('builder')); Pico::cfg(PwComponentFactory::get('PwArrayWrapper', $oCfg->{$configKey}));
/** * Include Picowa Autoload */ if (!(include PICOWA_LIB_PATH . 'PreLoad.php')) { trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'PreLoad.php' . ".", E_USER_ERROR); } if (!(include PICOWA_LIB_PATH . 'AutoLoad.php')) { trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'AutoLoad.php' . ".", E_USER_ERROR); } /** * Environment Constants */ $oCfg = Pw_Component_Factory::set('Pw_Component_Builder')->build('Pw_Config', array('production' => array('server' => '', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 1, 'use_debug_log' => 1, 'use_error_handler' => 1, 'builder' => 'Pw_Component_Builder'), 'development' => array('server' => '127.0.0.1', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 0, 'use_debug_log' => 0, 'use_error_handler' => 0, 'builder' => 'Pw_Component_Builder')), 'picowa_config'); // define debug mode if (!defined('PICOWA_DEBUG_MODE')) { $devServer = $oCfg->development('server'); $prdServer = $oCfg->production('server'); $debugMode = 0; if ($devServer !== '' && ($_SERVER['SERVER_ADDR'] === $devServer || $_SERVER['SERVER_NAME'] === $devServer)) { $debugMode = 1; } else { if ($prdServer !== '' && ($_SERVER['SERVER_ADDR'] === $prdServer || $_SERVER['SERVER_NAME'] === $prdServer)) { $debugMode = 0; } } define('PICOWA_DEBUG_MODE', $debugMode); } $configKey = PICOWA_DEBUG_MODE ? 'development' : 'production'; Pw_Component_Factory::set($oCfg->{$configKey}('builder')); Pico::cfg(Pw_Component_Factory::get('Pw_Wrapper_Array', $oCfg->{$configKey})); define('PICOWA_BOOTSTRAP', true);