Convert all occurrences of ereg and ereg_replace to strpos and str_replace
authorJoey Schulze <joey@infodrom.org>
Sat, 7 Dec 2013 21:22:07 +0000 (21:22 +0000)
committerJoey Schulze <joey@infodrom.org>
Sat, 7 Dec 2013 21:22:07 +0000 (21:22 +0000)
29 files changed:
Styles/projects.style
src/Debian/events/LinuxTag2001/workshops.wml
src/Debian/events/LinuxTag2002/projects.wml
src/Debian/events/LinuxTag2002/workshops.wml
src/Debian/events/LinuxTag2003/day.html.wml
src/Debian/events/LinuxTag2003/export.wml
src/Debian/events/LinuxTag2003/projects.wml
src/Debian/events/LinuxTag2003/workshops.wml
src/Debian/events/LinuxTag2004/day.html.wml
src/Debian/events/LinuxTag2004/projects.wml
src/Debian/events/LinuxTag2004/workshops.wml
src/Debian/events/LinuxTag2005/day.html.wml
src/Debian/events/LinuxTag2005/forum.wml
src/Debian/events/LinuxTag2005/projects.wml
src/Debian/events/LinuxTag2005/workshops.wml
src/Debian/events/calendar-past.html.wml
src/Debian/events/calendar.html.wml
src/Debian/lists.wml
src/Infodrom/patches/index.wml
src/Infodrom/todo/index.wml
src/Linux/calendar.html.wml
src/Linux/shownews.wml
src/LinuxTag/edit_person.wml
src/LinuxTag/functions.inc
src/LinuxTag/jobs.inc
src/LinuxTag/members.wml
src/LinuxTag/update.wml
src/Mail-Archive/index.wml
src/News/shownews.wml

index ea66c03..b7ae8b5 100644 (file)
       while ($dentry = $dir->read())
        if ($dentry != "." && $dentry != ".." && is_file ($dirname . "/" . $dentry)
            && strstr ($dentry, ".tar.") !== false && substr ($dentry, -4, 4) != '.asc')
