+define('SIMPLE', 1);
+define('NO_SKIN', 2);
+
+define('NO_AUTH', 0);
+define('DO_AUTH', 1);
+
+function __autoload($cls)
+{
+ @include dirname(dirname(__FILE__)).'/classes/'.strtolower($cls).'.php';
+}
+__autoload('Env');
+
+function pl_error_handler($errno, $errstr, $errfile, $errline)
+{
+ if (!error_reporting())
+ return;
+
+ $errortype = array (
+ E_ERROR => "Error",
+ E_WARNING => "Warning",
+ E_PARSE => "Parsing Error",
+ E_NOTICE => "Notice",
+ E_CORE_ERROR => "Core Error",
+ E_CORE_WARNING => "Core Warning",
+ E_COMPILE_ERROR => "Compile Error",
+ E_COMPILE_WARNING => "Compile Warning",
+ E_USER_ERROR => "User Error",
+ E_USER_WARNING => "User Warning",
+ E_USER_NOTICE => "User Notice",
+ E_STRICT => "Runtime Notice"
+ );
+
+ global $globals;
+ if (isset($globals) && !$globals->debug) {
+ if (strpos($errortype[$errno], 'Notice') !== false) {
+ return;
+ }
+ }
+
+ $errstr = utf8_encode(htmlentities($errstr));
+ $GLOBALS['pl_errors'][] =
+ "<div class='phperror'>".
+ "<strong>{$errortype[$errno]}</strong> <em>$errstr</em><br />".
+ "<tt>$errfile : $errline</tt>".
+ "</div>";
+}
+
+function pl_dump_env()
+{
+ echo "<div class='phperror'><pre>";
+ echo "\nSESSION: "; var_export($_SESSION);
+ echo "\nPOST: "; var_export($_POST);
+ echo "\nGET: "; var_export($_GET);
+ echo "\nCOOKIE: "; var_export($_COOKIE);
+ echo "</pre></div>";
+}