29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-27 07:33:41 +00:00

[#26028] Fix backward incompatible changes to JVersion

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@21438 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
This commit is contained in:
Mark Dexter 2011-06-04 13:35:56 +00:00
parent 15f1cde676
commit 586e17cb25
13 changed files with 208 additions and 33 deletions

View File

@ -104,6 +104,7 @@ class AdminModelSysInfo extends JModel
{
$this->info = array();
$version = new JVersion();
$platform = new JPlatform();
$db = JFactory::getDBO();
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$sf = $_SERVER['SERVER_SOFTWARE'];
@ -118,6 +119,7 @@ class AdminModelSysInfo extends JModel
$this->info['server'] = $sf;
$this->info['sapi_name'] = php_sapi_name();
$this->info['version'] = $version->getLongVersion();
$this->info['platform'] = $platform->getLongVersion();
$this->info['useragent'] = phpversion() <= '4.2.1' ? getenv("HTTP_USER_AGENT") : $_SERVER['HTTP_USER_AGENT'];
}
return $this->info;

View File

@ -85,6 +85,13 @@ defined('_JEXEC') or die;
<td>
<?php echo $this->info['version'];?>
</td>
</tr>
<td>
<strong><?php echo JText::_('COM_ADMIN_PLATFORM_VERSION'); ?></strong>
</td>
<td>
<?php echo $this->info['platform'];?>
</td>
</tr>
<tr>
<td>

View File

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<joshelp>
<sites>
<site
tag="en-GB"
url="http://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help16:{keyref}">English (GB) - Joomla help wiki 1.6</site>
<site
tag="en-GB"
url="http://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help{major}{minor}:{keyref}">English (GB) - Joomla help wiki</site>
</sites>
</joshelp>

View File

@ -25,9 +25,14 @@ if (!file_exists(JPATH_CONFIGURATION.'/configuration.php') || (filesize(JPATH_CO
exit();
}
/*
* Joomla! system startup
*/
//
// Joomla system startup.
//
// Import the cms version library if necessary.
if (!class_exists('JVersion')) {
require JPATH_ROOT.'/includes/version.php';
}
// System includes.
require_once JPATH_LIBRARIES.'/import.php';

View File

@ -101,6 +101,7 @@ COM_ADMIN_PHP_BUILT_ON="PHP Built On"
COM_ADMIN_PHP_INFORMATION="PHP Information"
COM_ADMIN_PHP_SETTINGS="PHP Settings"
COM_ADMIN_PHP_VERSION="PHP Version"
COM_ADMIN_PLATFORM_VERSION="Joomla! Platform Version"
COM_ADMIN_REGISTER_GLOBALS="Register Globals"
COM_ADMIN_RELEVANT_PHP_SETTINGS="Relevant PHP Settings"
COM_ADMIN_SAFE_MODE="Safe Mode"

View File

@ -36,6 +36,11 @@ if (!file_exists(JPATH_CONFIGURATION.'/configuration.php') || (filesize(JPATH_CO
// Joomla system startup.
//
// Import the cms version library if necessary.
if (!class_exists('JVersion')) {
require JPATH_ROOT.'/includes/version.php';
}
// System includes.
require_once JPATH_LIBRARIES.'/import.php';

145
includes/version.php Normal file
View File

@ -0,0 +1,145 @@
<?php
/**
* @package Joomla
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
/**
* Version information class for the Joomla CMS.
*
* @package Joomla
* @since 1.0
*/
final class JVersion
{
/** @var string Product name. */
public $PRODUCT = 'Joomla!';
/** @var string Release version. */
public $RELEASE = '1.7';
/** @var string Maintenance version. */
public $MAINTENANCE = '0';
/** @var string Development STATUS. */
public $STATUS = 'Alpha';
/** @var string Build number. */
public $BUILD = 0;
/** @var string Code name. */
public $CODE_NAME = 'Ember';
/** @var string Release date. */
public $RELEASE_DATE = '02-Jun-2011';
/** @var string Release time. */
public $RELEASE_TIME = '06:00';
/** @var string Release timezone. */
public $RELEASE_TIME_ZONE = 'GMT';
/** @var string Copyright Notice. */
public $COPYRIGHT = 'Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.';
/** @var string Link text. */
public $LINK_TEXT = '<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.';
/**
* Compares two a "PHP standardized" version number against the current Joomla version.
*
* @param string $minimum The minimum version of the Joomla which is compatible.
*
* @return bool True if the version is compatible.
*
* @see http://www.php.net/version_compare
* @since 1.0
*/
public function isCompatible($minimum)
{
return (version_compare(JVERSION, $minimum, 'eq') == 1);
}
/**
* Method to get the help file version.
*
* @return string Version suffix for help files.
*
* @since 1.0
*/
public function getHelpVersion()
{
if ($this->RELEASE > '1.0') {
return '.' . str_replace('.', '', $this->RELEASE);
}
else {
return '';
}
}
/**
* Gets a "PHP standardized" version string for the current Joomla.
*
* @return string Version string.
*
* @since 1.5
*/
public function getShortVersion()
{
return $this->RELEASE.'.'.$this->MAINTENANCE;
}
/**
* Gets a version string for the current Joomla with all release information.
*
* @return string Complete version string.
*
* @since 1.5
*/
public function getLongVersion()
{
return $this->PRODUCT.' '. $this->RELEASE.'.'.$this->MAINTENANCE.' '
. $this->STATUS.' [ '.$this->CODE_NAME.' ] '.$this->RELEASE_DATE.' '
.$this->RELEASE_TIME.' '.$this->RELEASE_TIME_ZONE;
}
/**
* Returns the user agent.
*
* @param string $component Name of the component.
* @param bool $mask Mask as Mozilla/5.0 or not.
* @param bool $add_version Add version afterwards to component.
*
* @return string User Agent.
*
* @since 1.0
*/
public function getUserAgent($component = null, $mask = false, $add_version = true)
{
if ($component === null) {
$component = 'Framework';
}
if ($add_version) {
$component .= '/'.$this->RELEASE;
}
// If masked pretend to look like Mozilla 5.0 but still identify ourselves.
if ($mask) {
return 'Mozilla/5.0 '. $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
}
else {
return $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
}
}
}
// Define the Joomla version if not already defined.
if (!defined('JVERSION')) {
$jversion = new JVersion;
define('JVERSION', $jversion->getShortVersion());
}

View File

@ -27,6 +27,9 @@ $ -> Language fix or change
- -> Removed
! -> Note
04-Jun-2011 Mark Dexter
# [#26028] Fix backward incompatible changes to JVersion
04-Jun-2011 Andrew Eddie
+ Feature [#25866] Add support to log deprecated API.
+ Feature [#25987] JToolBarHelper functions for Save and Create New and Save as Copy (Joseph LeBlanc).

View File

@ -55,9 +55,14 @@ if (file_exists(JPATH_CONFIGURATION.'/configuration.php') && (filesize(JPATH_CON
exit();
}
/*
* Joomla system startup
*/
//
// Joomla system startup.
//
// Import the cms version library if necessary.
if (!class_exists('JVersion')) {
require JPATH_ROOT.'/includes/version.php';
}
// Bootstrap the Joomla Framework.
require_once JPATH_LIBRARIES.'/import.php';

View File

@ -90,10 +90,10 @@ class JInstallationModelFilesystem extends JModel
// Check all possible paths for the real Joomla installation by comparing version files.
$rootPath = false;
$checkValue = file_get_contents(JPATH_LIBRARIES.DS.'joomla'.DS.'version.php');
$checkValue = file_get_contents(JPATH_ROOT.'/includes/version.php');
foreach ($paths as $tmp)
{
$filePath = rtrim($tmp, '/').'/libraries/joomla/version.php';
$filePath = rtrim($tmp, '/').'/includes/version.php';
$buffer = null;
@ $ftp->read($filePath, $buffer);
if ($buffer == $checkValue) {
@ -192,14 +192,14 @@ class JInstallationModelFilesystem extends JModel
// Verify RETR function
$buffer = null;
if ($ftp->read($root.'/libraries/joomla/version.php', $buffer) === false) {
if ($ftp->read($root.'/includes/version.php', $buffer) === false) {
$ftp->quit();
$this->setError(JText::_('INSTL_FTP_NORETR'));
return false;
}
// Verify valid root path, part two
$checkValue = file_get_contents(JPATH_LIBRARIES.DS.'joomla'.DS.'version.php');
$checkValue = file_get_contents(JPATH_ROOT.'/includes/version.php');
if ($buffer !== $checkValue) {
$ftp->quit();
$this->setError(JText::_('INSTL_FTP_INVALIDROOT'));
@ -347,14 +347,14 @@ class JInstallationModelFilesystem extends JModel
// Verify RETR function
$buffer = null;
if ($ftp->read($root.'/libraries/joomla/version.php', $buffer) === false) {
if ($ftp->read($root.'/includes/version.php', $buffer) === false) {
$ftp->quit();
$this->setError(JText::_('INSTL_FTP_NORETR'));
return false;
}
// Verify valid root path, part two
$checkValue = file_get_contents(JPATH_LIBRARIES.DS.'joomla'.DS.'version.php');
$checkValue = file_get_contents(JPATH_ROOT.'/includes/version.php');
if ($buffer !== $checkValue) {
$ftp->quit();
$this->setError(JText::_('INSTL_FTP_INVALIDROOT'));

View File

@ -30,16 +30,21 @@ if (!defined('IS_UNIX')) {
define('IS_UNIX', (($os !== 'MAC') && ($os !== 'WIN')) ? true : false);
}
// Import the platform version library if necessary.
if (!class_exists('JVersion')) {
require_once JPATH_PLATFORM.'/version.php';
}
// Import the library loader if necessary.
if (!class_exists('JLoader')) {
require_once JPATH_PLATFORM.'/loader.php';
}
// Register the JPlatform version class for lazy loading.
if (!class_exists('JPlatform')) {
JLoader::register('JPlatform', JPATH_PLATFORM.'/joomla/platform.php');
}
// Define the Joomla Platform version if not already defined.
if (!defined('JPLATFORM')) {
define('JPLATFORM', JPlatform::getShortVersion());
}
/**
* Import the base Joomla Platform libraries.
*/

View File

@ -199,7 +199,7 @@ class JLoggerFormattedText extends JLogger
$head[] = '#<?php die(\'Forbidden.\'); ?>';
}
$head[] = '#Date: '.gmdate('Y-m-d H:i:s').' UTC';
$head[] = '#Software: '.JVersion::getLongVersion();
$head[] = '#Software: '.JPlatform::getLongVersion();
$head[] = '';
// Prepare the fields string

View File

@ -8,27 +8,22 @@
defined('JPATH_PLATFORM') or die;
// Define the Joomla Platform version if not already defined.
if (!defined('JVERSION')) {
define('JVERSION', JVersion::getShortVersion());
}
/**
* Version information class for the Joomla Platform.
*
* @package Joomla.Platform
* @since 11.1
*/
final class JVersion
final class JPlatform
{
// Product name.
const PRODUCT = 'Joomla Platform';
// Release version.
const RELEASE = '1.7';
const RELEASE = '11';
// Maintenance version.
const MAINTENANCE = '0';
const MAINTENANCE = '1';
// Development STATUS.
const STATUS = 'Alpha';
const STATUS = 'Stable';
// Build number.
const BUILD = 0;
// Code name.
@ -56,7 +51,7 @@ final class JVersion
*/
public static function isCompatible($minimum)
{
return (version_compare(JVERSION, $minimum, 'eq') == 1);
return (version_compare(JPLATFORM, $minimum, 'eq') == 1);
}
/**
@ -68,7 +63,7 @@ final class JVersion
*/
public static function getShortVersion()
{
return JVersion::RELEASE.'.'.JVersion::MAINTENANCE;
return self::RELEASE.'.'.self::MAINTENANCE;
}
/**
@ -80,8 +75,8 @@ final class JVersion
*/
public static function getLongVersion()
{
return JVersion::PRODUCT.' '. JVersion::RELEASE.'.'.JVersion::MAINTENANCE.' '
. JVersion::STATUS.' [ '.JVersion::CODE_NAME.' ] '.JVersion::RELEASE_DATE.' '
.JVersion::RELEASE_TIME.' '.JVersion::RELEASE_TIME_ZONE;
return self::PRODUCT.' '. self::RELEASE.'.'.self::MAINTENANCE.' '
. self::STATUS.' [ '.self::CODE_NAME.' ] '.self::RELEASE_DATE.' '
.self::RELEASE_TIME.' '.self::RELEASE_TIME_ZONE;
}
}