Fixed bug #16574: PHP notices from XCLASS inclusions
[Packages/TYPO3.CMS.git] / typo3 / wizard_list.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@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 * Wizard to list records from a page id.
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
32 * XHTML compliant
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 74: class SC_wizard_list
42 * 93: function init()
43 * 105: function main()
44 *
45 * TOTAL FUNCTIONS: 2
46 * (This index is automatically created/updated by the extension "extdeveval")
47 *
48 */
49
50
51
52 $BACK_PATH='';
53 require ('init.php');
54 require ('template.php');
55 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
56
57
58
59
60
61
62
63
64
65
66
67 /**
68 * Script Class for redirecting the user to the Web > List module if a wizard-link has been clicked in TCEforms
69 *
70 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
71 * @package TYPO3
72 * @subpackage core
73 */
74 class SC_wizard_list {
75
76 // Internal, static:
77 var $pid; // PID
78
79 // Internal, static: GPvars
80 var $P; // Wizard parameters, coming from TCEforms linking to the wizard.
81 var $table; // Table to show, if none, then all tables are listed in list module.
82 var $id; // Page id to list.
83
84
85
86
87
88 /**
89 * Initialization of the class, setting GPvars.
90 *
91 * @return void
92 */
93 function init() {
94 $this->P = t3lib_div::_GP('P');
95 $this->table = t3lib_div::_GP('table');
96 $this->id = t3lib_div::_GP('id');
97 }
98
99 /**
100 * Main function
101 * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
102 *
103 * @return void
104 */
105 function main() {
106
107 // Get this record
108 $origRow = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
109
110 // Get TSconfig for it.
111 $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table,is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
112
113 // Set [params][pid]
114 if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###') {
115 $this->pid = intval($TSconfig['_'.substr($this->P['params']['pid'],3,-3)]);
116 } else $this->pid = intval($this->P['params']['pid']);
117
118 // Make redirect:
119 if (!strcmp($this->pid,'') || strcmp($this->id,'')) { // If pid is blank OR if id is set, then return...
120 $redirectUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']);
121 } else { // Otherwise, show the list:
122 $redirectUrl = t3lib_extMgm::createListViewLink(
123 $this->pid,
124 '&table=' . $this->P['params']['table'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')),
125 '',
126 '',
127 TRUE
128 );
129 }
130 t3lib_utility_Http::redirect($redirectUrl);
131 }
132 }
133
134
135 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/wizard_list.php'])) {
136 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/wizard_list.php']);
137 }
138
139
140
141 // Make instance:
142 $SOBE = t3lib_div::makeInstance('SC_wizard_list');
143 $SOBE->init();
144 $SOBE->main();
145
146 ?>