Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 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 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 pages.deleted=0 '.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> </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> </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)) : ' ').'</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 00571 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page); 00572 00573 $toolBar=''; 00574 $id = $GLOBALS['TSFE']->id; 00575 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'. 00576 '<img src="t3lib/gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>'; 00577 00578 if ($perms&16) { 00579 $toolBar.='<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00580 '<img src="t3lib/gfx/new_record.gif" width="16" height="12" hspace="1" border="0" align="top" title="'.$this->extGetLL('edit_newContentElement').'" alt="" /></a>'; 00581 } 00582 if ($perms&2) { 00583 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00584 '<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>'; 00585 } 00586 if ($perms&8) { 00587 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00588 '<img src="t3lib/gfx/new_page.gif" width="13" height="12" hspace="0" border="0" align="top" title="'.$this->extGetLL('edit_newPage').'" alt="" /></a>'; 00589 } 00590 if ($perms&2) { 00591 $params='&edit[pages]['.$id.']=edit'; 00592 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00593 '<img src="t3lib/gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageHeader').'" alt="" /></a>'; 00594 } 00595 if ($this->check('modules','web_list')) { 00596 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'. 00597 '<img src="t3lib/gfx/list.gif" width="11" height="11" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_db_list').'" alt="" /></a>'; 00598 } 00599 return $toolBar; 00600 } 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 /***************************************************** 00621 * 00622 * TSFE BE user Access Functions 00623 * 00624 ****************************************************/ 00625 00633 function checkBackendAccessSettingsFromInitPhp() { 00634 global $TYPO3_CONF_VARS; 00635 00636 // ********************** 00637 // Check Hardcoded lock on BE: 00638 // ********************** 00639 if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) { 00640 return FALSE; 00641 } 00642 00643 // ********************** 00644 // Check IP 00645 // ********************** 00646 if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) { 00647 if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) { 00648 return FALSE; 00649 } 00650 } 00651 00652 00653 // ********************** 00654 // Check SSL (https) 00655 // ********************** 00656 if (intval($TYPO3_CONF_VARS['BE']['lockSSL'])) { 00657 if (!t3lib_div::getIndpEnv('TYPO3_SSL')) { 00658 return FALSE; 00659 } 00660 } 00661 00662 // Finally a check from t3lib_beuserauth::backendCheckLogin() 00663 if (!$TYPO3_CONF_VARS['BE']['adminOnly'] || $this->isAdmin()) { 00664 return TRUE; 00665 } else return FALSE; 00666 } 00667 00668 00678 function extPageReadAccess($pageRec) { 00679 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1); 00680 } 00681 00689 function extAdmModuleEnabled($key) { 00690 // Returns true if the module checked is "preview" and the forcePreview flag is set. 00691 if ($key=="preview" && $this->ext_forcePreview) return true; 00692 // If key is not set, only "all" is checked 00693 if ($this->extAdminConfig['enable.']['all']) return true; 00694 if ($this->extAdminConfig['enable.'][$key]) { 00695 return true; 00696 } 00697 } 00698 00705 function extSaveFeAdminConfig() { 00706 $input = t3lib_div::_POST('TSFE_ADMIN_PANEL'); 00707 if (is_array($input)) { 00708 // Setting 00709 $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... 00710 unset($this->uc['TSFE_adminConfig']['action']); 00711 00712 // Actions: 00713 if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) { 00714 $this->extPageInTreeInfo=array(); 00715 $theStartId = intval($input['cache_clearCacheId']); 00716 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId); 00717 } 00718 if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish')) { 00719 $theStartId = intval($input['publish_id']); 00720 $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId; 00721 } 00722 00723 // Saving 00724 $this->writeUC(); 00725 } 00726 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR'); 00727 if ($this->extGetFeAdminValue('cache','noCache')) {$GLOBALS['TSFE']->set_no_cache();} 00728 } 00729 00737 function extGetFeAdminValue($pre,$val='') { 00738 if ($this->extAdmModuleEnabled($pre)) { // Check if module is enabled. 00739 // Exceptions where the values can be overridden from backend: 00740 if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons']) { 00741 return true; 00742 } 00743 if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) { 00744 return true; 00745 } 00746 00747 $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1; 00748 00749 if ($pre=='preview' && $this->ext_forcePreview) { 00750 if (!$val) { 00751 return true; 00752 } else { 00753 return $retVal; 00754 } 00755 } 00756 00757 // regular check: 00758 if ($this->extIsAdmMenuOpen($pre)) { // See if the menu is expanded! 00759 return $retVal; 00760 } 00761 } 00762 } 00763 00770 function extIsAdmMenuOpen($pre) { 00771 return $this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre]; 00772 } 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 /***************************************************** 00790 * 00791 * TSFE BE user Access Functions 00792 * 00793 ****************************************************/ 00794 00805 function extGetTreeList($id,$depth,$begin=0,$perms_clause) { 00806 $depth=intval($depth); 00807 $begin=intval($begin); 00808 $id=intval($id); 00809 $theList=''; 00810 00811 if ($id && $depth>0) { 00812 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00813 'uid,title', 00814 'pages', 00815 'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND deleted=0 AND '.$perms_clause 00816 ); 00817 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00818 if ($begin<=0) { 00819 $theList.=$row['uid'].','; 00820 $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth); 00821 } 00822 if ($depth>1) { 00823 $theList.=$this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause); 00824 } 00825 } 00826 } 00827 return $theList; 00828 } 00829 00836 function extGetNumberOfCachedPages($page_id) { 00837 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id)); 00838 list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); 00839 return $num; 00840 } 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 /***************************************************** 00863 * 00864 * Localization handling 00865 * 00866 ****************************************************/ 00867 00875 function extGetLL($key) { 00876 global $LOCAL_LANG; 00877 if (!is_array($LOCAL_LANG)) { 00878 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php'); 00879 #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php'); 00880 if (!is_array($LOCAL_LANG)) $LOCAL_LANG=array(); 00881 } 00882 00883 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key)); // Label string in the default backend output charset. 00884 00885 // Convert to utf-8, then to entities: 00886 if ($GLOBALS['LANG']->charSet!='utf-8') { 00887 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet); 00888 } 00889 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr); 00890 00891 // Return the result: 00892 return $labelStr; 00893 } 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 /***************************************************** 00908 * 00909 * Frontend Editing 00910 * 00911 ****************************************************/ 00912 00919 function extIsEditAction() { 00920 if (is_array($this->TSFE_EDIT)) { 00921 if ($this->TSFE_EDIT['cancel']) { 00922 unset($this->TSFE_EDIT['cmd']); 00923 } elseif (($cmd!='edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd!='new') { 00924 // $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. 00925 return true; 00926 } 00927 } 00928 } 00929 00937 function extIsFormShown() { 00938 if (is_array($this->TSFE_EDIT)) { 00939 $cmd=(string)$this->TSFE_EDIT['cmd']; 00940 if ($cmd=='edit' || $cmd=='new') { 00941 return true; 00942 } 00943 } 00944 } 00945 00953 function extEditAction() { 00954 global $TCA, $TYPO3_CONF_VARS; 00955 // Commands: 00956 list($table,$uid) = explode(':',$this->TSFE_EDIT['record']); 00957 if ($this->TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table])) { 00958 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00959 $tce->stripslashes_values=0; 00960 $recData=array(); 00961 $cmdData=array(); 00962 $cmd=$this->TSFE_EDIT['cmd']; 00963 00964 // **************** 00965 // extEditAction HOOK 00966 // **************** 00967 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) { 00968 $_params = array(); 00969 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) { 00970 t3lib_div::callUserFunction($_funcRef,$_params,$this); 00971 } 00972 } 00973 00974 switch($cmd) { 00975 case 'hide': 00976 case 'unhide': 00977 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled']; 00978 if ($hideField) { 00979 $recData[$table][$uid][$hideField]=($cmd=='hide'?1:0); 00980 $tce->start($recData,Array()); 00981 $tce->process_datamap(); 00982 } 00983 break; 00984 case 'up': 00985 case 'down': 00986 $sortField = $TCA[$table]['ctrl']['sortby']; 00987 if ($sortField) { 00988 if ($cmd=='up') { 00989 $op= '<'; 00990 $desc=' DESC'; 00991 } else { 00992 $op= '>'; 00993 $desc=''; 00994 } 00995 // Get self: 00996 $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1)); 00997 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid); 00998 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00999 // record before or after 01000 $preview = $this->extGetFeAdminValue('preview'); 01001 $copyAfterFieldsQuery = ''; 01002 if ($preview) {$ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);} 01003 if ($TCA[$table]['ctrl']['copyAfterDuplFields']) { 01004 $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1); 01005 while(list(,$fN)=each($cAFields)) { 01006 $copyAfterFieldsQuery.=' AND '.$fN.'="'.$row[$fN].'"'; 01007 } 01008 } 01009 01010 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 01011 'uid,pid', 01012 $table, 01013 'pid='.intval($row['pid']). 01014 ' AND '.$sortField.$op.intval($row[$sortField]). 01015 $copyAfterFieldsQuery. 01016 t3lib_pageSelect::enableFields($table,'',$ignore), 01017 '', 01018 $sortField.$desc, 01019 '2' 01020 ); 01021 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 01022 if($cmd=='down') { 01023 $cmdData[$table][$uid]['move']= -$row2['uid']; 01024 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Must take the second record above... 01025 $cmdData[$table][$uid]['move']= -$row3['uid']; 01026 } else { // ... and if that does not exist, use pid 01027 $cmdData[$table][$uid]['move']= $row['pid']; 01028 } 01029 } elseif ($cmd=='up') { 01030 $cmdData[$table][$uid]['move']= $row['pid']; 01031 } 01032 } 01033 if (count($cmdData)) { 01034 $tce->start(Array(),$cmdData); 01035 $tce->process_cmdmap(); 01036 } 01037 } 01038 break; 01039 case 'delete': 01040 $cmdData[$table][$uid]['delete']= 1; 01041 if (count($cmdData)) { 01042 $tce->start(Array(),$cmdData); 01043 $tce->process_cmdmap(); 01044 } 01045 break; 01046 } 01047 } 01048 // Data: 01049 if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) { 01050 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 01051 $tce->stripslashes_values=0; 01052 $tce->start($this->TSFE_EDIT['data'],Array()); 01053 $tce->process_uploads($_FILES); 01054 $tce->process_datamap(); 01055 } 01056 } 01057 } 01058 01059 01060 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']) { 01061 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']); 01062 } 01063 ?>