1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 08:47:45 +02:00

Some changes... non-invasive...

git-svn-id: file:///svn/phpbb/trunk@8025 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-08-13 12:14:07 +00:00
parent 11f05e3513
commit e9188d4e05
31 changed files with 250 additions and 187 deletions

View File

@@ -279,7 +279,7 @@ class acp_bots
$cache->destroy('_bots');
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"));
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));
}
}
@@ -376,14 +376,19 @@ class acp_bots
$db->sql_freeresult($result);
}
/**
* Validate bot name against username table
*/
function validate_botname($newname, $oldname = false)
{
global $db;
if ($oldname && utf8_clean_string($newname) === $oldname)
{
return true;
}
// Admins might want to use names otherwise forbidden, thus we only check for duplicates.
// Admins might want to use names otherwise forbidden, thus we only check for duplicates.
$sql = 'SELECT username
FROM ' . USERS_TABLE . "
WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($newname)) . "'";
@@ -391,14 +396,7 @@ class acp_bots
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
return false;
}
else
{
return true;
}
return ($row) ? false : true;
}
}

View File

@@ -120,10 +120,10 @@ class acp_users
WHERE module_basename = 'users'
AND module_enabled = 1
AND module_class = 'acp'
GROUP BY module_mode, module_auth
ORDER BY MIN(left_id)";
ORDER BY left_id, module_mode";
$result = $db->sql_query($sql);
$dropdown_modes = array();
while ($row = $db->sql_fetchrow($result))
{
if (!$this->p_master->module_auth($row['module_auth']))
@@ -131,11 +131,16 @@ class acp_users
continue;
}
$selected = ($mode == $row['module_mode']) ? ' selected="selected"' : '';
$s_form_options .= '<option value="' . $row['module_mode'] . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($row['module_mode'])] . '</option>';
$dropdown_modes[$row['module_mode']] = true;
}
$db->sql_freeresult($result);
foreach ($dropdown_modes as $module_mode => $null)
{
$selected = ($mode == $module_mode) ? ' selected="selected"' : '';
$s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>';
}
$template->assign_vars(array(
'U_BACK' => $this->u_action,
'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;u=$user_id"),

View File

@@ -3692,6 +3692,15 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false)
{
// flush the content, else we get a white page if output buffering is on
if ($config['gzip_compress'])
{
if (@extension_loaded('zlib') && !headers_sent())
{
ob_end_flush();
}
}
// remove complete path to installation, with the risk of changing backslashes meant to be there
$errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);

View File

@@ -416,7 +416,7 @@ class jabber
}
// Let's use TLS if SSL is not enabled and we can actually use it
if (!$this->session['ssl'] && $this->can_use_tls() && isset($xml['stream:features'][0]['#']['starttls']))
if (!$this->session['ssl'] && $this->can_use_tls() && $this->can_use_ssl() && isset($xml['stream:features'][0]['#']['starttls']))
{
$this->add_to_log('Switching to TLS.');
$this->send("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>\n");

View File

@@ -575,6 +575,12 @@ class queue
$package_size = $data_ary['package_size'];
$num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size;
// If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs...
if (sizeof($data_ary['data']) > $package_size * 2.5)
{
$num_items = sizeof($data_ary['data']);
}
switch ($object)
{
case 'email':

View File

@@ -364,6 +364,7 @@ class p_master
$this->p_mode = $item_ary['mode'];
$this->p_left = $item_ary['left'];
$this->p_right = $item_ary['right'];
$this->p_icat = $icat;
$this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id];
$this->active_module = $item_ary['id'];

View File

@@ -1250,8 +1250,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
'TOPIC_TITLE' => htmlspecialchars_decode($topic_title),
'FORUM_NAME' => htmlspecialchars_decode($forum_name),
'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&e=0",
'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&e=0",
'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id",
'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id",
'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id",
'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&unwatch=topic",
'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&unwatch=forum",

View File

@@ -1684,4 +1684,145 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
unset($messenger);
}
/**
* Display Message History
*/
function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false)
{
global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode;
// Get History Messages (could be newer)
$sql = 'SELECT t.*, p.*, u.*
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE t.msg_id = p.msg_id
AND p.author_id = u.user_id
AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ")
AND t.user_id = $user_id";
if (!$message_row['root_level'])
{
$sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))";
}
else
{
$sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')';
}
$sql .= ' ORDER BY p.message_time DESC';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!$row)
{
$db->sql_freeresult($result);
return false;
}
$rowset = array();
$bbcode_bitfield = '';
$folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&amp;folder=';
do
{
$folder_id = (int) $row['folder_id'];
$row['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
if (isset($rowset[$row['msg_id']]))
{
$rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
}
else
{
$rowset[$row['msg_id']] = $row;
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
}
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
$title = $row['message_subject'];
if (sizeof($rowset) == 1 && !$in_post_mode)
{
return false;
}
// Instantiate BBCode class
if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '')
{
if (!class_exists('bbcode'))
{
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
}
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$title = censor_text($title);
$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');
$next_history_pm = $previous_history_pm = $prev_id = 0;
foreach ($rowset as $id => $row)
{
$author_id = $row['author_id'];
$folder_id = (int) $row['folder_id'];
$subject = $row['message_subject'];
$message = $row['message_text'];
$message = censor_text($message);
$message = str_replace("\n", '<br />', $message);
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = smiley_text($message, !$row['enable_smilies']);
$subject = censor_text($subject);
if ($id == $msg_id)
{
$next_history_pm = next($rowset);
$next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0;
$previous_history_pm = $prev_id;
}
$template->assign_block_vars('history_row', array(
'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']),
'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']),
'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']),
'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']),
'SUBJECT' => $subject,
'SENT_DATE' => $user->format_date($row['message_time']),
'MESSAGE' => $message,
'FOLDER' => implode(', ', $row['folder']),
'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id),
'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false,
'S_IN_POST_MODE' => $in_post_mode,
'MSG_ID' => $row['msg_id'],
'U_VIEW_MESSAGE' => "$url&amp;f=$folder_id&amp;p=" . $row['msg_id'],
'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '',
'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=reply&amp;f=$folder_id&amp;p=" . $row['msg_id'] : '')
);
unset($rowset[$id]);
$prev_id = $id;
}
$template->assign_vars(array(
'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']),
'HISTORY_TITLE' => $title,
'U_VIEW_NEXT_HISTORY' => "$url&amp;p=" . (($next_history_pm) ? $next_history_pm : $msg_id),
'U_VIEW_PREVIOUS_HISTORY' => "$url&amp;p=" . (($previous_history_pm) ? $previous_history_pm : $msg_id))
);
return true;
}
?>

