diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php
index 7446dac9cd..6ea8985306 100644
--- a/e107_plugins/forum/forum.php
+++ b/e107_plugins/forum/forum.php
@@ -402,9 +402,10 @@ function forum_track()
$tp = e107::getParser();
$trackDiz = ($trackEmailPref) ? LAN_FORUM_3040 : LAN_FORUM_3041;
+ $text = '';
+// if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list')) //$trackedThreadList is not used anywhere in function, so why declare it?
+ if($forum->getTrackedThreadList(USERID, 'list'))
-
- if($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list'))
{
$viewed = $forum->threadGetUserViewed();
@@ -480,15 +481,19 @@ function forum_track()
}
// else
{
- $tracktext = $forum_track_start . $forum_trackstring . $forum_track_end;
+ $text = $forum_track_start . $forum_trackstring . $forum_track_end;
}
}
- $text = '';
-
+// $text = '';
+ if(!$text)
+ {
+ e107::redirect();
+ exit;
+ }
- $text .= $tracktext;
+// $text .= $tracktext;
$text .= "
" . e107::getForm()->pagination(e107::url('forum', 'index'), LAN_BACK) . "
";
diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php
index 4245f3637f..9ccb5ba147 100644
--- a/e107_plugins/forum/forum_class.php
+++ b/e107_plugins/forum/forum_class.php
@@ -98,7 +98,7 @@ public function __construct($update= false)
}
$this->e107 = e107::getInstance();
- $tp = e107::getParser();
+// $tp = e107::getParser(); // $tp not used here, so why declare it? Better would be declare it as class scope var, ie $this->tp
$this->userViewed = array();
$this->modArray = array();
@@ -809,7 +809,7 @@ function threadViewed($threadId)
function getTrackedThreadList($id, $retType = 'array')
{
- $e107 = e107::getInstance();
+// $e107 = e107::getInstance(); // $e107 variable is not used anywhere in fuction, why declare it?
$sql = e107::getDb();
$id = (int)$id;
@@ -831,12 +831,12 @@ function getTrackedThreadList($id, $retType = 'array')
function isDuplicatePost($postInfo)
{
- $sql = e107::getDb();
- $tp = e107::getParser();
+// $sql = e107::getDb(); // Only used once, why declare a variable? Better would be declare a class scope variable, something like $this->sql = e107::getDb()
+// $tp = e107::getParser(); // Only used once, why declare a variable? Better would be declare a class scope variable, something like $this->tp = e107::getParser()
- $post = $tp->toDB($postInfo['post_entry']);
+ $post = e107::getParser()->toDB($postInfo['post_entry']);
- if($sql->select('forum_post', 'post_id', "post_forum = ".intval($postInfo['post_forum'])." AND post_entry='".$post."' AND post_user = ".USERID." LIMIT 1"))
+ if(e107::getDb()->select('forum_post', 'post_id', "post_forum = ".intval($postInfo['post_forum'])." AND post_entry='".$post."' AND post_user = ".USERID." LIMIT 1"))
{
return true;
}
diff --git a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
index 831bd4f49c..7526ec8b0d 100644
--- a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
@@ -32,41 +32,41 @@ function sc_forumtitle()
}
// LEGACY shortcodes, to be deprecated & directly handled in template file???
- function sc_threadtitle()
+/* function sc_threadtitle()
{
return LAN_FORUM_0002;
}
-
- function sc_replytitle()
+*/
+/* function sc_replytitle()
{
return LAN_FORUM_0003;
}
-
- function sc_lastpostitle()
+*/
+/* function sc_lastpostitle()
{
return LAN_FORUM_0004;
}
-
- function sc_infotitle()
+*/
+/* function sc_infotitle()
{
return LAN_FORUM_0009;
}
-
- function sc_newthreadtitle()
+*/
+/* function sc_newthreadtitle()
{
return LAN_FORUM_0075;
}
-
- function sc_postedtitle()
+*/
+/* function sc_postedtitle()
{
return LAN_FORUM_0074;
}
-
- function sc_tracktitle()
+*/
+/* function sc_tracktitle()
{
return LAN_FORUM_0073;
}
-
+*/
function sc_statlink()
{
return "".LAN_FORUM_0017."\n";
@@ -84,7 +84,11 @@ function sc_iconkey()
return null;
}
- return "
+// global $FORUM_TEMPLATE;
+// if($FORUM_TEMPLATE['iconkey']){return $FORUM_TEMPLATE['iconkey'];}
+ $FORUM_TEMPLATE = varset($GLOBALS['FORUM_TEMPLATE']);
+ return (defset('BOOTSTRAP') && !empty($FORUM_TEMPLATE['iconkey'])) ? e107::getParser()->parseTemplate($FORUM_TEMPLATE['iconkey'], true, $this) :
+ "
\n
| ".defset('IMAGE_new_small')." |
".LAN_FORUM_0039." |
@@ -469,7 +473,6 @@ function sc_replies($parm = '')
return $this->sc_repliesx($parm);
}
-
function sc_threadsx($parm = null) // EQUAL TO SC_THREADS.......................
{
$val = ($this->var['forum_threads']) ? $this->var['forum_threads'] : '0';
@@ -482,7 +485,6 @@ function sc_threadsx($parm = null) // EQUAL TO SC_THREADS.......................
return e107::getParser()->toBadge($val);
}
-
function sc_repliesx($parm = null) // EQUAL TO SC_REPLIES.......................
{
//print_a($parm);
@@ -496,7 +498,6 @@ function sc_repliesx($parm = null) // EQUAL TO SC_REPLIES.......................
return e107::getParser()->toBadge($val);
}
-
function sc_forumsubforums()
{
return (!empty($this->var['text'])) ? "
".LAN_FORUM_0069.": {$this->var['text']}
":"";
@@ -507,13 +508,11 @@ function sc_lastpostuser()
return $this->sc_lastpost(array('type'=>'username'));
}
-
function sc_lastpostdate()
{
- return $this->sc_lastpost(array('type'=>'datelink'));
+ return $this->sc_lastpost(array('type'=>'datelink'));
}
-
function sc_lastpost($parm = null)
{
if (empty($this->var['forum_lastpost_info']))
diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
index a80660b8bf..9af5e2a611 100644
--- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
@@ -196,14 +196,14 @@ function sc_topic_datestamp($parm = null)
* @return string
* @example {TOPIC_LASTPOST_DATE: format=relative}
*/
- function sc_topic_lastpost_date($parm = null)
+ function sc_topic_lastpost_date($parm = null)
{
-
+/*
if(empty($this->var['thread_total_replies']))
{
return '';
}
-
+*/
$mode = empty($parm['format']) ? 'forum' : $parm['format'];
@@ -214,8 +214,8 @@ function sc_topic_lastpost_date($parm = null)
function sc_topic_lastpost_author($parm = null)
{
- if($this->var['thread_views'] && !empty($this->var['thread_total_replies']))
- {
+// if($this->var['thread_views'] && !empty($this->var['thread_total_replies']))
+// {
if(!empty($this->var['thread_lastuser_username']))
{
@@ -232,9 +232,9 @@ function sc_topic_lastpost_author($parm = null)
return LAN_FORUM_1015;
}
- }
+// }
- return ' - ';
+// return ' - ';
}
@@ -1067,7 +1067,7 @@ function sc_nextprev()
function sc_track()
{
- global $forum;
+ //global $forum; //$forum is not used inside function, so why global here?
if(!empty($this->pref['track']) && USER)
{
// BC Fix for old template.
diff --git a/e107_plugins/forum/templates/forum_template.php b/e107_plugins/forum/templates/forum_template.php
index 3a7effdd74..2eb5e41f1d 100644
--- a/e107_plugins/forum/templates/forum_template.php
+++ b/e107_plugins/forum/templates/forum_template.php
@@ -17,7 +17,7 @@
$FORUM_MAIN_START = "\n
\n
\n\n| {FORUMTITLE} | \n{LAN=FORUM_0002} | \n{LAN=FORUM_0003} | \n{LAN=FORUM_0004} | \n
";
*/
// LEGACY definition with LAN Shortcodes ({THREADTITLE}, {REPLYTITLE}, {LASTPOSTITLE}).....
- $FORUM_MAIN_START = "\n
\n
\n\n| {FORUMTITLE} | \n{THREADTITLE} | \n{REPLYTITLE} | \n{LASTPOSTITLE} | \n
";
+ $FORUM_MAIN_START = "\n
\n
\n\n| {FORUMTITLE} | \n{LAN=FORUM_0002} | \n{LAN=FORUM_0003} | \n{LAN=FORUM_0004} | \n
";
}
if (!isset($FORUM_MAIN_PARENT))
{
@@ -36,7 +36,7 @@
$FORUM_MAIN_END = "
\n
\n
\n\n| {LAN=FORUM_0009} | \n
\n\n\n\n
\n\n\n
\n\n
\n\n\n
\n
\n
\n
\n
";
*/
// LEGACY definition with LAN Shortcodes ({INFOTITLE}).....
-$FORUM_MAIN_END = "
\n
\n
\n\n| {INFOTITLE} | \n
\n\n\n\n
\n\n\n
\n\n
\n\n\n
\n
\n
\n
\n
";
+$FORUM_MAIN_END = "
\n
\n
\n\n| {LAN=FORUM_0009} | \n
\n\n\n\n
\n\n\n
\n\n
\n\n\n
\n
\n
\n
\n
";
}
if (!isset($FORUM_NEWPOSTS_START))
@@ -46,7 +46,7 @@
$FORUM_NEWPOSTS_START = "\n
\n
\n\n| | \n{LAN=FORUM_0075} | \n{LAN=FORUM_0074} | \n
";
*/
// LEGACY definition with LAN Shortcodes ({NEWTHREADTITLE}, {POSTEDTITLE}).....
- $FORUM_NEWPOSTS_START = "\n
\n
\n\n| | \n{NEWTHREADTITLE} | \n{POSTEDTITLE} | \n
";
+ $FORUM_NEWPOSTS_START = "\n
\n
\n\n| | \n{LAN=FORUM_0075} | \n{LAN=FORUM_0074} | \n
";
}
if (!isset($FORUM_NEWPOSTS_MAIN))
@@ -66,7 +66,7 @@
$FORUM_TRACK_START = "\n
\n
\n\n| {LAN=FORUM_0073} | \n
\n";
*/
// LEGACY definition with LAN Shortcodes ({TRACKTITLE}).....
-$FORUM_TRACK_START = "\n
\n
\n\n| {TRACKTITLE} | \n
\n";
+$FORUM_TRACK_START = "\n
\n
\n\n| {LAN=FORUM_0073} | \n
\n";
if (!isset($FORUM_TRACK_MAIN))
{