1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

Merge remote-tracking branch 'upstream/develop' into feature/avatars

* upstream/develop: (255 commits)
  [ticket/10935] Limit number of PM rules per user to 5000
  [ticket/10801] Fixed quickmod tools.
  [ticket/9551] uncomment line and change length to 255
  [ticket/10925] Clarify installation requirements for SQLite
  [ticket/10938] Serve subforum listing on forumlist from template loop
  [ticket/10640] Change subject length in mcp in subsilver
  [ticket/10640] Change subject length in MCP
  [ticket/10640] Do not change default value of truncate_string()
  [ticket/10640] Change maximum subject length
  [ticket/10936] remove PCRE and mbstring support check
  [ticket/10936] fix language key
  [ticket/10829] Delete T_STYLESHEET_NAME - no longer used.
  [ticket/10829] $style_name -> $style_path in style class.
  [ticket/10743] Renaming user->theme
  [ticket/10743] Changing obtain_cfg_items
  [ticket/10882] Fix test name - oops.
  [ticket/10931] Apply strtolower() correctly, i.e. not on false.
  [ticket/10931] Also test get_bytes() and get_string() with false.
  [ticket/10931] Make to_numeric function globally available.
  [ticket/10932] Use included composer.phar in build process
  ...

Conflicts:
	phpBB/includes/mcp/mcp_warn.php
	phpBB/install/database_update.php
	phpBB/styles/prosilver/template/ucp_avatar_options.html
This commit is contained in:
Igor Wiedler
2012-06-27 14:47:13 +02:00
254 changed files with 2817 additions and 1472 deletions

View File

