Passed
Branch oai_solr_new_directory_structu... (24cd44)
by Erik
04:51
created
plugins/collection/class.tx_dlf_collection.php 1 patch
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -19,414 +19,414 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_collection extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
22
+	public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
23 23
 
24
-    /**
25
-     * This holds the hook objects
26
-     *
27
-     * @var	array
28
-     * @access protected
29
-     */
30
-    protected $hookObjects = array ();
24
+	/**
25
+	 * This holds the hook objects
26
+	 *
27
+	 * @var	array
28
+	 * @access protected
29
+	 */
30
+	protected $hookObjects = array ();
31 31
 
32
-    /**
33
-     * The main method of the PlugIn
34
-     *
35
-     * @access	public
36
-     *
37
-     * @param	string		$content: The PlugIn content
38
-     * @param	array		$conf: The PlugIn configuration
39
-     *
40
-     * @return	string		The content that is displayed on the website
41
-     */
42
-    public function main($content, $conf) {
32
+	/**
33
+	 * The main method of the PlugIn
34
+	 *
35
+	 * @access	public
36
+	 *
37
+	 * @param	string		$content: The PlugIn content
38
+	 * @param	array		$conf: The PlugIn configuration
39
+	 *
40
+	 * @return	string		The content that is displayed on the website
41
+	 */
42
+	public function main($content, $conf) {
43 43
 
44
-        $this->init($conf);
44
+		$this->init($conf);
45 45
 
46
-        // Turn cache on.
47
-        $this->setCache(TRUE);
46
+		// Turn cache on.
47
+		$this->setCache(TRUE);
48 48
 
49
-        // Quit without doing anything if required configuration variables are not set.
50
-        if (empty($this->conf['pages'])) {
49
+		// Quit without doing anything if required configuration variables are not set.
50
+		if (empty($this->conf['pages'])) {
51 51
 
52
-            if (TYPO3_DLOG) {
52
+			if (TYPO3_DLOG) {
53 53
 
54
-                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
54
+				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
55 55
 
56
-            }
56
+			}
57 57
 
58
-            return $content;
58
+			return $content;
59 59
 
60
-        }
60
+		}
61 61
 
62
-        // Load template file.
63
-        if (!empty($this->conf['templateFile'])) {
62
+		// Load template file.
63
+		if (!empty($this->conf['templateFile'])) {
64 64
 
65
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
65
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
66 66
 
67
-        } else {
67
+		} else {
68 68
 
69
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
69
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
70 70
 
71
-        }
71
+		}
72 72
 
73
-        // Get hook objects.
74
-        $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
73
+		// Get hook objects.
74
+		$this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
75 75
 
76
-        if (!empty($this->piVars['collection'])) {
76
+		if (!empty($this->piVars['collection'])) {
77 77
 
78
-            $this->showSingleCollection(intval($this->piVars['collection']));
78
+			$this->showSingleCollection(intval($this->piVars['collection']));
79 79
 
80
-        } else {
80
+		} else {
81 81
 
82
-            $content .= $this->showCollectionList();
82
+			$content .= $this->showCollectionList();
83 83
 
84
-        }
84
+		}
85 85
 
86
-        return $this->pi_wrapInBaseClass($content);
86
+		return $this->pi_wrapInBaseClass($content);
87 87
 
88
-    }
88
+	}
89 89
 
90
-    /**
91
-     * Builds a collection list
92
-     *
93
-     * @access	protected
94
-     *
95
-     * @return	string		The list of collections ready to output
96
-     */
97
-    protected function showCollectionList() {
90
+	/**
91
+	 * Builds a collection list
92
+	 *
93
+	 * @access	protected
94
+	 *
95
+	 * @return	string		The list of collections ready to output
96
+	 */
97
+	protected function showCollectionList() {
98 98
 
99
-        $additionalWhere = '';
99
+		$additionalWhere = '';
100 100
 
101
-        $orderBy = 'tx_dlf_collections.label';
101
+		$orderBy = 'tx_dlf_collections.label';
102 102
 
103
-        // Handle collections set by configuration.
104
-        if ($this->conf['collections']) {
103
+		// Handle collections set by configuration.
104
+		if ($this->conf['collections']) {
105 105
 
106
-            if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) {
106
+			if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) {
107 107
 
108
-                $this->showSingleCollection(intval(trim($this->conf['collections'], ' ,')));
108
+				$this->showSingleCollection(intval(trim($this->conf['collections'], ' ,')));
109 109
 
110
-            }
110
+			}
111 111
 
112
-            $additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
112
+			$additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
113 113
 
114
-            $orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
114
+			$orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
115 115
 
116
-        }
116
+		}
117 117
 
118
-        // Should user-defined collections be shown?
119
-        if (empty($this->conf['show_userdefined'])) {
118
+		// Should user-defined collections be shown?
119
+		if (empty($this->conf['show_userdefined'])) {
120 120
 
121
-            $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0';
121
+			$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0';
122 122
 
123
-        } elseif ($this->conf['show_userdefined'] > 0) {
123
+		} elseif ($this->conf['show_userdefined'] > 0) {
124 124
 
125
-            if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
125
+			if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
126 126
 
127
-                $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']);
127
+				$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']);
128 128
 
129
-            } else {
129
+			} else {
130 130
 
131
-                $additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0';
131
+				$additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0';
132 132
 
133
-            }
133
+			}
134 134
 
135
-        }
135
+		}
136 136
 
137
-        // Get collections.
138
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
139
-            'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles',
140
-            'tx_dlf_documents',
141
-            'tx_dlf_relations',
142
-            'tx_dlf_collections',
143
-            'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
144
-            'tx_dlf_collections.uid',
145
-            $orderBy,
146
-            ''
147
-        );
137
+		// Get collections.
138
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
139
+			'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles',
140
+			'tx_dlf_documents',
141
+			'tx_dlf_relations',
142
+			'tx_dlf_collections',
143
+			'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
144
+			'tx_dlf_collections.uid',
145
+			$orderBy,
146
+			''
147
+		);
148 148
 
149
-        $count = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
149
+		$count = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
150 150
 
151
-        $content = '';
151
+		$content = '';
152 152
 
153
-        if ($count == 1 && empty($this->conf['dont_show_single'])) {
153
+		if ($count == 1 && empty($this->conf['dont_show_single'])) {
154 154
 
155
-            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
155
+			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
156 156
 
157
-            $this->showSingleCollection(intval($resArray['uid']));
157
+			$this->showSingleCollection(intval($resArray['uid']));
158 158
 
159
-        } elseif ($count > 0) {
159
+		} elseif ($count > 0) {
160 160
 
161
-            // Get number of volumes per collection.
162
-            $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
163
-                'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes',
164
-                'tx_dlf_documents',
165
-                'tx_dlf_relations',
166
-                'tx_dlf_collections',
167
-                'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
168
-                'tx_dlf_collections.uid',
169
-                '',
170
-                ''
171
-            );
161
+			// Get number of volumes per collection.
162
+			$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
163
+				'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes',
164
+				'tx_dlf_documents',
165
+				'tx_dlf_relations',
166
+				'tx_dlf_collections',
167
+				'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
168
+				'tx_dlf_collections.uid',
169
+				'',
170
+				''
171
+			);
172 172
 
173
-            $volumes = array ();
173
+			$volumes = array ();
174 174
 
175
-            while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) {
175
+			while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) {
176 176
 
177
-                $volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes'];
177
+				$volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes'];
178 178
 
179
-            }
179
+			}
180 180
 
181
-            // Process results.
182
-            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
181
+			// Process results.
182
+			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
183 183
 
184
-                // Generate random but unique array key taking priority into account.
185
-                do {
184
+				// Generate random but unique array key taking priority into account.
185
+				do {
186 186
 
187
-                    $_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000);
187
+					$_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000);
188 188
 
189
-                } while (!empty($markerArray[$_key]));
189
+				} while (!empty($markerArray[$_key]));
190 190
 
191
-                // Merge plugin variables with new set of values.
192
-                $additionalParams = array ('collection' => $resArray['uid']);
191
+				// Merge plugin variables with new set of values.
192
+				$additionalParams = array ('collection' => $resArray['uid']);
193 193
 
194
-                if (is_array($this->piVars)) {
194
+				if (is_array($this->piVars)) {
195 195
 
196
-                    $piVars = $this->piVars;
196
+					$piVars = $this->piVars;
197 197
 
198
-                    unset($piVars['DATA']);
198
+					unset($piVars['DATA']);
199 199
 
200
-                    $additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams);
200
+					$additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams);
201 201
 
202
-                }
202
+				}
203 203
 
204
-                // Build typolink configuration array.
205
-                $conf = array (
206
-                    'useCacheHash' => 1,
207
-                    'parameter' => $GLOBALS['TSFE']->id,
208
-                    'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
209
-                );
204
+				// Build typolink configuration array.
205
+				$conf = array (
206
+					'useCacheHash' => 1,
207
+					'parameter' => $GLOBALS['TSFE']->id,
208
+					'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
209
+				);
210 210
 
211
-                // Link collection's title to list view.
212
-                $markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf);
211
+				// Link collection's title to list view.
212
+				$markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf);
213 213
 
214
-                // Add feed link if applicable.
215
-                if (!empty($this->conf['targetFeed'])) {
214
+				// Add feed link if applicable.
215
+				if (!empty($this->conf['targetFeed'])) {
216 216
 
217
-                    $img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
217
+					$img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
218 218
 
219
-                    $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
219
+					$markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
220 220
 
221
-                } else {
221
+				} else {
222 222
 
223
-                    $markerArray[$_key]['###FEED###'] = '';
223
+					$markerArray[$_key]['###FEED###'] = '';
224 224
 
225
-                }
225
+				}
226 226
 
227
-                // Add thumbnail.
228
-                if (!empty($resArray['thumbnail'])) {
227
+				// Add thumbnail.
228
+				if (!empty($resArray['thumbnail'])) {
229 229
 
230
-                    $markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />';
230
+					$markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />';
231 231
 
232
-                } else {
232
+				} else {
233 233
 
234
-                    $markerArray[$_key]['###THUMBNAIL###'] = '';
234
+					$markerArray[$_key]['###THUMBNAIL###'] = '';
235 235
 
236
-                }
236
+				}
237 237
 
238
-                // Add description.
239
-                $markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
238
+				// Add description.
239
+				$markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
240 240
 
241
-                // Build statistic's output.
242
-                $labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
241
+				// Build statistic's output.
242
+				$labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
243 243
 
244
-                $markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
244
+				$markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
245 245
 
246
-                $labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
246
+				$labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
247 247
 
248
-                $markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
248
+				$markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
249 249
 
250
-            }
250
+			}
251 251
 
252
-            // Randomize sorting?
253
-            if (!empty($this->conf['randomize'])) {
252
+			// Randomize sorting?
253
+			if (!empty($this->conf['randomize'])) {
254 254
 
255
-                ksort($markerArray, SORT_NUMERIC);
255
+				ksort($markerArray, SORT_NUMERIC);
256 256
 
257
-                // Don't cache the output.
258
-                $this->setCache(FALSE);
257
+				// Don't cache the output.
258
+				$this->setCache(FALSE);
259 259
 
260
-            }
260
+			}
261 261
 
262
-            $entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
262
+			$entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
263 263
 
264
-            foreach ($markerArray as $marker) {
264
+			foreach ($markerArray as $marker) {
265 265
 
266
-                $content .= $this->cObj->substituteMarkerArray($entry, $marker);
266
+				$content .= $this->cObj->substituteMarkerArray($entry, $marker);
267 267
 
268
-            }
268
+			}
269 269
 
270
-            // Hook for getting custom collection hierarchies/subentries (requested by SBB).
271
-            foreach ($this->hookObjects as $hookObj) {
270
+			// Hook for getting custom collection hierarchies/subentries (requested by SBB).
271
+			foreach ($this->hookObjects as $hookObj) {
272 272
 
273
-                if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) {
273
+				if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) {
274 274
 
275
-                    $hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray);
275
+					$hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray);
276 276
 
277
-                }
277
+				}
278 278
 
279
-            }
279
+			}
280 280
 
281
-            return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE);
281
+			return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE);
282 282
 
283
-        }
283
+		}
284 284
 
285
-        return $content;
285
+		return $content;
286 286
 
287
-    }
287
+	}
288 288
 
289
-    /**
290
-     * Builds a collection's list
291
-     *
292
-     * @access	protected
293
-     *
294
-     * @param	integer		$id: The collection's UID
295
-     *
296
-     * @return	void
297
-     */
298
-    protected function showSingleCollection($id) {
289
+	/**
290
+	 * Builds a collection's list
291
+	 *
292
+	 * @access	protected
293
+	 *
294
+	 * @param	integer		$id: The collection's UID
295
+	 *
296
+	 * @return	void
297
+	 */
298
+	protected function showSingleCollection($id) {
299 299
 
300
-        // Should user-defined collections be shown?
301
-        if (empty($this->conf['show_userdefined'])) {
300
+		// Should user-defined collections be shown?
301
+		if (empty($this->conf['show_userdefined'])) {
302 302
 
303
-            $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
303
+			$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
304 304
 
305
-        } elseif ($this->conf['show_userdefined'] > 0) {
305
+		} elseif ($this->conf['show_userdefined'] > 0) {
306 306
 
307
-            $additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
307
+			$additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
308 308
 
309
-        }
309
+		}
310 310
 
311
-        // Get all documents in collection.
312
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
313
-            'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof',
314
-            'tx_dlf_documents',
315
-            'tx_dlf_relations',
316
-            'tx_dlf_collections',
317
-            'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
318
-            '',
319
-            'tx_dlf_documents.title_sorting ASC',
320
-            ''
321
-        );
311
+		// Get all documents in collection.
312
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
313
+			'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof',
314
+			'tx_dlf_documents',
315
+			'tx_dlf_relations',
316
+			'tx_dlf_collections',
317
+			'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
318
+			'',
319
+			'tx_dlf_documents.title_sorting ASC',
320
+			''
321
+		);
322 322
 
323
-        $toplevel = array ();
323
+		$toplevel = array ();
324 324
 
325
-        $subparts = array ();
325
+		$subparts = array ();
326 326
 
327
-        $listMetadata = array ();
327
+		$listMetadata = array ();
328 328
 
329
-        // Process results.
330
-        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
329
+		// Process results.
330
+		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
331 331
 
332
-            if (empty($listMetadata)) {
332
+			if (empty($listMetadata)) {
333 333
 
334
-                $listMetadata = array (
335
-                    'label' => htmlspecialchars($resArray['collLabel']),
336
-                    'description' => $this->pi_RTEcssText($resArray['collDesc']),
337
-                    'thumbnail' => htmlspecialchars($resArray['collThumb']),
338
-                    'options' => array (
339
-                        'source' => 'collection',
340
-                        'select' => $id,
341
-                        'userid' => $resArray['userid'],
342
-                        'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')),
343
-                        'core' => '',
344
-                        'pid' => $this->conf['pages'],
345
-                        'order' => 'title',
346
-                        'order.asc' => TRUE
347
-                    )
348
-                );
334
+				$listMetadata = array (
335
+					'label' => htmlspecialchars($resArray['collLabel']),
336
+					'description' => $this->pi_RTEcssText($resArray['collDesc']),
337
+					'thumbnail' => htmlspecialchars($resArray['collThumb']),
338
+					'options' => array (
339
+						'source' => 'collection',
340
+						'select' => $id,
341
+						'userid' => $resArray['userid'],
342
+						'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')),
343
+						'core' => '',
344
+						'pid' => $this->conf['pages'],
345
+						'order' => 'title',
346
+						'order.asc' => TRUE
347
+					)
348
+				);
349 349
 
350
-            }
350
+			}
351 351
 
352
-            // Split toplevel documents from volumes.
353
-            if ($resArray['partof'] == 0) {
352
+			// Split toplevel documents from volumes.
353
+			if ($resArray['partof'] == 0) {
354 354
 
355
-                // Prepare document's metadata for sorting.
356
-                $sorting = unserialize($resArray['metadata_sorting']);
355
+				// Prepare document's metadata for sorting.
356
+				$sorting = unserialize($resArray['metadata_sorting']);
357 357
 
358
-                if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
358
+				if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
359 359
 
360
-                    $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
360
+					$sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
361 361
 
362
-                }
362
+				}
363 363
 
