3 require('nastaveni.php');
5 $zacatek = getMicrotime();
7 function exception_handler($exception) {
8 html("Došlo k chybě: " . $exception->getMessage());
9 //header("Location: chyba_db.php");
13 set_exception_handler('exception_handler');
16 if (empty($_SERVER['HTTP_ACCEPT'])) {
17 $mimeTyp = 'application/xhtml+xml';
19 $mimeTyp = (( stristr( $_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml' ) && !preg_match("/application\/xhtml\+xml;\s*q=0(\.0)?\s*(,|$)/",$_SERVER['HTTP_ACCEPT']) ) ? 'application/xhtml+xml' : 'text/html' );
21 header("Content-Type: $mimeTyp");
23 /** $nadpis = titulek stránky + h1 */
24 function zahlavi($nadpis) {
27 html('<?xml version="1.0" encoding="UTF-8"?>
28 <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
29 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
31 <meta http-equiv="content-language" content="cs"/>
32 <meta http-equiv="content-type" content="' . $mimeTyp . '; charset=UTF-8"/>
33 <meta name="GOOGLEBOT" content="NOINDEX, NOFOLLOW"/>
34 <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
35 <link href="styl.css" type="text/css" rel="StyleSheet"/>
36 <script type="text/javaScript" src="hlavni.js"></script>
37 <script type="text/javaScript" src="tridenitabulky.js"></script>
38 <title>' . $nadpis . '</title>
41 <h1>' . $nadpis . '</h1>');
50 function htmlInfoKomentar() {
51 global $zacatek, $mimeTyp, $NASTAVENI;
52 if ($NASTAVENI['ladiciKomentare']) {
53 $konec = getMicrotime();
55 html('Stránka: ' . $_SERVER['REQUEST_URI']);
56 html('Klient: ' . $_SERVER['REMOTE_ADDR']);
57 html('MIME: ' . $mimeTyp);
58 html("Začátek zpracování: $zacatek");
59 html("Konec zpracování: $konec");
60 html('Doba zpracování: ' . ($konec - $zacatek) . 's');
65 function htmlOdstavec($text) {
66 html("<p>\n$text\n</p>");
69 function html($text) {
71 /** Odstraníme odkazy, které vedou na tutéž stránku */
72 $text = str_replace(' href="' . $stranka . '"', '', $text);
77 function htmlZnacka($znacka, $text) {
78 html("<$znacka>$text</$znacka>");
81 function htmlTlacitkovyOdkaz($url, $text) {
82 html('<form action="' . $url . '"><fieldset><button>' . $text . '</button></fieldset></form>');
85 function sqlZjistiHodnotu($dotaz, $parametry = null) {
88 $dotaz = $db->prepare($dotaz);
90 if ($parametry != null) {
91 for($i = 0; $i < count($parametry); $i++) {
92 $dotaz->bindParam($i+1, $parametry[$i]);
97 $r = $dotaz->fetchAll();
105 function getMicrotime(){
106 list($usec, $sec) = explode(" ",microtime());
107 return ((float)$usec + (float)$sec);
110 function logujChybu($popis, $chyba = null) {
111 htmlOdstavec($popis);