From e4436417f9d2f33d8bf0c31b98bde45691dc7ee5 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sat, 26 Mar 2016 11:41:52 -0700
Subject: [PATCH] Forum: Moderators list fix. Online count fix. IMAGE_track BC
Fix.
---
e107_plugins/forum/forum.php | 2 +-
e107_plugins/forum/forum_viewforum.php | 69 ++++++++++++++++++++------
e107_plugins/forum/forum_viewtopic.php | 15 +++++-
3 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php
index 6b4070ce5..82159faa8 100644
--- a/e107_plugins/forum/forum.php
+++ b/e107_plugins/forum/forum.php
@@ -262,7 +262,7 @@ if (USER && vartrue($allread) != TRUE && $total_new_threads && $total_new_thread
$trackPref = $forum->prefs->get('track');
if (USER && vartrue($trackPref) && e_QUERY != 'track')
{
- $fVars->INFO .= "
".LAN_FORUM_0030.'';
+ $fVars->INFO .= "
".LAN_FORUM_0030.'';
}
$fVars->FORUMINFO =
diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php
index b932152dd..1a4422b3f 100644
--- a/e107_plugins/forum/forum_viewforum.php
+++ b/e107_plugins/forum/forum_viewforum.php
@@ -204,12 +204,27 @@ if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
if(varset($pref['track_online']))
{
- $member_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id != 0");
- $guest_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id = 0");
+// $member_users = $sql->count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id != 0");
+// $guest_users = $sql->count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forumId\$') AND online_user_id = 0");
+ $member_users = $sql->count('online', '(*)', "WHERE online_location LIKE('".$tp->filter(e_REQUEST_URI)."%') AND online_user_id != 0");
+ $guest_users = $sql->count('online', '(*)', "WHERE online_location LIKE('".$tp->filter(e_REQUEST_URI)."%') AND online_user_id = 0");
+
+
$users = $member_users+$guest_users;
+
+}
+else
+{
+ $users = 0;
+ $member_users= 0;
+ $guest_users = 0;
+
+
}
require_once(HEADERF);
+
+
$text='';
// TODO - message batch shortcode
if ($message)
@@ -273,10 +288,17 @@ if(substr($forum_info['sub_parent'], 0, 1) == '*')
}
$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
-
+$modUser = array();
+foreach ( $modArray as $user)
+{
+ $modUser[] = "".$user['user_name']."";
+}
$fVars->FORUMTITLE = $forumInfo['forum_name'];
-$fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modArray);
+$fVars->MODERATORS = LAN_FORUM_1009.': '.implode(', ', $modUser);
$fVars->BROWSERS = '';
+
+
+
if(varset($pref['track_online']))
{
$fVars->BROWSERS = $users.' '.($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060).' ('.$member_users.' '.($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062).", ".$guest_users." ".($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064).')';
@@ -328,14 +350,29 @@ $fVars->SEARCH = "
";
-if($forum->checkPerm($forumId, 'post'))
-{
- $fVars->PERMS = LAN_FORUM_0043.' - '.LAN_FORUM_0045.' - '.LAN_FORUM_0047;
-}
-else
-{
- $fVars->PERMS = LAN_FORUM_0044.' - '.LAN_FORUM_0046.' - '.LAN_FORUM_0048;
-}
+
+ // ----- Perm Display ---
+
+ $permDisplay = array();
+
+ $permDisplay['topics'] = ($forum->checkPerm($forumId, 'thread')) ? LAN_FORUM_0043 : LAN_FORUM_0044;
+ if($forum->checkPerm($forumId, 'post'))
+ {
+ $permDisplay['post'] =LAN_FORUM_0045;
+ $permDisplay['edit'] = LAN_FORUM_0047;
+ }
+ else
+ {
+ $permDisplay['post'] =LAN_FORUM_0046;
+ $permDisplay['edit'] = LAN_FORUM_0048;
+ }
+
+
+ $fVars->PERMS = implode(' - '.$permDisplay);
+
+
+ // -------------------------------
+
$sticky_threads = 0;
$stuck = false;
@@ -695,11 +732,11 @@ function parse_thread($thread_info)
$_TEMPLATE = "".substr($_TEMPLATE,4);
}
- if(!BOOTSTRAP)
+ if(!deftrue('BOOTSTRAP'))
{
- $tVars->REPLIESX = $tVars->REPLIES;
- $tVars->VIEWSX = $tVars->VIEWS;
- $tVars->ADMINOPTIONS = $tVars->ADMIN_ICONS;
+ $tVars->REPLIESX = $tVars->REPLIES;
+ $tVars->VIEWSX = $tVars->VIEWS;
+ $tVars->ADMINOPTIONS = $tVars->ADMIN_ICONS;
}
diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php
index aebba3e3f..3d9f9a2f1 100644
--- a/e107_plugins/forum/forum_viewtopic.php
+++ b/e107_plugins/forum/forum_viewtopic.php
@@ -264,8 +264,21 @@ $tVars->NEXTPREV .= "');
+ }
+
+ if(!defined('IMAGE_untrack'))
+ {
+ define('IMAGE_untrack', '
');
+ }
+
+
$img = ($thread->threadInfo['track_userid'] ? IMAGE_track : IMAGE_untrack);
+
/*
$url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call
@@ -291,7 +304,7 @@ if ($forum->prefs->get('track') && USER)
";*/
- $tVars->TRACK = "".$img."
+ $tVars->TRACK = "".$img."
";
}