1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-13 08:59:44 +01:00

Minor bug correction and update

Minor bug correction and update
Still work in progress
This commit is contained in:
rica-carv 2024-09-28 22:17:34 +01:00 committed by GitHub
parent 416997604e
commit dc102f8722
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,8 +14,6 @@ e107::lan('forum','menu',true); // English_menu.php or {LANGUAGE}_menu.php
include_once(e_PLUGIN.'forum/forum_class.php');
if(!class_exists('forum_newforumposts_menu'))
{
class forum_newforumposts_menu // plugin folder + menu name (without the .php)
@ -54,7 +52,6 @@ if(!class_exists('forum_newforumposts_menu'))
$this->cacheTag .= "_".$this->menuPref['layout'];
if($text = e107::getCache()->retrieve($this->cacheTag, $this->cacheTime, true))
{
e107::getDebug()->log("New Forum Posts Menu Cache Rendered");
@ -63,6 +60,7 @@ if(!class_exists('forum_newforumposts_menu'))
return null;
}
/*
$sql = e107::getDb();
$this->total['topics'] = $sql->count("forum_thread");
@ -73,14 +71,11 @@ if(!class_exists('forum_newforumposts_menu'))
$tmp = $sql->fetch();
$this->total['views'] = intval($tmp["sum"]);
}
*/
$this->render();
}
private function getQuery()
{
$max_age = vartrue($this->menuPref['maxage'], 0);
@ -95,7 +90,6 @@ if(!class_exists('forum_newforumposts_menu'))
return false;
}
$this->menuPref['layout'] = vartrue($this->menuPref['layout'], 'default');
switch($this->menuPref['layout'])
{
@ -141,11 +135,9 @@ if(!class_exists('forum_newforumposts_menu'))
ORDER BY t.thread_lastpost DESC LIMIT 0, ".vartrue($this->menuPref['display'],10);
}
return $qry;
}
private function render()
{
$tp = e107::getParser();
@ -173,9 +165,6 @@ if(!class_exists('forum_newforumposts_menu'))
$template = e107::getTemplate('forum','newforumposts_menu',$layout);
$param = array();
foreach($this->menuPref as $k=>$v)
@ -183,7 +172,6 @@ if(!class_exists('forum_newforumposts_menu'))
$param['nfp_'.$k] = $v;
}
if($qry)
{
if($results = $sql->gen($qry))
@ -195,22 +183,34 @@ if(!class_exists('forum_newforumposts_menu'))
$sc = e107::getScBatch('view', 'forum')->setScVar('param',$param);
$list = $tp->parseTemplate($template['start'], true);
// $list = $tp->parseTemplate($template['start'], true);
$text = $tp->parseTemplate($template['start'], true);
while($row = $sql->fetch())
{
// var_dump ($row);
// echo "<hr>";
$row['thread_sef'] = $this->forumObj->getThreadSef($row);
$sc->setScVar('postInfo', $row);
$sc->setVars($row);
$list .= $tp->parseTemplate($template['item'], true, $sc);
// $list .= $tp->parseTemplate($template['item'], true, $sc);
$text .= $tp->parseTemplate($template['item'], true, $sc);
++$total_topics;
$total_views += $row['thread_views'];
$total_replies += $row['thread_total_replies'];
}
$TOTALS = array('TOTAL_TOPICS'=>$this->total['topics'], 'TOTAL_VIEWS'=>$this->total['views'], 'TOTAL_REPLIES'=>$this->total['replies']);
// $TOTALS = array('TOTAL_TOPICS'=>$this->total['topics'], 'TOTAL_VIEWS'=>$this->total['views'], 'TOTAL_REPLIES'=>$this->total['replies']);
$TOTALS = array('TOTAL_TOPICS'=>$total_topics, 'TOTAL_VIEWS'=>$total_views, 'TOTAL_REPLIES'=>$total_replies);
$list .= $tp->parseTemplate($template['end'], true, $TOTALS);
$text = $list;
// $list .= $tp->parseTemplate($template['end'], true, $TOTALS);
$text .= $tp->parseTemplate($template['end'], true, $TOTALS);
//
// $text = $list;
}
else
{
@ -221,7 +221,7 @@ if(!class_exists('forum_newforumposts_menu'))
{
$text = LAN_FORUM_MENU_016;
}
//var_dump ($text);
$caption = $this->getCaption();
if(!empty($this->menuPref['scroll']))
@ -230,7 +230,6 @@ if(!class_exists('forum_newforumposts_menu'))
}
// e107::debug('menuPref', $this->menuPref);
e107::getCache()->set($this->cacheTag, $text, true);
$ns->tablerender($caption, $text, 'nfp_menu');
@ -261,7 +260,6 @@ if(!class_exists('forum_newforumposts_menu'))
//$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption'];
}
if (empty($caption))
{
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
@ -270,14 +268,8 @@ if(!class_exists('forum_newforumposts_menu'))
return $caption;
}
}
}
new forum_newforumposts_menu;
new forum_newforumposts_menu;