diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php index 4be9ee178..e7bf8e29d 100644 --- a/e107_plugins/forum/forum.php +++ b/e107_plugins/forum/forum.php @@ -11,12 +11,13 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $ -| $Revision: 1.4 $ -| $Date: 2008-02-16 21:46:38 $ +| $Revision: 1.5 $ +| $Date: 2008-11-26 04:00:36 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ -if(!defined("e107_INIT")) { +if(!defined("e107_INIT")) +{ require_once("../../class2.php"); } @@ -25,12 +26,10 @@ include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php'); require_once(e_PLUGIN.'forum/forum_class.php'); $forum = new e107forum; -if (strstr(e_QUERY, "untrack")) +if ($untrackId = varset($_REQUEST['untrack'])) { - $tmp1 = explode(".", e_QUERY); - $tmp = str_replace("-".$tmp1[1]."-", "", USERREALM); - $sql->db_Update("user", "user_realm='".$tp -> toDB($tmp, true)."' WHERE user_id='".USERID."' "); - header("location:".e_SELF."?track"); + $forum->track('del', USERID, $untrackId); + header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'track'))); exit; } @@ -43,11 +42,9 @@ if (e_QUERY == "mark.all.as.read") } //Mark all threads in specific forum as read -if (strstr(e_QUERY, 'mfar')) +if (varset($_REQUEST['mfar'])) { - $tmp = explode(".", e_QUERY); - $forum_id = intval($tmp[1]); - $forum->forum_markasread($forum_id); + $forum->forum_markasread((int)$_REQUEST['mfar']); header("location:".e_SELF); exit; } diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index db9eb03b4..e90627e04 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.7 $ -| $Date: 2008-11-26 03:24:51 $ +| $Revision: 1.8 $ +| $Date: 2008-11-26 04:00:36 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -287,20 +287,39 @@ class e107forum } } - function untrack($thread_id, $from) + function track($which, $uid, $threadId) { - $thread_id = intval($thread_id); - global $sql; - $tmp = str_replace("-".$thread_id."-", "", USERREALM); - return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id=".USERID); + global $e107; + $threadId = (int)$threadId; + $uid = (int)$uid; + $result = false; + switch($which) + { + case 'add': + $tmp = array(); + $tmp['track_userid'] = $uid; + $tmp['track_thread'] = $threadId; + $result = $e107->sql->db_Insert('forum_track', $tmp); + unset($tmp); + break; + + case 'delete': + case 'del': + $result = $e107->sql->db_Delete('forum_track', 'WHERE `track_userid` = {$uid} AND `track_thread'); + break; + } + return $result; } - function track($thread_id, $from) +/* + function track($uid, $thread_id) { - $thread_id = intval($thread_id); + $thread_id = (int)$thread_id; + $uid = (int)$uid; global $sql; return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id=".USERID); } +*/ function forum_get($forum_id) { diff --git a/e107_plugins/forum/forum_sql.php b/e107_plugins/forum/forum_sql.php index 665fd0ef2..cc61542bc 100644 --- a/e107_plugins/forum/forum_sql.php +++ b/e107_plugins/forum/forum_sql.php @@ -58,9 +58,9 @@ CREATE TABLE forum_post ( CREATE TABLE forum_track ( `track_userid` int(10) unsigned NOT NULL, - `track_threadid` int(10) unsigned NOT NULL, + `track_thread` int(10) unsigned NOT NULL, PRIMARY KEY (`track_userid`,`track_threadid`), KEY `track_userid` (`track_userid`), - KEY `track_threadid` (`track_threadid`) + KEY `track_thread` (`track_thread`) ) Type=MyISAM; diff --git a/e107_plugins/forum/url/forum.php b/e107_plugins/forum/url/forum.php index 41b4aede6..f6770f0a6 100755 --- a/e107_plugins/forum/url/forum.php +++ b/e107_plugins/forum/url/forum.php @@ -1,11 +1,16 @@