/src/typo3_src-4.2.0alpha1/t3lib/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                 $row = '<img src="'.TYPO3_mainDir.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00166                 $row.= '<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="" />';
00167                 $row.= '<strong>'.$this->extFw($this->extGetLL('adminOptions')).'</strong>';
00168                 $row.= $this->extFw(': '.$this->user['username']);
00169 
00170                 $header = '
00171                         <tr class="typo3-adminPanel-hRow" style="background-color:#9ba1a8;">
00172                                 <td colspan="4" style="text-align:left; white-space:nowrap;">'.
00173                                         $this->extItemLink('top',$row).'
00174                                         <img src="clear.gif" width="40" height="1" alt="" />
00175                                         <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>
00176                         </tr>';
00177 
00178                 $query = !t3lib_div::_GET('id') ? ('<input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'.chr(10)) : '';
00179                         // 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")
00180                 $query.= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="">';
00181                 foreach (t3lib_div::_GET() as $k => $v) {
00182                         if ($k != 'TSFE_ADMIN_PANEL') {
00183                                 if (is_array($v)) {
00184                                         $query.= $this->extPrintFeAdminDialogHiddenFields($k,$v);
00185                                 } else {
00186                                         $query.= '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'">'.chr(10);
00187                                 }
00188                         }
00189                 }
00190 
00191                 $out = '
00192 <!--
00193         ADMIN PANEL
00194 -->
00195 <a name="TSFE_ADMIN"></a>
00196 <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)">'.
00197 $query.'
00198         <table border="0" cellpadding="0" cellspacing="0" class="typo3-adminPanel" style="background-color:#f6f2e6; border: 1px solid black; z-index:0; position:absolute;" summary="">'.
00199                 $header.
00200                 $out.'
00201         </table>
00202 </form>';
00203 
00204                 if ($this->uc['TSFE_adminConfig']['display_top']) {
00205                         $out.= '<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
00206                         $out.= '
00207                         <script type="text/javascript">
00208                                         /*<![CDATA[*/
00209                                 var evalFunc = new evalFunc();
00210                                         // TSFEtypo3FormFieldSet()
00211                                 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)      {       //
00212                                         var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00213                                         var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
00214                                         if (checkbox && theValue==checkboxValue)        {
00215                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
00216                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
00217                                         } else {
00218                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
00219                                                 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
00220                                         }
00221                                 }
00222                                         // TSFEtypo3FormFieldGet()
00223                                 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)        {       //
00224                                         var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00225                                         if (checkbox_off)       {
00226                                                 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
00227                                         }else{
00228                                                 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
00229                                         }
00230                                         TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
00231                                 }
00232                                         /*]]>*/
00233                         </script>
00234                         <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
00235                 }
00236                 return "\n\n\n\n".$out.'<br />';
00237         }
00238 
00248         function extPrintFeAdminDialogHiddenFields($key,&$val)  {
00249                 $out = '';
00250                 foreach($val as $k => $v)       {
00251                         if (is_array($v))       {
00252                                 $out.= $this->extPrintFeAdminDialogHiddenFields($key.'['.$k.']',$v);
00253                         } else {
00254                                 $out.= '<input type="hidden" name="'.$key.'['.$k.']" value="'.htmlspecialchars($v).'">'.chr(10);
00255                         }
00256                 }
00257                 return $out;
00258         }
00259 
00260 
00261 
00262 
00263 
00264 
00265 
00266 
00267 
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275         /*****************************************************
00276          *
00277          * Creating sections of the Admin Panel
00278          *
00279          ****************************************************/
00280 
00288         function extGetCategory_preview($out='')        {
00289                 $out.= $this->extGetHead('preview');
00290                 if ($this->uc['TSFE_adminConfig']['display_preview']) {
00291                         $this->extNeedUpdate = 1;
00292                         $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"':'').' />');
00293                         $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"':'').' />');
00294 
00295                                 // Simulate date
00296                         $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'].'" />');
00297                         $this->extJSCODE.= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
00298 
00299                                 // Simulate fe_user:
00300                         $options = '<option value="0">&nbsp;</option>';
00301                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00302                                                 'fe_groups.uid, fe_groups.title',
00303                                                 'fe_groups,pages',
00304                                                 'pages.uid=fe_groups.pid AND pages.deleted=0 '.t3lib_BEfunc::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1)
00305                                         );
00306                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00307                                 $options.= '<option value="'.$row['uid'].'"'.($this->uc['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
00308                         }
00309                         $out.= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
00310                 }
00311                 return $out;
00312         }
00313 
00321         function extGetCategory_cache($out='')  {
00322                 $out.= $this->extGetHead('cache');
00323                 if ($this->uc['TSFE_adminConfig']['display_cache'])     {
00324                         $this->extNeedUpdate = 1;
00325                         $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"':'').' />');
00326 
00327                         $options = '';
00328                         $options.= '<option value="0"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00329                         $options.= '<option value="1"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00330                         $options.= '<option value="2"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00331 
00332                         $out.= $this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
00333                                         '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00334 
00335                                 // Generating tree:
00336                         $depth = $this->extGetFeAdminValue('cache','clearCacheLevels');
00337                         $outTable = '';
00338                         $this->extPageInTreeInfo = array();
00339                         $this->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00340                         $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00341                         reset($this->extPageInTreeInfo);
00342                         while(list(,$row)=each($this->extPageInTreeInfo)) {
00343                                 $outTable.= '
00344                                         <tr>
00345                                                 <td style="white-space: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>
00346                                                 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00347                                                 <td>'.$this->extFw($this->extGetNumberOfCachedPages($row[0])).'</td>
00348                                         </tr>';
00349                         }
00350                         $outTable = '<br /><table border="0" cellpadding="0" cellspacing="0" summary="">'.$outTable.'</table>';
00351                         $outTable.= '<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
00352 
00353                         $out.= $this->extGetItem('cache_cacheEntries', $outTable);
00354                 }
00355                 return $out;
00356         }
00357 
00365         function extGetCategory_publish($out='')        {
00366                 $out.= $this->extGetHead('publish');
00367                 if ($this->uc['TSFE_adminConfig']['display_publish']) {
00368                         $this->extNeedUpdate = 1;
00369                         $options = '';
00370                         $options.= '<option value="0"'.($this->uc['TSFE_adminConfig']['publish_levels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00371                         $options.= '<option value="1"'.($this->uc['TSFE_adminConfig']['publish_levels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00372                         $options.= '<option value="2"'.($this->uc['TSFE_adminConfig']['publish_levels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00373                         $out.= $this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
00374                                         '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id.'" />&nbsp;<input type="submit" value="'.$this->extGetLL('update').'" />');
00375 
00376                                 // Generating tree:
00377                         $depth = $this->extGetFeAdminValue('publish','levels');
00378                         $outTable = '';
00379                         $this->extPageInTreeInfo = array();
00380                         $this->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00381                         $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00382                         reset($this->extPageInTreeInfo);
00383                         while(list(,$row)=each($this->extPageInTreeInfo)) {
00384                                 $outTable.= '
00385                                         <tr>
00386                                                 <td style="white-space: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>
00387                                                 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00388                                                 <td>'.$this->extFw('...').'</td>
00389                                         </tr>';
00390                         }
00391                         $outTable = '<br /><table border="0" cellpadding="0" cellspacing="0" summary="">'.$outTable.'</table>';
00392                         $outTable.= '<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
00393 
00394                         $out.= $this->extGetItem('publish_tree', $outTable);
00395                 }
00396                 return $out;
00397         }
00398 
00406         function extGetCategory_edit($out='')   {
00407                 $out.= $this->extGetHead('edit');
00408                 if ($this->uc['TSFE_adminConfig']['display_edit']) {
00409 
00410                                 // If another page module was specified, replace the default Page module with the new one
00411                         $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00412                         $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00413 
00414                         $this->extNeedUpdate = 1;
00415                         $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"':'').' />');
00416                         $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"':'').' />');
00417                         $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"':'').' />');
00418                         $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"':'').' />');
00419                         $out.= $this->extGetItem('', $this->ext_makeToolBar());
00420 
00421                         if (!t3lib_div::_GP('ADMCMD_view')) {
00422                                 $out.= $this->extGetItem('', '<a href="#" onclick="'.
00423                                         htmlspecialchars('
00424                                                 if (parent.opener && parent.opener.top && parent.opener.top.TS) {
00425                                                         parent.opener.top.fsMod.recentIds["web"]='.intval($GLOBALS['TSFE']->page['uid']).';
00426                                                         if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav)        {
00427                                                                 parent.opener.top.content.nav_frame.refresh_nav();
00428                                                         }
00429                                                         parent.opener.top.goToModule("'.$pageModule.'");
00430                                                         parent.opener.top.focus();
00431                                                 } else {
00432                                                         vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
00433                                                         vHWin.focus();
00434                                                 }
00435                                                 return false;
00436                                                 ').
00437                                         '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
00438                         }
00439                 }
00440                 return $out;
00441         }
00442 
00450         function extGetCategory_tsdebug($out='')        {
00451                 $out.= $this->extGetHead('tsdebug');
00452                 if ($this->uc['TSFE_adminConfig']['display_tsdebug']) {
00453                         $this->extNeedUpdate = 1;
00454 
00455                         $out.= $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"':'').' />');
00456                         $out.= $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"':'').' />');
00457                         $out.= $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"':'').' />');
00458                         $out.= $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"':'').' />');
00459                         $out.= $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"':'').' />');
00460                         $out.= $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"':'').' />');
00461                         $out.= $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"':'').' />');
00462 
00463                         $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
00464                         $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
00465                         $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
00466                         $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
00467                         $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
00468 
00469                         $out.= '
00470                                 <tr>
00471                                         <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00472                                         <td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td>
00473                                 </tr>';
00474                 }
00475                 return $out;
00476         }
00477 
00485         function extGetCategory_info($out='')   {
00486                 $out.= $this->extGetHead('info');
00487                 if ($this->uc['TSFE_adminConfig']['display_info']) {
00488                         $tableArr = array();
00489 
00490                         if ($this->extGetFeAdminValue('cache','noCache')) {
00491                                 $theBytes = 0;
00492                                 $count = 0;
00493 
00494                                 if (count($GLOBALS['TSFE']->imagesOnPage)) {
00495                                         $tableArr[] = array('*Images on this page:*', '');
00496                                         foreach ($GLOBALS['TSFE']->imagesOnPage as $file) {
00497                                                 $fs = @filesize($file);
00498                                                 $tableArr[] = array('&ndash; '.$file, t3lib_div::formatSize($fs));
00499                                                 $theBytes+= $fs;
00500                                                 $count++;
00501                                         }
00502                                 }
00503                                 $tableArr[] = array('', '');    // Add an empty line
00504 
00505                                 $tableArr[] = array('*Total number of images:*', $count);
00506                                 $tableArr[] = array('*Total image file sizes:*', t3lib_div::formatSize($theBytes));
00507                                 $tableArr[] = array('*Document size:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)));
00508                                 $tableArr[] = array('*Total page load:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)+$theBytes));
00509                                 $tableArr[] = array('', '');
00510                         }
00511 
00512                         $tableArr[] = array('id:', $GLOBALS['TSFE']->id);
00513                         $tableArr[] = array('type:', $GLOBALS['TSFE']->type);
00514                         $tableArr[] = array('gr_list:', $GLOBALS['TSFE']->gr_list);
00515                         $tableArr[] = array('no_cache:', $GLOBALS['TSFE']->no_cache);
00516                         $tableArr[] = array('fe_user, name:', $GLOBALS['TSFE']->fe_user->user['username']);
00517                         $tableArr[] = array('fe_user, uid:', $GLOBALS['TSFE']->fe_user->user['uid']);
00518                         $tableArr[] = array('', '');    // Add an empty line
00519 
00520                                 // parsetime:
00521                         $tableArr[] = array('*Total parsetime:*', $GLOBALS['TSFE']->scriptParseTime.' ms');
00522 
00523                         $table = '';
00524                         foreach ($tableArr as $arr) {
00525                                 if (strlen($arr[0])) {  // Put text wrapped by "*" between <strong> tags
00526                                         $value1 = preg_replace('/^\*(.*)\*$/', '$1', $arr[0], -1, $count);
00527                                         $value1 = ($count?'<strong>':'') . $this->extFw($value1) . ($count?'</strong>':'');
00528                                 } else {
00529                                         $value1 = $this->extFw('&nbsp;');
00530                                 }
00531 
00532                                 $value2 = strlen($arr[1]) ? $arr[1] : '&nbsp;';
00533                                 $value2 = $this->extFw($value2);
00534 
00535                                 $table.= '
00536                                         <tr>
00537                                                 <td style="text-align:left">'.$value1.'</td>
00538                                                 <td style="text-align:right">'.$value2.'</td>
00539                                         </tr>';
00540                         }
00541 
00542                         $table = '<table border="0" cellpadding="0" cellspacing="0" summary="">'.$table.'</table>';
00543 
00544                         $out.= '
00545                                 <tr>
00546                                         <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00547                                         <td colspan="3">'.$table.'</td>
00548                                 </tr>';
00549                 }
00550                 return $out;
00551         }
00552 
00553 
00554 
00555 
00556 
00557 
00558 
00559 
00560 
00561 
00562 
00563 
00564 
00565 
00566 
00567 
00568 
00569 
00570         /*****************************************************
00571          *
00572          * Admin Panel Layout Helper functions
00573          *
00574          ****************************************************/
00575 
00586         function extGetHead($pre)       {
00587                 $out = '<img src="'.TYPO3_mainDir.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00588                 $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="" />';
00589                 $out.= $this->extFw($this->extGetLL($pre));
00590 
00591                 $out = $this->extItemLink($pre,$out);
00592                 return '
00593                                 <tr class="typo3-adminPanel-itemHRow" style="background-color:#abbbb4;">
00594                                         <td colspan="4" style="text-align:left; border-top:dashed 1px #007a8c; white-space:nowrap;">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc['TSFE_adminConfig']['display_'.$pre].'" /></td>
00595                                 </tr>';
00596         }
00597 
00607         function extItemLink($pre,$str) {
00608                 return '<a href="#" style="text-decoration:none;" onclick="'.
00609                         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;').
00610                         '">'.$str.'</a>';
00611         }
00612 
00623         function extGetItem($pre,$element)      {
00624                 $out = '
00625                                         <tr class="typo3-adminPanel-itemRow">
00626                                                 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00627                                                 <td style="text-align:left; white-space:nowrap;">'.($pre ? $this->extFw($this->extGetLL($pre)) : '&nbsp;').'</td>
00628                                                 <td><img src="clear.gif" width="30" height="1" alt="" /></td>
00629                                                 <td style="text-align:left; white-space:nowrap;">'.$element.'</td>
00630                                         </tr>';
00631 
00632                 return $out;
00633         }
00634 
00641         function extFw($str)    {
00642                 return '<span style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:0.6em; color:black;">'.$str.'</span>';
00643         }
00644 
00650         function ext_makeToolBar()      {
00651                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00652                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00653                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00654                 $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');
00655 
00656                 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00657                 $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
00658 
00659                 $toolBar = '';
00660                 $id = $GLOBALS['TSFE']->id;
00661                 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'.
00662                                         '<img src="'.TYPO3_mainDir.'gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>';
00663 
00664                 if ($perms&16 && $langAllowed) {
00665                         $params = '';
00666                         if ($GLOBALS['TSFE']->sys_language_uid) $params = '&sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid;
00667                         $toolBar.= '<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.$params.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00668                                                 '<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>';
00669                 }
00670                 if ($perms&2) {
00671                         $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00672                                         '<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>';
00673                 }
00674                 if ($perms&8) {
00675                         $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00676                                         '<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>';
00677                 }
00678                 if ($perms&2) {
00679                         $params = '&edit[pages]['.$id.']=edit';
00680                         $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00681                                         '<img src="'.TYPO3_mainDir.'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageProperties').'" alt="" /></a>';
00682 
00683                         if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) {
00684                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00685                                         'uid,pid,t3ver_state',  'pages_language_overlay',
00686                                         'pid='.intval($id).' AND sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid.$GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'),
00687                                         '', '', '1');
00688                                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00689                                 $GLOBALS['TSFE']->sys_page->versionOL('pages_language_overlay',$row);
00690                                 if (is_array($row)) {
00691                                         $params='&edit[pages_language_overlay]['.$row['uid'].']=edit';
00692                                         $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00693                                                         '<img src="'.TYPO3_mainDir.'gfx/edit3.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageOverlay').'" alt="" /></a>';
00694                                 }
00695                         }
00696                 }
00697                 if ($this->check('modules','web_list')) {
00698                         $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00699                                         '<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>';
00700                 }
00701 
00702                 return $toolBar;
00703         }
00704 
00705 
00706 
00707 
00708 
00709 
00710 
00711 
00712 
00713 
00714 
00715 
00716 
00717 
00718 
00719 
00720 
00721 
00722 
00723         /*****************************************************
00724          *
00725          * TSFE BE user Access Functions
00726          *
00727          ****************************************************/
00728 
00736         function checkBackendAccessSettingsFromInitPhp()        {
00737                 global $TYPO3_CONF_VARS;
00738 
00739                 // **********************
00740                 // Check Hardcoded lock on BE:
00741                 // **********************
00742                 if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) {
00743                         return FALSE;
00744                 }
00745 
00746                 // **********************
00747                 // Check IP
00748                 // **********************
00749                 if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00750                         if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00751                                 return FALSE;
00752                         }
00753                 }
00754 
00755 
00756                 // **********************
00757                 // Check SSL (https)
00758                 // **********************
00759                 if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && $TYPO3_CONF_VARS['BE']['lockSSL'] != 3) {
00760                         if (!t3lib_div::getIndpEnv('TYPO3_SSL')) {
00761                                 return FALSE;
00762                         }
00763                 }
00764 
00765                         // Finally a check from t3lib_beuserauth::backendCheckLogin()
00766                 if (!$TYPO3_CONF_VARS['BE']['adminOnly'] || $this->isAdmin()) {
00767                         return TRUE;
00768                 } else return FALSE;
00769          }
00770 
00771 
00781         function extPageReadAccess($pageRec)    {
00782                 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
00783         }
00784 
00792         function extAdmModuleEnabled($key)      {
00793                         // Returns true if the module checked is "preview" and the forcePreview flag is set.
00794                 if ($key=="preview" && $this->ext_forcePreview) return true;
00795 
00796                         // If key is not set, only "all" is checked
00797                 if ($this->extAdminConfig['enable.']['all'])    return true;
00798                 if ($this->extAdminConfig['enable.'][$key]) {
00799                         return true;
00800                 }
00801         }
00802 
00809         function extSaveFeAdminConfig() {
00810                 $input = t3lib_div::_GET('TSFE_ADMIN_PANEL');
00811                 if (is_array($input)) {
00812                                 // Setting
00813                         $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...
00814                         unset($this->uc['TSFE_adminConfig']['action']);
00815 
00816                                 // Actions:
00817                         if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) {
00818                                 $this->extPageInTreeInfo=array();
00819                                 $theStartId = intval($input['cache_clearCacheId']);
00820                                 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
00821                         }
00822                         if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish')) {
00823                                 $theStartId = intval($input['publish_id']);
00824                                 $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
00825                         }
00826 
00827                                 // Saving
00828                         $this->writeUC();
00829                 }
00830                 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR');
00831 
00832                 if ($this->extGetFeAdminValue('cache','noCache'))       {
00833                         $GLOBALS['TSFE']->set_no_cache();
00834                 }
00835         }
00836 
00844         function extGetFeAdminValue($pre,$val='')       {
00845                 if ($this->extAdmModuleEnabled($pre)) { // Check if module is enabled.
00846                                 // Exceptions where the values can be overridden from backend:
00847                                 // deprecated
00848                         if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
00849                                 return true;
00850                         }
00851                         if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) {
00852                                 return true;
00853                         }
00854 
00855                                 // override all settings with user TSconfig
00856                         if ($this->extAdminConfig['override.'][$pre.'.'][$val] && $val) {
00857                                 return $this->extAdminConfig['override.'][$pre.'.'][$val];
00858                         }
00859                         if ($this->extAdminConfig['override.'][$pre]) {
00860                                 return $this->extAdminConfig['override.'][$pre];
00861                         }
00862 
00863                         $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1;
00864 
00865                         if ($pre=='preview' && $this->ext_forcePreview) {
00866                                 if (!$val) {
00867                                         return true;
00868                                 } else {
00869                                         return $retVal;
00870                                 }
00871                         }
00872 
00873                                 // regular check:
00874                         if ($this->extIsAdmMenuOpen($pre)) {    // See if the menu is expanded!
00875                                 return $retVal;
00876                         }
00877                 }
00878         }
00879 
00886         function extIsAdmMenuOpen($pre) {
00887                 return $this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre];
00888         }
00889 
00890 
00891 
00892 
00893 
00894 
00895 
00896 
00897 
00898 
00899 
00900 
00901 
00902 
00903 
00904 
00905         /*****************************************************
00906          *
00907          * TSFE BE user Access Functions
00908          *
00909          ****************************************************/
00910 
00921         function extGetTreeList($id,$depth,$begin=0,$perms_clause)      {
00922                 $depth=intval($depth);
00923                 $begin=intval($begin);
00924                 $id=intval($id);
00925                 $theList='';
00926 
00927                 if ($id && $depth>0) {
00928                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00929                                                 'uid,title',
00930                                                 'pages',
00931                                                 'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND deleted=0 AND '.$perms_clause
00932                                         );
00933                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00934                                 if ($begin<=0) {
00935                                         $theList.= $row['uid'].',';
00936                                         $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth);
00937                                 }
00938                                 if ($depth>1) {
00939                                         $theList.= $this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
00940                                 }
00941                         }
00942                 }
00943                 return $theList;
00944         }
00945 
00952         function extGetNumberOfCachedPages($page_id)    {
00953                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id));
00954                 list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00955                 return $num;
00956         }
00957 
00958 
00959 
00960 
00961 
00962 
00963 
00964 
00965 
00966 
00967 
00968 
00969 
00970 
00971 
00972 
00973 
00974 
00975 
00976 
00977 
00978         /*****************************************************
00979          *
00980          * Localization handling
00981          *
00982          ****************************************************/
00983 
00991         function extGetLL($key) {
00992                 global $LOCAL_LANG;
00993                 if (!is_array($LOCAL_LANG)) {
00994                         $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
00995                         #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
00996                         if (!is_array($LOCAL_LANG)) {
00997                                 $LOCAL_LANG = array();
00998                         }
00999                 }
01000 
01001                 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));    // Label string in the default backend output charset.
01002 
01003                         // Convert to utf-8, then to entities:
01004                 if ($GLOBALS['LANG']->charSet!='utf-8') {
01005                         $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
01006                 }
01007                 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
01008 
01009                         // Return the result:
01010                 return $labelStr;
01011         }
01012 
01013 
01014 
01015 
01016 
01017 
01018 
01019 
01020 
01021 
01022 
01023 
01024 
01025         /*****************************************************
01026          *
01027          * Frontend Editing
01028          *
01029          ****************************************************/
01030 
01037         function extIsEditAction()      {
01038                 if (is_array($this->TSFE_EDIT)) {
01039                         if ($this->TSFE_EDIT['cancel']) {
01040                                 unset($this->TSFE_EDIT['cmd']);
01041                         } else {
01042                                 $cmd = (string)$this->TSFE_EDIT['cmd'];
01043                                 if (($cmd!='edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd!='new')  {
01044                                                 // $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.
01045                                         return true;
01046                                 }
01047                         }
01048                 }
01049                 return false;
01050         }
01051 
01059         function extIsFormShown()       {
01060                 if (is_array($this->TSFE_EDIT)) {
01061                         $cmd = (string)$this->TSFE_EDIT['cmd'];
01062                         if ($cmd=='edit' || $cmd=='new') {
01063                                 return true;
01064                         }
01065                 }
01066         }
01067 
01075         function extEditAction()        {
01076                 global $TCA, $TYPO3_CONF_VARS;
01077                         // Commands:
01078                 list($table,$uid) = explode(':',$this->TSFE_EDIT['record']);
01079                 if ($this->TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table])) {
01080                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01081                         $tce->stripslashes_values=0;
01082                         $recData = array();
01083                         $cmdData = array();
01084                         $cmd = $this->TSFE_EDIT['cmd'];
01085 
01086                         // ****************
01087                         // extEditAction HOOK
01088                         // ****************
01089                         if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
01090                                 $_params = array();
01091                                 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
01092                                         t3lib_div::callUserFunction($_funcRef,$_params,$this);
01093                                 }
01094                         }
01095 
01096                         switch($cmd) {
01097                                 case 'hide':
01098                                 case 'unhide':
01099                                         $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
01100                                         if ($hideField) {
01101                                                 $recData[$table][$uid][$hideField] = ($cmd=='hide' ? 1 : 0);
01102                                                 $tce->start($recData,Array());
01103                                                 $tce->process_datamap();
01104                                         }
01105                                 break;
01106                                 case 'up':
01107                                 case 'down':
01108                                         $sortField = $TCA[$table]['ctrl']['sortby'];
01109                                         if ($sortField) {
01110                                                 if ($cmd=='up') {
01111                                                         $op= '<';
01112                                                         $desc=' DESC';
01113                                                 } else {
01114                                                         $op= '>';
01115                                                         $desc='';
01116                                                 }
01117 
01118                                                         // Get self:
01119                                                 $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
01120                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
01121                                                 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01122                                                                 // record before or after
01123                                                         $preview = $this->extGetFeAdminValue('preview');
01124                                                         $copyAfterFieldsQuery = '';
01125                                                         if ($preview) {
01126                                                                 $ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);
01127                                                         }
01128                                                         if ($TCA[$table]['ctrl']['copyAfterDuplFields']) {
01129                                                                 $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
01130                                                                 while(list(,$fN)=each($cAFields)) {
01131                                                                         $copyAfterFieldsQuery.= ' AND '.$fN.'="'.$row[$fN].'"';
01132                                                                 }
01133                                                         }
01134 
01135                                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01136                                                                                 'uid,pid',
01137                                                                                 $table,
01138                                                                                 'pid='.intval($row['pid']).
01139                                                                                         ' AND '.$sortField.$op.intval($row[$sortField]).
01140                                                                                         $copyAfterFieldsQuery.
01141                                                                                         $GLOBALS['TSFE']->sys_page->enableFields($table,'',$ignore),
01142                                                                                 '',
01143                                                                                 $sortField.$desc,
01144                                                                                 '2'
01145                                                                         );
01146                                                         if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01147                                                                 if($cmd=='down') {
01148                                                                         $cmdData[$table][$uid]['move'] = -$row2['uid'];
01149                                                                 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {        // Must take the second record above...
01150                                                                         $cmdData[$table][$uid]['move'] = -$row3['uid'];
01151                                                                 } else {        // ... and if that does not exist, use pid
01152                                                                         $cmdData[$table][$uid]['move'] = $row['pid'];
01153                                                                 }
01154                                                         } elseif ($cmd=='up') {
01155                                                                 $cmdData[$table][$uid]['move'] = $row['pid'];
01156                                                         }
01157                                                 }
01158                                                 if (count($cmdData)) {
01159                                                         $tce->start(Array(),$cmdData);
01160                                                         $tce->process_cmdmap();
01161                                                 }
01162                                         }
01163                                 break;
01164                                 case 'delete':
01165                                         $cmdData[$table][$uid]['delete'] = 1;
01166                                         if (count($cmdData)) {
01167                                                 $tce->start(Array(),$cmdData);
01168                                                 $tce->process_cmdmap();
01169                                         }
01170                                 break;
01171                         }
01172                 }
01173                         // Data:
01174                 if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) {
01175                         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01176                         $tce->stripslashes_values = 0;
01177                         $tce->start($this->TSFE_EDIT['data'],Array());
01178                         $tce->process_uploads($_FILES);
01179                         $tce->process_datamap();
01180                 }
01181         }
01182 }
01183 
01184 
01185 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php'])    {
01186         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);
01187 }
01188 
01189 ?>

This documentation has been generated automatically from TYPO3 source code using