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

Merge branch 'develop' into feature/extension-manager

* develop: (93 commits)
  [ticket/10157] Add notification to update cpfs when installing a language.
  [ticket/10185] Always set board startdate on conversion
  [ticket/10419] Reword the language strings
  [ticket/9361] View correct error messages when editing account information
  [ticket/10457] Undefined variable $request, when print-viewing PMs
  [ticket/10452] Fix xHTML errors when print-viewing PMs
  [ticket/9066] Move regex into get_preg_expression function and add tests
  [ticket/10254] Add "phpBB Group" to "Modified by" in prosilver stylesheet.css
  [ticket/10254] Removing the subsilver2 NOTE, incompatible with phpBB.com.
  [ticket/10254] Removing the NOTE as it is incompatible with phpBB.com.
  [ticket/10254] Remove subsilver2 as default style on theme.
  [ticket/10254] Remove style names from themes and fix some informations on it.
  [ticket/7138] Allow simple header and footer for trigger_error() messages
  [ticket/9066] Disallow some database prefix to prevent same errors and problems
  [ticket/10365] Fix up S_POST_UNAPPROVED check, make it easier to read
  [ticket/10437] Do not display announcements that are waiting for approval
  [ticket/10087] Organize bans in acp_baninto optgroups
  [ticket/8616] Include old U_INBOX var for BC
  [ticket/10435] Remove global announcement from forums total topic count
  [ticket/10435] Readd local announcements to total topic count in viewforum
  ...

Conflicts:
	phpBB/install/database_update.php
This commit is contained in:
Nils Adermann
2011-11-18 19:14:06 +01:00
98 changed files with 1182 additions and 711 deletions

View File

@ -175,12 +175,21 @@ class acp_ban
}
$result = $db->sql_query($sql);
$banned_options = '';
$banned_options = $excluded_options = array();
$ban_length = $ban_reasons = $ban_give_reasons = array();
while ($row = $db->sql_fetchrow($result))
{
$banned_options .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>';
$option = '<option value="' . $row['ban_id'] . '">' . $row[$field] . '</option>';
if ($row['ban_exclude'])
{
$excluded_options[] = $option;
}
else
{
$banned_options[] = $option;
}
$time_length = ($row['ban_end']) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0;
@ -241,10 +250,25 @@ class acp_ban
}
}
$options = '';
if ($excluded_options)
{
$options .= '<optgroup label="' . $user->lang['OPTIONS_EXCLUDED'] . '">';
$options .= implode('', $excluded_options);
$options .= '</optgroup>';
}
if ($banned_options)
{
$options .= '<optgroup label="' . $user->lang['OPTIONS_BANNED'] . '">';
$options .= implode('', $banned_options);
$options .= '</optgroup>';
}
$template->assign_vars(array(
'S_BAN_END_OPTIONS' => $ban_end_options,
'S_BANNED_OPTIONS' => ($banned_options) ? true : false,
'BANNED_OPTIONS' => $banned_options)
);
'S_BANNED_OPTIONS' => ($banned_options || $excluded_options) ? true : false,
'BANNED_OPTIONS' => $options,
));
}
}

View File

@ -99,6 +99,7 @@ class acp_board
'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_jquery_cdn' => array('lang' => 'LOAD_JQUERY_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'ACP_SUBMIT_CHANGES',
)
@ -189,7 +190,7 @@ class acp_board
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true),
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false),
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1', 'type' => 'text:4:6', 'explain' => true),
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),

View File

@ -136,8 +136,9 @@ class acp_email
$i = $j = 0;
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
$max_chunk_size = 50;
// Send with BCC
// Maximum number of bcc recipients
$max_chunk_size = (int) $config['email_max_chunk_size'];
$email_list = array();
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];

View File

@ -212,15 +212,11 @@ class acp_forums
$message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
// Redirect to permissions
if ($auth->acl_get('a_fauth') && !$copied_permissions)
{
$message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
}
// redirect directly to permission settings screen if authed
if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth'))
{
$message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url));
}
@ -875,7 +871,7 @@ class acp_forums
$errors = array();
if (!$forum_data['forum_name'])
if ($forum_data['forum_name'] == '')
{
$errors[] = $user->lang['FORUM_NAME_EMPTY'];
}

View File

