\n";
if (!isset($_POST['deletethread'])) {
echo "
\n";
} else {
$tdata2 = dbarray(dbquery("SELECT thread_id,thread_lastpost,thread_lastuser FROM ".$db_prefix."threads WHERE thread_id='$thread_id'"));
$threads_count = dbcount("(forum_id)", "threads", "forum_id='$forum_id'") - 1;
$result = dbquery("DELETE FROM ".$db_prefix."posts WHERE thread_id='$thread_id'");
$result = dbquery("DELETE FROM ".$db_prefix."threads WHERE thread_id='$thread_id'");
$result = dbquery("DELETE FROM ".$db_prefix."thread_notify WHERE thread_id='$thread_id'");
$result = dbquery("SELECT * FROM ".$db_prefix."forum_attachments WHERE thread_id='$thread_id'");
if (dbrows($result) != 0) {
while ($attach = dbarray($result)) {
unlink(FORUM."attachments/".$attach['attach_name']);
}
}
$result = dbquery("DELETE FROM ".$db_prefix."forum_attachments WHERE thread_id='$thread_id'");
if ($threads_count > 0) {
$result = dbquery("SELECT * FROM ".$db_prefix."forums WHERE forum_id='$forum_id' AND forum_lastpost='".$tdata2['thread_lastpost']."' AND forum_lastuser='".$tdata2['thread_lastuser']."'");
if (dbrows($result)) {
$result = dbquery("SELECT forum_id,post_author,post_datestamp FROM ".$db_prefix."posts WHERE forum_id='$forum_id' ORDER BY post_datestamp DESC LIMIT 1");
$pdata2 = dbarray($result);
$result = dbquery("UPDATE ".$db_prefix."forums SET forum_lastpost='".$pdata2['post_datestamp']."', forum_lastuser='".$pdata2['post_author']."' WHERE forum_id='$forum_id'");
}
} else {
$result = dbquery("UPDATE ".$db_prefix."forums SET forum_lastpost='0', forum_lastuser='0' WHERE forum_id='$forum_id'");
}
echo $locale['401']."
".$locale['402']."
".$locale['403']."\n";
}
echo "
\n";
closetable();
}
if ($step == "lock") {
$result = dbquery("UPDATE ".$db_prefix."threads SET thread_locked='1' WHERE thread_id='$thread_id'");
opentable($locale['410']);
echo "