X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplatalpage.php;h=eac986a03530661319c36e3c3866960c3058b42f;hb=c828f2ea1f718c619636ff1be4aaa9f91fb4e84f;hp=01ec3b57d7aad52516ee1f6b8dab2428b69e9846;hpb=6b8d257bc035e92668216da0a4b300945ac61d0f;p=platal.git diff --git a/classes/platalpage.php b/classes/platalpage.php index 01ec3b5..eac986a 100644 --- a/classes/platalpage.php +++ b/classes/platalpage.php @@ -1,6 +1,6 @@ _tpl = $tpl; - $this->_page_type = $type; - $this->assign('xorg_tpl', $tpl); + $this->_tpl = $tpl; + $this->_page_type = $type; + $this->assign('xorg_tpl', $tpl); } // }}} @@ -82,6 +82,14 @@ class PlatalPage extends Smarty $this->assign('xorg_failure', $this->_failure); $this->assign('globals', $globals); + if (Env::v('display') == 'light') { + $this->_page_type = SIMPLE; + } elseif (Env::v('display') == 'raw') { + $this->_page_type = NO_SKIN; + } elseif (Env::v('display') == 'full') { + $this->_page_typ = SKINNED; + } + switch ($this->_page_type) { case NO_SKIN: error_reporting(0); @@ -97,7 +105,7 @@ class PlatalPage extends Smarty } $this->register_outputfilter('hide_emails'); $this->addJsLink('wiki.js'); - header("Accept-Charset: iso-8859-15, latin9, us-ascii, ascii"); + header("Accept-Charset: utf-8"); if (!$globals->debug) { error_reporting(0); @@ -106,17 +114,18 @@ class PlatalPage extends Smarty } if ($globals->debug & 1) { - $this->assign('db_trace', XDB::trace_format($this, 'database-debug.tpl')); + PlBacktrace::clean(); + $this->assign_by_ref('backtraces', PlBacktrace::$bt); } $this->assign('validate', true); error_reporting(0); $result = $this->fetch($skin); - $ttime = sprintf('Temps total: %.02fs
', microtime_float() - $TIME_BEGIN); + $ttime = sprintf('Temps total: %.02fs - Mémoire totale : %dKo
', microtime(true) - $TIME_BEGIN + , memory_get_peak_usage(true) / 1024); $replc = "VALIDATION HTML INACTIVE
"; if ($globals->debug & 2) { - $fd = fopen($this->compile_dir."/valid.html","w"); fwrite($fd, $result); fclose($fd); @@ -184,6 +193,16 @@ class PlatalPage extends Smarty } // }}} + // {{{ function addCssInline + + function addCssInline($css) + { + if (!empty($css)) { + $this->append('xorg_inline_css', $css); + } + } + + // }}} // {{{ function setRssLink function setRssLink($title, $path) @@ -245,20 +264,14 @@ function at_to_globals($tpl_source, &$smarty) function trimwhitespace($source, &$smarty) { - $tags = array('script', 'pre', 'textarea'); - - foreach ($tags as $tag) { - preg_match_all("!<{$tag}[^>]+>.*?!is", $source, ${$tag}); - $source = preg_replace("!<{$tag}[^>]+>.*?!is", "&&&{$tag}&&&", $source); - } + $tags = '(script|pre|textarea)'; + preg_match_all("!<$tags.*?>.*?!ius", $source, $tagsmatches); + $source = preg_replace("!<$tags.*?>.*?!ius", "&&&tags&&&", $source); // remove all leading spaces, tabs and carriage returns NOT // preceeded by a php close tag. $source = preg_replace('/((?)\n)[\s]+/m', '\1', $source); - - foreach ($tags as $tag) { - $source = preg_replace("!&&&{$tag}&&&!e", 'array_shift(${$tag}[0])', $source); - } + $source = preg_replace("!&&&tags&&&!e", 'array_shift($tagsmatches[0])', $source); return $source; } @@ -269,7 +282,7 @@ function trimwhitespace($source, &$smarty) function form_force_encodings($source, &$smarty) { return preg_replace('/ and