/** * Check if version is within bounds of lower and upper, in mathematical * sens it would be: $lowerBound <= $currentVersion < $upperBound */ function VersionInBounds($currentVersion, $lowerBound, $upperBound) { $CurLow = CompareVersons($currentVersion, $lowerBound); $CurHig = CompareVersons($currentVersion, $upperBound); // If current version is equal or higher than lower bound // and is below the upper bound - then accepted! if ($CurLow >= 0 && $CurHig < 0) { return true; } else { return false; } }
// <<<<<<<<<<<< PHP dies after the page has been shown! } /* ===================================================[ PHP REQUIREMENTS CHECKS ]=================================================== */ if ($steps[STEP_PHPREQUIRES]['enabled']) { $page->MainTitle($steps[STEP_PHPREQUIRES]['title'], 'phplogo'); // Three variations of PHP checks, these will // indicate if there is a problem in certain part $phpversion = true; $extensions = true; $directives = true; // If minimum PHP version is required if ($steps[STEP_PHPREQUIRES]['phpversion'] !== false) { $page->SubTitle('PHP Version', 'notepad'); $bounds = GetVersionBounds($steps[STEP_PHPREQUIRES]['phpversion'], $steps[STEP_PHPREQUIRES]['maxversion']); $CurLow = CompareVersons($bounds['current'], $bounds['lower']); $CurHig = CompareVersons($bounds['current'], $bounds['upper']); // Start the version table $page->StartTable(4, array('class' => 'dbtests', 'cellspacing' => '0', 'cellpadding' => '0')); // Display the requirements $page->AddTableData('', array('class' => 'currentico')); $page->AddTableData('Required:', array('style' => 'padding-right:15px;')); // If range is defined or not if ($steps[STEP_PHPREQUIRES]['maxversion'] === false) { $str = ' or later'; } else { $str = ' - ' . implode('.', VersionStringToArray($steps[STEP_PHPREQUIRES]['maxversion'])); } $page->AddTableData(implode('.', $bounds['lower']) . $str, array('style' => 'padding-right:15px;')); $page->AddTableData(''); // If current version is equal or higher than lower bound // and is below the upper bound - then accepted!
/* -----------------------( CHECK PHP VERSION )----------------------- */ // If the php version is defined here if(isset($steps[$step]['phpversion'])) { $max = $steps[$step]['maxversion']; if($max === false) $max = 'x'; // Get the current, lower and upper $bounds = GetVersionBounds($steps[$step]['phpversion'], $max); $CurLow = CompareVersons($bounds['current'], $bounds['lower']); $CurHig = CompareVersons($bounds['current'], $bounds['upper']); $MinMax = CompareVersons($bounds['lower'], $bounds['upper']); $maxStr = ($steps[$step]['maxversion']) ? ' - '.implode('.', $bounds['upper']) : ''; $verStr = '<br /> <br />PHP Version: '.phpversion().'<br />PHP Required: '.implode('.', $bounds['lower']).$maxStr; // If minimum is above maximum! if($MinMax == 1) { $page->ErrorBox('Minimum version requirements are higher than maximum requirements. '. 'This check will always fail due to incorrect configuration! <br /> <br />'. 'This must be corrected: [min '.$steps[$step]['phpversion'].' > '.$steps[$step]['maxversion'].' max]'); } // If current version is equal or higher than lower bound // and is below the upper bound - then accepted! if ($CurLow >= 0 && $CurHig < 0) $page->SuccessBox('Current PHP version is supported!'.$verStr);