mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
Desesperatly trying to synchronise my different versions ;)
git-svn-id: file:///svn/phpbb/trunk@3676 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1a7c52fe19
commit
5fde0d061e
@ -56,7 +56,7 @@ if (!empty($load_extensions))
|
||||
}
|
||||
|
||||
// Include files
|
||||
require($phpbb_root_path . 'includes/acm/cache_' . $acm_type . '.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/template.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/session.'.$phpEx);
|
||||
@ -144,7 +144,6 @@ define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
|
||||
define('TOPICS_TABLE', $table_prefix.'topics');
|
||||
define('TOPICS_PREFETCH_TABLE', $table_prefix.'topics_prefetch');
|
||||
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
|
||||
define('UCP_MODULES_TABLE', $table_prefix.'ucp_modules');
|
||||
define('USER_GROUP_TABLE', $table_prefix.'user_group');
|
||||
define('USERS_TABLE', $table_prefix.'users');
|
||||
define('WORDS_TABLE', $table_prefix.'words');
|
||||
|
142
phpBB/mcp.php
142
phpBB/mcp.php
@ -526,8 +526,6 @@ switch ($mode)
|
||||
|
||||
if (count($post_id_list))
|
||||
{
|
||||
$log_mode = 'log_post_approved';
|
||||
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . "
|
||||
SET post_approved = $value
|
||||
WHERE post_id IN (" . implode(', ', $post_id_list) . ')';
|
||||
@ -547,8 +545,6 @@ switch ($mode)
|
||||
}
|
||||
elseif (count($topic_id_list))
|
||||
{
|
||||
$log_mode = 'log_topic_approved';
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_approved = $value
|
||||
WHERE topic_id IN (" . implode(', ', $topic_id_list) . ')';
|
||||
@ -575,7 +571,7 @@ switch ($mode)
|
||||
|
||||
foreach ($topic_id_list as $topic_id)
|
||||
{
|
||||
add_log('mod', $forum_id, $topic_id, $log_mode);
|
||||
add_log('mod', $forum_id, $topic_id, $mode);
|
||||
}
|
||||
trigger_error($user->lang[$lang_str] . '<br /><br />' . $l_redirect . $return_mcp);
|
||||
break;
|
||||
@ -816,7 +812,8 @@ switch ($mode)
|
||||
AND p.poster_id = u.user_id
|
||||
$limit_posts_time
|
||||
ORDER BY $sort_order";
|
||||
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
||||
// $result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
||||
$result = $db->sql_query_limit($sql, $start, $posts_per_page);
|
||||
|
||||
$i = 0;
|
||||
$has_unapproved_posts = FALSE;
|
||||
@ -1090,7 +1087,7 @@ switch ($mode)
|
||||
case 'split_beyond':
|
||||
$return_split = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="' . $mcp_url . '&mode=split' . $url_extra . '">', '</a>');
|
||||
|
||||
if (!count($post_id_list))
|
||||
if (!$post_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_POST_SELECTED'] . $return_split);
|
||||
}
|
||||
@ -1144,21 +1141,22 @@ switch ($mode)
|
||||
WHERE p.topic_id = $topic_id
|
||||
AND p.poster_id = u.user_id
|
||||
$limit_posts_time
|
||||
ORDER BY $sort_order
|
||||
LIMIT $start, -1";
|
||||
$result = $db->sql_query($sql);
|
||||
ORDER BY $sort_order";
|
||||
$result = $db->sql_query_limit($sql, -1, $start);
|
||||
|
||||
/*
|
||||
$sql = 'SELECT post_id
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE topic_id = $topic_id
|
||||
AND post_id >= $post_id";
|
||||
$result = $db->sql_query($sql);
|
||||
*/
|
||||
$store = FALSE;
|
||||
$post_id_list = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$post_id_list[] = $row['post_id'];
|
||||
// Start to store post_ids as soon as we see the first post that was selected
|
||||
if ($row['post_id'] == $post_id)
|
||||
{
|
||||
$store = TRUE;
|
||||
}
|
||||
if ($store)
|
||||
{
|
||||
$post_id_list[] = $row['post_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1461,7 +1459,7 @@ function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
|
||||
|
||||
if ($auto_sync)
|
||||
{
|
||||
resync('forum', 'forum_id', $forum_ids);
|
||||
resync('forum', 'forum_id', $forum_ids, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1505,8 +1503,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
|
||||
{
|
||||
$forum_ids[] = $row['forum_id'];
|
||||
|
||||
resync('topic', 'topic_id', $topic_ids);
|
||||
resync('forum', 'forum_id', $forum_ids);
|
||||
resync('topic', 'topic_id', $topic_ids, TRUE);
|
||||
resync('forum', 'forum_id', $forum_ids, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1551,7 +1549,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
|
||||
|
||||
if ($auto_sync)
|
||||
{
|
||||
resync('forum', 'forum_id', $forum_ids);
|
||||
resync('forum', 'forum_id', $forum_ids, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1598,8 +1596,8 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
|
||||
|
||||
if ($auto_sync)
|
||||
{
|
||||
resync('topic', 'topic_id', $topic_ids);
|
||||
resync('forum', 'forum_id', $forum_ids);
|
||||
resync('topic', 'topic_id', $topic_ids, TRUE);
|
||||
resync('forum', 'forum_id', $forum_ids, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1609,20 +1607,18 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
|
||||
// sync('topic', 'forum_id', array(2, 3)); <= resynch topics from forum #2 and #3
|
||||
// sync('topic'); <= resynch all topics
|
||||
//
|
||||
// Modes:
|
||||
// - 'topic', 'forum': resync post count, topic count, first/last post data and topic_approved flag
|
||||
// - 'approved': resync the topic_approved flag
|
||||
// - 'reported': resync the topic_reported flag using phpbb_posts.post_reported data
|
||||
//
|
||||
|
||||
/* NOTES:
|
||||
|
||||
1- This function will replace sync() in functions_admin.php asap ;)
|
||||
2- Queries are kinda tricky.
|
||||
Queries are kinda tricky.
|
||||
|
||||
- subforums: we have to be able to get post/topic counts including subforums, hence the join
|
||||
** UPDATE: I removed these joins because they cause too much load on large forums. The new logic may be slightly slower on small forums but is way more scalable.
|
||||
|
||||
- empty topics/forums: we have to be able to resync empty topics as well as empty forums therefore we have to use a LEFT join because a full join would only return results greater than 0
|
||||
** UPDATE: not anymore needed when sync'ing forums, I'm considering the removal of the join used when sync'ing topics if possible.
|
||||
|
||||
- approved posts and topics: I do not like to put the "*_approved = 1" condition in the left join condition but if it's put as a WHERE condition it won't return any row for empty forums. If it causes any problem it could be replaced with a group condition like "GROUP BY p.post_approved"
|
||||
|
||||
*/
|
||||
function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE)
|
||||
{
|
||||
@ -1664,6 +1660,7 @@ function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALS
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$topic_ids = $approved_ids = $unapproved_ids = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_approved'] != $row['post_approved'])
|
||||
@ -1924,9 +1921,9 @@ function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALS
|
||||
break;
|
||||
|
||||
case 'topic':
|
||||
$topic_data = $post_ids = $approved_ids = $unapproved_ids = $resync_forums = array();
|
||||
$topic_data = $topic_ids = $post_ids = $approved_ids = $unapproved_ids = $resync_forums = array();
|
||||
|
||||
$sql = 'SELECT t.*, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS first_post_id, MAX(p.post_id) AS last_post_id
|
||||
$sql = 'SELECT t.*, p.post_approved, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS first_post_id, MAX(p.post_id) AS last_post_id
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
$where_sql_and p.topic_id = t.topic_id
|
||||
GROUP BY p.topic_id, p.post_approved";
|
||||
@ -1934,31 +1931,78 @@ function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALS
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['post_approved'])
|
||||
{
|
||||
$row['total_posts'] = intval($row['total_posts']);
|
||||
$row['first_post_id'] = intval($row['first_post_id']);
|
||||
$row['last_post_id'] = intval($row['last_post_id']);
|
||||
$row['replies'] = $row['total_posts'] - 1;
|
||||
|
||||
$post_ids[$row['last_post_id']] = $row['last_post_id'];
|
||||
}
|
||||
$row['total_posts'] = intval($row['total_posts']);
|
||||
$row['first_post_id'] = intval($row['first_post_id']);
|
||||
$row['last_post_id'] = intval($row['last_post_id']);
|
||||
$row['replies'] = $row['total_posts'] - 1;
|
||||
|
||||
if (!isset($topic_data[$row['topic_id']]))
|
||||
{
|
||||
$topic_ids[] = $row['topic_id'];
|
||||
$topic_data[$row['topic_id']] = $row;
|
||||
}
|
||||
|
||||
$post_ids[$row['first_post_id']] = $row['first_post_id'];
|
||||
else
|
||||
{
|
||||
if ($topic_data[$row['topic_id']]['first_post_id'] > $row['first_post_id'])
|
||||
{
|
||||
$topic_data[$row['topic_id']]['first_post_id'] = $row['first_post_id'];
|
||||
}
|
||||
if ($row['post_approved'])
|
||||
{
|
||||
$topic_data[$row['topic_id']]['replies'] = $row['replies'];
|
||||
$topic_data[$row['topic_id']]['last_post_id'] = $row['last_post_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($post_ids))
|
||||
foreach ($topic_data as $topic_id => $row)
|
||||
{
|
||||
$post_ids[] = $row['first_post_id'];
|
||||
if ($row['first_post_id'] != $row['last_post_id'])
|
||||
{
|
||||
$post_ids[] = $row['last_post_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($topic_ids))
|
||||
{
|
||||
// If we get there, topic ids were invalid or topics did not contain any posts
|
||||
|
||||
delete_topics($where_type, $where_ids);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count($where_ids))
|
||||
{
|
||||
// If we get there, we already have a range of topic_ids; make a diff and delete topics
|
||||
// that didn't return any row
|
||||
$delete_ids = array_diff($where_ids, $topic_ids);
|
||||
if (count($delete_ids))
|
||||
{
|
||||
delete_topics('topic_id', $topic_ids);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're resync'ing by forum_id so we'll have to determine which topics we have to delete
|
||||
$sql = 'SELECT topic_id
|
||||
FROM ' . TOPICS_TABLE . "
|
||||
$where_sql_and topic_id NOT IN (" . implode($topic_ids) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$delete_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$delete_ids[] = $row['topic_id'];
|
||||
}
|
||||
|
||||
if (count($delete_ids))
|
||||
{
|
||||
delete_topics('topic_id', $delete_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_username, p.post_time, u.username
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
@ -2044,7 +2088,7 @@ function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALS
|
||||
}
|
||||
|
||||
// if some topics have been resync'ed then resync parent forums
|
||||
if (count($resync_forums))
|
||||
if ($resync_parents && count($resync_forums))
|
||||
{
|
||||
$sql = 'SELECT f.forum_id
|
||||
FROM ' .FORUMS_TABLE . ' f, ' . FORUMS_TABLE . ' f2
|
||||
@ -2060,7 +2104,7 @@ function resync($mode, $where_type = '', $where_ids = '', $resync_parents = FALS
|
||||
}
|
||||
if (count($forum_ids))
|
||||
{
|
||||
resync('forum', 'forum_id', $forum_ids, $resync_parents);
|
||||
resync('forum', 'forum_id', $forum_ids, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2195,8 +2239,6 @@ function very_temporary_lang_strings()
|
||||
'NO_SUBJECT' => '<No subject>',
|
||||
|
||||
'MOD_QUEUE' => 'Moderation queue',
|
||||
'QUEUE_EMPTY' => 'There is no post awaiting for approval',
|
||||
'FORUM_QUEUE_EMPTY' => 'There is no post awaiting for approval in this forum',
|
||||
|
||||
'log_topic_locked' => 'Locked topic',
|
||||
'log_topic_unlocked' => 'Unlocked topic',
|
||||
|
@ -1,9 +1,32 @@
|
||||
<!-- INCLUDE mcp_header.html -->
|
||||
|
||||
<table class="tablebg" width="100%" cellspacing="1" cellpadding="2" border="0">
|
||||
<tr>
|
||||
<td class="cat" colspan="5" height="28"><span class="cattitle">Latest 5 posts awaiting approval</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_FORUM} </th>
|
||||
<th> {L_TOPIC} </th>
|
||||
<th> {L_SUBJECT} </th>
|
||||
<th> {L_AUTHOR} </th>
|
||||
<th> {L_POST_TIME} </th>
|
||||
</tr>
|
||||
<!-- BEGIN unapproved -->
|
||||
<tr>
|
||||
<td class="row1" width="15%"><span class="gen">{unapproved.FORUM}</span></td>
|
||||
<td class="row2" width="18%"><span class="gen">{unapproved.TOPIC}</span></td>
|
||||
<td class="row1"><span class="gen">{unapproved.SUBJECT}</span></td>
|
||||
<td class="row2" align="center" width="15%" nowrap="nowrap"><span class="gen">{unapproved.AUTHOR}</span></td>
|
||||
<td class="row1" align="center" width="10%" nowrap="nowrap"><span class="gensmall">{unapproved.POST_TIME}</span></td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
<!-- END unapproved -->
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
Moderation queue:<br />
|
||||
There are xx posts waiting to be approved<br />
|
||||
<br />
|
||||
Reported posts:<br />
|
||||
There are xx reported posts to review<br />
|
||||
<br /><br />
|
||||
|
||||
<table class="tablebg" width="100%" cellspacing="1" cellpadding="2" border="0">
|
||||
<tr>
|
||||
<td class="cat" colspan="2" height="28"><span class="cattitle">Latest 5 reported posts</span></td>
|
||||
</tr>
|
||||
</table>
|
@ -9,29 +9,25 @@
|
||||
<th> {L_POST_TIME} </th>
|
||||
<th> {L_SELECT} </th>
|
||||
</tr>
|
||||
<!-- BEGIN postrow -->
|
||||
<!-- IF postrow.S_TOPICS_HEADER -->
|
||||
<!-- BEGIN unapproved -->
|
||||
<!-- IF unapproved.S_TOPICS_HEADER -->
|
||||
<tr>
|
||||
<td class="row3" colspan="6"><b class="gensmall">{L_TOPICS}</b></td>
|
||||
</tr>
|
||||
<!-- ELSEIF postrow.S_POSTS_HEADER -->
|
||||
<!-- ELSEIF unapproved.S_POSTS_HEADER -->
|
||||
<tr>
|
||||
<td class="row3" colspan="6"><b class="gensmall">{L_POSTS}</b></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td class="row1" width="15%"><span class="gen">{postrow.FORUM}</span></td>
|
||||
<td class="row2" width="18%"><span class="gen">{postrow.TOPIC}</span></td>
|
||||
<td class="row1"><span class="gen">{postrow.SUBJECT}</span></td>
|
||||
<td class="row2" align="center" width="15%"><span class="gen">{postrow.AUTHOR}</span></td>
|
||||
<td class="row1" align="center" width="15%"><span class="gensmall">{postrow.POST_TIME}</span></td>
|
||||
<td class="row2" align="center" width="5%">{postrow.S_CHECKBOX}</td>
|
||||
<td class="row1" width="15%"><span class="gen">{unapproved.FORUM}</span></td>
|
||||
<td class="row2" width="18%"><span class="gen">{unapproved.TOPIC}</span></td>
|
||||
<td class="row1"><span class="gen">{unapproved.SUBJECT}</span></td>
|
||||
<td class="row2" align="center" width="15%"><span class="gen">{unapproved.AUTHOR}</span></td>
|
||||
<td class="row1" align="center" width="15%"><span class="gensmall">{unapproved.POST_TIME}</span></td>
|
||||
<td class="row2" align="center" width="5%">{unapproved.S_CHECKBOX}</td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
<tr>
|
||||
<td class="row1" colspan="6" height="28" align="center"><!-- IF FORUM_NAME -->{L_FORUM_QUEUE_EMPTY}<!-- ELSE -->{L_QUEUE_EMPTY}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END postrow -->
|
||||
<!-- END unapproved -->
|
||||
</table>
|
||||
|
||||
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
||||
|
Loading…
x
Reference in New Issue
Block a user