1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

Merge branch 'develop-olympus' into develop

* develop-olympus:
  [ticket/7717] Localise default extension groups for attachments
  [ticket/9598] checkdnsrr() is now available on Windows with PHP 5.3 or later. Change if block order to always call checkdnsrr() if the function is available.
  [ticket/9173] No longer limit scope of numbers we store in the config table on
  [ticket/9536] Small improvement for query against user/session tables when managing users from the ACP.
  [ticket/9526] If an admin changes a user's 'user_allow_viewonline' flag to 'hide me' the admin usually wants that user to be hidden immediately. We therefore have to update his session if one exists.
  [ticket/9518] Correctly create new connection on PostgreSQL when new connection is forced.
  [ticket/9514] Correctly delete big datasets when deleting a forum including topics/posts on non-MySQL databases.
  [ticket/6726] Added localhost/127.0.0.1 note to database server hostname explanation in install language.
  [feature/remote_upload-filesize] Also check HTTP content-length before actually starting the file transfer.
  [feature/remote_upload-filesize] When transferring files from a remote webserver, abort the transfer as soon as the allowed filesize has been exceeded.
  [ticket/9176] Take current board timezone settings into account when setting board date format.
This commit is contained in:
Nils Adermann 2010-05-14 02:51:56 +02:00
commit cf89952106
10 changed files with 134 additions and 37 deletions

View File

@ -90,6 +90,7 @@ class acp_attachments
$s_assigned_groups = array();
while ($row = $db->sql_fetchrow($result))
{
$row['group_name'] = (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name'];
$s_assigned_groups[$row['cat_id']][] = $row['group_name'];
}
$db->sql_freeresult($result);
@ -494,6 +495,10 @@ class acp_attachments
$sql = 'SELECT group_id
FROM ' . EXTENSION_GROUPS_TABLE . "
WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'";
if ($group_id)
{
$sql .= ' AND group_id <> ' . $group_id;
}
$result = $db->sql_query($sql);
if ($db->sql_fetchrow($result))
@ -551,6 +556,7 @@ class acp_attachments
$group_id = $db->sql_nextid();
}
$group_name = (isset($user->lang['EXT_GROUP_' . $group_name])) ? $user->lang['EXT_GROUP_' . $group_name] : $group_name;
add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name);
}
@ -858,7 +864,7 @@ class acp_attachments
'U_EDIT' => $this->u_action . "&amp;action=edit&amp;g={$row['group_id']}",
'U_DELETE' => $this->u_action . "&amp;action=delete&amp;g={$row['group_id']}",
'GROUP_NAME' => $row['group_name'],
'GROUP_NAME' => (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name'],
'CATEGORY' => $cat_lang[$row['cat_id']],
)
);
@ -1118,6 +1124,7 @@ class acp_attachments
$group_name = array();
while ($row = $db->sql_fetchrow($result))
{
$row['group_name'] = (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name'];
$group_name[] = $row;
}
$db->sql_freeresult($result);

View File

@ -888,8 +888,8 @@ class acp_board
$old_tz = $user->timezone;
$old_dst = $user->dst;
$user->timezone = $config['board_timezone'];
$user->dst = $config['board_dst'];
$user->timezone = $config['board_timezone'] * 3600;
$user->dst = $config['board_dst'] * 3600;
$dateformat_options = '';

View File

@ -1705,6 +1705,9 @@ class acp_forums
)
);
// Amount of rows we select and delete in one iteration.
$batch_size = 500;
foreach ($tables_ary as $field => $tables)
{
$start = 0;
@ -1714,7 +1717,7 @@ class acp_forums
$sql = "SELECT $field
FROM " . POSTS_TABLE . '
WHERE forum_id = ' . $forum_id;
$result = $db->sql_query_limit($sql, 500, $start);
$result = $db->sql_query_limit($sql, $batch_size, $start);
$ids = array();
while ($row = $db->sql_fetchrow($result))
@ -1733,7 +1736,7 @@ class acp_forums
}
}
}
while ($row);
while (sizeof($ids) == $batch_size);
}
unset($ids);

View File

