Exemplo n.º 1
0
 function setUser($login, $userInfo = array())
 {
     global $AR, $store;
     pobject::pushContext(array("scope" => "php"));
     $result = mod_auth_default::getUser($login, $this->config["ar:userDir"]);
     if ($result === LD_ERR_ACCESS) {
         $aLogin = '******';
         // FIXME: make this configurable
         $AR->user = current($store->call("system.get.phtml", "", $store->find("/system/users/", "login.value='{$aLogin}' and object.implements='puser'")));
         $user_dir = $this->config["ar:userDir"];
         $user_profile = $this->config["ar:userProfile"];
         $data = array();
         $data["arNewFilename"] = "{$user_dir}{$login}/";
         $data["name"] = $login;
         $data["newpass1"] = '!';
         $data["newpass2"] = '!';
         $data["profile"] = $user_profile;
         $data["setowner"] = true;
         $data["email"] = $userInfo["email"];
         foreach ($userInfo as $key => $value) {
             $data["custom"]["none"][$key] = $value;
         }
         $userType = $this->config["ar:userType"] ? $this->config["ar:userType"] : "puser";
         $user = $store->newobject("{$user_dir}{$login}/", "{$user_dir}", $userType, new object());
         $user->arIsNewObject = true;
         $user->call('system.save.data.phtml', $data);
         $AR->user = $user;
     }
     ldSetCredentials($login, $this->config["ar:userDir"]);
     // unbecome system user
     pobject::popContext();
     return $AR->user;
 }
Exemplo n.º 2
0
Arquivo: ar.php Projeto: poef/ariadne
 public static function callAtPath($path, $callback)
 {
     $ob = current(ar_store::get($path)->call('system.get.phtml'));
     pobject::pushContext(array("arCurrentObject" => $ob, "scope" => "php"));
     call_user_func($callback);
     pobject::popContext();
 }