mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Thread moving and emote disabling now working
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_conf.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-12-17 04:22:37 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-12-17 18:48:02 $
|
||||
| $Author: mcfly_e107 $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -23,7 +23,7 @@ $forum = new e107forum;
|
||||
include_lan(e_PLUGIN.'forum/languages/English/lan_forum_conf.php');
|
||||
|
||||
$e_sub_cat = 'forum';
|
||||
|
||||
|
||||
if(!USER || !isset($_GET['f']) || !isset($_GET['id']))
|
||||
{
|
||||
header('location:'.$e107->url->getUrl('core:core', 'main', 'action=index'));
|
||||
@@ -62,76 +62,95 @@ if (isset($_POST['deletepollconfirm'])) {
|
||||
extract($row);
|
||||
$thread_name = str_replace("[poll] ", "", $thread_name);
|
||||
$sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
|
||||
$message = FORLAN_5;
|
||||
$message = FORCONF_5;
|
||||
$url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['move']))
|
||||
{
|
||||
require_once(e_PLUGIN."forum/forum_class.php");
|
||||
// print_a($_POST);
|
||||
require_once(e_PLUGIN.'forum/forum_class.php');
|
||||
$forum = new e107forum;
|
||||
$new_forum = intval($_POST['forum_move']);
|
||||
$replies = $sql->db_Select("forum_t", "*", "thread_parent='$thread_id' ");
|
||||
$sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_id ='".$thread_id."' ");
|
||||
$row = $sql->db_Fetch();
|
||||
$old_forum = $row['thread_forum_id'];
|
||||
$new_thread_name = $row['thread_name'];
|
||||
|
||||
$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')
|
||||
{
|
||||
$new_thread_name = "[".FORLAN_27."] ".$new_thread_name;
|
||||
$newThreadName = '['.FORCONF_27.'] '.$newThreadName;
|
||||
}
|
||||
elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != "")
|
||||
elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != '')
|
||||
{
|
||||
$new_thread_name = $tp->toDB($_POST['newtitle']);
|
||||
$newThreadName = $e107->tp->toDB($_POST['newtitle']);
|
||||
}
|
||||
|
||||
$sql->db_Update("forum_t", "thread_forum_id='$new_forum', thread_name='{$new_thread_name}' WHERE thread_id='$thread_id' ");
|
||||
$sql->db_Update("forum_t", "thread_forum_id='$new_forum' WHERE thread_parent='$thread_id' ");
|
||||
$sql->db_Update("forum", "forum_threads=forum_threads-1, forum_replies=forum_replies-$replies WHERE forum_id='$old_forum' ");
|
||||
$sql->db_Update("forum", "forum_threads=forum_threads+1, forum_replies=forum_replies+$replies WHERE forum_id='$new_forum' ");
|
||||
|
||||
// update lastposts
|
||||
//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);
|
||||
|
||||
$forum->update_lastpost('forum', $old_forum, FALSE);
|
||||
$forum->update_lastpost('forum', $new_forum, FALSE);
|
||||
|
||||
$message = FORLAN_9;
|
||||
$url = e_PLUGIN."forum/forum_viewforum.php?".$new_forum;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['movecancel']))
|
||||
{
|
||||
$message = FORLAN_10;
|
||||
$url = e_PLUGIN."forum/forum_viewforum.php?".$info['forum_id'];
|
||||
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 = "<div style='text-align:center'>".$message."
|
||||
<br />
|
||||
<a href='$url'>".FORLAN_11."</a>
|
||||
</div>";
|
||||
$ns->tablerender(FORLAN_12, $text);
|
||||
<a href='$url'>".FORCONF_11.'</a>
|
||||
</div>';
|
||||
$ns->tablerender(FORCONF_12, $text);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($action == "delete_poll")
|
||||
{
|
||||
$text = "<div style='text-align:center'>
|
||||
".FORLAN_13."
|
||||
".FORCONF_13."
|
||||
<br /><br />
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<input class='button' type='submit' name='deletecancel' value='".FORLAN_14."' />
|
||||
<input class='button' type='submit' name='deletepollconfirm' value='".FORLAN_15."' />
|
||||
<input class='button' type='submit' name='deletecancel' value='".FORCONF_14."' />
|
||||
<input class='button' type='submit' name='deletepollconfirm' value='".FORCONF_15."' />
|
||||
</form>
|
||||
</div>";
|
||||
$ns->tablerender(FORLAN_16, $text);
|
||||
$ns->tablerender(FORCONF_16, $text);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'move')
|
||||
{
|
||||
$postInfo = $forum->postGet($id, 0, 1);
|
||||
@@ -140,7 +159,7 @@ if ($action == 'move')
|
||||
<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>
|
||||
<tr>
|
||||
<td style='text-align:right'>".FORLAN_24.": </td>
|
||||
<td style='text-align:right'>".FORCONF_24.": </td>
|
||||
<td style='text-align:left'>
|
||||
<select name='forum_move' class='tbox'>";
|
||||
$qry = "
|
||||
@@ -149,7 +168,7 @@ if ($action == 'move')
|
||||
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id
|
||||
LEFT JOIN `#forum` AS sp ON f.forum_sub = sp.forum_id
|
||||
WHERE f.forum_parent != 0
|
||||
AND f.forum_id != ".(int)$threadInfo['thread_forum_id']."
|
||||
AND f.forum_id != ".(int)$threadInfo['thread_forum_id']."
|
||||
ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC
|
||||
";
|
||||
$e107->sql->db_Select_gen($qry);
|
||||
@@ -171,24 +190,24 @@ if ($action == 'move')
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><br />
|
||||
<b>".FORLAN_32."</b><br />
|
||||
<input type='radio' name='rename_thread' checked='checked' value='none' /> ".FORLAN_28."<br />
|
||||
<input type='radio' name='rename_thread' value='add' /> ".FORLAN_29.' ['.FORLAN_27.'] '.FORLAN_30."<br />
|
||||
<input type='radio' name='rename_thread' value='rename' /> ".FORLAN_31." <input type='text' class='tbox' name='newtitle' size='60' maxlength='250' value='".$tp->toForm($info['thread_name'])."'/>
|
||||
<b>".FORCONF_32."</b><br />
|
||||
<input type='radio' name='rename_thread' checked='checked' value='none' /> ".FORCONF_28."<br />
|
||||
<input type='radio' name='rename_thread' value='add' /> ".FORCONF_29.' ['.FORCONF_27.'] '.FORCONF_30."<br />
|
||||
<input type='radio' name='rename_thread' value='rename' /> ".FORCONF_31." <input type='text' class='tbox' name='newtitle' size='60' maxlength='250' value='".$tp->toForm($info['thread_name'])."'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style='vertical-align: top;'>
|
||||
<td colspan='2' style='text-align:center'><br />
|
||||
<input class='button' type='submit' name='move' value='".FORLAN_25."' />
|
||||
<input class='button' type='submit' name='movecancel' value='".FORLAN_14."' />
|
||||
<input class='button' type='submit' name='move' value='".FORCONF_25."' />
|
||||
<input class='button' type='submit' name='movecancel' value='".FORCONF_14."' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form><br />";
|
||||
$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(FORLAN_25, $text);
|
||||
|
||||
$e107->ns->tablerender(FORCONF_25, $text);
|
||||
|
||||
}
|
||||
require_once(FOOTERF);
|
||||
?>
|
Reference in New Issue
Block a user