1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-03 14:17:56 +02:00

ok, handled some bugs... the most important being validate_username (the variable passed to validate_data([...]array('username', [...])) and updating group listings while doing relevant group actions. Oh, and PM icons are working now. :o

git-svn-id: file:///svn/phpbb/trunk@6894 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-01-17 18:41:49 +00:00
parent 708113b790
commit a841fe70a8
42 changed files with 243 additions and 226 deletions

View File

@ -111,6 +111,10 @@
<dt><label>{L_POSTS}:</label></dt>
<dd><strong>{USER_POSTS}</strong></dd>
</dl>
<dl>
<dt><label>{L_WARNINGS}:</label></dt>
<dd><strong>{USER_WARNINGS}</strong></dd>
</dl>
<dl>
<dt><label for="user_founder">{L_FOUNDER}:</label><br /><span>{L_FOUNDER_EXPLAIN}</span></dt>
<dd><input type="radio" class="radio" name="user_founder" value="1"<!-- IF S_USER_FOUNDER --> id="user_founder" checked="checked"<!-- ENDIF --><!-- IF not S_FOUNDER --> disabled="disabled"<!-- ENDIF --> />&nbsp;{L_YES}&nbsp; <input type="radio" class="radio" name="user_founder" value="0"<!-- IF not S_USER_FOUNDER --> id="user_founder" checked="checked"<!-- ENDIF --><!-- IF not S_FOUNDER --> disabled="disabled"<!-- ENDIF --> />&nbsp;{L_NO}&nbsp;</dd>
@ -136,10 +140,6 @@
<fieldset>
<legend>{L_USER_TOOLS}</legend>
<dl>
<dt><label for="warnings">{L_WARNINGS}:</label><br /><span>{L_WARNINGS_EXPLAIN}</span></dt>
<dd><input type="text" id="warnings" name="warnings" value="{USER_WARNINGS}" size="2" /></dd>
</dl>
<dl>
<dt><label for="quicktools">{L_QUICK_TOOLS}:</label></dt>
<dd><select id="quicktools" name="action">{S_ACTION_OPTIONS}</select></dd>

View File

@ -1327,7 +1327,7 @@ function get_schema_struct()
'rule_user_id' => array('UINT', 0),
'rule_group_id' => array('UINT', 0),
'rule_action' => array('UINT', 0),
'rule_folder_id' => array('INT:4', 0),
'rule_folder_id' => array('UINT', 0),
),
'PRIMARY_KEY' => 'rule_id',
'KEYS' => array(
@ -1346,7 +1346,7 @@ function get_schema_struct()
'pm_replied' => array('BOOL', 0),
'pm_marked' => array('BOOL', 0),
'pm_forwarded' => array('BOOL', 0),
'folder_id' => array('INT:4', 0),
'folder_id' => array('UINT', 0),
),
'KEYS' => array(
'msg_id' => array('INDEX', 'msg_id'),

View File

@ -478,7 +478,7 @@ class acp_forums
$forum_data['forum_rules_bitfield'] = '';
$forum_data['forum_rules_options'] = 0;
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smiliess', false));
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false));
}
// Generate preview content
@ -498,7 +498,7 @@ class acp_forums
$forum_data['forum_desc_bitfield'] = '';
$forum_data['forum_desc_options'] = 0;
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smiliess', false));
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false));
}
// decode...

View File

@ -91,8 +91,6 @@ class acp_groups
break;
}
group_update_listings($group_id);
trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&amp;action=list&amp;g=' . $group_id));
break;
@ -142,8 +140,6 @@ class acp_groups
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
}
group_update_listings($group_id);
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&amp;action=list&amp;g=' . $group_id));
}
else

View File

