private function checkPiwikIsNotInstalled() { if (!SettingsPiwik::isPiwikInstalled()) { return; } \Piwik\Plugins\Login\Controller::clearSession(); $message = Piwik::translate('Installation_InvalidStateError', array('<br /><strong>', '</strong>', '<a href=\'' . Common::sanitizeInputValue(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) * 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(Config::getLocalConfigPath())) { $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\Plugins\Login\Controller::clearSession(); $message = Piwik::translate('Installation_ErrorInvalidState', array('<br /><strong>', '</strong>', '<a href=\'' . Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName()) . '\'>', '</a>')); Piwik::exitWithErrorMessage($message); } }