364
-                if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
364
+				if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
365 365
 
366
-                    $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
366
+					$sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
367 367
 
368
-                }
368
+				}
369 369
 
370
-                if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
370
+				if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
371 371
 
372
-                    $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
372
+					$sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
373 373
 
374
-                }
374
+				}
375 375
 
376
-                $toplevel[$resArray['uid']] = array (
377
-                    'u' => $resArray['uid'],
378
-                    'h' => '',
379
-                    's' => $sorting,
380
-                    'p' => array ()
381
-                );
376
+				$toplevel[$resArray['uid']] = array (
377
+					'u' => $resArray['uid'],
378
+					'h' => '',
379
+					's' => $sorting,
380
+					'p' => array ()
381
+				);
382 382
 
383
-            } else {
383
+			} else {
384 384
 
385
-                $subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
385
+				$subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
386 386
 
387
-            }
387
+			}
388 388
 
389
-        }
389
+		}
390 390
 
391
-        // Add volumes to the corresponding toplevel documents.
392
-        foreach ($subparts as $partof => $parts) {
391
+		// Add volumes to the corresponding toplevel documents.
392
+		foreach ($subparts as $partof => $parts) {
393 393
 
394
-            if (!empty($toplevel[$partof])) {
394
+			if (!empty($toplevel[$partof])) {
395 395
 
396
-                ksort($parts);
396
+				ksort($parts);
397 397
 
398
-                foreach ($parts as $part) {
398
+				foreach ($parts as $part) {
399 399
 
400
-                    $toplevel[$partof]['p'][] = array ('u' => $part);
400
+					$toplevel[$partof]['p'][] = array ('u' => $part);
401 401
 
402
-                }
402
+				}
403 403
 
404
-            }
404
+			}
405 405
 
406
-        }
406
+		}
407 407
 
408
-        // Save list of documents.
409
-        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
408
+		// Save list of documents.
409
+		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
410 410
 
411
-        $list->reset();
411
+		$list->reset();
412 412
 
413
-        $list->add(array_values($toplevel));
413
+		$list->add(array_values($toplevel));
414 414
 
415
-        $list->metadata = $listMetadata;
415
+		$list->metadata = $listMetadata;
416 416
 
417
-        $list->save();
417
+		$list->save();
418 418
 
419
-        // Clean output buffer.
420
-        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
419
+		// Clean output buffer.
420
+		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
421 421
 
422
-        // Send headers.
423
-        header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid']))));
422
+		// Send headers.
423
+		header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid']))));
424 424
 
425
-        // Flush output buffer and end script processing.
426
-        ob_end_flush();
425
+		// Flush output buffer and end script processing.
426
+		ob_end_flush();
427 427
 
428
-        exit;
428
+		exit;
429 429
 
430
-    }
430
+	}
431 431
 
432 432
 }
Please login to merge, or discard this patch.
plugins/feeds/class.tx_dlf_feeds.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -19,210 +19,210 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_feeds extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
22
+	public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
23 23
 
24
-    /**
25
-     * The main method of the PlugIn
26
-     *
27
-     * @access	public
28
-     *
29
-     * @param	string		$content: The PlugIn content
30
-     * @param	array		$conf: The PlugIn configuration
31
-     *
32
-     * @return	void
33
-     */
34
-    public function main($content, $conf) {
24
+	/**
25
+	 * The main method of the PlugIn
26
+	 *
27
+	 * @access	public
28
+	 *
29
+	 * @param	string		$content: The PlugIn content
30
+	 * @param	array		$conf: The PlugIn configuration
31
+	 *
32
+	 * @return	void
33
+	 */
34
+	public function main($content, $conf) {
35 35
 
36
-        $this->init($conf);
36
+		$this->init($conf);
37 37
 
38
-        // Don't cache the output.
39
-        $this->setCache(FALSE);
38
+		// Don't cache the output.
39
+		$this->setCache(FALSE);
40 40
 
41
-        // Create XML document.
42
-        $rss = new DOMDocument('1.0', 'utf-8');
41
+		// Create XML document.
42
+		$rss = new DOMDocument('1.0', 'utf-8');
43 43
 
44
-        // Add mandatory root element.
45
-        $root = $rss->createElement('rss');
44
+		// Add mandatory root element.
45
+		$root = $rss->createElement('rss');
46 46
 
47
-        $root->setAttribute('version', '2.0');
47
+		$root->setAttribute('version', '2.0');
48 48
 
49
-        // Add channel element.
50
-        $channel = $rss->createElement('channel');
49
+		// Add channel element.
50
+		$channel = $rss->createElement('channel');
51 51
 
52
-        $channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8')));
52
+		$channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8')));
53 53
 
54
-        $channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8')));
54
+		$channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8')));
55 55
 
56
-        if (!empty($this->conf['description'])) {
56
+		if (!empty($this->conf['description'])) {
57 57
 
58
-            $channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8')));
58
+			$channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8')));
59 59
 
60
-        }
60
+		}
61 61
 
62
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
63
-            'tx_dlf_libraries.label AS label',
64
-            'tx_dlf_libraries',
65
-            'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
66
-            '',
67
-            '',
68
-            '1'
69
-        );
62
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
63
+			'tx_dlf_libraries.label AS label',
64
+			'tx_dlf_libraries',
65
+			'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
66
+			'',
67
+			'',
68
+			'1'
69
+		);
70 70
 
71
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
71
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
72 72
 
73
-            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
73
+			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
74 74
 
75
-            $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
75
+			$channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
76 76
 
77
-        }
77
+		}
78 78
 
79
-        $channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME'])));
79
+		$channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME'])));
80 80
 
81
-        $channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8')));
81
+		$channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8')));
82 82
 
83
-        // Add item elements.
84
-        if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) {
83
+		// Add item elements.
84
+		if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) {
85 85
 
86
-            $additionalWhere = '';
86
+			$additionalWhere = '';
87 87
 
88
-            // Check for pre-selected collections.
89
-            if (!empty($this->piVars['collection'])) {
88
+			// Check for pre-selected collections.
89
+			if (!empty($this->piVars['collection'])) {
90 90
 
91
-                $additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']);
91
+				$additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']);
92 92
 
93
-            } elseif (!empty($this->conf['collections'])) {
93
+			} elseif (!empty($this->conf['collections'])) {
94 94
 
95
-                $additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
95
+				$additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
96 96
 
97
-            }
97
+			}
98 98
 
99
-            $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
100
-                'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate',
101
-                'tx_dlf_documents',
102
-                'tx_dlf_relations',
103
-                'tx_dlf_collections',
104
-                'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
105
-                'tx_dlf_documents.uid',
106
-                'tx_dlf_documents.tstamp DESC',
107
-                intval($this->conf['limit'])
108
-            );
99
+			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
100
+				'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate',
101
+				'tx_dlf_documents',
102
+				'tx_dlf_relations',
103
+				'tx_dlf_collections',
104
+				'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
105
+				'tx_dlf_documents.uid',
106
+				'tx_dlf_documents.tstamp DESC',
107
+				intval($this->conf['limit'])
108
+			);
109 109
 
110
-            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
110
+			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
111 111
 
112
-                // Add each record as item element.
113
-                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
112
+				// Add each record as item element.
113
+				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
114 114
 
115
-                    $item = $rss->createElement('item');
115
+					$item = $rss->createElement('item');
116 116
 
117
-                    $title = '';
117
+					$title = '';
118 118
 
119
-                    // Get title of superior document.
120
-                    if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) {
119
+					// Get title of superior document.
120
+					if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) {
121 121
 
122
-                        $superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE);
122
+						$superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE);
123 123
 
124
-                        if (!empty($superiorTitle)) {
124
+						if (!empty($superiorTitle)) {
125 125
 
126
-                            $title .= '['.$superiorTitle.']';
126
+							$title .= '['.$superiorTitle.']';
127 127
 
128
-                        }
128
+						}
129 129
 
130
-                    }
130
+					}
131 131
 
132
-                    // Get title of document.
133
-                    if (!empty($resArray['title'])) {
132
+					// Get title of document.
133
+					if (!empty($resArray['title'])) {
134 134
 
135
-                        $title .= ' '.$resArray['title'];
135
+						$title .= ' '.$resArray['title'];
136 136
 
137
-                    }
137
+					}
138 138
 
139
-                    // Set default title if empty.
140
-                    if (empty($title)) {
139
+					// Set default title if empty.
140
+					if (empty($title)) {
141 141
 
142
-                        $title = $this->pi_getLL('noTitle');
142
+						$title = $this->pi_getLL('noTitle');
143 143
 
144
-                    }
144
+					}
145 145
 
146
-                    // Append volume information.
147
-                    if (!empty($resArray['volume'])) {
146
+					// Append volume information.
147
+					if (!empty($resArray['volume'])) {
148 148
 
149
-                        $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume'];
149
+						$title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume'];
150 150
 
151
-                    }
151
+					}
152 152
 
153
-                    // Is this document new or updated?
154
-                    if ($resArray['crdate'] == $resArray['tstamp']) {
153
+					// Is this document new or updated?
154
+					if ($resArray['crdate'] == $resArray['tstamp']) {
155 155
 
156
-                        $title = $this->pi_getLL('new').' '.trim($title);
156
+						$title = $this->pi_getLL('new').' '.trim($title);
157 157
 
158
-                    } else {
158
+					} else {
159 159
 
160
-                        $title = $this->pi_getLL('update').' '.trim($title);
160
+						$title = $this->pi_getLL('update').' '.trim($title);
161 161
 
162
-                    }
162
+					}
163 163
 
164
-                    $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8')));
164
+					$item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8')));
165 165
 
166
-                    // Add link.
167
-                    $linkConf = array (
168
-                        'parameter' => $this->conf['targetPid'],
169
-                        'forceAbsoluteUrl' => 1,
170
-                        'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE)
171
-                    );
166
+					// Add link.
167
+					$linkConf = array (
168
+						'parameter' => $this->conf['targetPid'],
169
+						'forceAbsoluteUrl' => 1,
170
+						'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE)
171
+					);
172 172
 
173
-                    $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')));
173
+					$item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')));
174 174
 
175
-                    // Add author if applicable.
176
-                    if (!empty($resArray['author'])) {
175
+					// Add author if applicable.
176
+					if (!empty($resArray['author'])) {
177 177
 
178
-                        $item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8')));
178
+						$item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8')));
179 179
 
180
-                    }
180
+					}
181 181
 
182
-                    // Add online publication date.
183
-                    $item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate'])));
182
+					// Add online publication date.
183
+					$item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate'])));
184 184
 
185
-                    // Add internal record identifier.
186
-                    $item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8')));
185
+					// Add internal record identifier.
186
+					$item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8')));
187 187
 
188
-                    $channel->appendChild($item);
188
+					$channel->appendChild($item);
189 189
 
190
-                }
190
+				}
191 191
 
192
-            }
192
+			}
193 193
 
194
-        }
194
+		}
195 195
 
196
-        $root->appendChild($channel);
196
+		$root->appendChild($channel);
197 197
 
198
-        // Build XML output.
199
-        $rss->appendChild($root);
198
+		// Build XML output.
199
+		$rss->appendChild($root);
200 200
 
201
-        $content = $rss->saveXML();
201
+		$content = $rss->saveXML();
202 202
 
203
-        // Clean output buffer.
204
-        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
203
+		// Clean output buffer.
204
+		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
205 205
 
206
-        // Send headers.
207
-        header('HTTP/1.1 200 OK');
206
+		// Send headers.
207
+		header('HTTP/1.1 200 OK');
208 208
 
209
-        header('Cache-Control: no-cache');
209
+		header('Cache-Control: no-cache');
210 210
 
211
-        header('Content-Length: '.strlen($content));
211
+		header('Content-Length: '.strlen($content));
212 212
 
213
-        header('Content-Type: application/rss+xml; charset=utf-8');
213
+		header('Content-Type: application/rss+xml; charset=utf-8');
214 214
 
215
-        header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
215
+		header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
216 216
 
217
-        header('Expires: '.date('r', $GLOBALS['EXEC_TIME']));
217
+		header('Expires: '.date('r', $GLOBALS['EXEC_TIME']));
218 218
 
219
-        echo $content;
219
+		echo $content;
220 220
 
221
-        // Flush output buffer and end script processing.
222
-        ob_end_flush();
221
+		// Flush output buffer and end script processing.
222
+		ob_end_flush();
223 223
 
224
-        exit;
224
+		exit;
225 225
 
226
-    }
226
+	}
227 227
 
228 228
 }
Please login to merge, or discard this patch.
plugins/toc/class.tx_dlf_toc.php 1 patch
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -19,310 +19,310 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_toc extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php';
22
+	public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php';
23 23
 
24
-    /**
25
-     * This holds the active entries according to the currently selected page
26
-     *
27
-     * @var	array
28
-     * @access protected
29
-     */
30
-    protected $activeEntries = array ();
24
+	/**
25
+	 * This holds the active entries according to the currently selected page
26
+	 *
27
+	 * @var	array
28
+	 * @access protected
29
+	 */
30
+	protected $activeEntries = array ();
31 31
 
32
-    /**
33
-     * This builds an array for one menu entry
34
-     *
35
-     * @access	protected
36
-     *
37
-     * @param	array		$entry: The entry's array from tx_dlf_document->getLogicalStructure
38
-     * @param	boolean		$recursive: Whether to include the child entries
39
-     *
40
-     * @return	array		HMENU array for menu entry
41
-     */
42
-    protected function getMenuEntry(array $entry, $recursive = FALSE) {
32
+	/**
33
+	 * This builds an array for one menu entry
34
+	 *
35
+	 * @access	protected
36
+	 *
37
+	 * @param	array		$entry: The entry's array from tx_dlf_document->getLogicalStructure
38
+	 * @param	boolean		$recursive: Whether to include the child entries
39
+	 *
40
+	 * @return	array		HMENU array for menu entry
41
+	 */
42
+	protected function getMenuEntry(array $entry, $recursive = FALSE) {
43 43
 
44
-        $entryArray = array ();
44
+		$entryArray = array ();
45 45
 
46
-        // Set "title", "volume", "type" and "pagination" from $entry array.
47
-        $entryArray['title'] = $entry['label'];
46
+		// Set "title", "volume", "type" and "pagination" from $entry array.
47
+		$entryArray['title'] = $entry['label'];
48 48
 
49
-        $entryArray['volume'] = $entry['volume'];
49
+		$entryArray['volume'] = $entry['volume'];
50 50
 
51
-        $entryArray['orderlabel'] = $entry['orderlabel'];
51
+		$entryArray['orderlabel'] = $entry['orderlabel'];
52 52
 
53
-        $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']);
53
+		$entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']);
54 54
 
55
-        $entryArray['pagination'] = $entry['pagination'];
55
+		$entryArray['pagination'] = $entry['pagination'];
56 56
 
57
-        $entryArray['_OVERRIDE_HREF'] = '';
57
+		$entryArray['_OVERRIDE_HREF'] = '';
58 58
 
59
-        $entryArray['doNotLinkIt'] = 1;
59
+		$entryArray['doNotLinkIt'] = 1;
60 60
 
61
-        $entryArray['ITEM_STATE'] = 'NO';
61
+		$entryArray['ITEM_STATE'] = 'NO';
62 62
 
63
-        // Build menu links based on the $entry['points'] array.
64
-        if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) {
63
+		// Build menu links based on the $entry['points'] array.
64
+		if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) {
65 65
 
66
-            $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']);
66
+			$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']);
67 67
 
68
-            $entryArray['doNotLinkIt'] = 0;
68
+			$entryArray['doNotLinkIt'] = 0;
69 69
 
70
-            if ($this->conf['basketButton']) {
70
+			if ($this->conf['basketButton']) {
71 71
 
72
-                $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
72
+				$entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
73 73
 
74
-            }
74
+			}
75 75
 
76
-        } elseif (!empty($entry['points']) && is_string($entry['points'])) {
76
+		} elseif (!empty($entry['points']) && is_string($entry['points'])) {
77 77
 
78
-            $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
78
+			$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
79 79
 
80
-            $entryArray['doNotLinkIt'] = 0;
80
+			$entryArray['doNotLinkIt'] = 0;
81 81
 
82
-            if ($this->conf['basketButton']) {
82
+			if ($this->conf['basketButton']) {
83 83
 
84
-                $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
84
+				$entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
85 85
 
86
-            }
86
+			}
87 87
 
88
-        } elseif (!empty($entry['targetUid'])) {
88
+		} elseif (!empty($entry['targetUid'])) {
89 89
 
90
-            $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
90
+			$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
91 91
 
92
-            $entryArray['doNotLinkIt'] = 0;
92
+			$entryArray['doNotLinkIt'] = 0;
93 93
 
94
-            if ($this->conf['basketButton']) {
94
+			if ($this->conf['basketButton']) {
95 95
 
96
-                $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['targetUid']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
96
+				$entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['targetUid']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>';
97 97
 
98
-            }
98
+			}
99 99
 
100
-        }
100
+		}
101 101
 
