FormatHTML = false;
$this->ShowRuntimeInfo = false;
$this->Encoding = 'utf-8';
$this->Style = 'new';
// TODO: Move to external code
if(isset($this->System->Config['Web']['FormatHTML']))
$this->FormatHTML = $this->System->Config['Web']['FormatHTML'];
if(isset($this->System->Config['Web']['ShowRuntimeInfo']))
$this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo'];
if(isset($this->System->Config['Web']['Charset']))
$this->Encoding = $this->System->Config['Web']['Charset'];
if(isset($this->System->Config['Web']['Style']))
$this->Style = $this->System->Config['Web']['Style'];
}
function Show()
{
return('');
}
function SystemMessage($Title, $Text)
{
return('
');
//ShowFooter();
//die();
}
function ShowHeader($Title, $Path)
{
$ScriptName = $_SERVER['REQUEST_URI'];
while(strpos($ScriptName, '//') !== false)
$ScriptName = str_replace('//', '/', $ScriptName);
if(strpos($ScriptName, '?') !== false)
$ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?'));
$ScriptName = substr($ScriptName, strlen($this->System->Link('')));
if(substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);
$Page = $this;
$Navigation = '';
while($Page)
{
$Navigation = ' > '.$Page->ShortTitle.''.$Navigation;
if(class_exists($Page->ParentClass))
{
$PageClass = $Page->ParentClass;
$Page = new $PageClass($this->System);
$ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '/'));
} else $Page = null;
}
$Navigation = substr($Navigation, 6);
$BodyParam = '';
if(isset($this->Load)) $BodyParam .= ' onload="'.$this->Load.'"';
if(isset($this->Unload)) $BodyParam .= ' onunload="'.$this->Unload.'"';
$Output = 'Encoding.'"?>'."\n".
''.
''.
''.
''.
''.
''.$this->System->Config['Web']['Title'].' - '.$Path.'
';
if($this->BasicHTML == false)
{
//$Output .= ''.$Title.'
';
$Output .= '';
}
return($Output);
}
function ShowFooter()
{
global $ScriptTimeStart, $Revision, $ReleaseTime;
$Time = round(GetMicrotime() - $ScriptTimeStart, 2);
$Output = '';
if($this->BasicHTML == false)
{
$Output .= '';
}
$Output .= '';
return($Output);
}
function GetOutput()
{
//try {
$Output = $this->Show();
//} catch (Exception $E) {
// $Output = 'Chyba: '.$E->getMessage();
//}
if($this->ClearPage == false)
{
$Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
$Output .= $this->ShowFooter();
if($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
}
echo($Output);
}
function NewPage($ClassName)
{
$Page = new $ClassName();
$Page->System = $this->System;
$Page->Database = $this->Database;
$Page->FormatHTML = $this->FormatHTML;
return($Page);
}
// XML formating function
function FormatOutput($s)
{
$out = '';
$nn = 0;
$n = 0;
while($s != '')
{
$start = strpos($s, '<');
$end = strpos($s, '>');
if($start != 0)
{
$end = $start - 1;
$start = 0;
}
$line = trim(substr($s, $start, $end + 1));
if(strlen($line) > 0)
if($line[0] == '<')
{
if($s[$start + 1] == '/')
{
$n = $n - 2;
$nn = $n;
} else
{
if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
else $cmd = substr($line, 1, strlen($line) - 2);
//echo('['.$cmd.']');
if(strpos($s, ''.$cmd.'>')) $n = $n + 2;
}
}// else $line = '['.$line.']';
//if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
$s = substr($s, $end + 1, strlen($s));
$nn = $n;
}
return($out);
}
}