@@ -13,7 +13,7 @@ if (!defined('IN_PHPBB'))
}
/**
* Helper functions for phpBB 2.0.x to phpBB 3.0.x conversion
* Helper functions for phpBB 2.0.x to phpBB 3.1.x conversion
*/
/**

View File

@@ -189,6 +189,12 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// Update asset_version
if (isset($config['assets_version']))
{
set_config('assets_version', $config['assets_version'] + 1);
}
// phpbb_db_tools will be taken from new files (under install/update/new)
// if possible, falling back to the board's copy.
$db_tools = new phpbb_db_tools($db, true);
@@ -254,7 +260,7 @@ if ($has_global && !$ga_forum_id)
</form>
<?php
_print_footer();
exit;
exit_handler();
}
header('Content-type: text/html; charset=UTF-8');
@@ -1021,7 +1027,7 @@ function database_update_info()
// this column was removed from the database updater
// after 3.0.9-RC3 was released. It might still exist
// in 3.0.9-RCX installations and has to be dropped in
// 3.0.11 after the db_tools class is capable of properly
// 3.0.12 after the db_tools class is capable of properly
// removing a primary key.
// 'attempt_id' => array('UINT', NULL, 'auto_increment'),
'attempt_ip' => array('VCHAR:40', ''),
@@ -1063,8 +1069,10 @@ function database_update_info()
'3.0.10-RC2' => array(),
// No changes from 3.0.10-RC3 to 3.0.10
'3.0.10-RC3' => array(),
// No changes from 3.0.10 to 3.0.11-RC1
'3.0.10' => array(),
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 */
// Changes from 3.1.0-dev to 3.1.0-A1
'3.1.0-dev' => array(
@@ -1106,20 +1114,6 @@ function database_update_info()
'user_avatar_type' => array('VCHAR:32', 0),
),
),
'drop_columns' => array(
STYLES_TABLE => array(
'imageset_id',
'template_id',
'theme_id',
),
),
'drop_tables' => array(
STYLES_IMAGESET_TABLE,
STYLES_IMAGESET_DATA_TABLE,
STYLES_TEMPLATE_TABLE,
STYLES_TEMPLATE_DATA_TABLE,
STYLES_THEME_TABLE,
),
),
);
}
@@ -1131,7 +1125,7 @@ function database_update_info()
*****************************************************************************/
function change_database_data(&$no_updates, $version)
{
global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx;
global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $db_tools;
switch ($version)
{
@@ -2151,6 +2145,70 @@ function change_database_data(&$no_updates, $version)
case '3.0.10-RC3':
break;
// Changes from 3.0.10 to 3.0.11-RC1
case '3.0.10':
// Updates users having current style a deactivated one
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . '
WHERE style_active = 0';
$result = $db->sql_query($sql);
$deactivated_style_ids = array();
while ($style_id = $db->sql_fetchfield('style_id', false, $result))
{
$deactivated_style_ids[] = (int) $style_id;
}
$db->sql_freeresult($result);
if (!empty($deactivated_style_ids))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = ' . (int) $config['default_style'] .'
WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids);
_sql($sql, $errored, $error_ary);
}
// Delete orphan private messages
$batch_size = 500;
$sql_array = array(
'SELECT' => 'p.msg_id',
'FROM' => array(
PRIVMSGS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(PRIVMSGS_TO_TABLE => 't'),
'ON' => 'p.msg_id = t.msg_id',
),
),
'WHERE' => 't.user_id IS NULL',
);
$sql = $db->sql_build_query('SELECT', $sql_array);
do
{
$result = $db->sql_query_limit($sql, $batch_size);
$delete_pms = array();
while ($row = $db->sql_fetchrow($result))
{
$delete_pms[] = (int) $row['msg_id'];
}
$db->sql_freeresult($result);
if (!empty($delete_pms))
{
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $db->sql_in_set('msg_id', $delete_pms);
_sql($sql, $errored, $error_ary);
}
}
while (sizeof($delete_pms) == $batch_size);
$no_updates = false;
break;
// Changes from 3.1.0-dev to 3.1.0-A1
case '3.1.0-dev':
@@ -2282,13 +2340,6 @@ function change_database_data(&$no_updates, $version)
'auth' => 'acl_a_styles',
'cat' => 'ACP_STYLE_MANAGEMENT',
),
'edit' => array(
'base' => 'acp_styles',
'class' => 'acp',
'title' => 'ACP_STYLES_EDIT',
'auth' => 'acl_a_styles',
'cat' => 'ACP_STYLE_MANAGEMENT',
),
'cache' => array(
'base' => 'acp_styles',
'class' => 'acp',
@@ -2296,12 +2347,19 @@ function change_database_data(&$no_updates, $version)
'auth' => 'acl_a_styles',
'cat' => 'ACP_STYLE_MANAGEMENT',
),
'autologin_keys' => array(
'base' => 'ucp_profile',
'class' => 'ucp',
'title' => 'UCP_PROFILE_AUTOLOGIN_KEYS',
'auth' => '',
'cat' => 'UCP_PROFILE',
),
);
_add_modules($modules_to_install);
$sql = 'DELETE FROM ' . MODULES_TABLE . "
WHERE (module_basename = 'styles' OR module_basename = 'acp_styles') AND (module_mode = 'imageset' OR module_mode = 'theme' OR module_mode = 'template')";
WHERE (module_basename = 'styles' OR module_basename = 'acp_styles') AND (module_mode = 'imageset' OR module_mode = 'theme' OR module_mode = 'template')";
_sql($sql, $errored, $error_ary);
// Localise Global Announcements
@@ -2392,11 +2450,144 @@ function change_database_data(&$no_updates, $version)
set_config('teampage_memberships', '1');
}
// Clear styles table and add prosilver entry
_sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
// Check if styles table was already updated
if ($db_tools->sql_table_exists(STYLES_THEME_TABLE))
{
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
$sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '&copy; phpBB Group', 1, 'prosilver', 'kNg=', 0, '')";
_sql($sql, $errored, $error_ary);
$iterator = new DirectoryIterator($phpbb_root_path . 'styles');
$skip_dirs = array('.', '..', 'prosilver');
foreach ($iterator as $fileinfo)
{
if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/style.cfg'))
{
$style_cfg = parse_cfg_file($fileinfo->getPathname() . '/style.cfg');
if (isset($style_cfg['phpbb_version']) && version_compare($style_cfg['phpbb_version'], '3.1.0-dev', '>='))
{
// 3.1 style
$available_styles[] = $fileinfo->getFilename();
}
}
}
// Get all installed styles
if ($db_tools->sql_table_exists(STYLES_IMAGESET_TABLE))
{
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id, i.imageset_path
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
WHERE t.template_id = s.template_id
AND c.theme_id = s.theme_id
AND i.imageset_id = s.imageset_id";
}
else
{
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
WHERE t.template_id = s.template_id
AND c.theme_id = s.theme_id";
}
$result = $db->sql_query($sql);
$styles = array();
while ($row = $db->sql_fetchrow($result))
{
$styles[] = $row;
}
$db->sql_freeresult($result);
// Decide which styles to keep, all others will be deleted
$valid_styles = array();
foreach ($styles as $style_row)
{
if (
// Delete styles with parent style (not supported yet)
$style_row['template_inherits_id'] == 0 &&
// Check if components match
$style_row['template_path'] == $style_row['theme_path'] && (!isset($style_row['imageset_path']) || $style_row['template_path'] == $style_row['imageset_path']) &&
// Check if components are valid
in_array($style_row['template_path'], $available_styles)
)
{
// Valid style. Keep it
$sql_ary = array(
'style_path' => $style_row['template_path'],
'bbcode_bitfield' => $style_row['bbcode_bitfield'],
'style_parent_id' => 0,
'style_parent_tree' => '',
);
_sql('UPDATE ' . STYLES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE style_id = ' . $style_row['style_id'], $errored, $error_ary);
$valid_styles[] = (int) $style_row['style_id'];
}
}
// Remove old styles tables
$changes = array(
'drop_columns' => array(
STYLES_TABLE => array(
'imageset_id',
'template_id',
'theme_id',
),
),
'drop_tables' => array(
STYLES_IMAGESET_TABLE,
STYLES_IMAGESET_DATA_TABLE,
STYLES_TEMPLATE_TABLE,
STYLES_TEMPLATE_DATA_TABLE,
STYLES_THEME_TABLE,
)
);
$statements = $db_tools->perform_schema_changes($changes);
foreach ($statements as $sql)
{
_sql($sql, $errored, $error_ary);
}
// Remove old entries from styles table
if (!sizeof($valid_styles))
{
// No valid styles: remove everything and add prosilver
_sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
$sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '&copy; phpBB Group', 1, 'prosilver', 'kNg=', 0, '')";
_sql($sql, $errored, $error_ary);
$sql = 'SELECT style_id
FROM ' . $table . "
WHERE style_name = 'prosilver'";
$result = _sql($sql, $errored, $error_ary);
$default_style = $db->sql_fetchfield($result);
$db->sql_freeresult($result);
set_config('default_style', $default_style);
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
_sql($sql, $errored, $error_ary);
}
else
{
// There are valid styles in styles table. Remove styles that are outdated
_sql('DELETE FROM ' . STYLES_TABLE . ' WHERE ' . $db->sql_in_set('style_id', $valid_styles, true), $errored, $error_ary);
// Change default style
if (!in_array($config['default_style'], $valid_styles))
{
set_config('default_style', $valid_styles[0]);
}
// Reset styles for users
_sql('UPDATE ' . USERS_TABLE . ' SET user_style = 0 WHERE ' . $db->sql_in_set('user_style', $valid_styles, true), $errored, $error_ary);
}
}
// Create config value for displaying last subject on forum list
if (!isset($config['display_last_subject']))
{
$config->set('display_last_subject', '1');
}
// Update avatars to modular types
$avatar_type_map = array(
@@ -2420,6 +2611,11 @@ function change_database_data(&$no_updates, $version)
$no_updates = false;
if (!isset($config['assets_version']))
{
$config->set('assets_version', '1');
}
break;
}
}

