1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Thread moving and emote disabling now working

This commit is contained in:
mcfly
2008-12-17 18:48:02 +00:00
parent 0c7fb98d2e
commit 90e46f8066
7 changed files with 124 additions and 90 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_conf.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_conf.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2008-12-17 04:22:37 $ | $Date: 2008-12-17 18:48:02 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@@ -23,7 +23,7 @@ $forum = new e107forum;
include_lan(e_PLUGIN.'forum/languages/English/lan_forum_conf.php'); include_lan(e_PLUGIN.'forum/languages/English/lan_forum_conf.php');
$e_sub_cat = 'forum'; $e_sub_cat = 'forum';
if(!USER || !isset($_GET['f']) || !isset($_GET['id'])) if(!USER || !isset($_GET['f']) || !isset($_GET['id']))
{ {
header('location:'.$e107->url->getUrl('core:core', 'main', 'action=index')); header('location:'.$e107->url->getUrl('core:core', 'main', 'action=index'));
@@ -62,76 +62,95 @@ if (isset($_POST['deletepollconfirm'])) {
extract($row); extract($row);
$thread_name = str_replace("[poll] ", "", $thread_name); $thread_name = str_replace("[poll] ", "", $thread_name);
$sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' "); $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; $url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
} }
if (isset($_POST['move'])) 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; $forum = new e107forum;
$new_forum = intval($_POST['forum_move']);
$replies = $sql->db_Select("forum_t", "*", "thread_parent='$thread_id' "); $postInfo = $forum->postGet($id, 0, 1);
$sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_id ='".$thread_id."' "); $threadId = (int)$postInfo[0]['post_thread'];
$row = $sql->db_Fetch(); $threadInfo = $forum->threadGet($threadId);
$old_forum = $row['thread_forum_id'];
$new_thread_name = $row['thread_name']; // 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') 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' "); //Move thread to new forum, changing thread title if needed
$sql->db_Update("forum_t", "thread_forum_id='$new_forum' WHERE thread_parent='$thread_id' "); $sql->db_Update('forum_thread', "thread_forum_id={$newForumId}, thread_name='{$newThreadName}' WHERE thread_id={$threadId}", true);
$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' "); //Move all posts to new forum
$sql->db_Update('forum_post', "post_forum={$newForumId} WHERE post_thread={$threadId}", true);
// update lastposts
//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'])) if (isset($_POST['movecancel']))
{ {
$message = FORLAN_10; require_once(e_PLUGIN.'forum/forum_class.php');
$url = e_PLUGIN."forum/forum_viewforum.php?".$info['forum_id']; $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) if ($message)
{ {
$text = "<div style='text-align:center'>".$message." $text = "<div style='text-align:center'>".$message."
<br /> <br />
<a href='$url'>".FORLAN_11."</a> <a href='$url'>".FORCONF_11.'</a>
</div>"; </div>';
$ns->tablerender(FORLAN_12, $text); $ns->tablerender(FORCONF_12, $text);
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
if ($action == "delete_poll") if ($action == "delete_poll")
{ {
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
".FORLAN_13." ".FORCONF_13."
<br /><br /> <br /><br />
<form method='post' action='".e_SELF."?".e_QUERY."'> <form method='post' action='".e_SELF."?".e_QUERY."'>
<input class='button' type='submit' name='deletecancel' value='".FORLAN_14."' /> <input class='button' type='submit' name='deletecancel' value='".FORCONF_14."' />
<input class='button' type='submit' name='deletepollconfirm' value='".FORLAN_15."' /> <input class='button' type='submit' name='deletepollconfirm' value='".FORCONF_15."' />
</form> </form>
</div>"; </div>";
$ns->tablerender(FORLAN_16, $text); $ns->tablerender(FORCONF_16, $text);
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
if ($action == 'move') if ($action == 'move')
{ {
$postInfo = $forum->postGet($id, 0, 1); $postInfo = $forum->postGet($id, 0, 1);
@@ -140,7 +159,7 @@ if ($action == 'move')
<div style='text-align:center'> <div style='text-align:center'>
<table style='".ADMIN_WIDTH."'> <table style='".ADMIN_WIDTH."'>
<tr> <tr>
<td style='text-align:right'>".FORLAN_24.": </td> <td style='text-align:right'>".FORCONF_24.": </td>
<td style='text-align:left'> <td style='text-align:left'>
<select name='forum_move' class='tbox'>"; <select name='forum_move' class='tbox'>";
$qry = " $qry = "
@@ -149,7 +168,7 @@ if ($action == 'move')
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id
LEFT JOIN `#forum` AS sp ON f.forum_sub = sp.forum_id LEFT JOIN `#forum` AS sp ON f.forum_sub = sp.forum_id
WHERE f.forum_parent != 0 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 ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC
"; ";
$e107->sql->db_Select_gen($qry); $e107->sql->db_Select_gen($qry);
@@ -171,24 +190,24 @@ if ($action == 'move')
</tr> </tr>
<tr> <tr>
<td colspan='2'><br /> <td colspan='2'><br />
<b>".FORLAN_32."</b><br /> <b>".FORCONF_32."</b><br />
<input type='radio' name='rename_thread' checked='checked' value='none' /> ".FORLAN_28."<br /> <input type='radio' name='rename_thread' checked='checked' value='none' /> ".FORCONF_28."<br />
<input type='radio' name='rename_thread' value='add' /> ".FORLAN_29.' ['.FORLAN_27.'] '.FORLAN_30."<br /> <input type='radio' name='rename_thread' value='add' /> ".FORCONF_29.' ['.FORCONF_27.'] '.FORCONF_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'])."'/> <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> </td>
</tr> </tr>
<tr style='vertical-align: top;'> <tr style='vertical-align: top;'>
<td colspan='2' style='text-align:center'><br /> <td colspan='2' style='text-align:center'><br />
<input class='button' type='submit' name='move' value='".FORLAN_25."' /> <input class='button' type='submit' name='move' value='".FORCONF_25."' />
<input class='button' type='submit' name='movecancel' value='".FORLAN_14."' /> <input class='button' type='submit' name='movecancel' value='".FORCONF_14."' />
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</form><br />"; </form><br />";
$text = $e107->ns->tablerender($e107->tp->toHTML($threadInfo['thread_name']), $e107->tp->toHTML($postInfo[0]['post_entry']), '', true).$ns->tablerender('', $text, '', true); $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); require_once(FOOTERF);
?> ?>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
| $Revision: 1.32 $ | $Revision: 1.33 $
| $Date: 2008-12-15 00:29:20 $ | $Date: 2008-12-17 18:48:02 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -242,6 +242,10 @@ if (isset($_POST['newthread']) || isset($_POST['reply']))
$postInfo['post_forum'] = $forumId; $postInfo['post_forum'] = $forumId;
$postInfo['post_datestamp'] = $time; $postInfo['post_datestamp'] = $time;
$threadInfo['thread_lastpost'] = $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 we've successfully uploaded something, we'll have to edit the post_entry and post_attachments
if($uploadResult = process_upload($newPostId)) if($uploadResult = process_upload($newPostId))

View File

@@ -120,6 +120,11 @@ $forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eacti
return $BREADCRUMB; return $BREADCRUMB;
SC_END SC_END
SC_BEGIN NOEMOTES
if($eaction == true) { return ; }
return "<input type='checkbox' name='no_emote' value='1' />&nbsp;<span class='defaulttext'>".LAN_FORUMPOST_EMOTES.'</span>';
SC_END
SC_BEGIN EMAILNOTIFY SC_BEGIN EMAILNOTIFY
global $pref, $thread_info, $action, $eaction; global $pref, $thread_info, $action, $eaction;
if($eaction == true) { return ; } if($eaction == true) { return ; }

View File

@@ -24,7 +24,8 @@ SC_END
SC_BEGIN POST SC_BEGIN POST
global $postInfo; global $postInfo;
$e107 = e107::getInstance(); $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_END
SC_BEGIN POSTDELETED SC_BEGIN POSTDELETED

View File

@@ -4,41 +4,41 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_conf.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_conf.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:35:17 $ | $Date: 2008-12-17 18:48:02 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("FORLAN_5", "Poll deleted."); define("FORCONF_5", "Poll deleted.");
define("FORLAN_6", "Thread deleted"); define("FORCONF_6", "Thread deleted");
define("FORLAN_7", "replies deleted"); define("FORCONF_7", "replies deleted");
define("FORLAN_8", "Delete cancelled."); define("FORCONF_8", "Delete cancelled.");
define("FORLAN_9", "Thread moved."); define("FORCONF_9", "Thread moved.");
define("FORLAN_10", "Move cancelled."); define("FORCONF_10", "Move cancelled.");
define("FORLAN_11", "Back To Forums"); define("FORCONF_11", "Back To Forums");
define("FORLAN_12", "Forum Configuration"); define("FORCONF_12", "Forum Configuration");
define("FORLAN_13", "Are you absolutely certain you want to delete this poll?<br />Once deleted it <b><u>cannot</u></b> be retrieved."); define("FORCONF_13", "Are you absolutely certain you want to delete this poll?<br />Once deleted it <b><u>cannot</u></b> be retrieved.");
define("FORLAN_14", "Cancel"); define("FORCONF_14", "Cancel");
define("FORLAN_15", "Confirm Delete Forum Post"); define("FORCONF_15", "Confirm Delete Forum Post");
define("FORLAN_16", "Confirm Delete Poll"); define("FORCONF_16", "Confirm Delete Poll");
define("FORLAN_17", "posted by"); define("FORCONF_17", "posted by");
define("FORLAN_18", "Are you absolutely certain you want to delete this forum"); define("FORCONF_18", "Are you absolutely certain you want to delete this forum");
define("FORLAN_19", "thread and it's related posts?"); define("FORCONF_19", "thread and it's related posts?");
define("FORLAN_20", "the poll will also be deleted"); define("FORCONF_20", "the poll will also be deleted");
define("FORLAN_21", "Once deleted they"); define("FORCONF_21", "Once deleted they");
define("FORLAN_22", "post?<br />Once deleted it"); define("FORCONF_22", "post?<br />Once deleted it");
define("FORLAN_23", "cannot</u></b> be retrieved"); define("FORCONF_23", "cannot</u></b> be retrieved");
define("FORLAN_24", "Move thread to forum"); define("FORCONF_24", "Move thread to forum");
define("FORLAN_25", "Move Thread"); define("FORCONF_25", "Move Thread");
define("FORLAN_26", "Reply deleted"); define("FORCONF_26", "Reply deleted");
define("FORLAN_27", "moved"); define("FORCONF_27", "moved");
define("FORLAN_28", "Do not rename thread title"); define("FORCONF_28", "Do not rename thread title");
define("FORLAN_29", "Add"); define("FORCONF_29", "Add");
define("FORLAN_30", "to title"); define("FORCONF_30", "to title");
define("FORLAN_31", "Rename to:"); define("FORCONF_31", "Rename to:");
define("FORLAN_32", "Rename thread options:"); define("FORCONF_32", "Rename thread options:");
?> ?>

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_post.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_post.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-12-05 20:28:05 $ | $Date: 2008-12-17 18:48:02 $
| $Author: mcfly_e107 $ | $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_1", "Uploads disabled: ".e_FILE."public directory is not writable");
define("LAN_FORUM_2", "Duplicate post"); define("LAN_FORUM_2", "Duplicate post");
define('LAN_FORUMPOST_EMOTES', 'Deactivate emoticons for this post');
?> ?>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_post_template.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_post_template.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2008-12-07 04:16:39 $ | $Date: 2008-12-17 18:48:02 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -104,12 +104,13 @@ $FORUMPOST = "
<tr> <tr>
<td class='forumheader2' style='width:20%'>{POSTTYPE}</td> <td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
<td class='forumheader2' style='width:80%'> <td class='forumheader2' style='width:80%'>
{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS} {POSTBOX}<br />
{EMAILNOTIFY}<br />
{NOEMOTES}<br />
{POSTTHREADAS}
</td> </td>
</tr> </tr>
{POLL} {POLL}
{FILEATTACH} {FILEATTACH}
<tr style='vertical-align:top'> <tr style='vertical-align:top'>
@@ -147,7 +148,10 @@ $FORUMPOST_REPLY = "
<tr> <tr>
<td class='forumheader2' style='width:20%'>{POSTTYPE}</td> <td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
<td class='forumheader2' style='width:80%'> <td class='forumheader2' style='width:80%'>
{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS} {POSTBOX}<br />
{EMAILNOTIFY}<br />
{NOEMOTES}<br />
{POSTTHREADAS}
</td> </td>
</tr> </tr>