@ -415,6 +415,9 @@ class acp_groups
// Only set the rank, colour, etc. if it's changed or if we're adding a new
// group. This prevents existing group members being updated if no changes
// were made.
// However there are some attributes that need to be set everytime,
// otherwise the group gets removed from the feature.
$set_attributes = array('legend', 'teampage');
$group_attributes = array();
$test_variables = array(
@ -435,7 +438,7 @@ class acp_groups
foreach ($test_variables as $test => $type)
{
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || in_array($test, $set_attributes)))
{
settype($submit_ary[$test], $type);
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
@ -832,7 +835,7 @@ class acp_groups
case 'set_config_teampage':
set_config('teampage_forums', request_var('teampage_forums', 0));
set_config('teampage_multiple', request_var('teampage_multiple', 0));
set_config('teampage_memberships', request_var('teampage_memberships', 0));
break;
case 'add':
@ -913,11 +916,11 @@ class acp_groups
'U_ACTION_LEGEND' => $this->u_action . '&amp;field=legend',
'U_ACTION_TEAMPAGE' => $this->u_action . '&amp;field=teampage',
'S_GROUP_SELECT_LEGEND' => $s_group_select_legend,
'S_GROUP_SELECT_TEAMPAGE' => $s_group_select_teampage,
'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false,
'DISPLAY_MULTIPLE' => ($config['teampage_multiple']) ? true : false,
'LEGEND_SORT_GROUPNAME' => ($config['legend_sort_groupname']) ? true : false,
'S_GROUP_SELECT_LEGEND' => $s_group_select_legend,
'S_GROUP_SELECT_TEAMPAGE' => $s_group_select_teampage,
'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false,
'DISPLAY_MEMBERSHIPS' => $config['teampage_memberships'],
'LEGEND_SORT_GROUPNAME' => ($config['legend_sort_groupname']) ? true : false,
));
}
}

View File

@ -869,6 +869,9 @@ class acp_language
$default_lang_id = (int) $db->sql_fetchfield('lang_id');
$db->sql_freeresult($result);
// We want to notify the admin that custom profile fields need to be updated for the new language.
$notify_cpf_update = false;
// From the mysql documentation:
// Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
// Due to this we stay on the safe side if we do the insertion "the manual way"
@ -882,6 +885,7 @@ class acp_language
{
$row['lang_id'] = $lang_id;
$db->sql_query('INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row));
$notify_cpf_update = true;
}
$db->sql_freeresult($result);
@ -894,12 +898,15 @@ class acp_language
{
$row['lang_id'] = $lang_id;
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row));
$notify_cpf_update = true;
}
$db->sql_freeresult($result);
add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']);
trigger_error(sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']) . adm_back_link($this->u_action));
$message = sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']);
$message .= ($notify_cpf_update) ? '<br /><br />' . $user->lang['LANGUAGE_PACK_CPF_UPDATE'] : '';
trigger_error($message . adm_back_link($this->u_action));
break;

View File

@ -600,6 +600,17 @@ class acp_main
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
}
if (extension_loaded('mbstring'))
{
$template->assign_vars(array(
'S_MBSTRING_LOADED' => true,
'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)),
'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0),
'S_MBSTRING_HTTP_INPUT_FAIL' => (@ini_get('mbstring.http_input') != 'pass'),
'S_MBSTRING_HTTP_OUTPUT_FAIL' => (@ini_get('mbstring.http_output') != 'pass'),
));
}
// Fill dbms version if not yet filled
if (empty($config['dbms_version']))
{

View File

@ -199,7 +199,7 @@ class acp_ranks
'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '',
'S_FILENAME_LIST' => $filename_list,
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif',
'S_SPECIAL_RANK' => (!isset($ranks['rank_special']) || $ranks['rank_special']) ? true : false,
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
);

View File

