[TASK] Fix TYPO3.ControlStructures.DisallowEachInLoopCondition
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Database / QueryGenerator.php
1 <?php
2 namespace TYPO3\CMS\Core\Database;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2001-2011 Christian Jul Jensen (christian@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * Class for generating front end for building queries
31 *
32 * @author Christian Jul Jensen <christian@typo3.com>
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 * @coauthor Jo Hasenau <info@cybercraft.de>
35 */
36 /**
37 * Class for generating front end for building queries
38 *
39 * @author Christian Jul Jensen <christian@typo3.com>
40 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
41 * @package TYPO3
42 * @subpackage t3lib
43 */
44 class QueryGenerator {
45
46 /**
47 * @todo Define visibility
48 */
49 public $lang = array(
50 'OR' => 'or',
51 'AND' => 'and',
52 'comparison' => array(
53 // Type = text offset = 0
54 '0_' => 'contains',
55 '1_' => 'does not contain',
56 '2_' => 'starts with',
57 '3_' => 'does not start with',
58 '4_' => 'ends with',
59 '5_' => 'does not end with',
60 '6_' => 'equals',
61 '7_' => 'does not equal',
62 // Type = number , offset = 32
63 '32_' => 'equals',
64 '33_' => 'does not equal',
65 '34_' => 'is greater than',
66 '35_' => 'is less than',
67 '36_' => 'is between',
68 '37_' => 'is not between',
69 '38_' => 'is in list',
70 '39_' => 'is not in list',
71 '40_' => 'binary AND equals',
72 '41_' => 'binary AND does not equal',
73 '42_' => 'binary OR equals',
74 '43_' => 'binary OR does not equal',
75 // Type = multiple, relation, files , offset = 64
76 '64_' => 'equals',
77 '65_' => 'does not equal',
78 '66_' => 'contains',
79 '67_' => 'does not contain',
80 '68_' => 'is in list',
81 '69_' => 'is not in list',
82 '70_' => 'binary AND equals',
83 '71_' => 'binary AND does not equal',
84 '72_' => 'binary OR equals',
85 '73_' => 'binary OR does not equal',
86 // Type = date,time offset = 96
87 '96_' => 'equals',
88 '97_' => 'does not equal',
89 '98_' => 'is greater than',
90 '99_' => 'is less than',
91 '100_' => 'is between',
92 '101_' => 'is not between',
93 '102_' => 'binary AND equals',
94 '103_' => 'binary AND does not equal',
95 '104_' => 'binary OR equals',
96 '105_' => 'binary OR does not equal',
97 // Type = boolean, offset = 128
98 '128_' => 'is True',
99 '129_' => 'is False',
100 // Type = binary , offset = 160
101 '160_' => 'equals',
102 '161_' => 'does not equal',
103 '162_' => 'contains',
104 '163_' => 'does not contain'
105 )
106 );
107
108 /**
109 * @todo Define visibility
110 */
111 public $compSQL = array(
112 // Type = text offset = 0
113 '0' => '#FIELD# LIKE \'%#VALUE#%\'',
114 '1' => '#FIELD# NOT LIKE \'%#VALUE#%\'',
115 '2' => '#FIELD# LIKE \'#VALUE#%\'',
116 '3' => '#FIELD# NOT LIKE \'#VALUE#%\'',
117 '4' => '#FIELD# LIKE \'%#VALUE#\'',
118 '5' => '#FIELD# NOT LIKE \'%#VALUE#\'',
119 '6' => '#FIELD# = \'#VALUE#\'',
120 '7' => '#FIELD# != \'#VALUE#\'',
121 // Type = number, offset = 32
122 '32' => '#FIELD# = \'#VALUE#\'',
123 '33' => '#FIELD# != \'#VALUE#\'',
124 '34' => '#FIELD# > #VALUE#',
125 '35' => '#FIELD# < #VALUE#',
126 '36' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
127 '37' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
128 '38' => '#FIELD# IN (#VALUE#)',
129 '39' => '#FIELD# NOT IN (#VALUE#)',
130 '40' => '(#FIELD# & #VALUE#)=#VALUE#',
131 '41' => '(#FIELD# & #VALUE#)!=#VALUE#',
132 '42' => '(#FIELD# | #VALUE#)=#VALUE#',
133 '43' => '(#FIELD# | #VALUE#)!=#VALUE#',
134 // Type = multiple, relation, files , offset = 64
135 '64' => '#FIELD# = \'#VALUE#\'',
136 '65' => '#FIELD# != \'#VALUE#\'',
137 '66' => '#FIELD# LIKE \'%#VALUE#%\' AND #FIELD# LIKE \'%#VALUE1#%\'',
138 '67' => '(#FIELD# NOT LIKE \'%#VALUE#%\' OR #FIELD# NOT LIKE \'%#VALUE1#%\')',
139 '68' => '#FIELD# IN (#VALUE#)',
140 '69' => '#FIELD# NOT IN (#VALUE#)',
141 '70' => '(#FIELD# & #VALUE#)=#VALUE#',
142 '71' => '(#FIELD# & #VALUE#)!=#VALUE#',
143 '72' => '(#FIELD# | #VALUE#)=#VALUE#',
144 '73' => '(#FIELD# | #VALUE#)!=#VALUE#',
145 // Type = date, offset = 32
146 '96' => '#FIELD# = \'#VALUE#\'',
147 '97' => '#FIELD# != \'#VALUE#\'',
148 '98' => '#FIELD# > #VALUE#',
149 '99' => '#FIELD# < #VALUE#',
150 '100' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
151 '101' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
152 '102' => '(#FIELD# & #VALUE#)=#VALUE#',
153 '103' => '(#FIELD# & #VALUE#)!=#VALUE#',
154 '104' => '(#FIELD# | #VALUE#)=#VALUE#',
155 '105' => '(#FIELD# | #VALUE#)!=#VALUE#',
156 // Type = boolean, offset = 128
157 '128' => '#FIELD# = \'1\'',
158 '129' => '#FIELD# != \'1\'',
159 // Type = binary = 160
160 '160' => '#FIELD# = \'#VALUE#\'',
161 '161' => '#FIELD# != \'#VALUE#\'',
162 '162' => '(#FIELD# & #VALUE#)=#VALUE#',
163 '163' => '(#FIELD# & #VALUE#)=0'
164 );
165
166 /**
167 * @todo Define visibility
168 */
169 public $comp_offsets = array(
170 'text' => 0,
171 'number' => 1,
172 'multiple' => 2,
173 'relation' => 2,
174 'files' => 2,
175 'date' => 3,
176 'time' => 3,
177 'boolean' => 4,
178 'binary' => 5
179 );
180
181 /**
182 * @todo Define visibility
183 */
184 public $noWrap = ' nowrap';
185
186 // Form data name prefix
187 /**
188 * @todo Define visibility
189 */
190 public $name;
191
192 // Table for the query
193 /**
194 * @todo Define visibility
195 */
196 public $table;
197
198 // Field list
199 /**
200 * @todo Define visibility
201 */
202 public $fieldList;
203
204 // Array of the fields possible
205 /**
206 * @todo Define visibility
207 */
208 public $fields = array();
209
210 /**
211 * @todo Define visibility
212 */
213 public $extFieldLists = array();
214
215 // The query config
216 /**
217 * @todo Define visibility
218 */
219 public $queryConfig = array();
220
221 /**
222 * @todo Define visibility
223 */
224 public $enablePrefix = 0;
225
226 /**
227 * @todo Define visibility
228 */
229 public $enableQueryParts = 0;
230
231 /**
232 * @todo Define visibility
233 */
234 public $extJSCODE = '';
235
236 protected $formName = '';
237
238 /**
239 * Make a list of fields for current table
240 *
241 * @return string Separated list of fields
242 * @todo Define visibility
243 */
244 public function makeFieldList() {
245 $fieldListArr = array();
246 if (is_array($GLOBALS['TCA'][$this->table])) {
247 \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($this->table);
248 foreach ($GLOBALS['TCA'][$this->table]['columns'] as $fN => $value) {
249 $fieldListArr[] = $fN;
250 }
251 $fieldListArr[] = 'uid';
252 $fieldListArr[] = 'pid';
253 $fieldListArr[] = 'deleted';
254 if ($GLOBALS['TCA'][$this->table]['ctrl']['tstamp']) {
255 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['tstamp'];
256 }
257 if ($GLOBALS['TCA'][$this->table]['ctrl']['crdate']) {
258 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['crdate'];
259 }
260 if ($GLOBALS['TCA'][$this->table]['ctrl']['cruser_id']) {
261 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['cruser_id'];
262 }
263 if ($GLOBALS['TCA'][$this->table]['ctrl']['sortby']) {
264 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['sortby'];
265 }
266 }
267 return implode(',', $fieldListArr);
268 }
269
270 /**
271 * [Describe function...]
272 *
273 * @param [type] $name: ...
274 * @param [type] $table: ...
275 * @param [type] $fieldList: ...
276 * @return [type] ...
277 * @todo Define visibility
278 */
279 public function init($name, $table, $fieldList = '') {
280 // Analysing the fields in the table.
281 if (is_array($GLOBALS['TCA'][$table])) {
282 \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
283 $this->name = $name;
284 $this->table = $table;
285 $this->fieldList = $fieldList ? $fieldList : $this->makeFieldList();
286 $fieldArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->fieldList, 1);
287 foreach ($fieldArr as $fN) {
288 $fC = $GLOBALS['TCA'][$this->table]['columns'][$fN];
289 $this->fields[$fN] = $fC['config'];
290 $this->fields[$fN]['exclude'] = $fC['exclude'];
291 if (is_array($fC) && $fC['label']) {
292 $this->fields[$fN]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':');
293 switch ($this->fields[$fN]['type']) {
294 case 'input':
295 if (preg_match('/int|year/i', $this->fields[$fN]['eval'])) {
296 $this->fields[$fN]['type'] = 'number';
297 } elseif (preg_match('/time/i', $this->fields[$fN]['eval'])) {
298 $this->fields[$fN]['type'] = 'time';
299 } elseif (preg_match('/date/i', $this->fields[$fN]['eval'])) {
300 $this->fields[$fN]['type'] = 'date';
301 } else {
302 $this->fields[$fN]['type'] = 'text';
303 }
304 break;
305 case 'check':
306 if (!$this->fields[$fN]['items']) {
307 $this->fields[$fN]['type'] = 'boolean';
308 } else {
309 $this->fields[$fN]['type'] = 'binary';
310 }
311 break;
312 case 'radio':
313 $this->fields[$fN]['type'] = 'multiple';
314 break;
315 case 'select':
316 $this->fields[$fN]['type'] = 'multiple';
317 if ($this->fields[$fN]['foreign_table']) {
318 $this->fields[$fN]['type'] = 'relation';
319 }
320 if ($this->fields[$fN]['special']) {
321 $this->fields[$fN]['type'] = 'text';
322 }
323 break;
324 case 'group':
325 $this->fields[$fN]['type'] = 'files';
326 if ($this->fields[$fN]['internal_type'] == 'db') {
327 $this->fields[$fN]['type'] = 'relation';
328 }
329 break;
330 case 'user':
331
332 case 'flex':
333
334 case 'passthrough':
335
336 case 'none':
337
338 case 'text':
339
340 default:
341 $this->fields[$fN]['type'] = 'text';
342 break;
343 }
344 } else {
345 $this->fields[$fN]['label'] = '[FIELD: ' . $fN . ']';
346 switch ($fN) {
347 case 'pid':
348 $this->fields[$fN]['type'] = 'relation';
349 $this->fields[$fN]['allowed'] = 'pages';
350 break;
351 case 'cruser_id':
352 $this->fields[$fN]['type'] = 'relation';
353 $this->fields[$fN]['allowed'] = 'be_users';
354 break;
355 case 'tstamp':
356
357 case 'crdate':
358 $this->fields[$fN]['type'] = 'time';
359 break;
360 case 'deleted':
361 $this->fields[$fN]['type'] = 'boolean';
362 break;
363 default:
364 $this->fields[$fN]['type'] = 'number';
365 break;
366 }
367 }
368 }
369 }
370 /* // EXAMPLE:
371 $this->queryConfig = array(
372 array(
373 'operator' => 'AND',
374 'type' => 'FIELD_spaceBefore',
375 ),
376 array(
377 'operator' => 'AND',
378 'type' => 'FIELD_records',
379 'negate' => 1,
380 'inputValue' => 'foo foo'
381 ),
382 array(
383 'type' => 'newlevel',
384 'nl' => array(
385 array(
386 'operator' => 'AND',
387 'type' => 'FIELD_spaceBefore',
388 'negate' => 1,
389 'inputValue' => 'foo foo'
390 ),
391 array(
392 'operator' => 'AND',
393 'type' => 'FIELD_records',
394 'negate' => 1,
395 'inputValue' => 'foo foo'
396 )
397 )
398 ),
399 array(
400 'operator' => 'OR',
401 'type' => 'FIELD_maillist',
402 )
403 );
404 */
405 $this->initUserDef();
406 }
407
408 /**
409 * [Describe function...]
410 *
411 * @param [type] $name: ...
412 * @param [type] $list: ...
413 * @param [type] $force: ...
414 * @return [type] ...
415 * @todo Define visibility
416 */
417 public function setAndCleanUpExternalLists($name, $list, $force = '') {
418 $fields = array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $list . ',' . $force, 1));
419 $reList = array();
420 foreach ($fields as $fN) {
421 if ($this->fields[$fN]) {
422 $reList[] = $fN;
423 }
424 }
425 $this->extFieldLists[$name] = implode(',', $reList);
426 }
427
428 /**
429 * [Describe function...]
430 *
431 * @param [type] $qC: ...
432 * @return [type] ...
433 * @todo Define visibility
434 */
435 public function procesData($qC = '') {
436 $this->queryConfig = $qC;
437 $POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
438 // If delete...
439 if ($POST['qG_del']) {
440 // Initialize array to work on, save special parameters
441 $ssArr = $this->getSubscript($POST['qG_del']);
442 $workArr =& $this->queryConfig;
443 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
444 $workArr =& $workArr[$ssArr[$i]];
445 }
446 // Delete the entry and move the other entries
447 unset($workArr[$ssArr[$i]]);
448 for ($j = $ssArr[$i]; $j < sizeof($workArr); $j++) {
449 $workArr[$j] = $workArr[$j + 1];
450 unset($workArr[$j + 1]);
451 }
452 }
453 // If insert...
454 if ($POST['qG_ins']) {
455 // Initialize array to work on, save special parameters
456 $ssArr = $this->getSubscript($POST['qG_ins']);
457 $workArr =& $this->queryConfig;
458 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
459 $workArr =& $workArr[$ssArr[$i]];
460 }
461 // Move all entries above position where new entry is to be inserted
462 for ($j = sizeof($workArr); $j > $ssArr[$i]; $j--) {
463 $workArr[$j] = $workArr[$j - 1];
464 }
465 // Clear new entry position
466 unset($workArr[$ssArr[$i] + 1]);
467 $workArr[$ssArr[$i] + 1]['type'] = 'FIELD_';
468 }
469 // If move up...
470 if ($POST['qG_up']) {
471 // Initialize array to work on
472 $ssArr = $this->getSubscript($POST['qG_up']);
473 $workArr =& $this->queryConfig;
474 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
475 $workArr =& $workArr[$ssArr[$i]];
476 }
477 // Swap entries
478 $qG_tmp = $workArr[$ssArr[$i]];
479 $workArr[$ssArr[$i]] = $workArr[$ssArr[$i] - 1];
480 $workArr[$ssArr[$i] - 1] = $qG_tmp;
481 }
482 // If new level...
483 if ($POST['qG_nl']) {
484 // Initialize array to work on
485 $ssArr = $this->getSubscript($POST['qG_nl']);
486 $workArr =& $this->queryConfig;
487 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
488 $workArr =& $workArr[$ssArr[$i]];
489 }
490 // Do stuff:
491 $tempEl = $workArr[$ssArr[$i]];
492 if (is_array($tempEl)) {
493 if ($tempEl['type'] != 'newlevel') {
494 $workArr[$ssArr[$i]] = array(
495 'type' => 'newlevel',
496 'operator' => $tempEl['operator'],
497 'nl' => array($tempEl)
498 );
499 }
500 }
501 }
502 // If collapse level...
503 if ($POST['qG_remnl']) {
504 // Initialize array to work on
505 $ssArr = $this->getSubscript($POST['qG_remnl']);
506 $workArr =& $this->queryConfig;
507 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
508 $workArr =& $workArr[$ssArr[$i]];
509 }
510 // Do stuff:
511 $tempEl = $workArr[$ssArr[$i]];
512 if (is_array($tempEl)) {
513 if ($tempEl['type'] == 'newlevel') {
514 $a1 = array_slice($workArr, 0, $ssArr[$i]);
515 $a2 = array_slice($workArr, $ssArr[$i]);
516 array_shift($a2);
517 $a3 = $tempEl['nl'];
518 $a3[0]['operator'] = $tempEl['operator'];
519 $workArr = array_merge($a1, $a3, $a2);
520 }
521 }
522 }
523 }
524
525 /**
526 * [Describe function...]
527 *
528 * @param [type] $queryConfig: ...
529 * @return [type] ...
530 * @todo Define visibility
531 */
532 public function cleanUpQueryConfig($queryConfig) {
533 // Since we dont traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean before displaying
534 if (is_array($queryConfig)) {
535 ksort($queryConfig);
536 } else {
537 // queryConfig should never be empty!
538 if (!$queryConfig[0] || !$queryConfig[0]['type']) {
539 $queryConfig[0] = array('type' => 'FIELD_');
540 }
541 }
542 // Traverse:
543 $c = 0;
544 $arrCount = 0;
545 foreach ($queryConfig as $key => $conf) {
546 if (substr($conf['type'], 0, 6) == 'FIELD_') {
547 $fName = substr($conf['type'], 6);
548 $fType = $this->fields[$fName]['type'];
549 } elseif ($conf['type'] == 'newlevel') {
550 $fType = $conf['type'];
551 } else {
552 $fType = 'ignore';
553 }
554 switch ($fType) {
555 case 'newlevel':
556 if (!$queryConfig[$key]['nl']) {
557 $queryConfig[$key]['nl'][0]['type'] = 'FIELD_';
558 }
559 $queryConfig[$key]['nl'] = $this->cleanUpQueryConfig($queryConfig[$key]['nl']);
560 break;
561 case 'userdef':
562 $queryConfig[$key] = $this->userDefCleanUp($queryConfig[$key]);
563 break;
564 case 'ignore':
565
566 default:
567 $verifiedName = $this->verifyType($fName);
568 $queryConfig[$key]['type'] = 'FIELD_' . $this->verifyType($verifiedName);
569 if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
570 $conf['comparison'] = $this->comp_offsets[$fType] << 5;
571 }
572 $queryConfig[$key]['comparison'] = $this->verifyComparison($conf['comparison'], $conf['negate'] ? 1 : 0);
573 $queryConfig[$key]['inputValue'] = $this->cleanInputVal($queryConfig[$key]);
574 $queryConfig[$key]['inputValue1'] = $this->cleanInputVal($queryConfig[$key], 1);
575 break;
576 }
577 }
578 return $queryConfig;
579 }
580
581 /**
582 * [Describe function...]
583 *
584 * @param [type] $subLevel: ...
585 * @param [type] $queryConfig: ...
586 * @param [type] $parent: ...
587 * @return [type] ...
588 * @todo Define visibility
589 */
590 public function getFormElements($subLevel = 0, $queryConfig = '', $parent = '') {
591 $codeArr = array();
592 if (!is_array($queryConfig)) {
593 $queryConfig = $this->queryConfig;
594 }
595 $c = 0;
596 $arrCount = 0;
597 $loopcount = 0;
598 foreach ($queryConfig as $key => $conf) {
599 $subscript = $parent . '[' . $key . ']';
600 $lineHTML = '';
601 $lineHTML .= $this->mkOperatorSelect($this->name . $subscript, $conf['operator'], $c, $conf['type'] != 'FIELD_');
602 if (substr($conf['type'], 0, 6) == 'FIELD_') {
603 $fName = substr($conf['type'], 6);
604 $this->fieldName = $fName;
605 $fType = $this->fields[$fName]['type'];
606 if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
607 $conf['comparison'] = $this->comp_offsets[$fType] << 5;
608 }
609 //nasty nasty...
610 //make sure queryConfig contains _actual_ comparevalue.
611 //mkCompSelect don't care, but getQuery does.
612 $queryConfig[$key]['comparison'] += isset($conf['negate']) - $conf['comparison'] % 2;
613 } elseif ($conf['type'] == 'newlevel') {
614 $fType = $conf['type'];
615 } else {
616 $fType = 'ignore';
617 }
618 switch ($fType) {
619 case 'ignore':
620 break;
621 case 'newlevel':
622 if (!$queryConfig[$key]['nl']) {
623 $queryConfig[$key]['nl'][0]['type'] = 'FIELD_';
624 }
625 $lineHTML .= '<input type="hidden" name="' . $this->name . $subscript . '[type]" value="newlevel">';
626 $codeArr[$arrCount]['sub'] = $this->getFormElements($subLevel + 1, $queryConfig[$key]['nl'], $subscript . '[nl]');
627 break;
628 case 'userdef':
629 $lineHTML .= $this->userDef($this->name . $subscript, $conf, $fName, $fType);
630 break;
631 case 'date':
632 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
633 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
634 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
635 if ($conf['comparison'] == 100 || $conf['comparison'] == 101) {
636 // between
637 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
638 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue1]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue1']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '">';
639 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);';
640 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "date", "", 0,0);';
641 } else {
642 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
643 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);';
644 }
645 break;
646 case 'time':
647 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
648 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
649 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
650 if ($conf['comparison'] == 100 || $conf['comparison'] == 101) {
651 // between:
652 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
653 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue1]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', $conf['inputValue1']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '">';
654 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);';
655 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "datetime", "", 0,0);';
656 } else {
657 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', intval($conf['inputValue'])) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
658 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);';
659 }
660 break;
661 case 'multiple':
662
663 case 'binary':
664
665 case 'relation':
666 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
667 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
668 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
669 if ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) {
670 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '[]" style="vertical-align:top;" size="5" multiple>';
671 } elseif ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
672 if (is_array($conf['inputValue'])) {
673 $conf['inputValue'] = implode(',', $conf['inputValue']);
674 }
675 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
676 } else {
677 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
678 }
679 if ($conf['comparison'] != 66 && $conf['comparison'] != 67) {
680 $lineHTML .= $this->makeOptionList($fName, $conf, $this->table);
681 $lineHTML .= '</select>';
682 }
683 break;
684 case 'files':
685 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
686 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
687 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
688 if ($conf['comparison'] == 68 || $conf['comparison'] == 69) {
689 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '[]" style="vertical-align:top;" size="5" multiple>';
690 } else {
691 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
692 }
693 $lineHTML .= '<option value=""></option>' . $this->makeOptionList($fName, $conf, $this->table);
694 $lineHTML .= '</select>';
695 if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
696 $lineHTML .= ' + <input type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
697 }
698 break;
699 case 'boolean':
700 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
701 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
702 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
703 $lineHTML .= '<input type="hidden" value="1" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
704 break;
705 default:
706 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
707 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
708 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
709 if ($conf['comparison'] == 37 || $conf['comparison'] == 36) {
710 // between:
711 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . '>
712 <input type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . '>';
713 } else {
714 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
715 }
716 break;
717 }
718 if ($fType != 'ignore') {
719 $lineHTML .= $this->updateIcon();
720 if ($loopcount) {
721 $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif', 'width="11" height="12"') . 'title="Remove condition" name="qG_del' . $subscript . '">';
722 }
723 $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/add.gif', 'width="12" height="12"') . ' title="Add condition" name="qG_ins' . $subscript . '">';
724 if ($c != 0) {
725 $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2up.gif', 'width="12" height="7"') . ' title="Move up" name="qG_up' . $subscript . '">';
726 }
727 if ($c != 0 && $fType != 'newlevel') {
728 $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2right.gif', 'height="12" width="7"') . ' title="New level" name="qG_nl' . $subscript . '">';
729 }
730 if ($fType == 'newlevel') {
731 $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2left.gif', 'height="12" width="7"') . ' title="Collapse new level" name="qG_remnl' . $subscript . '">';
732 }
733 $codeArr[$arrCount]['html'] = $lineHTML;
734 $codeArr[$arrCount]['query'] = $this->getQuerySingle($conf, $c > 0 ? 0 : 1);
735 $arrCount++;
736 $c++;
737 }
738 $loopcount = 1;
739 }
740 $this->queryConfig = $queryConfig;
741 return $codeArr;
742 }
743
744 /**
745 * [Describe function...]
746 *
747 * @param [type] $codeArr: ...
748 * @param [type] $l: ...
749 * @param [type] $table: ...
750 * @return [type] ...
751 * @todo Define visibility
752 */
753 public function makeOptionList($fN, $conf, $table) {
754 $out = '';
755 $fieldSetup = $this->fields[$fN];
756 if ($fieldSetup['type'] == 'files') {
757 if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
758 $fileExtArray = explode(',', $fieldSetup['allowed']);
759 natcasesort($fileExtArray);
760 foreach ($fileExtArray as $fileExt) {
761 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $fileExt)) {
762 $out .= '<option value="' . $fileExt . '" selected>.' . $fileExt . '</option>';
763 } else {
764 $out .= '<option value="' . $fileExt . '">.' . $fileExt . '</option>';
765 }
766 }
767 }
768 $d = dir(PATH_site . $fieldSetup['uploadfolder']);
769 while (FALSE !== ($entry = $d->read())) {
770 if ($entry == '.' || $entry == '..') {
771 continue;
772 }
773 $fileArray[] = $entry;
774 }
775 $d->close();
776 natcasesort($fileArray);
777 foreach ($fileArray as $fileName) {
778 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $fileName)) {
779 $out .= '<option value="' . $fileName . '" selected>' . $fileName . '</option>';
780 } else {
781 $out .= '<option value="' . $fileName . '">' . $fileName . '</option>';
782 }
783 }
784 }
785 if ($fieldSetup['type'] == 'multiple') {
786 foreach ($fieldSetup['items'] as $key => $val) {
787 if (substr($val[0], 0, 4) == 'LLL:') {
788 $value = $GLOBALS['LANG']->sL($val[0]);
789 } else {
790 $value = $val[0];
791 }
792 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $val[1])) {
793 $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
794 } else {
795 $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
796 }
797 }
798 }
799 if ($fieldSetup['type'] == 'binary') {
800 foreach ($fieldSetup['items'] as $key => $val) {
801 if (substr($val[0], 0, 4) == 'LLL:') {
802 $value = $GLOBALS['LANG']->sL($val[0]);
803 } else {
804 $value = $val[0];
805 }
806 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], pow(2, $key))) {
807 $out .= '<option value="' . pow(2, $key) . '" selected>' . $value . '</option>';
808 } else {
809 $out .= '<option value="' . pow(2, $key) . '">' . $value . '</option>';
810 }
811 }
812 }
813 if ($fieldSetup['type'] == 'relation') {
814 if ($fieldSetup['items']) {
815 foreach ($fieldSetup['items'] as $key => $val) {
816 if (substr($val[0], 0, 4) == 'LLL:') {
817 $value = $GLOBALS['LANG']->sL($val[0]);
818 } else {
819 $value = $val[0];
820 }
821 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $val[1])) {
822 $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
823 } else {
824 $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
825 }
826 }
827 }
828 if (stristr($fieldSetup['allowed'], ',')) {
829 $from_table_Arr = explode(',', $fieldSetup['allowed']);
830 $useTablePrefix = 1;
831 if (!$fieldSetup['prepend_tname']) {
832 $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table), ($groupBy = ''), ($orderBy = ''), ($limit = ''));
833 if ($checkres) {
834 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) {
835 if (stristr($row[$fN], ',')) {
836 $checkContent = explode(',', $row[$fN]);
837 foreach ($checkContent as $singleValue) {
838 if (!stristr($singleValue, '_')) {
839 $dontPrefixFirstTable = 1;
840 }
841 }
842 } else {
843 $singleValue = $row[$fN];
844 if (strlen($singleValue) && !stristr($singleValue, '_')) {
845 $dontPrefixFirstTable = 1;
846 }
847 }
848 }
849 $GLOBALS['TYPO3_DB']->sql_free_result($checkres);
850 }
851 }
852 } else {
853 $from_table_Arr[0] = $fieldSetup['allowed'];
854 }
855 if ($fieldSetup['prepend_tname']) {
856 $useTablePrefix = 1;
857 }
858 if ($fieldSetup['foreign_table']) {
859 $from_table_Arr[0] = $fieldSetup['foreign_table'];
860 }
861 $counter = 0;
862 $webMountPageTree = '';
863 foreach ($from_table_Arr as $from_table) {
864 if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
865 $tablePrefix = $from_table . '_';
866 }
867 $counter = 1;
868 if (is_array($GLOBALS['TCA'][$from_table])) {
869 \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($from_table);
870 $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
871 $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
872 if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
873 foreach ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'] as $labelArray) {
874 if (substr($labelArray[0], 0, 4) == 'LLL:') {
875 $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
876 } else {
877 $labelFieldSelect[$labelArray[1]] = $labelArray[0];
878 }
879 }
880 $useSelectLabels = 1;
881 }
882 if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
883 foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
884 if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
885 $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
886 } else {
887 $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
888 }
889 }
890 $useAltSelectLabels = 1;
891 }
892 $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : '';
893 $select_fields = 'uid,' . $labelField . $altLabelFieldSelect;
894 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
895 $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
896 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
897 foreach ($webMounts as $key => $val) {
898 if ($webMountPageTree) {
899 $webMountPageTreePrefix = ',';
900 }
901 $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, ($begin = 0), $perms_clause);
902 }
903 if ($from_table == 'pages') {
904 $where_clause = 'uid IN (' . $webMountPageTree . ') ';
905 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
906 $where_clause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($from_table) . ' AND' . $perms_clause;
907 }
908 } else {
909 $where_clause = 'pid IN (' . $webMountPageTree . ') ';
910 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
911 $where_clause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($from_table);
912 }
913 }
914 } else {
915 $where_clause = 'uid';
916 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
917 $where_clause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($from_table);
918 }
919 }
920 $orderBy = 'uid';
921 if (!$this->tableArray[$from_table]) {
922 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, ($groupBy = ''), $orderBy, ($limit = ''));
923 }
924 if ($res) {
925 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
926 $this->tableArray[$from_table][] = $row;
927 }
928 $GLOBALS['TYPO3_DB']->sql_free_result($res);
929 }
930 foreach ($this->tableArray[$from_table] as $key => $val) {
931 if ($useSelectLabels) {
932 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($labelFieldSelect[$val[$labelField]]);
933 } elseif ($val[$labelField]) {
934 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$labelField]);
935 } elseif ($useAltSelectLabels) {
936 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($altLabelFieldSelect[$val[$altLabelField]]);
937 } else {
938 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$altLabelField]);
939 }
940 }
941 if ($GLOBALS['SOBE']->MOD_SETTINGS['options_sortlabel'] && is_array($outArray)) {
942 natcasesort($outArray);
943 }
944 }
945 }
946 foreach ($outArray as $key2 => $val2) {
947 if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $key2)) {
948 $out .= '<option value="' . $key2 . '" selected>[' . $key2 . '] ' . $val2 . '</option>';
949 } else {
950 $out .= '<option value="' . $key2 . '">[' . $key2 . '] ' . $val2 . '</option>';
951 }
952 }
953 }
954 return $out;
955 }
956
957 /**
958 * [Describe function...]
959 *
960 * @param [type] $codeArr: ...
961 * @param [type] $l: ...
962 * @return [type] ...
963 * @todo Define visibility
964 */
965 public function printCodeArray($codeArr, $l = 0) {
966 $line = '';
967 if ($l) {
968 $indent = '<td style="vertical-align:top;"><img height="1" width="50"></td>';
969 }
970 $lf = $l * 30;
971 $bgColor = \TYPO3\CMS\Core\Utility\GeneralUtility::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor2, $lf, $lf, $lf);
972 foreach ($codeArr as $k => $v) {
973 $line .= '<tr>' . $indent . '<td bgcolor="' . $bgColor . '"' . $this->noWrap . '>' . $v['html'] . '</td></tr>';
974 if ($this->enableQueryParts) {
975 $line .= '<tr>' . $indent . '<td>' . $this->formatQ($v['query']) . '</td></tr>';
976 }
977 if (is_array($v['sub'])) {
978 $line .= '<tr>' . $indent . '<td' . $this->noWrap . '>' . $this->printCodeArray($v['sub'], ($l + 1)) . '</td></tr>';
979 }
980 }
981 $out = '<table border="0" cellpadding="0" cellspacing="1">' . $line . '</table>';
982 return $out;
983 }
984
985 /**
986 * [Describe function...]
987 *
988 * @param [type] $str: ...
989 * @return [type] ...
990 * @todo Define visibility
991 */
992 public function formatQ($str) {
993 return '<font size="1" face="verdana" color="maroon"><i>' . htmlspecialchars($str) . '</i></font>';
994 }
995
996 /**
997 * [Describe function...]
998 *
999 * @param [type] $name: ...
1000 * @param [type] $op: ...
1001 * @param [type] $draw: ...
1002 * @param [type] $submit: ...
1003 * @return [type] ...
1004 * @todo Define visibility
1005 */
1006 public function mkOperatorSelect($name, $op, $draw, $submit) {
1007 if ($draw) {
1008 $out = '<select name="' . $name . '[operator]"' . ($submit ? ' onChange="submit();"' : '') . '>';
1009 //
1010 $out .= '<option value="AND"' . (!$op || $op == 'AND' ? ' selected' : '') . '>' . $this->lang['AND'] . '</option>';
1011 $out .= '<option value="OR"' . ($op == 'OR' ? ' selected' : '') . '>' . $this->lang['OR'] . '</option>';
1012 $out .= '</select>';
1013 } else {
1014 $out = '<input type="hidden" value="' . $op . '" name="' . $name . '[operator]">';
1015 $out .= '<img src="clear.gif" height="1" width="47">';
1016 }
1017 return $out;
1018 }
1019
1020 /**
1021 * [Describe function...]
1022 *
1023 * @param [type] $name: ...
1024 * @param [type] $fieldName: ...
1025 * @param [type] $prepend: ...
1026 * @return [type] ...
1027 * @todo Define visibility
1028 */
1029 public function mkTypeSelect($name, $fieldName, $prepend = 'FIELD_') {
1030 $out = '<select name="' . $name . '" onChange="submit();">';
1031 $out .= '<option value=""></option>';
1032 foreach ($this->fields as $key => $value) {
1033 if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) {
1034 $label = $this->fields[$key]['label'];
1035 $label_alt = $this->fields[$key]['label_alt'];
1036 $out .= '<option value="' . $prepend . $key . '"' . ($key == $fieldName ? ' selected' : '') . '>' . $label . '</option>';
1037 }
1038 }
1039 $out .= '</select>';
1040 return $out;
1041 }
1042
1043 /**
1044 * [Describe function...]
1045 *
1046 * @param [type] $fieldName: ...
1047 * @return [type] ...
1048 * @todo Define visibility
1049 */
1050 public function verifyType($fieldName) {
1051 $first = '';
1052 foreach ($this->fields as $key => $value) {
1053 if (!$first) {
1054 $first = $key;
1055 }
1056 if ($key == $fieldName) {
1057 return $key;
1058 }
1059 }
1060 return $first;
1061 }
1062
1063 /**
1064 * [Describe function...]
1065 *
1066 * @param [type] $comparison: ...
1067 * @param [type] $neg: ...
1068 * @return [type] ...
1069 * @todo Define visibility
1070 */
1071 public function verifyComparison($comparison, $neg) {
1072 $compOffSet = $comparison >> 5;
1073 $first = -1;
1074 for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) {
1075 if ($first == -1) {
1076 $first = $i;
1077 }
1078 if ($i >> 1 == $comparison >> 1) {
1079 return $i;
1080 }
1081 }
1082 return $first;
1083 }
1084
1085 /**
1086 * [Describe function...]
1087 *
1088 * @param [type] $name: ...
1089 * @param [type] $fieldName: ...
1090 * @return [type] ...
1091 * @todo Define visibility
1092 */
1093 public function mkFieldToInputSelect($name, $fieldName) {
1094 $out = '<input type="Text" value="' . htmlspecialchars($fieldName) . '" name="' . $name . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . '>' . $this->updateIcon();
1095 $out .= '<a href="#" onClick="document.forms[0][\'' . $name . '\'].value=\'\';return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . '</a>';
1096 $out .= '<BR><select name="_fieldListDummy" size="5" onChange="document.forms[0][\'' . $name . '\'].value+=\',\'+this.value">';
1097 foreach ($this->fields as $key => $value) {
1098 if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) {
1099 $label = $this->fields[$key]['label'];
1100 $label_alt = $this->fields[$key]['label_alt'];
1101 $out .= '<option value="' . $key . '"' . ($key == $fieldName ? ' selected' : '') . '>' . $label . '</option>';
1102 }
1103 }
1104 $out .= '</select>';
1105 return $out;
1106 }
1107
1108 /**
1109 * [Describe function...]
1110 *
1111 * @param [type] $name: ...
1112 * @param [type] $cur: ...
1113 * @return [type] ...
1114 * @todo Define visibility
1115 */
1116 public function mkTableSelect($name, $cur) {
1117 $out = '<select name="' . $name . '" onChange="submit();">';
1118 $out .= '<option value=""></option>';
1119 foreach ($GLOBALS['TCA'] as $tN => $value) {
1120 if ($GLOBALS['BE_USER']->check('tables_select', $tN)) {
1121 $out .= '<option value="' . $tN . '"' . ($tN == $cur ? ' selected' : '') . '>' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$tN]['ctrl']['title']) . '</option>';
1122 }
1123 }
1124 $out .= '</select>';
1125 return $out;
1126 }
1127
1128 /**
1129 * [Describe function...]
1130 *
1131 * @param [type] $name: ...
1132 * @param [type] $comparison: ...
1133 * @param [type] $neg: ...
1134 * @return [type] ...
1135 * @todo Define visibility
1136 */
1137 public function mkCompSelect($name, $comparison, $neg) {
1138 $compOffSet = $comparison >> 5;
1139 $out = '<select name="' . $name . '" onChange="submit();">';
1140 for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) {
1141 if ($this->lang['comparison'][$i . '_']) {
1142 $out .= '<option value="' . $i . '"' . ($i >> 1 == $comparison >> 1 ? ' selected' : '') . '>' . $this->lang['comparison'][($i . '_')] . '</option>';
1143 }
1144 }
1145 $out .= '</select>';
1146 return $out;
1147 }
1148
1149 /**
1150 * [Describe function...]
1151 *
1152 * @param [type] $arr: ...
1153 * @return [type] ...
1154 * @todo Define visibility
1155 */
1156 public function getSubscript($arr) {
1157 while (is_array($arr)) {
1158 reset($arr);
1159 list($key, ) = each($arr);
1160 $retArr[] = $key;
1161 $arr = $arr[$key];
1162 }
1163 return $retArr;
1164 }
1165
1166 /**
1167 * [Describe function...]
1168 *
1169 * @return [type] ...
1170 * @todo Define visibility
1171 */
1172 public function initUserDef() {
1173
1174 }
1175
1176 /**
1177 * [Describe function...]
1178 *
1179 * @return [type] ...
1180 * @todo Define visibility
1181 */
1182 public function userDef() {
1183
1184 }
1185
1186 /**
1187 * [Describe function...]
1188 *
1189 * @param [type] $queryConfig: ...
1190 * @return [type] ...
1191 * @todo Define visibility
1192 */
1193 public function userDefCleanUp($queryConfig) {
1194 return $queryConfig;
1195 }
1196
1197 /**
1198 * [Describe function...]
1199 *
1200 * @param [type] $queryConfig: ...
1201 * @param [type] $pad: ...
1202 * @return [type] ...
1203 * @todo Define visibility
1204 */
1205 public function getQuery($queryConfig, $pad = '') {
1206 $qs = '';
1207 // Since we don't traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean
1208 ksort($queryConfig);
1209 $first = 1;
1210 foreach ($queryConfig as $key => $conf) {
1211 switch ($conf['type']) {
1212 case 'newlevel':
1213 $qs .= LF . $pad . trim($conf['operator']) . ' (' . $this->getQuery($queryConfig[$key]['nl'], ($pad . ' ')) . LF . $pad . ')';
1214 break;
1215 case 'userdef':
1216 $qs .= LF . $pad . getUserDefQuery($conf, $first);
1217 break;
1218 default:
1219 $qs .= LF . $pad . $this->getQuerySingle($conf, $first);
1220 break;
1221 }
1222 $first = 0;
1223 }
1224 return $qs;
1225 }
1226
1227 /**
1228 * [Describe function...]
1229 *
1230 * @param [type] $conf: ...
1231 * @param [type] $first: ...
1232 * @return [type] ...
1233 * @todo Define visibility
1234 */
1235 public function getQuerySingle($conf, $first) {
1236 $qs = '';
1237 $prefix = $this->enablePrefix ? $this->table . '.' : '';
1238 if (!$first) {
1239 // Is it OK to insert the AND operator if none is set?
1240 $qs .= trim(($conf['operator'] ? $conf['operator'] : 'AND')) . ' ';
1241 }
1242 $qsTmp = str_replace('#FIELD#', $prefix . trim(substr($conf['type'], 6)), $this->compSQL[$conf['comparison']]);
1243 $inputVal = $this->cleanInputVal($conf);
1244 if ($conf['comparison'] == 68 || $conf['comparison'] == 69) {
1245 $inputVal = explode(',', $inputVal);
1246 foreach ($inputVal as $key => $fileName) {
1247 $inputVal[$key] = '\'' . $fileName . '\'';
1248 }
1249 $inputVal = implode(',', $inputVal);
1250 $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp);
1251 } elseif ($conf['comparison'] == 162 || $conf['comparison'] == 163) {
1252 $inputValArray = explode(',', $inputVal);
1253 $inputVal = 0;
1254 foreach ($inputValArray as $key => $fileName) {
1255 $inputVal += intval($fileName);
1256 }
1257 $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp);
1258 } else {
1259 $qsTmp = str_replace('#VALUE#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp);
1260 }
1261 if ($conf['comparison'] == 37 || $conf['comparison'] == 36 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 100 || $conf['comparison'] == 101) {
1262 // between:
1263 $inputVal = $this->cleanInputVal($conf, '1');
1264 $qsTmp = str_replace('#VALUE1#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp);
1265 }
1266 $qs .= trim($qsTmp);
1267 return $qs;
1268 }
1269
1270 /**
1271 * [Describe function...]
1272 *
1273 * @param [type] $conf: ...
1274 * @param [type] $suffix: ...
1275 * @return [type] ...
1276 * @todo Define visibility
1277 */
1278 public function cleanInputVal($conf, $suffix = '') {
1279 if ($conf['comparison'] >> 5 == 0 || ($conf['comparison'] == 32 || $conf['comparison'] == 33 || $conf['comparison'] == 64 || $conf['comparison'] == 65 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 96 || $conf['comparison'] == 97)) {
1280 $inputVal = $conf['inputValue' . $suffix];
1281 } elseif ($conf['comparison'] == 39 || $conf['comparison'] == 38) {
1282 // in list:
1283 $inputVal = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $conf['inputValue' . $suffix]));
1284 } elseif ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) {
1285 // in list:
1286 if (is_array($conf['inputValue' . $suffix])) {
1287 $inputVal = implode(',', $conf['inputValue' . $suffix]);
1288 } elseif ($conf['inputValue' . $suffix]) {
1289 $inputVal = $conf['inputValue' . $suffix];
1290 } else {
1291 $inputVal = 0;
1292 }
1293 } else {
1294 $inputVal = doubleval($conf['inputValue' . $suffix]);
1295 }
1296 return $inputVal;
1297 }
1298
1299 /**
1300 * [Describe function...]
1301 *
1302 * @param [type] $qcArr: ...
1303 * @return [type] ...
1304 * @todo Define visibility
1305 */
1306 public function getUserDefQuery($qcArr) {
1307
1308 }
1309
1310 /**
1311 * [Describe function...]
1312 *
1313 * @return [type] ...
1314 * @todo Define visibility
1315 */
1316 public function updateIcon() {
1317 return '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="Update" name="just_update">';
1318 }
1319
1320 /**
1321 * [Describe function...]
1322 *
1323 * @return [type] ...
1324 * @todo Define visibility
1325 */
1326 public function getLabelCol() {
1327 return $GLOBALS['TCA'][$this->table]['ctrl']['label'];
1328 }
1329
1330 /**
1331 * [Describe function...]
1332 *
1333 * @param [type] $modSettings: ...
1334 * @param [type] $enableList: ...
1335 * @return [type] ...
1336 * @todo Define visibility
1337 */
1338 public function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit') {
1339 $enableArr = explode(',', $enableList);
1340 // Make output
1341 $TDparams = ' class="bgColor5" nowrap';
1342 if (in_array('table', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectATable']) {
1343 $out = '
1344 <tr>
1345 <td' . $TDparams . '><strong>Select a table:</strong></td>
1346 <td' . $TDparams . '>' . $this->mkTableSelect('SET[queryTable]', $this->table) . '</td>
1347 </tr>';
1348 }
1349 if ($this->table) {
1350 // Init fields:
1351 $this->setAndCleanUpExternalLists('queryFields', $modSettings['queryFields'], 'uid,' . $this->getLabelCol());
1352 $this->setAndCleanUpExternalLists('queryGroup', $modSettings['queryGroup']);
1353 $this->setAndCleanUpExternalLists('queryOrder', $modSettings['queryOrder'] . ',' . $modSettings['queryOrder2']);
1354 // Limit:
1355 $this->extFieldLists['queryLimit'] = $modSettings['queryLimit'];
1356 if (!$this->extFieldLists['queryLimit']) {
1357 $this->extFieldLists['queryLimit'] = 100;
1358 }
1359 $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->extFieldLists['queryLimit']);
1360 if ($parts[1]) {
1361 $this->limitBegin = $parts[0];
1362 $this->limitLength = $parts[1];
1363 } else {
1364 $this->limitLength = $this->extFieldLists['queryLimit'];
1365 }
1366 $this->extFieldLists['queryLimit'] = implode(',', array_slice($parts, 0, 2));
1367 // Insert Descending parts
1368 if ($this->extFieldLists['queryOrder']) {
1369 $descParts = explode(',', $modSettings['queryOrderDesc'] . ',' . $modSettings['queryOrder2Desc']);
1370 $orderParts = explode(',', $this->extFieldLists['queryOrder']);
1371 $reList = array();
1372 foreach ($orderParts as $kk => $vv) {
1373 $reList[] = $vv . ($descParts[$kk] ? ' DESC' : '');
1374 }
1375 $this->extFieldLists['queryOrder_SQL'] = implode(',', $reList);
1376 }
1377 // Query Generator:
1378 $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : '');
1379 $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig);
1380 $this->enableQueryParts = $modSettings['search_query_smallparts'];
1381 $codeArr = $this->getFormElements();
1382 $queryCode = $this->printCodeArray($codeArr);
1383 if (in_array('fields', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) {
1384 $out .= '
1385 <tr>
1386 <td' . $TDparams . '><strong>Select fields:</strong></td>
1387 <td' . $TDparams . '>' . $this->mkFieldToInputSelect('SET[queryFields]', $this->extFieldLists['queryFields']) . '</td>
1388 </tr>';
1389 }
1390 if (in_array('query', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableMakeQuery']) {
1391 $out .= '<tr>
1392 <td colspan="2"' . $TDparams . '><strong>Make Query:</strong></td>
1393 </tr>
1394 <tr>
1395 <td colspan="2">' . $queryCode . '</td>
1396 </tr>
1397 ';
1398 }
1399 if (in_array('group', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableGroupBy']) {
1400 $out .= '<tr>
1401 <td' . $TDparams . '><strong>Group By:</strong></td>
1402 <td' . $TDparams . '>' . $this->mkTypeSelect('SET[queryGroup]', $this->extFieldLists['queryGroup'], '') . '</td>
1403 </tr>';
1404 }
1405 if (in_array('order', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableOrderBy']) {
1406 $orderByArr = explode(',', $this->extFieldLists['queryOrder']);
1407 $orderBy = '';
1408 $orderBy .= $this->mkTypeSelect('SET[queryOrder]', $orderByArr[0], '') . '&nbsp;' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrderDesc]', $modSettings['queryOrderDesc'], '', '', 'id="checkQueryOrderDesc"') . '&nbsp;<label for="checkQueryOrderDesc">Descending</label>';
1409 if ($orderByArr[0]) {
1410 $orderBy .= '<BR>' . $this->mkTypeSelect('SET[queryOrder2]', $orderByArr[1], '') . '&nbsp;' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrder2Desc]', $modSettings['queryOrder2Desc'], '', '', 'id="checkQueryOrder2Desc"') . '&nbsp;<label for="checkQueryOrder2Desc">Descending</label>';
1411 }
1412 $out .= '<tr>
1413 <td' . $TDparams . '><strong>Order By:</strong></td>
1414 <td' . $TDparams . '>' . $orderBy . '</td>
1415 </tr>';
1416 }
1417 if (in_array('limit', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableLimit']) {
1418 $limit = '<input type="Text" value="' . htmlspecialchars($this->extFieldLists['queryLimit']) . '" name="SET[queryLimit]" id="queryLimit"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>' . $this->updateIcon();
1419 $prevLimit = $this->limitBegin - $this->limitLength < 0 ? 0 : $this->limitBegin - $this->limitLength;
1420 if ($this->limitBegin) {
1421 $prevButton = '<input type="button" value="previous ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $prevLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
1422 }
1423 if (!$this->limitLength) {
1424 $this->limitLength = 100;
1425 }
1426 $nextLimit = $this->limitBegin + $this->limitLength;
1427 if ($nextLimit < 0) {
1428 $nextLimit = 0;
1429 }
1430 if ($nextLimit) {
1431 $nextButton = '<input type="button" value="next ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $nextLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
1432 }
1433 $numberButtons = '<input type="button" value="10" onclick=\'document.getElementById("queryLimit").value="10";document.forms[0].submit();\'>';
1434 $numberButtons .= '<input type="button" value="20" onclick=\'document.getElementById("queryLimit").value="20";document.forms[0].submit();\'>';
1435 $numberButtons .= '<input type="button" value="50" onclick=\'document.getElementById("queryLimit").value="50";document.forms[0].submit();\'>';
1436 $numberButtons .= '<input type="button" value="100" onclick=\'document.getElementById("queryLimit").value="100";document.forms[0].submit();\'>';
1437 $out .= '<tr>
1438 <td' . $TDparams . '><strong>Limit:</strong></td>
1439 <td' . $TDparams . '>' . $limit . $prevButton . $nextButton . '&nbsp;' . $numberButtons . '</td>
1440 </tr>
1441 ';
1442 }
1443 }
1444 $out = '<table border="0" cellpadding="3" cellspacing="1" class="qg-make-query">' . $out . '</table>';
1445 $out .= $this->JSbottom($this->formName);
1446 return $out;
1447 }
1448
1449 /**
1450 * [Describe function...]
1451 *
1452 * @param [type] $qString: ...
1453 * @param [type] $depth: ...
1454 * @param [type] $begin: ...
1455 * @param [type] $perms_clause: ...
1456 * @return [type] ...
1457 * @todo Define visibility
1458 */
1459 public function getTreeList($id, $depth, $begin = 0, $perms_clause) {
1460 $depth = intval($depth);
1461 $begin = intval($begin);
1462 $id = intval($id);
1463 if ($begin == 0) {
1464 $theList = $id;
1465 } else {
1466 $theList = '';
1467 }
1468 if ($id && $depth > 0) {
1469 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . $id . ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages') . ' AND ' . $perms_clause);
1470 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1471 if ($begin <= 0) {
1472 $theList .= ',' . $row['uid'];
1473 }
1474 if ($depth > 1) {
1475 $theList .= $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
1476 }
1477 }
1478 $GLOBALS['TYPO3_DB']->sql_free_result($res);
1479 }
1480 return $theList;
1481 }
1482
1483 /**
1484 * [Describe function...]
1485 *
1486 * @param [type] $qString: ...
1487 * @param [type] $fN: ...
1488 * @return [type] ...
1489 * @todo Define visibility
1490 */
1491 public function getSelectQuery($qString = '', $fN = '') {
1492 if (!$qString) {
1493 $qString = $this->getQuery($this->queryConfig);
1494 }
1495 $qString = '(' . $qString . ')';
1496 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
1497 $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
1498 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1499 $webMountPageTree = '';
1500 foreach ($webMounts as $key => $val) {
1501 if ($webMountPageTree) {
1502 $webMountPageTreePrefix = ',';
1503 }
1504 $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, ($begin = 0), $perms_clause);
1505 }
1506 if ($this->table == 'pages') {
1507 $qString .= ' AND uid IN (' . $webMountPageTree . ')';
1508 } else {
1509 $qString .= ' AND pid IN (' . $webMountPageTree . ')';
1510 }
1511 }
1512 $fieldlist = $this->extFieldLists['queryFields'] . ',pid' . ($GLOBALS['TCA'][$this->table]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] : '');
1513 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
1514 $qString .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table);
1515 }
1516 $query = $GLOBALS['TYPO3_DB']->SELECTquery($fieldlist, $this->table, $qString, trim($this->extFieldLists['queryGroup']), $this->extFieldLists['queryOrder'] ? trim($this->extFieldLists['queryOrder_SQL']) : '', $this->extFieldLists['queryLimit']);
1517 return $query;
1518 }
1519
1520 /**
1521 * [Describe function...]
1522 *
1523 * @param string $formname
1524 * @return string
1525 * @todo Define visibility
1526 */
1527 public function JSbottom($formname) {
1528 $out = '';
1529 if ($this->extJSCODE) {
1530 $out .= '
1531 <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.evalfield.js"></script>
1532 <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'jsfunc.tbe_editor.js"></script>
1533 <script language="javascript" type="text/javascript">
1534 TBE_EDITOR.formname = "' . $formname . '";
1535 TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
1536 TBE_EDITOR.backend_interface = "' . $GLOBALS['BE_USER']->uc['interfaceSetup'] . '";
1537 ' . $this->extJSCODE . '
1538 </script>';
1539 }
1540 return $out;
1541 }
1542
1543 /**
1544 * Sets the current name of the input form.
1545 *
1546 * @param string $formName The name of the form.
1547 * @return void
1548 */
1549 public function setFormName($formName) {
1550 $this->formName = trim($formName);
1551 }
1552
1553 }
1554
1555
1556 ?>