bugfix: the slice page was broken when nobody is in slice
[plewww.git] / planetlab / includes / plc_session.php
index 7850d86..a3cca09 100644 (file)
 // Mark Huang <mlhuang@cs.princeton.edu>
 // Copyright (C) 2006 The Trustees of Princeton University
 //
-// $Id$ $
-//
+
+// warning: Undefined array key "#validated" in /var/www/html/includes/form.inc on line 228.
+
+set_error_handler(function(int $errno, string $errstr) {
+    if ((strpos($errstr, 'Undefined array key') !== false) && (strpos($errstr, '/var/www/html/includes/') !== false))
+        return false;
+    // for filtering undefined variables
+//        if (strpos($errstr, 'Undefined variable') !== false)
+//        return false;
+    return true;
+    }, E_WARNING);
+
 
 // Usually in /etc/planetlab/php
 require_once 'plc_config.php';
@@ -79,7 +89,7 @@ class PLCSession
       $_SESSION['plc'] = array('auth' => $api->auth,
                               'person' => $person,
                               'expires' => $expires);
-     } 
+     }
     }
 
     function BecomePerson($person_id)
@@ -87,12 +97,12 @@ class PLCSession
        list($person) = $this->api->GetPersons(array($person_id));
        if ($person)
        {
-           //Get this users session if one exists, create 
+           //Get this users session if one exists, create
            //one otherwise
            list($session) = $this->api->GetSessions(array('person_id' => $person['person_id']));
            if (!$session)
            {
-               $session = $this->api->AddSession($person['person_id']);        
+               $session = $this->api->AddSession($person['person_id']);
            }
            else
            {
@@ -112,12 +122,12 @@ class PLCSession
            $_SESSION['plc']['person'] = $this->person;
            $_SESSION['plc']['alt_person'] = $this->alt_person;
             $_SESSION['plc']['alt_auth'] = $this->alt_auth;
-           
-       }       
+
+       }
     }
 
     function BecomeSelf()
-    {  
+    {
        if($this->alt_auth && $this->alt_person )
        {
            $this->person = $this->alt_person;
@@ -129,9 +139,9 @@ class PLCSession
            $_SESSION['plc']['person'] = $_SESSION['plc']['alt_person'];
            unset($_SESSION['plc']['alt_auth']);
             unset($_SESSION['plc']['alt_person']);
-       } 
+       }
     }
-  
+
 
   function logout()
   {