/** * 增加新的用户 * * @param object $data * @access public * @return boolean true|false */ public function addUser(UserSave $data) { if (!$this->userValidate->add($data)) { return $this->setErrorMsg($this->userValidate->getErrorMessage()); } if (!$this->acl->checkGroupLevelPermission($data->group_id, Acl::GROUP_LEVEL_TYPE_GROUP)) { return $this->setErrorMsg(Lang::get('common.account_level_deny')); } if ($this->userModel->getOneUserByName($data->name)) { return $this->setErrorMsg(Lang::get('user.account_exists')); } $data->setPassword(md5($data->password)); if ($this->userModel->addUser($data->toArray()) !== false) { return true; } return $this->setErrorMsg(Lang::get('common.action_error')); }
/** * Add a new user to the storage container * * @param string Username * @param string Password * @param array Additional information * * @return boolean */ function addUser($username, $password, $additional = '') { $res = $this->pwfile->addUser($user, $additional['userid'], $pass); if ($res === true) { return $this->pwfile->save(); } return $res; }
/** * Add a new user to the storage container * * @param string Username * @param string Password * @param array Additional information * * @return boolean */ function addUser($username, $password, $additional = '') { $this->log('Auth_Container_SMBPasswd::addUser() called.', AUTH_LOG_DEBUG); $res = $this->pwfile->addUser($user, $additional['userid'], $pass); if ($res === true) { return $this->pwfile->save(); } return $res; }
/** * 增加新的用户 * * @param object $data * @access public * @return boolean true|false */ public function addUser(\App\Services\Admin\User\Param\UserSave $data) { if (!$this->userValidate->add($data)) { return $this->setErrorMsg($this->userValidate->getErrorMessage()); } //检查当前用户的权限是否能增加这个用户 if (!$this->acl->checkGroupLevelPermission($data->group_id, Acl::GROUP_LEVEL_TYPE_GROUP)) { return $this->setErrorMsg(Lang::get('common.account_level_deny')); } //检测当前用户名是否已经存在 if ($this->userModel->getOneUserByName($data->name)) { return $this->setErrorMsg(Lang::get('user.account_exists')); } $data->setPassword(md5($data->password)); //开始保存到数据库 if ($this->userModel->addUser($data->toArray()) !== false) { return true; } return $this->setErrorMsg(Lang::get('common.action_error')); }
/** * Tries to add a user to both containers. * * If the optional $id parameter is passed it will be used * for both containers. * * In any case the auth and perm id will be equal when using this method. * * If this behaviour doesn't suit your needs please consider * using directly the concerned method. This method is just * implement to simplify things a bit and should satisfy most * user needs. * * Note type is optional for DB, thus it's needed for MDB and MDB2, * we recommend that you use type even though you use DB, so if you change to MDB[2], * it will be no problem for you. * usage example for addUser: * <code> * $user_id = $admin->addUser('johndoe', 'dummypass', true, null, null, null); * </code> * * Untested: it most likely doesn't work. * * @access public * @param string user handle (username) * @param string user password * @param integer permission user type * @param boolean is account active ? * @param int ID * @param integer ID of the owning user. * @param integer ID of the owning group. * @param array values for the custom fields * @return mixed userid or false */ function addUser($handle, $password, $type = null, $active = true, $id = null, $owner_user_id = null, $owner_group_id = null, $customFields = array()) { if (is_object($this->auth) && is_object($this->perm)) { $authId = $this->auth->addUser($handle, $password, $active, $owner_user_id, $owner_group_id, $id, $customFields); if (LiveUser::isError($authId)) { return $authId; } return $this->perm->addUser($authId, $this->authContainerName, $type); } return LiveUser::raiseError(LIVEUSER_ERROR, null, null, 'Perm or Auth container couldn\\t be started.'); }
/** * Process message from consumed queue. process() involves applying methods to existing objects as * a part of consuming a message in a queue. */ protected function process() { $this->mbcDEUser->processUserCampaigns($this->campaigns); // Skip user objects that end up with no campaigns if (count($this->mbcDEUser->campaigns) > 0) { $this->mbcDEUser->getSubsciptionsURL(); $this->mbcDEMessenger->addUser($this->mbcDEUser); $this->users[] = $this->mbcDEUser; } else { echo '- No valid campaigns to compose digest message for user.', PHP_EOL; } // Cleanup for processing of next user digest settings unset($this->mbcDEUser); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Account (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setAddressId($this->getAddressId()); $copyObj->setIdentifier($this->getIdentifier()); $copyObj->setName($this->getName()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getBookingTypes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addBookingType($relObj->copy($deepCopy)); } } foreach ($this->getClockingTypes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addClockingType($relObj->copy($deepCopy)); } } foreach ($this->getDomains() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addDomain($relObj->copy($deepCopy)); } } foreach ($this->getHolidays() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addHoliday($relObj->copy($deepCopy)); } } foreach ($this->getPlugins() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPlugin($relObj->copy($deepCopy)); } } foreach ($this->getPropertys() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProperty($relObj->copy($deepCopy)); } } foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \Models\Image (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setTitle($this->getTitle()); $copyObj->setDescription($this->getDescription()); $copyObj->setPath($this->getPath()); $copyObj->setThumbnailPath($this->getThumbnailPath()); $copyObj->setType($this->getType()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } foreach ($this->getArticles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addArticle($relObj->copy($deepCopy)); } } foreach ($this->getImageGalleryMaps() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addImageGalleryMap($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Add user to the storage container * * @access public * @param string Username * @param string Password * @param mixed Additional parameters * @return mixed True on success, PEAR error object on error * and AUTH_METHOD_NOT_SUPPORTED otherwise. */ function addUser($username, $password, $additional = '') { $this->_loadStorage(); return $this->storage->addUser($username, $password, $additional); }
/** * Add user to the storage container * * @access public * @param string Username * @param string Password * @param mixed Additional parameters * @return mixed True on success, PEAR error object on error * and AUTH_METHOD_NOT_SUPPORTED otherwise. */ function addUser($username, $password, $additional = '') { $this->log('Auth::addUser() called.', AUTH_LOG_DEBUG); $this->_loadStorage(); return $this->storage->addUser($username, $password, $additional); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \Jalle19\StatusManager\Database\Instance (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setName($this->getName()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } foreach ($this->getConnections() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addConnection($relObj->copy($deepCopy)); } } foreach ($this->getInputs() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addInput($relObj->copy($deepCopy)); } } foreach ($this->getChannels() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addChannel($relObj->copy($deepCopy)); } } foreach ($this->getSubscriptions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addSubscription($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \App\Propel\File (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setFileTypeId($this->getFileTypeId()); $copyObj->setFilePath($this->getFilePath()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getCategories() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCategory($relObj->copy($deepCopy)); } } foreach ($this->getNews() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addNews($relObj->copy($deepCopy)); } } foreach ($this->getPeriodicPlans() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPeriodicPlan($relObj->copy($deepCopy)); } } foreach ($this->getProducts() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProduct($relObj->copy($deepCopy)); } } foreach ($this->getProviders() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProvider($relObj->copy($deepCopy)); } } foreach ($this->getResourceFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addResourceFile($relObj->copy($deepCopy)); } } foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setFileId(NULL); // this is a auto-increment column, so set to default value } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Game (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setStartTime($this->start_time); $copyObj->setEndTime($this->end_time); $copyObj->setActivePlayers($this->active_players); $copyObj->setLatitude($this->latitude); $copyObj->setLongitude($this->longitude); $copyObj->setIsActive($this->is_active); $copyObj->setIsPublic($this->is_public); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } foreach ($this->getGameMembers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addGameMember($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Contact (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setFirstName($this->getFirstName()); $copyObj->setLastName($this->getLastName()); $copyObj->setCompanyName($this->getCompanyName()); $copyObj->setEmailAddress($this->getEmailAddress()); $copyObj->setPhoneMainNumber($this->getPhoneMainNumber()); $copyObj->setPhoneOtherNumber($this->getPhoneOtherNumber()); $copyObj->setMailingAddress($this->getMailingAddress()); $copyObj->setMailingAddressLatitude($this->getMailingAddressLatitude()); $copyObj->setMailingAddressLongitude($this->getMailingAddressLongitude()); $copyObj->setCity($this->getCity()); $copyObj->setStateId($this->getStateId()); $copyObj->setZipCode($this->getZipCode()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of sfGuardUser (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setUsername($this->getUsername()); $copyObj->setAlgorithm($this->getAlgorithm()); $copyObj->setSalt($this->getSalt()); $copyObj->setPassword($this->getPassword()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setLastLogin($this->getLastLogin()); $copyObj->setIsActive($this->getIsActive()); $copyObj->setIsSuperAdmin($this->getIsSuperAdmin()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getsfGuardUserPermissions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardUserPermission($relObj->copy($deepCopy)); } } foreach ($this->getsfGuardUserGroups() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardUserGroup($relObj->copy($deepCopy)); } } foreach ($this->getsfGuardRememberKeys() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardRememberKey($relObj->copy($deepCopy)); } } foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Domainname (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setName($this->name); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } foreach ($this->getEmailAliass() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addEmailAlias($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }
/** * Add user to the storage container * * @access public * @param string Username * @param string Password * @param mixed Additional parameters * @return mixed True on success, PEAR error object on error * and AUTH_METHOD_NOT_SUPPORTED otherwise. */ function addUser($username, $password, $additional = "") { return $this->storage->addUser($username, $password, $additional); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Employee (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setDepartmentId($this->department_id); $copyObj->setDesignationId($this->designation_id); $copyObj->setRoleId($this->role_id); $copyObj->setEmpCategory($this->emp_category); $copyObj->setName($this->name); $copyObj->setCnic($this->cnic); $copyObj->setDob($this->dob); $copyObj->setGender($this->gender); $copyObj->setMailAddress($this->mail_address); $copyObj->setContactRes($this->contact_res); $copyObj->setContactCell($this->contact_cell); $copyObj->setContactOff($this->contact_off); $copyObj->setEmergencyContact($this->emergency_contact); $copyObj->setEmploymentDate($this->employment_date); $copyObj->setLocalResident($this->local_resident); $copyObj->setQualification($this->qualification); $copyObj->setVisitFee($this->visit_fee); $copyObj->setStatus($this->status); $copyObj->setCreatedAt($this->created_at); $copyObj->setUpdatedAt($this->updated_at); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getDutyRostersRelatedByEmployeeId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addDutyRosterRelatedByEmployeeId($relObj->copy($deepCopy)); } } foreach ($this->getDutyRostersRelatedBySubstituteId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addDutyRosterRelatedBySubstituteId($relObj->copy($deepCopy)); } } foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } foreach ($this->getVisitsRelatedByDoctorId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addVisitRelatedByDoctorId($relObj->copy($deepCopy)); } } foreach ($this->getVisitsRelatedByWardDocId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addVisitRelatedByWardDocId($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of EnumItem (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setId($this->id); $copyObj->setParentId($this->parent_id); $copyObj->setDescr($this->descr); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getCourseTypeAssociations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseTypeAssociation($relObj->copy($deepCopy)); } } foreach ($this->getEnumItemsRelatedByParentId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addEnumItemRelatedByParentId($relObj->copy($deepCopy)); } } foreach ($this->getExams() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addExam($relObj->copy($deepCopy)); } } foreach ($this->getImportMappingsRelatedByImportFileType() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addImportMappingRelatedByImportFileType($relObj->copy($deepCopy)); } } foreach ($this->getImportMappingsRelatedByMapping() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addImportMappingRelatedByMapping($relObj->copy($deepCopy)); } } foreach ($this->getRatingFields() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addRatingField($relObj->copy($deepCopy)); } } foreach ($this->getUsers() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUser($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); }
/** * Method to add a new user */ protected function saveNewUser() { if (!$_POST) { // Check that user has submitted a page return $this->nextAction(NULL); } // Generate User Id $userId = $this->objUserAdmin->generateUserId(); // Capture all Submitted Fields $captcha = $this->getParam('request_captcha'); $username = $this->getParam('register_username'); $password = $this->getParam('register_password'); $repeatpassword = $this->getParam('register_confirmpassword'); $title = $this->getParam('register_title'); $firstname = $this->getParam('register_firstname'); $surname = $this->getParam('register_surname'); $email = $this->getParam('register_email'); $repeatemail = $this->getParam('register_confirmemail'); $sex = $this->getParam('register_sex'); $cellnumber = $this->getParam('register_cellnum'); $staffnumber = $this->getParam('register_staffnum'); $country = $this->getParam('country'); $accountstatus = 1; // Default Status Active // Create an array of fields that cannot be empty $checkFields = array($captcha, $username, $firstname, $surname, $email, $repeatemail, $password, $repeatpassword); // Create an Array to store problems $problems = array(); // Check that username is available if ($this->objUserAdmin->userNameAvailable($username) == FALSE) { $problems[] = 'usernametaken'; } //check that the email address is unique if ($this->objUserAdmin->emailAvailable($email) == FALSE) { $problems[] = 'emailtaken'; } // Check for any problems with password if ($password == '') { $problems[] = 'nopasswordentered'; } else { if ($repeatpassword == '') { $problems[] = 'norepeatpasswordentered'; } else { if ($password != $repeatpassword) { $problems[] = 'passwordsdontmatch'; } } } // Check that all required field are not empty if (!$this->checkFields($checkFields)) { $problems[] = 'missingfields'; } // Check that email address is valid if (!$this->objUrl->isValidFormedEmailAddress($email)) { $problems[] = 'emailnotvalid'; } // Check whether user matched captcha if (md5(strtoupper($captcha)) != $this->getParam('captcha')) { $problems[] = 'captchadoesntmatch'; } // If there are problems, present from to user to fix if (count($problems) > 0) { $this->setVar('mode', 'addfixup'); $this->setVarByRef('problems', $problems); return 'registrationhome_tpl.php'; } else { // Else add to database $pkid = $this->objUserAdmin->addUser($userId, $username, $password, $title, $firstname, $surname, $email, $sex, $country, $cellnumber, $staffnumber, 'useradmin', $accountstatus); // Email Details to User $this->objUserAdmin->sendRegistrationMessage($pkid, $password); $this->setSession('id', $pkid); //$this->setSession('password', $password); $this->setSession('time', $password); return $this->nextAction('detailssent'); } }