View File

@@ -976,6 +976,15 @@ function compose_pm($id, $mode, $action)
{
posting_gen_attachment_entry($attachment_data, $filename_data);
}
// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward')
{
if (message_history($msg_id, $user->data['user_id'], $post, array(), true))
{
$template->assign_var('S_DISPLAY_HISTORY', true);
}
}
}
/**

View File

@@ -230,146 +230,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
}
}
/**
* Display Message History
*/
function message_history($msg_id, $user_id, $message_row, $folder)
{
global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode;
// Get History Messages (could be newer)
$sql = 'SELECT t.*, p.*, u.*
FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE t.msg_id = p.msg_id
AND p.author_id = u.user_id
AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ")
AND t.user_id = $user_id";
if (!$message_row['root_level'])
{
$sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))";
}
else
{
$sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')';
}
$sql .= ' ORDER BY p.message_time DESC';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!$row)
{
$db->sql_freeresult($result);
return false;
}
$rowset = array();
$bbcode_bitfield = '';
$folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&amp;folder=';
do
{
$folder_id = (int) $row['folder_id'];
$row['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
if (isset($rowset[$row['msg_id']]))
{
$rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
}
else
{
$rowset[$row['msg_id']] = $row;
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
}
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
$title = $row['message_subject'];
if (sizeof($rowset) == 1)
{
return false;
}
// Instantiate BBCode class
if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '')
{
if (!class_exists('bbcode'))
{
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
}
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$title = censor_text($title);
$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');
$next_history_pm = $previous_history_pm = $prev_id = 0;
foreach ($rowset as $id => $row)
{
$author_id = $row['author_id'];
$folder_id = (int) $row['folder_id'];
$subject = $row['message_subject'];
$message = $row['message_text'];
$message = censor_text($message);
$message = str_replace("\n", '<br />', $message);
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = smiley_text($message, !$row['enable_smilies']);
$subject = censor_text($subject);
if ($id == $msg_id)
{
$next_history_pm = next($rowset);
$next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0;
$previous_history_pm = $prev_id;
}
$template->assign_block_vars('history_row', array(
'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']),
'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']),
'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']),
'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']),
'SUBJECT' => $subject,
'SENT_DATE' => $user->format_date($row['message_time']),
'MESSAGE' => $message,
'FOLDER' => implode(', ', $row['folder']),
'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id),
'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false,
'MSG_ID' => $row['msg_id'],
'U_VIEW_MESSAGE' => "$url&amp;f=$folder_id&amp;p=" . $row['msg_id'],
'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '',
'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=reply&amp;f=$folder_id&amp;p=" . $row['msg_id'] : '')
);
unset($rowset[$id]);
$prev_id = $id;
}
$template->assign_vars(array(
'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']),
'TITLE' => $title,
'U_VIEW_NEXT_HISTORY' => "$url&amp;p=" . (($next_history_pm) ? $next_history_pm : $msg_id),
'U_VIEW_PREVIOUS_HISTORY' => "$url&amp;p=" . (($previous_history_pm) ? $previous_history_pm : $msg_id))
);
return true;
}
/**
* Get user information (only for message display)
*/