102
-        // Set "ITEM_STATE" to "CUR" if this entry points to current page.
103
-        if (in_array($entry['id'], $this->activeEntries)) {
102
+		// Set "ITEM_STATE" to "CUR" if this entry points to current page.
103
+		if (in_array($entry['id'], $this->activeEntries)) {
104 104
 
105
-            $entryArray['ITEM_STATE'] = 'CUR';
105
+			$entryArray['ITEM_STATE'] = 'CUR';
106 106
 
107
-        }
107
+		}
108 108
 
109
-        // Build sub-menu if available and called recursively.
110
-        if ($recursive == TRUE && !empty($entry['children'])) {
109
+		// Build sub-menu if available and called recursively.
110
+		if ($recursive == TRUE && !empty($entry['children'])) {
111 111
 
112
-            // Build sub-menu only if one of the following conditions apply:
113
-            // 1. "expAll" is set for menu
114
-            // 2. Current menu node is in rootline
115
-            // 3. Current menu node points to another file
116
-            // 4. Current menu node has no corresponding images
117
-            if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) {
112
+			// Build sub-menu only if one of the following conditions apply:
113
+			// 1. "expAll" is set for menu
114
+			// 2. Current menu node is in rootline
115
+			// 3. Current menu node points to another file
116
+			// 4. Current menu node has no corresponding images
117
+			if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) {
118 118
 
119
-                $entryArray['_SUB_MENU'] = array ();
119
+				$entryArray['_SUB_MENU'] = array ();
120 120
 
121
-                foreach ($entry['children'] as $child) {
121
+				foreach ($entry['children'] as $child) {
122 122
 
123
-                    // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page.
124
-                    if (in_array($child['id'], $this->activeEntries)) {
123
+					// Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page.
124
+					if (in_array($child['id'], $this->activeEntries)) {
125 125
 
126
-                        $entryArray['ITEM_STATE'] = 'ACT';
126
+						$entryArray['ITEM_STATE'] = 'ACT';
127 127
 
128
-                    }
128
+					}
129 129
 
130
-                    $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE);
130
+					$entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE);
131 131
 
132
-                }
132
+				}
133 133
 
134
-            }
134
+			}
135 135
 
136
-            // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries.
137
-            $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB');
136
+			// Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries.
137
+			$entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB');
138 138
 
139
-        }
139
+		}
140 140
 
141
-        return $entryArray;
141
+		return $entryArray;
142 142
 
143
-    }
143
+	}
144 144
 
145
-    /**
146
-     * The main method of the PlugIn
147
-     *
148
-     * @access	public
149
-     *
150
-     * @param	string		$content: The PlugIn content
151
-     * @param	array		$conf: The PlugIn configuration
152
-     *
153
-     * @return	string		The content that is displayed on the website
154
-     */
155
-    public function main($content, $conf) {
145
+	/**
146
+	 * The main method of the PlugIn
147
+	 *
148
+	 * @access	public
149
+	 *
150
+	 * @param	string		$content: The PlugIn content
151
+	 * @param	array		$conf: The PlugIn configuration
152
+	 *
153
+	 * @return	string		The content that is displayed on the website
154
+	 */
155
+	public function main($content, $conf) {
156 156
 
157
-        $this->init($conf);
157
+		$this->init($conf);
158 158
 
159
-        // Check for typoscript configuration to prevent fatal error.
160
-        if (empty($this->conf['menuConf.'])) {
159
+		// Check for typoscript configuration to prevent fatal error.
160
+		if (empty($this->conf['menuConf.'])) {
161 161
 
162
-            if (TYPO3_DLOG) {
162
+			if (TYPO3_DLOG) {
163 163
 
164
-                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
164
+				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
165 165
 
166
-            }
166
+			}
167 167
 
168
-            return $content;
168
+			return $content;
169 169
 
170
-        }
170
+		}
171 171
 
172
-        // Load template file.
173
-        if (!empty($this->conf['templateFile'])) {
172
+		// Load template file.
173
+		if (!empty($this->conf['templateFile'])) {
174 174
 
175
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
175
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
176 176
 
177
-        } else {
177
+		} else {
178 178
 
179
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###');
179
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###');
180 180
 
181
-        }
181
+		}
182 182
 
183
-        $TSconfig = array ();
183
+		$TSconfig = array ();
184 184
 
185
-        $TSconfig['special'] = 'userfunction';
185
+		$TSconfig['special'] = 'userfunction';
186 186
 
187
-        $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray';
187
+		$TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray';
188 188
 
189
-        $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig);
189
+		$TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig);
190 190
 
191
-        $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig);
191
+		$markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig);
192 192
 
193
-        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
193
+		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
194 194
 
195
-        return $this->pi_wrapInBaseClass($content);
195
+		return $this->pi_wrapInBaseClass($content);
196 196
 
197
-    }
197
+	}
198 198
 
199
-    /**
200
-     * This builds a menu array for HMENU
201
-     *
202
-     * @access	public
203
-     *
204
-     * @param	string		$content: The PlugIn content
205
-     * @param	array		$conf: The PlugIn configuration
206
-     *
207
-     * @return	array		HMENU array
208
-     */
209
-    public function makeMenuArray($content, $conf) {
199
+	/**
200
+	 * This builds a menu array for HMENU
201
+	 *
202
+	 * @access	public
203
+	 *
204
+	 * @param	string		$content: The PlugIn content
205
+	 * @param	array		$conf: The PlugIn configuration
206
+	 *
207
+	 * @return	array		HMENU array
208
+	 */
209
+	public function makeMenuArray($content, $conf) {
210 210
 
211
-        $this->init($conf);
211
+		$this->init($conf);
212 212
 
213
-        // Load current document.
214
-        $this->loadDocument();
213
+		// Load current document.
214
+		$this->loadDocument();
215 215
 
216
-        if ($this->doc === NULL) {
216
+		if ($this->doc === NULL) {
217 217
 
218
-            // Quit without doing anything if required variables are not set.
219
-            return array ();
218
+			// Quit without doing anything if required variables are not set.
219
+			return array ();
220 220
 
221
-        } else {
221
+		} else {
222 222
 
223
-            if (!empty($this->piVars['logicalPage'])) {
223
+			if (!empty($this->piVars['logicalPage'])) {
224 224
 
225
-                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
226
-                // The logical page parameter should not appear again
227
-                unset($this->piVars['logicalPage']);
225
+				$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
226
+				// The logical page parameter should not appear again
227
+				unset($this->piVars['logicalPage']);
228 228
 
229
-                }
229
+				}
230 230
 
231
-            // Set default values for page if not set.
232
-            // $this->piVars['page'] may be integer or string (physical structure @ID)
233
-            if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
231
+			// Set default values for page if not set.
232
+			// $this->piVars['page'] may be integer or string (physical structure @ID)
233
+			if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
234 234
 
235
-                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
235
+				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
236 236
 
237
-            } else {
237
+			} else {
238 238
 
239
-                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
239
+				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
240 240
 
241
-            }
241
+			}
242 242
 
243
-            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
243
+			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
244 244
 
245
-        }
245
+		}
246 246
 
247
-        $menuArray = array ();
247
+		$menuArray = array ();
248 248
 
249
-        // Does the document have physical elements or is it an external file?
250
-        if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) {
249
+		// Does the document have physical elements or is it an external file?
250
+		if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) {
251 251
 
252
-            // Get all logical units the current page or track is a part of.
253
-            if (!empty($this->piVars['page']) && $this->doc->physicalStructure) {
252
+			// Get all logical units the current page or track is a part of.
253
+			if (!empty($this->piVars['page']) && $this->doc->physicalStructure) {
254 254
 
255
-                $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]);
255
+				$this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]);
256 256
 
257
-                if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) {
257
+				if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) {
258 258
 
259
-                    $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]);
259
+					$this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]);
260 260
 
261
-                }
261
+				}
262 262
 
263
-            }
263
+			}
264 264
 
265
-            // Go through table of contents and create all menu entries.
266
-            foreach ($this->doc->tableOfContents as $entry) {
265
+			// Go through table of contents and create all menu entries.
266
+			foreach ($this->doc->tableOfContents as $entry) {
267 267
 
268
-                $menuArray[] = $this->getMenuEntry($entry, TRUE);
268
+				$menuArray[] = $this->getMenuEntry($entry, TRUE);
269 269
 
270
-            }
270
+			}
271 271
 
272
-        } else {
272
+		} else {
273 273
 
274
-            // Go through table of contents and create top-level menu entries.
275
-            foreach ($this->doc->tableOfContents as $entry) {
274
+			// Go through table of contents and create top-level menu entries.
275
+			foreach ($this->doc->tableOfContents as $entry) {
276 276
 
277
-                $menuArray[] = $this->getMenuEntry($entry, FALSE);
277
+				$menuArray[] = $this->getMenuEntry($entry, FALSE);
278 278
 
279
-            }
279
+			}
280 280
 
281
-            // Get all child documents from database.
282
-            $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures');
281
+			// Get all child documents from database.
282
+			$whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures');
283 283
 
284
-            if ($this->conf['excludeOther']) {
284
+			if ($this->conf['excludeOther']) {
285 285
 
286
-                $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']);
286
+				$whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']);
287 287
 
288
-            }
288
+			}
289 289
 
290
-            // Build table of contents from database.
291
-            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
292
-                'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type',
293
-                'tx_dlf_documents,tx_dlf_structures',
294
-                $whereClause,
295
-                '',
296
-                'tx_dlf_documents.volume_sorting',
297
-                ''
298
-            );
290
+			// Build table of contents from database.
291
+			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
292
+				'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type',
293
+				'tx_dlf_documents,tx_dlf_structures',
294
+				$whereClause,
295
+				'',
296
+				'tx_dlf_documents.volume_sorting',
297
+				''
298
+			);
299 299
 
300
-            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
300
+			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
301 301
 
302
-                $menuArray[0]['ITEM_STATE'] = 'CURIFSUB';
302
+				$menuArray[0]['ITEM_STATE'] = 'CURIFSUB';
303 303
 
304
-                $menuArray[0]['_SUB_MENU'] = array ();
304
+				$menuArray[0]['_SUB_MENU'] = array ();
305 305
 
306
-                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
306
+				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
307 307
 
308
-                    $entry = array (
309
-                        'label' => $resArray['title'],
310
-                        'type' => $resArray['type'],
311
-                        'volume' => $resArray['volume'],
312
-                        'pagination' => '',
313
-                        'targetUid' => $resArray['uid']
314
-                    );
308
+					$entry = array (
309
+						'label' => $resArray['title'],
310
+						'type' => $resArray['type'],
311
+						'volume' => $resArray['volume'],
312
+						'pagination' => '',
313
+						'targetUid' => $resArray['uid']
314
+					);
315 315
 
316
-                    $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE);
316
+					$menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE);
317 317
 
318
-                }
318
+				}
319 319
 
320
-            }
320
+			}
321 321
 
322
-        }
322
+		}
323 323
 
324
-        return $menuArray;
324
+		return $menuArray;
325 325
 
326
-    }
326
+	}
327 327
 
328 328
 }
Please login to merge, or discard this patch.
ext_localconf.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if (!defined('TYPO3_MODE')) {
13
-    die ('Access denied.');
13
+	die ('Access denied.');
14 14
 }
15 15
 
16 16
 // Register plugins.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 if (TYPO3_MODE === 'FE') {
78 78
 
79
-    /*
79
+	/*
80 80
 	 * docTypeCheck user function to use in Typoscript
81 81
 	 *
82 82
 	 * @access	public
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return	boolean		TRUE if document type matches, FALSE if not
92 92
 	 **/
93
-    function user_dlf_docTypeCheck($type) {
93
+	function user_dlf_docTypeCheck($type) {
94 94
 
95
-        $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype');
95
+		$hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype');
96 96
 
97
-        return ($hook->getDocType() === $type);
97
+		return ($hook->getDocType() === $type);
98 98
 
99
-    }
99
+	}
100 100
 
101 101
 }