-         $file[] = ereg_replace ("\.tar\.", ".tar.", $dentry);
+         $file[] = $dentry;
     }
     return $file;
   }
       $dir = dir ($dirname);
       while ($dentry = $dir->read()) {
        if ($dentry != "." && $dentry != ".." && is_file ($dirname . "/" . $dentry)) {
-         if (ereg (".*-$version\.[^0-9].*", $dentry)) {
+         if (preg_match ("/.*-$version\.[^0-9].*/", $dentry)) {
            $file[] = $dentry;
          }
        }
 
   for ($i=0; ($i < count ($file)) && ($i < <get-var maxdownload>); $i++) {
     # Correct the filename again...
-    $file[$i] = ereg_replace ("\.0\.0\.0\.tar\.", ".tar.", $file[$i]);
     $foo = strstr ($file[$i], ".tar.");
     if ($foo) {
       $name = substr ($file[$i], 0, (strlen ($file[$i]) - strlen ($foo)));
         if ($copy) {
          $version .= "-" . $token;
        } else {
-         if (ereg ("^[0-9][0-9a-zA-Z\.:]*", $token)) {
+         if (preg_match("/^[0-9][0-9a-zA-Z\.:]*/", $token)) {
            $copy = 1;
            $version = $token;
          }
         if ($copy) {
          $version .= "-" . $token;
        } else {
-         if (ereg ("^[0-9][0-9a-zA-Z\.:]*", $token)) {
+         if (preg_match("/^[0-9][0-9a-zA-Z\.:]*/", $token)) {
            $copy = 1;
            $version = $token;
          }
   $file = get_tarfiles2 ("<download-dir>");
 
   for ($i=0; $i < count ($file); $i++) {
-    if (ereg (".*-<: print $version; :>\.tar\..*", $file[$i])) {
+    if (preg_match("/.*-<: print $version; :>\.tar\..*/", $file[$i])) {
       printf ($fstr, $file[$i]);
     }
   }
index d29a40d..386dcab 100644 (file)
@@ -93,7 +93,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
              if (strlen ($row['abstract'])) {
index d526214..d0e27fa 100644 (file)
@@ -45,7 +45,7 @@
        $rdate = $rdate[0];
        $rtime = explode (":", $rtime);
        $rtime = sprintf ("%s:%s", $rtime[0], $rtime[1]);
-       $row['room'] = ereg_replace (" ", "+", $row['room']);
+       $row['room'] = str_replace (" ", "+", $row['room']);
 
        printf ("<br>&nbsp;&nbsp;%s: <a href=\"workshop.php3?room=%s&day=%s&time=%s\">%s</a>",
               $row['speaker'], $row['room'], $rdate, $rtime, $row['title']);
index d5fbd3b..7b86e27 100644 (file)
@@ -88,7 +88,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
              if (strlen ($row['abstract'])) {
index f9b82ee..674ce52 100644 (file)
@@ -94,7 +94,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
              if (strlen ($row['abstract'])) {
@@ -173,7 +173,7 @@ delivered outside of the Debian day
       printf ("<h4>%s, %s</h4>", $dayname[$thisday], spokendate ($thisday));
     }
     if (strlen ($row['abstract'])) {
-      $tr_room = ereg_replace (" ", "+", $row['room']);
+      $tr_room = str_replace (" ", "+", $row['room']);
       $talk = sprintf ("<a href=\"workshop.php3?room=%s&day=%s&time=%s\">%s</a>",
                       $tr_room, $thisday, $rtime, $row['title']);
     } else {
index 5de23cf..9d5a17f 100644 (file)
@@ -5,7 +5,7 @@
 <?
   function db_quote ($text)
   {
-    $text= ereg_replace ("'", "''", $text);
+    $text= str_replace ("'", "''", $text);
     return $text;
   }
 
index 9f62f76..4665587 100644 (file)
@@ -43,7 +43,7 @@
        $rdate = $rdate[0];
        $rtime = explode (":", $rtime);
        $rtime = sprintf ("%s:%s", $rtime[0], $rtime[1]);
-       $row['room'] = ereg_replace (" ", "+", $row['room']);
+       $row['room'] = str_replace (" ", "+", $row['room']);
 
        if (strlen ($row['abstract'])) {
          printf ("<br>&nbsp;&nbsp;%s: <a href=\"workshop.php3?room=%s&day=%s&time=%s\">%s</a>",
@@ -78,7 +78,7 @@
     }
   } else {
     # Check content negotiation
-    if (ereg ("en.*de", $HTTP_ACCEPT_LANGUAGE)) {
+    if (preg_match("/en.*de/", $HTTP_ACCEPT_LANGUAGE)) {
       $desc = 'description_en';
       add_link("de");
     } else {
index 4968288..e4eecf2 100644 (file)
@@ -93,7 +93,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
 
@@ -101,7 +101,7 @@ if ($nr < pg_NumRows ($sth)) {
                 $row['title'] = substr ($row['title'],0, <len_title>-3) . "...";
              }
 
-             if (strlen ($row['speaker']) > <len_speaker> && ereg (",", $row['speaker'])) {
+             if (strlen ($row['speaker']) > <len_speaker> && strpos($row['speaker'] !== false)) {
                $foo = explode (",", $row['speaker']);
                $row['speaker'] = $foo[0];
               }
index 6a2e36b..50327fb 100644 (file)
@@ -90,7 +90,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
              if (strlen ($row['abstract'])) {
index 35f0eb2..6fa7c72 100644 (file)
@@ -43,7 +43,7 @@
        $rdate = $rdate[0];
        $rtime = explode (":", $rtime);
        $rtime = sprintf ("%s:%s", $rtime[0], $rtime[1]);
-       $row['room'] = ereg_replace (" ", "+", $row['room']);
+       $row['room'] = str_replace (" ", "+", $row['room']);
 
        if (strlen ($row['abstract'])) {
          printf ("<br>&nbsp;&nbsp;%s: <a href=\"workshop.php3?room=%s&day=%s&time=%s\">%s</a>",
@@ -78,7 +78,7 @@
     }
   } else {
     # Check content negotiation
-    if (ereg ("en.*de", $HTTP_ACCEPT_LANGUAGE)) {
+    if (preg_match("/en.*de/", $HTTP_ACCEPT_LANGUAGE)) {
       $desc = 'description_en';
       add_link("de");
     } else {
index 16d2b60..9314b45 100644 (file)
@@ -89,7 +89,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
 
@@ -97,7 +97,7 @@ if ($nr < pg_NumRows ($sth)) {
                 $row['title'] = substr ($row['title'],0, <len_title>-3) . "...";
              }
 
-             if (strlen ($row['speaker']) > <len_speaker> && ereg (",", $row['speaker'])) {
+             if (strlen ($row['speaker']) > <len_speaker> && strpos($row['speaker']) !== false) {
                $foo = explode (",", $row['speaker']);
                $row['speaker'] = $foo[0];
               }
index a4df377..8330410 100644 (file)
@@ -92,7 +92,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
              if (strlen ($row['abstract'])) {
index 1cefe87..fa86153 100644 (file)
@@ -82,7 +82,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
 
index 7e527be..0fe6259 100644 (file)
@@ -44,7 +44,7 @@
        $rdate = $rdate[0];
        $rtime = explode (":", $rtime);
        $rtime = sprintf ("%s:%s", $rtime[0], $rtime[1]);
-       $row['room'] = ereg_replace (" ", "+", $row['room']);
+       $row['room'] = str_replace (" ", "+", $row['room']);
 
        if (strlen ($row['abstract'])) {
          printf ("<br>&nbsp;&nbsp;%s: <a href=\"workshop.php3?room=%s&day=%s&time=%s\">%s</a>",
@@ -79,7 +79,7 @@
     }
   } else {
     # Check content negotiation
-    if (ereg ("en.*de", $HTTP_ACCEPT_LANGUAGE)) {
+    if (preg_match("/en.*de/", $HTTP_ACCEPT_LANGUAGE)) {
       $desc = 'description_en';
       add_link("de");
     } else {
index 75c0b83..20a7710 100644 (file)
@@ -88,7 +88,7 @@ if ($nr < pg_NumRows ($sth)) {
        printf ($t_time, $thistime);
 
         for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
-         $tr_room = ereg_replace (" ", "+", $thisroom);
+         $tr_room = str_replace (" ", "+", $thisroom);
          if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
            if ($row['visible'] == 1) {
 
index 7b7d481..415c3e5 100644 (file)
@@ -47,8 +47,8 @@ have contact information.
       $year = $thisyear;
     }
 
-    $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
-    $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
+    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
+    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);
 
     $name = encode_name ($row, "debian");
 
index d041aa3..2ef311f 100644 (file)
@@ -49,8 +49,8 @@ have contact information.
       $year = $thisyear;
     }
 
-    $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
-    $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
+    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
+    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);
 
     $name = encode_name ($row, "debian");
 
@@ -86,9 +86,9 @@ have contact information.
       $year = $thisyear;
     }
 
-    $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
-    $row['city'] = ereg_replace (" ", "&nbsp;", $row['city']);
-    $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
+    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
+    $row['city'] = str_replace (" ", "&nbsp;", $row['city']);
+    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);
 
     $name = encode_name ($row, "debian");
 
index 404df61..431c94b 100644 (file)
       while (!feof ($f)) {
         $line = fgets ($f, 255);
 <protect>
-        if (ereg ("^  ([a-z][^ ]*)@lists.debian.org", $line)) {
+        if (preg_match("/^  ([a-z][^ ]*)@lists.debian.org/", $line, $matches))
+          $lists[] = $matches[1];
 </protect>
-         $line = ereg_replace (" ", "", $line);
-         $line = ereg_replace ("@.*", "", $line);
-         $lists[] = $line;
-       }
       }
     }
   }
index 5792cda..2bcee34 100644 (file)
@@ -37,7 +37,7 @@ Software, they are released in the public.<p>
   $color = "<cold>";
   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
     $row = pg_fetch_array ($sth, $nr);
-    $pkg = ereg_replace(" ", "%20", $row[0]);
+    $pkg = str_replace(" ", "%20", $row[0]);
 
     $color = $color == "<cold>"?"<coln>":"<cold>";
     printf ($trow, $color, $pkg, $row[0], $row[1]);
index 33780d9..69b0091 100644 (file)
@@ -42,7 +42,7 @@ it upstream.</p>
   $color = "<cold>";
   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
     $row = pg_fetch_array ($sth, $nr);
-    $pkg = ereg_replace(" ", "%20", $row[0]);
+    $pkg = str_replace(" ", "%20", $row[0]);
 
     $color = $color == "<cold>"?"<coln>":"<cold>";
     printf ($trow, $color, $pkg, $row[0], $row[1]);
@@ -78,7 +78,7 @@ it upstream.</p>
   $color = "<cold>";
   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
     $row = pg_fetch_array ($sth, $nr);
-    $pkg = ereg_replace(" ", "%20", $row[0]);
+    $pkg = str_replace(" ", "%20", $row[0]);
 
     $color = $color == "<cold>"?"<coln>":"<cold>";
     printf ($trow, $color, $pkg, $row[0], $row[1]);
index eb0706a..1b34b71 100644 (file)
@@ -55,8 +55,8 @@ mail to <joey mailto>.
       $year = $thisyear;
     }
 
-    $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
-    $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
+    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
+    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);
 
     $name = encode_name ($row, "infodrom");
 
@@ -92,8 +92,8 @@ mail to <joey mailto>.
       $year = $thisyear;
     }
 
-    $row['name'] = ereg_replace (" ", "&nbsp;", $row['name']);
-    $row['country'] = ereg_replace (" ", "&nbsp;", $row['country']);
+    $row['name'] = str_replace (" ", "&nbsp;", $row['name']);
+    $row['country'] = str_replace (" ", "&nbsp;", $row['country']);
 
     $name = encode_name ($row, "infodrom");
 
index 5318aef..66e30fe 100644 (file)
@@ -61,9 +61,7 @@
       $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
       $ticker = $tick[$row['ticker']];
 
-      $body =  ereg_replace ("<newline>", "
-", ereg_replace ("<newline><newline>","<p>", ereg_replace ("
-", "<newline>", $row['body'])));
+      $body = str_replace("\n\n", "<p>", $row['body']);
 
       printf ($format, $row['subject'], $date, $ticker, $body);
 
index 323f418..cef640b 100644 (file)
@@ -82,7 +82,7 @@ if ((!empty($id)) or ($new == 1))
            die("You are not allowed to edit this user.");
         }
 
-        if (ereg ("^[0-9]+$", $id)) {
+        if (preg_match("/^[0-9]+$/", $id)) {
           $query = sprintf("SELECT * from person WHERE id = %d", $id);
        } else {
          die ("ID must be numeric");
index 2534f75..b501496 100644 (file)
@@ -159,7 +159,7 @@ function allowed_to_edit($id)
 
   // If not, we will try to find out the project of this user
 
-  if (ereg ("^[0-9]+$", $id)) {
+  if (preg_match("/^[0-9]+$/", $id)) {
     $query = sprintf ("SELECT junction.project FROM junction,person "
                     ."WHERE person = id AND id=%d",
                     $id);
index 053a0c2..5c84925 100644 (file)
   {
     $fromto = explode ("-", $timeframe);
 
-    if (!ereg ("([0-9]+)[\.:]([0-9]+)", $fromto[0], $frompart)) {
+    if (!preg_match("/([0-9]+)[\.:]([0-9]+)/", $fromto[0], $frompart)) {
       $frompart[1] = $fromto[0];
       $frompart[2] = 0;
     }
     $from = sprintf ("%02d:%02d", $frompart[1], $frompart[2]);
 
     if (strlen ($fromto[1])) {
-      if (!ereg ("([0-9]+)[\.:]([0-9]+)", $fromto[1], $to)) {
+      if (!preg_match("/([0-9]+)[\.:]([0-9]+)/", $fromto[1], $to)) {
        $to[1] = $fromto[1];
        $to[2] = 0;
       }
 <?
   function strip_space($foo)
   {
-    return ereg_replace (" ", "_", $foo);
+    return str_replace (" ", "_", $foo);
   }
 ?>
 
index 61a9ebb..89ebc95 100644 (file)
 function build_appendix ($phone, $mobile, $comment)
 {
   $appendix = '';
-  if (strlen ($phone) && ereg ("(\+[0-9]+ [0-9]+ [0-9]+)", $phone, $r)) {
+  if (strlen($phone) && preg_match("/(\+[0-9]+ [0-9]+ [0-9]+)/", $phone, $r))
     $appendix = $r[1];
-  }
-  if (strlen ($mobile) && ereg ("(\+[0-9]+ [0-9]+ [0-9]+)", $mobile, $r)) {
+  if (strlen($mobile) && preg_match(/"(\+[0-9]+ [0-9]+ [0-9]+)/", $mobile, $r)) {
     if (strlen ($appendix)){
       $appendix .= "/".$r[1];
     } else {
index 94f9ee5..465dea7 100644 (file)
@@ -13,7 +13,7 @@
 
 function email_ok($email)
 {
-  if (eregi('^[a-z0-9+.=-]+@[a-z0-9.-]+$', $email)) {
+  if (preg_match('/^[a-z0-9+.=-]+@[a-z0-9.-]+$/', $email)) {
     return true;
   } else {
     return false;
index 54e186f..136761c 100644 (file)
@@ -24,7 +24,8 @@
     $months = array ();
 
     while ($dentry = $dir->read()) {
-      if ($dentry != "." && $dentry != ".." && is_dir ("$dirname/$dentry") && ereg ("^[01][0-9]$", $dentry)) {
+      if ($dentry == "." || $dentry == "..") continue;
+      if (is_dir ("$dirname/$dentry") && preg_match('/^[01][0-9]$/', $dentry))
         $months[] = $dentry;
       }
     }
index bc48feb..1d9c72c 100644 (file)
         printf ("<div class=\"newsbody\">Von <a href=\"mailto:%s\">%s</a>, %s</div>", $row['email'], $row['author'], $date);
         printf ("<div class=\"newsbody\"><strong>%s</strong></div>\n", $row['teaser']);
         echo ("<div class=\"newsbody\">");
-        echo ereg_replace ("<newline>", "
-", ereg_replace ("<newline><newline>","<p>", ereg_replace ("
-", "<newline>", str_replace ("\\\n", "", str_replace ("\r", "", $row['body'])))));
+
+       echo str_replace(array("\r", "\\\n", "\n\n"),
+                        array('', '', '<p>'),
+                        $row['body']);
         echo ("</div></div>");
       }
     }