@ -37,7 +37,7 @@ class acp_update
$errstr = '';
$errno = 0;
$info = obtain_latest_version_info(request_var('versioncheck_force', false), true);
$info = obtain_latest_version_info(request_var('versioncheck_force', false));
if ($info === false)
{

View File

@ -818,7 +818,7 @@ class acp_users
// Which updates do we need to do?
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
$update_password = ($data['new_password'] && !phpbb_check_hash($user_row['user_password'], $data['new_password'])) ? true : false;
$update_password = ($data['new_password'] && !phpbb_check_hash($data['new_password'], $user_row['user_password'])) ? true : false;
$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;
if (!sizeof($error))

View File

@ -108,6 +108,15 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for
if (!$row)
{
if ($config['ip_login_limit_max'] && $attempts >= $config['ip_login_limit_max'])
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,
'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
'user_row' => array('user_id' => ANONYMOUS),
);
}
return array(
'status' => LOGIN_ERROR_USERNAME,
'error_msg' => 'LOGIN_ERROR_USERNAME',

View File

@ -347,6 +347,66 @@ class phpbb_db_tools
}
}
/**
* Gets a list of tables in the database.
*
* @return array Array of table names (all lower case)
*/
function sql_list_tables()
{
switch ($this->db->sql_layer)
{
case 'mysql':
case 'mysql4':
case 'mysqli':
$sql = 'SHOW TABLES';
break;
case 'sqlite':
$sql = 'SELECT name
FROM sqlite_master
WHERE type = "table"';
break;
case 'mssql':
case 'mssql_odbc':
case 'mssqlnative':
$sql = "SELECT name
FROM sysobjects
WHERE type='U'";
break;
case 'postgres':
$sql = 'SELECT relname
FROM pg_stat_user_tables';
break;
case 'firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
case 'oracle':
$sql = 'SELECT table_name
FROM USER_TABLES';
break;
}
$result = $this->db->sql_query($sql);
$tables = array();
while ($row = $this->db->sql_fetchrow($result))
{
$name = current($row);
$tables[$name] = $name;
}
$this->db->sql_freeresult($result);
return $tables;
}
/**
* Check if table exists
*
@ -1011,34 +1071,21 @@ class phpbb_db_tools
}
/**
* Check if a specified column exist
* Gets a list of columns of a table.
*
* @param string $table Table to check the column at
* @param string $column_name The column to check
* @param string $table Table name
*
* @return bool True if column exists, else false
* @return array Array of column names (all lower case)
*/
function sql_column_exists($table, $column_name)
function sql_list_columns($table)
{
$columns = array();
switch ($this->sql_layer)
{
case 'mysql_40':
case 'mysql_41':
$sql = "SHOW COLUMNS FROM $table";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// lower case just in case
if (strtolower($row['Field']) == $column_name)
{
$this->db->sql_freeresult($result);
return true;
}
}
$this->db->sql_freeresult($result);
return false;
break;
// PostgreSQL has a way of doing this in a much simpler way but would
@ -1049,19 +1096,6 @@ class phpbb_db_tools
WHERE c.relname = '{$table}'
AND a.attnum > 0
AND a.attrelid = c.oid";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// lower case just in case
if (strtolower($row['attname']) == $column_name)
{
$this->db->sql_freeresult($result);
return true;
}
}
$this->db->sql_freeresult($result);
return false;
break;
// same deal with PostgreSQL, we must perform more complex operations than
@ -1072,62 +1106,26 @@ class phpbb_db_tools
FROM syscolumns c
LEFT JOIN sysobjects o ON c.id = o.id
WHERE o.name = '{$table}'";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// lower case just in case
if (strtolower($row['name']) == $column_name)
{
$this->db->sql_freeresult($result);
return true;
}
}
$this->db->sql_freeresult($result);
return false;
break;
case 'oracle':
$sql = "SELECT column_name
FROM user_tab_columns
WHERE LOWER(table_name) = '" . strtolower($table) . "'";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// lower case just in case
if (strtolower($row['column_name']) == $column_name)
{
$this->db->sql_freeresult($result);
return true;
}
}
$this->db->sql_freeresult($result);
return false;
break;
case 'firebird':
$sql = "SELECT RDB\$FIELD_NAME as FNAME
FROM RDB\$RELATION_FIELDS
WHERE RDB\$RELATION_NAME = '" . strtoupper($table) . "'";
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// lower case just in case
if (strtolower($row['fname']) == $column_name)
{
$this->db->sql_freeresult($result);
return true;
}
}
$this->db->sql_freeresult($result);
return false;
break;
// ugh, SQLite
case 'sqlite':
$sql = "SELECT sql
FROM sqlite_master
WHERE type = 'table'
AND name = '{$table}'";
$result = $this->db->sql_query($sql);
if (!$result)
@ -1151,14 +1149,39 @@ class phpbb_db_tools
continue;
}
if (strtolower($entities[0]) == $column_name)
{
return true;
}
$column = strtolower($entities[0]);
$columns[$column] = $column;
}
return false;
return $columns;
break;
}
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$column = strtolower(current($row));
$columns[$column] = $column;
}
$this->db->sql_freeresult($result);
return $columns;
}
/**
* Check whether a specified column exist in a table
*
* @param string $table Table to check
* @param string $column_name Column to check
*
* @return bool True if column exists, false otherwise
*/
function sql_column_exists($table, $column_name)
{
$columns = $this->sql_list_columns($table);
return isset($columns[$column_name]);
}
/**
@ -2092,7 +2115,7 @@ class phpbb_db_tools
case 'mysql_40':
case 'mysql_41':
$statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX (' . implode(', ', $column) . ')';
break;
case 'mssql':
@ -2145,7 +2168,7 @@ class phpbb_db_tools
}
// no break
case 'mysql_41':
$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')';
break;
case 'mssql':

View File

@ -249,7 +249,13 @@ class dbal_mysqli extends dbal
return $cache->sql_fetchrow($query_id);
}
return ($query_id !== false) ? @mysqli_fetch_assoc($query_id) : false;
if ($query_id !== false)
{
$result = @mysqli_fetch_assoc($query_id);
return $result !== null ? $result : false;
}
return false;
}
/**

View File

@ -1654,7 +1654,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
*/
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
{
global $db, $tracking_topics, $user, $config, $request;
global $db, $tracking_topics, $user, $config, $auth, $request;
// Determine the users last forum mark time if not given.
if ($mark_time_forum === false)
@ -1677,6 +1677,10 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
}
}
// Handle update of unapproved topics info.
// Only update for moderators having m_approve permission for the forum.
$sql_update_unapproved = ($auth->acl_get('m_approve', $forum_id)) ? '': 'AND t.topic_approved = 1';
// Check the forum for any left unread topics.
// If there are none, we mark the forum as read.
if ($config['load_db_lastread'] && $user->data['is_registered'])
@ -1692,7 +1696,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_last_post_time > ' . $mark_time_forum . '
AND t.topic_moved_id = 0
AND t.topic_moved_id = 0 ' .
$sql_update_unapproved . '
AND (tt.topic_id IS NULL OR tt.mark_time < t.topic_last_post_time)
GROUP BY t.forum_id';
$result = $db->sql_query_limit($sql, 1);
@ -1716,7 +1721,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . $forum_id . '
AND topic_last_post_time > ' . $mark_time_forum . '
AND topic_moved_id = 0';
AND topic_moved_id = 0 ' .
$sql_update_unapproved;
$result = $db->sql_query($sql);
$check_forum = $tracking_topics['tf'][$forum_id];
@ -1901,7 +1907,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$start_cnt = min(max(1, $on_page - 4), $total_pages - 5);
$end_cnt = max(min($total_pages, $on_page + 4), 6);
$page_string .= ($start_cnt > 1) ? ' ... ' : $separator;
$page_string .= ($start_cnt > 1) ? '<span class="page-dots"> ... </span>' : $separator;
for ($i = $start_cnt + 1; $i < $end_cnt; $i++)
{
@ -1912,7 +1918,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
}
}
$page_string .= ($end_cnt < $total_pages) ? ' ... ' : $separator;
$page_string .= ($end_cnt < $total_pages) ? '<span class="page-dots"> ... </span>' : $separator;
}
else
{
@ -3256,6 +3262,10 @@ function get_preg_expression($mode)
$inline = ($mode == 'relative_url') ? ')' : '';
return "(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?";
break;
case 'table_prefix':
return '#^[a-zA-Z][a-zA-Z0-9_]*$#';
break;
}
return '';
@ -4570,6 +4580,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css',
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css',
'T_STYLESHEET_NAME' => $user->theme['theme_name'],
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js",
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
'T_THEME_NAME' => $user->theme['theme_path'],
'T_THEME_LANG_NAME' => $user->data['user_lang'],
@ -4627,15 +4639,13 @@ function page_footer($run_cron = true)
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))
{
if (function_exists('memory_get_usage'))
if (function_exists('memory_get_peak_usage'))
{
if ($memory_usage = memory_get_usage())
if ($memory_usage = memory_get_peak_usage())
{
global $base_memory_usage;
$memory_usage -= $base_memory_usage;
$memory_usage = get_formatted_filesize($memory_usage);
$debug_output .= ' | Memory Usage: ' . $memory_usage;
$debug_output .= ' | Peak Memory Usage: ' . $memory_usage;
}
}

View File

@ -106,15 +106,13 @@ function adm_page_footer($copyright_html = true)
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))
{
if (function_exists('memory_get_usage'))
if (function_exists('memory_get_peak_usage'))
{
if ($memory_usage = memory_get_usage())
if ($memory_usage = memory_get_peak_usage())
{
global $base_memory_usage;
$memory_usage -= $base_memory_usage;
$memory_usage = get_formatted_filesize($memory_usage);
$debug_output .= ' | Memory Usage: ' . $memory_usage;
$debug_output .= ' | Peak Memory Usage: ' . $memory_usage;
}
}
@ -126,6 +124,8 @@ function adm_page_footer($copyright_html = true)
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html,
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js",
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
'VERSION' => $config['version'])
);

