/** * Handles Installation Steps and Calculates Installation Progress Bar * * Procedure Notice: * If a STEP is successful, * proceed to the next, else return to the same STEP and display error. */ public function determineCurrentStep() { // update the session with the given variables! $_SESSION = Helper::array_merge_rec($_POST, $_SESSION); /** * STEP HANDLING */ if (isset($_SESSION['step']) === true) { $this->step = intval($_SESSION['step']); if (isset($_POST['step_forward']) === true and $this->step == $_POST['submitted_step']) { $this->step = $this->step + 1; } if (isset($_POST['step_backward']) === true and $this->step == $_POST['submitted_step']) { $this->step = $this->step - 1; } } else { $this->step = 1; } if ($this->step >= $this->total_steps) { $this->step = $this->total_steps; } if ($this->step == 0) { $this->step = 1; } // remove not needed values unset($_SESSION['step_forward'], $_SESSION['step_backward'], $_SESSION['submitted_step']); }