diff --git a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
index 1c2499f6e..33b2c248b 100644
--- a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php
@@ -128,6 +128,7 @@ class forum_shortcodes extends e_shortcode
// To be reworked to get the $forum var
$trackPref = $forum->prefs->get('track');
+//var_dump($forum->checkPerm($this->var['forum_id'], 'post'));
if(!empty($trackPref) && $forum->checkPerm($this->var['forum_id'], 'post'))
{
$uInfo[2] = "".LAN_FORUM_0030."";
@@ -347,7 +348,7 @@ class forum_shortcodes extends e_shortcode
if(USER && is_array($this->newFlagList) && in_array($this->var['forum_id'], $this->newFlagList))
{
- $url = $this->lastpostdata('url');
+ $url = $this->sc_lastpost('url');
return "".IMAGE_new.'';
}
elseif(empty($this->var['forum_replies']) && defined('IMAGE_noreplies'))
@@ -402,7 +403,8 @@ class forum_shortcodes extends e_shortcode
{
// global $f;
// return "".$f['forum_threads']."";
- return "".$this->var['forum_threads']."";
+// EQUAL TO SC_THREADS.......................
+ return $this->var['forum_threads'];
}
@@ -410,7 +412,8 @@ class forum_shortcodes extends e_shortcode
{
// global $f;
// return "".$f['forum_replies']."";
- return "".$this->var['forum_replies']."";
+// EQUAL TO SC_REPLIES.......................
+ return $this->var['forum_replies'];
}
@@ -419,246 +422,21 @@ class forum_shortcodes extends e_shortcode
return (!empty($this->var['text'])) ? "
".LAN_FORUM_0069.": {$this->var['text']}
":"";
}
-//----- ########################################################
-//----- Functions sc_latspostuser, sc_lastpostdate & sc_lastpost to be rewritten, since they pratically use the same code???
-//----- Also, viewforum_shortcodes uses similar shortcodes definitions......
-/*-----
function sc_lastpostuser()
{
-// global $f;
-// $e107 = e107::getInstance();
-// $tp = e107::getParser();
-
-// if ($f['forum_lastpost_info'])
- if ($this->var['forum_lastpost_info'])
- {
-// list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
-// $lastpost_name = $tp->toHTML($f['forum_lastpost_user_anon']);
-
-// if ($f['user_name'])
- $lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
-
- if ($this->var['user_name'])
- {
-
-// $lastpost_name = " $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}";
- $lastpost_name = " $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['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.
-
- return $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
-//---- {
- return "";
-// $fVars->LASTPOSTDATE = "-";
-// $fVars->LASTPOST = '-';
-//---- }
-}
- function sc_lastpostdate()
- {
-// global $f, $forum;
- global $forum;
-// $e107 = e107::getInstance();
-// $tp = e107::getParser();
-$gen = new convert;
-
-// if ($f['forum_lastpost_info'])
- if ($this->var['forum_lastpost_info'])
- {
-// list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
- list($lastpost_datestamp, $lastpost_thread) = explode('.', $this->var['forum_lastpost_info']);
-// if ($f['user_name'])
-// {
-
-// $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']);
- $urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
- $url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
- return "". $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 = "";
- return "-";
-// $fVars->LASTPOST = '-';
-//---- }
-}
- function sc_lastpost()
- {
-
- $e107 = e107::getInstance();
- $gen = new convert;
-
- // if ($f['forum_lastpost_info'])
- if ($this->var['forum_lastpost_info'])
- {
- // list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
- list($lastpost_datestamp, $lastpost_thread) = explode('.', $this->var['forum_lastpost_info']);
- // $lastpost_name = $tp->toHTML($f['forum_lastpost_user_anon']);
- // $lastpost_name = e107::getParser()->toHTML($f['forum_lastpost_user_anon']);
- // if ($f['user_name'])
- $lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
-
- if ($this->var['user_name'])
- {
- // $lastpost_name = " $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}";
- $lastpost_name = " $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['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');
- return $lastpost_datestamp.'
'.$lastpost_name." $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'';
-
- }
- //---- else
- //---- {
- // $fVars->LASTPOSTUSER = "";
- // $fVars->LASTPOSTDATE = "-";
- return '-';
- //---- }
- }
------*/
-
- function lastpostdata($mode='')
- {
-
- if (empty($this->var['forum_lastpost_info']))
- {
- return false;
- }
-
- global $forum;
-
- list($lastpost_datestamp, $lastpost_thread) = explode('.', $this->var['forum_lastpost_info']);
-
- // e107::getDebug()->log($this->var);
-
-
- $lastpost = $forum->threadGetLastpost($lastpost_thread); //FIXME TODO inefficient to have SQL query here.
- $urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
- $url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
-
- if (!empty($this->var['user_name']))
- {
- $lastpost_name = " $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}";
- }
- else
- {
- $lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
- }
-
- $relativeDate = e107::getParser()->toDate($lastpost_datestamp,'relative');
-
- switch($mode)
- {
- // $fVars->LASTPOSTUSER = $lastpost_name;
- case "user":
- return $lastpost_name;
- break;
-
- // $fVars->LASTPOSTDATE .= "". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."";
- case "date":
- return "". $relativeDate."";
- break;
-
- case "url":
- return $url;
- break;
-
- // $fVars->LASTPOST = $lastpost_datestamp.'
'.$lastpost_name." $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'';
- case 'post':
-
- return $relativeDate.'
'.$lastpost_name." ".IMAGE_post2.'';
-
- // code to be executed if n is different from all labels;
- }
-
-
- return false;
-
- // return $lastpost_datestamp;
- /*--
-
- --*/
-
-
- // $fVars->LASTPOST = $lastpost_datestamp.'
'.$lastpost_name." $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'';
-
- /*----
- $fVars->LASTPOSTUSER = $lastpost_name;
- $fVars->LASTPOSTDATE .= "". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."";
- $fVars->LASTPOST = $lastpost_datestamp.'
'.$lastpost_name." $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'';
- -----*/
-
-
-
-
-
- /*----
- else
- {
- $fVars->LASTPOSTUSER = "";
- $fVars->LASTPOSTDATE = "-";
- $fVars->LASTPOST = '-';
- }
- ----*/
-
- }
-
-
- function sc_lastpostuser()
- {
- return $this->lastpostdata('user');
+ return $this->sc_lastpost('username');
}
function sc_lastpostdate()
{
- return $this->lastpostdata('date');
+ return $this->sc_lastpost('datelink');
}
function sc_lastpost($parm = null)
{
+/*
if(!empty($parm['type']))
{
switch($parm['type'])
@@ -687,9 +465,57 @@ $gen = new convert;
}
return $this->lastpostdata('post');
- }
+*/
+ if (empty($this->var['forum_lastpost_info']))
+ {
+ return false;
+ }
+
+ global $forum;
+
+ list($lastpost_datestamp, $lastpost_thread) = explode('.', $this->var['forum_lastpost_info']);
+
+ // e107::getDebug()->log($this->var);
+
+
+ $lastpost = $forum->threadGetLastpost($lastpost_thread); //FIXME TODO inefficient to have SQL query here.
+ $urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
+ $url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
+ $lastpost_username = empty($this->var['user_name']) ? e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']) : " $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}";
+ $relativeDate = e107::getParser()->toDate($lastpost_datestamp,'relative');
+
+ if(!empty($parm['type']))
+ {
+ switch($parm['type'])
+// switch($mode)
+ {
+ case "username":
+ return $lastpost_username;
+// break;
+
+ case "datelink":
+ return "". $relativeDate."";
+// break;
+ case "date":
+ return $relativeDate;
+
+ case "url":
+ return $url;
+// break;
+ case "name":
+ return $lastpost['thread_name'];
+// default:
+
+// return $relativeDate.'
'.$lastpost_name." ".IMAGE_post2.'';
+
+ // code to be executed if n is different from all labels;
+ }
+ }
+ return $relativeDate.'
'.$lastpost_username." ".IMAGE_post2.'';
+ }
+
function sc_startertitle()
{
diff --git a/e107_plugins/forum/templates/forum_template.php b/e107_plugins/forum/templates/forum_template.php
index bd640724a..6915d01e8 100644
--- a/e107_plugins/forum/templates/forum_template.php
+++ b/e107_plugins/forum/templates/forum_template.php
@@ -25,7 +25,9 @@ if (!isset($FORUM_MAIN_PARENT))
}
if (!isset($FORUM_MAIN_FORUM))
{
- $FORUM_MAIN_FORUM = "\n\n\n\n\n\n
";
+ $SC_WRAPPER['LASTPOST:type=date'] = "{---}
";
+ $SC_WRAPPER['LASTPOST:type=url'] = " ".IMAGE_post2."";
+ $FORUM_MAIN_FORUM = "\n\n\n\n\n\n
";
}
if (!isset($FORUM_MAIN_END))
{
@@ -126,6 +128,8 @@ $FORUM_TEMPLATE['main']['parent'] = "
";
+$SC_WRAPPER['REPLIESX'] = "{---}";
+$SC_WRAPPER['THREADSX'] = "{---}";
$FORUM_TEMPLATE['main']['forum'] = "
{NEWFLAG} |
{FORUMNAME} {FORUMDESCRIPTION}{FORUMSUBFORUMS} |
diff --git a/e107_plugins/forum/templates/forum_viewforum_template.php b/e107_plugins/forum/templates/forum_viewforum_template.php
index a04f8e720..ae1ec7eb6 100644
--- a/e107_plugins/forum/templates/forum_viewforum_template.php
+++ b/e107_plugins/forum/templates/forum_viewforum_template.php
@@ -72,6 +72,8 @@ if(empty($FORUM_VIEW_START_CONTAINER))
if (empty($FORUM_VIEW_FORUM)) {
+ $SC_WRAPPER['LASTPOST:type=date'] = "{---}
";
+ $SC_WRAPPER['LASTPOST:type=url'] = " ".IMAGE_post2."";
$FORUM_VIEW_FORUM = "
@@ -89,7 +91,7 @@ if (empty($FORUM_VIEW_FORUM)) {
-
+
";
}
@@ -303,6 +305,7 @@ $FORUM_VIEWFORUM_TEMPLATE['header'] = "{BREADCRU
{SUBFORUMS}";
+$SC_WRAPPER['REPLIESX'] = "{---}";
$FORUM_VIEWFORUM_TEMPLATE['item'] = "
{ICON} |
|