1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 06:25:04 +02:00

Merge branch 'develop' into ticket/11015

* develop:
  [ticket/11012] Fix php_ext change in mock_extension_manager
  [ticket/11012] Normalize $phpEx member vars to $php_ext
  [ticket/11002] Use translating option to rename the Etc/GMT options

Conflicts:
	phpBB/includes/extension/manager.php
This commit is contained in:
Igor Wiedler 2012-07-21 18:16:53 +02:00
commit 83bdf3eeb3
9 changed files with 98 additions and 69 deletions

View File

@ -36,11 +36,11 @@ class acp_styles
protected $cache;
protected $auth;
protected $phpbb_root_path;
protected $phpEx;
protected $php_ext;
public function main($id, $mode)
{
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config;
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $php_ext, $template, $request, $cache, $auth, $config;
$this->db = $db;
$this->user = $user;
@ -50,12 +50,12 @@ class acp_styles
$this->auth = $auth;
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->default_style = $config['default_style'];
$this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/';
$this->u_base_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$id}");
$this->u_base_action = append_sid("{$phpbb_admin_path}index.$php_ext", "i={$id}");
$this->s_hidden_fields = array(
'mode' => $mode,
);
@ -939,7 +939,7 @@ class acp_styles
// Preview
$actions[] = array(
'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->phpEx, 'style=' . $style['style_id']),
'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'style=' . $style['style_id']),
'L_ACTION' => $this->user->lang['PREVIEW']
);
}

View File

@ -50,7 +50,7 @@ abstract class phpbb_extension_controller implements phpbb_extension_controller_
/**
* @var string PHP Extension
*/
protected $phpEx;
protected $php_ext;
/**
* @var string Relative path to board root
@ -64,14 +64,14 @@ abstract class phpbb_extension_controller implements phpbb_extension_controller_
public function __construct()
{
global $request, $db, $user, $template, $config;
global $phpEx, $phpbb_root_path;
global $php_ext, $phpbb_root_path;
$this->request = $request;
$this->db = $db;
$this->user = $user;
$this->template = $template;
$this->config = $config;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->phpbb_root_path = $phpbb_root_path;
}
}

View File

@ -25,7 +25,7 @@ class phpbb_extension_finder
protected $extension_manager;
protected $phpbb_root_path;
protected $cache;
protected $phpEx;
protected $php_ext;
/**
* The cache variable name used to store $this->cached_queries in $this->cache.
@ -56,16 +56,16 @@ class phpbb_extension_finder
* extensions and their locations
* @param string $phpbb_root_path Path to the phpbb root directory
* @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $phpEx php file extension
* @param string $php_ext php file extension
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
public function __construct(phpbb_extension_manager $extension_manager, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $phpEx = '.php', $cache_name = '_ext_finder')
public function __construct(phpbb_extension_manager $extension_manager, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = '.php', $cache_name = '_ext_finder')
{
$this->extension_manager = $extension_manager;
$this->phpbb_root_path = $phpbb_root_path;
$this->cache = $cache;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->cache_name = $cache_name;
$this->query = array(
@ -251,8 +251,8 @@ class phpbb_extension_finder
*/
public function get_classes($cache = true)
{
$this->query['extension_suffix'] .= $this->phpEx;
$this->query['core_suffix'] .= $this->phpEx;
$this->query['extension_suffix'] .= $this->php_ext;
$this->query['core_suffix'] .= $this->php_ext;
$files = $this->find($cache, false);
@ -261,7 +261,7 @@ class phpbb_extension_finder
{
$file = preg_replace('#^includes/#', '', $file);
$classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen($this->phpEx)));
$classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen($this->php_ext)));
}
return $classes;
}

View File

@ -23,7 +23,7 @@ if (!defined('IN_PHPBB'))
class phpbb_extension_manager
{
protected $cache;
protected $phpEx;
protected $php_ext;
protected $extensions;
protected $extension_table;
protected $phpbb_root_path;
@ -35,16 +35,16 @@ class phpbb_extension_manager
* @param dbal $db A database connection
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $phpEx php file extension
* @param string $php_ext php file extension
* @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
public function __construct(phpbb_db_driver $db, $extension_table, $phpbb_root_path, $phpEx = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
public function __construct(phpbb_db_driver $db, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
{
$this->phpbb_root_path = $phpbb_root_path;
$this->db = $db;
$this->cache = $cache;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->extension_table = $extension_table;
$this->cache_name = $cache_name;
@ -362,7 +362,7 @@ class phpbb_extension_manager
RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->phpEx)
if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->php_ext)
{
$ext_name = $iterator->getInnerIterator()->getSubPath();
@ -462,6 +462,6 @@ class phpbb_extension_manager
*/
public function get_finder()
{
return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->phpEx, $this->cache_name . '_finder');
return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
}
}

View File

@ -38,7 +38,7 @@ class phpbb_style
* PHP file extension
* @var string
*/
private $phpEx;
private $php_ext;
/**
* phpBB config instance
@ -73,10 +73,10 @@ class phpbb_style
* @param phpbb_style_path_provider $provider style path provider
* @param phpbb_template $template template
*/
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template)
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->config = $config;
$this->user = $user;
$this->locator = $locator;

