mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
Corrected incorrect MySQL row count when using PDO mode. Simple bootstrap 'carousel' mode added to welcome message preferences. For advanced options use the featurebox plugin.
This commit is contained in:
@@ -90,7 +90,8 @@ class generic_ui extends e_admin_ui
|
|||||||
|
|
||||||
|
|
||||||
protected $prefs = array(
|
protected $prefs = array(
|
||||||
'wm_enclose' => array('title'=> WMLAN_05, 'type'=>'boolean', 'data' => 'int','help'=> WMLAN_06), );
|
'wm_enclose' => array('title'=> WMLAN_05, 'type'=>'radio', 'data' => 'int','help'=> WMLAN_06, 'writeParms'=>array('optArray'=>array(0=> LAN_DISABLED, 1=> LAN_ENABLED, 2=> "Enclosed with Carousel"))),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
|
@@ -62,12 +62,14 @@ function wmessage_shortcode($parm='')
|
|||||||
SELECT * FROM #generic
|
SELECT * FROM #generic
|
||||||
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.')';
|
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.')';
|
||||||
$wmessage = array();
|
$wmessage = array();
|
||||||
|
$wmessageCaption = array();
|
||||||
$wmcaption = '';
|
$wmcaption = '';
|
||||||
if($sql->gen($qry))
|
if($sql->gen($qry))
|
||||||
{
|
{
|
||||||
while ($row = $sql->fetch())
|
while ($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
$wmessage[] = $tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
|
$wmessage[] = $tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
|
||||||
|
$wmessageCaption[] = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
||||||
if(!$wmcaption)
|
if(!$wmcaption)
|
||||||
{
|
{
|
||||||
$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
||||||
@@ -75,10 +77,21 @@ function wmessage_shortcode($parm='')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($wmessage) && $wmessage)
|
if (isset($wmessage) && $wmessage)
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
if (vartrue($pref['wm_enclose']))
|
if(intval($pref['wm_enclose']) === 2) // carousel
|
||||||
|
{
|
||||||
|
$carousel= array();
|
||||||
|
foreach($wmessage as $k=>$v)
|
||||||
|
{
|
||||||
|
$carousel['slide-'.$k] = array('caption'=>$wmessageCaption[$k], 'text'=>$ns->tablerender($wmessageCaption[$k],$v, 'wm',true));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo e107::getForm()->carousel('wmessage-carousel',$carousel);
|
||||||
|
}
|
||||||
|
elseif(intval($pref['wm_enclose']) === 1)
|
||||||
{
|
{
|
||||||
$ns->tablerender($wmcaption, implode("<br />",$wmessage), 'wm');
|
$ns->tablerender($wmcaption, implode("<br />",$wmessage), 'wm');
|
||||||
}
|
}
|
||||||
|
@@ -438,14 +438,27 @@ class e_db_mysql
|
|||||||
$this->mySQLresult = $sQryRes;
|
$this->mySQLresult = $sQryRes;
|
||||||
|
|
||||||
$this->total_results = false;
|
$this->total_results = false;
|
||||||
if ((strpos($query,'SQL_CALC_FOUND_ROWS') !== FALSE) && (strpos($query,'SELECT') !== FALSE))
|
|
||||||
{ // Need to get the total record count as well. Return code is a resource identifier
|
// Need to get the total record count as well. Return code is a resource identifier
|
||||||
// Have to do this before any debug action, otherwise this bit gets messed up
|
// Have to do this before any debug action, otherwise this bit gets messed up
|
||||||
$fr = ($this->pdo) ? $this->mySQLaccess->query('SELECT FOUND_ROWS()') : mysql_query('SELECT FOUND_ROWS()', $this->mySQLaccess);
|
if ((strpos($query,'SQL_CALC_FOUND_ROWS') !== false) && (strpos($query,'SELECT') !== false))
|
||||||
$rc = ($this->pdo) ? $this->fetch() : mysql_fetch_array($fr);
|
{
|
||||||
$this->total_results = (int) $rc['FOUND_ROWS()'];
|
if($this->pdo)
|
||||||
|
{
|
||||||
|
$fr = $this->mySQLaccess->query('SELECT FOUND_ROWS()');
|
||||||
|
$rc = $fr->fetchColumn();
|
||||||
|
$this->total_results = (int) $rc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fr = mysql_query('SELECT FOUND_ROWS()', $this->mySQLaccess);
|
||||||
|
$rc = mysql_fetch_array($fr);
|
||||||
|
$this->total_results = (int) $rc['FOUND_ROWS()'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (E107_DEBUG_LEVEL)
|
if (E107_DEBUG_LEVEL)
|
||||||
{
|
{
|
||||||
global $db_debug;
|
global $db_debug;
|
||||||
|
Reference in New Issue
Block a user