View File

@ -3111,7 +3111,7 @@ function get_database_size()
/**
* Retrieve contents from remotely stored file
*/
function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10)
function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6)
{
global $user;
@ -3121,6 +3121,9 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
@fputs($fsock, "HOST: $host\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
$timer_stop = time() + $timeout;
stream_set_timeout($fsock, $timeout);
$file_info = '';
$get_info = false;
@ -3143,6 +3146,14 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
return false;
}
}
$stream_meta_data = stream_get_meta_data($fsock);
if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
{
$errstr = $user->lang['FSOCK_TIMEOUT'];
return false;
}
}
@fclose($fsock);
}

View File

@ -446,6 +446,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'S_NO_CAT' => $catless && !$last_catless,
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
'S_UNREAD_FORUM' => $forum_unread,
'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']),
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
@ -655,7 +656,7 @@ function topic_generate_pagination($replies, $url)
$pagination .= '<a href="' . $url . ($j == 0 ? '' : '&amp;start=' . $j) . '">' . $times . '</a>';
if ($times == 1 && $total_pages > 5)
{
$pagination .= ' ... ';
$pagination .= '<span class="page-dots"> ... </span>';
// Display the last three pages
$times = $total_pages - 3;
@ -1065,6 +1066,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$match_id = ($mode == 'forum') ? $forum_id : $topic_id;
$u_url = "uid={$user->data['user_id']}";
$u_url .= ($mode == 'forum') ? '&amp;f' : '&amp;f=' . $forum_id . '&amp;t';
$is_watching = 0;
// Is user watching this thread?
if ($user_id != ANONYMOUS)
@ -1090,9 +1092,9 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$uid = request_var('uid', 0);
$token = request_var('hash', '');
if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true))
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
{
if (($uid != $user_id) || ($request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode))
if ($uid != $user_id || $request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode)
{
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
@ -1105,7 +1107,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$db->sql_query($sql);
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />';
$message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
meta_refresh(3, $redirect_url);
trigger_error($message);
}
@ -1122,7 +1125,14 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$s_hidden_fields['t'] = $topic_id;
}
$confirm_box_message = (($item_title == '') ? 'UNWATCH_' . strtoupper($mode) : $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title));
if ($item_title == '')
{
$confirm_box_message = 'UNWATCH_' . strtoupper($mode);
}
else
{
$confirm_box_message = $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title);
}
confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields));
}
}
@ -1147,9 +1157,9 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$uid = request_var('uid', 0);
$token = request_var('hash', '');
if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true))
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
{
if (($uid != $user_id) || ($request->variable('watch', '', false, phpbb_request_interface::GET) != $mode))
if ($uid != $user_id || $request->variable('watch', '', false, phpbb_request_interface::GET) != $mode)
{
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');

View File

@ -104,7 +104,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'DRIVER' => 'mssqlnative',
'AVAILABLE' => true,
'2.0.x' => false,
),
),
'oracle' => array(
'LABEL' => 'Oracle',
'SCHEMA' => 'oracle',
@ -211,61 +211,20 @@ function dbms_select($default = '', $only_20x_options = false)
/**
* Get tables of a database
*
* @deprecated
*/
function get_tables($db)
function get_tables(&$db)
{
switch ($db->sql_layer)
if (!class_exists('phpbb_db_tools'))
{
case 'mysql':
case 'mysql4':
case 'mysqli':
$sql = 'SHOW TABLES';
break;
case 'sqlite':
$sql = 'SELECT name
FROM sqlite_master
WHERE type = "table"';
break;
case 'mssql':
case 'mssql_odbc':
case 'mssqlnative':
$sql = "SELECT name
FROM sysobjects
WHERE type='U'";
break;
case 'postgres':
$sql = 'SELECT relname
FROM pg_stat_user_tables';
break;
case 'firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
case 'oracle':
$sql = 'SELECT table_name
FROM USER_TABLES';
break;
global $phpbb_root_path, $phpEx;
require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
}
$result = $db->sql_query($sql);
$db_tools = new phpbb_db_tools($db);
$tables = array();
while ($row = $db->sql_fetchrow($result))
{
$tables[] = current($row);
}
$db->sql_freeresult($result);
return $tables;
return $db_tools->sql_list_tables();
}
/**
@ -555,3 +514,45 @@ function adjust_language_keys_callback($matches)
return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]);
}
}
function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug = false)
{
$load_extensions = implode(',', $load_extensions);
$config_data = "<?php\n";
$config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
$config_data_array = array(
'dbms' => $dbms,
'dbhost' => $data['dbhost'],
'dbport' => $data['dbport'],
'dbname' => $data['dbname'],
'dbuser' => $data['dbuser'],
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
'table_prefix' => $data['table_prefix'],
'acm_type' => 'file',
'load_extensions' => $load_extensions,
);
foreach ($config_data_array as $key => $value)
{
$config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
}
$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
if ($debug)
{
$config_data .= "@define('DEBUG', true);\n";
$config_data .= "@define('DEBUG_EXTRA', true);\n";
}
else
{
$config_data .= "// @define('DEBUG', true);\n";
$config_data .= "// @define('DEBUG_EXTRA', true);\n";
}
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
return $config_data;
}

View File

@ -19,7 +19,8 @@ if (!defined('IN_PHPBB'))
Ability to simply add own rules by doing three things:
1) Add an appropriate constant
2) Add a new check array to the global_privmsgs_rules variable and the condition array (if one is required)
3) Add a new language variable to ucp.php
3) Implement the rule logic in the check_rule() function
4) Add a new language variable to ucp.php
The user is then able to select the new rule. It will be checked against and handled as specified.
To add new actions (yes, checks can be added here too) to the rule management, the core code has to be modified.
@ -57,42 +58,42 @@ define('CHECK_TO', 5);
*/
$global_privmsgs_rules = array(
CHECK_SUBJECT => array(
RULE_IS_LIKE => array('check0' => 'message_subject', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'),
RULE_IS_NOT_LIKE => array('check0' => 'message_subject', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'),
RULE_IS => array('check0' => 'message_subject', 'function' => '{CHECK0} == {STRING}'),
RULE_IS_NOT => array('check0' => 'message_subject', 'function' => '{CHECK0} != {STRING}'),
RULE_BEGINS_WITH => array('check0' => 'message_subject', 'function' => 'preg_match("/^" . preg_quote({STRING}, "/") . "/i", {CHECK0})'),
RULE_ENDS_WITH => array('check0' => 'message_subject', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "$/i", {CHECK0})'),
RULE_IS_LIKE => array('check0' => 'message_subject'),
RULE_IS_NOT_LIKE => array('check0' => 'message_subject'),
RULE_IS => array('check0' => 'message_subject'),
RULE_IS_NOT => array('check0' => 'message_subject'),
RULE_BEGINS_WITH => array('check0' => 'message_subject'),
RULE_ENDS_WITH => array('check0' => 'message_subject'),
),
CHECK_SENDER => array(
RULE_IS_LIKE => array('check0' => 'username', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'),
RULE_IS_NOT_LIKE => array('check0' => 'username', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'),
RULE_IS => array('check0' => 'username', 'function' => '{CHECK0} == {STRING}'),
RULE_IS_NOT => array('check0' => 'username', 'function' => '{CHECK0} != {STRING}'),
RULE_BEGINS_WITH => array('check0' => 'username', 'function' => 'preg_match("/^" . preg_quote({STRING}, "/") . "/i", {CHECK0})'),
RULE_ENDS_WITH => array('check0' => 'username', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "$/i", {CHECK0})'),
RULE_IS_FRIEND => array('check0' => 'friend', 'function' => '{CHECK0} == 1'),
RULE_IS_FOE => array('check0' => 'foe', 'function' => '{CHECK0} == 1'),
RULE_IS_USER => array('check0' => 'author_id', 'function' => '{CHECK0} == {USER_ID}'),
RULE_IS_GROUP => array('check0' => 'author_in_group', 'function' => 'in_array({GROUP_ID}, {CHECK0})'),
RULE_IS_LIKE => array('check0' => 'username'),
RULE_IS_NOT_LIKE => array('check0' => 'username'),
RULE_IS => array('check0' => 'username'),
RULE_IS_NOT => array('check0' => 'username'),
RULE_BEGINS_WITH => array('check0' => 'username'),
RULE_ENDS_WITH => array('check0' => 'username'),
RULE_IS_FRIEND => array('check0' => 'friend'),
RULE_IS_FOE => array('check0' => 'foe'),
RULE_IS_USER => array('check0' => 'author_id'),
RULE_IS_GROUP => array('check0' => 'author_in_group'),
),
CHECK_MESSAGE => array(
RULE_IS_LIKE => array('check0' => 'message_text', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'),
RULE_IS_NOT_LIKE => array('check0' => 'message_text', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'),
RULE_IS => array('check0' => 'message_text', 'function' => '{CHECK0} == {STRING}'),
RULE_IS_NOT => array('check0' => 'message_text', 'function' => '{CHECK0} != {STRING}'),
RULE_IS_LIKE => array('check0' => 'message_text'),
RULE_IS_NOT_LIKE => array('check0' => 'message_text'),
RULE_IS => array('check0' => 'message_text'),
RULE_IS_NOT => array('check0' => 'message_text'),
),
CHECK_STATUS => array(
RULE_ANSWERED => array('check0' => 'pm_replied', 'function' => '{CHECK0} == 1'),
RULE_FORWARDED => array('check0' => 'pm_forwarded', 'function' => '{CHECK0} == 1'),
RULE_ANSWERED => array('check0' => 'pm_replied'),
RULE_FORWARDED => array('check0' => 'pm_forwarded'),
),
CHECK_TO => array(
RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group', 'function' => 'in_array("g_" . {CHECK2}, {CHECK0}) || in_array("g_" . {CHECK2}, {CHECK1})'),
RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc', 'function' => 'in_array("u_" . $user_id, {CHECK0}) || in_array("u_" . $user_id, {CHECK1})'),
RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group'),
RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc'),
)
);
@ -260,16 +261,60 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
$check_ary = $rules[$rule_row['rule_check']][$rule_row['rule_connection']];
// Replace Check Literals
$evaluate = $check_ary['function'];
$evaluate = preg_replace('/{(CHECK[0-9])}/', '$message_row[$check_ary[strtolower("\1")]]', $evaluate);
// Replace Rule Literals
$evaluate = preg_replace('/{(STRING|USER_ID|GROUP_ID)}/', '$rule_row["rule_" . strtolower("\1")]', $evaluate);
// Evil Statement
$result = false;
eval('$result = (' . $evaluate . ') ? true : false;');
$check0 = $message_row[$check_ary['check0']];
switch ($rule_row['rule_connection'])
{
case RULE_IS_LIKE:
$result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_IS_NOT_LIKE:
$result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_IS:
$result = ($check0 == $rule_row['rule_string']);
break;
case RULE_IS_NOT:
$result = ($check0 != $rule_row['rule_string']);
break;
case RULE_BEGINS_WITH:
$result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_ENDS_WITH:
$result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0);
break;
case RULE_IS_FRIEND:
case RULE_IS_FOE:
case RULE_ANSWERED:
case RULE_FORWARDED:
$result = ($check0 == 1);
break;
case RULE_IS_USER:
$result = ($check0 == $rule_row['rule_user_id']);
break;
case RULE_IS_GROUP:
$result = in_array($rule_row['rule_group_id'], $check0);
break;
case RULE_TO_GROUP:
$result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']]));
break;
case RULE_TO_ME:
$result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']]));
break;
}
if (!$result)
{
@ -1607,7 +1652,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
// Send Notifications
if ($mode != 'edit')
{
pm_notification($mode, $data['from_username'], $recipients, $subject, $data['message']);
pm_notification($mode, $data['from_username'], $recipients, $subject, $data['message'], $data['msg_id']);
}
return $data['msg_id'];
@ -1616,7 +1661,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
/**
* PM Notification
*/
function pm_notification($mode, $author, $recipients, $subject, $message)
function pm_notification($mode, $author, $recipients, $subject, $message, $msg_id)
{
global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
@ -1688,8 +1733,9 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
'AUTHOR_NAME' => htmlspecialchars_decode($author),
'USERNAME' => htmlspecialchars_decode($addr['name']),
'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&folder=inbox")
);
'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&folder=inbox",
'U_VIEW_MESSAGE' => generate_board_url() . "/ucp.$phpEx?i=pm&mode=view&p=$msg_id",
));
$messenger->send($addr['method']);
}

View File

@ -286,14 +286,6 @@ function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;
// For changing topic types, we only allow operations in one forum.
$forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true);
if ($forum_id === false)
{
return;
}
switch ($action)
{
case 'make_announce':
@ -316,11 +308,18 @@ function change_topic_type($action, $topic_ids)
default:
$new_topic_type = POST_NORMAL;
$check_acl = '';
$check_acl = false;
$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
break;
}
$forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true);
if ($forum_id === false)
{
return;
}
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));
$s_hidden_fields = array(

View File

@ -246,7 +246,7 @@ function mcp_post_details($id, $mode, $action)
}
// Get Reports
if ($auth->acl_get('m_', $post_info['forum_id']))
if ($auth->acl_get('m_report', $post_info['forum_id']))
{
$sql = 'SELECT r.*, re.*, u.user_id, u.username
FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re

View File

@ -239,8 +239,8 @@ function mcp_topic_view($id, $mode, $action)
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])),
'S_POST_UNAPPROVED' => (!$row['post_approved'] && $auth->acl_get('m_approve', $topic_info['forum_id'])),
'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,

