no more php-5.3 deprecated stuff
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 1 Apr 2010 11:04:05 +0000 (11:04 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 1 Apr 2010 11:04:05 +0000 (11:04 +0000)
Makefile
planetlab/common/adminsearch.php
planetlab/events/events.php
planetlab/includes/plc_functions.php
planetlab/includes/plc_visibletags.php
planetlab/nodes/comon.php
planetlab/pub/feedback.php
planetlab/sites/site_form.php

index 295aa14..af50fcb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,16 +7,16 @@ tags:
 ########## sync
 # 2 forms are supported
 # (*) if your plc root context has direct ssh access:
-# make sync PLC=private.one-lab.org
+# make sync PLC=boot.planet-lab.eu
 # (*) otherwise, entering through the root context
-# make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
+# make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr
+
+PLCHOST ?= testplc.onelab.eu
 
 ifdef GUEST
-ifdef PLCHOST
 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
 endif
-endif
 ifdef PLC
 SSHURL:=root@$(PLC):/
 SSHCOMMAND:=ssh root@$(PLC)
@@ -30,8 +30,8 @@ RSYNC                 := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
 sync:
 ifeq (,$(SSHURL))
        @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
-       @echo "  e.g. make sync PLC=private.one-lab.org"
-       @echo "  or   make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
+       @echo "  e.g. make sync PLC=boot.planet-lab.eu"
+       @echo "  or   make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr"
        @exit 1
 else
        +$(RSYNC) planetlab plekit modules $(SSHURL)/var/www/html/
index ee2da8f..3b02079 100644 (file)
@@ -34,7 +34,7 @@ $pattern="";
 if (isset($_GET['pattern'])) { $pattern=$_GET['pattern']; }
 if (isset($_POST['pattern'])) { $pattern=$_POST['pattern']; }
 
-$tokens=split(" ",$pattern);
+$tokens=explode(" ",$pattern);
 function token_filter ($t) { $t = trim($t); if (empty($t)) return false; return true; }
 $tokens=array_filter($tokens, "token_filter");
 
index e04d762..8d248d1 100644 (file)
@@ -53,7 +53,7 @@ function parse_date ($user_date,$until_if_true=false,$DAY,$EPOCH) {
   
   } else {
     // user-provided string
-    list ($year,$month,$day) = split ('[/.-]',$user_date);
+    list ($year,$month,$day) = preg_split ('/[\/\.\-]/',$user_date);
     $date=sprintf("%s %s %s",$day,$month,$year);
     $time=strtotime($date);
     //if the flag is set, we add 23h59'59'', so the 'until' date is inclusive
@@ -88,7 +88,8 @@ function e_subject ($type,$id) {
   case 'Site': return l_site_t ($id,$mess);
   case 'Person': return l_person_t ($id,$mess);
   case 'Slice': return l_slice_t ($id,$mess);
-  case 'Role': case 'Key': case 'PCU': case 'Interface': case 'NodeGroup': case "Address":
+  case 'Interface': return l_interface_t ($id, $mess);
+  case 'Role': case 'Key': case 'PCU': case 'NodeGroup': case "Address":
     return "$mess";
   default: return "Unknown $type" . "-" . $id;
   }
@@ -197,7 +198,7 @@ if ($type == 'Event') {
   $title="Events [ $from_string - $until_string]";
   $title .= " type=$object_type";
   $title .= " id(s)=";
-  foreach ( split(",",$user_input) as $user_desc) {
+  foreach ( explode(",",$user_input) as $user_desc) {
 # numeric 
     if (my_is_int($user_desc)) {
       $obj_check = call_user_func(array($api,$method),array(intval($user_desc)),array($primary_key));
index 9ebf7c9..606bc24 100644 (file)
@@ -223,24 +223,24 @@ function topdomain ($hostname) {
   return $exploded[0];
 }
 
-// with php-5.3 on f12, ereg is marked deprecated, using PCRE instead
-// looks unused
-function is_valid_email_addr ($email) {
-  if (preg_match("/^.+@.+\\..+$/", $email) ) {
-    return true;
-  } else {
-    return false;
-  }
-}
-
-// looks unused
-function is_valid_url ($url) {
-  if (preg_match("/^(http|https):\/\/.+\..+$/", strtolower($url) ) ) {
-    return true;
-  } else {
-    return false;
-  }
-}
+//// with php-5.3 on f12, ereg is marked deprecated, using PCRE instead
+//// looks unused
+// function is_valid_email_addr ($email) {
+//  if (preg_match("/^.+@.+\\..+$/", $email) ) {
+//    return true;
+//  } else {
+//    return false;
+//  }
+//}
+//
+//// looks unused
+//function is_valid_url ($url) {
+//  if (preg_match("/^(http|https):\/\/.+\..+$/", strtolower($url) ) ) {
+//    return true;
+//  } else {
+//    return false;
+//  }
+//}
 
 function is_valid_ip ($ip) {
   if (preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip ) ) {
index a0382cc..0d45bb8 100644 (file)
@@ -35,9 +35,9 @@ class VisibleTags {
       $column['type']='string';
       $column['description']=$tag_type['description'];
       // split category and parse any setting
-      $category_tokens=split('/',$tag_type['category']);
+      $category_tokens=explode('/',$tag_type['category']);
       foreach ($category_tokens as $token) {
-       $assign=split('=',$token);
+       $assign=explode('=',$token);
        if (count($assign)==2) 
          $column[$assign[0]]=$assign[1];
       }
index 5912eae..743ee02 100644 (file)
@@ -14,7 +14,7 @@ require_once 'plc_functions.php';
 // http://summer.cs.princeton.edu/
 // "138.96.250.12"
 function plc_ip_to_int ($ip) {
-  $bytes=array_map("intval",split("[.]",$ip));
+  $bytes=array_map("intval",explode(".",$ip));
   $res=0;
   foreach (range(0,3) as $i) {
     $res=256*$res+$bytes[$i];
index 8a2395f..8144634 100644 (file)
@@ -34,7 +34,7 @@ if (isset($_REQUEST['email'])) {
   // checks proper syntax
   $email = $_REQUEST['email'];  
   if (preg_match("/^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9\.-]+$/", $email)) {
-    list($username, $domain) = split('@', $email);
+    list($username, $domain) = explode('@', $email);
     // prevent default domain from being appended
     $domain .= ".";
     // check if the domain has MX records, or is at least resolvable
index d5d4414..6e69437 100644 (file)
@@ -108,7 +108,7 @@ function parse_form ($form, $request, $input = NULL) {
 
   // fill with values form the form
   foreach ($form as $fullname => $item) {
-    list($objname,$field) = split(":",$fullname);
+    list($objname,$field) = explode(":",$fullname);
     $raw_input=$request[$fullname];
     if (!empty($raw_input)) {
       $empty_form = FALSE;
@@ -161,7 +161,7 @@ function parse_form ($form, $request, $input = NULL) {
 function form_check_required ($form, $input) {
   $missing = array();
   foreach ($form as $fullname => $item) {
-    list($objname,$field) = split(":",$fullname);
+    list($objname,$field) = explode(":",$fullname);
     if ($item['required'] && empty($input[$objname][$field])) {
       $missing[] = $item['title'];
     }
@@ -184,7 +184,7 @@ function form_render_details ($details, $site_form, $input, $outline_missing) {
 
   foreach ($site_form as $fullname => $item) {
     
-    list($objname,$field) = split(":",$fullname);
+    list($objname,$field) = explode(":",$fullname);
     
     // render the comment field
     if ( ! empty($item['comment'])) {