View File

@ -54,7 +54,7 @@ class phpbb_template
* PHP file extension
* @var string
*/
private $phpEx;
private $php_ext;
/**
* phpBB config instance
@ -87,10 +87,10 @@ class phpbb_template
* @param user $user current user
* @param phpbb_template_locator $locator template locator
*/
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_template_locator $locator)
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->php_ext = $php_ext;
$this->config = $config;
$this->user = $user;
$this->locator = $locator;
@ -313,7 +313,7 @@ class phpbb_template
private function _compiled_file_for_handle($handle)
{
$source_file = $this->locator->get_filename_for_handle($handle);
$compiled_file = $this->cachepath . str_replace('/', '.', $source_file) . '.' . $this->phpEx;
$compiled_file = $this->cachepath . str_replace('/', '.', $source_file) . '.' . $this->php_ext;
return $compiled_file;
}

View File

@ -26,85 +26,85 @@ class phpbb_update_helpers
switch ($timezone)
{
case '-12':
return 'Etc/GMT' . $offset; //'[UTC - 12] Baker Island Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 12] Baker Island Time'
case '-11':
return 'Etc/GMT' . $offset; //'[UTC - 11] Niue Time, Samoa Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 11] Niue Time, Samoa Standard Time'
case '-10':
return 'Etc/GMT' . $offset; //'[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time'
case '-9.5':
return 'Pacific/Marquesas'; //'[UTC - 9:30] Marquesas Islands Time'
return 'Pacific/Marquesas'; //'[UTC - 9:30] Marquesas Islands Time'
case '-9':
return 'Etc/GMT' . $offset; //'[UTC - 9] Alaska Standard Time, Gambier Island Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 9] Alaska Standard Time, Gambier Island Time'
case '-8':
return 'Etc/GMT' . $offset; //'[UTC - 8] Pacific Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 8] Pacific Standard Time'
case '-7':
return 'Etc/GMT' . $offset; //'[UTC - 7] Mountain Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 7] Mountain Standard Time'
case '-6':
return 'Etc/GMT' . $offset; //'[UTC - 6] Central Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 6] Central Standard Time'
case '-5':
return 'Etc/GMT' . $offset; //'[UTC - 5] Eastern Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 5] Eastern Standard Time'
case '-4.5':
return 'America/Caracas'; //'[UTC - 4:30] Venezuelan Standard Time'
return 'America/Caracas'; //'[UTC - 4:30] Venezuelan Standard Time'
case '-4':
return 'Etc/GMT' . $offset; //'[UTC - 4] Atlantic Standard Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 4] Atlantic Standard Time'
case '-3.5':
return 'America/St_Johns'; //'[UTC - 3:30] Newfoundland Standard Time'
return 'America/St_Johns'; //'[UTC - 3:30] Newfoundland Standard Time'
case '-3':
return 'Etc/GMT' . $offset; //'[UTC - 3] Amazon Standard Time, Central Greenland Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 3] Amazon Standard Time, Central Greenland Time'
case '-2':
return 'Etc/GMT' . $offset; //'[UTC - 2] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 2] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time'
case '-1':
return 'Etc/GMT' . $offset; //'[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time'
return 'Etc/GMT+' . abs($offset); //'[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time'
case '0':
return (!$dst) ? 'UTC' : 'Etc/GMT+1'; //'[UTC] Western European Time, Greenwich Mean Time'
return (!$dst) ? 'UTC' : 'Etc/GMT-1'; //'[UTC] Western European Time, Greenwich Mean Time'
case '1':
return 'Etc/GMT+' . $offset; //'[UTC + 1] Central European Time, West African Time'
return 'Etc/GMT-' . $offset; //'[UTC + 1] Central European Time, West African Time'
case '2':
return 'Etc/GMT+' . $offset; //'[UTC + 2] Eastern European Time, Central African Time'
return 'Etc/GMT-' . $offset; //'[UTC + 2] Eastern European Time, Central African Time'
case '3':
return 'Etc/GMT+' . $offset; //'[UTC + 3] Moscow Standard Time, Eastern African Time'
return 'Etc/GMT-' . $offset; //'[UTC + 3] Moscow Standard Time, Eastern African Time'
case '3.5':
return 'Asia/Tehran'; //'[UTC + 3:30] Iran Standard Time'
return 'Asia/Tehran'; //'[UTC + 3:30] Iran Standard Time'
case '4':
return 'Etc/GMT+' . $offset; //'[UTC + 4] Gulf Standard Time, Samara Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 4] Gulf Standard Time, Samara Standard Time'
case '4.5':
return 'Asia/Kabul'; //'[UTC + 4:30] Afghanistan Time'
return 'Asia/Kabul'; //'[UTC + 4:30] Afghanistan Time'
case '5':
return 'Etc/GMT+' . $offset; //'[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time'
case '5.5':
return 'Asia/Kolkata'; //'[UTC + 5:30] Indian Standard Time, Sri Lanka Time'
return 'Asia/Kolkata'; //'[UTC + 5:30] Indian Standard Time, Sri Lanka Time'
case '5.75':
return 'Asia/Kathmandu'; //'[UTC + 5:45] Nepal Time'
return 'Asia/Kathmandu'; //'[UTC + 5:45] Nepal Time'
case '6':
return 'Etc/GMT+' . $offset; //'[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time'
case '6.5':
return 'Indian/Cocos'; //'[UTC + 6:30] Cocos Islands Time, Myanmar Time'
return 'Indian/Cocos'; //'[UTC + 6:30] Cocos Islands Time, Myanmar Time'
case '7':
return 'Etc/GMT+' . $offset; //'[UTC + 7] Indochina Time, Krasnoyarsk Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 7] Indochina Time, Krasnoyarsk Standard Time'
case '8':
return 'Etc/GMT+' . $offset; //'[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time'
case '8.75':
return 'Australia/Eucla'; //'[UTC + 8:45] Southeastern Western Australia Standard Time'
return 'Australia/Eucla'; //'[UTC + 8:45] Southeastern Western Australia Standard Time'
case '9':
return 'Etc/GMT+' . $offset; //'[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time'
case '9.5':
return 'Australia/ACT'; //'[UTC + 9:30] Australian Central Standard Time'
return 'Australia/ACT'; //'[UTC + 9:30] Australian Central Standard Time'
case '10':
return 'Etc/GMT+' . $offset; //'[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time'
case '10.5':
return 'Australia/Lord_Howe'; //'[UTC + 10:30] Lord Howe Standard Time'
return 'Australia/Lord_Howe'; //'[UTC + 10:30] Lord Howe Standard Time'
case '11':
return 'Etc/GMT+' . $offset; //'[UTC + 11] Solomon Island Time, Magadan Standard Time'
return 'Etc/GMT-' . $offset; //'[UTC + 11] Solomon Island Time, Magadan Standard Time'
case '11.5':
return 'Pacific/Norfolk'; //'[UTC + 11:30] Norfolk Island Time'
return 'Pacific/Norfolk'; //'[UTC + 11:30] Norfolk Island Time'
case '12':
return 'Etc/GMT+12'; //'[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time'
return 'Etc/GMT-12'; //'[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time'
case '12.75':
return 'Pacific/Chatham'; //'[UTC + 12:45] Chatham Islands Time'
return 'Pacific/Chatham'; //'[UTC + 12:45] Chatham Islands Time'
case '13':
return 'Pacific/Tongatapu'; //'[UTC + 13] Tonga Time, Phoenix Islands Time'
return 'Pacific/Tongatapu'; //'[UTC + 13] Tonga Time, Phoenix Islands Time'
case '14':
return 'Pacific/Kiritimati'; //'[UTC + 14] Line Island Time'
return 'Pacific/Kiritimati'; //'[UTC + 14] Line Island Time'
default:
return 'UTC';
}

