2 /***************************************************************
5 * (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Class for TYPO3 backend user authentication in the TSFE frontend
31 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 * [CLASS/FUNCTION INDEX of SCRIPT]
41 * 103: class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth
42 * 129: function extInitFeAdmin()
43 * 154: function extPrintFeAdminDialog()
45 * SECTION: Creating sections of the Admin Panel
46 * 250: function extGetCategory_preview($out='')
47 * 283: function extGetCategory_cache($out='')
48 * 321: function extGetCategory_publish($out='')
49 * 356: function extGetCategory_edit($out='')
50 * 400: function extGetCategory_tsdebug($out='')
51 * 433: function extGetCategory_info($out='')
53 * SECTION: Admin Panel Layout Helper functions
54 * 506: function extGetHead($pre)
55 * 526: function extItemLink($pre,$str)
56 * 542: function extGetItem($pre,$element)
57 * 559: function extFw($str)
58 * 568: function ext_makeToolBar()
60 * SECTION: TSFE BE user Access Functions
61 * 637: function checkBackendAccessSettingsFromInitPhp()
62 * 682: function extPageReadAccess($pageRec)
63 * 693: function extAdmModuleEnabled($key)
64 * 709: function extSaveFeAdminConfig()
65 * 741: function extGetFeAdminValue($pre,$val='')
66 * 783: function extIsAdmMenuOpen($pre)
68 * SECTION: TSFE BE user Access Functions
69 * 818: function extGetTreeList($id,$depth,$begin=0,$perms_clause)
70 * 849: function extGetNumberOfCachedPages($page_id)
72 * SECTION: Localization handling
73 * 888: function extGetLL($key)
75 * SECTION: Frontend Editing
76 * 932: function extIsEditAction()
77 * 954: function extIsFormShown()
78 * 970: function extEditAction()
81 * (This index is automatically created/updated by the extension "extdeveval")
96 * TYPO3 backend user authentication in the TSFE frontend.
97 * This includes mainly functions related to the Admin Panel
99 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
103 class t3lib_tsfeBeUserAuth
extends t3lib_beUserAuth
{
104 var $formfield_uname = ''; // formfield with login-name
105 var $formfield_uident = ''; // formfield with password
106 var $formfield_chalvalue = ''; // formfield with a unique value which is used to encrypt the password and username
107 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.
108 var $writeStdLog = 0; // Decides if the writelog() function is called at login and logout
109 var $writeAttemptLog = 0; // If the writelog() functions is called if a login-attempt has be tried without success
110 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.
112 var $extNeedUpdate=0;
113 var $extPublishList='';
114 var $extPageInTreeInfo=array();
115 var $ext_forcePreview=0;
116 var $langSplitIndex=0;
117 var $extAdmEnabled = 0; // General flag which is set if the adminpanel should be displayed at all..
123 * Initialize the usage of Admin Panel.
124 * Called from index_ts.php if a backend users is correctly logged in.
125 * Sets $this->extAdminConfig to the "admPanel" config for the user and $this->extAdmEnabled = 1 IF access is enabled.
129 function extInitFeAdmin() {
130 $this->extAdminConfig
= $this->getTSConfigProp('admPanel');
131 if (is_array($this->extAdminConfig
['enable.'])) {
132 reset($this->extAdminConfig
['enable.']);
133 while(list($k,$v)=each($this->extAdminConfig
['enable.'])) {
135 $this->extAdmEnabled
=1; // Enable panel
141 // Init TSFE_EDIT variables if either the admPanel is enabled or if forceDisplayIcons is set
142 if($this->extAdmEnabled ||
$this->extGetFeAdminValue('edit', 'displayIcons')) {
143 $this->TSFE_EDIT
= t3lib_div
::_POST('TSFE_EDIT');
148 * Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
149 * Called from index_ts.php - in the end of the script
151 * @return string HTML for the Admin Panel
154 function extPrintFeAdminDialog() {
156 if ($this->uc
['TSFE_adminConfig']['display_top']) {
157 if ($this->extAdmModuleEnabled('preview')) $out.= $this->extGetCategory_preview();
158 if ($this->extAdmModuleEnabled('cache')) $out.= $this->extGetCategory_cache();
159 if ($this->extAdmModuleEnabled('publish')) $out.= $this->extGetCategory_publish();
160 if ($this->extAdmModuleEnabled('edit')) $out.= $this->extGetCategory_edit();
161 if ($this->extAdmModuleEnabled('tsdebug')) $out.= $this->extGetCategory_tsdebug();
162 if ($this->extAdmModuleEnabled('info')) $out.= $this->extGetCategory_info();
165 $row = '<img src="'.TYPO3_mainDir
.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
166 $row.= '<img src="'.TYPO3_mainDir
.'gfx/ol/'.($this->uc
['TSFE_adminConfig']['display_top']?
'minus':'plus').'bullet.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
167 $row.= '<strong>'.$this->extFw($this->extGetLL('adminOptions')).'</strong>';
168 $row.= $this->extFw(': '.$this->user
['username']);
171 <tr class="typo3-adminPanel-hRow" style="background-color:#9ba1a8;">
172 <td colspan="4" style="text-align:left; white-space:nowrap;">'.
173 $this->extItemLink('top',$row).'
174 <img src="clear.gif" width="40" height="1" alt="" />
175 <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>
178 $query = !t3lib_div
::_GET('id') ?
('<input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id
.'" />'.chr(10)) : '';
179 // the dummy field is needed for Firefox: to force a page reload on submit with must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
180 $query.= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="">';
181 foreach (t3lib_div
::_GET() as $k => $v) {
182 if ($k != 'TSFE_ADMIN_PANEL') {
184 $query.= $this->extPrintFeAdminDialogHiddenFields($k,$v);
186 $query.= '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'">'.chr(10);
195 <a name="TSFE_ADMIN"></a>
196 <form name="TSFE_ADMIN_PANEL_FORM" action="'.htmlspecialchars(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'#TSFE_ADMIN" method="get" style="margin:0;" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">'.
198 <table border="0" cellpadding="0" cellspacing="0" class="typo3-adminPanel" style="background-color:#f6f2e6; border: 1px solid black; z-index:0; position:absolute;" summary="">'.
204 if ($this->uc
['TSFE_adminConfig']['display_top']) {
205 $out.= '<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
207 <script type="text/javascript">
209 var evalFunc = new evalFunc();
210 // TSFEtypo3FormFieldSet()
211 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) { //
212 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
213 var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
214 if (checkbox && theValue==checkboxValue) {
215 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
216 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
218 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
219 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
222 // TSFEtypo3FormFieldGet()
223 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) { //
224 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
226 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
228 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
230 TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
234 <script language="javascript" type="text/javascript">'.$this->extJSCODE
.'</script>';
236 return "\n\n\n\n".$out.'<br />';
240 * Fetches recursively all GET parameters as hidden fields.
241 * Called from extPrintFeAdminDialog.
243 * @param string current key
244 * @param mixed current value
245 * @return string hidden fields
246 * @see extPrintFeAdminDialog()
248 function extPrintFeAdminDialogHiddenFields($key,&$val) {
250 foreach($val as $k => $v) {
252 $out.= $this->extPrintFeAdminDialogHiddenFields($key.'['.$k.']',$v);
254 $out.= '<input type="hidden" name="'.$key.'['.$k.']" value="'.htmlspecialchars($v).'">'.chr(10);
275 /*****************************************************
277 * Creating sections of the Admin Panel
279 ****************************************************/
282 * Creates the content for the "preview" section ("module") of the Admin Panel
284 * @param string Optional start-value; The generated content is added to this variable.
285 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
286 * @see extPrintFeAdminDialog()
288 function extGetCategory_preview($out='') {
289 $out.= $this->extGetHead('preview');
290 if ($this->uc
['TSFE_adminConfig']['display_preview']) {
291 $this->extNeedUpdate
= 1;
292 $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"':'').' />');
293 $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"':'').' />');
296 $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'].'" />');
297 $this->extJSCODE
.= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
300 $options = '<option value="0"> </option>';
301 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
302 'fe_groups.uid, fe_groups.title',
304 'pages.uid=fe_groups.pid AND pages.deleted=0 '.t3lib_BEfunc
::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1)
306 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
307 $options.= '<option value="'.$row['uid'].'"'.($this->uc
['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?
' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
309 $out.= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
315 * Creates the content for the "cache" section ("module") of the Admin Panel
317 * @param string Optional start-value; The generated content is added to this variable.
318 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
319 * @see extPrintFeAdminDialog()
321 function extGetCategory_cache($out='') {
322 $out.= $this->extGetHead('cache');
323 if ($this->uc
['TSFE_adminConfig']['display_cache']) {
324 $this->extNeedUpdate
= 1;
325 $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"':'').' />');
328 $options.= '<option value="0"'.($this->uc
['TSFE_adminConfig']['cache_clearCacheLevels']==0?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
329 $options.= '<option value="1"'.($this->uc
['TSFE_adminConfig']['cache_clearCacheLevels']==1?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
330 $options.= '<option value="2"'.($this->uc
['TSFE_adminConfig']['cache_clearCacheLevels']==2?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
332 $out.= $this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
333 '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id
.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
336 $depth = $this->extGetFeAdminValue('cache','clearCacheLevels');
338 $this->extPageInTreeInfo
= array();
339 $this->extPageInTreeInfo
[] = array($GLOBALS['TSFE']->page
['uid'],htmlspecialchars($GLOBALS['TSFE']->page
['title']),$depth+
1);
340 $this->extGetTreeList($GLOBALS['TSFE']->id
, $depth,0,$this->getPagePermsClause(1));
341 reset($this->extPageInTreeInfo
);
342 while(list(,$row)=each($this->extPageInTreeInfo
)) {
345 <td style="white-space:nowrap;"><img src="clear.gif" width="'.(($depth+
1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir
.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td>
346 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
347 <td>'.$this->extFw($this->extGetNumberOfCachedPages($row[0])).'</td>
350 $outTable = '<br /><table border="0" cellpadding="0" cellspacing="0" summary="">'.$outTable.'</table>';
351 $outTable.= '<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
353 $out.= $this->extGetItem('cache_cacheEntries', $outTable);
359 * Creates the content for the "publish" section ("module") of the Admin Panel
361 * @param string Optional start-value; The generated content is added to this variable.
362 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
363 * @see extPrintFeAdminDialog()
365 function extGetCategory_publish($out='') {
366 $out.= $this->extGetHead('publish');
367 if ($this->uc
['TSFE_adminConfig']['display_publish']) {
368 $this->extNeedUpdate
= 1;
370 $options.= '<option value="0"'.($this->uc
['TSFE_adminConfig']['publish_levels']==0?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
371 $options.= '<option value="1"'.($this->uc
['TSFE_adminConfig']['publish_levels']==1?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
372 $options.= '<option value="2"'.($this->uc
['TSFE_adminConfig']['publish_levels']==2?
' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
373 $out.= $this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
374 '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id
.'" /> <input type="submit" value="'.$this->extGetLL('update').'" />');
377 $depth = $this->extGetFeAdminValue('publish','levels');
379 $this->extPageInTreeInfo
= array();
380 $this->extPageInTreeInfo
[] = array($GLOBALS['TSFE']->page
['uid'],htmlspecialchars($GLOBALS['TSFE']->page
['title']),$depth+
1);
381 $this->extGetTreeList($GLOBALS['TSFE']->id
, $depth,0,$this->getPagePermsClause(1));
382 reset($this->extPageInTreeInfo
);
383 while(list(,$row)=each($this->extPageInTreeInfo
)) {
386 <td style="white-space:nowrap;"><img src="clear.gif" width="'.(($depth+
1-$row[2])*18).'" height="1" alt="" /><img src="'.TYPO3_mainDir
.'gfx/i/pages.gif" width="18" height="16" align="absmiddle" border="0" alt="" />'.$this->extFw($row[1]).'</td>
387 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
388 <td>'.$this->extFw('...').'</td>
391 $outTable = '<br /><table border="0" cellpadding="0" cellspacing="0" summary="">'.$outTable.'</table>';
392 $outTable.= '<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
394 $out.= $this->extGetItem('publish_tree', $outTable);
400 * Creates the content for the "edit" section ("module") of the Admin Panel
402 * @param string Optional start-value; The generated content is added to this variable.
403 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
404 * @see extPrintFeAdminDialog()
406 function extGetCategory_edit($out='') {
407 $out.= $this->extGetHead('edit');
408 if ($this->uc
['TSFE_adminConfig']['display_edit']) {
410 // If another page module was specified, replace the default Page module with the new one
411 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
412 $pageModule = t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
414 $this->extNeedUpdate
= 1;
415 $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"':'').' />');
416 $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"':'').' />');
417 $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"':'').' />');
418 $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"':'').' />');
419 $out.= $this->extGetItem('', $this->ext_makeToolBar());
421 if (!t3lib_div
::_GP('ADMCMD_view')) {
422 $out.= $this->extGetItem('', '<a href="#" onclick="'.
424 if (parent.opener && parent.opener.top && parent.opener.top.TS) {
425 parent.opener.top.fsMod.recentIds["web"]='.intval($GLOBALS['TSFE']->page
['uid']).';
426 if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav) {
427 parent.opener.top.content.nav_frame.refresh_nav();
429 parent.opener.top.goToModule("'.$pageModule.'");
430 parent.opener.top.focus();
432 vHWin=window.open(\''.TYPO3_mainDir
.t3lib_BEfunc
::getBackendScript().'\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
437 '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
444 * Creates the content for the "tsdebug" section ("module") of the Admin Panel
446 * @param string Optional start-value; The generated content is added to this variable.
447 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
448 * @see extPrintFeAdminDialog()
450 function extGetCategory_tsdebug($out='') {
451 $out.= $this->extGetHead('tsdebug');
452 if ($this->uc
['TSFE_adminConfig']['display_tsdebug']) {
453 $this->extNeedUpdate
= 1;
455 $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"':'').' />');
456 $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"':'').' />');
457 $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"':'').' />');
458 $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"':'').' />');
459 $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"':'').' />');
460 $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"':'').' />');
461 $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"':'').' />');
463 $GLOBALS['TT']->printConf
['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
464 $GLOBALS['TT']->printConf
['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
465 $GLOBALS['TT']->printConf
['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
466 $GLOBALS['TT']->printConf
['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
467 $GLOBALS['TT']->printConf
['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
471 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
472 <td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td>
479 * Creates the content for the "info" section ("module") of the Admin Panel
481 * @param string Optional start-value; The generated content is added to this variable.
482 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
483 * @see extPrintFeAdminDialog()
485 function extGetCategory_info($out='') {
486 $out.= $this->extGetHead('info');
487 if ($this->uc
['TSFE_adminConfig']['display_info']) {
490 if ($this->extGetFeAdminValue('cache','noCache')) {
494 if (count($GLOBALS['TSFE']->imagesOnPage
)) {
495 $tableArr[] = array('*Images on this page:*', '');
496 foreach ($GLOBALS['TSFE']->imagesOnPage
as $file) {
497 $fs = @filesize
($file);
498 $tableArr[] = array('– '.$file, t3lib_div
::formatSize($fs));
503 $tableArr[] = array('', ''); // Add an empty line
505 $tableArr[] = array('*Total number of images:*', $count);
506 $tableArr[] = array('*Total image file sizes:*', t3lib_div
::formatSize($theBytes));
507 $tableArr[] = array('*Document size:*', t3lib_div
::formatSize(strlen($GLOBALS['TSFE']->content
)));
508 $tableArr[] = array('*Total page load:*', t3lib_div
::formatSize(strlen($GLOBALS['TSFE']->content
)+
$theBytes));
509 $tableArr[] = array('', '');
512 $tableArr[] = array('id:', $GLOBALS['TSFE']->id
);
513 $tableArr[] = array('type:', $GLOBALS['TSFE']->type
);
514 $tableArr[] = array('gr_list:', $GLOBALS['TSFE']->gr_list
);
515 $tableArr[] = array('no_cache:', $GLOBALS['TSFE']->no_cache
);
516 $tableArr[] = array('fe_user, name:', $GLOBALS['TSFE']->fe_user
->user
['username']);
517 $tableArr[] = array('fe_user, uid:', $GLOBALS['TSFE']->fe_user
->user
['uid']);
518 $tableArr[] = array('', ''); // Add an empty line
521 $tableArr[] = array('*Total parsetime:*', $GLOBALS['TSFE']->scriptParseTime
.' ms');
524 foreach ($tableArr as $arr) {
525 if (strlen($arr[0])) { // Put text wrapped by "*" between <strong> tags
526 $value1 = preg_replace('/^\*(.*)\*$/', '$1', $arr[0], -1, $count);
527 $value1 = ($count?
'<strong>':'') . $this->extFw($value1) . ($count?
'</strong>':'');
529 $value1 = $this->extFw(' ');
532 $value2 = strlen($arr[1]) ?
$arr[1] : ' ';
533 $value2 = $this->extFw($value2);
537 <td style="text-align:left">'.$value1.'</td>
538 <td style="text-align:right">'.$value2.'</td>
542 $table = '<table border="0" cellpadding="0" cellspacing="0" summary="">'.$table.'</table>';
546 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
547 <td colspan="3">'.$table.'</td>
570 /*****************************************************
572 * Admin Panel Layout Helper functions
574 ****************************************************/
577 * Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
578 * It will have a plus/minus icon and a label which is linked so that it submits the form which surrounds the whole Admin Panel when clicked, alterting the TSFE_ADMIN_PANEL[display_'.$pre.'] value
579 * See the functions extGetCategory_*
581 * @param string The suffix to the display_ label. Also selects the label from the LOCAL_LANG array.
582 * @return string HTML table row.
586 function extGetHead($pre) {
587 $out = '<img src="'.TYPO3_mainDir
.'gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
588 $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="" />';
589 $out.= $this->extFw($this->extGetLL($pre));
591 $out = $this->extItemLink($pre,$out);
593 <tr class="typo3-adminPanel-itemHRow" style="background-color:#abbbb4;">
594 <td colspan="4" style="text-align:left; border-top:dashed 1px #007a8c; white-space:nowrap;">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc
['TSFE_adminConfig']['display_'.$pre].'" /></td>
599 * Wraps a string in a link which will open/close a certain part of the Admin Panel
601 * @param string The code for the display_ label/key
602 * @param string Input string
603 * @return string Linked input string
607 function extItemLink($pre,$str) {
608 return '<a href="#" style="text-decoration:none;" onclick="'.
609 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;').
614 * Returns a row (with 4 columns) for content in a section of the Admin Panel.
615 * It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
617 * @param string Key to label
618 * @param string The HTML content for the forth table cell.
619 * @return string HTML table row.
623 function extGetItem($pre,$element) {
625 <tr class="typo3-adminPanel-itemRow">
626 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
627 <td style="text-align:left; white-space:nowrap;">'.($pre ?
$this->extFw($this->extGetLL($pre)) : ' ').'</td>
628 <td><img src="clear.gif" width="30" height="1" alt="" /></td>
629 <td style="text-align:left; white-space:nowrap;">'.$element.'</td>
636 * Wraps a string in a span-tag with black verdana font
638 * @param string The string to wrap
641 function extFw($str) {
642 return '<span style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:0.6em; color:black;">'.$str.'</span>';
646 * Creates the tool bar links for the "edit" section of the Admin Panel.
648 * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
650 function ext_makeToolBar() {
651 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
652 $tmpTSc = t3lib_BEfunc
::getModTSconfig($this->pageinfo
['uid'],'mod.web_list');
653 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
654 $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');
656 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page
);
657 $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid
);
660 $id = $GLOBALS['TSFE']->id
;
661 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'#latest">'.
662 '<img src="'.TYPO3_mainDir
.'gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_recordHistory').'" alt="" /></a>';
664 if ($perms&16 && $langAllowed) {
666 if ($GLOBALS['TSFE']->sys_language_uid
) $params = '&sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid
;
667 $toolBar.= '<a href="'.htmlspecialchars($newContentWizScriptPath.'?id='.$id.$params.'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
668 '<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>';
671 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
672 '<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>';
675 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
676 '<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>';
679 $params = '&edit[pages]['.$id.']=edit';
680 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
681 '<img src="'.TYPO3_mainDir
.'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageProperties').'" alt="" /></a>';
683 if ($GLOBALS['TSFE']->sys_language_uid
&& $langAllowed) {
684 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
685 'uid,pid,t3ver_state', 'pages_language_overlay',
686 'pid='.intval($id).' AND sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid
.$GLOBALS['TSFE']->sys_page
->enableFields('pages_language_overlay'),
688 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
689 $GLOBALS['TSFE']->sys_page
->versionOL('pages_language_overlay',$row);
690 if (is_array($row)) {
691 $params='&edit[pages_language_overlay]['.$row['uid'].']=edit';
692 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
693 '<img src="'.TYPO3_mainDir
.'gfx/edit3.gif" width="11" height="12" hspace="2" border="0" align="top" title="'.$this->extGetLL('edit_editPageOverlay').'" alt="" /></a>';
697 if ($this->check('modules','web_list')) {
698 $toolBar.= '<a href="'.htmlspecialchars(TYPO3_mainDir
.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'))).'">'.
699 '<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>';
723 /*****************************************************
725 * TSFE BE user Access Functions
727 ****************************************************/
730 * Implementing the access checks that the typo3/init.php script does before a user is ever logged in.
731 * Used in the frontend.
733 * @return boolean Returns true if access is OK
734 * @see typo3/init.php, t3lib_beuserauth::backendCheckLogin()
736 function checkBackendAccessSettingsFromInitPhp() {
737 global $TYPO3_CONF_VARS;
739 // **********************
740 // Check Hardcoded lock on BE:
741 // **********************
742 if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) {
746 // **********************
748 // **********************
749 if (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
750 if (!t3lib_div
::cmpIP(t3lib_div
::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) {
756 // **********************
758 // **********************
759 if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && $TYPO3_CONF_VARS['BE']['lockSSL'] != 3) {
760 if (!t3lib_div
::getIndpEnv('TYPO3_SSL')) {
765 // Finally a check from t3lib_beuserauth::backendCheckLogin()
766 if (!$TYPO3_CONF_VARS['BE']['adminOnly'] ||
$this->isAdmin()) {
773 * Evaluates if the Backend User has read access to the input page record.
774 * The evaluation is based on both read-permission and whether the page is found in one of the users webmounts. Only if both conditions are true will the function return true.
775 * Read access means that previewing is allowed etc.
776 * Used in index_ts.php
778 * @param array The page record to evaluate for
779 * @return boolean True if read access
781 function extPageReadAccess($pageRec) {
782 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
786 * Checks if a Admin Panel section ("module") is available for the user. If so, true is returned.
788 * @param string The module key, eg. "edit", "preview", "info" etc.
790 * @see extPrintFeAdminDialog()
792 function extAdmModuleEnabled($key) {
793 // Returns true if the module checked is "preview" and the forcePreview flag is set.
794 if ($key=="preview" && $this->ext_forcePreview
) return true;
796 // If key is not set, only "all" is checked
797 if ($this->extAdminConfig
['enable.']['all']) return true;
798 if ($this->extAdminConfig
['enable.'][$key]) {
804 * Saves any change in settings made in the Admin Panel.
805 * Called from index_ts.php right after access check for the Admin Panel
809 function extSaveFeAdminConfig() {
810 $input = t3lib_div
::_GET('TSFE_ADMIN_PANEL');
811 if (is_array($input)) {
813 $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...
814 unset($this->uc
['TSFE_adminConfig']['action']);
817 if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) {
818 $this->extPageInTreeInfo
=array();
819 $theStartId = intval($input['cache_clearCacheId']);
820 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
822 if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish')) {
823 $theStartId = intval($input['publish_id']);
824 $this->extPublishList
= $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
830 $GLOBALS['TT']->LR
= $this->extGetFeAdminValue('tsdebug','LR');
832 if ($this->extGetFeAdminValue('cache','noCache')) {
833 $GLOBALS['TSFE']->set_no_cache();
836 // Hook for post processing the frontend admin configuration.
837 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'])) {
838 $_params = array('input' => &$input, 'pObj' => &$this);
839 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'] as $_funcRef) {
840 t3lib_div
::callUserFunction($_funcRef,$_params,$this);
846 * Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
848 * @param string Module key
849 * @param string Setting key
850 * @return string The setting value
852 function extGetFeAdminValue($pre,$val='') {
853 if ($this->extAdmModuleEnabled($pre)) { // Check if module is enabled.
854 // Exceptions where the values can be overridden from backend:
856 if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig
['module.']['edit.']['forceDisplayIcons']) {
859 if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig
['module.']['edit.']['forceDisplayFieldIcons']) {
863 // override all settings with user TSconfig
864 if ($this->extAdminConfig
['override.'][$pre.'.'][$val] && $val) {
865 return $this->extAdminConfig
['override.'][$pre.'.'][$val];
867 if ($this->extAdminConfig
['override.'][$pre]) {
868 return $this->extAdminConfig
['override.'][$pre];
871 $retVal = $val ?
$this->uc
['TSFE_adminConfig'][$pre.'_'.$val] : 1;
873 if ($pre=='preview' && $this->ext_forcePreview
) {
882 if ($this->extIsAdmMenuOpen($pre)) { // See if the menu is expanded!
886 // Hook for post processing the frontend editing action.
887 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'])) {
888 $_params = array('cmd' => &$cmd, 'tce' => &$tce, 'pObj' => &$this);
889 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'] as $_funcRef) {
890 t3lib_div
::callUserFunction($_funcRef,$_params,$this);
897 * Returns true if admin panel module is open
899 * @param string Module key
900 * @return boolean True, if the admin panel is open for the specified admin panel module key.
902 function extIsAdmMenuOpen($pre) {
903 return $this->uc
['TSFE_adminConfig']['display_top'] && $this->uc
['TSFE_adminConfig']['display_'.$pre];
921 /*****************************************************
923 * TSFE BE user Access Functions
925 ****************************************************/
928 * Generates a list of Page-uid's from $id. List does not include $id itself
929 * The only pages excluded from the list are deleted pages.
931 * @param integer Start page id
932 * @param integer Depth to traverse down the page tree.
933 * @param integer $begin is an optional integer that determines at which level in the tree to start collecting uid's. Zero means 'start right away', 1 = 'next level and out'
934 * @param string Perms clause
935 * @return string Returns the list with a comma in the end (if any pages selected!)
937 function extGetTreeList($id,$depth,$begin=0,$perms_clause) {
938 $depth=intval($depth);
939 $begin=intval($begin);
943 if ($id && $depth>0) {
944 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
947 'pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND deleted=0 AND '.$perms_clause
949 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
951 $theList.= $row['uid'].',';
952 $this->extPageInTreeInfo
[]=array($row['uid'],$row['title'],$depth);
955 $theList.= $this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
963 * Returns the number of cached pages for a page id.
965 * @param integer The page id.
966 * @return integer The number of pages for this page in the table "cache_pages"
968 function extGetNumberOfCachedPages($page_id) {
969 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id='.intval($page_id));
970 list($num) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
994 /*****************************************************
996 * Localization handling
998 ****************************************************/
1001 * Returns the label for key, $key. If a translation for the language set in $this->uc['lang'] is found that is returned, otherwise the default value.
1002 * IF the global variable $LOCAL_LANG is NOT an array (yet) then this function loads the global $LOCAL_LANG array with the content of "sysext/lang/locallang_tsfe.php" so that the values therein can be used for labels in the Admin Panel
1004 * @param string Key for a label in the $LOCAL_LANG array of "sysext/lang/locallang_tsfe.php"
1005 * @return string The value for the $key
1007 function extGetLL($key) {
1009 if (!is_array($LOCAL_LANG)) {
1010 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
1011 #include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
1012 if (!is_array($LOCAL_LANG)) {
1013 $LOCAL_LANG = array();
1017 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key)); // Label string in the default backend output charset.
1019 // Convert to utf-8, then to entities:
1020 if ($GLOBALS['LANG']->charSet
!='utf-8') {
1021 $labelStr = $GLOBALS['LANG']->csConvObj
->utf8_encode($labelStr,$GLOBALS['LANG']->charSet
);
1023 $labelStr = $GLOBALS['LANG']->csConvObj
->utf8_to_entities($labelStr);
1025 // Return the result:
1041 /*****************************************************
1045 ****************************************************/
1048 * Returns true in an edit-action is sent from the Admin Panel
1053 function extIsEditAction() {
1054 if (is_array($this->TSFE_EDIT
)) {
1055 if ($this->TSFE_EDIT
['cancel']) {
1056 unset($this->TSFE_EDIT
['cmd']);
1058 $cmd = (string)$this->TSFE_EDIT
['cmd'];
1059 if (($cmd!='edit' ||
(is_array($this->TSFE_EDIT
['data']) && ($this->TSFE_EDIT
['update'] ||
$this->TSFE_EDIT
['update_close']))) && $cmd!='new') {
1060 // $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.
1069 * Returns true if an edit form is shown on the page.
1070 * Used from index_ts.php where a true return-value will result in classes etc. being included.
1075 function extIsFormShown() {
1076 if (is_array($this->TSFE_EDIT
)) {
1077 $cmd = (string)$this->TSFE_EDIT
['cmd'];
1078 if ($cmd=='edit' ||
$cmd=='new') {
1085 * Management of the on-page frontend editing forms and edit panels.
1086 * Basically taking in the data and commands and passes them on to the proper classes as they should be.
1091 function extEditAction() {
1092 global $TCA, $TYPO3_CONF_VARS;
1094 list($table,$uid) = explode(':',$this->TSFE_EDIT
['record']);
1095 if ($this->TSFE_EDIT
['cmd'] && $table && $uid && isset($TCA[$table])) {
1096 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
1097 $tce->stripslashes_values
=0;
1100 $cmd = $this->TSFE_EDIT
['cmd'];
1103 // extEditAction HOOK
1105 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
1107 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
1108 t3lib_div
::callUserFunction($_funcRef,$_params,$this);
1115 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
1117 $recData[$table][$uid][$hideField] = ($cmd=='hide' ?
1 : 0);
1118 $tce->start($recData,Array());
1119 $tce->process_datamap();
1124 $sortField = $TCA[$table]['ctrl']['sortby'];
1135 $fields = array_unique(t3lib_div
::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
1136 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',',$fields), $table, 'uid='.$uid);
1137 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1138 // record before or after
1139 $preview = $this->extGetFeAdminValue('preview');
1140 $copyAfterFieldsQuery = '';
1142 $ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);
1144 if ($TCA[$table]['ctrl']['copyAfterDuplFields']) {
1145 $cAFields = t3lib_div
::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
1146 while(list(,$fN)=each($cAFields)) {
1147 $copyAfterFieldsQuery.= ' AND '.$fN.'="'.$row[$fN].'"';
1151 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1154 'pid='.intval($row['pid']).
1155 ' AND '.$sortField.$op.intval($row[$sortField]).
1156 $copyAfterFieldsQuery.
1157 $GLOBALS['TSFE']->sys_page
->enableFields($table,'',$ignore),
1162 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1164 $cmdData[$table][$uid]['move'] = -$row2['uid'];
1165 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Must take the second record above...
1166 $cmdData[$table][$uid]['move'] = -$row3['uid'];
1167 } else { // ... and if that does not exist, use pid
1168 $cmdData[$table][$uid]['move'] = $row['pid'];
1170 } elseif ($cmd=='up') {
1171 $cmdData[$table][$uid]['move'] = $row['pid'];
1174 if (count($cmdData)) {
1175 $tce->start(Array(),$cmdData);
1176 $tce->process_cmdmap();
1181 $cmdData[$table][$uid]['delete'] = 1;
1182 if (count($cmdData)) {
1183 $tce->start(Array(),$cmdData);
1184 $tce->process_cmdmap();
1190 if (($this->TSFE_EDIT
['doSave'] ||
$this->TSFE_EDIT
['update'] ||
$this->TSFE_EDIT
['update_close']) && is_array($this->TSFE_EDIT
['data'])) {
1191 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
1192 $tce->stripslashes_values
= 0;
1193 $tce->start($this->TSFE_EDIT
['data'],Array());
1194 $tce->process_uploads($_FILES);
1195 $tce->process_datamap();
1201 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']) {
1202 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);