Please login to merge, or discard this patch.
hooks/class.tx_dlf_em.php 1 patch
Indentation   +526 added lines, -526 removed lines patch added patch discarded remove patch
@@ -19,660 +19,660 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_em {
21 21
 
22
-    /**
23
-     * This holds the current configuration
24
-     *
25
-     * @var	array
26
-     * @access protected
27
-     */
28
-    protected $conf = array ();
29
-
30
-    /**
31
-     * This holds the output ready to return
32
-     *
33
-     * @var	string
34
-     * @access protected
35
-     */
36
-    protected $content = '';
37
-
38
-    /**
39
-     * Check if a connection to a Solr server could be established with the given credentials.
40
-     *
41
-     * @access	public
42
-     *
43
-     * @param	array		&$params: An array with parameters
44
-     * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
45
-     *
46
-     * @return	string		Message informing the user of success or failure
47
-     */
48
-    public function checkSolrConnection(&$params, &$pObj) {
49
-
50
-        // Prepend username and password to hostname.
51
-        if (!empty($this->conf['solrUser']) && !empty($this->conf['solrPass'])) {
22
+	/**
23
+	 * This holds the current configuration
24
+	 *
25
+	 * @var	array
26
+	 * @access protected
27
+	 */
28
+	protected $conf = array ();
29
+
30
+	/**
31
+	 * This holds the output ready to return
32
+	 *
33
+	 * @var	string
34
+	 * @access protected
35
+	 */
36
+	protected $content = '';
37
+
38
+	/**
39
+	 * Check if a connection to a Solr server could be established with the given credentials.
40
+	 *
41
+	 * @access	public
42
+	 *
43
+	 * @param	array		&$params: An array with parameters
44
+	 * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
45
+	 *
46
+	 * @return	string		Message informing the user of success or failure
47
+	 */
48
+	public function checkSolrConnection(&$params, &$pObj) {
49
+
50
+		// Prepend username and password to hostname.
51
+		if (!empty($this->conf['solrUser']) && !empty($this->conf['solrPass'])) {
52 52
 
53
-            $host = $this->conf['solrUser'].':'.$this->conf['solrPass'].'@'.(!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost');
54
-
55
-        } else {
56
-
57
-            $host = (!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost');
58
-
59
-        }
53
+			$host = $this->conf['solrUser'].':'.$this->conf['solrPass'].'@'.(!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost');
54
+
55
+		} else {
56
+
57
+			$host = (!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost');
58
+
59
+		}
60 60
 
61
-        // Set port if not set.
62
-        $port = (!empty($this->conf['solrPort']) ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['solrPort'], 0, 65535, 8180) : 8180);
63
-
64
-        // Trim path and append trailing slash.
65
-        $path = (!empty($this->conf['solrPath']) ? trim($this->conf['solrPath'], '/').'/' : '');
66
-
67
-        // Build request URI.
68
-        $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml';
69
-
70
-        $context = stream_context_create(array (
71
-            'http' => array (
72
-                'method' => 'GET',
73
-                'user_agent' => (!empty($this->conf['useragent']) ? $this->conf['useragent'] : ini_get('user_agent'))
74
-            )
75
-        ));
61
+		// Set port if not set.
62
+		$port = (!empty($this->conf['solrPort']) ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['solrPort'], 0, 65535, 8180) : 8180);
63
+
64
+		// Trim path and append trailing slash.
65
+		$path = (!empty($this->conf['solrPath']) ? trim($this->conf['solrPath'], '/').'/' : '');
66
+
67
+		// Build request URI.
68
+		$url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml';
69
+
70
+		$context = stream_context_create(array (
71
+			'http' => array (
72
+				'method' => 'GET',
73
+				'user_agent' => (!empty($this->conf['useragent']) ? $this->conf['useragent'] : ini_get('user_agent'))
74
+			)
75
+		));
76 76
 
77
-        // Try to connect to Solr server.
78
-        $response = @simplexml_load_string(file_get_contents($url, FALSE, $context));
79
-
80
-        // Check status code.
81
-        if ($response) {
82
-
83
-            $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]');
84
-
85
-            if (is_array($status)) {
86
-
87
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
88
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
89
-                    sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]),
90
-                    $GLOBALS['LANG']->getLL('solr.connected'),
91
-                    ($status[0] == 0 ? \TYPO3\CMS\Core\Messaging\FlashMessage::OK : \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING),
92
-                    FALSE
93
-                );
94
-
95
-                $this->content .= $message->render();
96
-
97
-                return $this->content;
98
-
99
-            }
100
-
101
-        }
102
-
103
-        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
104
-            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
105
-            sprintf($GLOBALS['LANG']->getLL('solr.error'), $url),
106
-            $GLOBALS['LANG']->getLL('solr.notConnected'),
107
-            \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
108
-            FALSE
109
-        );
110
-
111
-        $this->content .= $message->render();
112
-
113
-        return $this->content;
114
-
115
-    }
116
-
117
-    /**
118
-     * Make sure a backend user exists and is configured properly.
119
-     *
120
-     * @access	protected
121
-     *
122
-     * @param	boolean		$checkOnly: Just check the user or change it, too?
123
-     * @param	integer		$groupUid: UID of the corresponding usergroup
124
-     *
125
-     * @return	integer		UID of user or 0 if something is wrong
126
-     */
127
-    protected function checkCliUser($checkOnly, $groupUid) {
77
+		// Try to connect to Solr server.
78
+		$response = @simplexml_load_string(file_get_contents($url, FALSE, $context));
79
+
80
+		// Check status code.
81
+		if ($response) {
82
+
83
+			$status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]');
84
+
85
+			if (is_array($status)) {
86
+
87
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
88
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
89
+					sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]),
90
+					$GLOBALS['LANG']->getLL('solr.connected'),
91
+					($status[0] == 0 ? \TYPO3\CMS\Core\Messaging\FlashMessage::OK : \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING),
92
+					FALSE
93
+				);
94
+
95
+				$this->content .= $message->render();
96
+
97
+				return $this->content;
98
+
99
+			}
100
+
101
+		}
102
+
103
+		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
104
+			'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
105
+			sprintf($GLOBALS['LANG']->getLL('solr.error'), $url),
106
+			$GLOBALS['LANG']->getLL('solr.notConnected'),
107
+			\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
108
+			FALSE
109
+		);
110
+
111
+		$this->content .= $message->render();
112
+
113
+		return $this->content;
114
+
115
+	}
116
+
117
+	/**
118
+	 * Make sure a backend user exists and is configured properly.
119
+	 *
120
+	 * @access	protected
121
+	 *
122
+	 * @param	boolean		$checkOnly: Just check the user or change it, too?
123
+	 * @param	integer		$groupUid: UID of the corresponding usergroup
124
+	 *
125
+	 * @return	integer		UID of user or 0 if something is wrong
126
+	 */
127
+	protected function checkCliUser($checkOnly, $groupUid) {
128 128
 
129
-        // Set default return value.
130
-        $usrUid = 0;
129
+		// Set default return value.
130
+		$usrUid = 0;
131 131
 
132
-        // Check if user "_cli_dlf" exists, is no admin and is not disabled.
133
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
134
-            'uid,admin,usergroup',
135
-            'be_users',
136
-            'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users')
137
-        );
132
+		// Check if user "_cli_dlf" exists, is no admin and is not disabled.
133
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
134
+			'uid,admin,usergroup',
135
+			'be_users',
136
+			'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users')
137
+		);
138 138
 
139
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
139
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
140 140
 
141
-            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
141
+			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
142 142
 
143
-            // Explode comma-separated list.
144
-            $resArray['usergroup'] = explode(',', $resArray['usergroup']);
143
+			// Explode comma-separated list.
144
+			$resArray['usergroup'] = explode(',', $resArray['usergroup']);
145 145
 
146
-            // Check if user is not disabled.
147
-            $result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
148
-                '1',
149
-                'be_users',
150
-                'uid='.intval($resArray['uid']).\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users')
151
-            );
146
+			// Check if user is not disabled.
147
+			$result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
148
+				'1',
149
+				'be_users',
150
+				'uid='.intval($resArray['uid']).\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users')
151
+			);
152 152
 
153
-            // Check if user is configured properly.
154
-            if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0
155
-                    && !$resArray['admin']
156
-                    && $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) {
153
+			// Check if user is configured properly.
154
+			if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0
155
+					&& !$resArray['admin']
156
+					&& $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) {
157 157
 
158
-                $usrUid = $resArray['uid'];
158
+				$usrUid = $resArray['uid'];
159 159
 
160
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
161
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
162
-                    $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'),
163
-                    $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'),
164
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
165
-                    FALSE
166
-                );
160
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
161
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
162
+					$GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'),
163
+					$GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'),
164
+					\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
165
+					FALSE
166
+				);
167 167
 
168
-            } else {
168
+			} else {
169 169
 
170
-                if (!$checkOnly && $groupUid) {
170
+				if (!$checkOnly && $groupUid) {
171 171
 
172
-                    // Keep exisiting values and add the new ones.
173
-                    $usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup']));
172
+					// Keep exisiting values and add the new ones.
173
+					$usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup']));
174 174
 
175
-                    // Try to configure user.
176
-                    $data = array ();
177
-                    $data['be_users'][$resArray['uid']] = array (
178
-                        'admin' => 0,
179
-                        'usergroup' => implode(',', $usergroup),
180
-                        $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0,
181
-                        $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0,
182
-                        $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0
183
-                    );
175
+					// Try to configure user.
176
+					$data = array ();
177
+					$data['be_users'][$resArray['uid']] = array (
178
+						'admin' => 0,
179
+						'usergroup' => implode(',', $usergroup),
180
+						$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0,
181
+						$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0,
182
+						$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0
183
+					);
184 184
 
185
-                    tx_dlf_helper::processDBasAdmin($data);
185
+					tx_dlf_helper::processDBasAdmin($data);
186 186
 
187
-                    // Check if configuration was successful.
188
-                    if ($this->checkCliUser(TRUE, $groupUid)) {
187
+					// Check if configuration was successful.
188
+					if ($this->checkCliUser(TRUE, $groupUid)) {
189 189
 
190
-                        $usrUid = $resArray['uid'];
190
+						$usrUid = $resArray['uid'];
191 191
 
192
-                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
193
-                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
194
-                            $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'),
195
-                            $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'),
196
-                            \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
197
-                            FALSE
198
-                        );
199
-
200
-                    } else {
201
-
202
-                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
203
-                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
204
-                            $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
205
-                            $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
206
-                            \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
207
-                            FALSE
208
-                        );
192
+						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
193
+							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
194
+							$GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'),
195
+							$GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'),
196
+							\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
197
+							FALSE
198
+						);
199
+
200
+					} else {
201
+
202
+						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
203
+							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
204
+							$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
205
+							$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
206
+							\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
207
+							FALSE
208
+						);
209 209
 
210
-                    }
211
-
212
-                } else {
213
-
214
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
215
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
216
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
217
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
218
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
219
-                        FALSE
220
-                    );
221
-
222
-                }
223
-
224
-            }
225
-
226
-        } else {
227
-
228
-            if (!$checkOnly && $groupUid) {
229
-
230
-                // Try to create user.
231
-                $tempUid = uniqid('NEW');
232
-
233
-                $data = array ();
234
-                $data['be_users'][$tempUid] = array (
235
-                    'pid' => 0,
236
-                    'username' => '_cli_dlf',
237
-                    'password' => md5($tempUid),
238
-                    'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'),
239
-                    'usergroup' => intval($groupUid)
240
-                );
210
+					}
211
+
212
+				} else {
213
+
214
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
215
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
216
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
217
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
218
+						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
219
+						FALSE
220
+					);
221
+
222
+				}
223
+
224
+			}
225
+
226
+		} else {
227
+
228
+			if (!$checkOnly && $groupUid) {
229
+
230
+				// Try to create user.
231
+				$tempUid = uniqid('NEW');
232
+
233
+				$data = array ();
234
+				$data['be_users'][$tempUid] = array (
235
+					'pid' => 0,
236
+					'username' => '_cli_dlf',
237
+					'password' => md5($tempUid),
238
+					'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'),
239
+					'usergroup' => intval($groupUid)
240
+				);
241 241
 
242
-                $substUid = tx_dlf_helper::processDBasAdmin($data);
242
+				$substUid = tx_dlf_helper::processDBasAdmin($data);
243 243
 
244
-                // Check if creation was successful.
245
-                if (!empty($substUid[$tempUid])) {
246
-
247
-                    $usrUid = $substUid[$tempUid];
248
-
249
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
250
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
251
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'),
252
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'),
253
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
254
-                        FALSE
255
-                    );
244
+				// Check if creation was successful.
245
+				if (!empty($substUid[$tempUid])) {
246
+
247
+					$usrUid = $substUid[$tempUid];
248
+
249
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
250
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
251
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'),
252
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'),
253
+						\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
254
+						FALSE
255
+					);
256 256
 
257
-                } else {
257
+				} else {
258 258
 
259
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
260
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
261
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
262
-                        $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
263
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
264
-                        FALSE
265
-                    );
259
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
260
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
261
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
262
+						$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
263
+						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
264
+						FALSE
265
+					);
266 266
 
267
-                }
267
+				}
268 268
 
269
-            } else {
269
+			} else {
270 270
 
271
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
272
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
273
-                    $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
274
-                    $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
275
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
276
-                    FALSE
277
-                );
271
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
272
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
273
+					$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
274
+					$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
275
+					\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
276
+					FALSE
277
+				);
278 278
 
279
-            }
279
+			}
280 280
 
281
-        }
281
+		}
282 282
 
283
-        $this->content = $message->render();
283
+		$this->content = $message->render();
284 284
 
285
-        return $usrUid;
285
+		return $usrUid;
286 286
 
287
-    }
287
+	}
288 288
 
289
-    /**
290
-     * Make sure a backend usergroup exists and is configured properly.
291
-     *
292
-     * @access	protected
293
-     *
294
-     * @param	boolean		$checkOnly: Just check the usergroup or change it, too?
295
-     * @param	array		$settings: Array with default settings
296
-     *
297
-     * @return	integer		UID of usergroup or 0 if something is wrong
298
-     */
299
-    protected function checkCliGroup($checkOnly, $settings = array ()) {
289
+	/**
290
+	 * Make sure a backend usergroup exists and is configured properly.
291
+	 *
292
+	 * @access	protected
293
+	 *
294
+	 * @param	boolean		$checkOnly: Just check the usergroup or change it, too?
295
+	 * @param	array		$settings: Array with default settings
296
+	 *
297
+	 * @return	integer		UID of usergroup or 0 if something is wrong
298
+	 */
299
+	protected function checkCliGroup($checkOnly, $settings = array ()) {
300 300
 
301
-        // Set default return value.
302
-        $grpUid = 0;
301
+		// Set default return value.
302
+		$grpUid = 0;
303 303
 
304
-        // Set default configuration for usergroup.
305
-        if (empty($settings)) {
304
+		// Set default configuration for usergroup.
305
+		if (empty($settings)) {
306 306
 
307
-            $settings = array (
308
-                'non_exclude_fields' => array (),
309
-                'tables_select' => array (
310
-                    'tx_dlf_documents',
311
-                    'tx_dlf_collections',
312
-                    'tx_dlf_libraries',
313
-                    'tx_dlf_structures',
314
-                    'tx_dlf_metadata',
315
-                    'tx_dlf_metadataformat',
316
-                    'tx_dlf_formats',
317
-                    'tx_dlf_solrcores'
318
-                ),
319
-                'tables_modify' => array (
320
-                    'tx_dlf_documents',
321
-                    'tx_dlf_collections',
322
-                    'tx_dlf_libraries'
323
-                )
324
-            );
307
+			$settings = array (
308
+				'non_exclude_fields' => array (),
309
+				'tables_select' => array (
310
+					'tx_dlf_documents',
311
+					'tx_dlf_collections',
312
+					'tx_dlf_libraries',
313
+					'tx_dlf_structures',
314
+					'tx_dlf_metadata',
315
+					'tx_dlf_metadataformat',
316
+					'tx_dlf_formats',
317
+					'tx_dlf_solrcores'
318
+				),
319
+				'tables_modify' => array (
320
+					'tx_dlf_documents',
321
+					'tx_dlf_collections',
322
+					'tx_dlf_libraries'
323
+				)
324
+			);
325 325
 
326
-            // Set allowed exclude fields.
327
-            foreach ($settings['tables_modify'] as $table) {
326
+			// Set allowed exclude fields.
327
+			foreach ($settings['tables_modify'] as $table) {
328 328
 
329
-                foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldConf) {
329
+				foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldConf) {
330 330
 
331
-                    if (!empty($fieldConf['exclude'])) {
331
+					if (!empty($fieldConf['exclude'])) {
332 332
 
333
-                        $settings['non_exclude_fields'][] = $table.':'.$field;
333
+						$settings['non_exclude_fields'][] = $table.':'.$field;
334 334
 
335
-                    }
335
+					}
336 336
 
337
-                }
337
+				}
338 338
 
339
-            }
339
+			}
340 340
 
341
-        }
341
+		}
342 342
 
343
-        // Check if group "_cli_dlf" exists and is not disabled.
344
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
345
-            'uid,non_exclude_fields,tables_select,tables_modify,'.
346
-                $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'],
347
-            'be_groups',
348
-            'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').
349
-                \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups')
350
-        );
343
+		// Check if group "_cli_dlf" exists and is not disabled.
344
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
345
+			'uid,non_exclude_fields,tables_select,tables_modify,'.
346
+				$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'],
347
+			'be_groups',
348
+			'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').
349
+				\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups')
350
+		);
351 351
 
352
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
352
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
353 353
 
354
-            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
354
+			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
355 355
 
356
-            // Explode comma-separated lists.
357
-            $resArray['non_exclude_fields'] = explode(',', $resArray['non_exclude_fields']);
356
+			// Explode comma-separated lists.
357
+			$resArray['non_exclude_fields'] = explode(',', $resArray['non_exclude_fields']);
358 358
 
359
-            $resArray['tables_select'] = explode(',', $resArray['tables_select']);
359
+			$resArray['tables_select'] = explode(',', $resArray['tables_select']);
360 360
 
361
-            $resArray['tables_modify'] = explode(',', $resArray['tables_modify']);
361
+			$resArray['tables_modify'] = explode(',', $resArray['tables_modify']);
362 362
 
