/** * Redirects to Login form with error message. * Listens to FrontController.NoAccessException hook. * * @param Piwik_Event_Notification $notification notification object */ function noAccess($notification) { $exception = $notification->getNotificationObject(); $exceptionMessage = $exception->getMessage(); $controller = new Piwik_Login_Controller(); $controller->login($exceptionMessage); }
function welcome() { Piwik_Login_Controller::clearSession(); $view = new Piwik_Installation_View($this->pathView . 'welcome.tpl', $this->getInstallationSteps(), __FUNCTION__); $this->skipThisStep(__FUNCTION__); $view->showNextStep = true; $this->session->currentStepDone = __FUNCTION__; echo $view->render(); }
function welcome() { require_once "Login/Controller.php"; Piwik_Login_Controller::clearSession(); $view = new Piwik_Install_View($this->pathView . 'welcome.tpl', $this->getInstallationSteps(), __FUNCTION__); $this->skipThisStep(__FUNCTION__); $view->showNextStep = true; $_SESSION['currentStepDone'] = __FUNCTION__; echo $view->render(); }
/** * The previous step is valid if it is either * - any step before (OK to go back) * - the current step (case when validating a form) * If step is invalid, then exit. * * @param string $currentStep Current step */ protected function checkPreviousStepIsValid( $currentStep ) { $error = false; if(empty($this->session->currentStepDone)) { $error = true; } else if($currentStep == 'finished' && $this->session->currentStepDone == 'finished') { // ok to refresh this page or use language selector } else { if(file_exists(Piwik_Config::getDefaultUserConfigPath())) { $error = true; } $steps = array_keys($this->steps); // the currentStep $currentStepId = array_search($currentStep, $steps); // the step before $previousStepId = array_search($this->session->currentStepDone, $steps); // not OK if currentStepId > previous+1 if( $currentStepId > $previousStepId + 1 ) { $error = true; } } if($error) { Piwik_Login_Controller::clearSession(); $message = Piwik_Translate('Installation_ErrorInvalidState', array( '<br /><b>', '</b>', '<a href=\''.Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()).'\'>', '</a>') ); Piwik::exitWithErrorMessage( $message ); } }
/** * The previous step is valid if it is either * - any step before (OK to go back) * - the current step (case when validating a form) */ protected function checkPreviousStepIsValid($currentStep) { $error = false; // first we make sure that the config file is not present, ie. Installation state is expected try { $config = new Piwik_Config(); $config->init(); $error = true; } catch (Exception $e) { } if (empty($this->session->currentStepDone)) { $error = true; } else { $steps = array_keys($this->steps); // the currentStep $currentStepId = array_search($currentStep, $steps); // the step before $previousStepId = array_search($this->session->currentStepDone, $steps); // not OK if currentStepId > previous+1 if ($currentStepId > $previousStepId + 1) { $error = true; } } if ($error) { Piwik_Login_Controller::clearSession(); $message = Piwik_Translate('Installation_ErrorInvalidState', array('<br /><b>', '</b>', '<a href=\'' . Piwik_Url::getCurrentUrlWithoutFileName() . '\'>', '</a>')); Piwik::exitWithErrorMessage($message); } }