Cosmetic: Code cleanup
[www.energie.vellum.cz.git] / common.php
index cd9e5e4..0f9a035 100644 (file)
@@ -78,7 +78,7 @@ function db_connect()
 
        if (isset($db_link))
                return;
-       if (!($db_link=@mysql_connect($db_host,$db_user,$db_pwd)))
+       if (!($db_link=mysql_connect($db_host,$db_user,$db_pwd)))
                fatal("MySQL connect: ".mysql_error());
        if (!mysql_select_db($db_name,$db_link))
                fatal("MySQL database select: ".mysql_error());
@@ -118,8 +118,8 @@ function month_a($year,$month,$month_last=0)
 
        $r=array("year"=>$year,"month"=>$month,"month_last"=>$month_last,"month_full"=>$month_full,
                        "name"=>"$year/${month_full}",
-                       "img" =>"img/eap-$year-${month_full}.jpg",
-                       "icon"=>"img/eap-$year-${month_full}s.jpg",
+                       "img" =>"img/eap-$year-${month_full}.jpeg",
+                       "icon"=>"img/eap-$year-${month_full}s.jpeg",
                        );
        return($r);
 }
@@ -260,6 +260,19 @@ function title($year,$month)
                return(title_icons(&$year,&$month));
 }
 
+function image_supported($mime)
+{
+       global $HTTP_SERVER_VARS;
+
+       $exp=explode(",",$HTTP_SERVER_VARS["HTTP_ACCEPT"]);
+       while (($s=array_shift($exp))) {
+               $s=trim(ereg_replace(";.*","",$s));
+               if ($s==$mime)
+                       return(true);
+               }
+       return(false);
+}
+
 function footer()
 {
        // deadlock prevention: