/**
  * Check absolutely necessary stuff and die
  *
  * @return void
  */
 public function checkBasicStuff()
 {
     if (!$this->checkMinimumPhpVersion()) {
         printf('<p class="alert alert-error">Sorry, but you need PHP %s or later!</p>', PMF_System::VERSION_MINIMUM_PHP);
         PMF_System::renderFooter();
     }
     if (!function_exists('date_default_timezone_set')) {
         echo '<p class="alert alert-error">Sorry, but setting a default timezone doesn\'t work in your environment!</p>';
         PMF_System::renderFooter();
     }
     if (!$this->_system->checkDatabase()) {
         echo '<p class="alert alert-error">No supported database detected! Please install one of the following' . ' database systems and enable the corresponding PHP extension in php.ini:</p>';
         echo '<ul>';
         foreach ($this->_system->getSupportedDatabases() as $database) {
             printf('    <li>%s</li>', $database[1]);
         }
         echo '</ul>';
         PMF_System::renderFooter();
     }
     if (!$this->_system->checkRequiredExtensions()) {
         echo '<p class="alert alert-error">The following extensions are missing! Please enable the PHP extension(s) in ' . 'php.ini.</p>';
         echo '<ul>';
         foreach ($this->_system->getMissingExtensions() as $extension) {
             printf('    <li>ext/%s</li>', $extension);
         }
         echo '</ul>';
         PMF_System::renderFooter();
     }
     if (!$this->_system->checkRegisterGlobals()) {
         echo '<p class="alert alert-error">Please disable register_globals!</p>';
         PMF_System::renderFooter();
     }
     if (!$this->_system->checkMagicQuotesGpc()) {
         echo '<p class="alert alert-error">Please disable magic_quotes_gpc!</p>';
         PMF_System::renderFooter();
     }
     if (!$this->_system->checkphpMyFAQInstallation()) {
         echo '<p class="alert alert-error">It seems you\'re already running a version of phpMyFAQ. Please use the ' . '<a href="update.php">update script</a>.</p>';
         PMF_System::renderFooter();
     }
 }
예제 #2
0
 /**
  * Check absolutely necessary stuff and die
  *
  * @return array
  */
 public function checkBasicStuff()
 {
     $errors = array();
     if (!$this->checkMinimumPhpVersion()) {
         $errors[] = sprintf('Sorry, but you need PHP %s or later!', PMF_System::VERSION_MINIMUM_PHP);
     }
     if (!function_exists('date_default_timezone_set')) {
         $errors[] = 'Sorry, but setting a default timezone doesn\'t work in your environment!';
     }
     if (!$this->_system->checkDatabase()) {
         $dbError = "No supported database detected! Please install one of the following database systems and " . "enable the corresponding PHP extension in php.ini:";
         $dbError .= "<ul>";
         foreach ($this->_system->getSupportedDatabases() as $database) {
             $dbError .= sprintf("    <li>%s</li>\n", $database[1]);
         }
         $dbError .= "</ul>";
         $errors[] = $dbError;
     }
     if (!$this->_system->checkRequiredExtensions()) {
         $extError = "The following extensions are missing! Please enable the PHP extension(s) in php.ini.";
         $extError .= "<ul>";
         foreach ($this->_system->getMissingExtensions() as $extension) {
             $extError .= sprintf("    <li>ext/%s</li>\n", $extension);
         }
         $extError .= "</ul>";
         $errors[] = $extError;
     }
     if (!$this->_system->checkRegisterGlobals()) {
         $errors[] = "Please disable register_globals!";
     }
     if (!$this->_system->checkMagicQuotesGpc()) {
         $errors[] = "Please disable magic_quotes_gpc!";
     }
     if (!$this->_system->checkphpMyFAQInstallation()) {
         $errors[] = "It seems you're already running a version of phpMyFAQ. Please use the " . "<a href=\"update.php\">update script</a>.";
     }
     return $errors;
 }