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
This commit is contained in:
James Atkinson 2001-07-10 23:25:33 +00:00
parent bfcabd3df2
commit 777f847473
2 changed files with 105 additions and 46 deletions

View file

@ -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_Locked'] = "The selected topics have been locked";
$lang['Topics_Unlocked'] = "The selected topics have been unlocked"; $lang['Topics_Unlocked'] = "The selected topics have been unlocked";
$lang['Return_to_modcp'] = "to return to the moderator control panel"; $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_delete_topic'] = "Are you sure you want to remove the selected topic(s)?";
$lang['Confirm_lock_topic'] = "Are you sure you want to lock this 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 this 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 this 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!! // Old format ... _DON'T_add_any_ new entries here!!

View file

@ -270,65 +270,124 @@ switch($mode)
break; break;
case 'lock': case 'lock':
if($HTTP_POST_VARS['preform_op']) if($confirm)
{ {
$topics = $HTTP_POST_VARS['preform_op']; if($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 "; $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'] . "<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);
} }
$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 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']; $hidden_fields = '<input type="hidden" name="mode" value="'.$mode.'"><input type="hidden" name="'.POST_FORUM_URL.'" value="'.$forum_id.'">';
message_die(GENERAL_MESSAGE, $msg); if($HTTP_POST_VARS['preform_op'])
{
$topics = $HTTP_POST_VARS['preform_op'];
for($x = 0; $x < count($topics); $x++)
{
$hidden_fields .= '<input type="hidden" name="preform_op[]" value="'.$topics[$x].'">';
}
}
else
{
$hidden_fields .= '<input type="hidden" name="'.POST_TOPIC_URL.'" value="'.$topic_id.'">';
}
$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; break;
case 'unlock': case 'unlock':
if($HTTP_POST_VARS['preform_op']) if($confirm)
{ {
$topics = $HTTP_POST_VARS['preform_op']; if($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 "; $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'] . "<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);
} }
$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 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']; $hidden_fields = '<input type="hidden" name="mode" value="'.$mode.'"><input type="hidden" name="'.POST_FORUM_URL.'" value="'.$forum_id.'">';
message_die(GENERAL_MESSAGE, $msg); if($HTTP_POST_VARS['preform_op'])
{
$topics = $HTTP_POST_VARS['preform_op'];
for($x = 0; $x < count($topics); $x++)
{
$hidden_fields .= '<input type="hidden" name="preform_op[]" value="'.$topics[$x].'">';
}
}
else
{
$hidden_fields .= '<input type="hidden" name="'.POST_TOPIC_URL.'" value="'.$topic_id.'">';
}
$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; break;
case 'split': case 'split':