363
-            // Check if usergroup is configured properly.
364
-            if (count(array_diff($settings['non_exclude_fields'], $resArray['non_exclude_fields'])) == 0
365
-                    && count(array_diff($settings['tables_select'], $resArray['tables_select'])) == 0
366
-                    && count(array_diff($settings['tables_modify'], $resArray['tables_modify'])) == 0
367
-                    && $resArray[$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled']] == 0) {
363
+			// Check if usergroup is configured properly.
364
+			if (count(array_diff($settings['non_exclude_fields'], $resArray['non_exclude_fields'])) == 0
365
+					&& count(array_diff($settings['tables_select'], $resArray['tables_select'])) == 0
366
+					&& count(array_diff($settings['tables_modify'], $resArray['tables_modify'])) == 0
367
+					&& $resArray[$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled']] == 0) {
368 368
 
369
-                $grpUid = $resArray['uid'];
369
+				$grpUid = $resArray['uid'];
370 370
 
371
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
372
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
373
-                    $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'),
374
-                    $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'),
375
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
376
-                    FALSE
377
-                );
371
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
372
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
373
+					$GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'),
374
+					$GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'),
375
+					\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
376
+					FALSE
377
+				);
378 378
 
379
-            } else {
379
+			} else {
380 380
 
381
-                if (!$checkOnly) {
381
+				if (!$checkOnly) {
382 382
 
383
-                    // Keep exisiting values and add the new ones.
384
-                    $non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields']));
383
+					// Keep exisiting values and add the new ones.
384
+					$non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields']));
385 385
 
386
-                    $tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select']));
386
+					$tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select']));
387 387
 
388
-                    $tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify']));
388
+					$tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify']));
389 389
 
390
-                    // Try to configure usergroup.
391
-                    $data = array ();
392
-                    $data['be_groups'][$resArray['uid']] = array (
393
-                        'non_exclude_fields' => implode(',', $non_exclude_fields),
394
-                        'tables_select' => implode(',', $tables_select),
395
-                        'tables_modify' => implode(',', $tables_modify),
396
-                        $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0
397
-                    );
390
+					// Try to configure usergroup.
391
+					$data = array ();
392
+					$data['be_groups'][$resArray['uid']] = array (
393
+						'non_exclude_fields' => implode(',', $non_exclude_fields),
394
+						'tables_select' => implode(',', $tables_select),
395
+						'tables_modify' => implode(',', $tables_modify),
396
+						$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0
397
+					);
398 398
 
399
-                    tx_dlf_helper::processDBasAdmin($data);
399
+					tx_dlf_helper::processDBasAdmin($data);
400 400
 
401
-                    // Check if configuration was successful.
402
-                    if ($this->checkCliGroup(TRUE, $settings)) {
401
+					// Check if configuration was successful.
402
+					if ($this->checkCliGroup(TRUE, $settings)) {
403 403
 
404
-                        $grpUid = $resArray['uid'];
404
+						$grpUid = $resArray['uid'];
405 405
 
406
-                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
407
-                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
408
-                            $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'),
409
-                            $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'),
410
-                            \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
411
-                            FALSE
412
-                        );
406
+						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
407
+							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
408
+							$GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'),
409
+							$GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'),
410
+							\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
411
+							FALSE
412
+						);
413 413
 
414
-                    } else {
414
+					} else {
415 415
 
416
-                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
417
-                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
418
-                            $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
419
-                            $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
420
-                            \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
421
-                            FALSE
422
-                        );
416
+						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
417
+							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
418
+							$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
419
+							$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
420
+							\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
421
+							FALSE
422
+						);
423 423
 
424
-                    }
424
+					}
425 425
 
426
-                } else {
426
+				} else {
427 427
 
428
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
429
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
430
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
431
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
432
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
433
-                        FALSE
434
-                    );
428
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
429
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
430
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
431
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
432
+						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
433
+						FALSE
434
+					);
435 435
 
436
-                }
436
+				}
437 437
 
438
-            }
438
+			}
439 439
 
440
-        } else {
440
+		} else {
441 441
 
442
-            if (!$checkOnly) {
442
+			if (!$checkOnly) {
443 443
 
444
-                // Try to create usergroup.
445
-                $tempUid = uniqid('NEW');
444
+				// Try to create usergroup.
445
+				$tempUid = uniqid('NEW');
446 446
 
447
-                $data = array ();
448
-                $data['be_groups'][$tempUid] = array (
449
-                    'pid' => 0,
450
-                    'title' => '_cli_dlf',
451
-                    'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'),
452
-                    'non_exclude_fields' => implode(',', $settings['non_exclude_fields']),
453
-                    'tables_select' => implode(',', $settings['tables_select']),
454
-                    'tables_modify' => implode(',', $settings['tables_modify'])
455
-                );
447
+				$data = array ();
448
+				$data['be_groups'][$tempUid] = array (
449
+					'pid' => 0,
450
+					'title' => '_cli_dlf',
451
+					'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'),
452
+					'non_exclude_fields' => implode(',', $settings['non_exclude_fields']),
453
+					'tables_select' => implode(',', $settings['tables_select']),
454
+					'tables_modify' => implode(',', $settings['tables_modify'])
455
+				);
456 456
 
457
-                $substUid = tx_dlf_helper::processDBasAdmin($data);
457
+				$substUid = tx_dlf_helper::processDBasAdmin($data);
458 458
 
459
-                // Check if creation was successful.
460
-                if (!empty($substUid[$tempUid])) {
459
+				// Check if creation was successful.
460
+				if (!empty($substUid[$tempUid])) {
461 461
 
462
-                    $grpUid = $substUid[$tempUid];
462
+					$grpUid = $substUid[$tempUid];
463 463
 
464
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
465
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
466
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'),
467
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'),
468
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
469
-                        FALSE
470
-                    );
464
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
465
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
466
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'),
467
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'),
468
+						\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
469
+						FALSE
470
+					);
471 471
 
472
-                } else {
472
+				} else {
473 473
 
474
-                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
475
-                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
476
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
477
-                        $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
478
-                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
479
-                        FALSE
480
-                    );
474
+					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
475
+						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
476
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
477
+						$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
478
+						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
479
+						FALSE
480
+					);
481 481
 
482
-                }
482
+				}
483 483
 
484
-            } else {
484
+			} else {
485 485
 
486
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
487
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
488
-                    $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
489
-                    $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
490
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
491
-                    FALSE
492
-                );
486
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
487
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
488
+					$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
489
+					$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
490
+					\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
491
+					FALSE
492
+				);
493 493
 
494
-            }
494
+			}
495 495
 
496
-        }
496
+		}
497 497
 
498
-        $this->content = $message->render();
498
+		$this->content = $message->render();
499 499
 
500
-        return $grpUid;
500
+		return $grpUid;
501 501
 
502
-    }
502
+	}
503 503
 
504
-    /**
505
-     * Make sure a CLI user and group exist.
506
-     *
507
-     * @access	public
508
-     *
509
-     * @param	array		&$params: An array with parameters
510
-     * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
511
-     *
512
-     * @return	string		Message informing the user of success or failure
513
-     */
514
-    public function checkCliUserGroup(&$params, &$pObj) {
504
+	/**
505
+	 * Make sure a CLI user and group exist.
506
+	 *
507
+	 * @access	public
508
+	 *
509
+	 * @param	array		&$params: An array with parameters
510
+	 * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
511
+	 *
512
+	 * @return	string		Message informing the user of success or failure
513
+	 */
514
+	public function checkCliUserGroup(&$params, &$pObj) {
515 515
 
516
-        // Check if usergroup "_cli_dlf" exists and is configured properly.
517
-        $groupUid = $this->checkCliGroup(empty($this->conf['makeCliUserGroup']));
516
+		// Check if usergroup "_cli_dlf" exists and is configured properly.
517
+		$groupUid = $this->checkCliGroup(empty($this->conf['makeCliUserGroup']));
518 518
 
519
-        // Save output because it will be overwritten by the user check method.
520
-        $content = $this->content;
519
+		// Save output because it will be overwritten by the user check method.
520
+		$content = $this->content;
521 521
 
522
-        // Check if user "_cli_dlf" exists and is configured properly.
523
-        $userUid = $this->checkCliUser(empty($this->conf['makeCliUserGroup']), $groupUid);
522
+		// Check if user "_cli_dlf" exists and is configured properly.
523
+		$userUid = $this->checkCliUser(empty($this->conf['makeCliUserGroup']), $groupUid);
524 524
 
525
-        // Merge output from usergroup and user checks.
526
-        $this->content .= $content;
525
+		// Merge output from usergroup and user checks.
526
+		$this->content .= $content;
527 527
 
528
-        // Check if CLI dispatcher is executable.
529
-        if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) {
528
+		// Check if CLI dispatcher is executable.
529
+		if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) {
530 530
 
531
-            $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
532
-                'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
533
-                $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'),
534
-                $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'),
535
-                \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
536
-                FALSE
537
-            );
531
+			$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
532
+				'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
533
+				$GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'),
534
+				$GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'),
535
+				\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
536
+				FALSE
537
+			);
538 538
 
539
-        } else {
539
+		} else {
540 540
 
541
-            $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
542
-                'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
543
-                $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'),
544
-                $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'),
545
-                \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
546
-                FALSE
547
-            );
548
-
549
-        }
550
-
551
-        $this->content .= $message->render();
541
+			$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
542
+				'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
543
+				$GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'),
544
+				$GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'),
545
+				\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
546
+				FALSE
547
+			);
548
+
549
+		}
550
+
551
+		$this->content .= $message->render();
552 552
 
553
-        return $this->content;
553
+		return $this->content;
554 554
 
555
-    }
555
+	}
556 556
 
557
-    /**
558
-     * Make sure the essential namespaces are defined.
559
-     *
560
-     * @access	public
561
-     *
562
-     * @param	array		&$params: An array with parameters
563
-     * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
564
-     *
565
-     * @return	string		Message informing the user of success or failure
566
-     */
567
-    public function checkMetadataFormats(&$params, &$pObj) {
557
+	/**
558
+	 * Make sure the essential namespaces are defined.
559
+	 *
560
+	 * @access	public
561
+	 *
562
+	 * @param	array		&$params: An array with parameters
563
+	 * @param	\TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object
564
+	 *
565
+	 * @return	string		Message informing the user of success or failure
566
+	 */
567
+	public function checkMetadataFormats(&$params, &$pObj) {
568 568
 
569
-        $nsDefined = array (
570
-            'MODS' => FALSE,
571
-            'TEIHDR' => FALSE
572
-        );
569
+		$nsDefined = array (
570
+			'MODS' => FALSE,
571
+			'TEIHDR' => FALSE
572
+		);
573 573
 
574
-        // Check if formats "MODS" and "TEIHDR" exist.
575
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
576
-            'type',
577
-            'tx_dlf_formats',
578
-            '(type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('MODS', 'tx_dlf_formats').' OR type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('TEIHDR', 'tx_dlf_formats').')'.tx_dlf_helper::whereClause('tx_dlf_formats')
579
-        );
574
+		// Check if formats "MODS" and "TEIHDR" exist.
575
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
576
+			'type',
577
+			'tx_dlf_formats',
578
+			'(type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('MODS', 'tx_dlf_formats').' OR type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('TEIHDR', 'tx_dlf_formats').')'.tx_dlf_helper::whereClause('tx_dlf_formats')
579
+		);
580 580
 
581
-        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
581
+		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
582 582
 
583
-            $nsDefined[$resArray['type']] = TRUE;
583
+			$nsDefined[$resArray['type']] = TRUE;
584 584
 
585
-        }
585
+		}
586 586
 
587
-        // Build data array.
588
-        $data = array ();
587
+		// Build data array.
588
+		$data = array ();
589 589
 
590
-        // Add MODS namespace.
591
-        if (!$nsDefined['MODS']) {
590
+		// Add MODS namespace.
591
+		if (!$nsDefined['MODS']) {
592 592
 
593
-            $data['tx_dlf_formats'][uniqid('NEW')] = array (
594
-                'pid' => 0,
595
-                'type' => 'MODS',
596
-                'root' => 'mods',
597
-                'namespace' => 'http://www.loc.gov/mods/v3',
598
-                'class' => 'tx_dlf_mods'
599
-            );
593
+			$data['tx_dlf_formats'][uniqid('NEW')] = array (
594
+				'pid' => 0,
595
+				'type' => 'MODS',
596
+				'root' => 'mods',
597
+				'namespace' => 'http://www.loc.gov/mods/v3',
598
+				'class' => 'tx_dlf_mods'
599
+			);
600 600
 
601
-        }
601
+		}
602 602
 
603
-        // Add TEIHDR namespace.
604
-        if (!$nsDefined['TEIHDR']) {
605
-
606
-            $data['tx_dlf_formats'][uniqid('NEW')] = array (
607
-                'pid' => 0,
608
-                'type' => 'TEIHDR',
609
-                'root' => 'teiHeader',
610
-                'namespace' => 'http://www.tei-c.org/ns/1.0',
611
-                'class' => 'tx_dlf_teihdr'
612
-            );
603
+		// Add TEIHDR namespace.
604
+		if (!$nsDefined['TEIHDR']) {
605
+
606
+			$data['tx_dlf_formats'][uniqid('NEW')] = array (
607
+				'pid' => 0,
608
+				'type' => 'TEIHDR',
609
+				'root' => 'teiHeader',
610
+				'namespace' => 'http://www.tei-c.org/ns/1.0',
611
+				'class' => 'tx_dlf_teihdr'
612
+			);
613 613
 
614
-        }
614
+		}
615 615
 
616
-        if (!empty($data)) {
616
+		if (!empty($data)) {
617 617
 
618
-            // Process changes.
619
-            $substUid = tx_dlf_helper::processDBasAdmin($data);
618
+			// Process changes.
619
+			$substUid = tx_dlf_helper::processDBasAdmin($data);
620 620
 
621
-            if (!empty($substUid)) {
621
+			if (!empty($substUid)) {
622 622
 
623
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
624
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
625
-                    $GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'),
626
-                    $GLOBALS['LANG']->getLL('metadataFormats.nsCreated'),
627
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
628
-                    FALSE
629
-                );
623
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
624
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
625
+					$GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'),
626
+					$GLOBALS['LANG']->getLL('metadataFormats.nsCreated'),
627
+					\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
628
+					FALSE
629
+				);
630 630
 
631
-            } else {
631
+			} else {
632 632
 
633
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
634
-                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
635
-                    $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'),
636
-                    $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'),
637
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
638
-                    FALSE
639
-                );
633
+				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
634
+					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
635
+					$GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'),
636
+					$GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'),
637
+					\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
638
+					FALSE
639
+				);
640 640
 
641
-            }
641
+			}
642 642
 
643
-        } else {
643
+		} else {
644 644
 
645
-            $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
646
-                'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
647
-                $GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'),
648
-                $GLOBALS['LANG']->getLL('metadataFormats.nsOkay'),
649
-                \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
650
-                FALSE
651
-            );
645
+			$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
646
+				'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
647
+				$GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'),
648
+				$GLOBALS['LANG']->getLL('metadataFormats.nsOkay'),
649
+				\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
650
+				FALSE
651
+			);
652 652
 
653
-        }
653
+		}
654 654
 
655
-        $this->content .= $message->render();
655
+		$this->content .= $message->render();
656 656
 
657
-        return $this->content;
657
+		return $this->content;
658 658
 
659
-    }
659
+	}
660 660
 
661
-    /**
662
-     * This is the constructor.
663
-     *
664
-     * @access	public
665
-     *
666
-     * @return	void
667
-     */
668
-    public function __construct() {
661
+	/**
662
+	 * This is the constructor.
663
+	 *
664
+	 * @access	public
665
+	 *
666
+	 * @return	void
667
+	 */
668
+	public function __construct() {
669 669
 
670
-        // Load localization file.
671
-        $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml');
670
+		// Load localization file.
671
+		$GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml');
672 672
 
673
-        // Get current configuration.
674
-        $this->conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data'));
673
+		// Get current configuration.
674
+		$this->conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data'));
675 675
 
676
-    }
676
+	}
677 677
 
678 678
 }
Please login to merge, or discard this patch.
hooks/class.tx_dlf_hacks.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -19,69 +19,69 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_hacks {
21 21
 
22
-    /**
23
-     * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php
24
-     * When using Kitodo.Production the record identifier is saved only in MODS, but not
25
-     * in METS. To get it anyway, we have to do some magic.
26
-     *
27
-     * @access	public
28
-     *
29
-     * @param	SimpleXMLElement		&$xml: The XML object
30
-     * @param	mixed		$record_id: The record identifier
31
-     *
32
-     * @return	void
33
-     */
34
-    public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) {
22
+	/**
23
+	 * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php
24
+	 * When using Kitodo.Production the record identifier is saved only in MODS, but not
25
+	 * in METS. To get it anyway, we have to do some magic.
26
+	 *
27
+	 * @access	public
28
+	 *
29
+	 * @param	SimpleXMLElement		&$xml: The XML object
30
+	 * @param	mixed		$record_id: The record identifier
31
+	 *
32
+	 * @return	void
33
+	 */
34
+	public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) {
35 35
 
36
-        if (!$record_id) {
36
+		if (!$record_id) {
37 37
 
38
-            $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
38
+			$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
39 39
 
40
-            // Get all logical structure nodes with metadata, but without associated METS-Pointers.
41
-            if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
40
+			// Get all logical structure nodes with metadata, but without associated METS-Pointers.
41
+			if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
42 42
 
43
-                $smLinks = $xml->xpath('//mets:structLink/mets:smLink');
43
+				$smLinks = $xml->xpath('//mets:structLink/mets:smLink');
44 44
 
45
-                if ($smLinks) {
45
+				if ($smLinks) {
46 46
 
47
-                    foreach ($smLinks as $smLink) {
47
+					foreach ($smLinks as $smLink) {
48 48
 
49
-                        $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
49
+						$links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
50 50
 
51
-                    }
51
+					}
52 52
 
53
-                    foreach ($divs as $div) {
53
+					foreach ($divs as $div) {
54 54
 
55
-                        if (!empty($links[(string) $div['ID']])) {
55
+						if (!empty($links[(string) $div['ID']])) {
56 56
 
57
-                            $id = (string) $div['DMDID'];
57
+							$id = (string) $div['DMDID'];
58 58
 
59
-                            break;
59
+							break;
60 60
 
61
-                        }
61
+						}
62 62
 
63
-                    }
63
+					}
64 64
 
65
-                }
65
+				}
66 66
 
67
-                if (empty($id)) {
67
+				if (empty($id)) {
68 68
 
69
-                    $id = (string) $divs[0]['DMDID'];
69
+					$id = (string) $divs[0]['DMDID'];
70 70
 
71
-                }
71
+				}
72 72
 
73
-                $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
73
+				$recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
74 74
 
75
-                if (!empty($recordIds[0])) {
75
+				if (!empty($recordIds[0])) {
76 76
 
77
-                    $record_id = (string) $recordIds[0];
77
+					$record_id = (string) $recordIds[0];
78 78
 
79
-                }
79
+				}
80 80
 
81
-            }
81
+			}
82 82
 
83
-        }
83
+		}
84 84
 
