diff --git a/e107_plugins/forum/newforumposts_menu.php b/e107_plugins/forum/newforumposts_menu.php index 8ee591536..ab38ff52b 100755 --- a/e107_plugins/forum/newforumposts_menu.php +++ b/e107_plugins/forum/newforumposts_menu.php @@ -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) @@ -31,8 +29,14 @@ if(!class_exists('forum_newforumposts_menu')) function __construct() { $this->plugPref = e107::pref('forum'); // general forum preferences. - $this->menuPref = e107::getMenu()->pref();// ie. popup config details from within menu-manager. - $this->forumObj = new e107forum; +// $this->menuPref = e107::getMenu()->pref();// ie. popup config details from within menu-manager. + $menuPrefs = e107::getMenu()->pref();// ie. popup config details from within menu-manager. + $this->forumObj = new e107forum; + + parse_str($menuPrefs, $this->menuPref); + +// echo "


"; +// var_dump($this->menuPref); // Set some defaults ... if (!isset($this->menuPref['title'])) $this->menuPref['title'] = ""; @@ -43,8 +47,10 @@ if(!class_exists('forum_newforumposts_menu')) if (!isset($this->menuPref['scroll'])) $this->menuPref['scroll'] = ""; if (empty($this->menuPref['layout'])) $this->menuPref['layout'] = 'default'; - $this->cacheTag .= "_".$this->menuPref['layout']; +// echo "


"; +// var_dump($this->menuPref); + $this->cacheTag .= "_".$this->menuPref['layout']; if($text = e107::getCache()->retrieve($this->cacheTag, $this->cacheTime, true)) { @@ -54,6 +60,7 @@ if(!class_exists('forum_newforumposts_menu')) return null; } +/* $sql = e107::getDb(); $this->total['topics'] = $sql->count("forum_thread"); @@ -64,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); @@ -86,7 +90,6 @@ if(!class_exists('forum_newforumposts_menu')) return false; } - $this->menuPref['layout'] = vartrue($this->menuPref['layout'], 'default'); switch($this->menuPref['layout']) { @@ -132,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(); @@ -164,9 +165,6 @@ if(!class_exists('forum_newforumposts_menu')) $template = e107::getTemplate('forum','newforumposts_menu',$layout); - - - $param = array(); foreach($this->menuPref as $k=>$v) @@ -174,7 +172,6 @@ if(!class_exists('forum_newforumposts_menu')) $param['nfp_'.$k] = $v; } - if($qry) { if($results = $sql->gen($qry)) @@ -186,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 "
"; + $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 { @@ -212,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'])) @@ -221,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'); @@ -252,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; @@ -261,14 +268,8 @@ if(!class_exists('forum_newforumposts_menu')) return $caption; } - } - } - -new forum_newforumposts_menu; - - - +new forum_newforumposts_menu; \ No newline at end of file diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index b1b6fb381..a80660b8b 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -154,18 +154,26 @@ class plugin_forum_view_shortcodes extends e_shortcode function sc_topic_views($parm = null) { - $val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0'; - + + if(!empty($parm['raw'])) + { + return $val; + } + return e107::getParser()->toBadge($val); } function sc_topic_replies($parm = null) { - $val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0'; + if(!empty($parm['raw'])) + { + return $val; + } + return e107::getParser()->toBadge($val); }