X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fplatal.inc.php;h=b396d78ab10374cab5a9bfcdfe21d459753b3a68;hb=b16ea6f895109cfc82f0914b992e41ac5b3b4314;hp=bab48ad947181b073b9ce11580aa43d0c6505579;hpb=76a8d80be688b4663ffcc5ecb1bdd62c8f59dcc1;p=platal.git diff --git a/include/platal.inc.php b/include/platal.inc.php index bab48ad..b396d78 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -35,15 +35,24 @@ define('NO_SKIN', 2); define('NO_AUTH', 0); define('DO_AUTH', 1); +define('NO_HTTPS', 2); + +define('DEBUG_BT', 1); +define('DEBUG_VALID', 2); +define('DEBUG_SMARTY', 4); function __autoload($cls) { $cls = strtolower($cls); $path = dirname(dirname(__FILE__)); if (!@include "$path/classes/$cls.php") { - if (substr($cls, -1, 3) == 'req') { + if (substr($cls, -3, 3) == 'req') { @include 'validations.inc.php'; return; + } else if (substr($cls, 0, 6) == 'banana') { + require_once 'banana/banana.inc.php'; + Banana::load(substr($cls, 6)); + return; } @include "$cls.inc.php"; } @@ -52,35 +61,40 @@ __autoload('Env'); function pl_error_handler($errno, $errstr, $errfile, $errline) { + static $errortype; 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" - ); + if (!isset($errortype)) { + $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", + E_RECOVERABLE_ERROR => "Recoverable Error" + ); + } global $globals; if (isset($globals) && !$globals->debug) { - if (strpos($errortype[$errno], 'Notice') !== false) { + if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) { return; } } + $type = isset($errortype[$errno]) ? $errortype[$errno] : $errno; $errstr = utf8_encode(htmlentities($errstr)); $GLOBALS['pl_errors'][] = "