示例#1
0
 /**
  * Validate user registration information and register new user.
  */
 function registerUser()
 {
     RegistrationHandler::validate();
     import('user.form.RegistrationForm');
     $regForm =& new RegistrationForm();
     $regForm->readInputData();
     if ($regForm->validate()) {
         $regForm->execute();
         if (Config::getVar('email', 'require_validation')) {
             // Send them home; they need to deal with the
             // registration email.
             Request::redirect(null, 'index');
         }
         Validation::login($regForm->getData('username'), $regForm->getData('password'), $reason);
         if ($reason !== null) {
             parent::setupTemplate(true);
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('pageTitle', 'user.login');
             $templateMgr->assign('errorMsg', $reason == '' ? 'user.login.accountDisabled' : 'user.login.accountDisabledWithReason');
             $templateMgr->assign('errorParams', array('reason' => $reason));
             $templateMgr->assign('backLink', Request::url(null, null, 'login'));
             $templateMgr->assign('backLinkLabel', 'user.login');
             return $templateMgr->display('common/error.tpl');
         }
         // Opatan Inc.
         if (Request::getUserVar('isReviewer') == 1) {
             $reviewerId = Request::getUserVar('reviewerId');
             $source = Request::getUserVar('source');
             RegistrationHandler::enrollAsReviewer($reviewerId, $source);
         } else {
             if ($source = Request::getUserVar('source')) {
                 Request::redirectUrl($source);
             } else {
                 Request::redirect(null, 'login');
             }
         }
     } else {
         parent::setupTemplate(true);
         $regForm->display();
     }
 }
示例#2
0
 function enrollAsReviewer($arg1, $arg2)
 {
     import('pages.user.RegistrationHandler');
     RegistrationHandler::enrollAsReviewer($arg1, $arg2);
 }