aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2008-11-13 13:04:54 +0000
committerChris Smith <toonarmy@phpbb.com>2008-11-13 13:04:54 +0000
commitef0c0d4c82dadfb856357f6ae906263420d84791 (patch)
treeb3df38203ab6a4f77e493bd9eb74623655e23ce9 /phpBB/includes/mcp
parent1739da933574ff2cd68120d7c6ac0dae914943a6 (diff)
downloadforums-ef0c0d4c82dadfb856357f6ae906263420d84791.tar
forums-ef0c0d4c82dadfb856357f6ae906263420d84791.tar.gz
forums-ef0c0d4c82dadfb856357f6ae906263420d84791.tar.bz2
forums-ef0c0d4c82dadfb856357f6ae906263420d84791.tar.xz
forums-ef0c0d4c82dadfb856357f6ae906263420d84791.zip
been a while :( ... merge in r8997, r8998, r8999, r9000, r9001, r9002, r9003, r9004, r9005, r9007, r9008, r9009, r9010, r9011, r9012, r9013, r9014, r9015, r9022, r9023, r9029, r9030, r9034, r9048, r9049, r9054, r9056
git-svn-id: file:///svn/phpbb/trunk@9064 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r--phpBB/includes/mcp/mcp_forum.php2
-rw-r--r--phpBB/includes/mcp/mcp_front.php15
-rw-r--r--phpBB/includes/mcp/mcp_logs.php2
-rw-r--r--phpBB/includes/mcp/mcp_queue.php11
-rw-r--r--phpBB/includes/mcp/mcp_reports.php11
-rw-r--r--phpBB/includes/mcp/mcp_topic.php10
-rw-r--r--phpBB/includes/mcp/mcp_warn.php42
7 files changed, 85 insertions, 8 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 568239b000..66a2e2ad9d 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -245,7 +245,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
- 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
+ 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
'S_UNREAD_TOPIC' => $unread_topic,
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 4905640754..4b229c616f 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -26,7 +26,7 @@ function mcp_front_view($id, $mode, $action)
// Latest 5 unapproved
if ($module->loaded('queue'))
{
- $forum_list = get_forum_list('m_approve');
+ $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_approve')));
$post_list = array();
$forum_names = array();
@@ -80,7 +80,7 @@ function mcp_front_view($id, $mode, $action)
if ($total)
{
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
+ $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
AND t.topic_id = p.topic_id
@@ -102,12 +102,15 @@ function mcp_front_view($id, $mode, $action)
'U_MCP_TOPIC' => append_sid('mcp', 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'U_FORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '',
'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid('memberlist', 'mode=viewprofile&amp;u=' . $row['poster_id']),
+
+ 'AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
+ 'AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour']),
+ 'AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),
+ 'U_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']),
'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'POST_ID' => $row['post_id'],
'TOPIC_TITLE' => $row['topic_title'],
- 'AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? (($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'],
'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_TIME' => $user->format_date($row['post_time']))
);
@@ -139,7 +142,7 @@ function mcp_front_view($id, $mode, $action)
// Latest 5 reported
if ($module->loaded('reports'))
{
- $forum_list = get_forum_list('m_report');
+ $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_report')));
$template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
@@ -242,7 +245,7 @@ function mcp_front_view($id, $mode, $action)
// Latest 5 logs
if ($module->loaded('logs'))
{
- $forum_list = get_forum_list('m_');
+ $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
if (!empty($forum_list))
{
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index 3816d2eb17..22b413279f 100644
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -62,7 +62,7 @@ class mcp_logs
$this->tpl_name = 'mcp_logs';
$this->page_title = 'MCP_LOGS';
- $forum_list = get_forum_list('m_');
+ $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
$forum_list[] = 0;
$forum_id = $topic_id = 0;
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 3ada0539f1..48bcd044f5 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -242,6 +242,17 @@ class mcp_queue
}
$forum_list_approve = get_forum_list('m_approve', false, true);
+ $forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
+
+ // Remove forums we cannot read
+ foreach ($forum_list_approve as $k => $forum_data)
+ {
+ if (!isset($forum_list_read[$forum_data['forum_id']]))
+ {
+ unset($forum_list_approve[$k]);
+ }
+ }
+ unset($forum_list_read);
if (!$forum_id)
{
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index df6c399abb..7e6bae1dc1 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -246,6 +246,17 @@ class mcp_reports
$forum_info = array();
$forum_list_reports = get_forum_list('m_report', false, true);
+ $forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
+
+ // Remove forums we cannot read
+ foreach ($forum_list_reports as $k => $forum_data)
+ {
+ if (!isset($forum_list_read[$forum_data['forum_id']]))
+ {
+ unset($forum_list_reports[$k]);
+ }
+ }
+ unset($forum_list_read);
if ($topic_id && $forum_id)
{
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 83f2aaf8d1..18aacd53a9 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -113,11 +113,18 @@ function mcp_topic_view($id, $mode, $action)
{
$posts_per_page = $total;
}
+
if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page)
{
$start = 0;
}
+ // Make sure $start is set to the last page if it exceeds the amount
+ if ($start < 0 || $start >= $total)
+ {
+ $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
+ }
+
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
@@ -492,6 +499,9 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$success_msg = 'TOPIC_SPLIT_SUCCESS';
+ // Update forum statistics
+ set_config('num_topics', $config['num_topics'] + 1, true);
+
// Link back to both topics
$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
}
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index 4d38d05b57..d91b8b690a 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -245,6 +245,25 @@ class mcp_warn
$this->u_action .= "&amp;f=$forum_id&amp;p=$post_id";
}
+ // Check if can send a notification
+ if ($config['allow_privmsg'])
+ {
+ $auth2 = new auth();
+ $auth2->acl($user_row);
+ $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
+ unset($auth2);
+ }
+ else
+ {
+ $s_can_notify = false;
+ }
+
+ // Prevent against clever people
+ if ($notify && !$s_can_notify)
+ {
+ $notify = false;
+ }
+
if ($warning && $action == 'add_warning')
{
if (check_form_key('mcp_warn'))
@@ -303,6 +322,8 @@ class mcp_warn
'RANK_IMG' => $rank_img,
'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&amp;p=$post_id#p$post_id"),
+
+ 'S_CAN_NOTIFY' => $s_can_notify,
));
}
@@ -347,6 +368,25 @@ class mcp_warn
$this->u_action .= "&amp;u=$user_id";
}
+ // Check if can send a notification
+ if ($config['allow_privmsg'])
+ {
+ $auth2 = new auth();
+ $auth2->acl($user_row);
+ $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
+ unset($auth2);
+ }
+ else
+ {
+ $s_can_notify = false;
+ }
+
+ // Prevent against clever people
+ if ($notify && !$s_can_notify)
+ {
+ $notify = false;
+ }
+
if ($warning && $action == 'add_warning')
{
if (check_form_key('mcp_warn'))
@@ -385,6 +425,8 @@ class mcp_warn
'AVATAR_IMG' => $avatar_img,
'RANK_IMG' => $rank_img,
+
+ 'S_CAN_NOTIFY' => $s_can_notify,
));
return $user_id;