From 134bf3a7b5dd08e07198336feebd505034dc9bd8 Mon Sep 17 00:00:00 2001 From: mcfly Date: Fri, 5 Dec 2008 20:28:05 +0000 Subject: [PATCH] More forum changes, getting closer to it actually doing something --- e107_plugins/forum/forum_admin_class.php | 7 +-- e107_plugins/forum/forum_class.php | 18 ++++---- e107_plugins/forum/forum_post.php | 43 +++++++++---------- e107_plugins/forum/forum_post_shortcodes.php | 18 ++++---- e107_plugins/forum/forum_viewtopic.php | 6 +-- .../languages/English/lan_forum_admin.php | 5 ++- .../languages/English/lan_forum_post.php | 8 ++-- .../forum/templates/forum_posted_template.php | 18 ++++---- 8 files changed, 63 insertions(+), 60 deletions(-) diff --git a/e107_plugins/forum/forum_admin_class.php b/e107_plugins/forum/forum_admin_class.php index fe4dfa70a..d3400608d 100755 --- a/e107_plugins/forum/forum_admin_class.php +++ b/e107_plugins/forum/forum_admin_class.php @@ -9,8 +9,8 @@ * Forum admin functions * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin_class.php,v $ -* $Revision: 1.6 $ -* $Date: 2008-12-05 01:30:56 $ +* $Revision: 1.7 $ +* $Date: 2008-12-05 20:28:05 $ * $Author: mcfly_e107 $ * */ @@ -962,6 +962,7 @@ class forumAdmin function show_mods() { global $sql, $ns, $for, $tp; + $e107 = e107::getInstance(); $forumList = $for->forum_getforums('all'); $parentList = $for->forum_getparents('list'); $subList = $for->forum_getsubs('bysub'); @@ -981,7 +982,7 @@ class forumAdmin $txt .= " {$f['forum_name']} - ".$e107->e_userclass->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')." + ".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')." "; foreach($subList[$f['forum_id']] as $s) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 99d8cb016..47fd05b41 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ -| $Revision: 1.17 $ -| $Date: 2008-12-05 01:30:56 $ +| $Revision: 1.18 $ +| $Date: 2008-12-05 20:28:05 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -120,7 +120,7 @@ class e107forum { if(isset($e107->currentUser['user_plugin_forum_views'])) { - $this->userViewed = explode('.', $e107->currentUser['user_plugin_forum_viewed']); + $this->userViewed = explode('.', $e107->currentUser['user_plugin_forum_viewed']); } } if(is_array($this->userViewed) && in_array($threadId, $this->userViewed)) @@ -157,7 +157,7 @@ class e107forum $addUserPostCount = true; $e107 = e107::getInstance(); - $result = $e107->sql->db_Insert('forum_post', $postInfo, true); + $result = $e107->sql->db_Insert('forum_post', $postInfo); $forumInfo = array(); if($result && $updateThread) @@ -185,7 +185,7 @@ class e107forum $threadInfo['_FIELD_TYPES']['thread_total_replies'] = 'cmd'; // print_a($threadInfo); // exit; - $result = $e107->sql->db_Update('forum_thread', $threadInfo, true); + $result = $e107->sql->db_Update('forum_thread', $threadInfo); } @@ -216,7 +216,7 @@ class e107forum } $forumInfo['forum_lastpost_info'] = $postInfo['post_datestamp'].'.'.$postInfo['post_thread']; $forumInfo['WHERE'] = 'forum_id = '.$postInfo['post_forum']; - $result = $e107->sql->db_Update('forum', $forumInfo, true); + $result = $e107->sql->db_Update('forum', $forumInfo); } if($result && USER && $addUserPostCount) @@ -235,12 +235,14 @@ class e107forum { $e107 = e107::getInstance(); $threadInfo['_FIELD_TYPES'] = $this->fieldTypes['forum_thread']; - if($result = $e107->sql->db_Insert('forum_thread', $threadInfo, true)) + if($newThreadId = $e107->sql->db_Insert('forum_thread', $threadInfo)) { $postInfo['_FIELD_TYPES'] = $this->fieldTypes['forum_post']; - $postInfo['post_thread'] = $result; + $postInfo['post_thread'] = $newThreadId; $result = $this->postAdd($postInfo, false); + return $newThreadId; } + return false; } function threadUpdate($threadInfo, $inc) diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index f7ae87eeb..160014dde 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.22 $ -| $Date: 2008-12-02 21:34:18 $ +| $Revision: 1.23 $ +| $Date: 2008-12-05 20:28:05 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -34,20 +34,19 @@ $forum = new e107forum; if (!e_QUERY || !isset($_REQUEST['id'])) { - header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main'))); + header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main'))); exit; } -$action = $_REQUEST['f']; +$action = trim($_REQUEST['f']); $id = (int)$_REQUEST['id']; - switch($action) { case 'rp': $threadInfo = $forum->threadGet($id, false); $forumId = $threadInfo['thread_forum_id']; - var_dump($threadInfo); +// var_dump($threadInfo); // if (!is_array($thread_info) || !count($thread_info)) // { // $forum_info = false; // Someone fed us a dud forum id - should exist if replying @@ -256,7 +255,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) // Update forum with latest post info case 'rp': $postInfo['post_thread'] = $id; - $result = $forum->postAdd($postInfo); + $postResult = $forum->postAdd($postInfo); break; @@ -268,7 +267,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) $threadInfo['thread_forum_id'] = $forumId; $threadInfo['thread_active'] = 1; $threadInfo['thread_datestamp'] = $time; - $result = $forum->threadAdd($threadInfo, $postInfo); + $postResult = $forum->threadAdd($threadInfo, $postInfo); break; } @@ -280,32 +279,32 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) // } // print_a($threadInfo); // print_a($postInfo); - exit; +// exit; - $result = $forum->postAdd($postInfo, $threadInfo); - - $iid = $forum->thread_insert($subject, $post, $forum_id, $parent, $poster, $email_notify, $threadtype, $forum_info['forum_sub']); - if($iid === -1) + if($postResult === -1) //Duplicate post { require_once(HEADERF); - $ns->tablerender("", LAN_FORUM_2); + $ns->tablerender('', LAN_FORUM_2); require_once(FOOTERF); exit; } - if (isset($_POST['reply'])) { - $iid = $parent; - } - if ($_POST['poll_title'] != "" && $_POST['poll_option'][0] != "" && $_POST['poll_option'][1] != "" && isset($_POST['newthread'])) { - require_once(e_PLUGIN."poll/poll_class.php"); + $threadId = ($action == 'nt' ? $postResult : $id); + + if ($action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != '') + { + require_once(e_PLUGIN.'poll/poll_class.php'); $_POST['iid'] = $iid; $poll = new poll; - $poll -> submit_poll(2); + $poll->submit_poll(2); } + $threadLink = $e107->url->getUrl('forum', 'thread', array('func' => 'last', 'id' => $threadId)); + $forumLink = $e107->url->getUrl('forum', 'forum', array('func' => 'view', 'id' => $forumId)); if ($pref['forum_redirect']) { - redirect(e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last"); + header('location:'.$threadLink); + exit; } else { @@ -323,7 +322,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) } echo (isset($_POST['newthread']) ? $FORUMTHREADPOSTED : $FORUMREPLYPOSTED); - $e107cache->clear("newforumposts"); + $e107cache->clear('newforumposts'); require_once(FOOTERF); exit; } diff --git a/e107_plugins/forum/forum_post_shortcodes.php b/e107_plugins/forum/forum_post_shortcodes.php index f4daa9dee..950b7b53a 100644 --- a/e107_plugins/forum/forum_post_shortcodes.php +++ b/e107_plugins/forum/forum_post_shortcodes.php @@ -111,7 +111,7 @@ if (MODERATOR && $action == "nt") $thread_s = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_s']); return "
".LAN_400."".LAN_1." ".LAN_2." ".LAN_3.""; } -return ""; +return ''; SC_END SC_BEGIN BACKLINK @@ -122,35 +122,35 @@ SC_END SC_BEGIN EMAILNOTIFY global $pref, $thread_info, $action; -if ($pref['email_notify'] && $action == "nt" && USER) +if ($pref['email_notify'] && $action == 'nt' && USER) { if(isset($_POST['fpreview'])) { - $chk = ($_POST['email_notify'] ? "checked = 'checked'" : ""); + $chk = ($_POST['email_notify'] ? "checked = 'checked'" : ''); } else { if(isset($thread_info)) { - $chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : ""); + $chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : ''); } else { - $chk = ($pref['email_notify_on'] ? "checked='checked'" : ""); + $chk = ($pref['email_notify_on'] ? "checked='checked'" : ''); } } - return "".LAN_380.""; + return "
 ".LAN_380.""; } -return ""; +return ''; SC_END SC_BEGIN POLL global $poll_form, $action, $pref; -if ($action == "nt" && $pref['forum_poll'] && strpos(e_QUERY, "edit") === FALSE) +if ($action == 'nt' && $pref['forum_poll'] && strpos(e_QUERY, 'edit') === false) { return $poll_form; } -return ""; +return ''; SC_END */ diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index 9c1052560..a47e6ebea 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-12-04 21:36:09 $ +| $Revision: 1.7 $ +| $Date: 2008-12-05 20:28:05 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -88,7 +88,7 @@ if (MODERATOR && isset($_POST['mod'])) $thread->threadInfo = $forum->threadGet($thread->threadId); } -$postList = $forum->PostGet($thread->threadId, $thread->threadpage * $thread->perPage, $thread->perPage); +$postList = $forum->PostGet($thread->threadId, $thread->page * $thread->perPage, $thread->perPage); //var_dump($thread->threadInfo); require_once (HEADERF); diff --git a/e107_plugins/forum/languages/English/lan_forum_admin.php b/e107_plugins/forum/languages/English/lan_forum_admin.php index a547594f3..d2941c50e 100644 --- a/e107_plugins/forum/languages/English/lan_forum_admin.php +++ b/e107_plugins/forum/languages/English/lan_forum_admin.php @@ -4,8 +4,8 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_admin.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-12-05 01:30:56 $ +| $Revision: 1.4 $ +| $Date: 2008-12-05 20:28:05 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -74,6 +74,7 @@ define("FORLAN_62", "Forum Options"); define("FORLAN_63", "Ranks"); define("FORLAN_64", "Enter your levels here, if left blank generic stars will be used to denote level. Separate levels with comma. Maximum of 10 levels, lowest first."); define("FORLAN_65", "Forum Title"); +define('FORLAN_66', 'Not installed'); define("FORLAN_70", "Enable file / image attachments"); define("FORLAN_71", "Allow users to upload file or image with their forum post,"); diff --git a/e107_plugins/forum/languages/English/lan_forum_post.php b/e107_plugins/forum/languages/English/lan_forum_post.php index 7ded195e0..97e41270f 100644 --- a/e107_plugins/forum/languages/English/lan_forum_post.php +++ b/e107_plugins/forum/languages/English/lan_forum_post.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_post.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-08-11 15:11:03 $ -| $Author: e107steved $ +| $Revision: 1.3 $ +| $Date: 2008-12-05 20:28:05 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ define("PAGE_NAME", "Forum"); @@ -60,7 +60,7 @@ define("LAN_324", "Your message has been successfully posted."); define("LAN_325", "Click Here to view your message"); define("LAN_326", "Click here to return to the forum"); define("LAN_327", "Review"); -define("LAN_380", "If you wish to be notified by email when a reply is posted to your thread please tick the box "); +define("LAN_380", "Enable email tracking (email sent when reply is posted)"); define("LAN_381", "Forum reply from "); define("LAN_382", "Post made: "); define("LAN_383", "Please click the following link to view the full thread ..."); diff --git a/e107_plugins/forum/templates/forum_posted_template.php b/e107_plugins/forum/templates/forum_posted_template.php index 06180fc3f..83f47ec00 100644 --- a/e107_plugins/forum/templates/forum_posted_template.php +++ b/e107_plugins/forum/templates/forum_posted_template.php @@ -14,7 +14,7 @@ */ if (!defined('e107_INIT')) { exit; } -if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); } +if(!defined('USER_WIDTH')) { define('USER_WIDTH','width:95%'); } $FORUMPOLLPOSTED = " @@ -24,8 +24,8 @@ $FORUMPOLLPOSTED =
".IMAGE_e." 
".LAN_413."
-".LAN_414."
-".LAN_326."


+".LAN_414."
+".LAN_326."


"; $FORUMTHREADPOSTED = " @@ -36,9 +36,9 @@ $FORUMTHREADPOSTED = " ".IMAGE_e." 
".LAN_324."
-".(defined("F_MESSAGE") ? F_MESSAGE."
" : "")." -".LAN_325."
-".LAN_326."


+".(defined('F_MESSAGE') ? F_MESSAGE.'
' : '')." +".LAN_325."
+".LAN_326."


"; @@ -50,9 +50,9 @@ $FORUMREPLYPOSTED = " ".IMAGE_e." 
".LAN_415."
-".(defined("F_MESSAGE") ? F_MESSAGE."
" : "")." -".LAN_325."
-".LAN_326."


+".(defined('F_MESSAGE') ? F_MESSAGE.'
' : '')." +".LAN_325."
+".LAN_326."


"; ?> \ No newline at end of file