1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-26 01:11:28 +02:00

Merge branch 'e107inc:master' into master

This commit is contained in:
rica-carv
2025-01-10 22:18:01 +00:00
committed by GitHub
4 changed files with 76 additions and 36 deletions

View File

@@ -0,0 +1,24 @@
<?php
// $Id$
if (!defined('e107_INIT')) { exit; }
$FPW_TEMPLATE['form'] = '
<div class="row">
<div class="col-sm-12">
<p>{FPW_TEXT}</p>
<div class="form-group my-2">{FPW_USEREMAIL}</div>
<div class="form-group my-2">{FPW_CAPTCHA_IMG}{FPW_CAPTCHA_INPUT}</div>
<div class="row">
<div class="col-xs-12 m-auto">
{FPW_SUBMIT}
</div>
</div>
</div>
</div>
';
$FPW_TEMPLATE['header'] = '<div id="fpw-page" class="container">';
$FPW_TEMPLATE['footer'] = '</div>';

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'); include_once(e_PLUGIN.'forum/forum_class.php');
if(!class_exists('forum_newforumposts_menu')) if(!class_exists('forum_newforumposts_menu'))
{ {
class forum_newforumposts_menu // plugin folder + menu name (without the .php) class forum_newforumposts_menu // plugin folder + menu name (without the .php)
@@ -31,8 +29,21 @@ if(!class_exists('forum_newforumposts_menu'))
function __construct() function __construct()
{ {
$this->plugPref = e107::pref('forum'); // general forum preferences. $this->plugPref = e107::pref('forum'); // general forum preferences.
$this->menuPref = e107::getMenu()->pref();// ie. popup config details from within menu-manager. // $this->menuPref = e107::getMenu()->pref();// ie. popup config details from within menu-manager.
$this->forumObj = new e107forum; $menuPrefs = e107::getMenu()->pref();// ie. popup config details from within menu-manager.
$this->forumObj = new e107forum;
if(is_string($menuPrefs))
{
parse_str($menuPrefs, $this->menuPref);
}
else
{
$this->menuPref = $menuPrefs;
}
// echo "<hr><hr><hr>";
// var_dump($this->menuPref);
// Set some defaults ... // Set some defaults ...
if (!isset($this->menuPref['title'])) $this->menuPref['title'] = ""; if (!isset($this->menuPref['title'])) $this->menuPref['title'] = "";
@@ -43,8 +54,10 @@ if(!class_exists('forum_newforumposts_menu'))
if (!isset($this->menuPref['scroll'])) $this->menuPref['scroll'] = ""; if (!isset($this->menuPref['scroll'])) $this->menuPref['scroll'] = "";
if (empty($this->menuPref['layout'])) $this->menuPref['layout'] = 'default'; if (empty($this->menuPref['layout'])) $this->menuPref['layout'] = 'default';
$this->cacheTag .= "_".$this->menuPref['layout']; // echo "<hr><hr><hr>";
// var_dump($this->menuPref);
$this->cacheTag .= "_".$this->menuPref['layout'];
if($text = e107::getCache()->retrieve($this->cacheTag, $this->cacheTime, true)) if($text = e107::getCache()->retrieve($this->cacheTag, $this->cacheTime, true))
{ {
@@ -54,6 +67,7 @@ if(!class_exists('forum_newforumposts_menu'))
return null; return null;
} }
/*
$sql = e107::getDb(); $sql = e107::getDb();
$this->total['topics'] = $sql->count("forum_thread"); $this->total['topics'] = $sql->count("forum_thread");
@@ -64,14 +78,11 @@ if(!class_exists('forum_newforumposts_menu'))
$tmp = $sql->fetch(); $tmp = $sql->fetch();
$this->total['views'] = intval($tmp["sum"]); $this->total['views'] = intval($tmp["sum"]);
} }
*/
$this->render(); $this->render();
} }
private function getQuery() private function getQuery()
{ {
$max_age = vartrue($this->menuPref['maxage'], 0); $max_age = vartrue($this->menuPref['maxage'], 0);
@@ -86,7 +97,6 @@ if(!class_exists('forum_newforumposts_menu'))
return false; return false;
} }
$this->menuPref['layout'] = vartrue($this->menuPref['layout'], 'default'); $this->menuPref['layout'] = vartrue($this->menuPref['layout'], 'default');
switch($this->menuPref['layout']) switch($this->menuPref['layout'])
{ {
@@ -132,11 +142,9 @@ if(!class_exists('forum_newforumposts_menu'))
ORDER BY t.thread_lastpost DESC LIMIT 0, ".vartrue($this->menuPref['display'],10); ORDER BY t.thread_lastpost DESC LIMIT 0, ".vartrue($this->menuPref['display'],10);
} }
return $qry; return $qry;
} }
private function render() private function render()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -164,9 +172,6 @@ if(!class_exists('forum_newforumposts_menu'))
$template = e107::getTemplate('forum','newforumposts_menu',$layout); $template = e107::getTemplate('forum','newforumposts_menu',$layout);
$param = array(); $param = array();
foreach($this->menuPref as $k=>$v) foreach($this->menuPref as $k=>$v)
@@ -174,7 +179,6 @@ if(!class_exists('forum_newforumposts_menu'))
$param['nfp_'.$k] = $v; $param['nfp_'.$k] = $v;
} }
if($qry) if($qry)
{ {
if($results = $sql->gen($qry)) if($results = $sql->gen($qry))
@@ -186,22 +190,34 @@ if(!class_exists('forum_newforumposts_menu'))
$sc = e107::getScBatch('view', 'forum')->setScVar('param',$param); $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()) while($row = $sql->fetch())
{ {
// var_dump ($row);
// echo "<hr>";
$row['thread_sef'] = $this->forumObj->getThreadSef($row); $row['thread_sef'] = $this->forumObj->getThreadSef($row);
$sc->setScVar('postInfo', $row); $sc->setScVar('postInfo', $row);
$sc->setVars($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); // $list .= $tp->parseTemplate($template['end'], true, $TOTALS);
$text .= $tp->parseTemplate($template['end'], true, $TOTALS);
$text = $list; //
// $text = $list;
} }
else else
{ {
@@ -212,7 +228,7 @@ if(!class_exists('forum_newforumposts_menu'))
{ {
$text = LAN_FORUM_MENU_016; $text = LAN_FORUM_MENU_016;
} }
//var_dump ($text);
$caption = $this->getCaption(); $caption = $this->getCaption();
if(!empty($this->menuPref['scroll'])) if(!empty($this->menuPref['scroll']))
@@ -221,7 +237,6 @@ if(!class_exists('forum_newforumposts_menu'))
} }
// e107::debug('menuPref', $this->menuPref); // e107::debug('menuPref', $this->menuPref);
e107::getCache()->set($this->cacheTag, $text, true); e107::getCache()->set($this->cacheTag, $text, true);
$ns->tablerender($caption, $text, 'nfp_menu'); $ns->tablerender($caption, $text, 'nfp_menu');
@@ -252,7 +267,6 @@ if(!class_exists('forum_newforumposts_menu'))
//$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption']; //$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption'];
} }
if (empty($caption)) if (empty($caption))
{ {
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS; $caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
@@ -261,14 +275,8 @@ if(!class_exists('forum_newforumposts_menu'))
return $caption; return $caption;
} }
} }
} }
new forum_newforumposts_menu;
new forum_newforumposts_menu;

View File

@@ -185,7 +185,7 @@ class forum_shortcodes extends e_shortcode
} }
// String candidate for USERLIST wrapper // String candidate for USERLIST wrapper
$text .= "<br /><a rel='external' href='".e_BASE."online.php'>".LAN_FORUM_0037."</a> ".LAN_FORUM_0038; $text .= "<br /><a rel='external' href='".e_HTTP."online.php'>".LAN_FORUM_0037."</a> ".LAN_FORUM_0038;
} }
return $text; return $text;
} }

View File

@@ -154,18 +154,26 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_topic_views($parm = null) function sc_topic_views($parm = null)
{ {
$val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0'; $val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0';
if(!empty($parm['raw']))
{
return $val;
}
return e107::getParser()->toBadge($val); return e107::getParser()->toBadge($val);
} }
function sc_topic_replies($parm = null) function sc_topic_replies($parm = null)
{ {
$val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0'; $val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0';
if(!empty($parm['raw']))
{
return $val;
}
return e107::getParser()->toBadge($val); return e107::getParser()->toBadge($val);
} }