diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index afcfd86a38..ad7cff734f 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -239,7 +239,7 @@ class messenger
//
function save_queue()
{
- if ($this->use_queue)
+ if ($config['email_package_size'] && $this->use_queue)
{
$this->queue->save();
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index c2146d2e5a..b9e462e76b 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1267,7 +1267,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
case 'mssql':
case 'sqlite':
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader)
- " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $leader)", $add_id_ary));
+ VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $leader)", $add_id_ary));
$db->sql_query($sql);
break;
@@ -1677,26 +1677,58 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
}
/**
-* Obtain either the members of a specified group or the groups to
-* which the specified users are members
+* Obtain either the members of a specified group, the groups the specified user is subscribed to
+* or checking if a specified user is in a specified group
+*
+* Note: Extend select statement as needed
+* Note2: Never use this more than once... first group your users/groups
*/
-function group_memberships($group_id = false, $user_id_ary = false)
+function group_memberships($group_id_ary = false, $user_id_ary = false, $return_bool = false)
{
global $db;
- if (!$group_id && !$user_id_ary)
+ if (!$group_id_ary && !$user_id_ary)
{
return true;
}
- if ($group_id)
+ $sql = 'SELECT group_id, user_id
+ FROM ' . USER_GROUP_TABLE . '
+ WHERE ';
+
+ if ($group_id_ary && $user_id_ary)
{
+ $sql .= " group_id " . ((is_array($group_id_ary)) ? ' IN (' . implode(', ', $group_id_ary) . ')' : " = $group_id_ary") . "
+ AND user_id " . ((is_array($user_id_ary)) ? ' IN (' . implode(', ', $user_id_ary) . ')' : " = $user_id_ary");
+ }
+ else if ($group_id)
+ {
+ $sql .= " group_id " . ((is_array($group_id_ary)) ? ' IN (' . implode(', ', $group_id_ary) . ')' : " = $group_id_ary");
}
else if ($user_id_ary)
{
+ $sql .= " user_id " . ((is_array($user_id_ary)) ? ' IN (' . implode(', ', $user_id_ary) . ')' : " = $user_id_ary");
+ }
+
+ $result = ($return_bool) ? $db->sql_query_limit($sql, 1) : $db->sql_query($sql);
+
+ $row = $db->sql_fetchrow($result);
+
+ if ($return_bool)
+ {
+ $db->sql_freeresult($result);
+ return ($row) ? true : false;
}
- return false;
+ $result = array();
+
+ do
+ {
+ $result[] = $row;
+ }
+ while ($row = $db->sql_fetchrow($result));
+
+ return $result;
}
?>
\ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 29094ae631..6a6309d713 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -524,7 +524,13 @@ function mcp_move_topic($topic_ids)
else
{
meta_refresh(3, $redirect);
- trigger_error($user->lang[$success_msg] . '
' . sprintf($user->lang['RETURN_PAGE'], '', '') . '
' . sprintf($user->lang['RETURN_NEW_FORUM'], '', ''));
+
+ $message = $user->lang[$success_msg];
+ $message .= '
' . sprintf($user->lang['RETURN_PAGE'], '', '');
+ $message .= '
' . sprintf($user->lang['RETURN_FORUM'], "", '');
+ $message .= '
' . sprintf($user->lang['RETURN_NEW_FORUM'], "", '');
+
+ trigger_error($message);
}
}
@@ -629,9 +635,16 @@ function mcp_delete_post($post_ids)
$affected_topics = sizeof($topic_id_list);
$db->sql_freeresult($result);
+ $post_data = get_post_data($post_ids);
+
+ foreach ($post_data as $id => $row)
+ {
+ add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject']);
+ }
+
// Now delete the posts, topics and forums are automatically resync'ed
delete_posts('post_id', $post_ids);
-
+
$sql = 'SELECT COUNT(topic_id) AS topics_left
FROM ' . TOPICS_TABLE . '
WHERE topic_id IN (' . implode(', ', $topic_id_list) . ')';
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 5d695cc733..fda39ae0ed 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -335,30 +335,34 @@ if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['
if (confirm_box(true))
{
$data = array(
- 'topic_first_post_id' => $topic_first_post_id,
- 'topic_last_post_id' => $topic_last_post_id,
- 'topic_approved' => $topic_approved,
- 'topic_type' => $topic_type,
- 'post_approved' => $post_approved,
- 'post_time' => $post_time,
- 'poster_id' => $poster_id
+ 'topic_first_post_id' => $topic_first_post_id,
+ 'topic_last_post_id' => $topic_last_post_id,
+ 'topic_approved' => $topic_approved,
+ 'topic_type' => $topic_type,
+ 'post_approved' => $post_approved,
+ 'post_time' => $post_time,
+ 'poster_id' => $poster_id
);
$next_post_id = delete_post($mode, $post_id, $topic_id, $forum_id, $data);
if ($topic_first_post_id == $topic_last_post_id)
{
- $meta_info = "viewforum.$phpEx$SID&f=$forum_id";
+ add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $topic_title);
+
+ $meta_info = "{$phpbb_root_path}viewforum.$phpEx$SID&f=$forum_id";
$message = $user->lang['POST_DELETED'];
}
else
{
- $meta_info = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&p=$next_post_id#$next_post_id";
- $message = $user->lang['POST_DELETED'] . '
' . sprintf($user->lang['RETURN_TOPIC'], "", '');
+ add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_subject);
+
+ $meta_info = "{$phpbb_root_path}viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&p=$next_post_id#$next_post_id";
+ $message = $user->lang['POST_DELETED'] . '
' . sprintf($user->lang['RETURN_TOPIC'], "", '');
}
meta_refresh(3, $meta_info);
- $message .= '
' . sprintf($user->lang['RETURN_FORUM'], "", '');
+ $message .= '
' . sprintf($user->lang['RETURN_FORUM'], "", '');
trigger_error($message);
}
else