X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fplatal.inc.php;h=7fbdc08c570b314f0b7d13c5da2db4e658470aa0;hb=5faeba22490dfadac0c40e034e7273e132392365;hp=900220c2a770795ed7c59fd4fa6f1ef4f0dbac48;hpb=c4bcb1697481d3a6549f228739f17dc081641491;p=platal.git diff --git a/include/platal.inc.php b/include/platal.inc.php index 900220c..7fbdc08 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -54,9 +54,11 @@ function pl_autoload($cls, array $pathes = array()) } else if (starts_with($cls, 'pldbtable')) { $cls = 'pldbtableentry'; } - $basepath = dirname(dirname(dirname(__FILE__))); + $corebasepath = dirname(dirname(__FILE__)); + $basepath = dirname($corebasepath); + $corebasename = basename($corebasepath); - array_unshift($pathes, 'core/classes', 'classes'); + array_unshift($pathes, $corebasename . '/classes', 'classes'); foreach ($pathes as $path) { if (file_exists("$basepath/$path/$cls.php")) { if (include_once "$basepath/$path/$cls.php") { @@ -67,6 +69,7 @@ function pl_autoload($cls, array $pathes = array()) return false; } pl_autoload('Env'); +pl_autoload('PlBacktrace'); function pl_core_include($file) { @@ -107,7 +110,6 @@ function pl_error_handler($errno, $errstr, $errfile, $errline) $type = isset($errortype[$errno]) ? $errortype[$errno] : $errno; $error = strpos($type, 'Warning') !== false || strpos($type, 'Error') !==false; - pl_autoload('PlBacktrace'); if (!isset(PlBacktrace::$bt['PHP Errors'])) { new PlBacktrace('PHP Errors'); } @@ -261,7 +263,7 @@ function pl_content_headers($content_type, $encoding = 'utf-8') * cache duration defaults to the global static_cache_duration. No encoding is * applied by default. */ -function pl_cached_content_headers($content_type, $encoding = null, $cache_duration = -1) +function pl_cached_content_headers($content_type, $encoding = null, $cache_duration = -1, $filename = null) { global $globals; $cache_duration = ($cache_duration < 0 ? $globals->static_cache_duration : $cache_duration); @@ -270,6 +272,9 @@ function pl_cached_content_headers($content_type, $encoding = null, $cache_durat header("Expires: " . gmdate('D, d M Y H:i:s', time() + $cache_duration) . " GMT"); header("Pragma: "); pl_content_headers($content_type, $encoding); + if (!is_null($filename)) { + header('Content-Disposition: attachment; filename=' . $filename); + } } /** @@ -282,5 +287,13 @@ function pl_cached_dynamic_content_headers($content_type, $encoding = null) pl_cached_content_headers($content_type, $encoding, $globals->dynamic_cache_duration); } +function pl_var_dump() +{ + echo '
';
+    $array = func_get_args();
+    call_user_func_array('var_dump', $array);
+    echo '
'; +} + // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>