Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

class.t3lib_tsfebeuserauth.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 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                   // Enable panel
00136                $this->extAdmEnabled=1;
00137 
00138                   // Init TSFE_EDIT variables:
00139                $this->TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
00140 
00141                break;
00142             }
00143          }
00144       }
00145    }
00146 
00154    function extPrintFeAdminDialog() {
00155 
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" bgcolor="#9BA1A8">
00167             <td colspan="2" nowrap="nowrap">'.
00168                $this->extItemLink('top','<img src="t3lib/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                '</td>
00171             <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00172             <td><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>
00173          </tr>';
00174 
00175       $out='
00176 <!--
00177    ADMIN PANEL
00178 -->
00179 <a name="TSFE_ADMIN"></a>
00180 <form name="TSFE_ADMIN_PANEL_FORM" action="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'#TSFE_ADMIN" method="post" style="margin: 0 0 0 0;">
00181    <table border="0" cellpadding="0" cellspacing="0" class="typo3-adminPanel" bgcolor="#F6F2E6" style="border: 1px solid black; z-index:0; position:absolute;">'.
00182       $header.$out.'
00183    </table>
00184 </form>';
00185 
00186       if ($this->uc['TSFE_adminConfig']['display_top'])  {
00187          $out.='<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
00188          $out.='
00189          <script type="text/javascript">
00190                /*<![CDATA[*/
00191             var evalFunc = new evalFunc();
00192                // TSFEtypo3FormFieldSet()
00193             function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)  {  //
00194                var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00195                var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
00196                if (checkbox && theValue==checkboxValue)  {
00197                   document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
00198                   document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
00199                } else {
00200                   document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
00201                   document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
00202                }
00203             }
00204                // TSFEtypo3FormFieldGet()
00205             function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)   {  //
00206                var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00207                if (checkbox_off) {
00208                   document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
00209                }else{
00210                   document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
00211                }
00212                TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
00213             }
00214                /*]]>*/
00215          </script>
00216          <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
00217       }
00218       return "\n\n\n\n".$out.'<br />';
00219    }
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236    /*****************************************************
00237     *
00238     * Creating sections of the Admin Panel
00239     *
00240     ****************************************************/
00241 
00249    function extGetCategory_preview($out='')  {
00250       $out.=$this->extGetHead('preview');
00251       if ($this->uc['TSFE_adminConfig']['display_preview']) {
00252          $this->extNeedUpdate = 1;
00253          $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"':'').' />');
00254          $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"':'').' />');
00255 
00256             // Simulate data
00257          $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'].'" />');
00258          $this->extJSCODE.= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
00259 
00260             // Simulate fe_user:
00261          $options = '<option value="0"></option>';
00262          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00263                   'fe_groups.uid, fe_groups.title',
00264                   'fe_groups,pages',
00265                   'pages.uid=fe_groups.pid AND NOT pages.deleted '.t3lib_BEfunc::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1)
00266                );
00267          while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00268             $options.= '<option value="'.$row['uid'].'"'.($this->uc['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
00269          }
00270          $out.= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
00271       }
00272       return $out;
00273    }
00274 
00282    function extGetCategory_cache($out='') {
00283       $out.=$this->extGetHead('cache');
00284       if ($this->uc['TSFE_adminConfig']['display_cache'])   {
00285          $this->extNeedUpdate=1;
00286          $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"':'').' />');
00287 
00288          $options='';
00289          $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00290          $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00291          $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00292          $out.=$this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
00293                '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00294 
00295             // Generating tree:
00296          $depth=$this->extGetFeAdminValue('cache','clearCacheLevels');
00297          $outTable='';
00298          $this->extPageInTreeInfo=array();
00299          $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00300          $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00301          reset($this->extPageInTreeInfo);
00302          while(list(,$row)=each($this->extPageInTreeInfo))  {
00303             $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="t3lib/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>';
00304          }
00305          $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00306          $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
00307          $out.=$this->extGetItem('cache_cacheEntries', $outTable);
00308 
00309       }
00310       return $out;
00311    }
00312 
00320    function extGetCategory_publish($out='')  {
00321       $out.=$this->extGetHead('publish');
00322       if ($this->uc['TSFE_adminConfig']['display_publish']) {
00323          $this->extNeedUpdate=1;
00324          $options='';
00325          $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['publish_levels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00326          $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['publish_levels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00327          $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['publish_levels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00328          $out.=$this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
00329                '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00330 
00331             // Generating tree:
00332          $depth=$this->extGetFeAdminValue('publish','levels');
00333          $outTable='';
00334          $this->extPageInTreeInfo=array();
00335          $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00336          $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00337          reset($this->extPageInTreeInfo);
00338          while(list(,$row)=each($this->extPageInTreeInfo))  {
00339             $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="t3lib/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>';
00340          }
00341          $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00342          $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
00343          $out.=$this->extGetItem('publish_tree', $outTable);
00344       }
00345       return $out;
00346    }
00347 
00355    function extGetCategory_edit($out='')  {
00356       $out.=$this->extGetHead('edit');
00357       if ($this->uc['TSFE_adminConfig']['display_edit']) {
00358 
00359             // If another page module was specified, replace the default Page module with the new one
00360          $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00361          $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00362 
00363          $this->extNeedUpdate=1;
00364          $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"':'').' />');
00365          $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"':'').' />');
00366          $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"':'').' />');
00367          $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"':'').' />');
00368 
00369          $out.=$this->extGetItem('', $this->ext_makeToolBar());
00370          if (!t3lib_div::_GP('ADMCMD_view')) {
00371             $out.=$this->extGetItem('', '<a href="#" onclick="'.
00372                htmlspecialchars('
00373                   if (parent.opener && parent.opener.top && parent.opener.top.TS)   {
00374                      parent.opener.top.fsMod.recentIds["web"]='.intval($GLOBALS['TSFE']->page['uid']).';
00375                      if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav)   {
00376                         parent.opener.top.content.nav_frame.refresh_nav();
00377                      }
00378                      parent.opener.top.goToModule("'.$pageModule.'");
00379                      parent.opener.top.focus();
00380                   } else {
00381                      vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
00382                      vHWin.focus();
00383                   }
00384                   return false;
00385                   ').
00386                '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
00387          }
00388       }
00389       return $out;
00390    }
00391 
00399    function extGetCategory_tsdebug($out='')  {
00400       $out.=$this->extGetHead('tsdebug');
00401       if ($this->uc['TSFE_adminConfig']['display_tsdebug']) {
00402          $this->extNeedUpdate=1;
00403          $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"':'').' />');
00404          $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"':'').' />');
00405          $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"':'').' />');
00406          $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"':'').' />');
00407          $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"':'').' />');
00408          $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"':'').' />');
00409 
00410          $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"':'').' />');
00411 
00412          $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
00413          $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
00414          $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
00415          $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
00416          $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
00417          $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td></tr>';
00418       }
00419       return $out;
00420    }
00421 
00429    function extGetCategory_info($out='')  {
00430       $out.=$this->extGetHead('info');
00431       if ($this->uc['TSFE_adminConfig']['display_info']) {
00432 
00433          if (is_array($GLOBALS['TSFE']->imagesOnPage) && $this->extGetFeAdminValue('cache','noCache'))   {
00434             reset($GLOBALS['TSFE']->imagesOnPage);
00435             $theBytes=0;
00436             $count=0;
00437             $fileTable='';
00438             while(list(,$file)=each($GLOBALS['TSFE']->imagesOnPage)) {
00439                $fs=@filesize($file);
00440                $fileTable.='<tr><td>'.$this->extFw($file).'</td><td align="right">'.$this->extFw(t3lib_div::formatSize($fs)).'</td></tr>';
00441                $theBytes+=$fs;
00442                $count++;
00443             }
00444             $fileTable.='<tr><td><strong>'.$this->extFw('Total number of images:').'</strong></td><td>'.$this->extFw($count).'</td></tr>';
00445             $fileTable.='<tr><td><strong>'.$this->extFw('Total image file sizes:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize($theBytes)).'</td></tr>';
00446             $fileTable.='<tr><td><strong>'.$this->extFw('Document size:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content))).'</td></tr>';
00447             $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>';
00448             $fileTable.='<tr><td>&nbsp;</td></tr>';
00449          }
00450 
00451          $fileTable.='<tr><td>'.$this->extFw('id:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->id).'</td></tr>';
00452          $fileTable.='<tr><td>'.$this->extFw('type:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->type).'</td></tr>';
00453          $fileTable.='<tr><td>'.$this->extFw('gr_list:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->gr_list).'</td></tr>';
00454          $fileTable.='<tr><td>'.$this->extFw('no_cache:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->no_cache).'</td></tr>';
00455          $fileTable.='<tr><td>'.$this->extFw('fe_user, name:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['username']).'</td></tr>';
00456          $fileTable.='<tr><td>'.$this->extFw('fe_user, uid:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['uid']).'</td></tr>';
00457          $fileTable.='<tr><td>&nbsp;</td></tr>';
00458 
00459             // parsetime:
00460          $fileTable.='<tr><td>'.$this->extFw('Total parsetime:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->scriptParseTime.' ms').'</td></tr>';
00461 
00462          $fileTable='<table border="0" cellpadding="0" cellspacing="0">'.$fileTable.'</table>';
00463 
00464          $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$fileTable.'</td></tr>';
00465       }
00466       return $out;
00467    }
00468 
00469 
00470 
00471 
00472 
00473 
00474 
00475 
00476 
00477 
00478 
00479 
00480 
00481 
00482 
00483 
00484 
00485 
00486    /*****************************************************
00487     *
00488     * Admin Panel Layout Helper functions
00489     *
00490     ****************************************************/
00491 
00502    function extGetHead($pre)  {
00503       $out.='<img src="t3lib/gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00504       $out.='<img src="t3lib/gfx/ol/'.($this->uc['TSFE_adminConfig']['display_'.$pre]?'minus':'plus').'bullet.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00505       $out.=$this->extFw($this->extGetLL($pre));
00506       $out=$this->extItemLink($pre,$out);
00507       return '
00508             <tr class="typo3-adminPanel-itemHRow" bgcolor="#ABBBB4">
00509                <td colspan="4" nowrap="nowrap">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc['TSFE_adminConfig']['display_'.$pre].'" /></td>
00510             </tr>';
00511    }
00512 
00522    function extItemLink($pre,$str)  {
00523       return '<a href="#" onclick="'.
00524          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;').
00525          '">'.$str.'</a>';
00526    }
00527 
00538    function extGetItem($pre,$element)  {
00539       return '
00540                <tr class="typo3-adminPanel-itemRow">
00541                   <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00542                   <td nowrap="nowrap">'.($pre ? $this->extFw($this->extGetLL($pre)) : '&nbsp;').'</td>
00543                   <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00544                   <td>'.$element.'</td>
00545                </tr>';
00546 
00547    }
00548 
00555    function extFw($str) {
00556       return '<font face="verdana,arial" size="1" color="black">'.$str.'</font>';
00557    }
00558 
00564    function ext_makeToolBar() {
00565          //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00566       $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00567       $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00568       $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');
00569 
00570       $toolBar='';
00571       $id = $GLOBALS['TSFE']->id;
00572       $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'.
00573                '<img src="t3lib/gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>';
00574       $toolBar.='<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00575                '<img src="t3lib/gfx/new_record.gif" width="16" height="12" hspace="1" border="0" align="top" title="'.$this->extGetLL('edit_newContentElement').'" alt="" /></a>';
00576       $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00577                '<img src="t3lib/gfx/move_page.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_move_page').'" alt="" /></a>';
00578       $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00579                '<img src="t3lib/gfx/new_page.gif" width="13" height="12" hspace="0" border="0" align="top" title="'.$this->extGetLL('edit_newPage').'" alt="" /></a>';
00580 
00581       $params='&edit[pages]['.$id.']=edit';
00582       $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00583                '<img src="t3lib/gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageHeader').'" alt="" /></a>';
00584       if ($this->check('modules','web_list'))   {
00585          $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00586                '<img src="t3lib/gfx/list.gif" width="11" height="11" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_db_list').'" alt="" /></a>';
00587       }
00588       return $toolBar;
00589    }
00590 
00591 
00592 
00593 
00594 
00595 
00596 
00597 
00598 
00599 
00600 
00601 
00602 
00603 
00604 
00605 
00606 
00607 
00608 
00609    /*****************************************************
00610     *
00611     * TSFE BE user Access Functions
00612     *
00613     ****************************************************/
00614 
00622    function checkBackendAccessSettingsFromInitPhp()   {
00623       global $TYPO3_CONF_VARS;
00624 
00625       // **********************
00626       // Check Hardcoded lock on BE:
00627       // **********************
00628       if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) {
00629          return FALSE;
00630       }
00631 
00632       // **********************
00633       // Check IP
00634       // **********************
00635       if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00636          if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00637             return FALSE;
00638          }
00639       }
00640 
00641 
00642       // **********************
00643       // Check SSL (https)
00644       // **********************
00645       if (intval($TYPO3_CONF_VARS['BE']['lockSSL']))  {
00646          if (!t3lib_div::getIndpEnv('TYPO3_SSL'))  {
00647             return FALSE;
00648          }
00649       }
00650 
00651          // Finally a check from t3lib_beuserauth::backendCheckLogin()
00652       if (!$TYPO3_CONF_VARS['BE']['adminOnly'] || $this->isAdmin())  {
00653          return TRUE;
00654       } else return FALSE;
00655     }
00656 
00657 
00667    function extPageReadAccess($pageRec)   {
00668       return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
00669    }
00670 
00678    function extAdmModuleEnabled($key)  {
00679          // Returns true if the module checked is "preview" and the forcePreview flag is set.
00680       if ($key=="preview" && $this->ext_forcePreview) return true;
00681          // If key is not set, only "all" is checked
00682       if ($this->extAdminConfig['enable.']['all']) return true;
00683       if ($this->extAdminConfig['enable.'][$key])  {
00684          return true;
00685       }
00686    }
00687 
00694    function extSaveFeAdminConfig()  {
00695       $input = t3lib_div::_POST('TSFE_ADMIN_PANEL');
00696       if (is_array($input))   {
00697             // Setting
00698          $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...
00699          unset($this->uc['TSFE_adminConfig']['action']);
00700 
00701             // Actions:
00702          if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) {
00703             $this->extPageInTreeInfo=array();
00704             $theStartId = intval($input['cache_clearCacheId']);
00705             $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
00706          }
00707          if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish'))  {
00708             $theStartId = intval($input['publish_id']);
00709             $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
00710          }
00711 
00712             // Saving
00713          $this->writeUC();
00714       }
00715       $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR');
00716       if ($this->extGetFeAdminValue('cache','noCache'))  {$GLOBALS['TSFE']->set_no_cache();}
00717    }
00718 
00726    function extGetFeAdminValue($pre,$val='') {
00727       if ($this->extAdmModuleEnabled($pre))  {  // Check if module is enabled.
00728             // Exceptions where the values can be overridden from backend:
00729          if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
00730             return true;
00731          }
00732          if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons'])   {
00733             return true;
00734          }
00735 
00736          $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1;
00737 
00738          if ($pre=='preview' && $this->ext_forcePreview) {
00739             if (!$val)  {
00740                return true;
00741             } else {
00742                return $retVal;
00743             }
00744          }
00745 
00746             // regular check:
00747          if ($this->extIsAdmMenuOpen($pre))  {  // See if the menu is expanded!
00748             return $retVal;
00749          }
00750       }
00751    }
00752 
00759    function extIsAdmMenuOpen($pre)  {
00760       return $this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre];
00761    }
00762 
00763 
00764 
00765 
00766 
00767 
00768 
00769 
00770 
00771 
00772 
00773 
00774 
00775 
00776 
00777 
00778    /*****************************************************
00779     *
00780     * TSFE BE user Access Functions
00781     *
00782     ****************************************************/
00783 
00794    function extGetTreeList($id,$depth,$begin=0,$perms_clause)  {
00795       $depth=intval($depth);
00796       $begin=intval($begin);
00797       $id=intval($id);
00798       $theList='';
00799 
00800       if ($id && $depth>0) {
00801          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00802                   'uid,title',
00803                   'pages',
00804                   'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND NOT deleted AND '.$perms_clause
00805                );
00806          while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00807             if ($begin<=0) {
00808                $theList.=$row['uid'].',';
00809                $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth);
00810             }
00811             if ($depth>1)  {
00812                $theList.=$this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
00813             }
00814          }
00815       }
00816       return $theList;
00817    }
00818 
00825    function extGetNumberOfCachedPages($page_id) {
00826       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id));
00827       list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00828       return $num;
00829    }
00830 
00831 
00832 
00833 
00834 
00835 
00836 
00837 
00838 
00839 
00840 
00841 
00842 
00843 
00844 
00845 
00846 
00847 
00848 
00849 
00850 
00851    /*****************************************************
00852     *
00853     * Localization handling
00854     *
00855     ****************************************************/
00856 
00864    function extGetLL($key) {
00865       global $LOCAL_LANG;
00866       if (!is_array($LOCAL_LANG))   {
00867          $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
00868          #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
00869          if (!is_array($LOCAL_LANG))      $LOCAL_LANG=array();
00870       }
00871 
00872       $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));   // Label string in the default backend output charset.
00873 
00874          // Convert to utf-8, then to entities:
00875       if ($GLOBALS['LANG']->charSet!='utf-8')   {
00876          $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
00877       }
00878       $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
00879 
00880          // Return the result:
00881       return $labelStr;
00882    }
00883 
00884 
00885 
00886 
00887 
00888 
00889 
00890 
00891 
00892 
00893 
00894 
00895 
00896    /*****************************************************
00897     *
00898     * Frontend Editing
00899     *
00900     ****************************************************/
00901 
00908    function extIsEditAction() {
00909       if (is_array($this->TSFE_EDIT))  {
00910          if ($this->TSFE_EDIT['cancel'])  {
00911             unset($this->TSFE_EDIT['cmd']);
00912          } elseif (($cmd!='edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd!='new')  {
00913                // $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.
00914             return true;
00915          }
00916       }
00917    }
00918 
00926    function extIsFormShown()  {
00927       if (is_array($this->TSFE_EDIT))  {
00928          $cmd=(string)$this->TSFE_EDIT['cmd'];
00929          if ($cmd=='edit' || $cmd=='new') {
00930             return true;
00931          }
00932       }
00933    }
00934 
00942    function extEditAction()   {
00943       global $TCA;
00944          // Commands:
00945       list($table,$uid) = explode(':',$this->TSFE_EDIT['record']);
00946       if ($this->TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table]))   {
00947          $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00948          $tce->stripslashes_values=0;
00949          $recData=array();
00950          $cmdData=array();
00951          $cmd=$this->TSFE_EDIT['cmd'];
00952          switch($cmd)   {
00953             case 'hide':
00954             case 'unhide':
00955                $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
00956                if ($hideField)   {
00957                   $recData[$table][$uid][$hideField]=($cmd=='hide'?1:0);
00958                   $tce->start($recData,Array());
00959                   $tce->process_datamap();
00960                }
00961             break;
00962             case 'up':
00963             case 'down':
00964                $sortField = $TCA[$table]['ctrl']['sortby'];
00965                if ($sortField)   {
00966                   if ($cmd=='up')   {
00967                      $op= '<';
00968                      $desc=' DESC';
00969                   } else {
00970                      $op= '>';
00971                      $desc='';
00972                   }
00973                      // Get self:
00974                   $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
00975                   $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
00976                   if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00977                         // record before or after
00978                      $preview = $this->extGetFeAdminValue('preview');
00979                      $copyAfterFieldsQuery = '';
00980                      if ($preview)  {$ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);}
00981                      if ($TCA[$table]['ctrl']['copyAfterDuplFields'])   {
00982                         $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
00983                         while(list(,$fN)=each($cAFields))   {
00984                            $copyAfterFieldsQuery.=' AND '.$fN.'="'.$row[$fN].'"';
00985                         }
00986                      }
00987 
00988                      $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00989                               'uid,pid',
00990                               $table,
00991                               'pid='.intval($row['pid']).
00992                                  ' AND '.$sortField.$op.intval($row[$sortField]).
00993                                  $copyAfterFieldsQuery.
00994                                  t3lib_pageSelect::enableFields($table,'',$ignore),
00995                               '',
00996                               $sortField.$desc,
00997                               '2'
00998                            );
00999                      if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01000                         if($cmd=='down')  {
01001                            $cmdData[$table][$uid]['move']= -$row2['uid'];
01002                         } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {  // Must take the second record above...
01003                            $cmdData[$table][$uid]['move']= -$row3['uid'];
01004                         } else { // ... and if that does not exist, use pid
01005                            $cmdData[$table][$uid]['move']= $row['pid'];
01006                         }
01007                      } elseif ($cmd=='up') {
01008                         $cmdData[$table][$uid]['move']= $row['pid'];
01009                      }
01010                   }
01011                   if (count($cmdData)) {
01012                      $tce->start(Array(),$cmdData);
01013                      $tce->process_cmdmap();
01014                   }
01015                }
01016             break;
01017             case 'delete':
01018                $cmdData[$table][$uid]['delete']= 1;
01019                if (count($cmdData)) {
01020                   $tce->start(Array(),$cmdData);
01021                   $tce->process_cmdmap();
01022                }
01023             break;
01024          }
01025       }
01026          // Data:
01027       if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) {
01028          $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01029          $tce->stripslashes_values=0;
01030          $tce->start($this->TSFE_EDIT['data'],Array());
01031          $tce->process_uploads($_FILES);
01032          $tce->process_datamap();
01033       }
01034    }
01035 }
01036 
01037 
01038 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php'])   {
01039    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);
01040 }
01041 ?>

Generated on Sun Oct 3 01:05:51 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913