@ -623,7 +623,6 @@ class acp_users
'email_confirm' => strtolower(request_var('email_confirm', '')),
'user_password' => request_var('user_password', '', true),
'password_confirm' => request_var('password_confirm', '', true),
'warnings' => request_var('warnings', $user_row['user_warnings']),
);
// Validation data - we do not check the password complexity setting here
@ -632,7 +631,6 @@ class acp_users
array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
array('password')),
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
'warnings' => array('num'),
);
// Check username if altered
@ -641,7 +639,8 @@ class acp_users
$check_ary += array(
'username' => array(
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
array('username', $user_row['username'])),
array('username', $user_row['username'])
),
);
}
@ -670,7 +669,6 @@ class acp_users
}
// Which updates do we need to do?
$update_warning = ($user_row['user_warnings'] != $data['warnings']) ? true : false;
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
$update_password = ($data['user_password'] && $user_row['user_password'] != md5($data['user_password'])) ? true : false;
$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;
@ -681,11 +679,6 @@ class acp_users
if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER)
{
if ($update_warning)
{
$sql_ary['user_warnings'] = $data['warnings'];
}
// Only allow founders updating the founder status...
if ($user->data['user_type'] == USER_FOUNDER)
{
@ -765,13 +758,6 @@ class acp_users
$db->sql_query($sql);
}
/**
* @todo adjust every data based in the number of user warnings
*/
if ($update_warning)
{
}
if ($update_username)
{
user_update_name($user_row['username'], $update_username);

View File

@ -114,6 +114,24 @@ class dbal
return $this->_sql_close();
}
/**
* Build LIMIT query
* Doing some validation here.
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if (empty($query))
{
return false;
}
// Never use a negative total or offset
$total = ($total < 0) ? 0 : $total;
$offset = ($offset < 0) ? 0 : $offset;
return $this->_sql_query_limit($query, $total, $offset, $cache_ttl);
}
/**
* Fetch all rows
*/

View File

@ -158,20 +158,13 @@ class dbal_firebird extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
{
$this->query_result = false;
$this->query_result = false;
$query = 'SELECT FIRST ' . $total . ((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6);
$query = 'SELECT FIRST ' . $total . ((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6);
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
}
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -159,40 +159,33 @@ class dbal_mssql extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
if ($total)
{
$this->query_result = false;
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
if ($total)
// We need to grab the total number of rows + the offset number of rows to get the correct result
if (strpos($query, 'SELECT DISTINCT') === 0)
{
// We need to grab the total number of rows + the offset number of rows to get the correct result
if (strpos($query, 'SELECT DISTINCT') === 0)
{
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
}
else
{
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
}
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
}
$result = $this->sql_query($query, $cache_ttl);
// Seek by $offset rows
if ($offset)
else
{
$this->sql_rowseek($offset, $result);
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
}
return $result;
}
else
$result = $this->sql_query($query, $cache_ttl);
// Seek by $offset rows
if ($offset)
{
return false;
$this->sql_rowseek($offset, $result);
}
return $result;
}
/**

View File

@ -156,40 +156,33 @@ class dbal_mssql_odbc extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
if ($total)
{
$this->query_result = false;
// Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows)
if ($total)
// We need to grab the total number of rows + the offset number of rows to get the correct result
if (strpos($query, 'SELECT DISTINCT') === 0)
{
// We need to grab the total number of rows + the offset number of rows to get the correct result
if (strpos($query, 'SELECT DISTINCT') === 0)
{
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
}
else
{
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
}
$query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15);
}
$result = $this->sql_query($query, $cache_ttl);
// Seek by $offset rows
if ($offset)
else
{
$this->sql_rowseek($offset, $result);
$query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6);
}
return $result;
}
else
$result = $this->sql_query($query, $cache_ttl);
// Seek by $offset rows
if ($offset)
{
return false;
$this->sql_rowseek($offset, $result);
}
return $result;
}
/**

View File

@ -163,27 +163,20 @@ class dbal_mysql extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
// Having a value of -1 was always a bug
$total = '18446744073709551615';
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
// Having a value of -1 was always a bug
$total = '18446744073709551615';
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -142,27 +142,20 @@ class dbal_mysqli extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
// MySQL 4.1+ no longer supports -1 in limit queries
$total = '18446744073709551615';
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
// MySQL 4.1+ no longer supports -1 in limit queries
$total = '18446744073709551615';
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -213,20 +213,13 @@ class dbal_oracle extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
{
$this->query_result = false;
$this->query_result = false;
$query = 'SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (' . $query . ') a WHERE rownum <= ' . ($offset + $total) . ') WHERE xrownum >= ' . $offset;
$query = 'SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (' . $query . ') a WHERE rownum <= ' . ($offset + $total) . ') WHERE xrownum >= ' . $offset;
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
}
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -192,26 +192,19 @@ class dbal_postgres extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$total = -1;
}
$query .= "\n LIMIT $total OFFSET $offset";
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
$total = -1;
}
$query .= "\n LIMIT $total OFFSET $offset";
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -141,26 +141,19 @@ class dbal_sqlite extends dbal
/**
* Build LIMIT query
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
if ($query != '')
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$this->query_result = false;
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
$total = -1;
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
else
{
return false;
$total = -1;
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
return $this->sql_query($query, $cache_ttl);
}
/**

View File

@ -1285,8 +1285,11 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
{
global $template, $user;
// Make sure $per_page is a valid value
$per_page = ($per_page <= 0) ? 1 : $per_page;
$seperator = '<span class="page-sep">' . $user->lang['PAGINATION_SEPERATOR'] . '</span>';
$total_pages = ceil($num_items/$per_page);
$total_pages = ceil($num_items / $per_page);
if ($total_pages == 1 || !$num_items)
{
@ -1361,6 +1364,9 @@ function on_page($num_items, $per_page, $start)
{
global $template, $user;
// Make sure $per_page is a valid value
$per_page = ($per_page <= 0) ? 1 : $per_page;
$on_page = floor($start / $per_page) + 1;
$template->assign_vars(array(
@ -1503,12 +1509,6 @@ function redirect($url, $return = false)
// Make sure no &amp;'s are in, this will break the redirect
$url = str_replace('&amp;', '&', $url);
// Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false)
{
trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
}
// Determine which type of redirect we need to handle...
$url_parts = parse_url($url);

View File

@ -504,20 +504,23 @@ function topic_generate_pagination($replies, $url)
{
global $config, $user;
if (($replies + 1) > $config['posts_per_page'])
// Make sure $per_page is a valid value
$per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page'];
if (($replies + 1) > $per_page)
{
$total_pages = ceil(($replies + 1) / $config['posts_per_page']);
$total_pages = ceil(($replies + 1) / $per_page);
$pagination = '';
$times = 1;
for ($j = 0; $j < $replies + 1; $j += $config['posts_per_page'])
for ($j = 0; $j < $replies + 1; $j += $per_page)
{
$pagination .= '<a href="' . $url . '&amp;start=' . $j . '">' . $times . '</a>';
if ($times == 1 && $total_pages > 4)
{
$pagination .= ' ... ';
$times = $total_pages - 3;
$j += ($total_pages - 4) * $config['posts_per_page'];
$j += ($total_pages - 4) * $per_page;
}
else if ($times < $total_pages)
{

View File

@ -1240,7 +1240,7 @@ function get_folder_status($folder_id, $folder)
/**
* Submit PM
*/
function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = true)
function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
{
global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path;

View File

@ -817,9 +817,11 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
}
// Fetch currently set bans of the specified type and exclude state. Prevent duplicate bans.
$sql_where = ($type == 'ban_userid') ? 'ban_userid <> 0' : "$type <> ''";
$sql = "SELECT $type
FROM " . BANLIST_TABLE . "
WHERE $type <> ''
WHERE $sql_where
AND ban_exclude = $ban_exclude";
$result = $db->sql_query($sql);
@ -1148,15 +1150,19 @@ function validate_match($string, $optional = false, $match)
* Also checks if it includes the " character, which we don't allow in usernames.
* Used for registering, changing names, and posting anonymously with a username
*
* @param string $username The username to check
* @param string $allowed_username An allowed username, default being $user->data['username']
*
* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
*/
function validate_username($username)
function validate_username($username, $allowed_username = false)
{
global $config, $db, $user, $cache;
$clean_username = utf8_clean_string($username);
$allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username);
if (utf8_clean_string($user->data['username']) == $clean_username)
if ($allowed_username == $clean_username)
{
return false;
}
@ -1190,7 +1196,6 @@ function validate_username($username)
return 'USERNAME_TAKEN';
}
$bad_usernames = $cache->obtain_disallowed_usernames();
foreach ($bad_usernames as $bad_username)
@ -1725,6 +1730,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
$name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name;
add_log('admin', $log, $name);
group_update_listings($group_id);
}
return (sizeof($error)) ? $error : false;
@ -2013,6 +2020,8 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
add_log('admin', $log, $group_name, implode(', ', $username_ary));
group_update_listings($group_id);
// Return false - no error
return false;
}
@ -2115,13 +2124,17 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
add_log('admin', $log, $group_name, implode(', ', $username_ary));
group_update_listings($group_id);
return true;
}
/**
* Set users default group
*
* @private
*/
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false)
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
{
global $db;
@ -2212,6 +2225,11 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
set_config('newest_user_colour', $sql_ary['user_colour'], true);
}
}
if ($update_listing)
{
group_update_listings($group_id);
}
}
/**

View File

@ -129,14 +129,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row['topic_id'] : '';
$template->assign_block_vars('topicrow', array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row['topic_id']}&amp;mode=topic_view"),
'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false,
'U_SELECT_TOPIC' => $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row['topic_id'] . $selected_ids,
'U_MCP_QUEUE' => $u_mcp_queue,
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row['topic_id'] . '&amp;action=reports') : '',
$topic_row = array(
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
@ -159,16 +152,38 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'TOPIC_TITLE' => $topic_title,
'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'],
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
'TOPIC_ID' => $row['topic_id'],
'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? 'checked="checked" ' : '',
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved)
'S_POSTS_UNAPPROVED' => $posts_unapproved,
);
if ($row['topic_status'] == ITEM_MOVED)
{
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"),
'S_MOVED_TOPIC' => true,
'TOPIC_ID' => $row['topic_moved_id'],
));
}
else
{
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row['topic_id']}&amp;mode=topic_view"),
'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false,
'U_SELECT_TOPIC' => $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row['topic_id'] . $selected_ids,
'U_MCP_QUEUE' => $u_mcp_queue,
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row['topic_id'] . '&amp;action=reports') : '',
'TOPIC_ID' => $row['topic_id'],
'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false,
));
}
$template->assign_block_vars('topicrow', $topic_row);
}
unset($topic_rows);
}

View File

@ -386,6 +386,12 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$to_topic_id = $db->sql_nextid();
move_posts($post_id_list, $to_topic_id);
$topic_info = get_post_data(array($topic_id));
$topic_info = $topic_info[$topic_id];
add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);
// Change topic title of first post
$sql = 'UPDATE ' . POSTS_TABLE . "
SET post_subject = '" . $db->sql_escape($subject) . "'

View File

@ -432,7 +432,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
'address_list' => array('u' => array($user_row['user_id'] => 'to')),
);
submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false, false);
submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
}
add_log('admin', 'LOG_USER_WARNING', $user_row['username']);

View File

@ -799,7 +799,6 @@ class ucp_groups
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
}
group_update_listings($group_id);
$user->add_lang('acp/groups');
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . $return_page);

View File

@ -558,7 +558,7 @@ function compose_pm($id, $mode, $action)
unset($message_parser);
// ((!$message_subject) ? $subject : $message_subject)
$msg_id = submit_pm($action, $subject, $pm_data, true);
$msg_id = submit_pm($action, $subject, $pm_data);
$return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=view&amp;p=' . $msg_id);
$return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=outbox');

View File

@ -239,7 +239,9 @@ function view_folder($id, $mode, $folder_id, $folder)
$template->assign_vars(array(
'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false,
'S_SHOW_COLOUR_LEGEND' => true)
'S_SHOW_COLOUR_LEGEND' => true,
'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false)
);
}
}

View File

@ -60,7 +60,7 @@ class ucp_profile
{
$check_ary['username'] = array(
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
array('username', $data['username']),
array('username'),
);
}

View File

@ -329,6 +329,12 @@ $database_update_info = array(
'prune_viewed' => array('UINT', 0),
'prune_freq' => array('UINT', 0),
),
PRIVMSGS_RULES_TABLE => array(
'rule_folder_id' => array('UINT', 0),
),
PRIVMSGS_TO_TABLE => array(
'folder_id' => array('UINT', 0),
),
),
// Remove the following keys
'drop_keys' => array(

View File

@ -511,7 +511,7 @@ CREATE TABLE phpbb_privmsgs_rules (
rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_folder_id int(4) DEFAULT '0' NOT NULL,
rule_folder_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (rule_id),
KEY user_id (user_id)
);
@ -528,7 +528,7 @@ CREATE TABLE phpbb_privmsgs_to (
pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
folder_id int(4) DEFAULT '0' NOT NULL,
folder_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
KEY msg_id (msg_id),
KEY author_id (author_id),
KEY usr_flder_id (user_id, folder_id)

View File

@ -511,7 +511,7 @@ CREATE TABLE phpbb_privmsgs_rules (
rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
rule_folder_id int(4) DEFAULT '0' NOT NULL,
rule_folder_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (rule_id),
KEY user_id (user_id)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
@ -528,7 +528,7 @@ CREATE TABLE phpbb_privmsgs_to (
pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
folder_id int(4) DEFAULT '0' NOT NULL,
folder_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
KEY msg_id (msg_id),
KEY author_id (author_id),
KEY usr_flder_id (user_id, folder_id)

View File

@ -989,7 +989,7 @@ CREATE TABLE phpbb_privmsgs_rules (
rule_user_id number(8) DEFAULT '0' NOT NULL,
rule_group_id number(8) DEFAULT '0' NOT NULL,
rule_action number(8) DEFAULT '0' NOT NULL,
rule_folder_id number(4) DEFAULT '0' NOT NULL,
rule_folder_id number(8) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id)
)
/
@ -1026,7 +1026,7 @@ CREATE TABLE phpbb_privmsgs_to (
pm_replied number(1) DEFAULT '0' NOT NULL,
pm_marked number(1) DEFAULT '0' NOT NULL,
pm_forwarded number(1) DEFAULT '0' NOT NULL,
folder_id number(4) DEFAULT '0' NOT NULL
folder_id number(8) DEFAULT '0' NOT NULL
)
/

View File

@ -691,7 +691,7 @@ CREATE TABLE phpbb_privmsgs_rules (
rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0),
rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0),
rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0),
rule_folder_id INT4 DEFAULT '0' NOT NULL,
rule_folder_id INT4 DEFAULT '0' NOT NULL CHECK (rule_folder_id >= 0),
PRIMARY KEY (rule_id)
);
@ -710,7 +710,7 @@ CREATE TABLE phpbb_privmsgs_to (
pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0),
pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0),
pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0),
folder_id INT4 DEFAULT '0' NOT NULL
folder_id INT4 DEFAULT '0' NOT NULL CHECK (folder_id >= 0)
);
CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id);

View File

@ -495,7 +495,7 @@ CREATE TABLE phpbb_privmsgs_rules (
rule_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
rule_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
rule_action INTEGER UNSIGNED NOT NULL DEFAULT '0',
rule_folder_id int(4) NOT NULL DEFAULT '0'
rule_folder_id INTEGER UNSIGNED NOT NULL DEFAULT '0'
);
CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id);
@ -511,7 +511,7 @@ CREATE TABLE phpbb_privmsgs_to (
pm_replied INTEGER UNSIGNED NOT NULL DEFAULT '0',
pm_marked INTEGER UNSIGNED NOT NULL DEFAULT '0',
pm_forwarded INTEGER UNSIGNED NOT NULL DEFAULT '0',
folder_id int(4) NOT NULL DEFAULT '0'
folder_id INTEGER UNSIGNED NOT NULL DEFAULT '0'
);
CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id);

View File

@ -451,6 +451,9 @@ $lang = array_merge($lang, array(
'LOG_LOCK_POST' => '<strong>Locked post</strong><br />» %s',
'LOG_MERGE' => '<strong>Merged posts</strong> into topic<br />» %s',
'LOG_MOVE' => '<strong>Moved topic</strong><br />» from %s',
'LOG_SPLIT_DESTINATION' => '<strong>Moved splitted posts</strong><br />» to %s',
'LOG_SPLIT_SOURCE' => '<strong>Splitted posts</strong><br />» from %s',
'LOG_TOPIC_DELETED' => '<strong>Deleted topic</strong><br />» %s',
'LOG_TOPIC_RESYNC' => '<strong>Resynchronised topic counters</strong><br />» %s',
'LOG_TOPIC_TYPE_CHANGED' => '<strong>Changed topic type</strong><br />» %s',

View File

@ -62,7 +62,7 @@ $lang = array_merge($lang, array(
'DISPLAY_AT_REGISTER' => 'Display at registration screen',
'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration and able to be changed within the user control panel.',
'DISPLAY_PROFILE_FIELD' => 'Display profile field',
'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown on viewtopic/viewprofile/memberlist/etc.',
'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown on viewtopic/viewprofile/memberlist. if this is enabled within the load settings. Only showing within the users profile is enabled by default.',
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line',
'EDIT_DROPDOWN_LANG_EXPLAIN' => 'Please note that you are able to change your options text and also able to add new options to the end. It is not advised to add new options between existing options - this could result in wrong options assigned to your users. This can also happen if you remove options in-between. Removing options from the end result in users having assigned this item now reverting back to the default one.',

View File

@ -119,8 +119,6 @@ $lang = array_merge($lang, array(
'USER_RANK_UPDATED' => 'User rank updated.',
'USER_SIG_UPDATED' => 'User signature successfully updated.',
'USER_TOOLS' => 'Basic tools',
'WARNINGS_EXPLAIN' => 'You can directly alter the warnings this users has received.',
));
?>

View File

@ -124,6 +124,7 @@ $lang = array_merge($lang, array(
'NOTIFY_REPLY' => 'Send me an email when a reply is posted',
'NOT_UPLOADED' => 'File could not be uploaded.',
'NO_DELETE_POLL_OPTIONS' => 'You cannot delete existing poll options',
'NO_PM_ICON' => 'No PM icon',
'NO_POLL_TITLE' => 'You have to enter a poll title',
'NO_POST' => 'The requested post does not exist.',
'NO_POST_MODE' => 'No post mode specified',

View File

@ -1202,7 +1202,7 @@ switch ($mode)
'S_SEARCH_USER' => true,
'S_FORM_NAME' => $form,
'S_FIELD_NAME' => $field,
'S_SELECT_SINGLE' => $select_single,
'S_SELECT_SINGLE' => $select_single,
'S_COUNT_OPTIONS' => $s_find_count,
'S_SORT_OPTIONS' => $s_sort_key,
'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
@ -1239,7 +1239,8 @@ switch ($mode)
$id_cache = array();
while ($row = $db->sql_fetchrow($result))
{
$row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : '';
$row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0;
$row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit'];
$id_cache[$row['user_id']] = $row;
}
@ -1255,6 +1256,13 @@ switch ($mode)
$profile_fields_cache = $cp->generate_profile_fields_template('grab', array_keys($id_cache));
}
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
if ($sort_key == 'l')
{
$lesser_than = ($sort_dir == 'a') ? -1 : 1;
uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
}
$i = 0;
foreach ($id_cache as $user_id => $row)
{

View File

@ -549,7 +549,8 @@ if ($submit || $preview || $refresh)
$post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
$post_data['post_edit_reason'] = (!empty($_POST['edit_reason']) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';
$post_data['orig_topic_type'] = $post_data['topic_type'];
$post_data['topic_type'] = request_var('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL));
$post_data['topic_time_limit'] = request_var('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0));
$post_data['icon_id'] = request_var('icon', 0);
@ -799,7 +800,16 @@ if ($submit || $preview || $refresh)
if (!$auth->acl_get($auth_option, $forum_id))
{
$error[] = $user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))];
// There is a special case where a user edits his post whereby the topic type got changed by an admin/mod
if ($mode == 'edit' && $post_data['poster_id'] == $user->data['user_id'])
{
// To prevent non-authed users messing around with the topic type we reset it to the original one.
$post_data['topic_type'] = $post_data['orig_topic_type'];
}
else
{
$error[] = $user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))];
}
}
}

View File

@ -40,7 +40,9 @@
</td>
<td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td>
<td class="row1" width="120" align="center"><p class="topicdetails">{topicrow.LAST_POST_TIME}</p></td>
<td class="row2" align="center"><input type="checkbox" class="radio" name="topic_id_list[]" value="{topicrow.TOPIC_ID}" {topicrow.S_TOPIC_CHECKED}/></td>
<td class="row2" align="center">
<!-- IF not topicrow.S_MOVED_TOPIC --><input type="checkbox" class="radio" name="topic_id_list[]" value="{topicrow.TOPIC_ID}"<!-- IF topicrow.S_TOPIC_CHECKED --> checked="checked"<!-- ENDIF --> /><!-- ELSE -->&nbsp;<!-- ENDIF -->
</td>
</tr>
<!-- BEGINELSE -->
<tr>

View File

@ -121,13 +121,13 @@
</tr>
<!-- ENDIF -->
<!-- IF S_SHOW_TOPIC_ICONS -->
<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
<tr>
<td class="row1"><b class="genmed">{L_ICON}:</b></td>
<td class="row2">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><input type="radio" class="radio" name="icon" value="0"{S_NO_ICON_CHECKED} /><span class="genmed">{L_NO_TOPIC_ICON}</span> <!-- BEGIN topic_icon --><span style="white-space: nowrap;"><input type="radio" class="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /></span> <!-- END topic_icon --></td>
<td><input type="radio" class="radio" name="icon" value="0"{S_NO_ICON_CHECKED} /><span class="genmed"><!-- IF S_SHOW_TOPIC_ICON -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></span> <!-- BEGIN topic_icon --><span style="white-space: nowrap;"><input type="radio" class="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /></span> <!-- END topic_icon --></td>
</tr>
</table>
</td>

View File

@ -116,7 +116,7 @@
<br /><br />
<form method="post" action="{S_LOGIN_ACTION}">
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td>

View File

@ -152,9 +152,11 @@ if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] &
if (!$auth->acl_get('f_read', $forum_id))
{
$template->assign_vars(array(
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&amp;start=$start"),
'S_NO_READ_ACCESS' => true,
'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&amp;redirect=' . urlencode(build_url(array('_f_'))))
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&amp;redirect=' . urlencode(build_url(array('_f_'))),
));
page_footer();

View File

@ -493,7 +493,7 @@ $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_regist
$topic_mod = '';
$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : '';
$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . $user->lang['DELETE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : '';