From fd2ec7fad595af91f7f89603298224d160939584 Mon Sep 17 00:00:00 2001 From: James Atkinson Date: Fri, 6 Jul 2001 21:54:33 +0000 Subject: [PATCH] Mass lock/unlock done. Locked topic handling in viewforum git-svn-id: file:///svn/phpbb/trunk@589 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 2 + phpBB/language/lang_english.php | 2 + phpBB/modcp.php | 56 +++++++++++++++++++++++--- phpBB/templates/Default/modcp_body.tpl | 2 +- phpBB/viewforum.php | 16 ++++++-- 5 files changed, 67 insertions(+), 11 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index f3ef262412..8eb648495a 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -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'); diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 2b60d4fd81..7ad0fafc7d 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -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"; // diff --git a/phpBB/modcp.php b/phpBB/modcp.php index d770f2f324..de56cfb5d4 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -212,7 +212,7 @@ switch($mode) } } - $msg = $lang['Topics_Removed'] .= "
" . "". $lang['Click'] . " " . $lang['Here'] ." " . $lang['Return_to_modcp']; + $msg = $lang['Topics_Removed'] . "
" . "". $lang['Click'] . " " . $lang['Here'] ." " . $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'] . "
" . "". $lang['Click'] . " " . $lang['Here'] ." " . $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'] . "
" . "". $lang['Click'] . " " . $lang['Here'] ." " . $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, diff --git a/phpBB/templates/Default/modcp_body.tpl b/phpBB/templates/Default/modcp_body.tpl index eb0428b260..87569c810d 100644 --- a/phpBB/templates/Default/modcp_body.tpl +++ b/phpBB/templates/Default/modcp_body.tpl @@ -23,7 +23,7 @@ - {topicrow.TOPIC_TITLE} + {topicrow.TOPIC_TITLE} {topicrow.REPLIES} {topicrow.LAST_POST} {L_SELECT} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index ad71cb117a..cab3c0ea1e 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -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']) ? "" : ""; + if($topic_rowset[$x]['topic_status'] == TOPIC_LOCKED) + { + $folder_image = "\"Topic"; } else { - $folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "" : ""; + if($userdata['session_start'] == $userdata['session_time']) + { + $folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_last_visit']) ? "" : ""; + } + else + { + $folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "" : ""; + } } + // } $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&" . $replies);