1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Protect admin-area tablerender() from conflicts.

This commit is contained in:
Cameron
2013-05-08 17:11:17 -07:00
parent 6963333389
commit 91f0d4520f
2 changed files with 201 additions and 156 deletions

View File

@@ -784,23 +784,25 @@ if (!class_exists('e107table', false))
public $eMenuArea; public $eMenuArea;
public $eMenuTotal = array(); public $eMenuTotal = array();
public $eSetStyle; public $eSetStyle;
private $themeClass = '';
private $adminThemeClass = '';
function __construct()
{
// $this->themeClass = e107::getPref('sitetheme')."_theme"; // disabled at the moment.
$this->adminThemeClass = e107::getPref('admintheme')."_admintheme"; // Check for a class.
}
/** /**
* @param $caption * @param $caption string caption text
* @param $text * @param $text body text
* @param $mode * @param $mode unique identifier
* @param $return boolean : return the html instead of echo it. * @param $return boolean : return the html instead of echo it.
* @return null
*/ */
function tablerender($caption, $text, $mode = 'default', $return = false) public function tablerender($caption, $text, $mode = 'default', $return = false)
{ {
/*
# Render style table
# - parameter #1: string $caption, caption text
# - parameter #2: string $text, body text
# - return null
# - scope public
*/
$override_tablerender = e107::getSingleton('override', e_HANDLER.'override_class.php')->override_check('tablerender'); $override_tablerender = e107::getSingleton('override', e_HANDLER.'override_class.php')->override_check('tablerender');
if ($override_tablerender) if ($override_tablerender)
@@ -820,8 +822,9 @@ if (!class_exists('e107table', false))
{ {
$this->eMenuCount++; $this->eMenuCount++;
} }
ob_start(); ob_start();
tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle)); $this->tablestyle($caption, $text, $mode);
$ret=ob_get_contents(); $ret=ob_get_contents();
ob_end_clean(); ob_end_clean();
@@ -834,11 +837,48 @@ if (!class_exists('e107table', false))
{ {
$this->eMenuCount++; $this->eMenuCount++;
} }
tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle));
$this->tablestyle($caption, $text, $mode);
return ''; return '';
} }
} }
/**
* Output the styled template.
* @param $caption
* @param $text
* @param $mode
*/
private function tablestyle($caption, $text, $mode)
{
if(class_exists($this->adminThemeClass))
{
$thm = new $this->adminThemeClass();
} }
elseif(class_exists($this->themeClass)) // disabled at the moment.
{
$thm = new $this->themeClass();
}
if(is_object($thm))
{
$thm->tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle));
}
else
{
tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle));
}
}
}
} }
//############################################################# //#############################################################

View File

@@ -48,6 +48,9 @@ else
$no_core_css = TRUE; $no_core_css = TRUE;
class bootstrap_admintheme
{
function tablestyle($caption, $text, $mode) function tablestyle($caption, $text, $mode)
{ {
global $style; global $style;
@@ -201,6 +204,8 @@ function tablestyle($caption, $text, $mode)
break; break;
} }
} }
}
$HEADER = ''; $HEADER = '';
$FOOTER = ''; $FOOTER = '';