Jeremy Newman : fix some depreciated functions

Jeremy Newman jnewman at winehq.org
Thu Apr 12 14:53:42 CDT 2012


Module: website
Branch: master
Commit: b1fc778e554739273849bf4016d4d0570a4b01d6
URL:    http://source.winehq.org/git/website.git/?a=commit;h=b1fc778e554739273849bf4016d4d0570a4b01d6

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Thu Apr 12 14:24:03 2012 -0500

fix some depreciated functions

---

 include/utils.php |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/include/utils.php b/include/utils.php
index 4cb98f3..e51b0c1 100644
--- a/include/utils.php
+++ b/include/utils.php
@@ -101,16 +101,28 @@ function get_files ($dir, $filter = null)
 {
     // read dir
     $files = array();
-        
     $d = opendir($dir);
     while($entry = readdir($d))
     {
-    	if ($filter)
-	    {
-	        if(!eregi("(.+)\\.".$filter, $entry))
-	            continue;
-	    }
-    	array_push($files, $entry);
+        if (is_dir($dir.$entry))
+            continue;
+        if (is_array($filter))
+        {
+            $in = 0;
+            foreach ($filter as $f)
+            {
+                if (preg_match('/(.+)\\.'.$f.'/', $entry))
+                    $in = 1;
+            }
+            if (!$in)
+                continue;
+        }
+        else if ($filter)
+        {
+            if (!preg_match('/(.+)\\.'.$filter.'/', $entry))
+                continue;
+        }
+        array_push($files, $entry);
     }
     closedir($d);
     
@@ -127,11 +139,11 @@ function get_xml_tags ($file, $tags = null)
     {
         $content = array();
         $fp = @fopen($file, "r");
-	    $data = fread($fp, filesize($file));
-	    @fclose($fp);
+        $data = fread($fp, filesize($file));
+        @fclose($fp);
         foreach ($tags as $tag)
         {
-            if (eregi("<" . $tag . ">(.*)</" . $tag . ">", $data, $out))
+            if (preg_match("/\<{$tag}\>(.*)\<\/{$tag}\>/Us", $data, $out))
             {
                 $content[$tag] = $out[1];
             }




More information about the wine-cvs mailing list