aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-07-10 15:55:10 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-07-10 15:55:10 +0000
commit4f7c52e9e385041320179dcb7d27a9217a353c71 (patch)
treebcab21e9174983a19f2c6256b36435ffb56ad080 /phpBB/includes
parentChanged: being anal with the notation of Unicode codepoints (diff)
downloadphpbb-4f7c52e9e385041320179dcb7d27a9217a353c71.tar.gz
phpbb-4f7c52e9e385041320179dcb7d27a9217a353c71.tar.bz2
phpbb-4f7c52e9e385041320179dcb7d27a9217a353c71.zip
fix some bugs... again. :)
git-svn-id: file:///svn/phpbb/trunk@6165 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_attachments.php33
-rw-r--r--phpBB/includes/acp/acp_language.php21
-rw-r--r--phpBB/includes/acp/acp_profile.php19
-rw-r--r--phpBB/includes/acp/acp_users.php34
-rw-r--r--phpBB/includes/bbcode.php2
-rw-r--r--phpBB/includes/functions_posting.php11
-rw-r--r--phpBB/includes/functions_user.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewfolder.php18
8 files changed, 106 insertions, 36 deletions
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)
+
+ $imglist = filelist($phpbb_root_path . $img_path);
+
+ if (sizeof($imglist))
{
- if (!$ext_group_row['upload_icon'])
- {
- $no_image_select = true;
- $selected = '';
- }
- else
+ $imglist = array_values($imglist);
+ $imglist = $imglist[0];
+
+ foreach ($imglist as $key => $img)
{
- $selected = ($ext_group_row['upload_icon'] == $img) ? ' selected="selected"' : '';
- }
+ 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>';
+ $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>';
+ }
}
$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 . '&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']}",
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(' ', ' &nbsp;', $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)
{