Smarty();
$this->template_dir = $globals->spoolroot."/templates/";
$this->compile_dir = $globals->spoolroot."/spool/templates_c/";
array_unshift($this->plugins_dir, $globals->spoolroot."/plugins/");
$this->config_dir = $globals->spoolroot."/configs/";
$this->compile_check = !empty($globals->debug);
if ($type == SKINNED) {
$this->register_modifier('escape_html', 'escape_html');
$this->default_modifiers[] = '@escape_html';
}
$this->_page_type = $type;
$this->_tpl = $tpl;
$this->_errors = array();
$this->_failure = false;
$this->register_prefilter('at_to_globals');
$this->register_prefilter('trimwhitespace');
$this->addJsLink('javascript/xorg.js');
$this->doAuth();
}
// }}}
// {{{ function fakeDiogenes()
function fakeDiogenes()
{
require_once 'diogenes/diogenes.core.page.inc.php';
$this->register_function("extval","diogenes_func_extval");
$this->register_function("flags","diogenes_func_flags");
$this->register_function("a","diogenes_func_a");
$this->register_function("checkbox","diogenes_func_checkbox");
$this->register_function("diff","diogenes_func_diff");
$this->register_function("menu_item","diogenes_func_menu_item");
$this->register_function("tag","diogenes_func_tag");
$this->register_function("toolbar","diogenes_func_toolbar");
}
// }}}
// {{{ function changeTpl()
function changeTpl($tpl, $type=SKINNED)
{
$this->_tpl = $tpl;
$this->_page_type = $type;
if ($type == SKINNED) {
$this->register_modifier('escape_html', 'escape_html');
$this->default_modifiers = Array('@escape_html');
}
$this->_page_type = $type;
$this->assign('xorg_tpl', $tpl);
}
// }}}
// {{{ function _run()
function _run($skin)
{
global $globals, $TIME_BEGIN;
session_write_close();
$this->assign("xorg_errors", $this->_errors);
$this->assign("xorg_failure", $this->_failure);
if ($this->_page_type == NO_SKIN) {
$this->display($this->_tpl);
exit;
}
if (!$globals->debug) {
$this->display($skin);
exit;
}
if ($globals->debug & 1) {
$this->assign('db_trace', $globals->db->trace_format($this, 'database-debug.tpl'));
}
$this->assign('validate', urlencode($globals->baseurl.'/valid.html'));
$result = $this->fetch($skin);
$ttime .= sprintf('Temps total: %.02fs
', microtime_float() - $TIME_BEGIN);
$replc = "VALIDATION HTML INACTIVE
";
if ($globals->debug & 2) {
$fd = fopen($this->compile_dir."/valid.html","w");
fwrite($fd, $result);
fclose($fd);
exec($globals->spoolroot."/bin/devel/xhtml.validate.pl ".$this->compile_dir."/valid.html", $val);
foreach ($val as $h) {
if (preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) {
$replc = 'HTML OK
';
if ($m[1]) {
$replc = "{$m[1]} ERREUR(S) !!!
";
}
break;
}
}
}
echo str_replace("@HOOK@", $ttime.$replc, $result);
exit;
}
// }}}
// {{{ function run()
function run()
{
die ("implement me");
}
// }}}
// {{{ function nb_errs()
function nb_errs()
{
return count($this->_errors);
}
// }}}
// {{{ function trig()
function trig($msg)
{
$this->_errors[] = $msg;
}
// }}}
// {{{ function trig()
function trig_run($msg)
{
$this->trig($msg);
$this->run();
}
// }}}
// {{{ function fail()
function fail($msg)
{
$this->trig($msg);
$this->_failure = true;
}
// }}}
// {{{ function kill()
function kill($msg)
{
$this->fail($msg);
$this->run();
}
// }}}
// {{{ function doAuth()
function doAuth() { }
// }}}
// {{{ function loadModule()
function loadModule($modname)
{
require_once("$modname.inc.php");
}
// }}}
// {{{ function addJsLink
function addJsLink($path)
{
$this->append('xorg_js', $path);
}
// }}}
// {{{ function addCssLink
function addCssLink($path)
{
$this->append('xorg_css', $path);
}
// }}}
// {{{ function gassign
function gassign($varname)
{
global $$varname;
$this->assign($varname, $$varname);
}
// }}}
}
// }}}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>