View File

@ -97,8 +97,8 @@ function deregister_globals()
unset($input);
}
// If we are on PHP >= 6.0.0 we do not need some code
if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
// Register globals and magic quotes have been dropped in PHP 5.4
if (version_compare(PHP_VERSION, '5.4.0-dev', '>='))
{
/**
* @ignore

View File

@ -194,48 +194,44 @@ class ucp_groups
if ($group_row[$group_id]['group_type'] == GROUP_FREE)
{
group_user_add($group_id, $user->data['user_id']);
$email_template = 'group_added';
}
else
{
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
$email_template = 'group_request';
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger();
$sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . " u
WHERE ug.user_id = u.user_id
AND ug.group_leader = 1
AND ug.group_id = $group_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$messenger->template('group_request', $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),
'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),
'REQUEST_USERNAME' => $user->data['username'],
'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")
);
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
$messenger->save_queue();
}
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger();
$sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
WHERE ug.user_id = u.user_id
AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? "ug.user_id = {$user->data['user_id']}" : 'ug.group_leader = 1') . "
AND ug.group_id = $group_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$messenger->template($email_template, $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($row['username']),
'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),
'REQUEST_USERNAME' => $user->data['username'],
'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")
);
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
$messenger->save_queue();
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']);
meta_refresh(3, $this->u_action);

View File

@ -243,7 +243,7 @@ class ucp_pm
$num_not_moved = $num_removed = 0;
$release = request_var('release', 0);
if ($user->data['user_new_privmsg'] && $action == 'view_folder')
if ($user->data['user_new_privmsg'] && ($action == 'view_folder' || $action == 'view_message'))
{
$return = place_pm_into_folder($global_privmsgs_rules, $release);
$num_not_moved = $return['not_moved'];

View File

@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
global $user, $template, $auth, $db, $cache;
global $phpbb_root_path, $phpEx, $config;
global $phpbb_root_path, $request, $phpEx, $config;
$user->add_lang(array('viewtopic', 'memberlist'));
@ -239,7 +239,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $author_id) : '',
'U_WWW' => (!empty($user_info['user_website'])) ? $user_info['user_website'] : '',
'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people' . urlencode($user_info['user_icq']) . '/' : '',
'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people/' . urlencode($user_info['user_icq']) . '/' : '',
'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=aim&amp;u=' . $author_id) : '',
'U_YIM' => ($user_info['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($user_info['user_yim']) . '&amp;.src=pg' : '',
'U_MSN' => ($user_info['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=msnm&amp;u=' . $author_id) : '',

View File

@ -79,14 +79,14 @@ class ucp_profile
$error = validate_data($data, $check_ary);
if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])
if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])
{
$error[] = 'NEW_PASSWORD_ERROR';
$error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';
}
if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password']))
if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])
{
$error[] = 'CUR_PASSWORD_ERROR';
$error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
}
// Only check the new password against the previous password if there have been no errors
@ -95,9 +95,9 @@ class ucp_profile
$error[] = 'SAME_PASSWORD_ERROR';
}
if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])
if (!phpbb_check_hash($data['cur_password'], $user->data['user_password']))
{
$error[] = 'NEW_EMAIL_ERROR';
$error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
}
if (!check_form_key('ucp_reg_details'))