@ -105,7 +105,7 @@ class acp_users
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
WHERE u.user_id = ' . $user_id . '
ORDER BY s.session_time DESC';
$result = $db->sql_query($sql);
$result = $db->sql_query_limit($sql, 1);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@ -1550,6 +1550,31 @@ class acp_users
WHERE user_id = $user_id";
$db->sql_query($sql);
// Check if user has an active session
if ($user_row['session_id'])
{
// We'll update the session if user_allow_viewonline has changed and the user is a bot
// Or if it's a regular user and the admin set it to hide the session
if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
{
// We also need to check if the user has the permission to cloak.
$user_auth = new auth();
$user_auth->acl($user_row);
$session_sql_ary = array(
'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true,
);
$sql = 'UPDATE ' . SESSIONS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . "
WHERE session_user_id = $user_id";
$db->sql_query($sql);
unset($user_auth);
}
}
trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
}
@ -2084,7 +2109,7 @@ class acp_users
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
WHERE u.user_id = ' . $user_id . '
ORDER BY s.session_time DESC';
$result = $db->sql_query($sql);
$result = $db->sql_query_limit($sql, 1);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}

View File

@ -76,7 +76,14 @@ class dbal_postgres extends dbal
$this->persistency = $persistency;
$this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link);
if ($this->persistency)
{
$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
else
{
$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
if ($this->db_connect_id)
{

View File

@ -175,11 +175,8 @@ function set_config_count($config_name, $increment, $is_dynamic = false)
switch ($db->sql_layer)
{
case 'firebird':
$sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))';
break;
case 'postgres':
$sql_update = 'int4(config_value) + ' . (int) $increment;
$sql_update = 'CAST(CAST(config_value as DECIMAL(255, 0)) + ' . (int) $increment . ' as VARCHAR(255))';
break;
// MySQL, SQlite, mssql, mssql_odbc, oracle
@ -3409,13 +3406,14 @@ function phpbb_checkdnsrr($host, $type = '')
{
$type = (!$type) ? 'MX' : $type;
if (DIRECTORY_SEPARATOR == '\\')
// Call checkdnsrr() if available. This is also the case on Windows with PHP 5.3 or later.
if (function_exists('checkdnsrr'))
{
// The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain)
return checkdnsrr($host . '.', $type);
}
else if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec'))
{
if (!function_exists('exec'))
{
return NULL;
}
// @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output);
@exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host) . '.', $output);
@ -3441,11 +3439,6 @@ function phpbb_checkdnsrr($host, $type = '')
return false;
}
else if (function_exists('checkdnsrr'))
{
// The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain)
return (checkdnsrr($host . '.', $type)) ? true : false;
}
return NULL;
}

View File

@ -775,7 +775,18 @@ class fileupload
{
if ($get_info)
{
$data .= @fread($fsock, 1024);
$block = @fread($fsock, 1024);
$filesize += strlen($block);
if ($this->max_filesize && $filesize > $this->max_filesize)
{
$max_filesize = get_formatted_filesize($this->max_filesize, false);
$file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
return $file;
}
$data .= $block;
}
else
{
@ -791,6 +802,18 @@ class fileupload
{
$upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line)));
}
else if ($this->max_filesize && stripos($line, 'content-length: ') !== false)
{
$length = (int) str_replace('content-length: ', '', strtolower($line));
if ($length && $length > $this->max_filesize)
{
$max_filesize = get_formatted_filesize($this->max_filesize, false);
$file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
return $file;
}
}
else if (stripos($line, '404 not found') !== false)
{
$file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']);

View File

@ -913,6 +913,8 @@ function database_update_info()
'3.0.7-RC2' => array(),
// No changes from 3.0.7 to 3.0.7-PL1
'3.0.7' => array(),
// No changes from 3.0.7-PL1 to 3.0.8-RC1
'3.0.7-PL1' => array(),
);
}
@ -923,7 +925,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, $user;
switch ($version)
{
@ -1648,6 +1650,43 @@ function change_database_data(&$no_updates, $version)
// No changes from 3.0.7 to 3.0.7-PL1
case '3.0.7':
break;
// Changes from 3.0.7-PL1 to 3.0.8-RC1
case '3.0.7-PL1':
$user->add_lang('acp/attachments');
$extension_groups = array(
$user->lang['EXT_GROUP_ARCHIVES'] => 'ARCHIVES',
$user->lang['EXT_GROUP_DOCUMENTS'] => 'DOCUMENTS',
$user->lang['EXT_GROUP_DOWNLOADABLE_FILES'] => 'DOWNLOADABLE_FILES',
$user->lang['EXT_GROUP_FLASH_FILES'] => 'FLASH_FILES',
$user->lang['EXT_GROUP_IMAGES'] => 'IMAGES',
$user->lang['EXT_GROUP_PLAIN_TEXT'] => 'PLAIN_TEXT',
$user->lang['EXT_GROUP_QUICKTIME_MEDIA'] => 'QUICKTIME_MEDIA',
$user->lang['EXT_GROUP_REAL_MEDIA'] => 'REAL_MEDIA',
$user->lang['EXT_GROUP_WINDOWS_MEDIA'] => 'WINDOWS_MEDIA',
);
$sql = 'SELECT group_id, group_name
FROM ' . EXTENSION_GROUPS_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (isset($extension_groups[$row['group_name']]))
{
$sql_ary = array(
'group_name' => $extension_groups[$row['group_name']],
);
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE group_id = ' . (int) $row['group_id'];
_sql($sql, $errored, $error_ary);
}
}
$db->sql_freeresult($result);
$no_updates = false;
break;
}
}

