mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +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(
|
||||
'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()
|
||||
|
@@ -62,12 +62,14 @@ function wmessage_shortcode($parm='')
|
||||
SELECT * FROM #generic
|
||||
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.')';
|
||||
$wmessage = array();
|
||||
$wmessageCaption = array();
|
||||
$wmcaption = '';
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
$wmessage[] = $tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
|
||||
$wmessageCaption[] = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
||||
if(!$wmcaption)
|
||||
{
|
||||
$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
|
||||
@@ -75,10 +77,21 @@ function wmessage_shortcode($parm='')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($wmessage) && $wmessage)
|
||||
{
|
||||
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');
|
||||
}
|
||||
|
@@ -438,14 +438,27 @@ class e_db_mysql
|
||||
$this->mySQLresult = $sQryRes;
|
||||
|
||||
$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
|
||||
// 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);
|
||||
$rc = ($this->pdo) ? $this->fetch() : mysql_fetch_array($fr);
|
||||
$this->total_results = (int) $rc['FOUND_ROWS()'];
|
||||
|
||||
// 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
|
||||
if ((strpos($query,'SQL_CALC_FOUND_ROWS') !== false) && (strpos($query,'SELECT') !== false))
|
||||
{
|
||||
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)
|
||||
{
|
||||
global $db_debug;
|
||||
|
Reference in New Issue
Block a user