コード例 #1
0
ファイル: User.php プロジェクト: Troutzorz/csapp
 /**
  * 
  * @param type $data
  * @return type This function will return the id of the newly created use on success
  * and returns false otherwise.
  */
 private function createUserData($data)
 {
     $this->checkSec();
     $user = new User_model();
     if ($data['uID'] != 0) {
         $user->setUserID($data['uID']);
     }
     $user->setEmailAddress($data['email']);
     $user->setName($data['lName'] . ',' . $data['fName']);
     //todo Ensure there is a password and a name here.
     if ($data['pass'] == $data['confPass']) {
         $user->setPassword($data['pass']);
     }
     $user->setState(1);
     $user->setLastLogin(0);
     $isCreated = $user->create();
     if (!$isCreated && $data['uID'] != 0) {
         redirect('User/index/modify/' . $user->getUserID());
     }
     $this->addUserRoles($data, $user);
     return $user->getUserID();
 }