diff --git a/e107_core/shortcodes/single/breadcrumb.sc b/e107_core/shortcodes/single/breadcrumb.sc
index 22326387d..fb88b909c 100755
--- a/e107_core/shortcodes/single/breadcrumb.sc
+++ b/e107_core/shortcodes/single/breadcrumb.sc
@@ -16,7 +16,7 @@ foreach($flist as $f)
- if($bc[$f]['sep'])
+ if(isset($bc[$f]['sep']))
{
$ret .= $bc[$f]['sep'];
}
@@ -31,7 +31,7 @@ if(deftrue('BOOTSTRAP'))
foreach($flist as $f)
{
- if($bc[$f]['value'])
+ if(isset($bc[$f]['value']))
{
$opt[] = $bc[$f]['value'];
}
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index d6391009b..8e5429d89 100755
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -78,10 +78,10 @@ class e107
/**
* User login name
*
- * @var string
+ * @var array
* @see init_session()
*/
- public $currentUser = '';
+ public $currentUser;
/**
* Run once load core shortcodes
diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php
index 5d867d729..fed103c4a 100644
--- a/e107_plugins/forum/forum.php
+++ b/e107_plugins/forum/forum.php
@@ -2,7 +2,7 @@
/*
* e107 website system
*
- * Copyright (C) 2008-2013 e107 Inc (e107.org)
+ * Copyright (C) 2008-2019 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@@ -19,12 +19,11 @@ $sql = e107::getDb();
if (!$e107->isInstalled('forum'))
{
- // FIXME GLOBAL - get rid of all e_BASE|e_HTTP|Whatever/index.php - just point to SITEURL
e107::redirect();
exit;
}
+
e107::lan('forum', "front", true);
-// include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php'); // using English_front.php now
if(!deftrue('BOOTSTRAP'))
{
@@ -92,228 +91,14 @@ if(isset($_GET['f']))
}
}
-//echo "
";
- $sc = e107::getScBatch('forum', true);
-//echo "
";
-//var_dump ($sc);
-// $sc->forum = $forum;
-//var_dump ($sc);
-//echo $tp->parseTemplate("====>{FORUMTITLE}<====", false, $sc);
-//echo "
";
-//var_dump (is_object($sc));
-//var_dump (is_array($sc));
-
-//--$fVars = new e_vars;
-//--$gen = new convert;
-
-/*--
-// Gonne directly to shortcode file
-$fVars->FORUMTITLE = e107::pref('forum','title', LAN_PLUGIN_FORUM_NAME);
-// Gonne directly to template file
-$fVars->THREADTITLE = LAN_FORUM_0002;
-// Gonne directly to template file
-$fVars->REPLYTITLE = LAN_FORUM_0003;
-// Gonne directly to template file
-$fVars->LASTPOSTITLE = LAN_FORUM_0004;
-// Gonne directly to template file
-$fVars->INFOTITLE = LAN_FORUM_0009;
-// Gonne directly to shortcode file
-$fVars->LOGO = IMAGE_e;
-// Gonne directly to template file
-$fVars->NEWTHREADTITLE = LAN_FORUM_0075;
-// Gonne directly to template file
-$fVars->POSTEDTITLE = LAN_FORUM_0074;
-// Gonne directly to shortcode file
-$fVars->NEWIMAGE = IMAGE_new_small;
-// Gonne directly to template file
-$fVars->TRACKTITLE = LAN_FORUM_0073;
---*/
-/*--
-// Gonne directly to shortcode file
-$rules_text = forum_rules('check');
-
-$fVars->USERINFO = "".LAN_FORUM_0010." | ".LAN_FORUM_0011."";
-if(USER)
-{
- $fVars->USERINFO .= " | ".LAN_FORUM_0012." | ".LAN_FORUM_0013." | ".LAN_FORUM_0014."";
- if($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
- {
- $fVars->USERINFO .= " | ".LAN_FORUM_0015."";
- }
-}
-if(!empty($rules_text))
-{
- $fVars->USERINFO .= " | ".LAN_FORUM_0016.'';
-}
-
-
-// v2.x --------------------
-$uInfo = array();
-$uInfo[0] = "".LAN_FORUM_6013.'';
-
-if(!empty($rules_text))
-{
- $uInfo[1] = "".LAN_FORUM_0016.'';
-}
-
-$trackPref = $forum->prefs->get('track');
-if(!empty($trackPref))
-{
- $uInfo[2] = "".LAN_FORUM_0030."";
-}
-$fVars->USERINFOX = implode(" | ",$uInfo);
-// -----------
---*/
-
-
-/*--
-// Gonne to foruminfo shortcode
-$total_topics = $sql->count("forum_thread", "(*)");
-$total_replies = $sql->count("forum_post", "(*)");
-$total_members = $sql->count("user");
-$newest_member = $sql->select("user", "*", "user_ban='0' ORDER BY user_join DESC LIMIT 0,1");
-list($nuser_id, $nuser_name) = $sql->fetch('num'); // FIXME $nuser_id & $user_name return empty even though print_a($newest_member); returns proper result.
-
-if(!defined('e_TRACKING_DISABLED'))
-{
- $member_users = $sql->select("online", "*", "online_location REGEXP('forum.php') AND online_user_id!='0' ");
- $guest_users = $sql->select("online", "*", "online_location REGEXP('forum.php') AND online_user_id='0' ");
- $users = $member_users+$guest_users;
-// Gonne to shortcode file
-/*--
- $fVars->USERLIST = LAN_FORUM_0036.": ";
- global $listuserson;
- $c = 0;
- if(is_array($listuserson))
- {
- foreach($listuserson as $uinfo => $pinfo)
- {
- list($oid, $oname) = explode(".", $uinfo, 2);
- $c ++;
- $fVars->USERLIST .= "$oname".($c == MEMBERS_ONLINE ? "." :", ");
- }
- }
- $fVars->USERLIST .= "
".LAN_FORUM_0037." ".LAN_FORUM_0038;
-}
---*/
-// Gonne directly to shortcode file
-/*--
-$fVars->STATLINK = "".LAN_FORUM_0017."\n";
-$fVars->ICONKEY = "
-\n
-".IMAGE_new_small." |
-".LAN_FORUM_0039." |
-".IMAGE_nonew_small." |
-".LAN_FORUM_0040." |
-".IMAGE_closed_small." |
-".LAN_FORUM_0041." |
-
\n
\n";
-
-if(!$srchIcon = $tp->toGlyph('fa-search'))
-{
- $srchIcon = LAN_SEARCH;
-}
-
-$fVars->SEARCH = "
-\n";
-
-$fVars->PERMS = (USER == TRUE || ANON == TRUE ? LAN_FORUM_0043." - ".LAN_FORUM_0045." - ".LAN_FORUM_0047 : LAN_FORUM_0044." - ".LAN_FORUM_0046." - ".LAN_FORUM_0048);
-
-$fVars->INFO = "";
-if (USER == TRUE)
-{
- $total_new_threads = $sql->count('forum_thread', '(*)', "WHERE thread_datestamp>'".USERLV."' ");
- if (USERVIEWED != "")
- {
- $tmp = explode(".", USERVIEWED); // List of numbers, separated by single period
- $total_read_threads = count($tmp);
- }
- else
- {
- $total_read_threads = 0;
- }
-
- $fVars->INFO = LAN_FORUM_0018." ".USERNAME."
";
- $lastvisit_datestamp = $gen->convert_date(USERLV, 'long');
- $datestamp = $gen->convert_date(time(), "long");
- if (!$total_new_threads)
- {
- $fVars->INFO .= LAN_FORUM_0019." ";
- }
- elseif($total_new_threads == 1)
- {
- $fVars->INFO .= LAN_FORUM_0020;
- }
- else
- {
- $fVars->INFO .= LAN_FORUM_0021." ".$total_new_threads." ".LAN_FORUM_0022." ";
- }
- $fVars->INFO .= LAN_FORUM_0023;
- if ($total_new_threads == $total_read_threads && $total_new_threads != 0 && $total_read_threads >= $total_new_threads)
- {
- $fVars->INFO .= LAN_FORUM_0029;
- $allread = TRUE;
- }
- elseif($total_read_threads != 0)
- {
- $fVars->INFO .= " (".LAN_FORUM_0027." ".$total_read_threads." ".LAN_FORUM_0028.")";
- }
-
- $fVars->INFO .= "
- ".LAN_FORUM_0024." ".$lastvisit_datestamp."
- ".LAN_FORUM_0025." ".$datestamp;
-}
-else
-{
- $fVars->INFO .= '';
- if (ANON == TRUE)
- {
- $fVars->INFO .= LAN_FORUM_0049.'
'.LAN_FORUM_0050." ".LAN_FORUM_0051." ".LAN_FORUM_0052;
- }
- elseif(USER == FALSE)
- {
- $fVars->INFO .= LAN_FORUM_0049.'
'.LAN_FORUM_0053." ".LAN_FORUM_0054." ".LAN_FORUM_0055;
- }
-}
-
-if (USER && vartrue($allread) != TRUE && $total_new_threads && $total_new_threads >= $total_read_threads)
-{
- $fVars->INFO .= "
".LAN_FORUM_0057.''.(e_QUERY != 'new' ? ", ".LAN_FORUM_0058."" : '');
-}
-
-$trackPref = $forum->prefs->get('track');
-if (USER && vartrue($trackPref) && e_QUERY != 'track')
-{
- $fVars->INFO .= "
".LAN_FORUM_0030.'';
-}
-
-$fVars->FORUMINFO =
-str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($total_topics ".($total_topics == 1 ? LAN_FORUM_0032 : LAN_FORUM_0033).", $total_replies ".($total_replies == 1 ? LAN_FORUM_0034 : LAN_FORUM_0035).")
-".(!defined("e_TRACKING_DISABLED") ? "" : "
".$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).")
".LAN_FORUM_0066." ".$total_members."
".LAN_FORUM_0065." ".$nuser_name.".\n"); // FIXME cannot find other references to e_TRACKING_DISABLED, use pref?
---*/
-
-
-
-
+/** @var forum_shortcodes $sc */
+$sc = e107::getScBatch('forum', true);
if(empty($FORUM_TEMPLATE))
{
- // include(e_PLUGIN.'forum/templates/forum_template.php');
-
// Override with theme template
if(THEME_LEGACY !== true) //v2.x
{
@@ -348,7 +133,7 @@ if(is_array($FORUM_TEMPLATE) && THEME_LEGACY !== true) // new v2.x format.
$FORUM_MAIN_START = $FORUM_TEMPLATE['main']['start'];
$FORUM_MAIN_PARENT = $FORUM_TEMPLATE['main']['parent'];
- $FORUM_MAIN_PARENT_END = $FORUM_TEMPLATE['main']['parent_end'];
+ $FORUM_MAIN_PARENT_END = varset($FORUM_TEMPLATE['main']['parent_end']);
$FORUM_MAIN_FORUM = $FORUM_TEMPLATE['main']['forum'];
$FORUM_MAIN_END = $FORUM_TEMPLATE['main']['end'];
@@ -373,28 +158,20 @@ if (!$forumList)
}
$forum_string = '';
-//--$pVars = new e_vars;
-//--$frm = e107::getForm();
+
foreach ($forumList['parents'] as $parent)
{
-// Gonne directly to shortcode file
-//-- $status = parse_parent($parent);
-//-- $pVars->PARENTSTATUS = $status;
-//---- $sc->parentstatus = parse_parent($parent);
-// Gonne directly to shortcode file
-// $pVars->PARENTNAME = "".$parent['forum_name']."";
-// $pVars->PARENTNAME = $parent['forum_name'];
-//---- $sc->parentname = $parent['forum_name'];
-//-- $forum_string .= $tp->simpleParse($FORUM_MAIN_PARENT, $pVars);
-// $sc->fparent = $parent;
+ $parent = (array) $parent;
$sc->setVars($parent);
- $sc->setScVar('forumParent', $parent);
+// $sc->setScVar('forumParent', $parent);
$sc->wrapper('forum/main/parent');
$forum_string .= $tp->parseTemplate($FORUM_MAIN_PARENT, true, $sc);
- if (!count($forumList['forums'][$parent['forum_id']]))
+
+ $fid = $parent['forum_id'];
+ if (empty($forumList['forums'][$parent['forum_id']]))
{
$text .= "";
}
@@ -432,79 +209,20 @@ foreach ($forumList['parents'] as $parent)
}
}
-/*----
-function parse_parent($parent)
-{
- if(!check_class($parent['forum_postclass']))
- {
- $status = '('.LAN_FORUM_0056.')';
- }
- return vartrue($status);
-}
-*/
+
function parse_forum($f, $restricted_string = '')
{
-//---- global $FORUM_MAIN_FORUM, $gen, $forum, $newflag_list, $forumList, $sc;
+
global $FORUM_MAIN_FORUM, $forumList, $sc;
-//-- $fVars = new e_vars;
-//---- $e107 = e107::getInstance();
+
$tp = e107::getParser();
-// Gonne directly to shortcode file
-/*--
- if(USER && is_array($newflag_list) && in_array($f['forum_id'], $newflag_list))
- {
-
- $fVars->NEWFLAG = "".IMAGE_new.'';
- }
- elseif(empty($f['forum_replies']) && defined('IMAGE_noreplies'))
- {
- $fVars->NEWFLAG = IMAGE_noreplies;
- }
- else
- {
- $fVars->NEWFLAG = IMAGE_nonew;
- }
---*/
-
-// Gonne directly to shortcode file
-/*--
- if(substr($f['forum_name'], 0, 1) == '*')
- {
- $f['forum_name'] = substr($f['forum_name'], 1);
- }
- $f['forum_name'] = $tp->toHTML($f['forum_name'], true, 'no_hook');
- $f['forum_description'] = $tp->toHTML($f['forum_description'], true, 'no_hook');
-
-
- //$url= $e107->url->create('forum/forum/view', $f);
- $url = e107::url('forum', 'forum', $f);
- $fVars->FORUMNAME = "{$f['forum_name']}";
- $fVars->FORUMDESCRIPTION = $f['forum_description'].($restricted_string ? "
$restricted_string" : "");
---*/
-//-- $fVars->THREADS = $f['forum_threads'];
-//---- $sc->threads = $f['forum_threads'];
-//-- $fVars->REPLIES = $f['forum_replies'];
-//---- $sc->replies = $f['forum_replies'];
-//-- $fVars->FORUMSUBFORUMS = '';
-
-//-- $badgeReplies = ($f['forum_replies']) ? "badge-info" : "";
-//-- $badgeThreads = ($f['forum_threads']) ? "badge-info" : "";
-
-//-- $fVars->THREADSX = "".$f['forum_threads']."";
-//-- $fVars->REPLIESX = "".$f['forum_replies']."";
-
-
-//---- $subId = $f['forum_id'];
-//---- if(!empty($forumList['subs']) && is_array($forumList['subs'][$subId]))
if(!empty($forumList['subs']) && is_array($forumList['subs'][$f['forum_id']]))
{
-//---- list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
+
$lastpost_datestamp = reset(explode('.', $f['forum_lastpost_info']));
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
-// $fVars->FORUMSUBFORUMS = "
".LAN_FORUM_0069.": {$ret['text']}
";
-//-- $fVars->THREADS += $ret['threads'];
-//-- $fVars->REPLIES += $ret['replies'];
+
$f['forum_threads'] += $ret['threads'];
$f['forum_replies'] += $ret['replies'];
if(isset($ret['lastpost_info']))
@@ -514,45 +232,12 @@ function parse_forum($f, $restricted_string = '')
$f['forum_lastpost_user_anon'] = $ret['lastpost_user_anon'];
$f['user_name'] = $ret['user_name'];
}
- $f['text'] = $ret['text'];
+
+ $f['text'] = $ret['text'];
}
- $sc->setVars($f);
-/*--
- if ($f['forum_lastpost_info'])
- {
- list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
- if ($f['user_name'])
- {
+ $sc->setVars($f);
- $lastpost_name = " $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}";
- }
- else
- {
- $lastpost_name = $tp->toHTML($f['forum_lastpost_user_anon']);
- }
-
- $lastpost = $forum->threadGetLastpost($lastpost_thread); //XXX TODO inefficient to have SQL query here.
-
- $fVars->LASTPOSTUSER = $lastpost_name;
- // {forum_sef}/{thread_id}-{thread_sef}
-
- $urlData = array('forum_sef'=>$f['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
- $url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
- $fVars->LASTPOSTDATE .= "". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."";
- $lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum');
- $fVars->LASTPOST = $lastpost_datestamp.'
'.$lastpost_name." $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'';
-
- }
- else
- {
- $fVars->LASTPOSTUSER = "";
- $fVars->LASTPOSTDATE = "-";
- $fVars->LASTPOST = '-';
- }
---*/
-
-//-- return $tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
$sc->wrapper('forum/main/forum');
return $tp->parseTemplate($FORUM_MAIN_FORUM, true, $sc);
@@ -612,38 +297,16 @@ if (e_QUERY == 'new')
$newThreadList = $forum->threadGetNew(10);
foreach($newThreadList as $thread)
{
-//-- $author_name = ($thread['user_name'] ? $thread['user_name'] : $thread['lastuser_anon']);
-//---- $sc->author_name = ($thread['user_name'] ? $thread['user_name'] : $thread['lastuser_anon']);
-
-//-- $datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
-//---- $sc->datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
-/*--
- if(!$thread['user_name'])
- {
- $nVars->STARTERTITLE = $author_name.'
'.$datestamp;
- }
- else
- {
- $nVars->STARTERTITLE = " $thread['thread_lastuser'], 'name' => $author_name))."'>{$author_name}
".$datestamp;
- }
-
- $nVars->NEWSPOSTNAME = "".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'';
---*/
-
-//-- $forum_newstring .= $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
- $sc->setVars($thread);
+ $sc->setVars($thread);
$forum_newstring .= $tp->parseTemplate($FORUM_NEWPOSTS_MAIN, true, $sc);
}
if (empty($newThreadList))
{
-//-- $nVars->NEWSPOSTNAME = LAN_FORUM_0029;
-//-- $forum_newstring = $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
$forum_newstring = $tp->parseTemplate($FORUM_NEWPOSTS_MAIN, true, $sc);
}
-//-- $forum_new_start = $tp->simpleParse($FORUM_NEWPOSTS_START, $nVars);
-//-- $forum_new_end = $tp->simpleParse($FORUM_NEWPOSTS_END, $nVars);
+
$forum_new_start = $tp->parseTemplate($FORUM_NEWPOSTS_START, true, $sc);
$forum_new_end = $tp->parseTemplate($FORUM_NEWPOSTS_END, true, $sc);
@@ -657,15 +320,13 @@ if (e_QUERY == 'new')
}
}
-//$frm = e107::getForm();
+
$breadarray = array(
array('text'=> $forum->prefs->get('title'), 'url' => e107::url('forum','index') )
);
-//-- $fVars->FORUM_BREADCRUMB = $frm->breadcrumb($breadarray);
-//-- $forum_main_start = $tp->simpleParse($FORUM_MAIN_START, $fVars);
$sc->wrapper('forum/main/start');
$forum_main_start = $tp->parseTemplate($FORUM_MAIN_START, true, $sc);
//-- $forum_main_end = $tp->simpleParse($FORUM_MAIN_END, $fVars);
@@ -683,12 +344,6 @@ else
}
-
-
-
-
-
-
require_once(FOOTERF);
function forum_rules($action = 'check')
@@ -871,7 +526,7 @@ function forum_track()
e107::getRender()->tablerender(LAN_FORUM_0030, $text, 'forum-track');
-
+ return null;
}
diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php
index 6d086dfbf..c6ea29f83 100644
--- a/e107_plugins/forum/forum_class.php
+++ b/e107_plugins/forum/forum_class.php
@@ -455,8 +455,8 @@ class e107forum
/**
* get user ids with moderator permissions for the given $forumId
- * @param $forumId id of a forum
- * @return an array with user ids how have moderator permissions for the $forumId
+ * @param int $forumId id of a forum
+ * @return array with user ids how have moderator permissions for the $forumId
*/
public function getModeratorUserIdsByForumId($forumId)
{
@@ -980,7 +980,7 @@ class e107forum
}
$this->threadMarkAsRead($newThreadId);
- $threadInfo['thread_sef'] = $this->getThreadsef($threadInfo);
+ $threadInfo['thread_sef'] = $this->getThreadSef($threadInfo);
$triggerData = $info['data'];
$triggerData['thread_id'] = $newThreadId;
@@ -1377,45 +1377,6 @@ class e107forum
// Empty the post_attachments field for this post in the database (prevents loop when deleting entire thread)
$sql->update("forum_post", "post_attachments = NULL WHERE post_id = ".$id);
-
- /* Old code when attachments were still stored in plugin folder.
- Left for review but may be deleted in future.
-
- foreach($attachments as $k => $a)
- {
- $info = explode('*', $a);
- if('' == $f || $info[1] == $f)
- {
- $fname = e_PLUGIN."forum/attachments/{$info[1]}";
- @unlink($fname);
-
- //If attachment is an image and there is a thumb, remove it
- if('img' == $info[0] && $info[2])
- {
- $fname = e_PLUGIN."forum/attachments/thumb/{$info[2]}";
- @unlink($fname);
- }
- }
- unset($attachments[$k]);
- }
-
- $tmp = array();
- if(count($attachments))
- {
- $tmp['post_attachments'] = implode(',', $attachments);
- }
- else
- {
- $tmp['post_attachments'] = '_NULL_';
- }
-
- $info = array();
- $info['data'] = $tmp;
- $info['_FILE_TYPES']['post_attachments'] = 'array';
- $info['WHERE'] = 'post_id = '.$id;
- $sql->update('forum_post', $info);
-
- */
}
}
@@ -1747,7 +1708,7 @@ class e107forum
* Get a list of forum IDs that have unread threads.
* If a forum is a subforum, also ensure the parent is in the list.
*
- * @return type description
+ * @return array|bool description
* @access public
*/
function forumGetUnreadForums()
@@ -2215,7 +2176,7 @@ class e107forum
$this->forumUpdateCounts($fid);
}
return FORLAN_8." ( ".$thread_count." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
- return FORLAN_8." ( ".count($threadList)." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
+ // return FORLAN_8." ( ".count($threadList)." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
}
else
{
@@ -2357,7 +2318,10 @@ class e107forum
$threadInfo['thread_id'] = intval($threadInfo['thread_id']);
$search = array('{THREAD_TITLE}', '{THREAD_HREF}');
$replace = array(vartrue($threadInfo['thread_name']), ''); // $thread->threadInfo - no reference found
- $FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
+
+
+ $FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, varset($FORUM_CRUMB['thread']['value']));
+
$FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread';
@@ -2416,13 +2380,12 @@ class e107forum
if($forumInfo['forum_sub'])
{
$breadcrumb[] = array('text'=> ltrim($forumInfo['sub_parent'], '*') , 'url'=> e107::url('forum','forum', array('forum_sef'=> $forumInfo['parent_sef'])));
- $breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
+ $breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (defset('e_PAGE') !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
}
else
{
- $breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
-
+ $breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (defset('e_PAGE') !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
}
if(vartrue($forumInfo['thread_name']))
diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php
index 132948ac6..8aaf13707 100644
--- a/e107_plugins/forum/forum_viewforum.php
+++ b/e107_plugins/forum/forum_viewforum.php
@@ -1,497 +1,326 @@
'LAN_FORUM_0039',
- 'FORLAN_12' => 'LAN_FORUM_0040',
- 'FORLAN_13' => 'LAN_FORUM_0040',
- 'FORLAN_14' => 'LAN_FORUM_0040',
- 'FORLAN_16' => 'LAN_FORUM_1012',
- 'FORLAN_17' => 'LAN_FORUM_1013',
- 'FORLAN_18' => 'LAN_FORUM_1014',
- 'LAN_435' => 'LAN_DELETE',
- 'LAN_401' => 'LAN_FORUM_4011',
- 'LAN_398' => 'LAN_FORUM_4012',
- 'LAN_399' => 'LAN_FORUM_4013',
- 'LAN_400' => 'LAN_FORUM_4014',
- 'LAN_402' => 'LAN_FORUM_5019',
-
- );
-
- e107::getLanguage()->bcDefs($bcDefs);
-}
-
-
-define('NAVIGATION_ACTIVE','forum');
-
-
-
-
-if (!e_QUERY && empty($_GET))
-{
- if(E107_DEBUG_LEVEL > 0)
+ if(!deftrue('BOOTSTRAP'))
{
- echo __FILE__ .' Line: '.__LINE__;
+ $bcDefs = array(
+ 'FORLAN_11' => 'LAN_FORUM_0039',
+ 'FORLAN_12' => 'LAN_FORUM_0040',
+ 'FORLAN_13' => 'LAN_FORUM_0040',
+ 'FORLAN_14' => 'LAN_FORUM_0040',
+ 'FORLAN_16' => 'LAN_FORUM_1012',
+ 'FORLAN_17' => 'LAN_FORUM_1013',
+ 'FORLAN_18' => 'LAN_FORUM_1014',
+ 'LAN_435' => 'LAN_DELETE',
+ 'LAN_401' => 'LAN_FORUM_4011',
+ 'LAN_398' => 'LAN_FORUM_4012',
+ 'LAN_399' => 'LAN_FORUM_4013',
+ 'LAN_400' => 'LAN_FORUM_4014',
+ 'LAN_402' => 'LAN_FORUM_5019',
+
+ );
+
+ e107::getLanguage()->bcDefs($bcDefs);
+ }
+
+
+ define('NAVIGATION_ACTIVE', 'forum');
+
+
+ if(!e_QUERY && empty($_GET))
+ {
+ if(E107_DEBUG_LEVEL > 0)
+ {
+ echo __FILE__ . ' Line: ' . __LINE__;
+ exit;
+ }
+ $url = e107::url('forum', 'index', 'full');
+ e107::getRedirect()->go($url);
+ //header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
- $url = e107::url('forum','index','full');
- e107::getRedirect()->go($url);
- //header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
- exit;
-}
-if(!empty($_GET['sef']))
-{
- if($newID = $sql->retrieve('forum', 'forum_id', "forum_sef= '".$tp->toDB($_GET['sef'])."' LIMIT 1"))
+ if(!empty($_GET['sef']))
{
- $_REQUEST['id'] = $newID;
+ if($newID = $sql->retrieve('forum', 'forum_id', "forum_sef= '" . $tp->toDB($_GET['sef']) . "' LIMIT 1"))
+ {
+ $_REQUEST['id'] = $newID;
+ }
}
-}
-require_once(e_PLUGIN.'forum/forum_class.php');
-$forum = new e107forum;
+ require_once(e_PLUGIN . 'forum/forum_class.php');
+ $forum = new e107forum;
//$view = 25;
-$view = $forum->prefs->get('threadspage', 25);
-if(!$view) { $view = 25; }
-$page = (varset($_GET['p']) ? $_GET['p'] : 1);
-$threadFrom = ($page - 1) * $view;
-
-global $forum_info, $FORUM_CRUMB;
-
- $sc = e107::getScBatch('viewforum', 'forum');
-
-//----$fVars = new e_vars;
-
-/*--
-$fVars->STARTERTITLE = LAN_FORUM_1004;
-$fVars->THREADTITLE = LAN_FORUM_1003;
-$fVars->REPLYTITLE = LAN_FORUM_0003;
-$fVars->LASTPOSTITLE = LAN_FORUM_0004;
-$fVars->VIEWTITLE = LAN_FORUM_1005;
---*/
-
-$forumId = (int)$_REQUEST['id'];
-
-if(!$forumId && e_QUERY) // BC Fix for old links.
-{
- list($id,$from) = explode(".",e_QUERY);
- $forumId = intval($id);
- $threadFrom = intval($from);
- unset($id,$from);
-}
-
-if (!$forum->checkPerm($forumId, 'view'))
-{
- // header('Location:'.e107::getUrl()->create('forum/forum/main'));
-
- $url = e107::url('forum','index','full');
-
- if(E107_DEBUG_LEVEL > 0)
+ $view = $forum->prefs->get('threadspage', 25);
+ if(!$view)
{
- print_a($_REQUEST);
- print_a($_GET);
- echo __FILE__ .' Line: '.__LINE__;
- echo " forumId: ".$forumId;
+ $view = 25;
+ }
+ $page = (varset($_GET['p']) ? $_GET['p'] : 1);
+ $threadFrom = ($page - 1) * $view;
+
+ global $forum_info, $FORUM_CRUMB;
+
+ $sc = e107::getScBatch('viewforum', 'forum');
+
+ $forumId = (int) $_REQUEST['id'];
+
+ if(!$forumId && e_QUERY) // BC Fix for old links.
+ {
+ list($id, $from) = explode(".", e_QUERY);
+ $forumId = intval($id);
+ $threadFrom = intval($from);
+ unset($id, $from);
+ }
+
+ if(!$forum->checkPerm($forumId, 'view'))
+ {
+ // header('Location:'.e107::getUrl()->create('forum/forum/main'));
+
+ $url = e107::url('forum', 'index', 'full');
+
+ if(E107_DEBUG_LEVEL > 0)
+ {
+ print_a($_REQUEST);
+ print_a($_GET);
+ echo __FILE__ . ' Line: ' . __LINE__;
+ echo " forumId: " . $forumId;
+ exit;
+ }
+
+
+ e107::getRedirect()->go($url);
+
exit;
}
-
- e107::getRedirect()->go($url);
-
- exit;
-}
-
-$forumInfo = $forum->forumGet($forumId);
-$forumSCvars = array();
+ $forumInfo = $forum->forumGet($forumId);
+ $forumSCvars = array();
//----$threadsViewed = $forum->threadGetUserViewed();
-if (empty($FORUM_VIEW_START))
-{
- if(THEME_LEGACY !== true)
+ if(empty($FORUM_VIEW_START))
{
- $FORUM_VIEWFORUM_TEMPLATE = e107::getTemplate('forum','forum_viewforum');
- }
- else
- {
- if(file_exists(THEME.'templates/forum/forum_viewforum_template.php'))
+ if(THEME_LEGACY !== true)
{
- require_once(THEME.'templates/forum/forum_viewforum_template.php');
- }
- elseif (file_exists(THEME.'forum_viewforum_template.php')) //v1.x
- {
- require_once(THEME.'forum_viewforum_template.php');
- }
- elseif (file_exists(THEME.'forum_template.php')) //v1.x
- {
- require_once(THEME.'forum_template.php');
+ $FORUM_VIEWFORUM_TEMPLATE = e107::getTemplate('forum', 'forum_viewforum');
}
else
{
- require_once(e_PLUGIN.'forum/templates/forum_viewforum_template.php');
+ if(file_exists(THEME . 'templates/forum/forum_viewforum_template.php'))
+ {
+ require_once(THEME . 'templates/forum/forum_viewforum_template.php');
+ }
+ elseif(file_exists(THEME . 'forum_viewforum_template.php')) //v1.x
+ {
+ require_once(THEME . 'forum_viewforum_template.php');
+ }
+ elseif(file_exists(THEME . 'forum_template.php')) //v1.x
+ {
+ require_once(THEME . 'forum_template.php');
+ }
+ else
+ {
+ require_once(e_PLUGIN . 'forum/templates/forum_viewforum_template.php');
+ }
+
}
+
}
-}
+ if(!empty($FORUM_VIEWFORUM_TEMPLATE) && is_array($FORUM_VIEWFORUM_TEMPLATE) && THEME_LEGACY !== true) // New v2.x bootstrap Template.
+ {
+
+ $FORUM_VIEW_CAPTION = $FORUM_VIEWFORUM_TEMPLATE['caption'];
+ $FORUM_VIEW_START_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['start'];
+ $FORUM_VIEW_START = $FORUM_VIEWFORUM_TEMPLATE['header'];
+ $FORUM_VIEW_FORUM = $FORUM_VIEWFORUM_TEMPLATE['item'];
+ $FORUM_VIEW_FORUM_STICKY = $FORUM_VIEWFORUM_TEMPLATE['item-sticky'];
+ $FORUM_VIEW_FORUM_ANNOUNCE = $FORUM_VIEWFORUM_TEMPLATE['item-announce'];
+ $FORUM_VIEW_END = $FORUM_VIEWFORUM_TEMPLATE['footer'];
+ $FORUM_VIEW_END_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['end'];
+ $FORUM_VIEW_SUB_START = $FORUM_VIEWFORUM_TEMPLATE['sub-header'];
+ $FORUM_VIEW_SUB = $FORUM_VIEWFORUM_TEMPLATE['sub-item'];
+ $FORUM_VIEW_SUB_END = $FORUM_VIEWFORUM_TEMPLATE['sub-footer'];
+ $FORUM_IMPORTANT_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-important'];
+ $FORUM_NORMAL_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-normal'];
+
+ $FORUM_CRUMB = $FORUM_VIEWFORUM_TEMPLATE['forum-crumb'];
+
+ }
-if(!empty($FORUM_VIEWFORUM_TEMPLATE) && is_array($FORUM_VIEWFORUM_TEMPLATE) && THEME_LEGACY !== true) // New v2.x bootstrap Template.
-{
-
- $FORUM_VIEW_CAPTION = $FORUM_VIEWFORUM_TEMPLATE['caption'];
- $FORUM_VIEW_START_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['start'];
- $FORUM_VIEW_START = $FORUM_VIEWFORUM_TEMPLATE['header'];
- $FORUM_VIEW_FORUM = $FORUM_VIEWFORUM_TEMPLATE['item'];
- $FORUM_VIEW_FORUM_STICKY = $FORUM_VIEWFORUM_TEMPLATE['item-sticky'];
- $FORUM_VIEW_FORUM_ANNOUNCE = $FORUM_VIEWFORUM_TEMPLATE['item-announce'];
- $FORUM_VIEW_END = $FORUM_VIEWFORUM_TEMPLATE['footer'];
- $FORUM_VIEW_END_CONTAINER = $FORUM_VIEWFORUM_TEMPLATE['end'];
- $FORUM_VIEW_SUB_START = $FORUM_VIEWFORUM_TEMPLATE['sub-header'];
- $FORUM_VIEW_SUB = $FORUM_VIEWFORUM_TEMPLATE['sub-item'];
- $FORUM_VIEW_SUB_END = $FORUM_VIEWFORUM_TEMPLATE['sub-footer'];
- $FORUM_IMPORTANT_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-important'];
- $FORUM_NORMAL_ROW = $FORUM_VIEWFORUM_TEMPLATE['divider-normal'];
-
- $FORUM_CRUMB = $FORUM_VIEWFORUM_TEMPLATE['forum-crumb'];
-
-}
+ $forumInfo['forum_name'] = $tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
+ $forumInfo['forum_description'] = $tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
-
-
-$forumInfo['forum_name'] = $tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
-$forumInfo['forum_description'] = $tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
-
-$_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']);
-define('e_PAGETITLE', $_forum_name.' / '.LAN_FORUM_1001);
+ $_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']);
+ define('e_PAGETITLE', $_forum_name . ' / ' . LAN_FORUM_1001);
// SEO - meta description (auto)
-if(!empty($forumInfo['forum_description']))
-{
- define("META_DESCRIPTION", $tp->text_truncate(
- str_replace(
+ if(!empty($forumInfo['forum_description']))
+ {
+ define("META_DESCRIPTION", $tp->text_truncate(
+ str_replace(
//array('"', "'"), '', strip_tags($tp->toHTML($forumInfo['forum_description']))
- array('"', "'"), '', $tp->toText($forumInfo['forum_description'])
- ), 250, '...'));
-}
-
-$moderatorUserIds = $forum->getModeratorUserIdsByForumId($forumId);
-define('MODERATOR', (USER && in_array(USERID, $moderatorUserIds)));
-
-if (MODERATOR)
-{
- if ($_POST)
- {
- require_once(e_PLUGIN.'forum/forum_mod.php');
- $forumSCvars['message'] = forum_thread_moderate($_POST);
+ array('"', "'"), '', $tp->toText($forumInfo['forum_description'])
+ ), 250, '...'));
}
-}
-if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
-{
- $forum->ajaxModerate();
-}
+ $moderatorUserIds = $forum->getModeratorUserIdsByForumId($forumId);
+ define('MODERATOR', (USER && in_array(USERID, $moderatorUserIds)));
-if(varset($pref['track_online']))
-{
-// $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, 'url')."%') AND online_user_id != 0");
- $guest_users = $sql->count('online', '(*)', "WHERE online_location LIKE('".$tp->filter(e_REQUEST_URI, 'url')."%') AND online_user_id = 0");
+ if(MODERATOR)
+ {
+ if($_POST)
+ {
+ require_once(e_PLUGIN . 'forum/forum_mod.php');
+ $forumSCvars['message'] = forum_thread_moderate($_POST);
+ }
+ }
+
+ if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
+ {
+ $forum->ajaxModerate();
+ }
+
+ if(varset($pref['track_online']))
+ {
+ $member_users = $sql->count('online', '(*)', "WHERE online_location LIKE('" . $tp->filter(e_REQUEST_URI, 'url') . "%') AND online_user_id != 0");
+ $guest_users = $sql->count('online', '(*)', "WHERE online_location LIKE('" . $tp->filter(e_REQUEST_URI, 'url') . "%') AND online_user_id = 0");
+ $users = $member_users + $guest_users;
+
+ }
+ else
+ {
+ $users = 0;
+ $member_users = 0;
+ $guest_users = 0;
- $users = $member_users+$guest_users;
+ }
-}
-else
-{
- $users = 0;
- $member_users= 0;
- $guest_users = 0;
+ require_once(HEADERF);
-}
-
-require_once(HEADERF);
-
-
-$text='';
+ $text = '';
// TODO - message batch shortcode
-/*--
-if ($message)
-{
- //$ns->tablerender('', $message, array('forum_viewforum', 'msg'));
- //e107::getMessage()->add($thread->message);
- $fVars->MESSAGE = $message;
-}
---*/
-
-$threadCount = (int) $forumInfo['forum_threads'];
-
-if ($threadCount > $view)
-{
- $pages = ceil($threadCount/$view);
-}
-else
-{
- $pages = false;
-}
-
-
-if ($pages)
-{
- if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
+ /*--
+ if ($message)
{
- // issue #3087 url need to be decoded first (because the [FROM] get's encoded in url())
- // and to encode the full url to not loose the id param when being used in the $forumSCvars['parms']
- $url = rawurlencode(rawurldecode(e107::url('forum','forum',$forumInfo, array('query'=>array('p'=>'[FROM]')))));
-
- /*--
- $parms = "total={$pages}&type=page¤t={$page}&url=".$url."&caption=off";
- $fVars->THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
- --*/
- $forumSCvars['parms'] = "total={$pages}&type=page¤t={$page}&url=".$url."&caption=off";
-//-- ?????????? unset $ulrparms????
- unset($urlparms);
+ //$ns->tablerender('', $message, array('forum_viewforum', 'msg'));
+ //e107::getMessage()->add($thread->message);
+ $fVars->MESSAGE = $message;
+ }
+ --*/
+
+ $threadCount = (int) $forumInfo['forum_threads'];
+
+ if($threadCount > $view)
+ {
+ $pages = ceil($threadCount / $view);
+ }
+ else
+ {
+ $pages = false;
+ }
+
+
+ if($pages)
+ {
+ if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== false || strpos($FORUM_VIEW_END, 'THREADPAGES') !== false)
+ {
+ // issue #3087 url need to be decoded first (because the [FROM] get's encoded in url())
+ // and to encode the full url to not loose the id param when being used in the $forumSCvars['parms']
+ $url = rawurlencode(rawurldecode(e107::url('forum', 'forum', $forumInfo, array('query' => array('p' => '[FROM]')))));
+ $forumSCvars['parms'] = "total={$pages}&type=page¤t={$page}&url=" . $url . "&caption=off";
+
+ unset($urlparms);
+ }
}
-}
//-- if($forum->checkPerm($forumId, 'thread')) //new thread access only.
-if($forum->checkPerm($forumId, 'post')) //new thread access only.
-{
- $forumSCvars['ntUrl']= e107::url('forum','post')."?f=nt&id=". $forumId;
-/*--
- $ntUrl = e107::url('forum','post')."?f=nt&id=". $forumId;
- $fVars->NEWTHREADBUTTON = "".IMAGE_newthread.'';
- $fVars->NEWTHREADBUTTONX = newthreadjump($ntUrl);
-
-}
-
-if(!BOOTSTRAP)
-{
- $fVars->NEWTHREADBUTTONX = $fVars->NEWTHREADBUTTON;
-}
---*/
-}
+ if($forum->checkPerm($forumId, 'post')) //new thread access only.
+ {
+ $forumSCvars['ntUrl'] = e107::url('forum', 'post') . "?f=nt&id=" . $forumId;
+ }
//XXX What is this?
-if(substr($forumInfo['forum_name'], 0, 1) == '*')
-{
- $forum_info['forum_name'] = substr($forum_info['forum_name'], 1);
- $container_only = true;
-}
-else
-{
- $container_only = false;
-}
+ if(substr($forumInfo['forum_name'], 0, 1) == '*')
+ {
+ $forum_info['forum_name'] = substr($forum_info['forum_name'], 1);
+ $container_only = true;
+ }
+ else
+ {
+ $container_only = false;
+ }
-if(substr($forum_info['sub_parent'], 0, 1) == '*')
-{
- $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
-}
+ if(substr($forum_info['sub_parent'], 0, 1) == '*')
+ {
+ $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
+ }
//----$forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK)
//-- Function eventually to be reworked (move full function to shortcode file, or make a new breadcrumb function, like in downloads, maybe?)
-$forum->set_crumb(true, '', $forumSCvars); // set $BREADCRUMB (and $BACKLINK)
+ $forum->set_crumb(true, '', $forumSCvars); // 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(', ', $modUser);
-$fVars->BROWSERS = '';
---*/
- $forumSCvars['forum_name']= $forumInfo['forum_name'];
- $forumSCvars['forum_description']= $forumInfo['forum_description'];
- $forumSCvars['forum_image']= $forumInfo['forum_image'];
- $forumSCvars['modUser']= $modUser;
- $forumSCvars['track_online']= varset($pref['track_online']);
-
-/*--
-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).')';
-}
-
-
-
-if(defset('BOOTSTRAP')==3 && !empty($FORUM_VIEWFORUM_TEMPLATE['iconkey'])) // v2.x
-{
- $fVars->ICONKEY = $tp->parseTemplate($FORUM_VIEWFORUM_TEMPLATE['iconkey'],true);
-}
-else // v1.x
-{
- $fVars->ICONKEY = "
-
-
- ".IMAGE_new_small." |
- ".LAN_FORUM_0039." |
- ".IMAGE_nonew_small." |
- ".LAN_FORUM_0040." |
- ".IMAGE_sticky_small." |
- ".LAN_FORUM_1011." |
- ".IMAGE_announce_small." |
- ".LAN_FORUM_1013." |
-
-
- ".IMAGE_new_popular_small." |
- ".LAN_FORUM_0039." ".LAN_FORUM_1010." |
- ".IMAGE_nonew_popular_small." |
- ".LAN_FORUM_0040." ".LAN_FORUM_1010." |
- ".IMAGE_stickyclosed_small." |
- ".LAN_FORUM_1012." |
- ".IMAGE_closed_small." |
- ".LAN_FORUM_1014." |
-
-
";
-
-}
---*/
-
-// ----------------- { VIEWABLE_BY } ---------------------------
-/*--
-if($users = $forum->getForumClassMembers($forumId))
-{
- $userList = array();
- if(is_array($users))
+ $modUser = array();
+ $modArray = $forum->forumGetMods();
+ foreach($modArray as $user)
{
- foreach($users as $user)
- {
- $userList[] = "".$user['user_name']."";
- }
-
- $viewable = implode(', ', $userList);;
- }
- elseif($users == 0)
- {
- $viewable = '' ;
- }
- else
- {
- $viewable = e107::getUserClass()->getFixedClassDescription($users);
- }
-
-}
-
-if(!empty($viewable))
-{
-
- $fVars->VIEWABLE_BY = "
-
-
-
Viewable by
-
- ".$viewable."
-
-
-
- ";
-}
-else
-{
- $fVars->VIEWABLE_BY = '';
-}
---*/
-
-// ------------------------------------------------------------
-///TODO XXX All these $fVars items need to be put into a shortcode class so they can be parsed with parms and wrappers. Big Job!
-
-/*--
-$fVars->SEARCH = "
- ";
---*/
-
-/*--
- // ----- 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;
+ $modUser[] = "" . $user['user_name'] . "";
}
- $fVars->PERMS = implode("", $permDisplay);
---*/
+ $forumSCvars['forum_name'] = $forumInfo['forum_name'];
+ $forumSCvars['forum_description'] = $forumInfo['forum_description'];
+ $forumSCvars['forum_image'] = $forumInfo['forum_image'];
+ $forumSCvars['modUser'] = $modUser;
+ $forumSCvars['track_online'] = varset($pref['track_online']);
- // -------------------------------
+ $sticky_threads = 0;
+ $stuck = false;
+ $reg_threads = 0;
+ $unstuck = false;
-$sticky_threads = 0;
-$stuck = false;
-$reg_threads = 0;
-$unstuck = false;
+ $threadFilter = null;
-$threadFilter = null;
-
-if(!empty($_GET['srch']))
-{
- $threadFilter = "t.thread_name LIKE '%".$tp->filter($_GET['srch'], 'w')."%'";
-}
-
-$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter);
-/*--
-$subList = $forum->forumGetSubs(vartrue($forum_id));
---*/
-//------$gen = new convert;
-$forumSCvars['forum_parent']= $forumInfo['forum_parent'];
-/*--
-$fVars->SUBFORUMS = '';
-if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
-{
- $newflag_list = $forum->forumGetUnreadForums();
- $sub_info = '';
- foreach($subList[$forumInfo['forum_parent']][$forumId] as $sub)
+ if(!empty($_GET['srch']))
{
- $sub_info .= parse_sub($sub);
+ $threadFilter = "t.thread_name LIKE '%" . $tp->filter($_GET['srch'], 'w') . "%'";
}
- $fVars->SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
-}
---*/
+
+ $threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter);
+ $forumSCvars['forum_parent'] = $forumInfo['forum_parent'];
+
+ $forum_view_forum = '';
+
if(count($threadList))
{
foreach($threadList as $thread_info)
@@ -550,601 +379,280 @@ if(is_array($subList) && isset($subList[$forumInfo['forum_parent']][$forumId]))
$forum_view_forum .= parse_thread($thread_info);
}
}
-else
-{
- $forum_view_forum .= deftrue('BOOTSTRAP') ? "".LAN_FORUM_1008."
":
-"
";
-}
+ else
+ {
+ $forum_view_forum .= deftrue('BOOTSTRAP') ? "" . LAN_FORUM_1008 . "
" :
+ "
";
+ }
//--$fVars->FORUMJUMP = forumjump();
//--$fVars->TOPLINK = "".LAN_GO.''; // FIXME - TOPLINK not used anymore?
-if($container_only)
-{
- $FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START);
- $FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END);
- $forum_view_forum = '';
-}
+ if($container_only)
+ {
+ $FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START);
+ $FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END);
+ $forum_view_forum = '';
+ }
- $sc->setVars($forumSCvars);
+ $sc->setVars($forumSCvars);
+
+ $forum_view_start = $tp->parseTemplate($FORUM_VIEW_START_CONTAINER . $FORUM_VIEW_START, true, $sc);
+ $forum_view_forum = $tp->parseTemplate($forum_view_forum, true, $sc);
+ $forum_view_end = $tp->parseTemplate($FORUM_VIEW_END . $FORUM_VIEW_END_CONTAINER, true, $sc);
-//var_dump ($FORUM_VIEW_START);
-// var_dump ($FORUM_VIEW_SUB);
-$forum_view_start = $tp->parseTemplate($FORUM_VIEW_START_CONTAINER.$FORUM_VIEW_START, true, $sc);
-$forum_view_forum = $tp->parseTemplate($forum_view_forum, true, $sc);
-$forum_view_end = $tp->parseTemplate($FORUM_VIEW_END.$FORUM_VIEW_END_CONTAINER, true, $sc);
-
-//$forum_view_start .= "
FVARS FORUM
".$tp->simpleParse($FORUM_VIEW_START, $fVars);
-//$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
-
-if ($forum->prefs->get('enclose'))
-{
+ if($forum->prefs->get('enclose'))
+ {
// $forum_view_subs????
- $caption = varset($FORUM_VIEW_CAPTION) ? $tp->parseTemplate($FORUM_VIEW_CAPTION, true, $sc) : $forum->prefs->get('title');
+ $caption = varset($FORUM_VIEW_CAPTION) ? $tp->parseTemplate($FORUM_VIEW_CAPTION, true, $sc) : $forum->prefs->get('title');
- $ns->tablerender($caption, $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, 'forum-viewforum');
-}
-else
-{
- echo $forum_view_start.$forum_view_forum.$forum_view_end;
-}
+ $ns->tablerender($caption, $forum_view_start . /*$forum_view_subs.*/ $forum_view_forum . $forum_view_end, 'forum-viewforum');
+ }
+ else
+ {
+ echo $forum_view_start . $forum_view_forum . $forum_view_end;
+ }
-echo "";
-require_once(FOOTERF);
+ require_once(FOOTERF);
-function parse_thread($thread_info)
-{
-//var_dump ($thread_info);
-/* OLD CODE
- global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
- $tp = e107::getParser();
- $tVars = new e_vars;
- $threadId = $thread_info['thread_id'];
- $forumId = $thread_info['thread_forum_id'];
- $tVars = array();
-
- $tVars['VIEWS'] = $thread_info['thread_views'];
- $tVars['REPLIES'] = $thread_info['thread_total_replies'];
-
- $badge = ($thread_info['thread_views'] > 0) ? "badge-info" : "";
-
- $tVars['REPLIESX'] = "".$thread_info['thread_total_replies']."";
- $tVars['VIEWSX'] = "".$thread_info['thread_views']."";
-
- if ($tVars['REPLIES'])
+ function parse_thread($thread_info)
{
- $lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
- if($thread_info['lastpost_username'])
+
+ // TODO Remove globals.
+ global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
+ $tp = e107::getParser();
+
+ $sc->setVars($thread_info);
+
+ switch($thread_info['thread_sticky'])
{
- // XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
- $url = e107::getUrl()->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
- $tVars['LASTPOST'] = "".$thread_info['lastpost_username']."";
- $tVars['LASTPOSTUSER'] = "".$thread_info['lastpost_username']."";
+ case 1:
+ $_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
+ break;
+
+ case 2:
+ $_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
+ break;
+
+ default:
+ $_TEMPLATE = $FORUM_VIEW_FORUM;
+ break;
}
- else
+
+
+ if(substr($_TEMPLATE, 0, 4) == '') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
{
- if(!$thread_info['thread_lastuser'])
- {
- $tVars['LASTPOST'] = $tp->toHTML($thread_info['thread_lastuser_anon']);
- $tVars['LASTPOSTUSER'] = $tp->toHTML($thread_info['thread_lastuser_anon']);
- }
- else
- {
- $tVars['LASTPOST'] = LAN_FORUM_1015;
- $tVars['LASTPOSTUSER'] = LAN_FORUM_1015;
- }
+
+ $threadId = $thread_info['thread_id'];
+
+ $_TEMPLATE = "
" . substr($_TEMPLATE, 4);
}
- $tVars['LASTPOST'] .= '
'.$lastpost_datestamp;
- $tVars['LASTPOSTUSER'] = $thread_info['lastpost_username']; // $lastpost_name;
+ return $tp->parseTemplate($_TEMPLATE, true, $sc);
- $thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
-
- $urlData = array('forum_sef'=>$thread_info['forum_sef'], 'thread_id'=>$thread_info['thread_id'],'thread_sef'=>$thread_info['thread_sef']);
- $url = e107::url('forum', 'topic', $urlData);
- $url .= (strpos($url,'?')!==false) ? '&' : '?';
- $url .= "last=1#post-".$thread_info['lastpost_id'];
-
- $tVars['LASTPOSTDATE'] .= "". $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short')."";
}
- $newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed));
- $tVars['THREADDATE'] = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
-
- $tVars['THREADTIMELAPSE'] = $gen->computeLapse($thread_info['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
-
-
-
- /// ---------- Icon ----------------
-
- $tVars['ICON'] = ($newflag ? IMAGE_new : IMAGE_nonew);
- if ($tVars['REPLIES'] >= $forum->prefs->get('popular', 10))
+ function forumjump()
{
- $tVars['ICON'] = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
- }
- elseif(empty($tVars['REPLIES']) && defined('IMAGE_noreplies'))
- {
- $tVars['ICON'] = IMAGE_noreplies;
- }
- $tVars['THREADTYPE'] = '';
- if ($thread_info['thread_sticky'] == 1)
- {
- $tVars['ICON'] = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
- $tVars['THREADTYPE'] = '['.LAN_FORUM_1011.']
';
- }
- elseif($thread_info['thread_sticky'] == 2)
- {
- $tVars['ICON'] = IMAGE_announce;
- $tVars['THREADTYPE'] = '['.LAN_FORUM_1013.']
';
- }
- elseif(!$thread_info['thread_active'])
- {
- $tVars['ICON'] = IMAGE_closed;
- }
-
-// $tVars['ICON'] = $tVars['REPLIES'];
-
- // ------------------------------------------------------
-
-
-
-
-
-
-
- $thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
- if(isset($thread_info['thread_options']['poll']))
- {
- $thread_name = '['.LAN_FORUM_1016.'] ' . $thread_name;
- }
-// if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE))))
-// {
-// $thread_name = substr($thread_name, strlen($THREADTYPE));
-// }
- if ($forum->prefs->get('tooltip'))
- {
- $thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook'));
- $tip_length = $forum->prefs->get('tiplength', 400);
- if (strlen($thread_thread) > $tip_length)
+ global $forum;
+ $jumpList = $forum->forumGetAllowed('view');
+ $text = "";
-// $url = e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name));
-
- $thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
- $url = e107::url('forum','topic', $thread_info);
- $tVars['THREADNAME'] = "{$thread_name}";
-
-
- // FIXME - pages -> convert to nextprev shortcode
- /*
- $pages = ceil(($tVars['REPLIES'])/$forum->prefs->get('postspage'));
- $urlparms = $thread_info;
- if ($pages > 1)
- {
- if($pages > 6)
- {
- for($a = 0; $a <= 2; $a++)
- {
- $aa = $a + 1;
- $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
- $urlparms['page'] = $aa;
- $url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars['PAGES'] .= "{$aa}";
- }
- $tVars['PAGES'] .= ' ... ';
- for($a = $pages-3; $a <= $pages-1; $a++)
- {
- $aa = $a + 1;
- $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
- $urlparms['page'] = $aa;
- $url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars['PAGES'] .= "{$aa}";
- }
- }
- else
- {
- for($a = 0; $a <= ($pages-1); $a++)
- {
- $aa = $a + 1;
- $tVars['PAGES'] .= $tVars['PAGES'] ? ' ' : '';
- $urlparms['page'] = $aa;
- $url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $tVars['PAGES'] .= "{$aa}";
- }
- }
- $tVars['PAGES'] = LAN_GOTO.' [ '.$tVars['PAGES'].' ]';
- }
- else
- {
- $tVars['PAGES'] = '';
- }
- */
-/* OLD CODE
-
- $tVars['PAGES'] = fpages($thread_info, $tVars['REPLIES']);
- $tVars['PAGESX'] = fpages($thread_info, $tVars['REPLIES']);
-
- if (MODERATOR)
- {
- // FIXME _URL_ thread name
- // e107::getUrl()->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
- // USED self instead
-
- $moveUrl = e107::url('forum','move', $thread_info);
-
- $tVars['ADMIN_ICONS'] = "
-
- ';
-
- $tVars['ADMINOPTIONS'] = fadminoptions($thread_info);
+ return $text;
}
- if($thread_info['user_name'])
- {
- $tVars['POSTER'] = " $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name']."";
- }
- else
- {
- if($thread_info['thread_user_anon'])
- {
- $tVars['POSTER'] = $tp->toHTML($thread_info['thread_user_anon']);
- }
- else
- {
- $tVars['POSTER'] = LAN_FORUM_1015;
- }
- }
- if (!$tVars['REPLIES'])
- {
- $tVars['REPLIES'] = '0';
- $tVars['REPLIESX'] = "0";
- $tVars['LASTPOST'] = ' - ';
- $tVars['LASTPOSTDATE'] = ' - ';
- }
-
- switch($thread_info['thread_sticky'])
- {
- case 1:
- $_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
- break;
-
- case 2:
- $_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
- break;
-
- default:
- $_TEMPLATE = $FORUM_VIEW_FORUM;
- break;
- }
-
-
- if(substr($_TEMPLATE,0,4) == '
') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
- {
- $_TEMPLATE = "
".substr($_TEMPLATE,4);
- }
-
- if(!deftrue('BOOTSTRAP'))
- {
- $tVars['REPLIESX'] = $tVars['REPLIES'];
- $tVars['VIEWSX'] = $tVars['VIEWS'];
- $tVars['ADMINOPTIONS'] = $tVars['ADMIN_ICONS'];
- }
-
- $tVars['_WRAPPER_'] = 'forum_viewforum';
-
- return $tp->parseTemplate($_TEMPLATE, true, $tVars);
-*/
-// NEW REWRITTEN CODE
- global $sc, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE;
- $tp = e107::getParser();
-
-// Initial ideia, to have a separate shortcode var ($threadsc)....
-// $threadsc = e107::getScBatch('viewforum', 'forum', 'viewforumthread');
-// $threadsc->setVars($thread_info);
- $sc->setVars($thread_info);
-
- switch($thread_info['thread_sticky'])
- {
- case 1:
- $_TEMPLATE = ($FORUM_VIEW_FORUM_STICKY ? $FORUM_VIEW_FORUM_STICKY : $FORUM_VIEW_FORUM);
- break;
-
- case 2:
- $_TEMPLATE = ($FORUM_VIEW_FORUM_ANNOUNCE ? $FORUM_VIEW_FORUM_ANNOUNCE : $FORUM_VIEW_FORUM);
- break;
-
- default:
- $_TEMPLATE = $FORUM_VIEW_FORUM;
- break;
- }
-
-
- if(substr($_TEMPLATE,0,4) == '
') // Inject id into table row. //XXX Find a better way to do this without placing in template. .
+ function fadminoptions($thread_info)
{
- $threadId = $thread_info['thread_id'];
-
- $_TEMPLATE = "
".substr($_TEMPLATE,4);
- }
-
- return $tp->parseTemplate($_TEMPLATE, true, $sc);
-
-}
-
-/*----
-function parse_sub($subInfo)
-{
- global $FORUM_VIEW_SUB, $gen, $newflag_list;
- $tp = e107::getParser();
-// $tVars = new e_vars;
-
- $forumName = $tp->toHTML($subInfo['forum_name'], true);
- $tVars['SUB_FORUMTITLE'] = "{$forumName}";
- $tVars['SUB_DESCRIPTION'] = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
- $tVars['SUB_THREADS'] = $subInfo['forum_threads'];
- $tVars['SUB_REPLIES'] = $subInfo['forum_replies'];
-
- $badgeReplies = ($subInfo['forum_replies']) ? "badge-info" : "";
- $badgeThreads = ($subInfo['forum_replies']) ? "badge-info" : "";
-
- $tVars['SUB_THREADSX'] = "".$subInfo['forum_threads']."";
- $tVars['SUB_REPLIESX'] = "".$subInfo['forum_replies']."";
-
-// $tVars['REPLIESX'] = "".$thread_info['thread_total_replies']."";
-// $tVars['VIEWSX'] = "".$thread_info['thread_views']."";
-
- if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
- {
-
- $tVars['NEWFLAG'] = "".IMAGE_new.'';
- }
- else
- {
- $tVars['NEWFLAG'] = IMAGE_nonew;
- }
-
- if($subInfo['forum_lastpost_info'])
- {
- $tmp = explode('.', $subInfo['forum_lastpost_info']);
- $lp_thread = " $tmp[1]))."'>".IMAGE_post2.'';
- $lp_date = $gen->convert_date($tmp[0], 'forum');
-
- if($subInfo['user_name'])
- {
- $lp_name = " $subInfo['forum_lastpost_user'], 'name' => $subInfo['user_name']))."'>{$subInfo['user_name']}";
- }
- else
- {
- $lp_name = $subInfo['forum_lastpost_user_anon'];
- }
- $tVars['SUB_LASTPOST'] = $lp_date.'
'.$lp_name.' '.$lp_thread;
-
- $tVars['SUB_LASTPOSTDATE'] = $gen->computeLapse($tmp[0], time(), false, false, 'short');
- $tVars['SUB_LASTPOSTUSER'] = $lp_name;
- }
- else
- {
- $tVars['SUB_LASTPOST'] = '-';
- $tVars['SUB_LASTPOSTUSER'] = '';
- $tVars['SUB_LASTPOSTDATE'] = '';
- }
-
- $tVars['_WRAPPER_'] = 'forum_viewforum';
-
- return $tp->parseTemplate($FORUM_VIEW_SUB, true, $tVars);
-}
-----*/
-
-function forumjump()
-{
- global $forum;
- $jumpList = $forum->forumGetAllowed('view');
- $text = "";
- return $text;
-}
-
-function fadminoptions($thread_info)
-{
//-- $tVars here???
//---- $tVars = new e_vars;
- $e107 = e107::getInstance();
- $tp = e107::getParser();
-
+ $e107 = e107::getInstance();
+ $tp = e107::getParser();
+
// $text = "";
- return $text;
-}
-
-
-function fpages($thread_info, $replies)
-{
- global $forum;
- $tp = e107::getParser();
- $replies = (int) $replies;
- $postsPerPage = (int) $forum->prefs->get('postspage');
-
- // Add 1 for the first post in the topic (which technically is not a reply), to make it consistent with the nextprev in the forum_viewtopic page
- $replies = $replies + 1;
-
- $pages = ceil(($replies)/$postsPerPage);
-
- $thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
- $urlparms = $thread_info;
- $text = '';
-
- if ($pages > 1)
+ function fpages($thread_info, $replies)
{
- if($pages > 6)
- {
- for($a = 0; $a <= 2; $a++)
- {
- $aa = $a + 1;
- $text .= $text ? ' ' : '';
- // $urlparms['page'] = $aa;
- // $url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $title = $tp->lanVars(LAN_GOTOPAGEX, $aa);
- $url = e107::url('forum','topic',$urlparms).'&p='.$aa;
- $opts[] = "{$aa}";
- }
- $text .= ' ... ';
- for($a = $pages-3; $a <= $pages-1; $a++)
+ global $forum;
+ $tp = e107::getParser();
+
+ $replies = (int) $replies;
+ $postsPerPage = (int) $forum->prefs->get('postspage');
+
+ // Add 1 for the first post in the topic (which technically is not a reply), to make it consistent with the nextprev in the forum_viewtopic page
+ $replies = $replies + 1;
+
+ $pages = ceil(($replies) / $postsPerPage);
+
+ $thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'], 'dashl');
+ $urlparms = $thread_info;
+ $text = '';
+
+ if($pages > 1)
+ {
+ if($pages > 6)
{
- $aa = $a + 1;
- $text .= $text ? ' ' : '';
- // $urlparms['page'] = $aa;
- // $url = e107::getUrl()->create('forum/thread/view', $urlparms);
- $title = $tp->lanVars(LAN_GOTOPAGEX, $aa);
- $url = e107::url('forum','topic',$urlparms).'&p='.$aa;
- $opts[] = "{$aa}";
+ for($a = 0; $a <= 2; $a++)
+ {
+ $aa = $a + 1;
+ $text .= $text ? ' ' : '';
+ // $urlparms['page'] = $aa;
+
+ // $url = e107::getUrl()->create('forum/thread/view', $urlparms);
+ $title = $tp->lanVars(LAN_GOTOPAGEX, $aa);
+ $url = e107::url('forum', 'topic', $urlparms) . '&p=' . $aa;
+ $opts[] = "{$aa}";
+ }
+ $text .= ' ... ';
+ for($a = $pages - 3; $a <= $pages - 1; $a++)
+ {
+ $aa = $a + 1;
+ $text .= $text ? ' ' : '';
+ // $urlparms['page'] = $aa;
+ // $url = e107::getUrl()->create('forum/thread/view', $urlparms);
+ $title = $tp->lanVars(LAN_GOTOPAGEX, $aa);
+ $url = e107::url('forum', 'topic', $urlparms) . '&p=' . $aa;
+ $opts[] = "{$aa}";
+ }
}
+ else
+ {
+
+ for($a = 0; $a <= ($pages - 1); $a++)
+ {
+ $aa = $a + 1;
+ $text .= $text ? ' ' : '';
+ // $urlparms['page'] = $aa;
+ // $url = e107::getUrl()->create('forum/thread/view', $urlparms);
+ $title = $tp->lanVars(LAN_GOTOPAGEX, $aa);
+ $url = e107::url('forum', 'topic', $urlparms) . '&p=' . $aa;
+ $opts[] = "{$aa}";
+ }
+ }
+
+ if(deftrue('BOOTSTRAP'))
+ {
+ $text = "";
+ }
+ else
+ {
+ $text = implode(" ", $opts); // ."";
+ }
+
}
else
{
+ $text = '';
+ }
- for($a = 0; $a <= ($pages-1); $a++)
+ return $text;
+ }
+
+ function newthreadjump($url)
+ {
+
+ global $forum;
+ $jumpList = $forum->forumGetAllowed('view');
+
+ $text = '";
- $text .= "";
- }
- else
- {
- $text = implode(" ",$opts); // ."";
- }
-
+ $text .= '
+
+ ';
+
+ return $text;
}
- else
- {
- $text = '';
- }
-
- return $text;
-}
-function newthreadjump($url)
-{
- global $forum;
- $jumpList = $forum->forumGetAllowed('view');
- $text = '';
-
- return $text;
-}
-?>
+?>
\ No newline at end of file
diff --git a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
index b510c8daf..532282901 100644
--- a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
@@ -400,10 +400,7 @@ class forum_shortcodes extends e_shortcode
$this->var['forum_name'] = e107::getParser()->toHTML($this->var['forum_name'], true, 'no_hook');
- if(!empty($parm['class']))
- {
- $class = "class='".$parm['class']."'";
- }
+ $class = !empty($parm['class']) ? "class='".$parm['class']."'" : '';
$url = e107::url('forum', 'forum', $this->var);
return "{$this->var['forum_name']}";
diff --git a/e107_plugins/forum/templates/forum_viewtopic_template.php b/e107_plugins/forum/templates/forum_viewtopic_template.php
index ac474f310..66dc17503 100644
--- a/e107_plugins/forum/templates/forum_viewtopic_template.php
+++ b/e107_plugins/forum/templates/forum_viewtopic_template.php
@@ -178,14 +178,16 @@ $FORUMEND = "
-
-
-
+ */
+
+$FORUMEND .= "
Powered by e107 Forum System
";
$FORUMREPLYSTYLE = "
diff --git a/e107_plugins/siteinfo/e_shortcode.php b/e107_plugins/siteinfo/e_shortcode.php
index 6c3f9404b..c21ecc15e 100644
--- a/e107_plugins/siteinfo/e_shortcode.php
+++ b/e107_plugins/siteinfo/e_shortcode.php
@@ -88,7 +88,7 @@ class siteinfo_shortcodes // must match the folder name of the plugin.
return SITETAG;
}
- function sc_sitelogo($parm='')
+ function sc_sitelogo($parm=null)
{
return $this->sc_logo($parm);
}
@@ -168,7 +168,7 @@ class siteinfo_shortcodes // must match the folder name of the plugin.
{
//
$dimensions[0] = $parm['w'];
- $dimensions[1] = $parm['h'];
+ $dimensions[1] = !empty($parm['h']) ? $parm['h'] : 0;
if(empty($parm['noresize']) && !empty($logopref)) // resize by default - avoiding large files.
{