1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

- fixed a few smaller things

git-svn-id: file:///svn/phpbb/trunk@5952 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-05-20 18:39:35 +00:00
parent 037f0bf4da
commit 5029170afb
28 changed files with 118 additions and 106 deletions

View File

@@ -187,7 +187,7 @@ class cache extends acm
AND g.allow_group = 1';
$result = $db->sql_query($sql);
$extensions = array();
$extensions = array('_allowed_' => array());
while ($row = $db->sql_fetchrow($result))
{
$extension = strtolower(trim($row['extension']));

View File

@@ -36,8 +36,8 @@ class acp_email
{
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$subject = html_entity_decode(request_var('subject', '', true));
$message = html_entity_decode(request_var('message', '', true));
$subject = request_var('subject', '', true);
$message = request_var('message', '', true);
$use_queue = (isset($_POST['send_immediatly'])) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
@@ -150,14 +150,14 @@ class acp_email
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->subject($subject);
$messenger->subject(html_entity_decode($subject));
$messenger->replyto($config['board_email']);
$messenger->set_mail_priority($priority);
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'CONTACT_EMAIL' => $config['board_contact'],
'MESSAGE' => $message)
'MESSAGE' => html_entity_decode($message))
);
if (!($messenger->send($used_method)))
@@ -216,8 +216,8 @@ class acp_email
'S_GROUP_OPTIONS' => $select_list,
'USERNAMES' => $usernames,
'U_FIND_USERNAME' => $phpbb_root_path . "memberlist.$phpEx$SID&mode=searchuser&form=acp_email&field=usernames",
'SUBJECT' => request_var('subject', '', true),
'MESSAGE' => request_var('message', '', true),
'SUBJECT' => $subject,
'MESSAGE' => $message,
'S_PRIORITY_OPTIONS' => $s_priority_options)
);

View File

@@ -127,7 +127,7 @@ class acp_main
$messenger->assign_vars(array(
'EMAIL_SIG' => $sig,
'USERNAME' => $row['username'],
'USERNAME' => html_entity_decode($row['username']),
'SITENAME' => $config['sitename'],
'REGISTER_DATE' => $user->format_date($row['user_regdate']),

View File

@@ -263,7 +263,7 @@ class acp_users
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']),
'USERNAME' => $user_row['username'],
'USERNAME' => html_entity_decode($user_row['username']),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
@@ -1277,7 +1277,7 @@ class acp_users
{
$data['user_id'] = $user_id;
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload)
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload && $config['allow_avatar_upload'])
{
list($type, $filename, $width, $height) = avatar_upload($data, $error);
}
@@ -1347,6 +1347,8 @@ class acp_users
// Generate users avatar
if ($user_row['user_avatar'])
{
$avatar_img = '';
switch ($user_row['user_avatar_type'])
{
case AVATAR_UPLOAD:
@@ -1357,8 +1359,8 @@ class acp_users
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $user_row['user_avatar'];
$avatar_img .= $user_row['user_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="" />';
}
else
@@ -1375,7 +1377,8 @@ class acp_users
$template->assign_vars(array(
'S_AVATAR' => true,
'S_CAN_UPLOAD' => $can_upload,
'S_CAN_UPLOAD' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
'S_ALLOW_REMOTE' => ($config['allow_avatar_remote']) ? true : false,
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,

View File

@@ -682,15 +682,27 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
global $user, $db, $template, $auth;
global $phpbb_root_path, $phpEx, $SID;
$topic_ids = $draft_rows = array();
$topic_ids = $forum_ids = $draft_rows = array();
// Load those drafts not connected to forums/topics
// If forum_id == 0 AND topic_id == 0 then this is a PM draft
$sql = 'SELECT *
FROM ' . DRAFTS_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND (forum_id = 0 OR topic_id = 0)
ORDER BY save_time DESC';
if (!$topic_id && !$forum_id)
{
$sql_and = 'AND d.forum_id = 0 AND d.topic_id = 0';
}
else
{
$sql_and = '';
$sql_and .= ($forum_id) ? 'AND d.forum_id = ' . $forum_id : '';
$sql_and .= ($topic_id) ? 'AND d.topic_id = ' . $topic_id : '';
}
$sql = 'SELECT d.*, f.forum_id, f.forum_name
FROM ' . DRAFTS_TABLE . ' d
LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = d.forum_id)
WHERE d.user_id = ' . $user->data['user_id'] . "
$sql_and
ORDER BY d.save_time DESC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -703,35 +715,12 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
}
$db->sql_freeresult($result);
// Only those fitting into this forum now...
if ($forum_id || $topic_id)
{
$sql = 'SELECT d.draft_id, d.topic_id, d.forum_id, d.draft_subject, d.save_time, f.forum_name
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
WHERE d.user_id = ' . $user->data['user_id'] . '
AND d.forum_id = f.forum_id ' .
(($forum_id) ? " AND d.forum_id = $forum_id" : '') . '
ORDER BY d.save_time DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($row['topic_id'])
{
$topic_ids[] = (int) $row['topic_id'];
}
$draft_rows[] = $row;
}
$db->sql_freeresult($result);
}
if (!sizeof($draft_rows))
{
return;
}
$topic_rows = array();
if (sizeof($topic_ids))
{
$sql = 'SELECT topic_id, forum_id, topic_title
@@ -746,7 +735,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
$db->sql_freeresult($result);
}
unset($topic_ids);
$template->assign_var('S_SHOW_DRAFTS', true);
foreach ($draft_rows as $draft)

View File

@@ -1462,9 +1462,9 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
$messenger->assign_vars(array(
'EMAIL_SIG' => $email_sig,
'SITENAME' => $config['sitename'],
'SUBJECT' => $subject,
'AUTHOR_NAME' => $author,
'USERNAME' => $addr['name'],
'SUBJECT' => html_entity_decode($subject),
'AUTHOR_NAME' => html_entity_decode($author),
'USERNAME' => html_entity_decode($addr['name']),
'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&folder=inbox")
);

View File

@@ -307,7 +307,7 @@ class filespec
if (!$this->upload->valid_dimensions($this))
{
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, $this->upload->max_height);
$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, $this->upload->max_height, $this->width, $this->height);
}
}
}

