<th align="left" class="th">Component</th> <th class="th" style="text-align: right;">Status</th> </tr> <tr> <td class="tdComponent">PHP version</td> <td align="right" class="tdValues"><strong> <?php $error_found = false; $minVersion = '5.1.2'; $supportedVersions = array('5.0.1', '5.0.2', '5.0.3', '5.0.4', '5.1.0', '5.1.1', '5.1.2', '5.1.3', '5.1.4', '5.1.5', '5.1.6', '5.1.7', '5.2.0', '5.2.1', '5.2.2'); $invalidVersions = array('5.0.0', '5.0.5'); $php_version = constant('PHP_VERSION'); $check_php_version_result = checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $php_version); switch ($check_php_version_result) { case INSTALLUTIL_VERSION_INVALID: echo "<b><font color='red'>Invalid version, ({$php_version}) Installed</font></b>"; $error_found = true; break; case INSTALLUTIL_VERSION_UNSUPPORTED: echo "<b><font color='red'>Unsupported (ver {$php_version})</font></b>"; break; case INSTALLUTIL_VERSION_SUPPORTED: echo "<b><font color='green'>OK (ver {$php_version})</font></b>"; break; } ?> </strong></td> </tr>
//error_reporting(-1); // See all errors (for debugging only) // User configuration if (is_file($GLOBALS['config']['CONFIG_FILE'])) { require_once $GLOBALS['config']['CONFIG_FILE']; } // Shaarli library require_once 'application/Cache.php'; require_once 'application/CachedPage.php'; require_once 'application/LinkDB.php'; require_once 'application/TimeZone.php'; require_once 'application/Url.php'; require_once 'application/Utils.php'; require_once 'application/Config.php'; // Ensure the PHP version is supported try { checkPHPVersion('5.3', PHP_VERSION); } catch (Exception $e) { header('Content-Type: text/plain; charset=utf-8'); echo $e->getMessage(); exit; } // Force cookie path (but do not change lifetime) $cookie = session_get_cookie_params(); $cookiedir = ''; if (dirname($_SERVER['SCRIPT_NAME']) != '/') { $cookiedir = dirname($_SERVER["SCRIPT_NAME"]) . '/'; } // Set default cookie expiration and path. session_set_cookie_params($cookie['lifetime'], $cookiedir, $_SERVER['SERVER_NAME']); // Set session parameters on server side. // If the user does not access any page within this time, his/her session is considered expired.
/** * Check another unsupported PHP version * @expectedException Exception * @expectedExceptionMessageRegExp /Your PHP version is obsolete/ */ public function testCheckSupportedPHPVersion52() { checkPHPVersion('5.3', '5.2'); }
<style> body { background-color: #F0F0F0; font-family: tahoma; font-size: 14px; height: 100%; overflow: auto;} table { margin: 0px; padding: 0px; border: 0px; } tr { margin: 0px; padding: 0px; border: 0px; } td { font-family: tahoma; font-size: 11px; margin: 0px; padding: 0px; border: 0px; } div.folder { cursor: hand; cursor: pointer; } a.smallLinkGrey:link { text-decoration: none; color: #6A6A6A; } a.smallLinkGrey:visited { text-decoration: none; color: #6A6A6A; } a.smallLinkGrey:hover { text-decoration: underline; color: #6A6A6A; } a.smallLinkBlack:link { text-decoration: none; color: #000000; } a.smallLinkBlack:visited { text-decoration: none; color: #000000; } a.smallLinkBlack:hover { text-decoration: underline; color: #000000; } </style> </head> <?php checkPHPVersion(); ?> <body> <?php /* Files that we don't want to see in the tree */ $Exclusion = array(".", "..", "index.php", "buildAll.cmd", "pictures", "resources", "delayedLoader", "sandbox", "imageMap"); /* Determine the current package version */ $FileHandle = fopen("../readme.txt", "r"); for ($i = 0; $i <= 5; $i++) { $buffer = fgets($FileHandle, 4096); } fclose($FileHandle); $Values = preg_split("/:/", $buffer); $Values = preg_split("/ /", $Values[1]); $Version = strip_tags($Values[1]);
* as published by the Free Software Foundation; version 2 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. */ error_reporting(E_ALL); include_once "./classes/util/global.func.php"; set_exception_handler('exception_handler'); // Check PHP version. if (!checkPHPVersion("5.3")) { echo "Wrong PHP version. The minimum required version is: 5.3"; exit(1); } // Does the config.ini file exists? if (!file_exists("./data/config.ini")) { if (!copy("./data/config.tpl.ini", "./data/config.ini")) { throw new Exception("Could not copy configuration file template. Require write permission (777) to \"data\" folder and all containing files."); } header("Location: settings.php"); exit(0); } /** * Password encryption type for BASIC authentication. */ //define("IF_HtPasswd_DefaultCrypt", "CRYPT"); // Unix only.
/** * Test method for checkPHPVersion() in installUtil.php */ public function testCheckPHPVersion() { $minVersion = '5.1.2'; $supportedVersions = array('5.0.1', '5.0.2', '5.0.3', '5.0.4', '5.1.0', '5.1.1', '5.1.2', '5.1.4', '5.1.5', '5.1.6', '5.1.7', '5.2.0', '5.2.1', '5.2.2'); $invalidVersions = array('5.0.0', '5.0.5', '5.5.0'); // Less than minVersion $version = "4.8.1"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_INVALID, "Should return INSTALLUTIL_VERSION_INVALID"); // Less than minVersion but in supported versions $version = "5.1.1"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_SUPPORTED, "Should return INSTALLUTIL_VERSION_SUPPORTED"); // Less than minVersion and in invalid versions $version = "5.0.0"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_INVALID, "Should return INSTALLUTIL_VERSION_INVALID"); // Greather than minVersion and not in supported or invalid versions $version = "5.1.3"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_UNSUPPORTED, "Should return INSTALLUTIL_VERSION_UNSUPPORTED"); // Not in supported versions or invalid versions but greater than the highest version in // supportedVersions $version = "5.2.3"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_SUPPORTED, "Should return INSTALLUTIL_VERSION_SUPPORTED"); // Greater than minVersion but in invalid versions $version = "5.5.0"; $this->assertEquals(checkPHPVersion($minVersion, $supportedVersions, $invalidVersions, $version), INSTALLUTIL_VERSION_INVALID, "Should return INSTALLUTIL_VERSION_INVALID"); }
//error_reporting(E_ALL); //ini_set('display_errors', 'on'); // @todo we need the user to confirm the path on the box of the ppi-framework. // @todo with this we can check if files required are there.. this is so we can re-use the default authentication scheme in the project's config // @todo and can register the user, using this. otherwise we would be registering the user, using some scheme that the dev would change // @todo to another kind of scheme and it would mismatch // @todo .. more thinking required .. $action = isset($_GET['action']) ? $_GET['action'] : null; switch ($action) { case 'user_create': // Get the default auth scheme from somewhere, (maybe a dropdown, to choose) // In order to make a dropdown it would have to scan the PPI/Auth/ folder for schemes // Using that auth adapter we can make a user break; case 'check_php': if (checkPHPVersion()) { die(json_encode(array('code' => 'E_OK', 'message' => ''))); } else { die(json_encode(array('code' => 'E_VERSION_TOO_MINOR', 'message' => 'Old PHP version detected; running: ' . PHP_VERSION))); } break; case 'check_pdomysql': if (checkPDOMysql()) { die(json_encode(array('code' => 'E_OK', 'message' => ''))); } else { die(json_encode(array('code' => 'E_EXTENSION_NOT_ENABLED', 'message' => 'PDO & PDO_MySQL not enabled.'))); } break; case 'check_xml': if (checkXML()) { die(json_encode(array('code' => 'E_OK', 'message' => '')));