85
-    }
85
+	}
86 86
 
87 87
 }
Please login to merge, or discard this patch.
hooks/class.tx_dlf_tcemain.php 1 patch
Indentation   +280 added lines, -280 removed lines patch added patch discarded remove patch
@@ -19,433 +19,433 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_tcemain {
21 21
 
22
-    /**
23
-     * Field post-processing hook for the process_datamap() method.
24
-     *
25
-     * @access	public
26
-     *
27
-     * @param	string		$status: 'new' or 'update'
28
-     * @param	string		$table: The destination table
29
-     * @param	integer		$id: The uid of the record
30
-     * @param	array		&$fieldArray: Array of field values
31
-     * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
32
-     *
33
-     * @return	void
34
-     */
35
-    public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) {
22
+	/**
23
+	 * Field post-processing hook for the process_datamap() method.
24
+	 *
25
+	 * @access	public
26
+	 *
27
+	 * @param	string		$status: 'new' or 'update'
28
+	 * @param	string		$table: The destination table
29
+	 * @param	integer		$id: The uid of the record
30
+	 * @param	array		&$fieldArray: Array of field values
31
+	 * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
32
+	 *
33
+	 * @return	void
34
+	 */
35
+	public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) {
36 36
 
37
-        if ($status == 'new') {
37
+		if ($status == 'new') {
38 38
 
39
-            switch ($table) {
39
+			switch ($table) {
40 40
 
41
-                // Field post-processing for table "tx_dlf_documents".
42
-                case 'tx_dlf_documents':
41
+				// Field post-processing for table "tx_dlf_documents".
42
+				case 'tx_dlf_documents':
43 43
 
44
-                    // Set sorting field if empty.
45
-                    if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) {
44
+					// Set sorting field if empty.
45
+					if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) {
46 46
 
47
-                        $fieldArray['title_sorting'] = $fieldArray['title'];
47
+						$fieldArray['title_sorting'] = $fieldArray['title'];
48 48
 
49
-                    }
49
+					}
50 50
 
51
-                    break;
51
+					break;
52 52
 
53
-                    // Field post-processing for table "tx_dlf_metadata".
54
-                case 'tx_dlf_metadata':
53
+					// Field post-processing for table "tx_dlf_metadata".
54
+				case 'tx_dlf_metadata':
55 55
 
56
-                    // Store field in index if it should appear in lists.
57
-                    if (!empty($fieldArray['is_listed'])) {
56
+					// Store field in index if it should appear in lists.
57
+					if (!empty($fieldArray['is_listed'])) {
58 58
 
59
-                        $fieldArray['index_stored'] = 1;
59
+						$fieldArray['index_stored'] = 1;
60 60
 
61
-                    }
61
+					}
62 62
 
63
-                    // Index field in index if it should be used for auto-completion.
64
-                    if (!empty($fieldArray['index_autocomplete'])) {
63
+					// Index field in index if it should be used for auto-completion.
64
+					if (!empty($fieldArray['index_autocomplete'])) {
65 65
 
66
-                        $fieldArray['index_indexed'] = 1;
66
+						$fieldArray['index_indexed'] = 1;
67 67
 
68
-                    }
68
+					}
69 69
 
70
-                    // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures".
71
-                case 'tx_dlf_collections':
72
-                case 'tx_dlf_libraries':
73
-                case 'tx_dlf_structures':
70
+					// Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures".
71
+				case 'tx_dlf_collections':
72
+				case 'tx_dlf_libraries':
73
+				case 'tx_dlf_structures':
74 74
 
75
-                    // Set label as index name if empty.
76
-                    if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) {
75
+					// Set label as index name if empty.
76
+					if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) {
77 77
 
78
-                        $fieldArray['index_name'] = $fieldArray['label'];
78
+						$fieldArray['index_name'] = $fieldArray['label'];
79 79
 
80
-                    }
80
+					}
81 81
 
82
-                    // Set index name as label if empty.
83
-                    if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) {
82
+					// Set index name as label if empty.
83
+					if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) {
84 84
 
85
-                        $fieldArray['label'] = $fieldArray['index_name'];
85
+						$fieldArray['label'] = $fieldArray['index_name'];
86 86
 
87
-                    }
87
+					}
88 88
 
89
-                    // Ensure that index names don't get mixed up with sorting values.
90
-                    if (substr($fieldArray['index_name'], -8) == '_sorting') {
89
+					// Ensure that index names don't get mixed up with sorting values.
90
+					if (substr($fieldArray['index_name'], -8) == '_sorting') {
91 91
 
92
-                        $fieldArray['index_name'] .= '0';
92
+						$fieldArray['index_name'] .= '0';
93 93
 
94
-                    }
94
+					}
95 95
 
96
-                    break;
96
+					break;
97 97
 
98
-                    // Field post-processing for table "tx_dlf_solrcores".
99
-                case 'tx_dlf_solrcores':
98
+					// Field post-processing for table "tx_dlf_solrcores".
99
+				case 'tx_dlf_solrcores':
100 100
 
101
-                    // Get number of existing cores.
102
-                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
103
-                        '*',
104
-                        'tx_dlf_solrcores',
105
-                        '',
106
-                        '',
107
-                        '',
108
-                        ''
109
-                    );
101
+					// Get number of existing cores.
102
+					$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
103
+						'*',
104
+						'tx_dlf_solrcores',
105
+						'',
106
+						'',
107
+						'',
108
+						''
109
+					);
110 110
 
111
-                    // Get first unused core number.
112
-                    $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result));
111
+					// Get first unused core number.
112
+					$coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result));
113 113
 
114
-                    // Get Solr credentials.
115
-                    $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
114
+					// Get Solr credentials.
115
+					$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
116 116
 
117
-                    // Prepend username and password to hostname.
118
-                    if ($conf['solrUser'] && $conf['solrPass']) {
117
+					// Prepend username and password to hostname.
118
+					if ($conf['solrUser'] && $conf['solrPass']) {
119 119
 
120
-                        $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
120
+						$host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
121 121
 
122
-                    } else {
122
+					} else {
123 123
 
124
-                        $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
124
+						$host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
125 125
 
126
-                    }
126
+					}
127 127
 
128
-                    // Set port if not set.
129
-                    $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180);
128
+					// Set port if not set.
129
+					$port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180);
130 130
 
131
-                    // Trim path and append trailing slash.
132
-                    $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : '');
131
+					// Trim path and append trailing slash.
132
+					$path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : '');
133 133
 
134
-                    $context = stream_context_create(array (
135
-                        'http' => array (
136
-                            'method' => 'GET',
137
-                            'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent'))
138
-                        )
139
-                    ));
134
+					$context = stream_context_create(array (
135
+						'http' => array (
136
+							'method' => 'GET',
137
+							'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent'))
138
+						)
139
+					));
140 140
 
141
-                    // Build request for adding new Solr core.
142
-                    // @see http://wiki.apache.org/solr/CoreAdmin
143
-                    $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber;
141
+					// Build request for adding new Solr core.
142
+					// @see http://wiki.apache.org/solr/CoreAdmin
143
+					$url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber;
144 144
 
145
-                    $response = @simplexml_load_string(file_get_contents($url, FALSE, $context));
145
+					$response = @simplexml_load_string(file_get_contents($url, FALSE, $context));
146 146
 
147
-                    // Process response.
148
-                    if ($response) {
147
+					// Process response.
148
+					if ($response) {
149 149
 
150
-                        $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]');
150
+						$status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]');
151 151
 
152
-                        if ($status && $status[0] == 0) {
152
+						if ($status && $status[0] == 0) {
153 153
 
154
-                            $fieldArray['index_name'] = 'dlfCore'.$coreNumber;
154
+							$fieldArray['index_name'] = 'dlfCore'.$coreNumber;
155 155
 
156
-                            return;
156
+							return;
157 157
 
158
-                        }
158
+						}
159 159
 
160
-                    }
160
+					}
161 161
 
162
-                    if (TYPO3_DLOG) {
162
+					if (TYPO3_DLOG) {
163 163
 
164
-                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
164
+						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
165 165
 
166
-                    }
166
+					}
167 167
 
168
-                    // Solr core could not be created, thus unset field array.
169
-                    $fieldArray = array ();
168
+					// Solr core could not be created, thus unset field array.
169
+					$fieldArray = array ();
170 170
 
171
-                    break;
171
+					break;
172 172
 
173
-            }
173
+			}
174 174
 
175
-        } elseif ($status == 'update') {
175
+		} elseif ($status == 'update') {
176 176
 
177
-            switch ($table) {
177
+			switch ($table) {
178 178
 
179
-                    // Field post-processing for table "tx_dlf_metadata".
180
-                case 'tx_dlf_metadata':
179
+					// Field post-processing for table "tx_dlf_metadata".
180
+				case 'tx_dlf_metadata':
181 181
 
182
-                    // Store field in index if it should appear in lists.
183
-                    if (!empty($fieldArray['is_listed'])) {
182
+					// Store field in index if it should appear in lists.
183
+					if (!empty($fieldArray['is_listed'])) {
184 184
 
185
-                        $fieldArray['index_stored'] = 1;
185
+						$fieldArray['index_stored'] = 1;
186 186
 
187
-                    }
187
+					}
188 188
 
189
-                    if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) {
189
+					if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) {
190 190
 
191
-                        // Get current configuration.
192
-                        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
193
-                            $table.'.is_listed AS is_listed',
194
-                            $table,
195
-                            $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
196
-                            '',
197
-                            '',
198
-                            '1'
199
-                        );
191
+						// Get current configuration.
192
+						$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
193
+							$table.'.is_listed AS is_listed',
194
+							$table,
195
+							$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
196
+							'',
197
+							'',
198
+							'1'
199
+						);
200 200
 
201
-                        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
201
+						if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
202 202
 
203
-                            // Reset storing to current.
204
-                            list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
203
+							// Reset storing to current.
204
+							list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
205 205
 
206
-                        }
206
+						}
207 207
 
208
-                    }
208
+					}
209 209
 
210
-                    // Index field in index if it should be used for auto-completion.
211
-                    if (!empty($fieldArray['index_autocomplete'])) {
210
+					// Index field in index if it should be used for auto-completion.
211
+					if (!empty($fieldArray['index_autocomplete'])) {
212 212
 
213
-                        $fieldArray['index_indexed'] = 1;
213
+						$fieldArray['index_indexed'] = 1;
214 214
 
215
-                    }
215
+					}
216 216
 
217
-                    if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) {
217
+					if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) {
218 218
 
219
-                        // Get current configuration.
220
-                        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
221
-                            $table.'.index_autocomplete AS index_autocomplete',
222
-                            $table,
223
-                            $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
224
-                            '',
225
-                            '',
226
-                            '1'
227
-                        );
219
+						// Get current configuration.
220
+						$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
221
+							$table.'.index_autocomplete AS index_autocomplete',
222
+							$table,
223
+							$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
224
+							'',
225
+							'',
226
+							'1'
227
+						);
228 228
 
229
-                        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
229
+						if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
230 230
 
231
-                            // Reset indexing to current.
232
-                            list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
231
+							// Reset indexing to current.
232
+							list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
233 233
 
234
-                        }
234
+						}
235 235
 
236
-                    }
236
+					}
237 237
 
238
-                    // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures".
239
-                case 'tx_dlf_structures':
238
+					// Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures".
239
+				case 'tx_dlf_structures':
240 240
 
241
-                    // The index name should not be changed in production.
242
-                    if (isset($fieldArray['index_name'])) {
241
+					// The index name should not be changed in production.
242
+					if (isset($fieldArray['index_name'])) {
243 243
 
244
-                        if (count($fieldArray) < 2) {
244
+						if (count($fieldArray) < 2) {
245 245
 
246
-                            // Unset the whole field array.
247
-                            $fieldArray = array ();
246
+							// Unset the whole field array.
247
+							$fieldArray = array ();
248 248
 
249
-                        } else {
249
+						} else {
250 250
 
251
-                            // Get current index name.
252
-                            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
253
-                                $table.'.index_name AS index_name',
254
-                                $table,
255
-                                $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
256
-                                '',
257
-                                '',
258
-                                '1'
259
-                            );
251
+							// Get current index name.
252
+							$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
253
+								$table.'.index_name AS index_name',
254
+								$table,
255
+								$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
256
+								'',
257
+								'',
258
+								'1'
259
+							);
260 260
 
261
-                            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
261
+							if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
262 262
 
263
-                                // Reset index name to current.
264
-                                list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
263
+								// Reset index name to current.
264
+								list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
265 265
 
266
-                            }
266
+							}
267 267
 
268
-                        }
268
+						}
269 269
 
270
-                        if (TYPO3_DLOG) {
270
+						if (TYPO3_DLOG) {
271 271
 
272
-                            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray);
272
+							\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray);
273 273
 
274
-                        }
274
+						}
275 275
 
276
-                    }
276
+					}
277 277
 
278
-                    break;
278
+					break;
279 279
 
280
-            }
280
+			}
281 281
 
282
-        }
282
+		}
283 283
 
284
-    }
284
+	}
285 285
 
286
-    /**
287
-     * After database operations hook for the process_datamap() method.
288
-     *
289
-     * @access	public
290
-     *
291
-     * @param	string		$status: 'new' or 'update'
292
-     * @param	string		$table: The destination table
293
-     * @param	integer		$id: The uid of the record
294
-     * @param	array		&$fieldArray: Array of field values
295
-     * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
296
-     *
297
-     * @return	void
298
-     */
299
-    public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) {
286
+	/**
287
+	 * After database operations hook for the process_datamap() method.
288
+	 *
289
+	 * @access	public
290
+	 *
291
+	 * @param	string		$status: 'new' or 'update'
292
+	 * @param	string		$table: The destination table
293
+	 * @param	integer		$id: The uid of the record
294
+	 * @param	array		&$fieldArray: Array of field values
295
+	 * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
296
+	 *
297
+	 * @return	void
298
+	 */
299
+	public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) {
300 300
 
301
-        if ($status == 'update') {
301
+		if ($status == 'update') {
302 302
 
303
-            switch ($table) {
303
+			switch ($table) {
304 304
 
305
-                // After database operations for table "tx_dlf_documents".
306
-                case 'tx_dlf_documents':
305
+				// After database operations for table "tx_dlf_documents".
306
+				case 'tx_dlf_documents':
307 307
 
308
-                    // Delete/reindex document in Solr according to "hidden" status in database.
309
-                    if (isset($fieldArray['hidden'])) {
308
+					// Delete/reindex document in Solr according to "hidden" status in database.
309
+					if (isset($fieldArray['hidden'])) {
310 310
 
311
-                        // Get Solr core.
312
-                        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
313
-                            'tx_dlf_solrcores.uid',
314
-                            'tx_dlf_solrcores,tx_dlf_documents',
315
-                            'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
316
-                            '',
317
-                            '',
318
-                            '1'
319
-                        );
311
+						// Get Solr core.
312
+						$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
313
+							'tx_dlf_solrcores.uid',
314
+							'tx_dlf_solrcores,tx_dlf_documents',
315
+							'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
316
+							'',
317
+							'',
318
+							'1'
319
+						);
320 320
 
321
-                        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
321
+						if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
322 322
 
323
-                            list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
323
+							list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
324 324
 
325
-                            if ($fieldArray['hidden']) {
325
+							if ($fieldArray['hidden']) {
326 326
 
327
-                                // Establish Solr connection.
328
-                                if ($solr = tx_dlf_solr::getInstance($core)) {
327
+								// Establish Solr connection.
328
+								if ($solr = tx_dlf_solr::getInstance($core)) {
329 329
 
330
-                                    // Delete Solr document.
331
-                                    $solr->service->deleteByQuery('uid:'.$id);
330
+									// Delete Solr document.
331
+									$solr->service->deleteByQuery('uid:'.$id);
332 332
 
333
-                                    $solr->service->commit();
333
+									$solr->service->commit();
334 334
 
335
-                                }
335
+								}
336 336
 
337
-                            } else {
337
+							} else {
338 338
 
339
-                                // Reindex document.
340
-                                $doc =& tx_dlf_document::getInstance($id);
339
+								// Reindex document.
340
+								$doc =& tx_dlf_document::getInstance($id);
341 341
 
342
-                                if ($doc->ready) {
342
+								if ($doc->ready) {
343 343
 
344
-                                    $doc->save($doc->pid, $core);
344
+									$doc->save($doc->pid, $core);
345 345
 
346
-                                } else {
346
+								} else {
347 347
 
348
-                                    if (TYPO3_DLOG) {
348
+									if (TYPO3_DLOG) {
349 349
 
350
-                                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
350
+										\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
351 351
 
352
-                                    }
352
+									}
353 353
 
354
-                                }
354
+								}
355 355
 
356
-                            }
356
+							}
357 357
 
358
-                        }
358
+						}
359 359
 
360
-                    }
360
+					}
361 361
 
362
-                    break;
362
+					break;
363 363
 
364
-            }
364
+			}
365 365
 
