Beispiel #1
0
 function perform()
 {
     $this->_userName = $this->_request->getValue("userName");
     $this->_userPassword = $this->_request->getValue("userPassword");
     $this->_confirmPassword = $this->_request->getValue("userPasswordCheck");
     $this->_userEmail = $this->_request->getValue("userEmail");
     $this->_userFullName = $this->_request->getValue("userFullName");
     $db = connectDb();
     if (!$db) {
         $this->_view = new WizardView("step3");
         $this->_view->setErrorMessage("There was an error connecting to the database. Please check your settings.");
         $this->setCommonData();
         return false;
     }
     if ($this->_confirmPassword != $this->_userPassword) {
         $this->_view = new WizardView("step3");
         $this->_form->setFieldValidationStatus("userPasswordCheck", false);
         $this->setCommonData(true);
         return false;
     }
     $dbPrefix = Db::getPrefix();
     $users = new Users();
     $user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName);
     $userId = $users->addUser($user);
     if (!$userId) {
         $this->_view = new WizardView("step3");
         $message = "There was an error adding the user. Make sure that the user does not already exist in the database (" . $users->DbError() . ")";
         $this->_view->setErrorMessage($message);
         $this->setCommonData();
         return false;
     }
     // we also have to execute the code to give administrator privileges to this user
     $query = "INSERT INTO {$dbPrefix}users_permissions(user_id,blog_id,permission_id) VALUES( {$userId}, 0, 1 );";
     $db->Execute($query);
     $this->_view = new Wizardview("step4");
     $this->_view->setValue("ownerid", $userId);
     $this->_view->setValue("siteLocales", Locales::getLocales());
     $this->_view->setValue("defaultLocale", Locales::getDefaultLocale());
     $ts = new TemplateSets();
     $this->_view->setValue("siteTemplates", $ts->getGlobalTemplateSets());
     $this->setCommonData();
     return true;
 }