lambdas and create_function
[plewww.git] / planetlab / slices / slice.php
index 3b27b11..b194194 100644 (file)
@@ -83,7 +83,7 @@ global $DAY;          $DAY = 24*60*60;
 global $WEEK;          $WEEK = 7 * $DAY; 
 global $MAX_WEEKS;     $MAX_WEEKS= 8;          // weeks from today
 global $GRACE_DAYS;    $GRACE_DAYS=10;         // days for renewal promoted on top
-global $NOW;           $NOW=mktime();
+global $NOW;           $NOW=time();
 
 //////////////////////////////////////////////////////////// utility for the renew tab
 // make the renew area on top and open if the expiration time is less than 10 days from now
@@ -652,7 +652,7 @@ $toggle_nodes=new PlekitToggle('my-slice-nodes-configuration',
                                     'info-visible'=>$show_layout_info));
 $toggle_nodes->start();
 
-//usort ($table_headers, create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);'));
+//usort ($table_headers, function($col1, $col2) {return strcmp($col1["header"],$col2["header"]);}));
 //print("<p>TABLE HEADERS<p>");
 //print_r($table_headers);
 
@@ -686,8 +686,9 @@ $interface_filter=array('is_primary'=>TRUE);
 $interfaces=$api->GetInterfaces($interface_filter,$interface_columns);
 
 $interface_hash=array();
-foreach ($interfaces as $interface) $interface_hash[$interface['node_id']]=$interface;
-
+if ($interfaces) {
+       foreach ($interfaces as $interface) $interface_hash[$interface['node_id']]=$interface;
+}
 
 if ($profiling) plc_debug_prof('10: interfaces',count($interfaces));
 
@@ -885,7 +886,7 @@ available names in the drop down below.  </li>
 <li> You also have the option to provide <span class='bold'> your own
 code </span>, with the following conventions: <ul>
 
-<li> Like regular initscripts, your script must except to receive as a
+<li> Like regular initscripts, your script must expect to receive as a
 first argument <span class='bold'> start </span>, <span class='bold'>
 stop </span> or <span class='bold'> restart </span>. It is important
 to honor this argument, as your slice may be stopped and restarted at
@@ -1027,8 +1028,10 @@ $tag_value_threshold=24;
     }
     $_nodes = $api->GetNodes(array('node_id' => $_node_ids), array('node_id', 'hostname'));
     $_hostnames = array();
-    foreach ($_nodes as $_node) {
-      $_hostnames[$_node['node_id']] = $_node['hostname'];
+    if ($_nodes) {
+       foreach ($_nodes as $_node) {
+               $_hostnames[$_node['node_id']] = $_node['hostname'];
+       }
     }
 
     // Loop through tags again to display