00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00103 class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth {
00104 var $formfield_uname = '';
00105 var $formfield_uident = '';
00106 var $formfield_chalvalue = '';
00107 var $security_level = '';
00108 var $writeStdLog = 0;
00109 var $writeAttemptLog = 0;
00110 var $auth_include = '';
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;
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;
00136 break;
00137 }
00138 }
00139 }
00140
00141
00142 if($this->extAdmEnabled || $this->extGetFeAdminValue('edit', 'displayIcons')) {
00143 $this->TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
00144 }
00145 }
00146
00154 function extPrintFeAdminDialog() {
00155 $out='';
00156 if ($this->uc['TSFE_adminConfig']['display_top']) {
00157 if ($this->extAdmModuleEnabled('preview')) $out.= $this->extGetCategory_preview();
00158 if ($this->extAdmModuleEnabled('cache')) $out.= $this->extGetCategory_cache();
00159 if ($this->extAdmModuleEnabled('publish')) $out.= $this->extGetCategory_publish();
00160 if ($this->extAdmModuleEnabled('edit')) $out.= $this->extGetCategory_edit();
00161 if ($this->extAdmModuleEnabled('tsdebug')) $out.= $this->extGetCategory_tsdebug();
00162 if ($this->extAdmModuleEnabled('info')) $out.= $this->extGetCategory_info();
00163 }
00164
00165 $header='
00166 <tr class="typo3-adminPanel-hRow" style="background-color:#9ba1a8;">
00167 <td colspan="4" nowrap="nowrap">'.
00168 $this->extItemLink('top','<img src="'.TYPO3_mainDir.'gfx/ol/'.($this->uc['TSFE_adminConfig']['display_top']?'minus':'plus').'bullet.gif" width="18" height="16" align="absmiddle" border="0" alt="" /><strong>'.$this->extFw($this->extGetLL('adminOptions')).'</strong>').
00169 $this->extFw(': '.$this->user['username']).'
00170 <img src="clear.gif" width="40" height="1" alt="" />
00171 <input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="'.$this->uc['TSFE_adminConfig']['display_top'].'" />'.($this->extNeedUpdate?'<input type="submit" value="'.$this->extGetLL('update').'" />':'').'</td>
00172 </tr>';
00173
00174 $query='';
00175 foreach(t3lib_div::_GET() as $k => $v) {
00176 if ($k != 'TSFE_ADMIN_PANEL') {
00177 if (is_array($v)) {
00178 $query.=$this->extPrintFeAdminDialogHiddenFields($k,$v);
00179 } else {
00180 $query.='<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'">'.chr(10);
00181 }
00182 }
00183 }
00184 $out='
00185 <!--
00186 ADMIN PANEL
00187 -->
00188 <a name="TSFE_ADMIN"></a>
00189 <form name="TSFE_ADMIN_PANEL_FORM" action="'.htmlspecialchars(t3lib_div::getIndpEnv('SCRIPT_NAME')).'#TSFE_ADMIN" method="get" style="margin:0;">
00190 '.$query.
00191 ' <table border="0" cellpadding="0" cellspacing="0" class="typo3-adminPanel" style="background-color:#f6f2e6; border: 1px solid black; z-index:0; position:absolute;">'.$header.$out.'
00192 </table>
00193 </form>';
00194
00195 if ($this->uc['TSFE_adminConfig']['display_top']) {
00196 $out.='<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
00197 $out.='
00198 <script type="text/javascript">
00199
00200 var evalFunc = new evalFunc();
00201
00202 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) {
00203 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00204 var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
00205 if (checkbox && theValue==checkboxValue) {
00206 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
00207 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
00208 } else {
00209 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
00210 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
00211 }
00212 }
00213
00214 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) {
00215 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00216 if (checkbox_off) {
00217 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
00218 }else{
00219 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
00220 }
00221 TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
00222 }
00223
00224 </script>
00225 <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
00226 }
00227 return "\n\n\n\n".$out.'<br />';
00228 }
00229
00239 function extPrintFeAdminDialogHiddenFields($key,&$val) {
00240 $out='';
00241 foreach($val as $k => $v) {
00242 if (is_array($v)) {
00243 $out.=$this->extPrintFeAdminDialogHiddenFields($key.'['.$k.']',$v);
00244 } else {
00245 $out.='<input type="hidden" name="'.$key.'['.$k.']" value="'.htmlspecialchars($v).'">'.chr(10);
00246 }
00247 }
00248 return $out;
00249 }
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00279 function extGetCategory_preview($out='') {
00280 $out.=$this->extGetHead('preview');
00281 if ($this->uc['TSFE_adminConfig']['display_preview']) {
00282 $this->extNeedUpdate = 1;
00283 $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"':'').' />');
00284 $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"':'').' />');
00285
00286
00287 $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'].'" />');
00288 $this->extJSCODE.= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
00289
00290
00291 $options = '<option value="0"></option>';
00292 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00293 'fe_groups.uid, fe_groups.title',
00294 'fe_groups,pages',
00295 'pages.uid=fe_groups.pid AND pages.deleted=0 '.t3lib_BEfunc::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1)
00296 );
00297 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00298 $options.= '<option value="'.$row['uid'].'"'.($this->uc['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
00299 }
00300 $out.= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
00301 }
00302 return $out;
00303 }
00304
00312 function extGetCategory_cache($out='') {
00313 $out.=$this->extGetHead('cache');
00314 if ($this->uc['TSFE_adminConfig']['display_cache']) {
00315 $this->extNeedUpdate=1;
00316 $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"':'').' />');
00317
00318 $options='';
00319 $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00320 $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00321 $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00322 $out.=$this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
00323 '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00324
00325
00326 $depth=$this->extGetFeAdminValue('cache','clearCacheLevels');
00327 $outTable='';
00328 $this->extPageInTreeInfo=array();
00329 $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00330 $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00331 reset($this->extPageInTreeInfo);
00332 while(list(,$row)=each($this->extPageInTreeInfo)) {
00333 $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td><td><img src="clear.gif" width="10" height="1" alt="" /></td><td>'.$this->extFw($this->extGetNumberOfCachedPages($row[0])).'</td></tr>';
00334 }
00335 $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00336 $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
00337 $out.=$this->extGetItem('cache_cacheEntries', $outTable);
00338
00339 }
00340 return $out;
00341 }
00342
00350 function extGetCategory_publish($out='') {
00351 $out.=$this->extGetHead('publish');
00352 if ($this->uc['TSFE_adminConfig']['display_publish']) {
00353 $this->extNeedUpdate=1;
00354 $options='';
00355 $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['publish_levels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
00356 $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['publish_levels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
00357 $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['publish_levels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
00358 $out.=$this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
00359 '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
00360
00361
00362 $depth=$this->extGetFeAdminValue('publish','levels');
00363 $outTable='';
00364 $this->extPageInTreeInfo=array();
00365 $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
00366 $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
00367 reset($this->extPageInTreeInfo);
00368 while(list(,$row)=each($this->extPageInTreeInfo)) {
00369 $outTable.='<tr><td nowrap="nowrap"><img src="clear.gif" width="'.(($depth+1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td><td><img src="clear.gif" width="10" height="1" alt="" /></td><td>'.$this->extFw('...').'</td></tr>';
00370 }
00371 $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
00372 $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
00373 $out.=$this->extGetItem('publish_tree', $outTable);
00374 }
00375 return $out;
00376 }
00377
00385 function extGetCategory_edit($out='') {
00386 $out.=$this->extGetHead('edit');
00387 if ($this->uc['TSFE_adminConfig']['display_edit']) {
00388
00389
00390 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00391 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00392
00393 $this->extNeedUpdate=1;
00394 $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"':'').' />');
00395 $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"':'').' />');
00396 $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"':'').' />');
00397 $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"':'').' />');
00398
00399 $out.=$this->extGetItem('', $this->ext_makeToolBar());
00400 if (!t3lib_div::_GP('ADMCMD_view')) {
00401 $out.=$this->extGetItem('', '<a href="#" onclick="'.
00402 htmlspecialchars('
00403 if (parent.opener && parent.opener.top && parent.opener.top.TS) {
00404 parent.opener.top.fsMod.recentIds["web"]='.intval($GLOBALS['TSFE']->page['uid']).';
00405 if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav) {
00406 parent.opener.top.content.nav_frame.refresh_nav();
00407 }
00408 parent.opener.top.goToModule("'.$pageModule.'");
00409 parent.opener.top.focus();
00410 } else {
00411 vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
00412 vHWin.focus();
00413 }
00414 return false;
00415 ').
00416 '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
00417 }
00418 }
00419 return $out;
00420 }
00421
00429 function extGetCategory_tsdebug($out='') {
00430 $out.=$this->extGetHead('tsdebug');
00431 if ($this->uc['TSFE_adminConfig']['display_tsdebug']) {
00432 $this->extNeedUpdate=1;
00433
00434 $content='';
00435 $content.=$this->extGetItem('tsdebug_tree', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_tree']?' checked="checked"':'').' />');
00436 $content.=$this->extGetItem('tsdebug_displayTimes', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayTimes']?' checked="checked"':'').' />');
00437 $content.=$this->extGetItem('tsdebug_displayMessages', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayMessages']?' checked="checked"':'').' />');
00438 $content.=$this->extGetItem('tsdebug_LR', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_LR']?' checked="checked"':'').' />');
00439 $content.=$this->extGetItem('tsdebug_displayContent', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayContent']?' checked="checked"':'').' />');
00440 $content.=$this->extGetItem('tsdebug_displayQueries', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_displayQueries']?' checked="checked"':'').' />');
00441 $content.=$this->extGetItem('tsdebug_forceTemplateParsing', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="1"'.($this->uc['TSFE_adminConfig']['tsdebug_forceTemplateParsing']?' checked="checked"':'').' />');
00442
00443 $out.='<tr><td colspan="4" nowrap="nowrap"><table border="0" cellpadding="0" cellspacing="0">'.$content.'</table></td></tr>';
00444
00445 $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
00446 $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
00447 $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
00448 $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
00449 $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
00450 $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td></tr>';
00451 }
00452 return $out;
00453 }
00454
00462 function extGetCategory_info($out='') {
00463 $out.=$this->extGetHead('info');
00464 if ($this->uc['TSFE_adminConfig']['display_info']) {
00465
00466 if (is_array($GLOBALS['TSFE']->imagesOnPage) && $this->extGetFeAdminValue('cache','noCache')) {
00467 reset($GLOBALS['TSFE']->imagesOnPage);
00468 $theBytes=0;
00469 $count=0;
00470 $fileTable='';
00471 while(list(,$file)=each($GLOBALS['TSFE']->imagesOnPage)) {
00472 $fs=@filesize($file);
00473 $fileTable.='<tr><td>'.$this->extFw($file).'</td><td align="right">'.$this->extFw(t3lib_div::formatSize($fs)).'</td></tr>';
00474 $theBytes+=$fs;
00475 $count++;
00476 }
00477 $fileTable.='<tr><td><strong>'.$this->extFw('Total number of images:').'</strong></td><td>'.$this->extFw($count).'</td></tr>';
00478 $fileTable.='<tr><td><strong>'.$this->extFw('Total image file sizes:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize($theBytes)).'</td></tr>';
00479 $fileTable.='<tr><td><strong>'.$this->extFw('Document size:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content))).'</td></tr>';
00480 $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>';
00481 $fileTable.='<tr><td> </td></tr>';
00482 }
00483
00484 $fileTable.='<tr><td>'.$this->extFw('id:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->id).'</td></tr>';
00485 $fileTable.='<tr><td>'.$this->extFw('type:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->type).'</td></tr>';
00486 $fileTable.='<tr><td>'.$this->extFw('gr_list:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->gr_list).'</td></tr>';
00487 $fileTable.='<tr><td>'.$this->extFw('no_cache:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->no_cache).'</td></tr>';
00488 $fileTable.='<tr><td>'.$this->extFw('fe_user, name:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['username']).'</td></tr>';
00489 $fileTable.='<tr><td>'.$this->extFw('fe_user, uid:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['uid']).'</td></tr>';
00490 $fileTable.='<tr><td> </td></tr>';
00491
00492
00493 $fileTable.='<tr><td>'.$this->extFw('Total parsetime:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->scriptParseTime.' ms').'</td></tr>';
00494
00495 $fileTable='<table border="0" cellpadding="0" cellspacing="0">'.$fileTable.'</table>';
00496
00497 $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$fileTable.'</td></tr>';
00498 }
00499 return $out;
00500 }
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00535 function extGetHead($pre) {
00536 $out.='<img src="'.TYPO3_mainDir.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
00537 $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="" />';
00538 $out.=$this->extFw($this->extGetLL($pre));
00539 $out=$this->extItemLink($pre,$out);
00540 return '
00541 <tr class="typo3-adminPanel-itemHRow" style="background-color:#abbbb4;">
00542 <td colspan="4" nowrap="nowrap" style="border-top:dashed 1px #007a8c;">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc['TSFE_adminConfig']['display_'.$pre].'" /></td>
00543 </tr>';
00544 }
00545
00555 function extItemLink($pre,$str) {
00556 return '<a href="#" style="text-decoration:none;" onclick="'.
00557 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;').
00558 '">'.$str.'</a>';
00559 }
00560
00571 function extGetItem($pre,$element) {
00572 return '
00573 <tr class="typo3-adminPanel-itemRow">
00574 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
00575 <td nowrap="nowrap">'.($pre ? $this->extFw($this->extGetLL($pre)) : ' ').'</td>
00576 <td><img src="clear.gif" width="40" height="1" alt="" /></td>
00577 <td>'.$element.'</td>
00578 </tr>';
00579
00580 }
00581
00588 function extFw($str) {
00589 return '<font face="verdana,arial" size="1" color="black">'.$str.'</font>';
00590 }
00591
00597 function ext_makeToolBar() {
00598
00599 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00600 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00601 $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');
00602
00603
00604 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00605 $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
00606
00607 $toolBar='';
00608 $id = $GLOBALS['TSFE']->id;
00609 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'.
00610 '<img src="'.TYPO3_mainDir.'gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>';
00611
00612 if ($perms&16 && $langAllowed) {
00613 $params = '';
00614 if ($GLOBALS['TSFE']->sys_language_uid) $params = '&sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid;
00615 $toolBar.='<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.$params.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00616 '<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>';
00617 }
00618 if ($perms&2) {
00619 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00620 '<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>';
00621 }
00622 if ($perms&8) {
00623 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00624 '<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>';
00625 }
00626 if ($perms&2) {
00627 $params='&edit[pages]['.$id.']=edit';
00628 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00629 '<img src="'.TYPO3_mainDir.'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageProperties').'" alt="" /></a>';
00630 }
00631 if ($this->check('modules','web_list')) {
00632 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00633 '<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>';
00634 }
00635 return $toolBar;
00636 }
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00669 function checkBackendAccessSettingsFromInitPhp() {
00670 global $TYPO3_CONF_VARS;
00671
00672
00673
00674
00675 if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) {
00676 return FALSE;
00677 }
00678
00679
00680
00681
00682 if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00683 if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) {
00684 return FALSE;
00685 }
00686 }
00687
00688
00689
00690
00691
00692 if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && $TYPO3_CONF_VARS['BE']['lockSSL'] != 3) {
00693 if (!t3lib_div::getIndpEnv('TYPO3_SSL')) {
00694 return FALSE;
00695 }
00696 }
00697
00698
00699 if (!$TYPO3_CONF_VARS['BE']['adminOnly'] || $this->isAdmin()) {
00700 return TRUE;
00701 } else return FALSE;
00702 }
00703
00704
00714 function extPageReadAccess($pageRec) {
00715 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
00716 }
00717
00725 function extAdmModuleEnabled($key) {
00726
00727 if ($key=="preview" && $this->ext_forcePreview) return true;
00728
00729 if ($this->extAdminConfig['enable.']['all']) return true;
00730 if ($this->extAdminConfig['enable.'][$key]) {
00731 return true;
00732 }
00733 }
00734
00741 function extSaveFeAdminConfig() {
00742 $input = t3lib_div::_GET('TSFE_ADMIN_PANEL');
00743 if (is_array($input)) {
00744
00745 $this->uc['TSFE_adminConfig'] = array_merge(!is_array($this->uc['TSFE_adminConfig'])?array():$this->uc['TSFE_adminConfig'], $input);
00746 unset($this->uc['TSFE_adminConfig']['action']);
00747
00748
00749 if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) {
00750 $this->extPageInTreeInfo=array();
00751 $theStartId = intval($input['cache_clearCacheId']);
00752 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
00753 }
00754 if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish')) {
00755 $theStartId = intval($input['publish_id']);
00756 $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
00757 }
00758
00759
00760 $this->writeUC();
00761 }
00762 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR');
00763 if ($this->extGetFeAdminValue('cache','noCache')) {$GLOBALS['TSFE']->set_no_cache();}
00764 }
00765
00773 function extGetFeAdminValue($pre,$val='') {
00774 if ($this->extAdmModuleEnabled($pre)) {
00775
00776
00777 if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
00778 return true;
00779 }
00780 if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) {
00781 return true;
00782 }
00783
00784
00785 if ($this->extAdminConfig['override.'][$pre.'.'][$val] && $val) {
00786 return $this->extAdminConfig['override.'][$pre.'.'][$val];
00787 }
00788 if ($this->extAdminConfig['override.'][$pre]) {
00789 return $this->extAdminConfig['override.'][$pre];
00790 }
00791
00792 $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1;
00793
00794 if ($pre=='preview' && $this->ext_forcePreview) {
00795 if (!$val) {
00796 return true;
00797 } else {
00798 return $retVal;
00799 }
00800 }
00801
00802
00803 if ($this->extIsAdmMenuOpen($pre)) {
00804 return $retVal;
00805 }
00806 }
00807 }
00808
00815 function extIsAdmMenuOpen($pre) {
00816 return $this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre];
00817 }
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00850 function extGetTreeList($id,$depth,$begin=0,$perms_clause) {
00851 $depth=intval($depth);
00852 $begin=intval($begin);
00853 $id=intval($id);
00854 $theList='';
00855
00856 if ($id && $depth>0) {
00857 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00858 'uid,title',
00859 'pages',
00860 'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND deleted=0 AND '.$perms_clause
00861 );
00862 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00863 if ($begin<=0) {
00864 $theList.=$row['uid'].',';
00865 $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth);
00866 }
00867 if ($depth>1) {
00868 $theList.=$this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
00869 }
00870 }
00871 }
00872 return $theList;
00873 }
00874
00881 function extGetNumberOfCachedPages($page_id) {
00882 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id));
00883 list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00884 return $num;
00885 }
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00920 function extGetLL($key) {
00921 global $LOCAL_LANG;
00922 if (!is_array($LOCAL_LANG)) {
00923 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
00924 #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
00925 if (!is_array($LOCAL_LANG)) $LOCAL_LANG=array();
00926 }
00927
00928 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));
00929
00930
00931 if ($GLOBALS['LANG']->charSet!='utf-8') {
00932 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
00933 }
00934 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
00935
00936
00937 return $labelStr;
00938 }
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00964 function extIsEditAction() {
00965 if (is_array($this->TSFE_EDIT)) {
00966 if ($this->TSFE_EDIT['cancel']) {
00967 unset($this->TSFE_EDIT['cmd']);
00968 } else {
00969 $cmd = (string)$this->TSFE_EDIT['cmd'];
00970 if (($cmd!='edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd!='new') {
00971
00972 return true;
00973 }
00974 }
00975 }
00976 return false;
00977 }
00978
00986 function extIsFormShown() {
00987 if (is_array($this->TSFE_EDIT)) {
00988 $cmd=(string)$this->TSFE_EDIT['cmd'];
00989 if ($cmd=='edit' || $cmd=='new') {
00990 return true;
00991 }
00992 }
00993 }
00994
01002 function extEditAction() {
01003 global $TCA, $TYPO3_CONF_VARS;
01004
01005 list($table,$uid) = explode(':',$this->TSFE_EDIT['record']);
01006 if ($this->TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table])) {
01007 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01008 $tce->stripslashes_values=0;
01009 $recData=array();
01010 $cmdData=array();
01011 $cmd=$this->TSFE_EDIT['cmd'];
01012
01013
01014
01015
01016 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
01017 $_params = array();
01018 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
01019 t3lib_div::callUserFunction($_funcRef,$_params,$this);
01020 }
01021 }
01022
01023 switch($cmd) {
01024 case 'hide':
01025 case 'unhide':
01026 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
01027 if ($hideField) {
01028 $recData[$table][$uid][$hideField]=($cmd=='hide'?1:0);
01029 $tce->start($recData,Array());
01030 $tce->process_datamap();
01031 }
01032 break;
01033 case 'up':
01034 case 'down':
01035 $sortField = $TCA[$table]['ctrl']['sortby'];
01036 if ($sortField) {
01037 if ($cmd=='up') {
01038 $op= '<';
01039 $desc=' DESC';
01040 } else {
01041 $op= '>';
01042 $desc='';
01043 }
01044
01045 $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
01046 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
01047 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01048
01049 $preview = $this->extGetFeAdminValue('preview');
01050 $copyAfterFieldsQuery = '';
01051 if ($preview) {$ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);}
01052 if ($TCA[$table]['ctrl']['copyAfterDuplFields']) {
01053 $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
01054 while(list(,$fN)=each($cAFields)) {
01055 $copyAfterFieldsQuery.=' AND '.$fN.'="'.$row[$fN].'"';
01056 }
01057 }
01058
01059 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01060 'uid,pid',
01061 $table,
01062 'pid='.intval($row['pid']).
01063 ' AND '.$sortField.$op.intval($row[$sortField]).
01064 $copyAfterFieldsQuery.
01065 t3lib_pageSelect::enableFields($table,'',$ignore),
01066 '',
01067 $sortField.$desc,
01068 '2'
01069 );
01070 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01071 if($cmd=='down') {
01072 $cmdData[$table][$uid]['move']= -$row2['uid'];
01073 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01074 $cmdData[$table][$uid]['move']= -$row3['uid'];
01075 } else {
01076 $cmdData[$table][$uid]['move']= $row['pid'];
01077 }
01078 } elseif ($cmd=='up') {
01079 $cmdData[$table][$uid]['move']= $row['pid'];
01080 }
01081 }
01082 if (count($cmdData)) {
01083 $tce->start(Array(),$cmdData);
01084 $tce->process_cmdmap();
01085 }
01086 }
01087 break;
01088 case 'delete':
01089 $cmdData[$table][$uid]['delete']= 1;
01090 if (count($cmdData)) {
01091 $tce->start(Array(),$cmdData);
01092 $tce->process_cmdmap();
01093 }
01094 break;
01095 }
01096 }
01097
01098 if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) {
01099 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
01100 $tce->stripslashes_values=0;
01101 $tce->start($this->TSFE_EDIT['data'],Array());
01102 $tce->process_uploads($_FILES);
01103 $tce->process_datamap();
01104 }
01105 }
01106 }
01107
01108
01109 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']) {
01110 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);
01111 }
01112 ?>