View File

@@ -982,25 +982,38 @@ function avatar_remote($data, &$error)
return false;
}
if ((!($data['width'] || $data['height']) || $data['remotelink'] != $user->data['user_avatar']) && ($config['avatar_max_width'] || $config['avatar_max_height']))
// Make sure getimagesize works...
if (($image_data = @getimagesize($data['remotelink'])) === false)
{
list($width, $height) = @getimagesize($data['remotelink']);
$error[] = $user->lang['AVATAR_URL_INVALID'];
return false;
}
if (!$width || !$height)
$width = ($data['width'] && $data['height']) ? $data['width'] : $image_data[0];
$height = ($data['width'] && $data['height']) ? $data['height'] : $image_data[1];
if (!$width || !$height)
{
$error[] = $user->lang['AVATAR_NO_SIZE'];
return false;
}
if ($config['avatar_max_width'] || $config['avatar_max_height'])
{
if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
{
$error[] = $user->lang['AVATAR_NO_SIZE'];
return false;
}
else if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height']);
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height);
return false;
}
}
else if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
if ($config['avatar_min_width'] || $config['avatar_min_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height']);
return false;
if ($width < $config['avatar_min_width'] || $height < $config['avatar_min_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height);
return false;
}
}
return array(AVATAR_REMOTE, $data['remotelink'], $width, $height);

View File

@@ -116,7 +116,7 @@ function mcp_notes_user_view($id, $mode, $action)
add_log('admin', 'LOG_CLEAR_USER', $userrow['username']);
$msg = ($deletemark) ? 'MARKED_DELETED' : 'ALL_DELETED';
$msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED';
$redirect = "mcp.$phpEx$SID&amp;i=$id&amp;mode=$mode&amp;u=$user_id";
meta_refresh(2, $redirect);
trigger_error($user->lang[$msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));

View File

@@ -458,12 +458,12 @@ function approve_post($post_id_list, $mode)
$messenger->assign_vars(array(
'EMAIL_SIG' => $email_sig,
'SITENAME' => $config['sitename'],
'USERNAME' => $post_data['username'],
'POST_SUBJECT' => censor_text($post_data['post_subject']),
'TOPIC_TITLE' => censor_text($post_data['topic_title']),
'USERNAME' => html_entity_decode($post_data['username']),
'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])),
'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title'])),
'U_VIEW_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&e=0",
'U_VIEW_POST' => "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&e=0",
'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
);
$messenger->send($post_data['user_notify_type']);
@@ -550,6 +550,7 @@ function disapprove_post($post_id_list, $mode)
);
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
$disapprove_reason = '';
if ($reason_id)
{
@@ -569,8 +570,7 @@ function disapprove_post($post_id_list, $mode)
{
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
$disapprove_reason = ($row['reason_title'] != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : '';
$disapprove_reason .= ($reason) ? "\n\n" . $_REQUEST['reason'] : '';
unset($reason);
$disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
}
}
@@ -671,10 +671,10 @@ function disapprove_post($post_id_list, $mode)
$messenger->assign_vars(array(
'EMAIL_SIG' => $email_sig,
'SITENAME' => $config['sitename'],
'USERNAME' => $post_data['username'],
'REASON' => $disapprove_reason,
'POST_SUBJECT' => censor_text($post_data['post_subject']),
'TOPIC_TITLE' => censor_text($post_data['topic_title']))
'USERNAME' => html_entity_decode($post_data['username']),
'REASON' => html_entity_decode($disapprove_reason),
'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])),
'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title'])))
);
$messenger->send($post_data['user_notify_type']);

