From 90e46f806669b3d2f670d0f57dc77fbaf58dbd28 Mon Sep 17 00:00:00 2001 From: mcfly Date: Wed, 17 Dec 2008 18:48:02 +0000 Subject: [PATCH] Thread moving and emote disabling now working --- e107_plugins/forum/forum_conf.php | 117 ++++++++++-------- e107_plugins/forum/forum_post.php | 8 +- e107_plugins/forum/forum_post_shortcodes.php | 5 + e107_plugins/forum/forum_shortcodes.php | 3 +- .../languages/English/lan_forum_conf.php | 60 ++++----- .../languages/English/lan_forum_post.php | 5 +- .../forum/templates/forum_post_template.php | 16 ++- 7 files changed, 124 insertions(+), 90 deletions(-) diff --git a/e107_plugins/forum/forum_conf.php b/e107_plugins/forum/forum_conf.php index 6e60853a4..2e089c629 100644 --- a/e107_plugins/forum/forum_conf.php +++ b/e107_plugins/forum/forum_conf.php @@ -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 = "
".$message."
- ".FORLAN_11." -
"; - $ns->tablerender(FORLAN_12, $text); + ".FORCONF_11.' + '; + $ns->tablerender(FORCONF_12, $text); require_once(FOOTERF); exit; } - + if ($action == "delete_poll") { $text = "
- ".FORLAN_13." + ".FORCONF_13."

- - + +
"; - $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')
- +
".FORLAN_24.": ".FORCONF_24.":

- ".FORLAN_32."
- ".FORLAN_28."
- ".FORLAN_29.' ['.FORLAN_27.'] '.FORLAN_30."
- ".FORLAN_31." + ".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(FORLAN_25, $text); - + $e107->ns->tablerender(FORCONF_25, $text); + } require_once(FOOTERF); ?> \ No newline at end of file diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index baa841230..56bf6a5e3 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ -| $Revision: 1.32 $ -| $Date: 2008-12-15 00:29:20 $ +| $Revision: 1.33 $ +| $Date: 2008-12-17 18:48:02 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -242,6 +242,10 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) $postInfo['post_forum'] = $forumId; $postInfo['post_datestamp'] = $time; $threadInfo['thread_lastpost'] = $time; + if(isset($_POST['no_emote'])) + { + $postInfo['post_options'] = serialize(array('no_emote' => 1)); + } //If we've successfully uploaded something, we'll have to edit the post_entry and post_attachments if($uploadResult = process_upload($newPostId)) diff --git a/e107_plugins/forum/forum_post_shortcodes.php b/e107_plugins/forum/forum_post_shortcodes.php index e51ee377e..cfc0af358 100644 --- a/e107_plugins/forum/forum_post_shortcodes.php +++ b/e107_plugins/forum/forum_post_shortcodes.php @@ -120,6 +120,11 @@ $forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eacti return $BREADCRUMB; SC_END +SC_BEGIN NOEMOTES +if($eaction == true) { return ; } +return " ".LAN_FORUMPOST_EMOTES.''; +SC_END + SC_BEGIN EMAILNOTIFY global $pref, $thread_info, $action, $eaction; if($eaction == true) { return ; } diff --git a/e107_plugins/forum/forum_shortcodes.php b/e107_plugins/forum/forum_shortcodes.php index 35064835b..1ce805a89 100644 --- a/e107_plugins/forum/forum_shortcodes.php +++ b/e107_plugins/forum/forum_shortcodes.php @@ -24,7 +24,8 @@ SC_END SC_BEGIN POST global $postInfo; $e107 = e107::getInstance(); -return $e107->tp->toHTML($postInfo['post_entry'], true, 'USER_BODY', 'class:'.$post_info['user_class']); +$emote = (isset($postInfo['post_options']['no_emote']) ? ',emotes_off' : ''); +return $e107->tp->toHTML($postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$post_info['user_class']); SC_END SC_BEGIN POSTDELETED diff --git a/e107_plugins/forum/languages/English/lan_forum_conf.php b/e107_plugins/forum/languages/English/lan_forum_conf.php index f835678c4..4fc92db1f 100644 --- a/e107_plugins/forum/languages/English/lan_forum_conf.php +++ b/e107_plugins/forum/languages/English/lan_forum_conf.php @@ -4,41 +4,41 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_conf.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:35:17 $ +| $Revision: 1.2 $ +| $Date: 2008-12-17 18:48:02 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ -define("FORLAN_5", "Poll deleted."); -define("FORLAN_6", "Thread deleted"); -define("FORLAN_7", "replies deleted"); -define("FORLAN_8", "Delete cancelled."); -define("FORLAN_9", "Thread moved."); -define("FORLAN_10", "Move cancelled."); -define("FORLAN_11", "Back To Forums"); -define("FORLAN_12", "Forum Configuration"); -define("FORLAN_13", "Are you absolutely certain you want to delete this poll?
Once deleted it cannot be retrieved."); -define("FORLAN_14", "Cancel"); -define("FORLAN_15", "Confirm Delete Forum Post"); -define("FORLAN_16", "Confirm Delete Poll"); -define("FORLAN_17", "posted by"); -define("FORLAN_18", "Are you absolutely certain you want to delete this forum"); -define("FORLAN_19", "thread and it's related posts?"); -define("FORLAN_20", "the poll will also be deleted"); -define("FORLAN_21", "Once deleted they"); -define("FORLAN_22", "post?
Once deleted it"); -define("FORLAN_23", "cannot be retrieved"); -define("FORLAN_24", "Move thread to forum"); -define("FORLAN_25", "Move Thread"); -define("FORLAN_26", "Reply deleted"); +define("FORCONF_5", "Poll deleted."); +define("FORCONF_6", "Thread deleted"); +define("FORCONF_7", "replies deleted"); +define("FORCONF_8", "Delete cancelled."); +define("FORCONF_9", "Thread moved."); +define("FORCONF_10", "Move cancelled."); +define("FORCONF_11", "Back To Forums"); +define("FORCONF_12", "Forum Configuration"); +define("FORCONF_13", "Are you absolutely certain you want to delete this poll?
Once deleted it cannot be retrieved."); +define("FORCONF_14", "Cancel"); +define("FORCONF_15", "Confirm Delete Forum Post"); +define("FORCONF_16", "Confirm Delete Poll"); +define("FORCONF_17", "posted by"); +define("FORCONF_18", "Are you absolutely certain you want to delete this forum"); +define("FORCONF_19", "thread and it's related posts?"); +define("FORCONF_20", "the poll will also be deleted"); +define("FORCONF_21", "Once deleted they"); +define("FORCONF_22", "post?
Once deleted it"); +define("FORCONF_23", "cannot be retrieved"); +define("FORCONF_24", "Move thread to forum"); +define("FORCONF_25", "Move Thread"); +define("FORCONF_26", "Reply deleted"); -define("FORLAN_27", "moved"); +define("FORCONF_27", "moved"); -define("FORLAN_28", "Do not rename thread title"); -define("FORLAN_29", "Add"); -define("FORLAN_30", "to title"); -define("FORLAN_31", "Rename to:"); -define("FORLAN_32", "Rename thread options:"); +define("FORCONF_28", "Do not rename thread title"); +define("FORCONF_29", "Add"); +define("FORCONF_30", "to title"); +define("FORCONF_31", "Rename to:"); +define("FORCONF_32", "Rename thread options:"); ?> \ No newline at end of file diff --git a/e107_plugins/forum/languages/English/lan_forum_post.php b/e107_plugins/forum/languages/English/lan_forum_post.php index 97e41270f..a481b4315 100644 --- a/e107_plugins/forum/languages/English/lan_forum_post.php +++ b/e107_plugins/forum/languages/English/lan_forum_post.php @@ -4,8 +4,8 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_post.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-12-05 20:28:05 $ +| $Revision: 1.4 $ +| $Date: 2008-12-17 18:48:02 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -111,5 +111,6 @@ define("POLL_508", "no"); define("LAN_FORUM_1", "Uploads disabled: ".e_FILE."public directory is not writable"); define("LAN_FORUM_2", "Duplicate post"); +define('LAN_FORUMPOST_EMOTES', 'Deactivate emoticons for this post'); ?> \ No newline at end of file diff --git a/e107_plugins/forum/templates/forum_post_template.php b/e107_plugins/forum/templates/forum_post_template.php index 783a76203..356495606 100644 --- a/e107_plugins/forum/templates/forum_post_template.php +++ b/e107_plugins/forum/templates/forum_post_template.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_post_template.php,v $ -| $Revision: 1.2 $ -| $Date: 2008-12-07 04:16:39 $ +| $Revision: 1.3 $ +| $Date: 2008-12-17 18:48:02 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -104,12 +104,13 @@ $FORUMPOST = " {POSTTYPE} -{POSTBOX}
{EMAILNOTIFY}
{POSTTHREADAS} +{POSTBOX}
+{EMAILNOTIFY}
+{NOEMOTES}
+{POSTTHREADAS} - {POLL} - {FILEATTACH} @@ -147,7 +148,10 @@ $FORUMPOST_REPLY = " {POSTTYPE} -{POSTBOX}
{EMAILNOTIFY}
{POSTTHREADAS} +{POSTBOX}
+{EMAILNOTIFY}
+{NOEMOTES}
+{POSTTHREADAS}