<?php if (!defined('XOOPS_ROOT_PATH')) { exit; } // get (object)$forumpost $forumpost = new ForumPosts(intval(@$_GET['post_id'])); $post_id = intval($forumpost->postid()); if (empty($post_id)) { die(_MD_XHNEWBB_ERRORPOST); } $topic_id = intval($forumpost->topic()); $forum = intval($forumpost->forum()); // lock check (even admin cannot post into locked topic) if (xhnewbb_is_locked($topic_id)) { die(_MD_XHNEWBB_TOPICLOCKED); }
} $new_topic_id = intval($xoopsDB->getInsertId()); $new_forum = $forum; $sql = "UPDATE " . $xoopsDB->prefix("xhnewbb_posts") . " SET pid=0 WHERE post_id={$post_id}"; if (!$xoopsDB->query($sql)) { die(_MD_XHNEWBB_DATABASEERROR); } } else { // get topic_id from post_id $targetpost = new ForumPosts($pid); $pid = intval($targetpost->postid()); // loop check if (in_array($pid, $children)) { die(_MD_XHNEWBB_ERROR_PIDLOOP); } $new_forum = intval($targetpost->forum()); if (empty($pid)) { die(_MD_XHNEWBB_ERRORPOST); } $new_topic_id = intval($targetpost->topic()); $sql = "UPDATE " . $xoopsDB->prefix("xhnewbb_posts") . " SET pid={$pid} WHERE post_id={$post_id}"; if (!$xoopsDB->query($sql)) { die(_MD_XHNEWBB_DATABASEERROR); } } foreach ($children as $child_post_id) { $child_post_id = intval($child_post_id); $sql = "UPDATE " . $xoopsDB->prefix("xhnewbb_posts") . " SET topic_id={$new_topic_id},forum_id={$new_forum} WHERE post_id={$child_post_id}"; $xoopsDB->query($sql); } xhnewbb_sync($new_forum, "forum");
} include XOOPS_ROOT_PATH . '/header.php'; include_once 'class/class.forumposts.php'; $forumpost = new ForumPosts($post_id); $r_message = $forumpost->text(); $r_date = formatTimestamp($forumpost->posttime()); $r_name = $forumpost->uid() != 0 ? XoopsUser::getUnameFromId($forumpost->uid()) : $xoopsConfig['anonymous']; $r_content = _MD_BY . " " . $r_name . " " . _MD_ON . " " . $r_date . "<br /><br />"; $r_content .= $r_message; $r_subject = $forumpost->subject(); if (!preg_match("/^Re:/i", $r_subject)) { $subject = 'Re: ' . $myts->htmlSpecialChars($r_subject); } else { $subject = $myts->htmlSpecialChars($r_subject); } $q_message = $forumpost->text("Quotes"); $hidden = "[quote]\n"; $hidden .= sprintf(_MD_USERWROTE, $r_name); $hidden .= "\n" . $q_message . "[/quote]"; $message = ""; themecenterposts($r_subject, $r_content); echo "<br />"; $pid = $post_id; unset($post_id); $topic_id = $forumpost->topic(); $forum = $forumpost->forum(); $isreply = 1; $istopic = 0; include 'include/forumform.inc.php'; include XOOPS_ROOT_PATH . '/footer.php'; }
if ($xoopsUser) { if (!$xoopsUser->isAdmin($xoopsModule->mid())) { if (!is_moderator($forum, $xoopsUser->uid())) { redirect_header("viewtopic.php?topic_id={$topic_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_DELNOTALLOWED); exit; } } } else { redirect_header("viewtopic.php?topic_id={$topic_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_DELNOTALLOWED); exit; } include_once 'class/class.forumposts.php'; if (!empty($_POST['ok'])) { if (!empty($post_id)) { $post = new ForumPosts($post_id); $post->delete(); sync($post->forum(), "forum"); sync($post->topic(), "topic"); } if ($post->istopic()) { redirect_header("viewforum.php?forum={$forum}", 2, _MD_POSTSDELETED); exit; } else { redirect_header("viewtopic.php?topic_id={$topic_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_POSTSDELETED); exit; } } else { include XOOPS_ROOT_PATH . "/header.php"; xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 1), 'delete.php', _MD_AREUSUREDEL); } include XOOPS_ROOT_PATH . '/footer.php';