예제 #1
0
 /**
  * Sets the step based on a few checks
  *
  * @return	void
  */
 private function setStep()
 {
     // fetch step
     $step = isset($_GET['step']) ? (int) $_GET['step'] : 1;
     if ($step !== 1) {
         // invalid requirements, so force step 2
         if (!InstallerStep2::checkRequirements()) {
             $step = 2;
         }
     }
     // installer step class exists
     if (class_exists('InstallerStep' . $step)) {
         // isAllowed exists
         if (is_callable(array('InstallerStep' . $step, 'isAllowed'))) {
             // step is actually allowed
             if (call_user_func(array('InstallerStep' . $step, 'isAllowed'))) {
                 // step has been validated
                 $this->step = $step;
                 // step out
                 return;
             }
         }
     }
     // fallback
     $this->step = 1;
 }
예제 #2
0
파일: step_3.php 프로젝트: richsage/forkcms
 /**
  * Is this step allowed.
  *
  * @return bool
  */
 public static function isAllowed()
 {
     return InstallerStep2::isAllowed() && InstallerStep2::checkRequirements();
 }
예제 #3
0
 /**
  * Execute this step
  */
 public function execute()
 {
     // init vars
     self::$variables = array();
     // head
     self::$variables['head'] = file_get_contents('layout/templates/head.tpl');
     self::$variables['foot'] = file_get_contents('layout/templates/foot.tpl');
     // next step
     self::$variables['step3'] = 'index.php?step=3';
     // check requirements
     self::checkRequirements();
     // get template contents
     $tpl = file_get_contents('layout/templates/step_2.tpl');
     // has errors
     if (in_array(self::STATUS_ERROR, self::$variables)) {
         self::$variables[self::STATUS_ERROR] = true;
     } elseif (in_array(self::STATUS_WARNING, self::$variables)) {
         self::$variables[self::STATUS_WARNING] = true;
     } else {
         header('Location: ' . self::$variables['step3']);
         exit;
     }
     // set paths for template
     self::$variables['PATH_WWW'] = defined('PATH_WWW') ? PATH_WWW : '<unknown>';
     self::$variables['PATH_LIBRARY'] = defined('PATH_LIBRARY') ? PATH_LIBRARY : '<unknown>';
     // build the search & replace array
     $search = array_keys(self::$variables);
     $replace = array_values(self::$variables);
     // loop search values
     foreach ($search as $key => $value) {
         // parse variables
         $tpl = str_replace('{$' . $value . '}', $replace[$key], $tpl);
         // assign options
         $tpl = preg_replace('/\\{option:\\!(' . $value . ')\\}(.*?)\\{\\/option:\\!\\1\\}/is', !$replace[$key] ? '\\2' : '', $tpl);
         $tpl = preg_replace('/\\{option:(' . $value . ')\\}(.*?)\\{\\/option:\\1\\}/is', $replace[$key] ? '\\2' : '', $tpl);
     }
     // assign leftover options
     $tpl = preg_replace('/\\{option:!(.*?)\\}(.*?)\\{\\/option:!\\1\\}/is', '\\2', $tpl);
     $tpl = preg_replace('/\\{option:(.*?)\\}(.*?)\\{\\/option:\\1\\}/is', '', $tpl);
     // ignore comments
     $tpl = preg_replace('/\\{\\*(?!.*?\\{\\*).*?\\*\\}/s', '', $tpl);
     // show output
     echo $tpl;
     // stop the script
     exit;
 }
예제 #4
0
파일: step_7.php 프로젝트: richsage/forkcms
 /**
  * Validates the previous steps
  */
 private function validateForm()
 {
     return InstallerStep2::isAllowed() && InstallerStep3::isAllowed() && InstallerStep4::isAllowed() && InstallerStep5::isAllowed();
 }