None is equal to zero for php. use === operator to check the type
[plewww.git] / planetlab / sites / site.php
index be4d5fb..d80dc5f 100644 (file)
@@ -48,6 +48,7 @@ $max_slivers= $site['max_slivers'];
 $max_slices= $site['max_slices'];
 
 $enabled = $site['enabled'];
+$ext_consortium_id = $site ['ext_consortium_id'];
 
 // get peer 
 $peer_id= $site['peer_id'];
@@ -92,7 +93,7 @@ else
 $techs = array();
 $pis = array();
 $disabled_persons = array();
-foreach( $persons as $person ) {
+if ($persons) foreach( $persons as $person ) {
   $role_ids= $person['role_ids'];
 
   if ( in_array( '20', $role_ids ))    $pis[] = $person;
@@ -112,6 +113,8 @@ drupal_set_title("Details for site " . $sitename);
   
 $tabs=array();
 
+$tabs []= tab_mysite();
+
 // available actions
 if ( $is_site_admin)
   $tabs['Expire slices'] = array('url'=>l_actions(),
@@ -148,10 +151,22 @@ plekit_linetabs($tabs);
 // show gray background on foreign objects : start a <div> with proper class
 $peers->block_start ($peer_id);
 
-if ( $local_peer && ( ! $enabled ) )
-  plc_warning ("This site is not enabled - Please visit " . 
-              href (l_sites_pending(),"this page") . 
-              " to review pending applications.");
+// sanity checks
+if ( $local_peer ) {
+  // pending site
+  global $PENDING_CONSORTIUM_ID;
+  if ( $ext_consortium_id === $PENDING_CONSORTIUM_ID) {
+    if ( ! $enabled ) 
+      plc_warning ("This site is under pending registration - Please visit " . 
+                  href (l_sites_pending(),"this page") . 
+                  " to review pending applications.");
+    else 
+      plc_warning ("This site is pending but is also enabled - something is wrong. You should fix the issue with plcsh");
+  } else {
+    if ( ! $enabled) 
+      plc_warning ("This site is disabled.");
+  }
+}
 
 $can_update=(plc_is_admin ()  && $local_peer) || ( plc_in_site($site_id) && plc_is_pi());