View File

@@ -202,10 +202,10 @@ $config = new phpbb_config(array(
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
$phpbb_style_path_provider = new phpbb_style_path_provider();
$template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider);
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
$style->set_ext_dir_prefix('adm/');
$style->set_custom_style('admin', '../adm/style', '');
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator);
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
$phpbb_style->set_ext_dir_prefix('adm/');
$phpbb_style->set_custom_style('admin', '../adm/style', '');
$template->assign_var('T_ASSETS_PATH', '../assets');
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');

View File

@@ -52,11 +52,13 @@ class install_install extends module
function main($mode, $sub)
{
global $lang, $template, $language, $phpbb_root_path;
global $lang, $template, $language, $phpbb_root_path, $cache;
switch ($sub)
{
case 'intro':
$cache->purge();
$this->page_title = $lang['SUB_INTRO'];
$template->assign_vars(array(
@@ -104,6 +106,7 @@ class install_install extends module
$this->add_language($mode, $sub);
$this->add_bots($mode, $sub);
$this->email_admin($mode, $sub);
$this->disable_avatars_if_unwritable();
// Remove the lock file
@unlink($phpbb_root_path . 'cache/install_lock');
@@ -128,7 +131,7 @@ class install_install extends module
'BODY' => $lang['REQUIREMENTS_EXPLAIN'],
));
$passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false,);
$passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false, 'json' => false,);
// Test for basic PHP settings
$template->assign_block_vars('checks', array(
@@ -165,25 +168,28 @@ class install_install extends module
'S_LEGEND' => false,
));
// Check for register_globals being enabled
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
// Don't check for register_globals on 5.4+
if (version_compare($php_version, '5.4.0-dev') < 0)
{
$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
// Check for register_globals being enabled
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
}
else
{
$result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
}
$template->assign_block_vars('checks', array(
'TITLE' => $lang['PHP_REGISTER_GLOBALS'],
'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'],
'RESULT' => $result,
'S_EXPLAIN' => true,
'S_LEGEND' => false,
));
}
else
{
$result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
}
$template->assign_block_vars('checks', array(
'TITLE' => $lang['PHP_REGISTER_GLOBALS'],
'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'],
'RESULT' => $result,
'S_EXPLAIN' => true,
'S_LEGEND' => false,
));
// Check for url_fopen
if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on')
@@ -244,6 +250,26 @@ class install_install extends module
'S_EXPLAIN' => true,
'S_LEGEND' => false,
));
// Check for php json support
if (@extension_loaded('json'))
{
$passed['json'] = true;
$result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
}
else
{
$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
}
$template->assign_block_vars('checks', array(
'TITLE' => $lang['PHP_JSON_SUPPORT'],
'TITLE_EXPLAIN' => $lang['PHP_JSON_SUPPORT_EXPLAIN'],
'RESULT' => $result,
'S_EXPLAIN' => true,
'S_LEGEND' => false,
));
/**
* Better not enabling and adding to the loaded extensions due to the specific requirements needed
@@ -1851,6 +1877,21 @@ class install_install extends module
));
}
/**
* Check if the avatar directory is writable and disable avatars
* if it isn't writable.
*/
function disable_avatars_if_unwritable()
{
global $phpbb_root_path;
if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/'))
{
set_config('allow_avatar', 0);
set_config('allow_avatar_upload', 0);
}
}
/**
* Generate a list of available mail server authentication methods
*/

View File

@@ -131,7 +131,7 @@ class install_update extends module
}
// Set custom template again. ;)
$style->set_custom_style('admin', '../adm/style', '');
$phpbb_style->set_custom_style('admin', '../adm/style', '');
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],

View File

@@ -8,10 +8,10 @@
INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_attachments', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1');
@@ -88,6 +88,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('dbms_version', '')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0');
@@ -99,7 +100,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_http_auth', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_post', '15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_topic', '10');