Exemple #1
0
 public function setUser($id)
 {
     $db = ECPFactory::getDbo();
     $user = $db->newQuery("select", "user")->table("logins")->where("id", $id, "=")->execute();
     if ($user->getRows()) {
         $u = $user->getSingleResult();
         $this->guest = false;
         $this->id = $id;
         $u['profiel'] = strtolower($u['profiel']);
         $this->user = $u;
         ecpimport("user.usertype");
         //usertype interface
         if (ecplocate("user.types.{$u['profiel']}")) {
             ecpimport("user.types.{$u['profiel']}");
             //usertype class
             $classname = "ECP_User_" . $u['profiel'];
             $this->typeobj = new $classname();
         } else {
             echo "fatal error.. usertype unknown<br/>Missing type is: {$u['profiel']}";
             ecpexit();
         }
         $this->locked = 1;
     } else {
         $this->guest = 1;
         $this->locked = 1;
         $this->user = array("naam" => "Gast", "type" => "Guest");
     }
 }