diff options
Diffstat (limited to 'plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php')
-rw-r--r-- | plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php b/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php index 919d73a2cb..3199cb3167 100644 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php +++ b/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php @@ -9,7 +9,7 @@ /** * require the PhpSecInfo_Test_Application class */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Application.php'); +require_once(PHPSECINFO_BASE_DIR . '/Test/Test_Application.php'); /** * Test class for PHP application @@ -21,49 +21,52 @@ require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Application.php'); */ class PhpSecInfo_Test_Application_Php extends PhpSecInfo_Test_Application { - var $test_name = "PHP"; + var $test_name = "PHP"; - var $recommended_value = null; + var $recommended_value = null; - function _retrieveCurrentValue() { - $this->current_value = PHP_VERSION; + function _retrieveCurrentValue() + { + $this->current_value = PHP_VERSION; - $url = 'http://php.net/releases/?serialize=1&version=5'; - $timeout = Piwik_UpdateCheck::SOCKET_TIMEOUT; - try { - $latestVersion = Piwik_Http::sendHttpRequest($url, $timeout); - $versionInfo = safe_unserialize($latestVersion); - $this->recommended_value = $versionInfo['version']; - } catch(Exception $e) { - $this->recommended_value = ''; - } - } + $url = 'http://php.net/releases/?serialize=1&version=5'; + $timeout = Piwik_UpdateCheck::SOCKET_TIMEOUT; + try { + $latestVersion = Piwik_Http::sendHttpRequest($url, $timeout); + $versionInfo = safe_unserialize($latestVersion); + $this->recommended_value = $versionInfo['version']; + } catch (Exception $e) { + $this->recommended_value = ''; + } + } - function _execTest() { - if (version_compare($this->current_value, '5.2.1') < 0) { - return PHPSECINFO_TEST_RESULT_WARN; - } + function _execTest() + { + if (version_compare($this->current_value, '5.2.1') < 0) { + return PHPSECINFO_TEST_RESULT_WARN; + } - if (empty($this->recommended_value)) { - return PHPSECINFO_TEST_RESULT_ERROR; - } + if (empty($this->recommended_value)) { + return PHPSECINFO_TEST_RESULT_ERROR; + } - if (version_compare($this->current_value, $this->recommended_value) >= 0 ) { - return PHPSECINFO_TEST_RESULT_OK; - } + if (version_compare($this->current_value, $this->recommended_value) >= 0) { + return PHPSECINFO_TEST_RESULT_OK; + } - return PHPSECINFO_TEST_RESULT_NOTICE; - } + return PHPSECINFO_TEST_RESULT_NOTICE; + } - function _setMessages() { - parent::_setMessages(); + function _setMessages() + { + parent::_setMessages(); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP ".$this->current_value. - ($this->current_value == $this->recommended_value - ? " (the latest version)." - : ". The latest version is ".$this->recommended_value.".")); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are running PHP ".$this->current_value.". The latest version of PHP is ".$this->recommended_value."."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "You are running PHP ".$this->current_value." which is really old. We recommend running the latest (stable) version of PHP which includes numerous bug fixes and security fixes."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_ERROR, 'en', "Unable to determine the latest version of PHP available."); - } + $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP " . $this->current_value . + ($this->current_value == $this->recommended_value + ? " (the latest version)." + : ". The latest version is " . $this->recommended_value . ".")); + $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are running PHP " . $this->current_value . ". The latest version of PHP is " . $this->recommended_value . "."); + $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "You are running PHP " . $this->current_value . " which is really old. We recommend running the latest (stable) version of PHP which includes numerous bug fixes and security fixes."); + $this->setMessageForResult(PHPSECINFO_TEST_RESULT_ERROR, 'en', "Unable to determine the latest version of PHP available."); + } } |