From 777f847473a9c740d991795c5e441b716c221120 Mon Sep 17 00:00:00 2001 From: James Atkinson Date: Tue, 10 Jul 2001 23:25:33 +0000 Subject: [PATCH] Confirm works with lock/unlock now too. Next up, move and split git-svn-id: file:///svn/phpbb/trunk@620 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/lang_english.php | 8 +- phpBB/modcp.php | 143 ++++++++++++++++++++++---------- 2 files changed, 105 insertions(+), 46 deletions(-) diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 9f00606b32..76c5cc6f2a 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -492,10 +492,10 @@ $lang['Topics_Removed'] = "The selected topics have been successfully removed fr $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"; -$lang['Confirm_delete_topic'] = "Are you sure you want to remove this topic(s)?"; -$lang['Confirm_lock_topic'] = "Are you sure you want to lock this topic(s)?"; -$lang['Confirm_unlock_topic'] = "Are you sure you want to unlock this topic(s)?"; -$lang['Confirm_move_topic'] = "Are you sure you want to move this topic(s)?"; +$lang['Confirm_delete_topic'] = "Are you sure you want to remove the selected topic(s)?"; +$lang['Confirm_lock_topic'] = "Are you sure you want to lock the selected topic(s)?"; +$lang['Confirm_unlock_topic'] = "Are you sure you want to unlock the selected topic(s)?"; +$lang['Confirm_move_topic'] = "Are you sure you want to move the selected topic(s)?"; // // Old format ... _DON'T_add_any_ new entries here!! diff --git a/phpBB/modcp.php b/phpBB/modcp.php index 879a9d620a..815f0d5f33 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -270,65 +270,124 @@ switch($mode) break; case 'lock': - if($HTTP_POST_VARS['preform_op']) + if($confirm) { - $topics = $HTTP_POST_VARS['preform_op']; - } - else - { - $topics = array($HTTP_GET_VARS[POST_TOPIC_URL]); - } - - $sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_LOCKED . " WHERE "; - for($x = 0; $x < count($topics); $x++) - { - if($x > 0) + if($HTTP_POST_VARS['preform_op']) { - $sql .= " OR "; + $topics = $HTTP_POST_VARS['preform_op']; + } + else + { + $topics = array($HTTP_GET_VARS[POST_TOPIC_URL]); + } + + $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); } - $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); + $hidden_fields = ''; + if($HTTP_POST_VARS['preform_op']) + { + $topics = $HTTP_POST_VARS['preform_op']; + for($x = 0; $x < count($topics); $x++) + { + $hidden_fields .= ''; + } + } + else + { + $hidden_fields .= ''; + } + + $template->assign_vars(array("MESSAGE_TITLE" => $lang['Confirm'], + "MESSAGE_TEXT" => $lang['Confirm_lock_topic'], + "L_YES" => $lang['Yes'], + "L_NO" => $lang['No'], + "S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), + "HIDDEN_FIELDS" => $hidden_fields)); + $template->pparse("confirm"); + include('includes/page_tail.'.$phpEx); + exit(); } break; case 'unlock': - if($HTTP_POST_VARS['preform_op']) + if($confirm) { - $topics = $HTTP_POST_VARS['preform_op']; - } - else - { - $topics = array($HTTP_GET_VARS[POST_TOPIC_URL]); - } - - $sql = "UPDATE " . TOPICS_TABLE . " SET topic_status = " . TOPIC_UNLOCKED . " WHERE "; - for($x = 0; $x < count($topics); $x++) - { - if($x > 0) + if($HTTP_POST_VARS['preform_op']) { - $sql .= " OR "; + $topics = $HTTP_POST_VARS['preform_op']; + } + else + { + $topics = array($HTTP_GET_VARS[POST_TOPIC_URL]); + } + + $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); } - $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); + $hidden_fields = ''; + if($HTTP_POST_VARS['preform_op']) + { + $topics = $HTTP_POST_VARS['preform_op']; + for($x = 0; $x < count($topics); $x++) + { + $hidden_fields .= ''; + } + } + else + { + $hidden_fields .= ''; + } + + $template->assign_vars(array("MESSAGE_TITLE" => $lang['Confirm'], + "MESSAGE_TEXT" => $lang['Confirm_unlock_topic'], + "L_YES" => $lang['Yes'], + "L_NO" => $lang['No'], + "S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), + "HIDDEN_FIELDS" => $hidden_fields)); + $template->pparse("confirm"); + include('includes/page_tail.'.$phpEx); + exit(); } + break; case 'split':