366
-        }
366
+		}
367 367
 
368
-    }
368
+	}
369 369
 
370
-    /**
371
-     * Post-processing hook for the process_cmdmap() method.
372
-     *
373
-     * @access	public
374
-     *
375
-     * @param	string		$command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete'
376
-     * @param	string		$table: The destination table
377
-     * @param	integer		$id: The uid of the record
378
-     * @param	mixed		$value: The value for the command
379
-     * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
380
-     *
381
-     * @return	void
382
-     */
383
-    public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) {
370
+	/**
371
+	 * Post-processing hook for the process_cmdmap() method.
372
+	 *
373
+	 * @access	public
374
+	 *
375
+	 * @param	string		$command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete'
376
+	 * @param	string		$table: The destination table
377
+	 * @param	integer		$id: The uid of the record
378
+	 * @param	mixed		$value: The value for the command
379
+	 * @param	\TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
380
+	 *
381
+	 * @return	void
382
+	 */
383
+	public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) {
384 384
 
385
-        if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') {
385
+		if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') {
386 386
 
387
-            // Get Solr core.
388
-            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
389
-                'tx_dlf_solrcores.uid',
390
-                'tx_dlf_solrcores,tx_dlf_documents',
391
-                'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
392
-                '',
393
-                '',
394
-                '1'
395
-            );
387
+			// Get Solr core.
388
+			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
389
+				'tx_dlf_solrcores.uid',
390
+				'tx_dlf_solrcores,tx_dlf_documents',
391
+				'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
392
+				'',
393
+				'',
394
+				'1'
395
+			);
396 396
 
397
-            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
397
+			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
398 398
 
399
-                list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
399
+				list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
400 400
 
401
-                switch ($command) {
401
+				switch ($command) {
402 402
 
403
-                    case 'move':
404
-                    case 'delete':
403
+					case 'move':
404
+					case 'delete':
405 405
 
406
-                        // Establish Solr connection.
407
-                        if ($solr = tx_dlf_solr::getInstance($core)) {
406
+						// Establish Solr connection.
407
+						if ($solr = tx_dlf_solr::getInstance($core)) {
408 408
 
409
-                            // Delete Solr document.
410
-                            $solr->service->deleteByQuery('uid:'.$id);
409
+							// Delete Solr document.
410
+							$solr->service->deleteByQuery('uid:'.$id);
411 411
 
412
-                            $solr->service->commit();
412
+							$solr->service->commit();
413 413
 
414
-                            if ($command == 'delete') {
414
+							if ($command == 'delete') {
415 415
 
416
-                                break;
416
+								break;
417 417
 
418
-                            }
418
+							}
419 419
 
420
-                        }
420
+						}
421 421
 
422
-                    case 'undelete':
422
+					case 'undelete':
423 423
 
424
-                        // Reindex document.
425
-                        $doc =& tx_dlf_document::getInstance($id);
424
+						// Reindex document.
425
+						$doc =& tx_dlf_document::getInstance($id);
426 426
 
427
-                        if ($doc->ready) {
427
+						if ($doc->ready) {
428 428
 
429
-                            $doc->save($doc->pid, $core);
429
+							$doc->save($doc->pid, $core);
430 430
 
431
-                        } else {
431
+						} else {
432 432
 
433
-                            if (TYPO3_DLOG) {
433
+							if (TYPO3_DLOG) {
434 434
 
435
-                                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
435
+								\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
436 436
 
437
-                            }
437
+							}
438 438
 
439
-                        }
439
+						}
440 440
 
441
-                        break;
441
+						break;
442 442
 
443
-                }
443
+				}
444 444
 
445
-            }
445
+			}
446 446
 
447
-        }
447
+		}
448 448
 
449
-    }
449
+	}
450 450
 
451 451
 }
Please login to merge, or discard this patch.
hooks/class.tx_dlf_doctype.php 1 patch
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -20,61 +20,61 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_doctype {
22 22
 
23
-    /**
24
-     * This holds the current document
25
-     *
26
-     * @var	tx_dlf_document
27
-     * @access protected
28
-     */
29
-    protected $doc;
30
-
31
-    /**
32
-     * This holds the extension key
33
-     *
34
-     * @var	string
35
-     * @access protected
36
-     */
37
-    protected $extKey = 'dlf';
38
-
39
-    /**
40
-     * This holds the current DLF plugin parameters
41
-     * @see __contruct()
42
-     *
43
-     * @var	array
44
-     * @access protected
45
-     */
46
-    protected $piVars = array ();
47
-
48
-    /**
49
-     * This holds the DLF parameter prefix
50
-     *
51
-     * @var	string
52
-     * @access protected
53
-     */
54
-    protected $prefixId = 'tx_dlf';
55
-
56
-    /**
57
-     * Check the current document's type.
58
-     *
59
-     * @access	public
60
-     *
61
-     * @return	string		The type of the current document
62
-     */
63
-    public function getDocType() {
64
-
65
-        // Load current document.
66
-        $this->loadDocument();
67
-
68
-        if ($this->doc === NULL) {
69
-
70
-            // Quit without doing anything if document not available.
71
-            return '';
72
-
73
-        }
74
-
75
-        $toc = $this->doc->tableOfContents;
76
-
77
-        /*
23
+	/**
24
+	 * This holds the current document
25
+	 *
26
+	 * @var	tx_dlf_document
27
+	 * @access protected
28
+	 */
29
+	protected $doc;
30
+
31
+	/**
32
+	 * This holds the extension key
33
+	 *
34
+	 * @var	string
35
+	 * @access protected
36
+	 */
37
+	protected $extKey = 'dlf';
38
+
39
+	/**
40
+	 * This holds the current DLF plugin parameters
41
+	 * @see __contruct()
42
+	 *
43
+	 * @var	array
44
+	 * @access protected
45
+	 */
46
+	protected $piVars = array ();
47
+
48
+	/**
49
+	 * This holds the DLF parameter prefix
50
+	 *
51
+	 * @var	string
52
+	 * @access protected
53
+	 */
54
+	protected $prefixId = 'tx_dlf';
55
+
56
+	/**
57
+	 * Check the current document's type.
58
+	 *
59
+	 * @access	public
60
+	 *
61
+	 * @return	string		The type of the current document
62
+	 */
63
+	public function getDocType() {
64
+
65
+		// Load current document.
66
+		$this->loadDocument();
67
+
68
+		if ($this->doc === NULL) {
69
+
70
+			// Quit without doing anything if document not available.
71
+			return '';
72
+
73
+		}
74
+
75
+		$toc = $this->doc->tableOfContents;
76
+
77
+		/*
78 78
 		 * Get the document type
79 79
 		 *
80 80
 		 * 1. newspaper
@@ -88,145 +88,145 @@  discard block
 block discarded – undo
88 88
 		 * 			  - children array([0]) --> type = month
89 89
 		 * 			  - children array([0], [1], [2], ...) --> type = day --> Issue
90 90
 		 */
91
-        switch ($toc[0]['type']) {
91
+		switch ($toc[0]['type']) {
92 92
 
93
-            case 'newspaper':
93
+			case 'newspaper':
94 94
 
95
-                $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]');
95
+				$nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]');
96 96
 
97
-                if (count($nodes_year) > 1) {
97
+				if (count($nodes_year) > 1) {
98 98
 
99
-                    // Multiple years means this is a newspaper's anchor file.
100
-                    return 'newspaper';
99
+					// Multiple years means this is a newspaper's anchor file.
100
+					return 'newspaper';
101 101
 
102
-                } else {
102
+				} else {
103 103
 
104
-                    $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]');
104
+					$nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]');
105 105
 
106
-                    $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]');
106
+					$nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]');
107 107
 
108
-                    $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]');
108
+					$nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]');
109 109
 
110
-                    $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID');
110
+					$nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID');
111 111
 
112
-                    if (count($nodes_year) == 1 && count($nodes_issue) == 0) {
112
+					if (count($nodes_year) == 1 && count($nodes_issue) == 0) {
113 113
 
114
-                        // It's possible to have only one year in the newspaper's anchor file.
115
-                        return 'newspaper';
114
+						// It's possible to have only one year in the newspaper's anchor file.
115
+						return 'newspaper';
116 116
 
117
-                    } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) {
117
+					} elseif (count($nodes_year) == 1 && count($nodes_month) > 1) {
118 118
 
119
-                        // One year, multiple months means this is a year's anchor file.
120
-                        return 'year';
119
+						// One year, multiple months means this is a year's anchor file.
120
+						return 'year';
121 121
 
122
-                    } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) {
122
+					} elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) {
123 123
 
124
-                        // One year, one month, one or more days means this is a year's anchor file.
125
-                        return 'year';
124
+						// One year, one month, one or more days means this is a year's anchor file.
125
+						return 'year';
126 126
 
127
-                    } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) {
127
+					} elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) {
128 128
 
129
-                        // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file.
130
-                        return 'year';
129
+						// One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file.
130
+						return 'year';
131 131
 
132
-                    } else {
132
+					} else {
133 133
 
134
-                        // In all other cases we assume it's newspaper's issue.
135
-                        return 'issue';
134
+						// In all other cases we assume it's newspaper's issue.
135
+						return 'issue';
136 136
 
137
-                    }
137
+					}
138 138
 
139
-                }
139
+				}
140 140
 
141
-                break;
141
+				break;
142 142
 
143
-            default:
143
+			default:
144 144
 
145
-                return $toc[0]['type'];
145
+				return $toc[0]['type'];
146 146
 
147
-        }
147
+		}
148 148
 
149
-    }
149
+	}
150 150
 
151
-    /**
152
-     * Loads the current document into $this->doc
153
-     *
154
-     * @access	protected
155
-     *
156
-     * @return	void
157
-     */
158
-    protected function loadDocument() {
151
+	/**
152
+	 * Loads the current document into $this->doc
153
+	 *
154
+	 * @access	protected
155
+	 *
156
+	 * @return	void
157
+	 */
158
+	protected function loadDocument() {
159 159
 
160
-        // Check for required variable.
161
-        if (!empty($this->piVars['id'])) {
160
+		// Check for required variable.
161
+		if (!empty($this->piVars['id'])) {
162 162
 
163
-            // Get instance of tx_dlf_document.
164
-            $this->doc =& tx_dlf_document::getInstance($this->piVars['id']);
163
+			// Get instance of tx_dlf_document.
164
+			$this->doc =& tx_dlf_document::getInstance($this->piVars['id']);
165 165
 
166
-            if (!$this->doc->ready) {
166
+			if (!$this->doc->ready) {
167 167
 
168
-                // Destroy the incomplete object.
169
-                $this->doc = NULL;
168
+				// Destroy the incomplete object.
169
+				$this->doc = NULL;
170 170
 
171
-                if (TYPO3_DLOG) {
171
+				if (TYPO3_DLOG) {
172 172
 
173
-                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
173
+					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
174 174
 
175
-                }
175
+				}
176 176
 
177
-            }
177
+			}
178 178
 
179
-        } elseif (!empty($this->piVars['recordId'])) {
179
+		} elseif (!empty($this->piVars['recordId'])) {
180 180
 
181
-            // Get UID of document with given record identifier.
182
-            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
183
-                'tx_dlf_documents.uid',
184
-                'tx_dlf_documents',
185
-                'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'),
186
-                '',
187
-                '',
188
-                '1'
189
-            );
181
+			// Get UID of document with given record identifier.
182
+			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
183
+				'tx_dlf_documents.uid',
184
+				'tx_dlf_documents',
185
+				'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'),
186
+				'',
187
+				'',
188
+				'1'
189
+			);
190 190
 
191
-            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) {
191
+			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) {
192 192
 
193
-                list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
193
+				list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
194 194
 
195
-                // Set superglobal $_GET array.
196
-                $_GET[$this->prefixId]['id'] = $this->piVars['id'];
195
+				// Set superglobal $_GET array.
196
+				$_GET[$this->prefixId]['id'] = $this->piVars['id'];
197 197
 
198
-                // Unset variable to avoid infinite looping.
199
-                unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']);
198
+				// Unset variable to avoid infinite looping.
199
+				unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']);
200 200
 
201
-                // Try to load document.
202
-                $this->loadDocument();
201
+				// Try to load document.
202
+				$this->loadDocument();
203 203
 
204
-            } else {
204
+			} else {
205 205
 
206
-                if (TYPO3_DLOG) {
206
+				if (TYPO3_DLOG) {
207 207
 
208
-                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
208
+					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
209 209
 
210
-                }
210
+				}
211 211
 
212
-            }
212
+			}
213 213
 
214
-        }
214
+		}
215 215
 
216
-    }
216
+	}
217 217
 
218
-    /**
219
-     * Initializes the hook by setting initial variables.
220
-     *
221
-     * @access public
222
-     *
223
-     * @return	void
224
-     */
225
-    public function __construct() {
218
+	/**
219
+	 * Initializes the hook by setting initial variables.
220
+	 *
221
+	 * @access public
222
+	 *
223
+	 * @return	void
224
+	 */
225
+	public function __construct() {
226 226
 
227
-        // Load current plugin parameters.
228
-        $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
227
+		// Load current plugin parameters.
228
+		$this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
229 229
 
230
-    }
230
+	}
231 231
 
232 232
 }
