]> gitweb.fluxo.info Git - original.git/commitdiff
Avoiding deprecation notices (3)
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 18 Feb 2011 13:44:58 +0000 (11:44 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 18 Feb 2011 13:44:58 +0000 (11:44 -0200)
www/inc/exif.inc.php
www/inc/funkce.inc.php
www/inc/photo.class.inc.php
www/inc/www.class.inc.php
www/index.php

index 00068c8392db7b42513661debc304ff0778fc34d..ac30a16ab4b77f6eefd281678986ac8a2de9476a 100644 (file)
@@ -46,7 +46,7 @@ function formatEXIF ($k,$v) {
                        break;
                case "DateTime":
                        //return date("M d Y H:i:s", $v);
-                       ereg("^([0-9]{4}):([0-9]{1,2}):([0-9]{1,2}) (.*)",$v,$x);
+                       preg_match("/^([0-9]{4}):([0-9]{1,2}):([0-9]{1,2}) (.*)/",$v,$x);
                        return $x[1] . "/" . $x[2] . "/" . $x[3] . " " . $x[4];
                        break;
                default:
index de4b592a6fceecc7fa30c4d610f5d4a024af736e..1f893414bcb6293111a65e27345046752345dc7b 100644 (file)
@@ -3,8 +3,8 @@
 function check($file) {
    global $gallery_dir, $page;
    
-#   if (eregi("[^0-9a-z\_\-\ ]",$file) || !file_exists("$gallery_dir/$file")) {
-#   if (eregi("CVS",$file) || !file_exists("$gallery_dir/$file")) {
+#   if (preg_match("/[^0-9a-z\_\-\ ]/i",$file) || !file_exists("$gallery_dir/$file")) {
+#   if (preg_match("/CVS/i",$file) || !file_exists("$gallery_dir/$file")) {
    if (!file_exists("$gallery_dir/$file")) {
       echo "funkce.inc.php/check(): Bad input";
       $page->footer();
@@ -16,19 +16,19 @@ function browserCheck() {
    global $HTTP_USER_AGENT;
    
         $HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
-   if (eregi("(MSIE.[456789]).*Mac.*",$HTTP_USER_AGENT)) {
+   if (preg_match("/(MSIE.[456789]).*Mac.*/i",$HTTP_USER_AGENT)) {
         return("macie4+");
-   } elseif (eregi("(MSIE.[678])",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/(MSIE.[678])/i",$HTTP_USER_AGENT)) {
         return("ie6+");
-   } elseif (eregi("(MSIE.[45])",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/(MSIE.[45])/i",$HTTP_USER_AGENT)) {
         return("ie4+");
-   } elseif (eregi("Opera",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/Opera/i",$HTTP_USER_AGENT)) {
         return("opera");
-   } elseif (eregi("(Mozilla.4)",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/(Mozilla.4)/i",$HTTP_USER_AGENT)) {
         return("netscape4");
-   } elseif (eregi("(Mozilla.[5-9])",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/(Mozilla.[5-9])/i",$HTTP_USER_AGENT)) {
         return("mozilla");
-   } elseif (eregi("KMeleon",$HTTP_USER_AGENT)) {
+   } elseif (preg_match("/KMeleon/i",$HTTP_USER_AGENT)) {
         return("mozilla");
    } else {
         return("Netscape3");
index 1b677c1aa56d29a6aff75b0f4da4175fa21cac47..46f1a8f563e8ddbbdd840635b0abf0efb0262004 100644 (file)
@@ -102,7 +102,7 @@ class C_photo {
                                return;
                        }
                        //parse buffer
-                       if(eregi("^<span>(.*)</span>( - )?(.*)", $buffer, $x)) {
+                       if(preg_match("/^<span>(.*)</span>( - )?(.*)/i", $buffer, $x)) {
                                $this->name = $x[1]; //mostly "Photo"
                                $this->caption = chop($x[3]);
                        } else {
index bb61a5cb615df8d632bf5724503b5d4a5dd75344..312ba508944a7c0f4765dbe1c98ae0f717f2305f 100644 (file)
@@ -289,14 +289,14 @@ class C_www {
                                $comment_data = stripslashes(strip_tags($comment_data,$allowedTags));
                                // thanks google: 
                                // http://www.google.com/googleblog/2005/01/preventing-comment-spam.html
-                               $comment_data = eregi_replace("<a ","<a rel=\"nofollow\" ",$comment_data);
+                               $comment_data = preg_replace("/<a ","<a rel=\"nofollow\" /i",$comment_data);
 
                                #further comment spam
                                $comment_blacklist = array("pharmacy", "poker", "Viagra");
 
                                foreach($comment_blacklist as $blackword) {
                                        $check = addslashes($blackword);
-                                       if (eregi($check,$comment_data)) {
+                                       if (preg_match("/$check/i",$comment_data)) {
                                                #write error message
                                                $this->error( __('No comment spam'), __('Your comment includes blacklisted word') . __('No comment spam') );
                                                $this->footer();
index 5711b8722647a254351494fbe4b5931d6f49921e..f32d3b384ec8d8d7944646bb0ecc296c2fd9b875 100644 (file)
@@ -199,7 +199,7 @@ if (!$galerie) {
    $imgfiles = new SortDir($path);
    check($galerie); // check for nasty input
    while ($file = $imgfiles->read()) {
-      if (is_file("$path/$file") && eregi("^img-([0-9]+)\.(png|jpe?g)", $file, $x)) {
+      if (is_file("$path/$file") && preg_match("/^img-([0-9]+)\.(png|jpe?g)/i", $file, $x)) {
                                                                 
          $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
          $imgsize = getimagesize("$root/$thumb");
@@ -220,7 +220,7 @@ if (!$galerie) {
                                                        $fh = fopen("$gallery_dir/$galerie/comments/user_${x[1]}.txt","r");
                                                        while (!feof($fh)) {
                                                                $line = fgets($fh);
-                                                               if (eregi("commententry",$line)) $NumOfComments++;
+                                                               if (preg_match("/commententry/i",$line)) $NumOfComments++;
                                                        }
                                                        fclose($fh);
                                         }
@@ -232,8 +232,8 @@ if (!$galerie) {
                                 }
         if (file_exists("$gallery_dir/$galerie/comments/${x[1]}.txt") &&
                   $title = file_get_contents("$gallery_dir/$galerie/comments/${x[1]}.txt")) {
-            $title = ereg_replace("(\"|\')","",trim(strip_tags($title)));
-            $title = ereg_replace("(.{77}).*","\\1",$title);
+            $title = preg_replace("/(\"|\')/","",trim(strip_tags($title)));
+       $title = preg_replace("/(.{77}).*/","\\1",$title);
         } else 
           $title = "Photo ${x[1]}";
 
@@ -332,7 +332,7 @@ if (!$galerie) {
       print "</a>\n";
       print " : \n";
       while ($thumbfile = $imgfiles->read()) {
-         if ( eregi("^img-([0-9]+)\.(png|jpe?g)",
+         if ( preg_match("/^img-([0-9]+)\.(png|jpe?g)/",
              $thumbfile, $x)) {
             $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
             print "   <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}";