+dirnameslashed($filename)
[www.energie.vellum.cz.git] / common.php
index f0fd2c9..ab99ea7 100644 (file)
@@ -25,7 +25,7 @@
        else if (ereg("[[:<:]]Mozilla/([0-9]+)\\.",$user_agent,$mozilla_major_a))
                $mozilla_major=$mozilla_major_a[1];
 
-       $have_style=!ereg("Mozilla/4\\.[5-7]",$user_agent);
+       $have_style=!isset($mozilla_major) || $mozilla_major!=4;
        $have_css=true; // doesn't hurt anybody AFAIK
 
 function addpercents($url)
@@ -43,7 +43,7 @@ function fatal($msg="UNKNOWN")
 {
        global $admin_mail;
 
-       print("\n<br /><h1 class=\"error\">Nastala chyba pøi zpracování: $msg!</h1>\n"
+       print("\n<p>&nbsp;<br />&nbsp;</p><hr /><h1 class=\"error\">Nastala chyba pøi zpracování: $msg!</h1>\n"
                        ."<p>Mù¾ete tento problém nahlásit <a href=\"mailto:$admin_mail\">správci tohoto webu</a>.</p>\n");
        footer();
 }
@@ -304,7 +304,16 @@ function image_supported($mime)
        return(false);
 }
 
-function footer()
+// PHP dirname() is broken: ("/1/2/3"=>"/1/2", "/1"->"/")
+function dirnameslashed($filename)
+{
+       $r=dirname($filename);
+       if (substr($r,-1)!="/")
+               $r.="/";
+       return($r);
+}
+
+function footer($delimit=true)
 {
        // deadlock prevention:
        global $footer_passed;
@@ -313,8 +322,9 @@ function footer()
        $footer_passed=true;
 
        global $cvs_id_html,$viewcvs,$viewcvs,$HTTP_SERVER_VARS;
+       if ($delimit)
+               print("<p>&nbsp;</p>\n");
        ?>
-<p>&nbsp;</p>
 <hr />
 <table border="0" width="100%">
 <tr><td align="left"><span class="cvs-id"><?php print($cvs_id_html); ?></span></td><td align="right"><a