Exemplo n.º 1
0
 /**
  * Returns the global User object, only creating it if it
  * doesn't already exist.
  *
  * @param   integer  $identifier  The user to load - Can be an integer or string - If string, it is converted to ID automatically.
  *
  * @return  JUser  The User object.
  *
  * @since   11.1
  */
 public static function getInstance($identifier = 0)
 {
     // Find the user id
     //echo "$identifier == identifier";
     if ($identifier == "null" || $identifier == "") {
         $identifier = 0;
     }
     if (!is_numeric($identifier)) {
         //TODO helper maken of functie die via de username de user gaat ophalen
         parent::addError("ECP_User getInstance::User doesn't exist.");
         return false;
     } else {
         $id = $identifier;
     }
     // If the $id is zero, just return an empty ECP_User.
     // Note: don't cache this user because it'll have a new ID on save!
     if ($id === 0) {
         return new ECP_User();
     }
     // Check if the user ID is already cached.
     if (empty(self::$instances[$id])) {
         $user = new ECP_User($id);
         self::$instances[$id] = $user;
     }
     return self::$instances[$id];
 }
Exemplo n.º 2
0
 /**
  * Returns an object of EQApp from the right $id
  * @param type $id Clientname
  */
 public static function getInstance($id)
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     if (empty($instances[$id])) {
         $prefix = "ECP_";
         $classname = $id;
         if (ecpimport("application." . strtolower($classname) . "_app")) {
             $classname = $prefix . $id . 'App';
             $instance = new $classname($id);
         } else {
             parent::addError("ECPApp::getInstance");
             $instance = "";
         }
         $instances[$id] =& $instance;
     }
     return $instances[$id];
 }
Exemplo n.º 3
0
 public function restart()
 {
     $this->destroy();
     if ($this->_state !== 'destroyed') {
         parent::addError("ECP_Session::restart - Session seems not be destroyed, so can't restart the session.");
         return false;
     }
     $this->_state = 'restart';
     $this->_start();
     $this->_state = 'active';
     $this->_validate();
     $this->_setCounter();
     return true;
 }
Exemplo n.º 4
0
 public function getUserId()
 {
     if ($_SERVER['REQUEST_METHOD'] === "POST") {
         //in elke post method zit de uid erbij! (normaal)
         if (array_key_exists("uid", $_POST)) {
             //dus hier ligt de voorwaarde via post ook vast!
             return $_POST['uid'];
         } else {
             return null;
         }
     }
     if ($this->state === "parsed") {
         return $this->uri->getUserId();
     } else {
         parent::addError("ECP_ROUTER::getUser() - couldn't return UserId because URI isn't parsed yet!");
         return 0;
     }
 }