Documentation TYPO3 par Ameos

class.t3lib_tsfebeuserauth.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00103 class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth {
00104         var $formfield_uname = '';                      // formfield with login-name
00105         var $formfield_uident = '';             // formfield with password
00106         var $formfield_chalvalue = '';          // formfield with a unique value which is used to encrypt the password and username
00107         var $security_level = '';                               // sets the level of security. *'normal' = clear-text. 'challenged' = hashed password/username from form in $formfield_uident. 'superchallenged' = hashed password hashed again with username.
00108         var $writeStdLog = 0;                                   // Decides if the writelog() function is called at login and logout
00109         var $writeAttemptLog = 0;                               // If the writelog() functions is called if a login-attempt has be tried without success
00110         var $auth_include = '';                                         // this is the name of the include-file containing the login form. If not set, login CAN be anonymous. If set login IS needed.
00111 
00112         var $extNeedUpdate=0;
00113         var $extPublishList='';
00114         var $extPageInTreeInfo=array();
00115         var $ext_forcePreview=0;
00116         var $langSplitIndex=0;
00117         var $extAdmEnabled = 0; // General flag which is set if the adminpanel should be displayed at all..
00118 
00119 
00120 
00121 
00129         function extInitFeAdmin()       {
00130                 $this->extAdminConfig = $this->getTSConfigProp('admPanel');
00131                 if (is_array($this->extAdminConfig['enable.'])) {
00132                         reset($this->extAdminConfig['enable.']);
00133                         while(list($k,$v)=each($this->extAdminConfig['enable.']))       {
00134                                 if ($v) {
00135                                         $this->extAdmEnabled=1; // Enable panel
00136                                         break;
00137                                 }
00138                         }
00139                 }
00140 
00141                         // Init TSFE_EDIT variables if either the admPanel is enabled or if forceDisplayIcons is set
00142                 if($this->extAdmEnabled || $this->extGetFeAdminValue('edit', 'displayIcons'))   {
00143                         $this->TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
00144                 }
00145         }
00146 
00154         function extPrintFeAdminDialog()        {
00155                 $out='';
00156                 if ($this->uc['TSFE_adminConfig']['display_top'])       {
00157                         if ($this->extAdmModuleEnabled('preview'))      $out.= $this->extGetCategory_preview();
00158                         if ($this->extAdmModuleEnabled('cache'))        $out.= $this->extGetCategory_cache();
00159                         if ($this->extAdmModuleEnabled('publish'))      $out.= $this->extGetCategory_publish();
00160                         if ($this->extAdmModuleEnabled('edit'))         $out.= $this->extGetCategory_edit();
00161                         if ($this->extAdmModuleEnabled('tsdebug'))      $out.= $this->extGetCategory_tsdebug();
00162                         if ($this->extAdmModuleEnabled('info'))         $out.= $this->extGetCategory_info();
00163                 }
00164 
00165                 $header='
00166                         <tr class="typo3-adminPanel-hRow" style="background-color:#9ba1a8;">
00167                                 <td colspan="4" nowrap="nowrap">'.
00168                                         $this->extItemLink('top','<img src="'.TYPO3_mainDir.'gfx/ol/'.($this->uc['TSFE_adminConfig']['display_top']?'minus':'plus').'bullet.gif" width="18" height="16" align="absmiddle" border="0" alt="" /><strong>'.$this->extFw($this->extGetLL('adminOptions')).'</strong>').
00169                                         $this->extFw(': '.$this->user['username']).'
00170                                         <img src="clear.gif" width="40" height="1" alt="" />
00171                                         <input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="'.$this->uc['TSFE_adminConfig']['display_top'].'" />'.($this->extNeedUpdate?'<input type="submit" value="'.$this->extGetLL('update').'" />':'').'</td>
00172                         </tr>';
00173 
00174                 $query = !t3lib_div::_GET('id') ? ('<input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'.chr(10)) : '';
00175                         // the dummy field is needed for Firefox: to force a page reload on submit with must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
00176                 $query.= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="">';
00177                 foreach (t3lib_div::_GET() as $k => $v) {
00178                         if ($k != 'TSFE_ADMIN_PANEL')   {
00179                                 if (is_array($v))       {
00180                                         $query.=$this->extPrintFeAdminDialogHiddenFields($k,$v);
00181                                 } else {
00182                                         $query.='<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'">'.chr(10);
00183                                 }
00184                         }
00185                 }
00186 
00187                 $out='
00188 <!--
00189         ADMIN PANEL
00190 -->
00191 <a name="TSFE_ADMIN"></a>
00192 <form name="TSFE_ADMIN_PANEL_FORM" action="'.htmlspecialchars(t3lib_div::getIndpEnv('SCRIPT_NAME')).'#TSFE_ADMIN" method="get" style="margin:0;" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">'.
00193 $query.
00194 '       <table border="0" cellpadding="0" cellspacing="0" class="typo3-adminPanel" style="background-color:#f6f2e6; border: 1px solid black; z-index:0; position:absolute;">'.$header.$out.'
00195         </table>
00196 </form>';
00197 
00198                 if ($this->uc['TSFE_adminConfig']['display_top'])       {
00199                         $out.='<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
00200                         $out.='
00201                         <script type="text/javascript">
00202                                         /*<![CDATA[*/
00203                                 var evalFunc = new evalFunc();
00204                                         // TSFEtypo3FormFieldSet()
00205                                 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)      {       //
00206                                         var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00207                                         var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
00208                                         if (checkbox && theValue==checkboxValue)        {
00209                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
00210                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
00211                                         } else {
00212                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
00213                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
00214                                         }
00215                                 }
00216                                         // TSFEtypo3FormFieldGet()
00217                                 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)        {       //
00218                                         var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00219                                         if (checkbox_off)       {
00220                                                 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
00221                                         }else{
00222                                                 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
00223                                         }
00224                                         TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
00225                                 }
00226                                         /*]]>*/
00227                         </script>
00228                         <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
00229                 }
00230                 return "\n\n\n\n".$out.'<br />';
00231         }
00232 
00242         function extPrintFeAdminDialogHiddenFields($key,&$val)  {
00243                 $out='';
00244                 foreach($val as $k => $v)       {
00245                         if (is_array($v))       {
00246                                 $out.=$this->extPrintFeAdminDialogHiddenFields($key.'['.$k.']',$v);
00247                         } else {
00248                                 $out.='<input type="hidden" name="'.$key.'['.$k.']" value="'.htmlspecialchars($v).'">'.chr(10);
00249                         }
00250                 }
00251                 return $out;
00252         }
00253 
00254 
00255 
00256 
00257 
00258 
00259 
00260 
00261 
00262 
00263 
00264 
00265 
00266 
00267 
00268 
00269         /*****************************************************
00270          *
00271          * Creating sections of the Admin Panel
00272          *
00273          ****************************************************/
00274 
00282         function extGetCategory_preview($out='')        {
00283                 $out.=$this->extGetHead('preview');
00284                 if ($this->uc['TSFE_adminConfig']['display_preview'])   {
00285                         $this->extNeedUpdate = 1;
00286                         $out.= $this->extGetItem('preview_showHiddenPages', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="1"'.($this->uc['TSFE_adminConfig']['preview_showHiddenPages']?' checked="checked"':'').' />');
00287                         $out.= $this->extGetItem('preview_showHiddenRecords', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="1"'.($this->uc['TSFE_adminConfig']['preview_showHiddenRecords']?' checked="checked"':'').' />');
00288 
00289                                 // Simulate date
00290                         $out.= $this->extGetItem('preview_simulateDate', '<input type="checkbox" name="TSFE_ADMIN_PANEL[preview_simulateDate]_cb" onclick="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\',1,0,1);" /><input type="text" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" /><input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="'.$this->uc['TSFE_adminConfig']['preview_simulateDate'].'" />');
00291                         $this->extJSCODE.= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
00292 
00293                                 // Simulate fe_user:
00294                         $options = '<option value="0"></option>';
00295                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00296                                                 'fe_groups.uid, fe_groups.title',
00297                                                 'fe_groups,pages',
00298                                                 'pages.uid=fe_groups.pid AND pages.deleted=0 '.t3lib_BEfunc::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1)
00299                                         );
00300                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
00301                                 $options.= '<option value="'.$row['uid'].'"'.($this->uc['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
00302                         }
00303                         $out.= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
00304                 }
00305                 return $out;
00306         }
00307 
00315         function extGetCategory_cache($out='')  {
00316                 $out.=$this->extGetHead('cache');
00317                 if ($this->uc['TSFE_adminConfig']['display_cache'])     {
00318                         $this->extNeedUpdate=1;
00319                         $out.=$this->extGetItem('cache_noCache', '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_noCache]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[cache_noCache]" value="1"'.($this->uc['TSFE_adminConfig']['cache_noCache']?' checked="checked"':'').' />');
00320 
00321                         $options='';
00322                         $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00323                         $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00324                         $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00325                         $out.=$this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
00326                                         '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00327 
00328                                 // Generating tree:
00329                         $depth=$this->extGetFeAdminValue('cache','clearCacheLevels');
00330                         $outTable='';
00331                         $this->extPageInTreeInfo=array();
00332                         $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00333                         $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00334                         reset($this->extPageInTreeInfo);
00335                         while(list(,$row)=each($this->extPageInTreeInfo))       {
00336                                 $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td><td><img src="clear.gif" width="10" height="1" alt="" /></td><td>'.$this->extFw($this->extGetNumberOfCachedPages($row[0])).'</td></tr>';
00337                         }
00338                         $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00339                         $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
00340                         $out.=$this->extGetItem('cache_cacheEntries', $outTable);
00341 
00342                 }
00343                 return $out;
00344         }
00345 
00353         function extGetCategory_publish($out='')        {
00354                 $out.=$this->extGetHead('publish');
00355                 if ($this->uc['TSFE_adminConfig']['display_publish'])   {
00356                         $this->extNeedUpdate=1;
00357                         $options='';
00358                         $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['publish_levels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00359                         $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['publish_levels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00360                         $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['publish_levels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00361                         $out.=$this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
00362                                         '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00363 
00364                                 // Generating tree:
00365                         $depth=$this->extGetFeAdminValue('publish','levels');
00366                         $outTable='';
00367                         $this->extPageInTreeInfo=array();
00368                         $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00369                         $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00370                         reset($this->extPageInTreeInfo);
00371                         while(list(,$row)=each($this->extPageInTreeInfo))       {
00372                                 $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td><td><img src="clear.gif" width="10" height="1" alt="" /></td><td>'.$this->extFw('...').'</td></tr>';
00373                         }
00374                         $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00375                         $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
00376                         $out.=$this->extGetItem('publish_tree', $outTable);
00377                 }
00378                 return $out;
00379         }
00380 
00388         function extGetCategory_edit($out='')   {
00389                 $out.=$this->extGetHead('edit');
00390                 if ($this->uc['TSFE_adminConfig']['display_edit'])      {
00391 
00392                                 // If another page module was specified, replace the default Page module with the new one
00393                         $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00394                         $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00395 
00396                         $this->extNeedUpdate=1;
00397                         $out.=$this->extGetItem('edit_displayFieldIcons', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="1"'.($this->uc['TSFE_adminConfig']['edit_displayFieldIcons']?' checked="checked"':'').' />');
00398                         $out.=$this->extGetItem('edit_displayIcons', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="1"'.($this->uc['TSFE_adminConfig']['edit_displayIcons']?' checked="checked"':'').' />');
00399                         $out.=$this->extGetItem('edit_editFormsOnPage', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="1"'.($this->uc['TSFE_adminConfig']['edit_editFormsOnPage']?' checked="checked"':'').' />');
00400                         $out.=$this->extGetItem('edit_editNoPopup', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="1"'.($this->uc['TSFE_adminConfig']['edit_editNoPopup']?' checked="checked"':'').' />');
00401 
00402                         $out.=$this->extGetItem('', $this->ext_makeToolBar());
00403                         if (!t3lib_div::_GP('ADMCMD_view'))     {
00404                                 $out.=$this->extGetItem('', '<a href="#" onclick="'.
00405                                         htmlspecialchars('
00406                                                 if (parent.opener && parent.opener.top && parent.opener.top.TS) {
00407                                                         parent.opener.top.fsMod.recentIds["web"]='.intval($GLOBALS['TSFE']->page['uid']).';
00408                                                         if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav)        {
00409                                                                 parent.opener.top.content.nav_frame.refresh_nav();
00410                                                         }
00411                                                         parent.opener.top.goToModule("'.$pageModule.'");
00412                                                         parent.opener.top.focus();
00413                                                 } else {
00414                                                         vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
00415                                                         vHWin.focus();
00416                                                 }
00417                                                 return false;
00418                                                 ').
00419                                         '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
00420                         }
00421                 }
00422                 return $out;
00423         }
00424 
00432         function extGetCategory_tsdebug($out='')        {
00433                 $out.=$this->extGetHead('tsdebug');
00434                 if ($this->uc['TSFE_adminConfig']['display_tsdebug'])   {
00435                         $this->extNeedUpdate=1;
00436 
00437                         $content='';
00438                         $content.=$this->extGetItem('tsdebug_tree', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_tree']?' checked="checked"':'').' />');
00439                         $content.=$this->extGetItem('tsdebug_displayTimes', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayTimes']?' checked="checked"':'').' />');
00440                         $content.=$this->extGetItem('tsdebug_displayMessages', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayMessages']?' checked="checked"':'').' />');
00441                         $content.=$this->extGetItem('tsdebug_LR', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_LR']?' checked="checked"':'').' />');
00442                         $content.=$this->extGetItem('tsdebug_displayContent', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayContent']?' checked="checked"':'').' />');
00443                         $content.=$this->extGetItem('tsdebug_displayQueries', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayQueries']?' checked="checked"':'').' />');
00444                         $content.=$this->extGetItem('tsdebug_forceTemplateParsing', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_forceTemplateParsing']?' checked="checked"':'').' />');
00445 
00446                         $out.='<tr><td colspan="4" nowrap="nowrap"><table border="0" cellpadding="0" cellspacing="0">'.$content.'</table></td></tr>';
00447 
00448                         $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
00449                         $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
00450                         $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
00451                         $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
00452                         $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
00453                         $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td></tr>';
00454                 }
00455                 return $out;
00456         }
00457 
00465         function extGetCategory_info($out='')   {
00466                 $out.=$this->extGetHead('info');
00467                 if ($this->uc['TSFE_adminConfig']['display_info'])      {
00468 
00469                         if (is_array($GLOBALS['TSFE']->imagesOnPage) && $this->extGetFeAdminValue('cache','noCache'))   {
00470                                 reset($GLOBALS['TSFE']->imagesOnPage);
00471                                 $theBytes=0;
00472                                 $count=0;
00473                                 $fileTable='';
00474                                 while(list(,$file)=each($GLOBALS['TSFE']->imagesOnPage))        {
00475                                         $fs=@filesize($file);
00476                                         $fileTable.='<tr><td>'.$this->extFw($file).'</td><td align="right">'.$this->extFw(t3lib_div::formatSize($fs)).'</td></tr>';
00477                                         $theBytes+=$fs;
00478                                         $count++;
00479                                 }
00480                                 $fileTable.='<tr><td><strong>'.$this->extFw('Total number of images:').'</strong></td><td>'.$this->extFw($count).'</td></tr>';
00481                                 $fileTable.='<tr><td><strong>'.$this->extFw('Total image file sizes:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize($theBytes)).'</td></tr>';
00482                                 $fileTable.='<tr><td><strong>'.$this->extFw('Document size:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content))).'</td></tr>';
00483                                 $fileTable.='<tr><td><strong>'.$this->extFw('Total page load:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)+$theBytes)).'</td></tr>';
00484                                 $fileTable.='<tr><td>&nbsp;</td></tr>';
00485                         }
00486 
00487                         $fileTable.='<tr><td>'.$this->extFw('id:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->id).'</td></tr>';
00488                         $fileTable.='<tr><td>'.$this->extFw('type:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->type).'</td></tr>';
00489                         $fileTable.='<tr><td>'.$this->extFw('gr_list:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->gr_list).'</td></tr>';
00490                         $fileTable.='<tr><td>'.$this->extFw('no_cache:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->no_cache).'</td></tr>';
00491                         $fileTable.='<tr><td>'.$this->extFw('fe_user, name:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['username']).'</td></tr>';
00492                         $fileTable.='<tr><td>'.$this->extFw('fe_user, uid:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['uid']).'</td></tr>';
00493                         $fileTable.='<tr><td>&nbsp;</td></tr>';
00494 
00495                                 // parsetime:
00496                         $fileTable.='<tr><td>'.$this->extFw('Total parsetime:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->scriptParseTime.' ms').'</td></tr>';
00497 
00498                         $fileTable='<table border="0" cellpadding="0" cellspacing="0">'.$fileTable.'</table>';
00499 
00500                         $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$fileTable.'</td></tr>';
00501                 }
00502                 return $out;
00503         }
00504 
00505 
00506 
00507 
00508 
00509 
00510 
00511 
00512 
00513 
00514 
00515 
00516 
00517 
00518 
00519 
00520 
00521 
00522         /*****************************************************
00523          *
00524          * Admin Panel Layout Helper functions
00525          *
00526          ****************************************************/
00527 
00538         function extGetHead($pre)       {
00539                 $out.='<img src="'.TYPO3_mainDir.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00540                 $out.='<img src="'.TYPO3_mainDir.'gfx/ol/'.($this->uc['TSFE_adminConfig']['display_'.$pre]?'minus':'plus').'bullet.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00541                 $out.=$this->extFw($this->extGetLL($pre));
00542                 $out=$this->extItemLink($pre,$out);
00543                 return '
00544                                 <tr class="typo3-adminPanel-itemHRow" style="background-color:#abbbb4;">
00545                                         <td colspan="4" nowrap="nowrap" style="border-top:dashed 1px #007a8c;">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc['TSFE_adminConfig']['display_'.$pre].'" /></td>
00546                                 </tr>';
00547         }
00548 
00558         function extItemLink($pre,$str) {
00559                 return '<a href="#" style="text-decoration:none;" onclick="'.
00560                         htmlspecialchars('document.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[display_'.$pre.']\'].value='.($this->uc['TSFE_adminConfig']['display_'.$pre]?'0':'1').'; document.TSFE_ADMIN_PANEL_FORM.submit(); return false;').
00561                         '">'.$str.'</a>';
00562         }
00563 
00574         function extGetItem($pre,$element)      {
00575                 return '
00576                                         <tr class="typo3-adminPanel-itemRow">
00577                                                 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00578                                                 <td nowrap="nowrap">'.($pre ? $this->extFw($this->extGetLL($pre)) : '&nbsp;').'</td>
00579                                                 <td><img src="clear.gif" width="40" height="1" alt="" /></td>
00580                                                 <td>'.$element.'</td>
00581                                         </tr>';
00582 
00583         }
00584 
00591         function extFw($str)    {
00592                 return '<font face="verdana,arial" size="1" color="black">'.$str.'</font>';
00593         }
00594 
00600         function ext_makeToolBar()      {
00601                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00602                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00603                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00604                 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : (TYPO3_mainDir.'sysext/cms/layout/db_new_content_el.php');
00605 
00606 
00607                 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00608                 $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
00609 
00610                 $toolBar = '';
00611                 $id = $GLOBALS['TSFE']->id;
00612                 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'.
00613                                         '<img src="'.TYPO3_mainDir.'gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>';
00614 
00615                 if ($perms&16 && $langAllowed)  {
00616                         $params = '';
00617                         if ($GLOBALS['TSFE']->sys_language_uid) $params = '&sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid;
00618                         $toolBar.='<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.$params.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00619                                                 '<img src="'.TYPO3_mainDir.'gfx/new_record.gif" width="16" height="12" hspace="1" border="0" align="top" title="'.$this->extGetLL('edit_newContentElement').'" alt="" /></a>';
00620                 }
00621                 if ($perms&2)   {
00622                         $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00623                                         '<img src="'.TYPO3_mainDir.'gfx/move_page.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_move_page').'" alt="" /></a>';
00624                 }
00625                 if ($perms&8)   {
00626                         $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00627                                         '<img src="'.TYPO3_mainDir.'gfx/new_page.gif" width="13" height="12" hspace="0" border="0" align="top" title="'.$this->extGetLL('edit_newPage').'" alt="" /></a>';
00628                 }
00629                 if ($perms&2)   {
00630                         $params='&edit[pages]['.$id.']=edit';
00631                         $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00632                                         '<img src="'.TYPO3_mainDir.'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageProperties').'" alt="" /></a>';
00633 
00634                         if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) {
00635                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00636                                         'uid,pid,t3ver_state',  'pages_language_overlay',
00637                                         'pid='.intval($id).' AND sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid.$GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'),
00638                                         '', '', '1');
00639                                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00640                                 $GLOBALS['TSFE']->sys_page->versionOL('pages_language_overlay',$row);
00641                                 if (is_array($row))     {
00642                                         $params='&edit[pages_language_overlay]['.$row['uid'].']=edit';
00643                                         $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00644                                                         '<img src="'.TYPO3_mainDir.'gfx/edit3.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageOverlay').'" alt="" /></a>';
00645                                 }
00646                         }
00647                 }
00648                 if ($this->check('modules','web_list')) {
00649                         $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00650                                         '<img src="'.TYPO3_mainDir.'gfx/list.gif" width="11" height="11" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_db_list').'" alt="" /></a>';
00651                 }
00652                 return $toolBar;
00653         }
00654 
00655 
00656 
00657 
00658 
00659 
00660 
00661 
00662 
00663 
00664 
00665 
00666 
00667 
00668 
00669 
00670 
00671 
00672 
00673         /*****************************************************
00674          *
00675          * TSFE BE user Access Functions
00676          *
00677          ****************************************************/
00678 
00686         function checkBackendAccessSettingsFromInitPhp()        {
00687                 global $TYPO3_CONF_VARS;
00688 
00689                 // **********************
00690                 // Check Hardcoded lock on BE:
00691                 // **********************
00692                 if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0)    {
00693                         return FALSE;
00694                 }
00695 
00696                 // **********************
00697                 // Check IP
00698                 // **********************
00699                 if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00700                         if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList']))      {
00701                                 return FALSE;
00702                         }
00703                 }
00704 
00705 
00706                 // **********************
00707                 // Check SSL (https)
00708                 // **********************
00709                 if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && $TYPO3_CONF_VARS['BE']['lockSSL'] != 3)        {
00710                         if (!t3lib_div::getIndpEnv('TYPO3_SSL'))        {
00711                                 return FALSE;
00712                         }
00713                 }
00714 
00715                         // Finally a check from t3lib_beuserauth::backendCheckLogin()
00716                 if (!$TYPO3_CONF_VARS['BE']['adminOnly'] || $this->isAdmin())   {
00717                         return TRUE;
00718                 } else return FALSE;
00719          }
00720 
00721 
00731         function extPageReadAccess($pageRec)    {
00732                 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
00733         }
00734 
00742         function extAdmModuleEnabled($key)      {
00743                         // Returns true if the module checked is "preview" and the forcePreview flag is set.
00744                 if ($key=="preview" && $this->ext_forcePreview) return true;
00745                         // If key is not set, only "all" is checked
00746                 if ($this->extAdminConfig['enable.']['all'])    return true;
00747                 if ($this->extAdminConfig['enable.'][$key])     {
00748                         return true;
00749                 }
00750         }
00751 
00758         function extSaveFeAdminConfig() {
00759                 $input = t3lib_div::_GET('TSFE_ADMIN_PANEL');
00760                 if (is_array($input))   {
00761                                 // Setting
00762                         $this->uc['TSFE_adminConfig'] = array_merge(!is_array($this->uc['TSFE_adminConfig'])?array():$this->uc['TSFE_adminConfig'], $input);                    // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
00763                         unset($this->uc['TSFE_adminConfig']['action']);
00764 
00765                                 // Actions:
00766                         if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache'))      {
00767                                 $this->extPageInTreeInfo=array();
00768                                 $theStartId = intval($input['cache_clearCacheId']);
00769                                 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
00770                         }
00771                         if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish'))       {
00772                                 $theStartId = intval($input['publish_id']);
00773                                 $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
00774                         }
00775 
00776                                 // Saving
00777                         $this->writeUC();
00778                 }
00779                 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR');
00780                 if ($this->extGetFeAdminValue('cache','noCache'))       {$GLOBALS['TSFE']->set_no_cache();}
00781         }
00782 
00790         function extGetFeAdminValue($pre,$val='')       {
00791                 if ($this->extAdmModuleEnabled($pre))   {       // Check if module is enabled.
00792                                 // Exceptions where the values can be overridden from backend:
00793                                 // deprecated
00794                         if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons'])     {
00795                                 return true;
00796                         }
00797                         if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons'])   {
00798                                 return true;
00799                         }
00800 
00801                                 // override all settings with user TSconfig
00802                         if ($this->extAdminConfig['override.'][$pre.'.'][$val] && $val) {
00803                                 return $this->extAdminConfig['override.'][$pre.'.'][$val];
00804                         }
00805                         if ($this->extAdminConfig['override.'][$pre])   {
00806                                 return $this->extAdminConfig['override.'][$pre];
00807                         }
00808 
00809                         $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1;
00810 
00811                         if ($pre=='preview' && $this->ext_forcePreview) {
00812                                 if (!$val)      {
00813                                         return true;
00814                                 } else {
00815                                         return $retVal;
00816                                 }
00817                         }
00818 
00819                                 // regular check:
00820                         if ($this->extIsAdmMenuOpen($pre))      {       // See if the menu is expanded!
00821                                 return $retVal;
00822                         }
00823                 }
00824         }
00825 
00832         function extIsAdmMenuOpen($pre) {
00833                 return $this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre];
00834         }
00835 
00836 
00837 
00838 
00839 
00840 
00841 
00842 
00843 
00844 
00845 
00846 
00847 
00848 
00849 
00850 
00851         /*****************************************************
00852          *
00853          * TSFE BE user Access Functions
00854          *
00855          ****************************************************/
00856 
00867         function extGetTreeList($id,$depth,$begin=0,$perms_clause)      {
00868                 $depth=intval($depth);
00869                 $begin=intval($begin);
00870                 $id=intval($id);
00871                 $theList='';
00872 
00873                 if ($id && $depth>0)    {
00874                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00875                                                 'uid,title',
00876                                                 'pages',
00877                                                 'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND deleted=0 AND '.$perms_clause
00878                                         );
00879                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
00880                                 if ($begin<=0)  {
00881                                         $theList.=$row['uid'].',';
00882                                         $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth);
00883                                 }
00884                                 if ($depth>1)   {
00885                                         $theList.=$this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
00886                                 }
00887                         }
00888                 }
00889                 return $theList;
00890         }
00891 
00898         function extGetNumberOfCachedPages($page_id)    {
00899                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id));
00900                 list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00901                 return $num;
00902         }
00903 
00904 
00905 
00906 
00907 
00908 
00909 
00910 
00911 
00912 
00913 
00914 
00915 
00916 
00917 
00918 
00919 
00920 
00921 
00922 
00923 
00924         /*****************************************************
00925          *
00926          * Localization handling
00927          *
00928          ****************************************************/
00929 
00937         function extGetLL($key) {
00938                 global $LOCAL_LANG;
00939                 if (!is_array($LOCAL_LANG))     {
00940                         $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
00941                         #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
00942                         if (!is_array($LOCAL_LANG))             $LOCAL_LANG=array();
00943                 }
00944 
00945                 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));    // Label string in the default backend output charset.
00946 
00947                         // Convert to utf-8, then to entities:
00948                 if ($GLOBALS['LANG']->charSet!='utf-8') {
00949                         $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
00950                 }
00951                 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
00952 
00953                         // Return the result:
00954                 return $labelStr;
00955         }
00956 
00957 
00958 
00959 
00960 
00961 
00962 
00963 
00964 
00965 
00966 
00967 
00968 
00969         /*****************************************************
00970          *
00971          * Frontend Editing
00972          *
00973          ****************************************************/
00974 
00981         function extIsEditAction()      {
00982                 if (is_array($this->TSFE_EDIT)) {
00983                         if ($this->TSFE_EDIT['cancel']) {
00984                                 unset($this->TSFE_EDIT['cmd']);
00985                         } else {
00986                                 $cmd = (string)$this->TSFE_EDIT['cmd'];
00987                                 if (($cmd!='edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd!='new')  {
00988                                                 // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sendt because of .keepGoing flag.
00989                                         return true;
00990                                 }
00991                         }
00992                 }
00993                 return false;
00994         }
00995 
01003         function extIsFormShown()       {
01004                 if (is_array($this->TSFE_EDIT)) {
01005                         $cmd=(string)$this->TSFE_EDIT['cmd'];
01006                         if ($cmd=='edit' || $cmd=='new')        {
01007                                 return true;
01008                         }
01009                 }
01010         }
01011 
01019         function extEditAction()        {
01020                 global $TCA, $TYPO3_CONF_VARS;
01021                         // Commands:
01022                 list($table,$uid) = explode(':',$this->TSFE_EDIT['record']);
01023                 if ($this->TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table]))   {
01024                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01025                         $tce->stripslashes_values=0;
01026                         $recData=array();
01027                         $cmdData=array();
01028                         $cmd=$this->TSFE_EDIT['cmd'];
01029 
01030                         // ****************
01031                         // extEditAction HOOK
01032                         // ****************
01033                         if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
01034                                 $_params = array();
01035                                 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
01036                                                                 t3lib_div::callUserFunction($_funcRef,$_params,$this);
01037                                 }
01038                         }
01039 
01040                         switch($cmd)    {
01041                                 case 'hide':
01042                                 case 'unhide':
01043                                         $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
01044                                         if ($hideField) {
01045                                                 $recData[$table][$uid][$hideField]=($cmd=='hide'?1:0);
01046                                                 $tce->start($recData,Array());
01047                                                 $tce->process_datamap();
01048                                         }
01049                                 break;
01050                                 case 'up':
01051                                 case 'down':
01052                                         $sortField = $TCA[$table]['ctrl']['sortby'];
01053                                         if ($sortField) {
01054                                                 if ($cmd=='up') {
01055                                                         $op= '<';
01056                                                         $desc=' DESC';
01057                                                 } else {
01058                                                         $op= '>';
01059                                                         $desc='';
01060                                                 }
01061                                                         // Get self:
01062                                                 $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
01063                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
01064                                                 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01065                                                                 // record before or after
01066                                                         $preview = $this->extGetFeAdminValue('preview');
01067                                                         $copyAfterFieldsQuery = '';
01068                                                         if ($preview)   {$ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);}
01069                                                         if ($TCA[$table]['ctrl']['copyAfterDuplFields'])        {
01070                                                                 $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
01071                                                                 while(list(,$fN)=each($cAFields))       {
01072                                                                         $copyAfterFieldsQuery.=' AND '.$fN.'="'.$row[$fN].'"';
01073                                                                 }
01074                                                         }
01075 
01076                                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01077                                                                                 'uid,pid',
01078                                                                                 $table,
01079                                                                                 'pid='.intval($row['pid']).
01080                                                                                         ' AND '.$sortField.$op.intval($row[$sortField]).
01081                                                                                         $copyAfterFieldsQuery.
01082                                                                                         $GLOBALS['TSFE']->sys_page->enableFields($table,'',$ignore),
01083                                                                                 '',
01084                                                                                 $sortField.$desc,
01085                                                                                 '2'
01086                                                                         );
01087                                                         if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))        {
01088                                                                 if($cmd=='down')        {
01089                                                                         $cmdData[$table][$uid]['move']= -$row2['uid'];
01090                                                                 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {        // Must take the second record above...
01091                                                                         $cmdData[$table][$uid]['move']= -$row3['uid'];
01092                                                                 } else {        // ... and if that does not exist, use pid
01093                                                                         $cmdData[$table][$uid]['move']= $row['pid'];
01094                                                                 }
01095                                                         } elseif ($cmd=='up') {
01096                                                                 $cmdData[$table][$uid]['move']= $row['pid'];
01097                                                         }
01098                                                 }
01099                                                 if (count($cmdData))    {
01100                                                         $tce->start(Array(),$cmdData);
01101                                                         $tce->process_cmdmap();
01102                                                 }
01103                                         }
01104                                 break;
01105                                 case 'delete':
01106                                         $cmdData[$table][$uid]['delete']= 1;
01107                                         if (count($cmdData))    {
01108                                                 $tce->start(Array(),$cmdData);
01109                                                 $tce->process_cmdmap();
01110                                         }
01111                                 break;
01112                         }
01113                 }
01114                         // Data:
01115                 if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data']))       {
01116                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01117                         $tce->stripslashes_values=0;
01118                         $tce->start($this->TSFE_EDIT['data'],Array());
01119                         $tce->process_uploads($_FILES);
01120                         $tce->process_datamap();
01121                 }
01122         }
01123 }
01124 
01125 
01126 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php'])    {
01127         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);
01128 }
01129 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6