상속: extends Piwik\QuickForm2
예제 #1
0
 /**
  * Installation Step 5: General Set-up (superuser login/password/email and subscriptions)
  */
 function setupSuperUser()
 {
     $this->checkPiwikIsNotInstalled();
     $this->initObjectsToCallAPI();
     if (count(APIUsersManager::getInstance()->getUsersHavingSuperUserAccess()) > 0) {
         $this->redirectToNextStep('setupSuperUser');
     }
     $view = new View('@Installation/setupSuperUser', $this->getInstallationSteps(), __FUNCTION__);
     $form = new FormSuperUser();
     if ($form->validate()) {
         try {
             $this->createSuperUser($form->getSubmitValue('login'), $form->getSubmitValue('password'), $form->getSubmitValue('email'));
             $email = $form->getSubmitValue('email');
             $newsletterPiwikORG = $form->getSubmitValue('subscribe_newsletter_piwikorg');
             $newsletterPiwikPRO = $form->getSubmitValue('subscribe_newsletter_piwikpro');
             $this->registerNewsletter($email, $newsletterPiwikORG, $newsletterPiwikPRO);
             $this->redirectToNextStep(__FUNCTION__);
         } catch (Exception $e) {
             $view->errorMessage = $e->getMessage();
         }
     }
     $view->addForm($form);
     return $view->render();
 }
예제 #2
0
 /**
  * Installation Step 5: General Set-up (superuser login/password/email and subscriptions)
  */
 function setupSuperUser()
 {
     $this->checkPiwikIsNotInstalled();
     $superUserAlreadyExists = Access::doAsSuperUser(function () {
         return count(APIUsersManager::getInstance()->getUsersHavingSuperUserAccess()) > 0;
     });
     if ($superUserAlreadyExists) {
         $this->redirectToNextStep('setupSuperUser');
     }
     $view = new View('@Installation/setupSuperUser', $this->getInstallationSteps(), __FUNCTION__);
     $form = new FormSuperUser();
     if ($form->validate()) {
         try {
             $this->createSuperUser($form->getSubmitValue('login'), $form->getSubmitValue('password'), $form->getSubmitValue('email'));
             $email = $form->getSubmitValue('email');
             $newsletterPiwikORG = $form->getSubmitValue('subscribe_newsletter_piwikorg');
             $newsletterProfessionalServices = $form->getSubmitValue('subscribe_newsletter_professionalservices');
             $this->registerNewsletter($email, $newsletterPiwikORG, $newsletterProfessionalServices);
             $this->redirectToNextStep(__FUNCTION__);
         } catch (Exception $e) {
             $view->errorMessage = $e->getMessage();
         }
     }
     $view->addForm($form);
     return $view->render();
 }