View File

@ -836,6 +836,35 @@ $lang = array_merge($lang, array(
'Dec' => 'Dec',
),
// Timezones can be translated. We use this for the Etc/GMT timezones here,
// because they are named invers to their offset.
'timezones' => array(
'Etc/GMT-12' => 'GMT+12',
'Etc/GMT-11' => 'GMT+11',
'Etc/GMT-10' => 'GMT+10',
'Etc/GMT-9' => 'GMT+9',
'Etc/GMT-8' => 'GMT+8',
'Etc/GMT-7' => 'GMT+7',
'Etc/GMT-6' => 'GMT+6',
'Etc/GMT-5' => 'GMT+5',
'Etc/GMT-4' => 'GMT+4',
'Etc/GMT-3' => 'GMT+3',
'Etc/GMT-2' => 'GMT+2',
'Etc/GMT-1' => 'GMT+1',
'Etc/GMT+1' => 'GMT-1',
'Etc/GMT+2' => 'GMT-2',
'Etc/GMT+3' => 'GMT-3',
'Etc/GMT+4' => 'GMT-4',
'Etc/GMT+5' => 'GMT-5',
'Etc/GMT+6' => 'GMT-6',
'Etc/GMT+7' => 'GMT-7',
'Etc/GMT+8' => 'GMT-8',
'Etc/GMT+9' => 'GMT-9',
'Etc/GMT+10' => 'GMT-10',
'Etc/GMT+11' => 'GMT-11',
'Etc/GMT+12' => 'GMT-12',
),
// The value is only an example and will get replaced by the current time on view
'dateformats' => array(
'd M Y, H:i' => '01 Jan 2007, 13:37',

View File

@ -12,7 +12,7 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
public function __construct($phpbb_root_path, $extensions = array())
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = '.php';
$this->php_ext = '.php';
$this->extensions = $extensions;
}
}