View File

@@ -461,10 +461,10 @@ function close_report($post_id_list, $mode, $action)
$messenger->assign_vars(array(
'EMAIL_SIG' => $email_sig,
'SITENAME' => $config['sitename'],
'USERNAME' => $reporter['username'],
'CLOSER_NAME' => $user->data['username'],
'POST_SUBJECT' => censor_text($post_info[$post_id]['post_subject']),
'TOPIC_TITLE' => censor_text($post_info[$post_id]['topic_title']))
'USERNAME' => html_entity_decode($reporter['username']),
'CLOSER_NAME' => html_entity_decode($user->data['username']),
'POST_SUBJECT' => html_entity_decode(censor_text($post_info[$post_id]['post_subject'])),
'TOPIC_TITLE' => html_entity_decode(censor_text($post_info[$post_id]['topic_title'])))
);
$messenger->send($reporter['user_notify_type']);

View File

@@ -87,7 +87,7 @@ class ucp_activate
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'USERNAME' => $row['username'],
'USERNAME' => html_entity_decode($row['username']),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))
);

View File

@@ -176,8 +176,8 @@ class ucp_groups
$messenger->assign_vars(array(
'EMAIL_SIG' => $email_sig,
'SITENAME' => $config['sitename'],
'USERNAME' => $row['username'],
'GROUP_NAME' => $group_row[$group_id]['group_name'],
'USERNAME' => html_entity_decode($row['username']),
'GROUP_NAME' => html_entity_decode($group_row[$group_id]['group_name']),
'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=usergroups&mode=manage",
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")

View File

@@ -604,6 +604,7 @@ class ucp_main
case 'drafts':
$pm_drafts = ($this->p_master->p_name == 'pm') ? true : false;
$template->assign_var('S_SHOW_DRAFTS', true);
$user->add_lang('posting');

View File

@@ -332,7 +332,8 @@ function compose_pm($id, $mode, $action)
{
$sql = 'SELECT draft_id
FROM ' . DRAFTS_TABLE . '
WHERE (forum_id = 0 AND topic_id = 0)
WHERE forum_id = 0
AND topic_id = 0
AND user_id = ' . $user->data['user_id'] .
(($draft_id) ? " AND draft_id <> $draft_id" : '');
$result = $db->sql_query_limit($sql, 1);
@@ -397,7 +398,7 @@ function compose_pm($id, $mode, $action)
if ($row = $db->sql_fetchrow($result))
{
$_REQUEST['subject'] = $row['draft_subject'];
$_POST['message'] = $row['draft_message'];
$_REQUEST['message'] = $row['draft_message'];
$refresh = true;
$template->assign_var('S_DRAFT_LOADED', true);
}

View File

@@ -136,7 +136,7 @@ class ucp_profile
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'USERNAME' => $username,
'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
@@ -162,7 +162,7 @@ class ucp_profile
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => $username,
'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")

View File

@@ -327,8 +327,8 @@ class ucp_register
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']),
'USERNAME' => $username,
'PASSWORD' => $password_confirm,
'USERNAME' => html_entity_decode($username),
'PASSWORD' => html_entity_decode($password_confirm),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
@@ -365,7 +365,7 @@ class ucp_register
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => $username,
'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")

View File

@@ -69,8 +69,8 @@ class ucp_remind
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'USERNAME' => $username,
'PASSWORD' => $user_password,
'USERNAME' => html_entity_decode($username),
'PASSWORD' => html_entity_decode($user_password),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")

View File

@@ -79,7 +79,7 @@ class ucp_resend
$messenger->assign_vars(array(
'SITENAME' => $config['sitename'],
'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']),
'USERNAME' => $row['username'],
'USERNAME' => html_entity_decode($row['username']),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$row['user_id']}&k={$row['user_actkey']}")
@@ -117,7 +117,7 @@ class ucp_resend
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array(
'USERNAME' => $row['username'],
'USERNAME' => html_entity_decode($row['username']),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$row['user_id']}&k={$row['user_actkey']}")