diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html
index 06fdf6626f..5ce4e6e00b 100644
--- a/phpBB/adm/style/acp_users.html
+++ b/phpBB/adm/style/acp_users.html
@@ -134,11 +134,13 @@
-
-
{L_DELETE_USER_EXPLAIN}
-
-
-
+
+
+
{L_DELETE_USER_EXPLAIN}
+
+
+
+
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 52c5460847..5bcf3c894a 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -631,25 +631,30 @@ class acp_attachments
$img_path = $config['upload_icons_path'];
- $imglist = filelist($phpbb_root_path . $img_path);
- $imglist = array_values($imglist);
- $imglist = $imglist[0];
-
$filename_list = '';
$no_image_select = false;
- foreach ($imglist as $key => $img)
- {
- if (!$ext_group_row['upload_icon'])
- {
- $no_image_select = true;
- $selected = '';
- }
- else
- {
- $selected = ($ext_group_row['upload_icon'] == $img) ? ' selected="selected"' : '';
- }
- $filename_list .= '';
+ $imglist = filelist($phpbb_root_path . $img_path);
+
+ if (sizeof($imglist))
+ {
+ $imglist = array_values($imglist);
+ $imglist = $imglist[0];
+
+ foreach ($imglist as $key => $img)
+ {
+ if (!$ext_group_row['upload_icon'])
+ {
+ $no_image_select = true;
+ $selected = '';
+ }
+ else
+ {
+ $selected = ($ext_group_row['upload_icon'] == $img) ? ' selected="selected"' : '';
+ }
+
+ $filename_list .= '';
+ }
}
$i = 0;
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 78b6f89cd9..0c67e92256 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -127,7 +127,8 @@ class acp_language
trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action));
}
- $sql = 'SELECT * FROM ' . LANG_TABLE . "
+ $sql = 'SELECT *
+ FROM ' . LANG_TABLE . "
WHERE lang_id = $lang_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -162,7 +163,8 @@ class acp_language
trigger_error($user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action));
}
- $sql = 'SELECT * FROM ' . LANG_TABLE . "
+ $sql = 'SELECT *
+ FROM ' . LANG_TABLE . "
WHERE lang_id = $lang_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -332,7 +334,8 @@ class acp_language
$this->page_title = 'LANGUAGE_PACK_DETAILS';
- $sql = 'SELECT * FROM ' . LANG_TABLE . '
+ $sql = 'SELECT *
+ FROM ' . LANG_TABLE . '
WHERE lang_id = ' . $lang_id;
$result = $db->sql_query($sql);
$lang_entries = $db->sql_fetchrow($result);
@@ -644,7 +647,8 @@ class acp_language
trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action));
}
- $sql = 'SELECT * FROM ' . LANG_TABLE . '
+ $sql = 'SELECT *
+ FROM ' . LANG_TABLE . '
WHERE lang_id = ' . $lang_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -686,7 +690,8 @@ class acp_language
);
unset($file);
- $sql = 'SELECT lang_iso FROM ' . LANG_TABLE . "
+ $sql = 'SELECT lang_iso
+ FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'";
$result = $db->sql_query($sql);
@@ -725,7 +730,8 @@ class acp_language
trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action));
}
- $sql = 'SELECT * FROM ' . LANG_TABLE . '
+ $sql = 'SELECT *
+ FROM ' . LANG_TABLE . '
WHERE lang_id = ' . $lang_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -841,7 +847,8 @@ class acp_language
$db->sql_freeresult($result);
$sql = 'SELECT *
- FROM ' . LANG_TABLE;
+ FROM ' . LANG_TABLE . '
+ ORDER BY lang_english_name';
$result = $db->sql_query($sql);
$installed = array();
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index f2adb7b53d..28f547189d 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -50,7 +50,8 @@ class acp_profile
$lang_defs = array();
$sql = 'SELECT lang_id, lang_iso
- FROM ' . LANG_TABLE;
+ FROM ' . LANG_TABLE . '
+ ORDER BY lang_english_name';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -63,7 +64,7 @@ class acp_profile
$sql = 'SELECT field_id, lang_id
FROM ' . PROFILE_LANG_TABLE . '
- ORDER BY lang_id';
+ ORDER BY lang_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -293,10 +294,11 @@ class acp_profile
$field_type = $field_row['field_type'];
// Get language entries
- $sql = 'SELECT * FROM ' . PROFILE_FIELDS_LANG_TABLE . '
+ $sql = 'SELECT *
+ FROM ' . PROFILE_FIELDS_LANG_TABLE . '
WHERE lang_id = ' . $lang_defs['iso'][$config['default_lang']] . "
AND field_id = $field_id
- ORDER BY option_id ASC";
+ ORDER BY option_id ASC";
$result = $db->sql_query($sql);
$lang_options = array();
@@ -474,7 +476,8 @@ class acp_profile
if ($action == 'edit')
{
// Get language entries
- $sql = 'SELECT * FROM ' . PROFILE_FIELDS_LANG_TABLE . '
+ $sql = 'SELECT *
+ FROM ' . PROFILE_FIELDS_LANG_TABLE . '
WHERE lang_id <> ' . $lang_defs['iso'][$config['default_lang']] . "
AND field_id = $field_id
ORDER BY option_id ASC";
@@ -488,7 +491,8 @@ class acp_profile
$db->sql_freeresult($result);
- $sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value FROM ' . PROFILE_LANG_TABLE . '
+ $sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
+ FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $lang_defs['iso'][$config['default_lang']] . "
AND field_id = $field_id
ORDER BY lang_id ASC";
@@ -769,7 +773,8 @@ class acp_profile
$sql = 'SELECT lang_id, lang_iso
FROM ' . LANG_TABLE . "
- WHERE lang_iso <> '" . $config['default_lang'] . "'";
+ WHERE lang_iso <> '" . $config['default_lang'] . "'
+ ORDER BY lang_english_name";
$result = $db->sql_query($sql);
$languages = array();
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index adc5064b67..d89cf53d78 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -192,6 +192,12 @@ class acp_users
case 'banuser':
case 'banemail':
case 'banip':
+
+ if ($user_id == $user->data['user_id'])
+ {
+ trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id));
+ }
+
$ban = array();
switch ($action)
@@ -238,6 +244,11 @@ class acp_users
case 'reactivate':
+ if ($user_id == $user->data['user_id'])
+ {
+ trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id));
+ }
+
if ($config['email_enable'])
{
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
@@ -287,6 +298,12 @@ class acp_users
case 'active':
+ if ($user_id == $user->data['user_id'])
+ {
+ // It is only deactivation since the user is already activated (else he would not have reached this page)
+ trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id));
+ }
+
user_active_flip($user_id, $user_row['user_type'], false, $user_row['username']);
$message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
@@ -749,11 +766,19 @@ class acp_users
}
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
- $quick_tool_ary = array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP', 'active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'), 'delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
-
- if ($config['email_enable'])
+
+ if ($user_id == $user->data['user_id'])
{
- $quick_tool_ary['reactivate'] = 'FORCE';
+ $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
+ }
+ else
+ {
+ $quick_tool_ary = array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP', 'active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'), 'delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
+
+ if ($config['email_enable'])
+ {
+ $quick_tool_ary['reactivate'] = 'FORCE';
+ }
}
$s_action_options = '';
@@ -771,6 +796,7 @@ class acp_users
'S_USER_IP' => ($user_row['user_ip']) ? true : false,
'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false,
'S_ACTION_OPTIONS' => $s_action_options,
+ 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false,
'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}",
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 936a543b7d..680d17dd20 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -561,7 +561,7 @@ class bbcode
$code = str_replace(' ', ' ', $code);
// remove newline at the beginning
- if ($code{0} == "\n")
+ if (!empty($code) && $code{0} == "\n")
{
$code = substr($code, 1);
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6ae39be7a9..9096586b33 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -339,9 +339,18 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
}
+ // Admins and mods are allowed to exceed the allowed filesize
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id))
{
- $allowed_filesize = ($extensions[$file->get('extension')]['max_filesize'] != 0) ? $extensions[$file->get('extension')]['max_filesize'] : (($is_message) ? $config['max_filesize_pm'] : $config['max_filesize']);
+ if (!empty($extensions[$file->get('extension')]['max_filesize']))
+ {
+ $allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
+ }
+ else
+ {
+ $allowed_filesize = ($is_message) ? $config['max_filesize_pm'] : $config['max_filesize'];
+ }
+
$file->upload->set_max_filesize($allowed_filesize);
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 0f3cb7ccfc..14ff15c1b2 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -384,10 +384,12 @@ function user_active_flip($user_id, $user_type, $user_actkey = false, $username
WHERE user_id = $user_id";
$result = $db->sql_query($sql);
+ $group_name = ($user_type == USER_NORMAL) ? 'REGISTERED' : 'INACTIVE';
while ($row = $db->sql_fetchrow($result))
{
- if ($group_name = array_search($row['group_id'], $group_id_ary))
+ if ($name = array_search($row['group_id'], $group_id_ary))
{
+ $group_name = $name;
break;
}
}
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php
index cd72917f37..f69f42d393 100644
--- a/phpBB/includes/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php
@@ -29,7 +29,23 @@ function view_folder($id, $mode, $folder_id, $folder)
$icons = array();
$cache->obtain_icons($icons);
- $color_rows = array('marked', 'replied', 'friend', 'foe');
+ $color_rows = array('marked', 'replied');
+
+ // only show the friend/foe color rows if the module is enabled
+ $zebra_enabled = false;
+
+ $_module = new p_master();
+ $_module->list_modules('ucp');
+ $_module->set_active('zebra');
+
+ $zebra_enabled = ($_module->active_module === false) ? false : true;
+
+ unset($_module);
+
+ if ($zebra_enabled)
+ {
+ $color_rows = array_merge($color_rows, array('friend', 'foe'));
+ }
foreach ($color_rows as $var)
{
diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php
index 52bff60476..6398ff8f70 100644
--- a/phpBB/language/en/acp/users.php
+++ b/phpBB/language/en/acp/users.php
@@ -34,9 +34,12 @@ $lang = array_merge($lang, array(
'BAN_SUCCESSFUL' => 'Ban entered successfully',
- 'CANNOT_REMOVE_ANONYMOUS' => 'You are not able to remove the guest user account.',
- 'CANNOT_REMOVE_YOURSELF' => 'You are not allowed to remove your own user account.',
- 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing the users email address.',
+ 'CANNOT_BAN_YOURSELF' => 'You are not allowed to ban yourself.',
+ 'CANNOT_DEACTIVATE_YOURSELF' => 'You are not allowed to deactivate your own account.',
+ 'CANNOT_FORCE_REACT_YOURSELF' => 'You are not allowed to force reactivation of your own account.',
+ 'CANNOT_REMOVE_ANONYMOUS' => 'You are not able to remove the guest user account.',
+ 'CANNOT_REMOVE_YOURSELF' => 'You are not allowed to remove your own user account.',
+ 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing the users email address.',
'DELETE_POSTS' => 'Delete posts',
'DELETE_USER' => 'Delete user',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index db47ce98fd..dceef08a98 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -566,25 +566,13 @@ if ($submit || $preview || $refresh)
if ($poll_delete && $mode == 'edit' && sizeof($post_data['poll_options']) &&
((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
{
- switch (SQL_LAYER)
- {
- case 'mysql4':
- case 'mysqli':
- $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
- WHERE topic_id = $topic_id";
- $db->sql_query($sql);
- break;
+ $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
- default:
- $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . "
- WHERE topic_id = $topic_id";
- $db->sql_query($sql);
-
- $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
- WHERE topic_id = $topic_id";
- $db->sql_query($sql);
- break;
- }
+ $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
$topic_sql = array(
'poll_title' => '',
diff --git a/phpBB/styles/subSilver/template/attachment.html b/phpBB/styles/subSilver/template/attachment.html
index 65d32a5932..6c2c9e04e6 100644
--- a/phpBB/styles/subSilver/template/attachment.html
+++ b/phpBB/styles/subSilver/template/attachment.html
@@ -33,10 +33,10 @@
-
-
-
-
+
+
+
+
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 0b84057784..4b7075fbf4 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -384,13 +384,43 @@ $sql_array = array(
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
+$shadow_topic_list = array();
while ($row = $db->sql_fetchrow($result))
{
+ if ($row['topic_status'] == ITEM_MOVED)
+ {
+ $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id'];
+ }
+
$rowset[$row['topic_id']] = $row;
$topic_list[] = $row['topic_id'];
}
$db->sql_freeresult($result);
+// If we have some shadow topics, update the rowset to reflect their topic informations
+if (sizeof($shadow_topic_list))
+{
+ $sql = 'SELECT *
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_id IN (' . implode(', ', array_keys($shadow_topic_list)) . ')';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $orig_topic_id = $shadow_topic_list[$row['topic_id']];
+
+ // We want to retain some values
+ $row = array_merge($row, array(
+ 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'],
+ 'topic_status' => $rowset[$orig_topic_id]['topic_status'])
+ );
+
+ $rowset[$orig_topic_id] = $row;
+ }
+ $db->sql_freeresult($result);
+}
+unset($shadow_topic_list);
+
$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list);
$topic_tracking_info = $tracking_topics = array();
@@ -406,7 +436,7 @@ if (sizeof($topic_list))
$topic_forum_list = array();
foreach ($rowset as $t_id => $row)
{
- $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
+ $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered']) ? $row['forum_mark_time'] : 0;
$topic_forum_list[$row['forum_id']]['topics'][] = $t_id;
}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 4a8570f762..ccc17c7f6e 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -390,6 +390,12 @@ if ($hilit_words)
$highlight = urlencode($hilit_words);
}
+// Make sure $start is set to the last page if it exceeds the amount
+if ($start < 0 || $start > $total_posts)
+{
+ $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
+}
+
// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : ''));