template_dir = $globals->spoolroot."/templates/";
$this->compile_dir = $globals->spoolroot."/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 = new XOrgErrors;
$this->DiogenesCorePage();
$this->register_prefilter('at_to_globals');
$this->register_prefilter('trimwhitespace');
$this->addJsLink('javascript/xorg.js');
$this->doAuth();
}
// }}}
// {{{ 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;
$this->assign("xorg_error", $this->_errors);
if ($this->_page_type == NO_SKIN) {
$this->display($this->_tpl);
exit;
}
if ($globals->debug) {
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;
}
$this->display($skin);
exit;
}
// }}}
// {{{ function run()
function run()
{
die ("implement me");
}
// }}}
// {{{ function nb_errs()
function nb_errs()
{
return count($this->_errors->errs);
}
// }}}
// {{{ function trig()
function trig($msg)
{
$this->_errors->trig($msg);
}
// }}}
// {{{ function trig()
function trig_run($msg)
{
$this->_errors->trig($msg);
$this->run();
}
// }}}
// {{{ function fail()
function fail($msg)
{
$this->_errors->fail($msg);
}
// }}}
// {{{ 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:
?>