mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Mass lock/unlock done. Locked topic handling in viewforum
git-svn-id: file:///svn/phpbb/trunk@589 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
977503911a
commit
fd2ec7fad5
5 changed files with 67 additions and 11 deletions
|
@ -54,6 +54,8 @@ $images['posticon'] = "$url_images/posticon.gif";
|
|||
$images['folder'] = "$url_images/folder.gif";
|
||||
$images['new_folder'] = "$url_images/red_folder.gif";
|
||||
$images['latest_reply'] = "$url_images/latest_reply.gif";
|
||||
$images['locked_folder'] = "$url_images/folder_lock.gif";
|
||||
|
||||
|
||||
include('includes/template.inc');
|
||||
|
||||
|
|
|
@ -441,6 +441,8 @@ $lang['Move'] = "Move";
|
|||
$lang['Lock'] = "Lock";
|
||||
$lang['Unlock'] = "Unlock";
|
||||
$lang['Topics_Removed'] = "The selected topics have been successfully removed from the database.";
|
||||
$lang['Topics_Locked'] = "The selected topics have been locked";
|
||||
$lang['Topics_Unlocked'] = "The selected topics have been unlocked";
|
||||
$lang['Return_to_modcp'] = "to return to the moderator control panel";
|
||||
|
||||
//
|
||||
|
|
|
@ -212,7 +212,7 @@ switch($mode)
|
|||
}
|
||||
}
|
||||
|
||||
$msg = $lang['Topics_Removed'] .= "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
|
||||
$msg = $lang['Topics_Removed'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
|
||||
message_die(GENERAL_MESSAGE, $msg);
|
||||
|
||||
}
|
||||
|
@ -224,11 +224,55 @@ switch($mode)
|
|||
|
||||
break;
|
||||
case 'lock':
|
||||
echo 'Lock';
|
||||
if($HTTP_POST_VARS['preform_op'])
|
||||
{
|
||||
$topics = $HTTP_POST_VARS['preform_op'];
|
||||
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_LOCKED . " WHERE ";
|
||||
for($x = 0; $x < count($topics); $x++)
|
||||
{
|
||||
if($x > 0)
|
||||
{
|
||||
$sql .= " OR ";
|
||||
}
|
||||
$sql .= "topic_id = " . $topics[$x];
|
||||
}
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Coule not update topics table!", "Error", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $lang['Topics_Locked'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
|
||||
message_die(GENERAL_MESSAGE, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'unlock':
|
||||
echo 'Unlock';
|
||||
if($HTTP_POST_VARS['preform_op'])
|
||||
{
|
||||
$topics = $HTTP_POST_VARS['preform_op'];
|
||||
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE ";
|
||||
for($x = 0; $x < count($topics); $x++)
|
||||
{
|
||||
if($x > 0)
|
||||
{
|
||||
$sql .= " OR ";
|
||||
}
|
||||
$sql .= "topic_id = " . $topics[$x];
|
||||
}
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Coule not update topics table!", "Error", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $lang['Topics_Unlocked'] . "<br />" . "<a href=\"".append_sid("modcp.$phpEx?".POST_FORUM_URL."=$forum_id")."\">". $lang['Click'] . " " . $lang['Here'] ."</a> " . $lang['Return_to_modcp'];
|
||||
message_die(GENERAL_MESSAGE, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
|
@ -246,7 +290,7 @@ switch($mode)
|
|||
$start = 0;
|
||||
}
|
||||
|
||||
$sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, u.username, u.user_id, p.post_time
|
||||
$sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, t.topic_status, t.topic_type, u.username, u.user_id, p.post_time
|
||||
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
|
||||
WHERE t.forum_id = $forum_id
|
||||
AND t.topic_poster = u.user_id
|
||||
|
@ -266,13 +310,13 @@ switch($mode)
|
|||
{
|
||||
$topic_id = $topics[$x]['topic_id'];
|
||||
$topic_title = stripslashes($topics[$x]['topic_title']);
|
||||
$s_topic_url = append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id");
|
||||
$u_view_topic = append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id");
|
||||
$topic_replies = $topics[$x]['topic_replies'];
|
||||
$last_post_time = create_date($board_config['default_dateformat'], $topics[$x]['post_time'], $board_config['default_timezone']);
|
||||
|
||||
|
||||
$template->assign_block_vars("topicrow", array(
|
||||
"S_TOPIC_URL" => $s_topic_url,
|
||||
"U_VIEW_TOPIC" => $u_view_topic,
|
||||
"TOPIC_TITLE" => $topic_title,
|
||||
"REPLIES" => $topic_replies,
|
||||
"LAST_POST" => $last_post_time,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</tr>
|
||||
<!-- BEGIN topicrow -->
|
||||
<tr class="tablebody">
|
||||
<td bgcolor="#CCCCCC"><a href="{topicrow.S_TOPIC_URL}">{topicrow.TOPIC_TITLE}</a></td>
|
||||
<td bgcolor="#CCCCCC"><a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a></td>
|
||||
<td bgcolor="#DDDDDD" align="center">{topicrow.REPLIES}</td>
|
||||
<td bgcolor="#CCCCCC" align="center">{topicrow.LAST_POST}</td>
|
||||
<td bgcolor="#DDDDDD"><input type="checkbox" name="preform_op[]" value="{topicrow.TOPIC_ID}">{L_SELECT}</td>
|
||||
|
|
|
@ -361,14 +361,22 @@ if($total_topics)
|
|||
// }
|
||||
// else
|
||||
// {
|
||||
if($userdata['session_start'] == $userdata['session_time'])
|
||||
{
|
||||
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
|
||||
if($topic_rowset[$x]['topic_status'] == TOPIC_LOCKED)
|
||||
{
|
||||
$folder_image = "<img src=\"" . $images['locked_folder'] . "\" alt=\"Topic Locked\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
|
||||
if($userdata['session_start'] == $userdata['session_time'])
|
||||
{
|
||||
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&" . $replies);
|
||||
|
|
Loading…
Add table
Reference in a new issue