⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dousercreation.class.php

📁 一个用PHP编写的
💻 PHP
字号:
<?php	lt_include( PLOG_CLASS_PATH."class/summary/action/registeraction.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" );        lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );    lt_include( PLOG_CLASS_PATH."class/summary/view/doblogregistrationview.class.php" );	lt_include( PLOG_CLASS_PATH."class/summary/view/summaryusercreationview.class.php" );        /**     * starts the user and blog registration process     */    class doUserCreation extends RegisterAction 	{			function doUserCreation( $actionInfo, $request )		{			$this->RegisterAction( $actionInfo, $request );						// data validation and stuff like that :)			$this->registerFieldValidator( "userName", new UsernameValidator());			$this->registerFieldValidator( "userPassword", new PasswordValidator());			$this->registerFieldValidator( "userPasswordCheck", new PasswordValidator());			$this->registerFieldValidator( "userEmail", new EmailValidator());            $this->_config =& Config::getConfig();            if( $this->_config->getValue( "use_captcha_auth" )) {				$this->registerFieldValidator( "userAuth", new StringValidator());			}			$this->registerField( "userFullName" );			$view = new SummaryUserCreationView();			$view->setErrorMessage( $this->_locale->tr("error_adding_user" ));			$this->setValidationErrorView( $view );		}	        function perform()        {	        // if all data is correct, then we can proceed and use it			$tf = new Textfilter();	                    $this->userName = $tf->filterAllHTML($this->_request->getValue( "userName" ));            $this->userPassword = $tf->filterAllHTML($this->_request->getValue( "userPassword" ));            $this->confirmPassword = $tf->filterAllHTML($this->_request->getValue( "userPasswordCheck" ));            $this->userEmail = $tf->filterAllHTML($this->_request->getValue( "userEmail" ));			$this->userFullName = $tf->filterAllHTML($this->_request->getValue( "userFullName" ));			$this->captcha = $this->_request->getValue( "userAuth" );						// check if there is already a user with the same username and quit if so			$users = new Users();			if( $users->getUserInfoFromUsername( $this->userName )) {				$this->_view = new SummaryUserCreationView();				//$this->_form->hasRun( true );				$this->_form->setFieldValidationStatus( "userName", false );				$this->setCommonData( true );				return false;			}            // check if this email account has registered and quit if so, but only if the configuration			// says that we should only allow one blog per email account			if( $this->_config->getValue( "force_one_blog_per_email_account" )) {        	    if( $users->emailExists($this->userEmail)) {					$this->_view = new SummaryUserCreationView();					//$this->_form->hasRun( true );					$this->_form->setFieldValidationStatus( "userEmail", false );					$this->setCommonData( true );					return false;            	}			}						// check if the passwords match, and stop processing if so too            if( $this->userPassword != $this->confirmPassword ) {	            $this->_view = new SummaryUserCreationView();                $this->_view->setErrorMessage( $this->_locale->tr("error_passwords_dont_match"));				$this->_form->setFieldValidationStatus( "userPasswordCheck", false );                                $this->setCommonData( true );                return false;            }			                        // check if the captcha matches            if( $this->_config->getValue( "use_captcha_auth")) {            	lt_include( PLOG_CLASS_PATH."class/data/captcha/captcha.class.php" );            	$captcha = new Captcha();            	if( !$captcha->validate( $this->captcha )) {		            $this->_view = new SummaryUserCreationView();    	            $this->_view->setErrorMessage( $this->_locale->tr("error_invalid_auth_code"));					$this->_form->setFieldValidationStatus( "userAuth", false );                            	    $this->setCommonData( true );                	return false;            	            	}            }			// save the data to the session			SessionManager::setSessionValue( "userName", $this->userName );			SessionManager::setSessionValue( "userPassword", $this->userPassword );			SessionManager::setSessionValue( "userEmail", $this->userEmail );			SessionManager::setSessionValue( "userFullName", $this->userFullName );            // if everything went fine, then proceed            $this->_view = new doBlogRegistrationView();            $this->setCommonData();            return true;        }    }?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -