*** empty log message ***
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_tsfebeuserauth.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Class for TYPO3 backend user authentication in the TSFE frontend
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasper@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 103: class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth
42 * 129: function extInitFeAdmin()
43 * 149: function extPrintFeAdminDialog()
44 * 173: function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)
45 * 185: function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)
46 *
47 * SECTION: Creating sections of the Admin Panel
48 * 229: function extGetCategory_preview($out='')
49 * 260: function extGetCategory_cache($out='')
50 * 298: function extGetCategory_publish($out='')
51 * 333: function extGetCategory_edit($out='')
52 * 359: function extGetCategory_tsdebug($out='')
53 * 389: function extGetCategory_info($out='')
54 *
55 * SECTION: Admin Panel Layout Helper functions
56 * 462: function extGetHead($pre)
57 * 479: function extItemLink($pre,$str)
58 * 495: function extGetItem($pre,$element)
59 * 511: function extFw($str)
60 * 520: function ext_makeToolBar()
61 *
62 * SECTION: TSFE BE user Access Functions
63 * 575: function extPageReadAccess($pageRec)
64 * 586: function extAdmModuleEnabled($key)
65 * 602: function extSaveFeAdminConfig()
66 * 634: function extGetFeAdminValue($pre,$val='')
67 *
68 * SECTION: TSFE BE user Access Functions
69 * 692: function extGetTreeList($id,$depth,$begin=0,$perms_clause)
70 * 721: function extGetNumberOfCachedPages($page_id)
71 *
72 * SECTION: Localization handling
73 * 760: function extGetLL($key)
74 *
75 * SECTION: Frontend Editing
76 * 803: function extIsEditAction()
77 * 826: function extIsFormShown()
78 * 843: function extEditAction()
79 *
80 * TOTAL FUNCTIONS: 25
81 * (This index is automatically created/updated by the extension "extdeveval")
82 *
83 */
84
85
86
87
88
89
90
91
92
93
94
95 /**
96 * TYPO3 backend user authentication in the TSFE frontend.
97 * This includes mainly functions related to the Admin Panel
98 *
99 * @author Kasper Skaarhoj <kasper@typo3.com>
100 * @package TYPO3
101 * @subpackage t3lib
102 */
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.
111
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..
118
119
120
121
122 /**
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.
126 *
127 * @return void
128 */
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.'])) {
134 if ($v) {
135 $this->extAdmEnabled=1;
136 break;
137 }
138 }
139 }
140 }
141
142 /**
143 * Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
144 * Called from index_ts.php - in the end of the script
145 *
146 * @return string HTML for the Admin Panel
147 * @see index_ts.php
148 */
149 function extPrintFeAdminDialog() {
150 if ($this->uc['TSFE_adminConfig']['display_top']) {
151 if ($this->extAdmModuleEnabled('preview')) $out.= $this->extGetCategory_preview();
152 if ($this->extAdmModuleEnabled('cache')) $out.= $this->extGetCategory_cache();
153 if ($this->extAdmModuleEnabled('publish')) $out.= $this->extGetCategory_publish();
154 if ($this->extAdmModuleEnabled('edit')) $out.= $this->extGetCategory_edit();
155 if ($this->extAdmModuleEnabled('tsdebug')) $out.= $this->extGetCategory_tsdebug();
156 if ($this->extAdmModuleEnabled('info')) $out.= $this->extGetCategory_info();
157 }
158
159 $header.='<tr><td bgcolor="#9BA1A8" colspan="2" nowrap="nowrap">';
160 $header.=$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="" />'.
161 $this->extFw('<strong>'.$this->extGetLL('adminOptions').'</strong>')).$this->extFw(': '.$this->user['username']).
162 '</td><td bgcolor="#9BA1A8"><img src="clear.gif" width="10" height="1" alt="" /></td><td bgcolor="#9BA1A8"><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></tr>';
163
164 $out='<form name="TSFE_ADMIN_PANEL_FORM" action="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'#TSFE_ADMIN" method="post" style="margin: 0 0 0 0;"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#F6F2E6">'.$header.$out.'</table></form>';
165 $out='<a name="TSFE_ADMIN"></a><table border="0" cellpadding="1" cellspacing="0" bgcolor="black"><tr><td>'.$out.'</td></tr></table>';
166 if ($this->uc['TSFE_adminConfig']['display_top']) {
167 $out.='<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
168 $out.='
169 <script type="text/javascript">
170 /*<![CDATA[*/
171 var evalFunc = new evalFunc();
172 // TSFEtypo3FormFieldSet()
173 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) {
174 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
175 var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
176 if (checkbox && theValue==checkboxValue) {
177 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
178 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
179 } else {
180 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
181 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
182 }
183 }
184 // TSFEtypo3FormFieldGet()
185 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) {
186 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
187 if (checkbox_off) {
188 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
189 }else{
190 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
191 }
192 TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
193 }
194 /*]]>*/
195 </script>
196 <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
197 }
198 return "\n\n\n\n".$out.'<br />';
199 }
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 /*****************************************************
217 *
218 * Creating sections of the Admin Panel
219 *
220 ****************************************************/
221
222 /**
223 * Creates the content for the "preview" section ("module") of the Admin Panel
224 *
225 * @param string Optional start-value; The generated content is added to this variable.
226 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
227 * @see extPrintFeAdminDialog()
228 */
229 function extGetCategory_preview($out='') {
230 $out.=$this->extGetHead('preview');
231 if ($this->uc['TSFE_adminConfig']['display_preview']) {
232 $this->extNeedUpdate=1;
233 $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"':'').' />');
234 $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"':'').' />');
235
236 // Simulate data
237 $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'].'" />');
238 $this->extJSCODE.='TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 1,0);';
239
240 // Simulate fe_user:
241 $query = 'SELECT fe_groups.uid, fe_groups.title FROM fe_groups,pages WHERE pages.uid=fe_groups.pid AND NOT pages.deleted '.t3lib_BEfunc::deleteClause('fe_groups').' AND '.$this->getPagePermsClause(1);
242 $res = mysql(TYPO3_db, $query);
243 echo mysql_error();
244 $options='<option value="0"></option>';
245 while($row=mysql_fetch_assoc($res)) {
246 $options.='<option value="'.$row['uid'].'"'.($this->uc['TSFE_adminConfig']['preview_simulateUserGroup']==$row['uid']?' selected="selected"':'').'>'.htmlspecialchars('['.$row['uid'].'] '.$row['title']).'</option>';
247 }
248 $out.=$this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">'.$options.'</select>');
249 }
250 return $out;
251 }
252
253 /**
254 * Creates the content for the "cache" section ("module") of the Admin Panel
255 *
256 * @param string Optional start-value; The generated content is added to this variable.
257 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
258 * @see extPrintFeAdminDialog()
259 */
260 function extGetCategory_cache($out='') {
261 $out.=$this->extGetHead('cache');
262 if ($this->uc['TSFE_adminConfig']['display_cache']) {
263 $this->extNeedUpdate=1;
264 $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"':'').' />');
265
266 $options='';
267 $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
268 $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
269 $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['cache_clearCacheLevels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
270 $out.=$this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">'.$options.'</select>'.
271 '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
272
273 // Generating tree:
274 $depth=$this->extGetFeAdminValue('cache','clearCacheLevels');
275 $outTable='';
276 $this->extPageInTreeInfo=array();
277 $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
278 $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
279 reset($this->extPageInTreeInfo);
280 while(list(,$row)=each($this->extPageInTreeInfo)) {
281 $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>';
282 }
283 $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
284 $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="'.$this->extGetLL('cache_doit').'" />';
285 $out.=$this->extGetItem('cache_cacheEntries', $outTable);
286
287 }
288 return $out;
289 }
290
291 /**
292 * Creates the content for the "publish" section ("module") of the Admin Panel
293 *
294 * @param string Optional start-value; The generated content is added to this variable.
295 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
296 * @see extPrintFeAdminDialog()
297 */
298 function extGetCategory_publish($out='') {
299 $out.=$this->extGetHead('publish');
300 if ($this->uc['TSFE_adminConfig']['display_publish']) {
301 $this->extNeedUpdate=1;
302 $options='';
303 $options.='<option value="0"'.($this->uc['TSFE_adminConfig']['publish_levels']==0?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_0').'</option>';
304 $options.='<option value="1"'.($this->uc['TSFE_adminConfig']['publish_levels']==1?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_1').'</option>';
305 $options.='<option value="2"'.($this->uc['TSFE_adminConfig']['publish_levels']==2?' selected="selected"':'').'>'.$this->extGetLL('div_Levels_2').'</option>';
306 $out.=$this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">'.$options.'</select>'.
307 '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="'.$GLOBALS['TSFE']->id.'" /><input type="submit" value="'.$this->extGetLL('update').'" />');
308
309 // Generating tree:
310 $depth=$this->extGetFeAdminValue('publish','levels');
311 $outTable='';
312 $this->extPageInTreeInfo=array();
313 $this->extPageInTreeInfo[]=array($GLOBALS['TSFE']->page['uid'],$GLOBALS['TSFE']->page['title'],$depth+1);
314 $this->extGetTreeList($GLOBALS['TSFE']->id, $depth,0,$this->getPagePermsClause(1));
315 reset($this->extPageInTreeInfo);
316 while(list(,$row)=each($this->extPageInTreeInfo)) {
317 $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>';
318 }
319 $outTable='<br /><table border="0" cellpadding="0" cellspacing="0">'.$outTable.'</table>';
320 $outTable.='<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="'.$this->extGetLL('publish_doit').'" />';
321 $out.=$this->extGetItem('publish_tree', $outTable);
322 }
323 return $out;
324 }
325
326 /**
327 * Creates the content for the "edit" section ("module") of the Admin Panel
328 *
329 * @param string Optional start-value; The generated content is added to this variable.
330 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
331 * @see extPrintFeAdminDialog()
332 */
333 function extGetCategory_edit($out='') {
334 $out.=$this->extGetHead('edit');
335 if ($this->uc['TSFE_adminConfig']['display_edit']) {
336 $this->extNeedUpdate=1;
337 $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"':'').' />');
338 $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"':'').' />');
339 $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"':'').' />');
340 $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"':'').' />');
341
342 $out.=$this->extGetItem('', $this->ext_makeToolBar());
343 if (!t3lib_div::GPvar('ADMCMD_view')) {
344 $out.=$this->extGetItem('', '<a href="#" onclick="'.
345 htmlspecialchars('vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');vHWin.focus();return false;').
346 '">'.$this->extFw($this->extGetLL('edit_openAB')).'</a>');
347 }
348 }
349 return $out;
350 }
351
352 /**
353 * Creates the content for the "tsdebug" section ("module") of the Admin Panel
354 *
355 * @param string Optional start-value; The generated content is added to this variable.
356 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
357 * @see extPrintFeAdminDialog()
358 */
359 function extGetCategory_tsdebug($out='') {
360 $out.=$this->extGetHead('tsdebug');
361 if ($this->uc['TSFE_adminConfig']['display_tsdebug']) {
362 $this->extNeedUpdate=1;
363 $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"':'').' />');
364 $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"':'').' />');
365 $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"':'').' />');
366 $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"':'').' />');
367 $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"':'').' />');
368 $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"':'').' />');
369
370 $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"':'').' />');
371
372 $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug','tree');
373 $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug','displayTimes');
374 $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug','displayMessages');
375 $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug','displayContent');
376 $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug','displayQueries');
377 $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$GLOBALS['TT']->printTSlog().'</td></tr>';
378 }
379 return $out;
380 }
381
382 /**
383 * Creates the content for the "info" section ("module") of the Admin Panel
384 *
385 * @param string Optional start-value; The generated content is added to this variable.
386 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
387 * @see extPrintFeAdminDialog()
388 */
389 function extGetCategory_info($out='') {
390 $out.=$this->extGetHead('info');
391 if ($this->uc['TSFE_adminConfig']['display_info']) {
392
393 if (is_array($GLOBALS['TSFE']->imagesOnPage) && $this->extGetFeAdminValue('cache','noCache')) {
394 reset($GLOBALS['TSFE']->imagesOnPage);
395 $theBytes=0;
396 $count=0;
397 $fileTable='';
398 while(list(,$file)=each($GLOBALS['TSFE']->imagesOnPage)) {
399 $fs=@filesize($file);
400 $fileTable.='<tr><td>'.$this->extFw($file).'</td><td align="right">'.$this->extFw(t3lib_div::formatSize($fs)).'</td></tr>';
401 $theBytes+=$fs;
402 $count++;
403 }
404 $fileTable.='<tr><td><strong>'.$this->extFw('Total number of images:').'</strong></td><td>'.$this->extFw($count).'</td></tr>';
405 $fileTable.='<tr><td><strong>'.$this->extFw('Total image file sizes:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize($theBytes)).'</td></tr>';
406 $fileTable.='<tr><td><strong>'.$this->extFw('Document size:').'</strong></td><td align="right">'.$this->extFw(t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content))).'</td></tr>';
407 $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>';
408 $fileTable.='<tr><td>&nbsp;</td></tr>';
409 }
410
411 $fileTable.='<tr><td>'.$this->extFw('id:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->id).'</td></tr>';
412 $fileTable.='<tr><td>'.$this->extFw('type:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->type).'</td></tr>';
413 $fileTable.='<tr><td>'.$this->extFw('gr_list:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->gr_list).'</td></tr>';
414 $fileTable.='<tr><td>'.$this->extFw('no_cache:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->no_cache).'</td></tr>';
415 $fileTable.='<tr><td>'.$this->extFw('fe_user, name:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['username']).'</td></tr>';
416 $fileTable.='<tr><td>'.$this->extFw('fe_user, uid:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->fe_user->user['uid']).'</td></tr>';
417 $fileTable.='<tr><td>&nbsp;</td></tr>';
418
419 // parsetime:
420 $fileTable.='<tr><td>'.$this->extFw('Total parsetime:').'</td><td>'.$this->extFw($GLOBALS['TSFE']->scriptParseTime.' ms').'</td></tr>';
421
422 $fileTable='<table border="0" cellpadding="0" cellspacing="0">'.$fileTable.'</table>';
423
424 $out.='<tr><td><img src="clear.gif" width="50" height="1" alt="" /></td><td colspan="3">'.$fileTable.'</td></tr>';
425 }
426 return $out;
427 }
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446 /*****************************************************
447 *
448 * Admin Panel Layout Helper functions
449 *
450 ****************************************************/
451
452 /**
453 * Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
454 * 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
455 * See the functions extGetCategory_*
456 *
457 * @param string The suffix to the display_ label. Also selects the label from the LOCAL_LANG array.
458 * @return string HTML table row.
459 * @access private
460 * @see extGetItem()
461 */
462 function extGetHead($pre) {
463 $out.='<img src="t3lib/gfx/ol/blank.gif" width="18" height="16" align="absmiddle" border="0" alt="" />';
464 $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="" />';
465 $out.=$this->extFw($this->extGetLL($pre));
466 $out=$this->extItemLink($pre,$out);
467 return '<tr><td bgcolor="#ABBBB4" colspan="4" nowrap="nowrap">'.$out.'<input type="hidden" name="TSFE_ADMIN_PANEL[display_'.$pre.']" value="'.$this->uc['TSFE_adminConfig']['display_'.$pre].'" /></td></tr>';
468 }
469
470 /**
471 * Wraps a string in a link which will open/close a certain part of the Admin Panel
472 *
473 * @param string The code for the display_ label/key
474 * @param string Input string
475 * @return string Linked input string
476 * @access private
477 * @see extGetHead()
478 */
479 function extItemLink($pre,$str) {
480 return '<a href="#" onclick="'.
481 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;').
482 '">'.$str.'</a>';
483 }
484
485 /**
486 * Returns a row (with 4 columns) for content in a section of the Admin Panel.
487 * It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
488 *
489 * @param string Key to label
490 * @param string The HTML content for the forth table cell.
491 * @return string HTML table row.
492 * @access private
493 * @see extGetHead()
494 */
495 function extGetItem($pre,$element) {
496 return '<tr>
497 <td><img src="clear.gif" width="50" height="1" alt="" /></td>
498 <td nowrap="nowrap">'.($pre ? $this->extFw($this->extGetLL($pre)) : '&nbsp;').'</td>
499 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
500 <td>'.$element.'</td>
501 </tr>';
502
503 }
504
505 /**
506 * Wraps a string in a font-tag with verdana, size 1 and black
507 *
508 * @param string The string to wrap
509 * @return string
510 */
511 function extFw($str) {
512 return '<font face="Verdana" size="1" color="black"'.($GLOBALS['CLIENT']['FORMSTYLE']?' style="color:black;"':'').'>'.$str.'</font>';
513 }
514
515 /**
516 * Creates the tool bar links for the "edit" section of the Admin Panel.
517 *
518 * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
519 */
520 function ext_makeToolBar() {
521 $toolBar='';
522 $id = $GLOBALS['TSFE']->id;
523 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'show_rechis.php?element='.rawurlencode('pages:'.$id).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'#latest">'.
524 '<img src="t3lib/gfx/history2.gif" width="13" height="12" hspace="2" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_recordHistory'),1).' alt="" /></a>';
525 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new_content_el.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
526 '<img src="t3lib/gfx/new_record.gif" width="16" height="12" hspace="1" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_newContentElement'),1).' alt="" /></a>';
527 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'move_el.php?table=pages&uid='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
528 '<img src="t3lib/gfx/move_page.gif" width="11" height="12" hspace="2" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_move_page'),1).' alt="" /></a>';
529 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
530 '<img src="t3lib/gfx/new_page.gif" width="13" height="12" hspace="0" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_newPage'),1).' alt="" /></a>';
531
532 $params='&edit[pages]['.$id.']=edit';
533 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'alt_doc.php?'.$params.'&noView=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
534 '<img src="t3lib/gfx/edit2.gif" width="11" height="12" hspace="2" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_editPageHeader'),1).' alt="" /></a>';
535 if ($this->check('modules','web_list')) {
536 $toolBar.='<a href="'.htmlspecialchars(TYPO3_mainDir.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
537 '<img src="t3lib/gfx/list.gif" width="11" height="11" hspace="2" border="0" align="top"'.t3lib_BEfunc::titleAttrib($this->extGetLL('edit_db_list'),1).' alt="" /></a>';
538 }
539 return $toolBar;
540 }
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560 /*****************************************************
561 *
562 * TSFE BE user Access Functions
563 *
564 ****************************************************/
565
566 /**
567 * Evaluates if the Backend User has read access to the input page record.
568 * 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.
569 * Read access means that previewing is allowed etc.
570 * Used in index_ts.php
571 *
572 * @param array The page record to evaluate for
573 * @return boolean True if read access
574 */
575 function extPageReadAccess($pageRec) {
576 return $this->isInWebMount($pageRec['uid']) && $this->doesUserHaveAccess($pageRec,1);
577 }
578
579 /**
580 * Checks if a Admin Panel section ("module") is available for the user. If so, true is returned.
581 *
582 * @param string The module key, eg. "edit", "preview", "info" etc.
583 * @return boolean
584 * @see extPrintFeAdminDialog()
585 */
586 function extAdmModuleEnabled($key) {
587 // Returns true if the module checked is "preview" and the forcePreview flag is set.
588 if ($key=="preview" && $this->ext_forcePreview) return true;
589 // If key is not set, only "all" is checked
590 if ($this->extAdminConfig['enable.']['all']) return true;
591 if ($this->extAdminConfig['enable.'][$key]) {
592 return true;
593 }
594 }
595
596 /**
597 * Saves any change in settings made in the Admin Panel.
598 * Called from index_ts.php right after access check for the Admin Panel
599 *
600 * @return void
601 */
602 function extSaveFeAdminConfig() {
603 if (is_array($GLOBALS['HTTP_POST_VARS']['TSFE_ADMIN_PANEL'])) {
604 // Setting
605 $input = $GLOBALS['HTTP_POST_VARS']['TSFE_ADMIN_PANEL'];
606 $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...
607 unset($this->uc['TSFE_adminConfig']['action']);
608
609 // Actions:
610 if ($input['action']['clearCache'] && $this->extAdmModuleEnabled('cache')) {
611 $this->extPageInTreeInfo=array();
612 $theStartId = intval($input['cache_clearCacheId']);
613 $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache','clearCacheLevels'),0,$this->getPagePermsClause(1)).$theStartId);
614 }
615 if ($input['action']['publish'] && $this->extAdmModuleEnabled('publish')) {
616 $theStartId = intval($input['publish_id']);
617 $this->extPublishList = $this->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish','levels'),0,$this->getPagePermsClause(1)).$theStartId;
618 }
619
620 // Saving
621 $this->writeUC();
622 }
623 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug','LR');
624 if ($this->extGetFeAdminValue('cache','noCache')) {$GLOBALS['TSFE']->set_no_cache();}
625 }
626
627 /**
628 * Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
629 *
630 * @param string Module key
631 * @param string Setting key
632 * @return string The setting value
633 */
634 function extGetFeAdminValue($pre,$val='') {
635 if ($this->extAdmModuleEnabled($pre)) { // Check if module is enabled.
636 // Exceptions where the values can be overridden from backend:
637 if ($pre.'_'.$val == 'edit_displayIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
638 return true;
639 }
640 if ($pre.'_'.$val == 'edit_displayFieldIcons' && $this->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) {
641 return true;
642 }
643
644 $retVal = $val ? $this->uc['TSFE_adminConfig'][$pre.'_'.$val] : 1;
645
646 if ($pre=='preview' && $this->ext_forcePreview) {
647 if (!$val) {
648 return true;
649 } else {
650 return $retVal;
651 }
652 }
653
654 // regular check:
655 if ($this->uc['TSFE_adminConfig']['display_top'] && $this->uc['TSFE_adminConfig']['display_'.$pre]) { // See if the menu is expanded!
656 return $retVal;
657 }
658 }
659 }
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676 /*****************************************************
677 *
678 * TSFE BE user Access Functions
679 *
680 ****************************************************/
681
682 /**
683 * Generates a list of Page-uid's from $id. List does not include $id itself
684 * The only pages excluded from the list are deleted pages.
685 *
686 * @param integer Start page id
687 * @param integer Depth
688 * @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'
689 * @param string Perms clause
690 * @return string Returns the list with a comma in the end (if any pages selected!)
691 */
692 function extGetTreeList($id,$depth,$begin=0,$perms_clause) {
693 $depth=intval($depth);
694 $begin=intval($begin);
695 $id=intval($id);
696 $theList='';
697
698 if ($id && $depth>0) {
699 $query = 'SELECT uid,title FROM pages WHERE pid='.$id.' AND doktype IN ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].') AND NOT deleted AND '.$perms_clause;
700 $res = mysql(TYPO3_db, $query);
701 echo mysql_error();
702 while ($row = mysql_fetch_assoc($res)) {
703 if ($begin<=0) {
704 $theList.=$row['uid'].',';
705 $this->extPageInTreeInfo[]=array($row['uid'],$row['title'],$depth);
706 }
707 if ($depth>1) {
708 $theList.=$this->extGetTreeList($row['uid'], $depth-1,$begin-1,$perms_clause);
709 }
710 }
711 }
712 return $theList;
713 }
714
715 /**
716 * Returns the number of cached pages for a page id.
717 *
718 * @param integer The page id.
719 * @return integer The number of pages for this page in the table "cache_pages"
720 */
721 function extGetNumberOfCachedPages($page_id) {
722 $res = mysql (TYPO3_db, 'SELECT count(*) FROM cache_pages WHERE page_id='.intval($page_id));
723 list($num) = mysql_fetch_row($res);
724 return $num;
725 }
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747 /*****************************************************
748 *
749 * Localization handling
750 *
751 ****************************************************/
752
753 /**
754 * 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.
755 * 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
756 *
757 * @param string Key for a label in the $LOCAL_LANG array of "sysext/lang/locallang_tsfe.php"
758 * @return string The value for the $key
759 */
760 function extGetLL($key) {
761 global $LOCAL_LANG;
762 if (!is_array($LOCAL_LANG)) {
763 include('./'.TYPO3_mainDir.'sysext/lang/locallang_tsfe.php');
764 if (!is_array($LOCAL_LANG)) $LOCAL_LANG=array();
765 }
766
767 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key)); // Label string in the default backend output charset.
768
769 // Convert to utf-8, then to entities:
770 if ($GLOBALS['LANG']->charSet!='utf-8') {
771 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
772 }
773 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
774
775 // Return the result:
776 return $labelStr;
777 }
778
779
780
781
782
783
784
785
786
787
788
789
790
791 /*****************************************************
792 *
793 * Frontend Editing
794 *
795 ****************************************************/
796
797 /**
798 * Returns true in an edit-action is sent from the Admin Panel
799 *
800 * @return boolean
801 * @see index_ts.php
802 */
803 function extIsEditAction() {
804 $TSFE_EDIT = $GLOBALS['HTTP_POST_VARS']['TSFE_EDIT'];
805 if (is_array($TSFE_EDIT)) {
806 /* $cmd=(string)$TSFE_EDIT['cmd'];
807 if ($cmd!="edit" && $cmd!='new') {
808 return true;
809 }*/
810 if ($TSFE_EDIT['cancel']) {
811 unset($TSFE_EDIT['cmd']);
812 } elseif (($cmd!='edit' || (is_array($TSFE_EDIT['data']) && ($TSFE_EDIT['update'] || $TSFE_EDIT['update_close']))) && $cmd!='new') {
813 // $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.
814 return true;
815 }
816 }
817 }
818
819 /**
820 * Returns true if an edit form is shown on the page.
821 * Used from index_ts.php where a true return-value will result in classes etc. being included.
822 *
823 * @return boolean
824 * @see index_ts.php
825 */
826 function extIsFormShown() {
827 $TSFE_EDIT = $GLOBALS['HTTP_POST_VARS']['TSFE_EDIT'];
828 if (is_array($TSFE_EDIT)) {
829 $cmd=(string)$TSFE_EDIT['cmd'];
830 if ($cmd=='edit' || $cmd=='new') {
831 return true;
832 }
833 }
834 }
835
836 /**
837 * Management of the on-page frontend editing forms and edit panels.
838 * Basically taking in the data and commands and passes them on to the proper classes as they should be.
839 *
840 * @return void
841 * @see index_ts.php
842 */
843 function extEditAction() {
844 global $TCA;
845 // Commands:
846 $TSFE_EDIT = $GLOBALS['HTTP_POST_VARS']['TSFE_EDIT'];
847
848 list($table,$uid) = explode(':',$TSFE_EDIT['record']);
849 if ($TSFE_EDIT['cmd'] && $table && $uid && isset($TCA[$table])) {
850 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
851 $recData=array();
852 $cmdData=array();
853 $cmd=$TSFE_EDIT['cmd'];
854 switch($cmd) {
855 case 'hide':
856 case 'unhide':
857 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
858 if ($hideField) {
859 $recData[$table][$uid][$hideField]=($cmd=='hide'?1:0);
860 $tce->start($recData,Array());
861 $tce->process_datamap();
862 }
863 break;
864 case 'up':
865 case 'down':
866 $sortField = $TCA[$table]['ctrl']['sortby'];
867 if ($sortField) {
868 if ($cmd=='up') {
869 $op= '<';
870 $desc=' DESC';
871 } else {
872 $op= '>';
873 $desc='';
874 }
875 // Get self:
876 $fields = array_unique(t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'].',uid,pid,'.$sortField,1));
877 $query='SELECT '.implode(',',$fields).' FROM '.$table.' WHERE uid='.$uid;
878 $res = mysql(TYPO3_db,$query);
879 if ($row=mysql_fetch_assoc($res)) {
880 // record before or after
881 $preview = $this->extGetFeAdminValue('preview');
882 $copyAfterFieldsQuery = '';
883 if ($preview) {$ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);}
884 if ($TCA[$table]['ctrl']['copyAfterDuplFields']) {
885 $cAFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['copyAfterDuplFields'],1);
886 while(list(,$fN)=each($cAFields)) {
887 $copyAfterFieldsQuery.=' AND '.$fN.'="'.$row[$fN].'"';
888 }
889 }
890
891 $query='SELECT uid,pid FROM '.$table.' WHERE pid='.$row['pid'].
892 ' AND '.$sortField.$op.intval($row[$sortField]).
893 $copyAfterFieldsQuery.
894 t3lib_pageSelect::enableFields($table,'',$ignore).
895 ' ORDER BY '.$sortField.$desc.
896 ' LIMIT 2';
897
898 $res = mysql(TYPO3_db,$query);
899 if ($row2=mysql_fetch_assoc($res)) {
900 if($cmd=='down') {
901 $cmdData[$table][$uid]['move']= -$row2['uid'];
902 } elseif ($row3=mysql_fetch_assoc($res)) { // Must take the second record above...
903 $cmdData[$table][$uid]['move']= -$row3['uid'];
904 } else { // ... and if that does not exist, use pid
905 $cmdData[$table][$uid]['move']= $row['pid'];
906 }
907 } elseif ($cmd=='up') {
908 $cmdData[$table][$uid]['move']= $row['pid'];
909 }
910 }
911 if (count($cmdData)) {
912 $tce->start(Array(),$cmdData);
913 $tce->process_cmdmap();
914 }
915 }
916 break;
917 case 'delete':
918 $cmdData[$table][$uid]['delete']= 1;
919 if (count($cmdData)) {
920 $tce->start(Array(),$cmdData);
921 $tce->process_cmdmap();
922 }
923 break;
924 }
925 }
926 // Data:
927 if (($TSFE_EDIT['doSave'] || $TSFE_EDIT['update'] || $TSFE_EDIT['update_close']) && is_array($TSFE_EDIT['data'])) {
928 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
929 # $tce->stripslashes_values=0; // This line is NOT needed because $TSFE_EDIT['data'] is already slashed and needs slashes stripped.
930 $tce->start($TSFE_EDIT['data'],Array());
931 $tce->process_uploads($GLOBALS['HTTP_POST_FILES']);
932 $tce->process_datamap();
933 }
934 }
935 }
936
937
938 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']) {
939 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsfebeuserauth.php']);
940 }
941 ?>