diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php
index ccd837689..9f4ab0465 100644
--- a/e107_plugins/forum/forum_class.php
+++ b/e107_plugins/forum/forum_class.php
@@ -9,8 +9,8 @@
* Message Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
- * $Revision: 1.33 $
- * $Date: 2008-12-20 23:59:00 $
+ * $Revision: 1.34 $
+ * $Date: 2008-12-23 20:48:24 $
* $Author: mcfly_e107 $
*
*/
@@ -118,9 +118,9 @@ class e107forum
$e107 = e107::getInstance();
if(!$this->userViewed)
{
- if(isset($e107->currentUser['user_plugin_forum_views']))
+ if(isset($e107->currentUser['user_plugin_forum_viewed']))
{
- $this->userViewed = explode('.', $e107->currentUser['user_plugin_forum_viewed']);
+ $this->userViewed = explode(',', $e107->currentUser['user_plugin_forum_viewed']);
}
}
return (is_array($this->userViewed) && in_array($threadId, $this->userViewed));
@@ -549,7 +549,7 @@ class e107forum
$extra = " AND thread_forum_id IN($forumList)";
}
$qry = 'thread_lastpost > '.USERLV.$extra;
-
+
if ($e107->sql->db_Select('forum_thread', 'thread_id', $qry))
{
while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
@@ -613,7 +613,7 @@ class e107forum
function forumGetForumList()
{
- $e107 = e107::getInstance();
+ $e107 = e107::getInstance();
$qry = '
SELECT f.*, u.user_name FROM `#forum` AS f
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
@@ -743,7 +743,7 @@ class e107forum
return false;
}
}
-
+
function thread_user($post_info)
{
if($post_info['user_name'])
@@ -757,12 +757,12 @@ class e107forum
}
}
- function track($which, $uid, $threadId)
+ function track($which, $uid, $threadId, $force=false)
{
$e107 = e107::getInstance();
global $pref;
- if (!varsettrue($pref['forum_track'])) { return false; }
+ if (!varsettrue($pref['forum_track']) && !$force) { return false; }
$threadId = (int)$threadId;
$uid = (int)$uid;
@@ -951,15 +951,15 @@ class e107forum
AND f.forum_class IN (".USERCLASS_LIST.")
{$viewed}
ORDER BY ft.thread_datestamp DESC LIMIT 0, ".intval($count);
-
+
$qry = "
SELECT t.*, u.user_name FROM `#forum_thread` AS t
LEFT JOIN `#user` AS u ON u.user_id = t.thread_lastuser
WHERE t.thread_lastpost > ".USERLV. "
{$viewed}
ORDER BY t.thread_lastpost DESC LIMIT 0, ".(int)$count;
-
-
+
+
if($e107->sql->db_Select_gen($qry))
{
$ret = $e107->sql->db_getList();
@@ -1031,7 +1031,7 @@ class e107forum
}
}
}
-
+
function getUserCounts()
{
global $sql;
@@ -1131,8 +1131,8 @@ class e107forum
}
$BACKLINK = $BREADCRUMB;
}
-
-
+
+
function threadDelete($threadId, $updateForumLastpost = true)
{
$e107 = e107::getInstance();
@@ -1140,7 +1140,7 @@ class e107forum
{
// delete poll if there is one
$e107->sql->db_Delete('poll', 'poll_datestamp='.$threadId);
-
+
//decrement user post counts
if ($postCount = $this->threadGetUserPostcount($threadId))
{
@@ -1149,7 +1149,7 @@ class e107forum
$e107->sql->db_Update('user_extended', 'user_plugin_forum_posts=GREATEST(user_plugin_forum_posts-'.$v.',0) WHERE user_id='.$k);
}
}
-
+
// delete all posts
$qry = 'SELECT post_id FROM `#forum_post` WHERE post_thread = '.$threadId;
if($e107->sql->db_Select_gen($qry))
@@ -1164,16 +1164,16 @@ class e107forum
$this->postDelete($postId, false);
}
}
-
+
// delete the thread itself
$e107->sql->db_Delete('forum_thread', 'thread_id='.$threadId);
-
+
//Delete any thread tracking
$e107->sql->db_Delete('forum_track', 'track_thread='.$threadId);
-
+
// update forum with correct thread/reply counts
$e107->sql->db_Update('forum', "forum_threads=GREATEST(forum_threads-1,0), forum_replies=GREATEST(forum_replies-{$threadInfo['thread_total_replies']},0) WHERE forum_id=".$threadInfo['thread_forum_id']);
-
+
if($updateForumLastpost)
{
// update lastpost info
@@ -1182,7 +1182,7 @@ class e107forum
return $threadInfo['thread_total_replies'];
}
}
-
+
function postDelete($postId, $updateCounts = true)
{
$postId = (int)$postId;
@@ -1192,16 +1192,16 @@ class e107forum
echo 'NOT FOUND!'; return;
}
$row = $e107->sql->db_Fetch(MYSQL_ASSOC);
-
+
//delete attachments if they exist
if($row['post_attachments'])
{
$this->postDeleteAttachments('post', $postId);
}
-
+
// delete post
$e107->sql->db_Delete('forum_post', 'post_id='.$postId);
-
+
if($updateCounts)
{
//decrement user post counts
@@ -1212,19 +1212,19 @@ class e107forum
// update thread with correct reply counts
$e107->sql->db_Update('forum_thread', "thread_total_replies=GREATEST(thread_total_replies-1,0) WHERE thread_id=".$row['post_thread']);
-
+
// update forum with correct thread/reply counts
$e107->sql->db_Update('forum', "forum_replies=GREATEST(forum_replies-1,0) WHERE forum_id=".$row['post_forum']);
-
+
// update thread lastpost info
$this->forumUpdateLastpost('thread', $row['post_thread']);
-
+
// update forum lastpost info
$this->forumUpdateLastpost('forum', $row['post_forum']);
}
return $threadInfo['thread_total_replies'];
}
-
+
}
diff --git a/e107_plugins/forum/forum_update.php b/e107_plugins/forum/forum_update.php
index f6028d82f..9ce231b54 100644
--- a/e107_plugins/forum/forum_update.php
+++ b/e107_plugins/forum/forum_update.php
@@ -9,8 +9,8 @@
* Message Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_update.php,v $
- * $Revision: 1.8 $
- * $Date: 2008-12-20 23:59:00 $
+ * $Revision: 1.9 $
+ * $Date: 2008-12-23 20:48:24 $
* $Author: mcfly_e107 $
*
*/
@@ -129,9 +129,9 @@ function step2()
require_once(e_HANDLER.'db_table_admin_class.php');
$db = new db_table_admin;
-
+
$tabList = array('forum' => 'forum_new', 'forum_thread' => '', 'forum_post' => '', 'forum_track' => '');
- $ret = '';
+ $ret = '';
$failed = false;
$text = '';
foreach($tabList as $name => $rename)
@@ -223,7 +223,7 @@ function step3()
";
}
$e107->ns->tablerender($stepCaption, $text);
-
+
}
function step4()
@@ -255,7 +255,7 @@ function step4()
{
require_once(e_HANDLER.'user_extended_class.php');
$ue = new e107_user_extended;
-
+
while($row = $db->db_Fetch(MYSQL_ASSOC))
{
$result['usercount']++;
@@ -265,8 +265,8 @@ function step4()
$viewed = trim($viewed, '.');
$tmp = preg_split('#\.+#', $viewed);
$viewed = implode(',', $tmp);
-
-
+
+
$realm = $row['user_realm'];
$realm - str_replace('USERREALM', '', $realm);
$realm = trim($realm, '-.');
@@ -284,7 +284,7 @@ function step4()
$ue->user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
$result['viewcount']++;
}
-
+
if(is_array($trackList) && count($trackList))
{
foreach($trackList as $threadId)
@@ -298,14 +298,14 @@ function step4()
$tmp['track_thread'] = $threadId;
$tmp['_FIELD_TYPES']['track_userid'] = 'int';
$tmp['_FIELD_TYPES']['track_thread'] = 'int';
-
- $e107->sql->db_Insert('forum_track', $tmp);
+
+ $e107->sql->db_Insert('forum_track', $tmp);
}
}
}
}
}
-
+
$text .= "
User data move results:
Number of users processed: {$result['usercount']}
@@ -318,7 +318,7 @@ function step4()
";
$e107->ns->tablerender($stepCaption, $text);
-
+
}
function step5()
@@ -353,7 +353,7 @@ function step5()
$ftypes['_FIELD_TYPES']['forum_threadclass'] = 'int';
$counts = array('parens' => 0, 'forums' => 0, 'subs' => 0);
-
+
if($e107->sql->db_Select('forum'))
{
$forumList = $e107->sql->db_getList();
@@ -362,7 +362,7 @@ function step5()
if($forum['forum_parent'] == 0)
{
$counts['parents']++;
- }
+ }
elseif($forum['forum_sub'] != 0)
{
$counts['subs']++;
@@ -371,14 +371,14 @@ function step5()
{
$counts['forums']++;
}
-
+
$tmp = $forum;
$tmp['forum_threadclass'] = $tmp['forum_postclass'];
$tmp['forum_options'] = '_NULL_';
$tmp['_FIELD_TYPES'] = $ftypes['_FIELD_TYPES'];
$e107->sql->db_Insert('forum_new', $tmp);
}
-
+
$text = "
Forum data move results:
Number of forum parents processed: {$counts['parents']}
@@ -390,20 +390,20 @@ function step5()
$result = $e107->sql->db_Select_gen('RENAME TABLE `#forum` TO `#forum_old` ');
$text .= "Rename forum to forum_old -> ".($result ? 'Passed' : 'Failed!');
$text .= '
';
-
+
$result = $e107->sql->db_Select_gen('RENAME TABLE `#forum_new` TO `#forum` ');
$text .= "Rename forum_new to forum -> ".($result ? 'Passed' : 'Failed!');
$text .= '
';
-
+
$text .= "