get_array
[plewww.git] / planetlab / sites / sites.php
index d8632c3..1a8613f 100644 (file)
@@ -2,7 +2,7 @@
   // $Id$
   //
 
-  // Require login
+// Require login
 require_once 'plc_login.php';
 
 // Get session and API handles
@@ -20,10 +20,10 @@ require_once 'linetabs.php';
 require_once 'table.php';
 require_once 'nifty.php';
 
-// -------------------- 
+// --------------------
 // recognized URL arguments
-$peerscope=$_GET['peerscope'];
-$pattern=$_GET['pattern'];
+$peerscope = get_array($_GET, 'peerscope');
+$pattern = get_array($_GET, 'pattern');
 
 // --- decoration
 $title="Sites";
@@ -32,7 +32,7 @@ $tabs []= tab_sites();
 $tabs []= tab_sites_local();
 $tabs []= tab_mysite();
 
-// -------------------- 
+// --------------------
 $site_filter=array();
 
 function site_status ($site) {
@@ -40,32 +40,33 @@ function site_status ($site) {
   $class=($site['peer_id']) ? 'plc-foreign' : 'plc-warning';
 
   $messages=array();
-  
-  if (empty ($site['node_ids'])) 
+
+  if (empty ($site['node_ids']))
     $messages [] = "No node";
 
   // do all this stuff on local sites only
   if ( ! $site['peer_id'] ) {
-    
+
     // check that site is enabled
-    if ( ! $site['enabled']) 
+    if ( ! $site['enabled'])
       $messages [] = "Not enabled";
     global $PENDING_CONSORTIUM_ID;
     if ( $site['ext_consortium_id'] === $PENDING_CONSORTIUM_ID )
       $messages [] = "Pending registration";
-  
+
     // check that site has at least a PI and a tech
     global $api;
     $persons=$api->GetPersons(array("person_id"=>$site['person_ids']),array("role_ids"));
     $nb_pis=0;
-    $nb_tech=0;
-    if ( $persons) foreach ($persons as $person) {
-       if (in_array( '20', $person['role_ids'])) $nb_pis += 1;
-       if (in_array( '40', $person['role_ids'])) $nb_techs += 1;
+    $nb_techs=0;
+    if ( $persons)
+      foreach ($persons as $person) {
+        if (in_array( '20', $person['role_ids'])) $nb_pis += 1;
+        if (in_array( '40', $person['role_ids'])) $nb_techs += 1;
       }
     if ($nb_pis == 0) $messages [] = "No PI";
     if ($nb_techs == 0) $messages [] = "No Tech";
-    
+
     if (! $site['is_public']) $messages []= "Not public";
 
     // check number of slices
@@ -98,12 +99,12 @@ if (! plc_is_admin()) {
   $site_columns = array("site_id", "name", "abbreviated_name", "login_base" , "peer_id" );
   $site_filter = array_merge ($site_filter, array ("enabled" => TRUE));
  } else {
-  $site_columns = array("site_id", "name", "abbreviated_name", "login_base" , "peer_id" , 
+  $site_columns = array("site_id", "name", "abbreviated_name", "login_base" , "peer_id" ,
                        "is_public", "enabled", "ext_consortium_id",
                        "person_ids", "max_slices", "slice_ids", "node_ids");
  }
 
-if (plc_is_admin()) 
+if (plc_is_admin())
   $tabs['Joining Sites'] = array ('url'=>l_sites_pending(),
                                  'bubble'=>'Review pending join requests');