fix some bugs... again. :)

git-svn-id: file:///svn/phpbb/trunk@6165 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-07-10 15:55:10 +00:00
parent 0fa9103a0c
commit 4f7c52e9e3
14 changed files with 168 additions and 69 deletions

View file

@ -134,11 +134,13 @@
<dt><label for="quicktools">{L_QUICK_TOOLS}:</label></dt>
<dd><select id="quicktools" name="action">{S_ACTION_OPTIONS}</select></dd>
</dl>
<dl>
<dt><label for="delete_user">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" name="delete" value="1" /></dd>
<dd><select id="delete_user" name="delete_type"><option value="retain">{L_RETAIN_POSTS}</option><option value="remove">{L_DELETE_POSTS}</option></select></dd>
</dl>
<!-- IF not S_OWN_ACCOUNT -->
<dl>
<dt><label for="delete_user">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt>
<dd><input type="checkbox" class="radio" name="delete" value="1" /></dd>
<dd><select id="delete_user" name="delete_type"><option value="retain">{L_RETAIN_POSTS}</option><option value="remove">{L_DELETE_POSTS}</option></select></dd>
</dl>
<!-- ENDIF -->
<!-- ENDIF -->
</fieldset>

View file

@ -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 .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>';
$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 .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>';
}
}
$i = 0;

View file

@ -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();

View file

@ -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();

View file

@ -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 . '&amp;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 . '&amp;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 . '&amp;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 = '<option class="sep" value="">' . $user->lang['SELECT_OPTION'] . '</option>';
@ -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 . "&amp;u=$user_id&amp;ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
'U_WHOIS' => $this->u_action . "&amp;action=whois&amp;user_ip={$user_row['user_ip']}",

View file

@ -561,7 +561,7 @@ class bbcode
$code = str_replace(' ', ' &nbsp;', $code);
// remove newline at the beginning
if ($code{0} == "\n")
if (!empty($code) && $code{0} == "\n")
{
$code = substr($code, 1);
}

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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)
{

View file

@ -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',

View file

@ -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' => '',

View file

@ -33,10 +33,10 @@
<param name="ShowControls" value="1">
<param name="ShowDisplay" value="0">
<param name="ShowStatusBar" value="1">
<param name="AutoSize" value="1">
<param name="AutoStart" value="0">
<param name="Visible" value="1">
<param name="AnimationStart" value="0">
<param name="AutoSize" value="1">
<param name="AutoStart" value="0">
<param name="Visible" value="1">
<param name="AnimationStart" value="0">
<param name="Loop" value="0">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="{_file.U_DOWNLOAD_LINK}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 autostart=0 visible=1 animationatstart=0 loop=0></embed>
</object>

View file

@ -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;
}

View file

@ -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&amp;t=$topic_id&amp;start=$start&amp;$u_sort_param" . (($highlight_match) ? "&amp;hilit=$highlight" : ''));