[TYPO3-dev] Admin panel problem in my plugin
Tapio Markula
tapio.markula at atwebteam.com
Thu Dec 7 17:02:27 CET 2006
Hi
In my plugin is problem with admin panel
function isModuleSetInTBE_MODULES($modName) {
reset($GLOBALS['TBE_MODULES']);
$loaded=array();
while(list($mkey,$list)=each($GLOBALS['TBE_MODULES'])) {
cause following warning
Warning: reset(): Passed variable is not an array or object
in
/home/httpd/vhosts/t3test.xetpoint.com/httpdocs/t3lib/class.t3lib_befunc.php
on line 2957
Warning: Variable passed to each() is not an array or object in
/home/httpd/vhosts/t3test.xetpoint.com/httpdocs/t3lib/class.t3lib_befunc.php
on line 2959
That happens if the user is not admin but he has admin panel enabled.
I don't figure this - any glue how I could get rid of these warning
messages?
I got anwer:
The function reset() isnt needed if you use foreach! The foreach syntax
does the reset automtically if its needed (maybe not in php4). Furthermore
its faster.
function isModuleSetInTBE_MODULES($modName) {
if(!is_array($GLOBALS['TBE_MODULES']))
$GLOBALS['TBE_MODULES'] = array();
$loaded=array();
foreach($GLOBALS['TBE_MODULES'] as $mkey => $list) {
seems that non-admin users must test module information, but not for
admin users.
I can't XCLASS class.t3lib_befunc.php
but is there any glue, which function in
class.ux_t3lib_tsfebeuserauth.php
the function has been used in following situations:
function extGetCategory_edit($out='') {
global $BE_USER,$Skin_grey_2;
$admConfProperties=Array();
$admConfProperties =
t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'admPanel');
$id = $GLOBALS['TSFE']->id;
$out.=$this->extGetHead('edit');
if ($this->uc['TSFE_adminConfig']['display_edit']) {
// If another page module was specified, replace the default Page
module with the new one
$newPageModule =
trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule)
? $newPageModule : 'web_layout';
...
function extGetCategory_editMenu($editMenu='') {
$confProperties=Array();
$confProperties =
t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.FE_BE');
$typesForDisableToolbarButtons =
t3lib_div::trimExplode(',',strtolower($confProperties['properties']['disableToolbarButtons']),1);
$disableToolbarButtons = array_flip($typesForDisableToolbarButtons);
$editMenu.='<li><a href="#" onclick="return
false;">'.$GLOBALS['LANG']->sL('LLL:EXT:tm_contentaccess/locallang.php:pages').'</a><ul>';
$this->uc['TSFE_adminConfig']['display_edit'] = 1;
if ($this->uc['TSFE_adminConfig']['display_edit']) {
// If another page module was specified, replace the default Page
module with the new one
$newPageModule =
trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule)
? $newPageModule : 'web_layout';
More information about the TYPO3-dev
mailing list