url->getUrl('core:core', 'main', 'action=index')); exit; } $id = (int)$_GET['id']; $action = $_GET['f']; $qry = " SELECT t.*, f.*, fp.forum_id AS forum_parent_id FROM #forum_t as t LEFT JOIN #forum AS f ON t.thread_forum_id = f.forum_id LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent WHERE t.thread_id = {$thread_id} "; $threadInfo = $forum->threadGet($id); $modList = $forum->forumGetMods($threadInfo->forum_moderators); //var_dump($threadInfo); //var_dump($modList); //If user is not a moderator of indicated forum, redirect to index page if(!in_array(USERID, array_keys($modList))) { header('location:'.$e107->url->getUrl('core:core', 'main', 'action=index')); exit; } require_once(HEADERF); if (isset($_POST['deletepollconfirm'])) { $sql->db_Delete("poll", "poll_id='".intval($thread_parent)."' "); $sql->db_Select("forum_t", "*", "thread_id='".$thread_id."' "); $row = $sql->db_Fetch(); extract($row); $thread_name = str_replace("[poll] ", "", $thread_name); $sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' "); $message = FORCONF_5; $url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id; } if (isset($_POST['move'])) { // print_a($_POST); require_once(e_PLUGIN.'forum/forum_class.php'); $forum = new e107forum; $postInfo = $forum->postGet($id, 0, 1); $threadId = (int)$postInfo[0]['post_thread']; $threadInfo = $forum->threadGet($threadId); // print_a($postInfo); // print_a($threadInfo); // exit; $oldForumId = (int)$threadInfo['thread_forum_id']; $newForumId = (int)$_POST['forum_move']; $newThreadName = $threadInfo['thread_name']; $replyCount = $threadInfo['thread_total_replies']; if($_POST['rename_thread'] == 'add') { $newThreadName = '['.FORCONF_27.'] '.$newThreadName; } elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != '') { $newThreadName = $e107->tp->toDB($_POST['newtitle']); } //Move thread to new forum, changing thread title if needed $sql->db_Update('forum_thread', "thread_forum_id={$newForumId}, thread_name='{$newThreadName}' WHERE thread_id={$threadId}", true); //Move all posts to new forum $sql->db_Update('forum_post', "post_forum={$newForumId} WHERE post_thread={$threadId}", true); //set the thread counts correctly $sql->db_Update('forum', "forum_threads=forum_threads-1, forum_replies=forum_replies-$replyCount WHERE forum_id={$oldForumId}", true); $sql->db_Update('forum', "forum_threads=forum_threads+1, forum_replies=forum_replies+$replyCount WHERE forum_id={$newForumId}", true); // update lastpost information for old and new forums $forum->forumUpdateLastpost('forum', $oldForumId, false); $forum->forumUpdateLastpost('forum', $newForumId, false); $message = FORCONF_9; // $url = e_PLUGIN."forum/forum_viewforum.php?".$new_forum; $url = $e107->url->getUrl('forum', 'thread', 'func=view&id='.$id); } if (isset($_POST['movecancel'])) { require_once(e_PLUGIN.'forum/forum_class.php'); $forum = new e107forum; $postInfo = $forum->postGet($id, 0, 1); $message = FORCONF_10; // $url = e_PLUGIN."forum/forum_viewforum.php?".$info['forum_id']; $url = $e107->url->getUrl('forum', 'forum', 'func=view&id='.$postInfo[0]['post_forum']); } if ($message) { $text = "
".$message."
".FORCONF_11.'
'; $ns->tablerender(FORCONF_12, $text); require_once(FOOTERF); exit; } if ($action == "delete_poll") { $text = "
".FORCONF_13."

"; $ns->tablerender(FORCONF_16, $text); require_once(FOOTERF); exit; } if ($action == 'move') { $postInfo = $forum->postGet($id, 0, 1); $text = "
".FORCONF_24.":

".FORCONF_32."
".FORCONF_28."
".FORCONF_29.' ['.FORCONF_27.'] '.FORCONF_30."
".FORCONF_31."


"; $text = $e107->ns->tablerender($e107->tp->toHTML($threadInfo['thread_name']), $e107->tp->toHTML($postInfo[0]['post_entry']), '', true).$ns->tablerender('', $text, '', true); $e107->ns->tablerender(FORCONF_25, $text); } require_once(FOOTERF); ?>