View File

@ -85,7 +85,7 @@ $lang = array_merge($lang, array(
'DISPLAY_INLINED_EXPLAIN' => 'If set to No image attachments will show as a link.',
'DISPLAY_ORDER' => 'Attachment display order',
'DISPLAY_ORDER_EXPLAIN' => 'Display attachments ordered by time.',
'EDIT_EXTENSION_GROUP' => 'Edit extension group',
'EXCLUDE_ENTERED_IP' => 'Enable this to exclude the entered IP/hostname.',
'EXCLUDE_FROM_ALLOWED_IP' => 'Exclude IP from allowed IPs/hostnames',
@ -97,6 +97,16 @@ $lang = array_merge($lang, array(
'EXTENSION_GROUP_DELETED' => 'Extension group successfully deleted.',
'EXTENSION_GROUP_EXIST' => 'The extension group %s already exists.',
'EXT_GROUP_ARCHIVES' => 'Archives',
'EXT_GROUP_DOCUMENTS' => 'Documents',
'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files',
'EXT_GROUP_FLASH_FILES' => 'Flash Files',
'EXT_GROUP_IMAGES' => 'Images',
'EXT_GROUP_PLAIN_TEXT' => 'Plain Text',
'EXT_GROUP_QUICKTIME_MEDIA' => 'Quicktime Media',
'EXT_GROUP_REAL_MEDIA' => 'Real Media',
'EXT_GROUP_WINDOWS_MEDIA' => 'Windows Media',
'GO_TO_EXTENSIONS' => 'Go to extension management screen',
'GROUP_NAME' => 'Group name',

View File

@ -128,7 +128,7 @@ $lang = array_merge($lang, array(
'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing <var>query_first</var>, %s (“%s”).',
'DB_ERR_SELECT' => 'Error while running <code>SELECT</code> query.',
'DB_HOST' => 'Database server hostname or DSN',
'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs.',
'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP.',
'DB_NAME' => 'Database name',
'DB_PASSWORD' => 'Database password',
'DB_PORT' => 'Database server port',
@ -586,16 +586,6 @@ $lang = array_merge($lang, array(
'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!',
'EXT_GROUP_ARCHIVES' => 'Archives',
'EXT_GROUP_DOCUMENTS' => 'Documents',
'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files',
'EXT_GROUP_FLASH_FILES' => 'Flash Files',
'EXT_GROUP_IMAGES' => 'Images',
'EXT_GROUP_PLAIN_TEXT' => 'Plain Text',
'EXT_GROUP_QUICKTIME_MEDIA' => 'Quicktime Media',
'EXT_GROUP_REAL_MEDIA' => 'Real Media',
'EXT_GROUP_WINDOWS_MEDIA' => 'Windows Media',
'FORUMS_FIRST_CATEGORY' => 'Your first category',
'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.',
'FORUMS_TEST_FORUM_TITLE' => 'Your first forum',