mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-22 16:22:58 +02:00
This commit was manufactured by cvs2svn to create tag
'release_2_0_2'. git-svn-id: file:///svn/phpbb/tags/release_2_0_2@2845 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
112
phpBB/modcp.php
112
phpBB/modcp.php
@@ -68,33 +68,10 @@ else
|
||||
|
||||
$confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0;
|
||||
|
||||
//
|
||||
// Check if user did or did not confirm
|
||||
// If they did not, forward them to the last page they were on
|
||||
//
|
||||
if ( isset($HTTP_POST_VARS['cancel']) )
|
||||
{
|
||||
if ( $topic_id )
|
||||
{
|
||||
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
|
||||
}
|
||||
else if ( $forum_id )
|
||||
{
|
||||
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirect = "index.$phpEx";
|
||||
}
|
||||
|
||||
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
|
||||
header($header_location . append_sid($redirect, true));
|
||||
}
|
||||
|
||||
//
|
||||
// Continue var definitions
|
||||
//
|
||||
$start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
|
||||
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
|
||||
|
||||
$delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE;
|
||||
$move = ( isset($HTTP_POST_VARS['move']) ) ? TRUE : FALSE;
|
||||
@@ -176,6 +153,30 @@ init_userprefs($userdata);
|
||||
// End session management
|
||||
//
|
||||
|
||||
//
|
||||
// Check if user did or did not confirm
|
||||
// If they did not, forward them to the last page they were on
|
||||
//
|
||||
if ( isset($HTTP_POST_VARS['cancel']) )
|
||||
{
|
||||
if ( $topic_id )
|
||||
{
|
||||
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
|
||||
}
|
||||
else if ( $forum_id )
|
||||
{
|
||||
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirect = "index.$phpEx";
|
||||
}
|
||||
|
||||
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
|
||||
header($header_location . append_sid($redirect, true));
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Start auth check
|
||||
//
|
||||
@@ -210,10 +211,39 @@ switch( $mode )
|
||||
$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
|
||||
}
|
||||
|
||||
$sql = "SELECT poster_id, COUNT(post_id) AS posts
|
||||
FROM " . POSTS_TABLE . "
|
||||
WHERE topic_id IN ($topic_id_sql)
|
||||
GROUP BY poster_id";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get poster id information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$count_sql = array();
|
||||
while ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$count_sql[] = "UPDATE " . USERS_TABLE . "
|
||||
SET user_posts = user_posts - " . $row['posts'] . "
|
||||
WHERE user_id = " . $row['poster_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ( sizeof($count_sql) )
|
||||
{
|
||||
for($i = 0; $i < sizeof($count_sql); $i++)
|
||||
{
|
||||
if ( !$db->sql_query($count_sql[$i]) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT post_id
|
||||
FROM " . POSTS_TABLE . "
|
||||
WHERE topic_id IN ($topic_id_sql)";
|
||||
if ( !$result = $db->sql_query($sql) )
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
@@ -330,7 +360,6 @@ switch( $mode )
|
||||
else
|
||||
{
|
||||
// Not confirmed, show confirmation message
|
||||
|
||||
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['None_selected']);
|
||||
@@ -343,7 +372,7 @@ switch( $mode )
|
||||
$topics = $HTTP_POST_VARS['topic_id_list'];
|
||||
for($i = 0; $i < count($topics); $i++)
|
||||
{
|
||||
$hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . $topics[$i] . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />';
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -381,6 +410,11 @@ switch( $mode )
|
||||
|
||||
if ( $confirm )
|
||||
{
|
||||
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['None_selected']);
|
||||
}
|
||||
|
||||
$new_forum_id = $HTTP_POST_VARS['new_forum'];
|
||||
$old_forum_id = $forum_id;
|
||||
|
||||
@@ -391,7 +425,7 @@ switch( $mode )
|
||||
$topic_list = '';
|
||||
for($i = 0; $i < count($topics); $i++)
|
||||
{
|
||||
$topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . $topics[$i];
|
||||
$topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . intval($topics[$i]);
|
||||
}
|
||||
|
||||
$sql = "SELECT *
|
||||
@@ -520,6 +554,11 @@ switch( $mode )
|
||||
break;
|
||||
|
||||
case 'lock':
|
||||
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['None_selected']);
|
||||
}
|
||||
|
||||
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
|
||||
|
||||
$topic_id_sql = '';
|
||||
@@ -559,6 +598,11 @@ switch( $mode )
|
||||
break;
|
||||
|
||||
case 'unlock':
|
||||
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['None_selected']);
|
||||
}
|
||||
|
||||
$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
|
||||
|
||||
$topic_id_sql = '';
|
||||
@@ -624,7 +668,7 @@ switch( $mode )
|
||||
message_die(GENERAL_MESSAGE, $lang['Empty_subject']);
|
||||
}
|
||||
|
||||
$new_forum_id = $HTTP_POST_VARS['new_forum_id'];
|
||||
$new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
|
||||
$topic_time = time();
|
||||
|
||||
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type)
|
||||
@@ -722,7 +766,7 @@ switch( $mode )
|
||||
|
||||
'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"),
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||
'S_FORUM_SELECT' => make_forum_select("new_forum_id"))
|
||||
'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id))
|
||||
);
|
||||
|
||||
for($i = 0; $i < $total_posts; $i++)
|
||||
@@ -858,7 +902,7 @@ switch( $mode )
|
||||
FROM " . POSTS_TABLE . "
|
||||
WHERE poster_id = $poster_id
|
||||
GROUP BY poster_ip
|
||||
ORDER BY postings DESC";
|
||||
ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql);
|
||||
@@ -905,7 +949,7 @@ switch( $mode )
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.poster_ip = '" . $post_row['poster_ip'] . "'
|
||||
GROUP BY u.user_id, u.username
|
||||
ORDER BY postings DESC";
|
||||
ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not get posters information based on IP', '', __LINE__, __FILE__, $sql);
|
||||
@@ -1003,12 +1047,12 @@ switch( $mode )
|
||||
if ( $row['topic_type'] == POST_ANNOUNCE )
|
||||
{
|
||||
$folder_img = $images['folder_announce'];
|
||||
$folder_alt = $lang['Announcement'];
|
||||
$folder_alt = $lang['Topic_Announcement'];
|
||||
}
|
||||
else if ( $row['topic_type'] == POST_STICKY )
|
||||
{
|
||||
$folder_img = $images['folder_sticky'];
|
||||
$folder_alt = $lang['Sticky'];
|
||||
$folder_alt = $lang['Topic_Sticky'];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user