Please login to merge, or discard this patch.
hooks/class.tx_dlf_tceforms.php 1 patch
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -19,393 +19,393 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_tceforms {
21 21
 
22
-    /**
23
-     * Helper to display document's thumbnail for table "tx_dlf_documents"
24
-     *
25
-     * @access	public
26
-     *
27
-     * @param	array		&$params: An array with parameters
28
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
29
-     *
30
-     * @return	string		HTML <img> tag for thumbnail
31
-     */
32
-    public function displayThumbnail(&$params, &$pObj) {
22
+	/**
23
+	 * Helper to display document's thumbnail for table "tx_dlf_documents"
24
+	 *
25
+	 * @access	public
26
+	 *
27
+	 * @param	array		&$params: An array with parameters
28
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
29
+	 *
30
+	 * @return	string		HTML <img> tag for thumbnail
31
+	 */
32
+	public function displayThumbnail(&$params, &$pObj) {
33 33
 
34
-        $output = '<div style="padding:5px; background-color:#000000;">';
34
+		$output = '<div style="padding:5px; background-color:#000000;">';
35 35
 
36
-        // Simulate TCA field type "passthrough".
37
-        $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />';
36
+		// Simulate TCA field type "passthrough".
37
+		$output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />';
38 38
 
39
-        if (!empty($params['itemFormElValue'])) {
39
+		if (!empty($params['itemFormElValue'])) {
40 40
 
41
-            $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />';
41
+			$output .= '<img alt="" src="'.$params['itemFormElValue'].'" />';
42 42
 
43
-        }
43
+		}
44 44
 
45
-        $output .= '</div>';
45
+		$output .= '</div>';
46 46
 
47
-        return $output;
47
+		return $output;
48 48
 
49
-    }
49
+	}
50 50
 
51
-    /**
52
-     * Helper to get flexform's items array for plugin "tx_dlf_collection"
53
-     *
54
-     * @access	public
55
-     *
56
-     * @param	array		&$params: An array with parameters
57
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
58
-     *
59
-     * @return	void
60
-     */
61
-    public function itemsProcFunc_collectionList(&$params, &$pObj) {
51
+	/**
52
+	 * Helper to get flexform's items array for plugin "tx_dlf_collection"
53
+	 *
54
+	 * @access	public
55
+	 *
56
+	 * @param	array		&$params: An array with parameters
57
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
58
+	 *
59
+	 * @return	void
60
+	 */
61
+	public function itemsProcFunc_collectionList(&$params, &$pObj) {
62 62
 
63
-        // the access to pi_flexform data has changed in TYPO3 7.6
64
-        if (version_compare(TYPO3_version, '7.6', '<')) {
63
+		// the access to pi_flexform data has changed in TYPO3 7.6
64
+		if (version_compare(TYPO3_version, '7.6', '<')) {
65 65
 
66
-            if ($params['row']['pi_flexform']) {
66
+			if ($params['row']['pi_flexform']) {
67 67
 
68
-                $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
68
+				$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
69 69
 
70
-                $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
70
+				$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
71 71
 
72
-            }
72
+			}
73 73
 
74
-        } else {
74
+		} else {
75 75
 
76
-            $pages = $params['row']['pages'];
76
+			$pages = $params['row']['pages'];
77 77
 
78
-        }
78
+		}
79 79
 
80
-        if (!empty($pages)) {
80
+		if (!empty($pages)) {
81 81
 
82
-            // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
83
-            // i.e. instead of "18" it reads "pages_18|Title"
84
-            if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
82
+			// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
83
+			// i.e. instead of "18" it reads "pages_18|Title"
84
+			if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
85 85
 
86
-                $parts = explode('|', $pages);
86
+				$parts = explode('|', $pages);
87 87
 
88
-                $pages = array_pop(explode('_', $parts[0]));
88
+				$pages = array_pop(explode('_', $parts[0]));
89 89
 
90
-            }
90
+			}
91 91
 
92
-            if ($pages > 0) {
92
+			if ($pages > 0) {
93 93
 
94
-                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
95
-                    'label,uid',
96
-                    'tx_dlf_collections',
97
-                    'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'),
98
-                    '',
99
-                    'label',
100
-                    ''
101
-                );
94
+				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
95
+					'label,uid',
96
+					'tx_dlf_collections',
97
+					'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'),
98
+					'',
99
+					'label',
100
+					''
101
+				);
102 102
 
103
-                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
103
+				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
104 104
 
105
-                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
105
+					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
106 106
 
107
-                        $params['items'][] = $resArray;
107
+						$params['items'][] = $resArray;
108 108
 
109
-                    }
109
+					}
110 110
 
111
-                }
111
+				}
112 112
 
113
-            }
113
+			}
114 114
 
115
-        }
115
+		}
116 116
 
117
-    }
117
+	}
118 118
 
119
-    /**
120
-     * Helper to get flexform's items array for plugin "tx_dlf_search"
121
-     *
122
-     * @access	public
123
-     *
124
-     * @param	array		&$params: An array with parameters
125
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
126
-     *
127
-     * @return	void
128
-     */
129
-    public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
119
+	/**
120
+	 * Helper to get flexform's items array for plugin "tx_dlf_search"
121
+	 *
122
+	 * @access	public
123
+	 *
124
+	 * @param	array		&$params: An array with parameters
125
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
126
+	 *
127
+	 * @return	void
128
+	 */
129
+	public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
130 130
 
131
-        // the access to pi_flexform data has changed in TYPO3 7.6
132
-        if (version_compare(TYPO3_version, '7.6', '<')) {
131
+		// the access to pi_flexform data has changed in TYPO3 7.6
132
+		if (version_compare(TYPO3_version, '7.6', '<')) {
133 133
 
134
-            if ($params['row']['pi_flexform']) {
134
+			if ($params['row']['pi_flexform']) {
135 135
 
136
-                $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
136
+				$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
137 137
 
138
-                $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
138
+				$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
139 139
 
140
-            }
140
+			}
141 141
 
142
-        } else {
142
+		} else {
143 143
 
144
-            $pages = $params['row']['pages'];
144
+			$pages = $params['row']['pages'];
145 145
 
146
-        }
146
+		}
147 147
 
148
-        if (!empty($pages)) {
148
+		if (!empty($pages)) {
149 149
 
150
-            // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
151
-            // i.e. instead of "18" it reads "pages_18|Title"
152
-            if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
150
+			// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
151
+			// i.e. instead of "18" it reads "pages_18|Title"
152
+			if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
153 153
 
154
-                $_parts = explode('|', $pages);
154
+				$_parts = explode('|', $pages);
155 155
 
156
-                $pages = array_pop(explode('_', $_parts[0]));
156
+				$pages = array_pop(explode('_', $_parts[0]));
157 157
 
158
-            }
158
+			}
159 159
 
160
-            if ($pages > 0) {
160
+			if ($pages > 0) {
161 161
 
162
-                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
163
-                    'label,index_name',
164
-                    'tx_dlf_metadata',
165
-                    'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
166
-                    '',
167
-                    'sorting',
168
-                    ''
169
-                );
162
+				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
163
+					'label,index_name',
164
+					'tx_dlf_metadata',
165
+					'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
166
+					'',
167
+					'sorting',
168
+					''
169
+				);
170 170
 
171
-                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
171
+				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
172 172
 
173
-                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
173
+					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
174 174
 
175
-                        $params['items'][] = $resArray;
175
+						$params['items'][] = $resArray;
176 176
 
177
-                    }
177
+					}
178 178
 
179
-                }
179
+				}
180 180
 
181
-            }
181
+			}
182 182
 
183
-        }
183
+		}
184 184
 
185
-    }
185
+	}
186 186
 
187
-    /**
188
-     * Helper to get flexform's items array for plugin "tx_dlf_search"
189
-     *
190
-     * @access	public
191
-     *
192
-     * @param	array		&$params: An array with parameters
193
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
194
-     *
195
-     * @return	void
196
-     */
197
-    public function itemsProcFunc_facetsList(&$params, &$pObj) {
187
+	/**
188
+	 * Helper to get flexform's items array for plugin "tx_dlf_search"
189
+	 *
190
+	 * @access	public
191
+	 *
192
+	 * @param	array		&$params: An array with parameters
193
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
194
+	 *
195
+	 * @return	void
196
+	 */
197
+	public function itemsProcFunc_facetsList(&$params, &$pObj) {
198 198
 
199
-        // the access to pi_flexform data has changed in TYPO3 7.6
200
-        if (version_compare(TYPO3_version, '7.6', '<')) {
199
+		// the access to pi_flexform data has changed in TYPO3 7.6
200
+		if (version_compare(TYPO3_version, '7.6', '<')) {
201 201
 
202
-            if ($params['row']['pi_flexform']) {
202
+			if ($params['row']['pi_flexform']) {
203 203
 
204
-                $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
204
+				$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
205 205
 
206
-                $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
206
+				$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
207 207
 
208
-            }
208
+			}
209 209
 
210
-        } else {
210
+		} else {
211 211
 
212
-            $pages = $params['row']['pages'];
212
+			$pages = $params['row']['pages'];
213 213
 
214
-        }
214
+		}
215 215
 
216
-        if (!empty($pages)) {
216
+		if (!empty($pages)) {
217 217
 
218
-            // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
219
-            // i.e. instead of "18" it reads "pages_18|Title"
220
-            if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
218
+			// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
219
+			// i.e. instead of "18" it reads "pages_18|Title"
220
+			if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
221 221
 
222
-                $_parts = explode('|', $pages);
222
+				$_parts = explode('|', $pages);
223 223
 
224
-                $pages = array_pop(explode('_', $_parts[0]));
224
+				$pages = array_pop(explode('_', $_parts[0]));
225 225
 
226
-            }
226
+			}
227 227
 
228
-            if ($pages > 0) {
228
+			if ($pages > 0) {
229 229
 
230
-                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
231
-                    'label,index_name',
232
-                    'tx_dlf_metadata',
233
-                    'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
234
-                    '',
235
-                    'sorting',
236
-                    ''
237
-                );
230
+				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
231
+					'label,index_name',
232
+					'tx_dlf_metadata',
233
+					'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
234
+					'',
235
+					'sorting',
236
+					''
237
+				);
238 238
 
239
-                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
239
+				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
240 240
 
241
-                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
241
+					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
242 242
 
243
-                        $params['items'][] = $resArray;
243
+						$params['items'][] = $resArray;
244 244
 
245
-                    }
245
+					}
246 246
 
247
-                }
247
+				}
248 248
 
249
-            }
249
+			}
250 250
 
251
-        }
251
+		}
252 252
 
253
-    }
253
+	}
254 254
 
255
-    /**
256
-     * Helper to get flexform's items array for plugin "tx_dlf_oai"
257
-     *
258
-     * @access	public
259
-     *
260
-     * @param	array		&$params: An array with parameters
261
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
262
-     *
263
-     * @return	void
264
-     */
265
-    public function itemsProcFunc_libraryList(&$params, &$pObj) {
255
+	/**
256
+	 * Helper to get flexform's items array for plugin "tx_dlf_oai"
257
+	 *
258
+	 * @access	public
259
+	 *
260
+	 * @param	array		&$params: An array with parameters
261
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
262
+	 *
263
+	 * @return	void
264
+	 */
265
+	public function itemsProcFunc_libraryList(&$params, &$pObj) {
266 266
 
267
-        // the access to pi_flexform data has changed in TYPO3 7.6
268
-        if (version_compare(TYPO3_version, '7.6', '<')) {
267
+		// the access to pi_flexform data has changed in TYPO3 7.6
268
+		if (version_compare(TYPO3_version, '7.6', '<')) {
269 269
 
270
-            if ($params['row']['pi_flexform']) {
270
+			if ($params['row']['pi_flexform']) {
271 271
 
272
-                $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
272
+				$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
273 273
 
274
-                $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
274
+				$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
275 275
 
276
-            }
276
+			}
277 277
 
278
-        } else {
278
+		} else {
279 279
 
280
-            $pages = $params['row']['pages'];
280
+			$pages = $params['row']['pages'];
281 281
 
282
-        }
282
+		}
283 283
 
284
-        if (!empty($pages)) {
284
+		if (!empty($pages)) {
285 285
 
286
-            // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
287
-            // i.e. instead of "18" it reads "pages_18|Title"
288
-            if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
286
+			// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
287
+			// i.e. instead of "18" it reads "pages_18|Title"
288
+			if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
289 289
 
290
-                $parts = explode('|', $pages);
290
+				$parts = explode('|', $pages);
291 291
 
292
-                $pages = array_pop(explode('_', $parts[0]));
292
+				$pages = array_pop(explode('_', $parts[0]));
293 293
 
294
-            }
294
+			}
295 295
 
296
-            if ($pages > 0) {
296
+			if ($pages > 0) {
297 297
 
298
-                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
299
-                    'label,uid',
300
-                    'tx_dlf_libraries',
301
-                    'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'),
302
-                    '',
303
-                    'label',
304
-                    ''
305
-                );
298
+				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
299
+					'label,uid',
300
+					'tx_dlf_libraries',
301
+					'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'),
302
+					'',
303
+					'label',
304
+					''
305
+				);
306 306
 
307
-                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
307
+				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
308 308
 
309
-                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
309
+					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
310 310
 
311
-                        $params['items'][] = $resArray;
311
+						$params['items'][] = $resArray;
312 312
 
313
-                    }
313
+					}
314 314
 
315
-                }
315
+				}
316 316
 
317
-            }
317
+			}
318 318
 
319
-        }
319
+		}
320 320
 
321
-    }
321
+	}
322 322
 
323
-    /**
324
-     * Helper to get flexform's items array for plugin "tx_dlf_search"
325
-     *
326
-     * @access	public
327
-     *
328
-     * @param	array		&$params: An array with parameters
329
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
330
-     *
331
-     * @return	void
332
-     */
333
-    public function itemsProcFunc_solrList(&$params, &$pObj) {
323
+	/**
324
+	 * Helper to get flexform's items array for plugin "tx_dlf_search"
325
+	 *
326
+	 * @access	public
327
+	 *
328
+	 * @param	array		&$params: An array with parameters
329
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
330
+	 *
331
+	 * @return	void
332
+	 */
333
+	public function itemsProcFunc_solrList(&$params, &$pObj) {
334 334
 
335
-        // the access to pi_flexform data has changed in TYPO3 7.6
336
-        if (version_compare(TYPO3_version, '7.6', '<')) {
335
+		// the access to pi_flexform data has changed in TYPO3 7.6
336
+		if (version_compare(TYPO3_version, '7.6', '<')) {
337 337
 
338
-            if ($params['row']['pi_flexform']) {
338
+			if ($params['row']['pi_flexform']) {
339 339
 
340
-                $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
340
+				$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
341 341
 
342
-                $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
342
+				$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
343 343
 
344
-            }
344
+			}
345 345
 
346
-        } else {
346
+		} else {
347 347
 
348
-            $pages = $params['row']['pages'];
348
+			$pages = $params['row']['pages'];
349 349
 
350
-        }
350
+		}
351 351
 
352
-        if (!empty($pages)) {
352
+		if (!empty($pages)) {
353 353
 
354
-            // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
355
-            // i.e. instead of "18" it reads "pages_18|Title"
356
-            if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
354
+			// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
355
+			// i.e. instead of "18" it reads "pages_18|Title"
356
+			if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
357 357
 
358
-                $parts = explode('|', $pages);
358
+				$parts = explode('|', $pages);
359 359
 
360
-                $pages = array_pop(explode('_', $parts[0]));
360
+				$pages = array_pop(explode('_', $parts[0]));
361 361
 
362
-            }
362
+			}
363 363
 
364
-            if ($pages > 0) {
364
+			if ($pages > 0) {
365 365
 
366
-                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
367
-                    'label,uid',
368
-                    'tx_dlf_solrcores',
369
-                    'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
370
-                    '',
371
-                    'label',
372
-                    ''
373
-                );
366
+				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
367
+					'label,uid',
368
+					'tx_dlf_solrcores',
369
+					'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
370
+					'',
371
+					'label',
372
+					''
373
+				);
374 374
 
375
-                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
375
+				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
376 376
 
377
-                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
377
+					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
378 378
 
379
-                        $params['items'][] = $resArray;
379
+						$params['items'][] = $resArray;
380 380
 
381
-                    }
381
+					}
382 382
 
383
-                }
383
+				}
384 384
 
385
-            }
385
+			}
386 386
 
387
-        }
387
+		}
388 388
 
389
-    }
389
+	}
390 390
 
391
-    /**
392
-     * Helper to get flexform's items array for plugin "tx_dlf_toolbox"
393
-     *
394
-     * @access	public
395
-     *
396
-     * @param	array		&$params: An array with parameters
397
-     * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
398
-     *
399
-     * @return	void
400
-     */
401
-    public function itemsProcFunc_toolList(&$params, &$pObj) {
391
+	/**
392
+	 * Helper to get flexform's items array for plugin "tx_dlf_toolbox"
393
+	 *
394
+	 * @access	public
395
+	 *
396
+	 * @param	array		&$params: An array with parameters
397
+	 * @param	\TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
398
+	 *
399
+	 * @return	void
400
+	 */
401
+	public function itemsProcFunc_toolList(&$params, &$pObj) {
402 402
 
403
-        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) {
403
+		foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) {
404 404
 
405
-            $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class);
405
+			$params['items'][] = array ($GLOBALS['LANG']->sL($label), $class);
406 406
 
407
-        }
407
+		}
408 408
 
409
-    }
409
+	}
410 410
 
411 411
 }
Please login to merge, or discard this patch.