Connect($Options['DB_Host'], $Options['DB_User'], $Options['DB_Password'], $Options['DB_Database']);
$Database->charset('utf8');
$Database->Prefix = $DB_Prefix;
function IconedLink($Link, $Text)
{
global $Options;
$Extension = strtolower(substr($Link, strrpos($Link, '.') + 1));
$IconFile = 'images/icons/'.$Extension.'.gif';
//echo($IconFile."
\n");
if(!file_exists($IconFile))
{
$Extension = 'blank';
$IconFile = 'images/icons/'.$Extension.'.gif';
}
$Icon = ' ';
return($Icon.''.$Text.'');
}
function ShowArray($Pole)
{
echo('
');
print_r($Pole);
echo('
');
}
function GetMicrotime()
{
list($Usec, $Sec) = explode(" ",microtime());
return ((float)$Usec + (float)$Sec);
}
function ShowHeader($Path, $Title)
{
global $Time_Start, $refresh, $Charset, $Options, $Output;
$Time_Start = GetMicrotime();// Zjisti počáteční čas
$Cesty = array(
);
$Output = '
';
if (isset($refresh)) $Output .= '\n";
//
$Output .= ''.$Options['Title'].' - '.$Title.''.
''.
''.
''.
''.$Title.'
'.
'Navigace >> ';
$I = 1;
foreach($Path as $Index => $Item)
{
$Item = substr($Options['RootPath'],0,-1).$Item;
$Output .= '
'.$Index.'';
if(count($Path) > $I) $Output .= ' > ';
$I++;
}
$Output .= '
';
}
function ShowFooter()
{
global $Time_Start, $Version, $Output;
$Time = floor((GetMicrotime() - $Time_Start)*100)/100;
$Output .= '| Web mistr: Jiří Hajda | e-mail: robie@centrum.cz | ICQ: 277158770 | Vygenerováno za '.$Time.' s | Verze: '.$Version.' | Naposledy aktualizováno: '.date('j.n.Y',filemtime($_SERVER['SCRIPT_FILENAME'])).' |
';
//ShowArray($GLOBALS);
$Output .= '';
echo($Output);
//echo(FormatOutput($Output));
}
$MonthNames = array('','Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec');
function HumanDate($Date)
{
$Parts = explode('-',$Date);
if($Date != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]);
else return(' ');
}
// Zobrazení číselný seznamu stránek
function PagesList($URL, $Page, $TotalCount, $CountPerPage)
{
$Count = ceil($TotalCount/$CountPerPage);
$Around = 10;
$Result = '';
if($Count>1)
{
if($Page>0)
{
$Result.= '<< ';
$Result.= '< ';
}
$PagesMax = $Count-1;
$PagesMin = 0;
if($PagesMax>($Page+$Around)) $PagesMax = $Page+$Around;
if($PagesMin<($Page-$Around))
{
$Result.= ' .. ';
$PagesMin = $Page-$Around;
}
for($i=$PagesMin;$i<=$PagesMax;$i++)
{
if($i==$Page) $Result.= '';
$Result.= ''.($i+1).' ';
if($i==$Page) $Result.= '';
}
if($PagesMax<($Count-1)) $Result .= ' .. ';
if($Page<($Count-1))
{
$Result.= '> ';
$Result.= '>>';
}
}
return($Result);
}
function GetRemoteAddress()
{
$IP = $_SERVER['REMOTE_ADDR'];
if($IP == '127.0.0.1') $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
return($IP);
}
// Funkce formatovani vystupu
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);
}