Completed
Push — TYPO3_8 ( 1b9511...e42837 )
by Tomas Norre
10:17
created
modfunc1/class.tx_crawler_modfunc1.php 3 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1054,8 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 		$isAvailable = false;
1055 1055
 		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1056 1056
 
1057
-		if (is_array($userArray))
1058
-			$isAvailable = true;
1057
+		if (is_array($userArray)) {
1058
+					$isAvailable = true;
1059
+		}
1059 1060
 
1060 1061
 		return $isAvailable;
1061 1062
 	}
@@ -1073,8 +1074,9 @@  discard block
 block discarded – undo
1073 1074
 		$isAvailable = false;
1074 1075
 		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1075 1076
 
1076
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1077
-			$isAvailable = true;
1077
+		if (is_array($userArray) && $userArray[0]['admin'] == 0) {
1078
+					$isAvailable = true;
1079
+		}
1078 1080
 
1079 1081
 		return $isAvailable;
1080 1082
 	}
Please login to merge, or discard this patch.
Indentation   +916 added lines, -916 removed lines patch added patch discarded remove patch
@@ -40,126 +40,126 @@  discard block
 block discarded – undo
40 40
  * @subpackage tx_crawler
41 41
  */
42 42
 class tx_crawler_modfunc1 extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
43
-		// Internal, dynamic:
44
-	var $duplicateTrack = array();
45
-	var $submitCrawlUrls = FALSE;
46
-	var $downloadCrawlUrls = FALSE;
43
+        // Internal, dynamic:
44
+    var $duplicateTrack = array();
45
+    var $submitCrawlUrls = FALSE;
46
+    var $downloadCrawlUrls = FALSE;
47 47
 
48
-	var $scheduledTime = 0;
49
-	var $reqMinute = 0;
48
+    var $scheduledTime = 0;
49
+    var $reqMinute = 0;
50 50
 
51
-	/**
52
-	 * @var array holds the selection of configuration from the configuration selector box
53
-	 */
54
-	var $incomingConfigurationSelection = array();
51
+    /**
52
+     * @var array holds the selection of configuration from the configuration selector box
53
+     */
54
+    var $incomingConfigurationSelection = array();
55 55
 
56
-	/**
57
-	 * @var tx_crawler_lib
58
-	 */
59
-	var $crawlerObj;
56
+    /**
57
+     * @var tx_crawler_lib
58
+     */
59
+    var $crawlerObj;
60 60
 
61
-	var $CSVaccu = array();
61
+    var $CSVaccu = array();
62 62
 
63
-	/**
64
-	 * If true the user requested a CSV export of the queue
65
-	 *
66
-	 * @var boolean
67
-	 */
68
-	var $CSVExport = FALSE;
69
-
70
-	var $downloadUrls = array();
63
+    /**
64
+     * If true the user requested a CSV export of the queue
65
+     *
66
+     * @var boolean
67
+     */
68
+    var $CSVExport = FALSE;
71 69
 
72
-	/**
73
-	 * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
74
-	 *
75
-	 * @var array
76
-	 */
77
-	protected $extensionSettings = array();
70
+    var $downloadUrls = array();
78 71
 
79
-	/**
80
-	 * Indicate that an flash message with an error is present.
81
-	 *
82
-	 * @var boolean
83
-	 */
84
-	protected $isErrorDetected = false;
85
-
86
-	/**
87
-	 * the constructor
88
-	 */
89
-	public function __construct() {
90
-		$this->processManager = new tx_crawler_domain_process_manager();
91
-	}
92
-
93
-	/**
94
-	 * Additions to the function menu array
95
-	 *
96
-	 * @return	array		Menu array
97
-	 */
98
-	function modMenu()	{
99
-		global $LANG;
100
-
101
-		return array (
102
-			'depth' => array(
103
-				0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
104
-				1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
105
-				2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
106
-				3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
107
-				4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
108
-				99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
109
-			),
110
-			'crawlaction' => array(
111
-				'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
112
-				'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
113
-				'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
114
-			),
115
-			'log_resultLog' => '',
116
-			'log_feVars' => '',
117
-			'processListMode' => '',
118
-			'log_display' => array(
119
-				'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
120
-				'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
121
-				'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
122
-			),
123
-			'itemsPerPage' => array(
124
-				'5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
125
-				'10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
126
-				'50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
127
-				'0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
128
-			)
129
-		);
130
-	}
72
+    /**
73
+     * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
74
+     *
75
+     * @var array
76
+     */
77
+    protected $extensionSettings = array();
131 78
 
132
-	/**
133
-	 * Load extension settings
134
-	 *
135
-	 * @param void
136
-	 * @return void
137
-	 */
138
-	protected function loadExtensionSettings() {
139
-		$this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
140
-	}
141
-
142
-	/**
143
-	 * Main function
144
-	 *
145
-	 * @return	string		HTML output
146
-	 */
147
-	function main() {
148
-		global $LANG, $BACK_PATH;
79
+    /**
80
+     * Indicate that an flash message with an error is present.
81
+     *
82
+     * @var boolean
83
+     */
84
+    protected $isErrorDetected = false;
85
+
86
+    /**
87
+     * the constructor
88
+     */
89
+    public function __construct() {
90
+        $this->processManager = new tx_crawler_domain_process_manager();
91
+    }
92
+
93
+    /**
94
+     * Additions to the function menu array
95
+     *
96
+     * @return	array		Menu array
97
+     */
98
+    function modMenu()	{
99
+        global $LANG;
100
+
101
+        return array (
102
+            'depth' => array(
103
+                0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
104
+                1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
105
+                2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
106
+                3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
107
+                4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
108
+                99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
109
+            ),
110
+            'crawlaction' => array(
111
+                'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
112
+                'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
113
+                'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
114
+            ),
115
+            'log_resultLog' => '',
116
+            'log_feVars' => '',
117
+            'processListMode' => '',
118
+            'log_display' => array(
119
+                'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
120
+                'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
121
+                'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
122
+            ),
123
+            'itemsPerPage' => array(
124
+                '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
125
+                '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
126
+                '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
127
+                '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
128
+            )
129
+        );
130
+    }
131
+
132
+    /**
133
+     * Load extension settings
134
+     *
135
+     * @param void
136
+     * @return void
137
+     */
138
+    protected function loadExtensionSettings() {
139
+        $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
140
+    }
141
+
142
+    /**
143
+     * Main function
144
+     *
145
+     * @return	string		HTML output
146
+     */
147
+    function main() {
148
+        global $LANG, $BACK_PATH;
149 149
 
150
-		$this->incLocalLang();
150
+        $this->incLocalLang();
151 151
 
152
-		$this->loadExtensionSettings();
153
-		if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
154
-			$this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
155
-		}
152
+        $this->loadExtensionSettings();
153
+        if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
154
+            $this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
155
+        }
156 156
 
157
-			// Set CSS styles specific for this document:
158
-		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
157
+            // Set CSS styles specific for this document:
158
+        $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
159 159
 			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
160 160
 		',$this->pObj->content);
161 161
 
162
-		$this->pObj->content .= '<style type="text/css"><!--
162
+        $this->pObj->content .= '<style type="text/css"><!--
163 163
 			table.url-table,
164 164
 			table.param-expanded,
165 165
 			table.crawlerlog {
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 		<link rel="stylesheet" type="text/css" href="'.$BACK_PATH.'../typo3conf/ext/crawler/template/res.css" />
178 178
 		';
179 179
 
180
-			// Type function menu:
181
-		$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
182
-			$this->pObj->id,
183
-			'SET[crawlaction]',
184
-			$this->pObj->MOD_SETTINGS['crawlaction'],
185
-			$this->pObj->MOD_MENU['crawlaction'],
186
-			'index.php'
187
-		);
180
+            // Type function menu:
181
+        $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
182
+            $this->pObj->id,
183
+            'SET[crawlaction]',
184
+            $this->pObj->MOD_SETTINGS['crawlaction'],
185
+            $this->pObj->MOD_MENU['crawlaction'],
186
+            'index.php'
187
+        );
188 188
 
189
-		/*
189
+        /*
190 190
 			// Showing depth-menu in certain cases:
191 191
 		if ($this->pObj->MOD_SETTINGS['crawlaction']!=='cli' && $this->pObj->MOD_SETTINGS['crawlaction']!== 'multiprocess' && ($this->pObj->MOD_SETTINGS['crawlaction']!=='log' || $this->pObj->id))	{
192 192
 			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
@@ -199,62 +199,62 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 		*/
201 201
 
202
-			// Additional menus for the log type:
203
-		if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
204
-			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
205
-				$this->pObj->id,
206
-				'SET[depth]',
207
-				$this->pObj->MOD_SETTINGS['depth'],
208
-				$this->pObj->MOD_MENU['depth'],
209
-				'index.php'
210
-			);
202
+            // Additional menus for the log type:
203
+        if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
204
+            $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
205
+                $this->pObj->id,
206
+                'SET[depth]',
207
+                $this->pObj->MOD_SETTINGS['depth'],
208
+                $this->pObj->MOD_MENU['depth'],
209
+                'index.php'
210
+            );
211
+
212
+            $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
213
+
214
+            $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
215
+
216
+            $h_func.= '<hr/>'.
217
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
218
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
219
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
220
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
221
+                    \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
222
+                        $this->pObj->id,
223
+                        'SET[itemsPerPage]',
224
+                        $this->pObj->MOD_SETTINGS['itemsPerPage'],
225
+                        $this->pObj->MOD_MENU['itemsPerPage'],
226
+                        'index.php'
227
+                    );
228
+        }
211 229
 
212
-			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
213
-
214
-			$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
215
-
216
-			$h_func.= '<hr/>'.
217
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
218
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
219
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
220
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
221
-					\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
222
-						$this->pObj->id,
223
-						'SET[itemsPerPage]',
224
-						$this->pObj->MOD_SETTINGS['itemsPerPage'],
225
-						$this->pObj->MOD_MENU['itemsPerPage'],
226
-						'index.php'
227
-					);
228
-		}
230
+        $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
229 231
 
230
-		$theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
231
-
232
-			// Branch based on type:
233
-		switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
234
-			case 'start':
235
-				if (empty($this->pObj->id)) {
236
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
237
-				} else {
238
-					$theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
239
-				}
240
-				break;
241
-			case 'log':
242
-				if (empty($this->pObj->id)) {
243
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
244
-				} else {
245
-					$theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
246
-				}
247
-				break;
248
-			case 'cli':
249
-				$theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
250
-				break;
251
-			case 'multiprocess':
252
-				$theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
253
-				break;
254
-		}
232
+            // Branch based on type:
233
+        switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
234
+            case 'start':
235
+                if (empty($this->pObj->id)) {
236
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
237
+                } else {
238
+                    $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
239
+                }
240
+                break;
241
+            case 'log':
242
+                if (empty($this->pObj->id)) {
243
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
244
+                } else {
245
+                    $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
246
+                }
247
+                break;
248
+            case 'cli':
249
+                $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
250
+                break;
251
+            case 'multiprocess':
252
+                $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
253
+                break;
254
+        }
255 255
 
256
-		return $theOutput;
257
-	}
256
+        return $theOutput;
257
+    }
258 258
 
259 259
 
260 260
 
@@ -267,176 +267,176 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 
270
-	/*******************************
270
+    /*******************************
271 271
 	 *
272 272
 	 * Generate URLs for crawling:
273 273
 	 *
274 274
 	 ******************************/
275 275
 
276
-	/**
277
-	 * Produces a table with overview of the URLs to be crawled for each page
278
-	 *
279
-	 * @return	string		HTML output
280
-	 */
281
-	function drawURLs()	{
282
-		global $BACK_PATH, $BE_USER;
283
-
284
-			// Init:
285
-		$this->duplicateTrack = array();
286
-		$this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
287
-		$this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
288
-		$this->makeCrawlerProcessableChecks();
289
-
290
-		switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
291
-			case 'midnight':
292
-				$this->scheduledTime = mktime(0,0,0);
293
-			break;
294
-			case '04:00':
295
-				$this->scheduledTime = mktime(0,0,0)+4*3600;
296
-			break;
297
-			case 'now':
298
-			default:
299
-				$this->scheduledTime = time();
300
-			break;
301
-		}
302
-		// $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
303
-		// TODO: check relevance
304
-		$this->reqMinute = 1000;
276
+    /**
277
+     * Produces a table with overview of the URLs to be crawled for each page
278
+     *
279
+     * @return	string		HTML output
280
+     */
281
+    function drawURLs()	{
282
+        global $BACK_PATH, $BE_USER;
283
+
284
+            // Init:
285
+        $this->duplicateTrack = array();
286
+        $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
287
+        $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
288
+        $this->makeCrawlerProcessableChecks();
289
+
290
+        switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
291
+            case 'midnight':
292
+                $this->scheduledTime = mktime(0,0,0);
293
+            break;
294
+            case '04:00':
295
+                $this->scheduledTime = mktime(0,0,0)+4*3600;
296
+            break;
297
+            case 'now':
298
+            default:
299
+                $this->scheduledTime = time();
300
+            break;
301
+        }
302
+        // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
303
+        // TODO: check relevance
304
+        $this->reqMinute = 1000;
305 305
 
306 306
 
307
-		$this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
308
-		$this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
307
+        $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
308
+        $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
309 309
 
310
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
311
-		$this->crawlerObj->setAccessMode('gui');
312
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
310
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
311
+        $this->crawlerObj->setAccessMode('gui');
312
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
313 313
 
314
-		if (empty($this->incomingConfigurationSelection)
315
-			|| (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
316
-			) {
317
-			$code= '
314
+        if (empty($this->incomingConfigurationSelection)
315
+            || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
316
+            ) {
317
+            $code= '
318 318
 			<tr>
319 319
 				<td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td>
320 320
 			</tr>';
321
-		} else {
322
-			if($this->submitCrawlUrls){
323
-				$reason = new tx_crawler_domain_reason();
324
-				$reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
321
+        } else {
322
+            if($this->submitCrawlUrls){
323
+                $reason = new tx_crawler_domain_reason();
324
+                $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
325
+
326
+                if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
327
+                $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
328
+
329
+                tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
330
+                                                                            $this->findCrawler()->setID,
331
+                                                                            array(	'reason' => $reason ));
332
+            }
333
+
334
+            $code = $this->crawlerObj->getPageTreeAndUrls(
335
+                $this->pObj->id,
336
+                $this->pObj->MOD_SETTINGS['depth'],
337
+                $this->scheduledTime,
338
+                $this->reqMinute,
339
+                $this->submitCrawlUrls,
340
+                $this->downloadCrawlUrls,
341
+                array(), // Do not filter any processing instructions
342
+                $this->incomingConfigurationSelection
343
+            );
325 344
 
326
-				if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
327
-				$reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
328 345
 
329
-				tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
330
-																			$this->findCrawler()->setID,
331
-																			array(	'reason' => $reason ));
332
-			}
333
-
334
-			$code = $this->crawlerObj->getPageTreeAndUrls(
335
-				$this->pObj->id,
336
-				$this->pObj->MOD_SETTINGS['depth'],
337
-				$this->scheduledTime,
338
-				$this->reqMinute,
339
-				$this->submitCrawlUrls,
340
-				$this->downloadCrawlUrls,
341
-				array(), // Do not filter any processing instructions
342
-				$this->incomingConfigurationSelection
343
-			);
344
-
345
-
346
-		}
346
+        }
347 347
 
348
-		$this->downloadUrls = $this->crawlerObj->downloadUrls;
349
-		$this->duplicateTrack = $this->crawlerObj->duplicateTrack;
348
+        $this->downloadUrls = $this->crawlerObj->downloadUrls;
349
+        $this->duplicateTrack = $this->crawlerObj->duplicateTrack;
350 350
 
351
-		$output = '';
352
-		if ($code)	{
351
+        $output = '';
352
+        if ($code)	{
353 353
 
354
-			$output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
355
-			$output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
354
+            $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
355
+            $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
356 356
 
357
-			if (!$this->submitCrawlUrls)	{
358
-				$output .= $this->drawURLs_cfgSelectors().'<br />';
359
-				$output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
360
-				$output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
361
-				$output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
362
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
363
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
364
-				$output .= '<br />
357
+            if (!$this->submitCrawlUrls)	{
358
+                $output .= $this->drawURLs_cfgSelectors().'<br />';
359
+                $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
360
+                $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
361
+                $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
362
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
363
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
364
+                $output .= '<br />
365 365
 					<table class="lrPadding c-list url-table">'.
366
-						$this->drawURLs_printTableHeader().
367
-						$code.
368
-					'</table>';
369
-			} else {
370
-				$output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
371
-				$output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
372
-				$output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
373
-			}
374
-		}
375
-
376
-			// Download Urls to crawl:
377
-		if ($this->downloadCrawlUrls)	{
378
-
379
-				// Creating output header:
380
-			$mimeType = 'application/octet-stream';
381
-			Header('Content-Type: '.$mimeType);
382
-			Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
383
-
384
-				// Printing the content of the CSV lines:
385
-			echo implode(chr(13).chr(10),$this->downloadUrls);
366
+                        $this->drawURLs_printTableHeader().
367
+                        $code.
368
+                    '</table>';
369
+            } else {
370
+                $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
371
+                $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
372
+                $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
373
+            }
374
+        }
386 375
 
387
-				// Exits:
388
-			exit;
389
-		}
376
+            // Download Urls to crawl:
377
+        if ($this->downloadCrawlUrls)	{
390 378
 
391
-			// Return output:
392
-		return 	$output;
393
-	}
379
+                // Creating output header:
380
+            $mimeType = 'application/octet-stream';
381
+            Header('Content-Type: '.$mimeType);
382
+            Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
394 383
 
395
-	/**
396
-	 * Draws the configuration selectors for compiling URLs:
397
-	 *
398
-	 * @return	string		HTML table
399
-	 */
400
-	function drawURLs_cfgSelectors()	{
384
+                // Printing the content of the CSV lines:
385
+            echo implode(chr(13).chr(10),$this->downloadUrls);
401 386
 
402
-			// depth
403
-		$cell[] = $this->selectorBox(
404
-			array(
405
-				0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
406
-				1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
407
-				2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
408
-				3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
409
-				4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
410
-				99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
411
-			),
412
-			'SET[depth]',
413
-			$this->pObj->MOD_SETTINGS['depth'],
414
-			0
415
-		);
416
-		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
417
-
418
-			// Configurations
419
-		$cell[] = $this->selectorBox(
420
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
421
-			'configurationSelection',
422
-			$this->incomingConfigurationSelection,
423
-			1
424
-		);
387
+                // Exits:
388
+            exit;
389
+        }
425 390
 
426
-			// Scheduled time:
427
-		$cell[] = $this->selectorBox(
428
-			array(
429
-				'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
430
-				'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
431
-				'04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
432
-			),
433
-			'tstamp',
434
-			\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
435
-			0
436
-		);
391
+            // Return output:
392
+        return 	$output;
393
+    }
437 394
 
438
-		// TODO: check relevance
439
-		/*
395
+    /**
396
+     * Draws the configuration selectors for compiling URLs:
397
+     *
398
+     * @return	string		HTML table
399
+     */
400
+    function drawURLs_cfgSelectors()	{
401
+
402
+            // depth
403
+        $cell[] = $this->selectorBox(
404
+            array(
405
+                0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
406
+                1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
407
+                2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
408
+                3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
409
+                4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
410
+                99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
411
+            ),
412
+            'SET[depth]',
413
+            $this->pObj->MOD_SETTINGS['depth'],
414
+            0
415
+        );
416
+        $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
417
+
418
+            // Configurations
419
+        $cell[] = $this->selectorBox(
420
+            empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
421
+            'configurationSelection',
422
+            $this->incomingConfigurationSelection,
423
+            1
424
+        );
425
+
426
+            // Scheduled time:
427
+        $cell[] = $this->selectorBox(
428
+            array(
429
+                'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
430
+                'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
431
+                '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
432
+            ),
433
+            'tstamp',
434
+            \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
435
+            0
436
+        );
437
+
438
+        // TODO: check relevance
439
+        /*
440 440
 			// Requests per minute:
441 441
 		$cell[] = $this->selectorBox(
442 442
 			array(
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		);
458 458
 		*/
459 459
 
460
-		$output = '
460
+        $output = '
461 461
 			<table class="lrPadding c-list">
462 462
 				<tr class="bgColor5 tableheader">
463 463
 					<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.depth').':</td>
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 				</tr>
471 471
 			</table>';
472 472
 
473
-		return $output;
474
-	}
473
+        return $output;
474
+    }
475 475
 
476
-	/**
477
-	 * Create Table header row for URL display
478
-	 *
479
-	 * @return	string		Table header
480
-	 */
481
-	function drawURLs_printTableHeader()	{
476
+    /**
477
+     * Create Table header row for URL display
478
+     *
479
+     * @return	string		Table header
480
+     */
481
+    function drawURLs_printTableHeader()	{
482 482
 
483
-		$content = '
483
+        $content = '
484 484
 			<tr class="bgColor5 tableheader">
485 485
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
486 486
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.key').':</td>
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.parameters').':</td>
492 492
 			</tr>';
493 493
 
494
-		return $content;
495
-	}
494
+        return $content;
495
+    }
496 496
 
497 497
 
498 498
 
@@ -505,75 +505,75 @@  discard block
 block discarded – undo
505 505
 
506 506
 
507 507
 
508
-	/*******************************
508
+    /*******************************
509 509
 	 *
510 510
 	 * Shows log of indexed URLs
511 511
 	 *
512 512
 	 ******************************/
513 513
 
514
-	/**
515
-	 * Shows the log of indexed URLs
516
-	 *
517
-	 * @return	string		HTML output
518
-	 */
519
-	function drawLog()	{
520
-		global $BACK_PATH;
521
-		$output = '';
522
-
523
-			// Init:
524
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
525
-		$this->crawlerObj->setAccessMode('gui');
526
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
527
-
528
-		$this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
529
-
530
-			// Read URL:
531
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
532
-			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
533
-		}
514
+    /**
515
+     * Shows the log of indexed URLs
516
+     *
517
+     * @return	string		HTML output
518
+     */
519
+    function drawLog()	{
520
+        global $BACK_PATH;
521
+        $output = '';
522
+
523
+            // Init:
524
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
525
+        $this->crawlerObj->setAccessMode('gui');
526
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
527
+
528
+        $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
529
+
530
+            // Read URL:
531
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
532
+            $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
533
+        }
534 534
 
535
-			// Look for set ID sent - if it is, we will display contents of that set:
536
-		$showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
535
+            // Look for set ID sent - if it is, we will display contents of that set:
536
+        $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
537 537
 
538
-			// Show details:
539
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
538
+            // Show details:
539
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
540 540
 
541
-				// Get entry record:
542
-			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
541
+                // Get entry record:
542
+            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
543 543
 
544
-				// Explode values:
545
-				$resStatus = $this->getResStatus($q_entry);
546
-			$q_entry['parameters'] = unserialize($q_entry['parameters']);
547
-			$q_entry['result_data'] = unserialize($q_entry['result_data']);
548
-			if (is_array($q_entry['result_data']))	{
549
-				$q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
550
-			}
544
+                // Explode values:
545
+                $resStatus = $this->getResStatus($q_entry);
546
+            $q_entry['parameters'] = unserialize($q_entry['parameters']);
547
+            $q_entry['result_data'] = unserialize($q_entry['result_data']);
548
+            if (is_array($q_entry['result_data']))	{
549
+                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
550
+            }
551 551
 
552
-			if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
553
-				unset($q_entry['result_data']['content']['log']);
554
-			}
552
+            if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
553
+                unset($q_entry['result_data']['content']['log']);
554
+            }
555 555
 
556
-				// Print rudimentary details:
557
-			$output .= '
556
+                // Print rudimentary details:
557
+            $output .= '
558 558
 				<br /><br />
559 559
 				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
560 560
 				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
561 561
 				<input type="hidden" value="' . $showSetId . '" name="setID" />
562 562
 				<br />
563 563
 				Current server time: ' . date('H:i:s', time()) . '<br />' .
564
-				'Status: ' . $resStatus . '<br />' .
565
-				\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
566
-		} else {	// Show list:
567
-
568
-				// If either id or set id, show list:
569
-			if ($this->pObj->id || $showSetId)	{
570
-				if ($this->pObj->id)	{
571
-						// Drawing tree:
572
-					$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
573
-					$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
574
-					$tree->init('AND '.$perms_clause);
575
-
576
-						// Set root row:
564
+                'Status: ' . $resStatus . '<br />' .
565
+                \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
566
+        } else {	// Show list:
567
+
568
+                // If either id or set id, show list:
569
+            if ($this->pObj->id || $showSetId)	{
570
+                if ($this->pObj->id)	{
571
+                        // Drawing tree:
572
+                    $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
573
+                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
574
+                    $tree->init('AND '.$perms_clause);
575
+
576
+                        // Set root row:
577 577
                     if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version()) < 8000000) {
578 578
                         $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord(
579 579
                             'pages',
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
                         $iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory');
584 584
                         $HTML = $iconFactory->getIconForRecord('pages', $this->pObj->pageinfo, Icon::SIZE_SMALL)->render();
585 585
                     }
586
-					$tree->tree[] = Array(
587
-						'row' => $this->pObj->pageinfo,
588
-						'HTML' => $HTML
589
-					);
590
-
591
-						// Get branch beneath:
592
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
593
-						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
594
-					}
595
-
596
-						// Traverse page tree:
597
-					$code = ''; $count = 0;
598
-					foreach($tree->tree as $data)	{
599
-						$code .= $this->drawLog_addRows(
600
-									$data['row'],
601
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
602
-									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
603
-								);
604
-						if (++$count == 1000) {
605
-							break;
606
-						}
607
-					}
608
-				} else {
609
-					$code = '';
610
-					$code.= $this->drawLog_addRows(
611
-								$showSetId,
612
-								'Set ID: '.$showSetId
613
-							);
614
-				}
615
-
616
-				if ($code)	{
617
-
618
-					$output .= '
586
+                    $tree->tree[] = Array(
587
+                        'row' => $this->pObj->pageinfo,
588
+                        'HTML' => $HTML
589
+                    );
590
+
591
+                        // Get branch beneath:
592
+                    if ($this->pObj->MOD_SETTINGS['depth'])	{
593
+                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
594
+                    }
595
+
596
+                        // Traverse page tree:
597
+                    $code = ''; $count = 0;
598
+                    foreach($tree->tree as $data)	{
599
+                        $code .= $this->drawLog_addRows(
600
+                                    $data['row'],
601
+                                    $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
602
+                                    intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
603
+                                );
604
+                        if (++$count == 1000) {
605
+                            break;
606
+                        }
607
+                    }
608
+                } else {
609
+                    $code = '';
610
+                    $code.= $this->drawLog_addRows(
611
+                                $showSetId,
612
+                                'Set ID: '.$showSetId
613
+                            );
614
+                }
615
+
616
+                if ($code)	{
617
+
618
+                    $output .= '
619 619
 						<br /><br />
620 620
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" />
621 621
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" />
@@ -629,20 +629,20 @@  discard block
 block discarded – undo
629 629
 
630 630
 
631 631
 						<table class="lrPadding c-list crawlerlog">'.
632
-							$this->drawLog_printTableHeader().
633
-							$code.
634
-						'</table>';
635
-				}
636
-			} else {	// Otherwise show available sets:
637
-				$setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
638
-								'set_id, count(*) as count_value, scheduled',
639
-								'tx_crawler_queue',
640
-								'',
641
-								'set_id, scheduled',
642
-								'scheduled DESC'
643
-							);
644
-
645
-				$code = '
632
+                            $this->drawLog_printTableHeader().
633
+                            $code.
634
+                        '</table>';
635
+                }
636
+            } else {	// Otherwise show available sets:
637
+                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
638
+                                'set_id, count(*) as count_value, scheduled',
639
+                                'tx_crawler_queue',
640
+                                '',
641
+                                'set_id, scheduled',
642
+                                'scheduled DESC'
643
+                            );
644
+
645
+                $code = '
646 646
 					<tr class="bgColor5 tableheader">
647 647
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>
648 648
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td>
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 					</tr>
651 651
 				';
652 652
 
653
-				$cc=0;
654
-				foreach($setList as $set)	{
655
-					$code.= '
653
+                $cc=0;
654
+                foreach($setList as $set)	{
655
+                    $code.= '
656 656
 						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
657 657
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
658 658
 							<td>'.$set['count_value'].'</td>
@@ -660,218 +660,218 @@  discard block
 block discarded – undo
660 660
 						</tr>
661 661
 					';
662 662
 
663
-					$cc++;
664
-				}
663
+                    $cc++;
664
+                }
665 665
 
666
-				$output .= '
666
+                $output .= '
667 667
 					<br /><br />
668 668
 					<table class="lrPadding c-list">'.
669
-						$code.
670
-					'</table>';
671
-			}
672
-		}
669
+                        $code.
670
+                    '</table>';
671
+            }
672
+        }
673 673
 
674
-		if($this->CSVExport) {
675
-			$this->outputCsvFile();
676
-		}
674
+        if($this->CSVExport) {
675
+            $this->outputCsvFile();
676
+        }
677 677
 
678
-			// Return output
679
-		return 	$output;
680
-	}
678
+            // Return output
679
+        return 	$output;
680
+    }
681 681
 
682
-	/**
683
-	 * Outputs the CSV file and sets the correct headers
684
-	 */
685
-	protected function outputCsvFile() {
682
+    /**
683
+     * Outputs the CSV file and sets the correct headers
684
+     */
685
+    protected function outputCsvFile() {
686 686
 
687
-		if (!count($this->CSVaccu)) {
688
-			$this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
689
-			return;
690
-		}
687
+        if (!count($this->CSVaccu)) {
688
+            $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
689
+            return;
690
+        }
691 691
 
692
-		$csvLines = array();
692
+        $csvLines = array();
693 693
 
694
-			// Field names:
695
-		reset($this->CSVaccu);
696
-		$fieldNames = array_keys(current($this->CSVaccu));
697
-		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
694
+            // Field names:
695
+        reset($this->CSVaccu);
696
+        $fieldNames = array_keys(current($this->CSVaccu));
697
+        $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
698 698
 
699
-			// Data:
700
-		foreach($this->CSVaccu as $row)	{
701
-			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
702
-		}
699
+            // Data:
700
+        foreach($this->CSVaccu as $row)	{
701
+            $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
702
+        }
703 703
 
704
-			// Creating output header:
705
-		$mimeType = 'application/octet-stream';
706
-		Header('Content-Type: '.$mimeType);
707
-		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
704
+            // Creating output header:
705
+        $mimeType = 'application/octet-stream';
706
+        Header('Content-Type: '.$mimeType);
707
+        Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
708 708
 
709
-			// Printing the content of the CSV lines:
710
-		echo implode(chr(13).chr(10),$csvLines);
709
+            // Printing the content of the CSV lines:
710
+        echo implode(chr(13).chr(10),$csvLines);
711 711
 
712
-			// Exits:
713
-		exit;
714
-	}
712
+            // Exits:
713
+        exit;
714
+    }
715 715
 
716
-	/**
717
-	 * Create the rows for display of the page tree
718
-	 * For each page a number of rows are shown displaying GET variable configuration
719
-	 *
720
-	 * @param array $pageRow_setId Page row or set-id
721
-	 * @param string $titleString Title string
722
-	 * @param int $itemsPerPage Items per Page setting
716
+    /**
717
+     * Create the rows for display of the page tree
718
+     * For each page a number of rows are shown displaying GET variable configuration
723 719
      *
724
-	 * @return string HTML <tr> content (one or more)
725
-	 */
726
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
727
-
728
-			// If Flush button is pressed, flush tables instead of selecting entries:
729
-
730
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
731
-			$doFlush = true;
732
-			$doFullFlush = false;
733
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
734
-			$doFlush = true;
735
-			$doFullFlush = true;
736
-		} else {
737
-			$doFlush = false;
738
-			$doFullFlush = false;
739
-		}
720
+     * @param array $pageRow_setId Page row or set-id
721
+     * @param string $titleString Title string
722
+     * @param int $itemsPerPage Items per Page setting
723
+     *
724
+     * @return string HTML <tr> content (one or more)
725
+     */
726
+    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
727
+
728
+            // If Flush button is pressed, flush tables instead of selecting entries:
729
+
730
+        if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
731
+            $doFlush = true;
732
+            $doFullFlush = false;
733
+        } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
734
+            $doFlush = true;
735
+            $doFullFlush = true;
736
+        } else {
737
+            $doFlush = false;
738
+            $doFullFlush = false;
739
+        }
740 740
 
741
-			// Get result:
742
-		if (is_array($pageRow_setId))	{
743
-			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
744
-		} else {
745
-			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
746
-		}
741
+            // Get result:
742
+        if (is_array($pageRow_setId))	{
743
+            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
744
+        } else {
745
+            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
746
+        }
747
+
748
+            // Init var:
749
+        $colSpan = 9
750
+                + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
751
+                + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
752
+
753
+        if (count($res))	{
754
+                // Traverse parameter combinations:
755
+            $c = 0;
756
+            $content='';
757
+            foreach($res as $kk => $vv)	{
758
+
759
+                    // Title column:
760
+                if (!$c)	{
761
+                    $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
762
+                } else {
763
+                    $titleClm = '';
764
+                }
765
+
766
+                    // Result:
767
+                $resLog = $this->getResultLog($vv);
768
+
769
+                $resStatus = $this->getResStatus($vv);
770
+                $resFeVars = $this->getResFeVars($vv);
771
+
772
+                    // Compile row:
773
+                $parameters = unserialize($vv['parameters']);
774
+
775
+                    // Put data into array:
776
+                $rowData = array();
777
+                if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
778
+                    $rowData['result_log'] = $resLog;
779
+                } else {
780
+                    $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
781
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
782
+                }
783
+                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
784
+                $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
785
+                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
786
+                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
787
+                $rowData['set_id'] = $vv['set_id'];
788
+
789
+                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
790
+                    $rowData['tsfe_id'] = $resFeVars['id'];
791
+                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
792
+                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
793
+                }
747 794
 
748
-			// Init var:
749
-		$colSpan = 9
750
-				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
751
-				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
752
-
753
-		if (count($res))	{
754
-				// Traverse parameter combinations:
755
-			$c = 0;
756
-			$content='';
757
-			foreach($res as $kk => $vv)	{
758
-
759
-					// Title column:
760
-				if (!$c)	{
761
-					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
762
-				} else {
763
-					$titleClm = '';
764
-				}
765
-
766
-					// Result:
767
-				$resLog = $this->getResultLog($vv);
768
-
769
-				$resStatus = $this->getResStatus($vv);
770
-				$resFeVars = $this->getResFeVars($vv);
771
-
772
-					// Compile row:
773
-				$parameters = unserialize($vv['parameters']);
774
-
775
-					// Put data into array:
776
-				$rowData = array();
777
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
778
-					$rowData['result_log'] = $resLog;
779
-				} else {
780
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
781
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
782
-				}
783
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
784
-				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
785
-				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
786
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
787
-				$rowData['set_id'] = $vv['set_id'];
788
-
789
-				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
790
-					$rowData['tsfe_id'] = $resFeVars['id'];
791
-					$rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
792
-					$rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
793
-				}
794
-
795
-				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
796
-
797
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
798
-				if (version_compare(TYPO3_version,'7.0','>=')) {
799
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
800
-				}
801
-
802
-					// Put rows together:
803
-				$content.= '
795
+                $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
796
+
797
+                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
798
+                if (version_compare(TYPO3_version,'7.0','>=')) {
799
+                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
800
+                }
801
+
802
+                    // Put rows together:
803
+                $content.= '
804 804
 					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
805 805
 						'.$titleClm.'
806 806
 						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
807 807
 						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>';
808
-				foreach($rowData as $fKey => $value) {
808
+                foreach($rowData as $fKey => $value) {
809 809
 
810
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
811
-						$content.= '
810
+                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
811
+                        $content.= '
812 812
 						<td>'.$value.'</td>';
813
-					} else {
814
-						$content.= '
813
+                    } else {
814
+                        $content.= '
815 815
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
816
-					}
817
-				}
818
-				$content.= '
816
+                    }
817
+                }
818
+                $content.= '
819 819
 					</tr>';
820
-				$c++;
821
-
822
-				if ($this->CSVExport)	{
823
-						// Only for CSV (adding qid and scheduled/exec_time if needed):
824
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
825
-					$rowData['qid'] = $vv['qid'];
826
-					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
827
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
828
-					$this->CSVaccu[] = $rowData;
829
-				}
830
-			}
831
-		} else {
820
+                $c++;
821
+
822
+                if ($this->CSVExport)	{
823
+                        // Only for CSV (adding qid and scheduled/exec_time if needed):
824
+                    $rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
825
+                    $rowData['qid'] = $vv['qid'];
826
+                    $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
827
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
828
+                    $this->CSVaccu[] = $rowData;
829
+                }
830
+            }
831
+        } else {
832 832
 
833
-				// Compile row:
834
-			$content = '
833
+                // Compile row:
834
+            $content = '
835 835
 				<tr class="bgColor-20">
836 836
 					<td>'.$titleString.'</td>
837 837
 					<td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td>
838 838
 				</tr>';
839
-		}
839
+        }
840 840
 
841
-		return $content;
842
-	}
841
+        return $content;
842
+    }
843 843
 
844
-	/**
845
-	 * Find Fe vars
846
-	 *
847
-	 * @param array $row
848
-	 * @return array
849
-	 */
850
-	function getResFeVars($row) {
851
-		$feVars = array();
852
-
853
-		if ($row['result_data']) {
854
-			$resultData = unserialize($row['result_data']);
855
-			$requestResult = unserialize($resultData['content']);
856
-			$feVars = $requestResult['vars'];
857
-		}
844
+    /**
845
+     * Find Fe vars
846
+     *
847
+     * @param array $row
848
+     * @return array
849
+     */
850
+    function getResFeVars($row) {
851
+        $feVars = array();
852
+
853
+        if ($row['result_data']) {
854
+            $resultData = unserialize($row['result_data']);
855
+            $requestResult = unserialize($resultData['content']);
856
+            $feVars = $requestResult['vars'];
857
+        }
858 858
 
859
-		return $feVars;
860
-	}
859
+        return $feVars;
860
+    }
861 861
 
862
-	/**
863
-	 * Create Table header row (log)
864
-	 *
865
-	 * @return	string		Table header
866
-	 */
867
-	function drawLog_printTableHeader()	{
862
+    /**
863
+     * Create Table header row (log)
864
+     *
865
+     * @return	string		Table header
866
+     */
867
+    function drawLog_printTableHeader()	{
868 868
 
869
-		$content = '
869
+        $content = '
870 870
 			<tr class="bgColor5 tableheader">
871 871
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
872 872
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td>
873 873
 				<td>&nbsp;</td>'.
874
-				($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
874
+                ($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
875 875
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : '
876 876
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td>
877 877
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').'
@@ -880,14 +880,14 @@  discard block
 block discarded – undo
880 880
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td>
881 881
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td>
882 882
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'.
883
-				($this->pObj->MOD_SETTINGS['log_feVars'] ? '
883
+                ($this->pObj->MOD_SETTINGS['log_feVars'] ? '
884 884
 				<td>'.htmlspecialchars('TSFE->id').'</td>
885 885
 				<td>'.htmlspecialchars('TSFE->gr_list').'</td>
886 886
 				<td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').'
887 887
 			</tr>';
888 888
 
889
-		return $content;
890
-	}
889
+        return $content;
890
+    }
891 891
 
892 892
         /**
893 893
          * Extract the log information from the current row and retrive it as formatted string.
@@ -914,25 +914,25 @@  discard block
 block discarded – undo
914 914
                 return $content;
915 915
         }
916 916
 
917
-	function getResStatus($vv) {
918
-		if ($vv['result_data'])	{
919
-			$requestContent = unserialize($vv['result_data']);
920
-			$requestResult = unserialize($requestContent['content']);
921
-			if (is_array($requestResult)) {
922
-				if (empty($requestResult['errorlog'])) {
923
-					$resStatus = 'OK';
924
-				} else {
925
-					$resStatus = implode("\n", $requestResult['errorlog']);
926
-				}
927
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
928
-			} else {
929
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
930
-			}
931
-		} else {
932
-			$resStatus = '-';
933
-		}
934
-		return $resStatus;
935
-	}
917
+    function getResStatus($vv) {
918
+        if ($vv['result_data'])	{
919
+            $requestContent = unserialize($vv['result_data']);
920
+            $requestResult = unserialize($requestContent['content']);
921
+            if (is_array($requestResult)) {
922
+                if (empty($requestResult['errorlog'])) {
923
+                    $resStatus = 'OK';
924
+                } else {
925
+                    $resStatus = implode("\n", $requestResult['errorlog']);
926
+                }
927
+                $resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
928
+            } else {
929
+                $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
930
+            }
931
+        } else {
932
+            $resStatus = '-';
933
+        }
934
+        return $resStatus;
935
+    }
936 936
 
937 937
 
938 938
 
@@ -941,344 +941,344 @@  discard block
 block discarded – undo
941 941
 
942 942
 
943 943
 
944
-	/*****************************
944
+    /*****************************
945 945
 	 *
946 946
 	 * CLI status display
947 947
 	 *
948 948
 	 *****************************/
949 949
 
950
-	/**
951
-	 * This method is used to show an overview about the active an the finished crawling processes
952
-	 *
953
-	 * @author Timo Schmidt
954
-	 * @param void
955
-	 * @return string
956
-	 */
957
-	protected function drawProcessOverviewAction(){
958
-
959
-		$this->runRefreshHooks();
960
-
961
-		global $BACK_PATH;
962
-		$this->makeCrawlerProcessableChecks();
963
-
964
-		$crawler = $this->findCrawler();
965
-		try {
966
-			$this->handleProcessOverviewActions();
967
-		} catch (Exception $e) {
968
-			$this->addErrorMessage($e->getMessage());
969
-		}
950
+    /**
951
+     * This method is used to show an overview about the active an the finished crawling processes
952
+     *
953
+     * @author Timo Schmidt
954
+     * @param void
955
+     * @return string
956
+     */
957
+    protected function drawProcessOverviewAction(){
958
+
959
+        $this->runRefreshHooks();
960
+
961
+        global $BACK_PATH;
962
+        $this->makeCrawlerProcessableChecks();
963
+
964
+        $crawler = $this->findCrawler();
965
+        try {
966
+            $this->handleProcessOverviewActions();
967
+        } catch (Exception $e) {
968
+            $this->addErrorMessage($e->getMessage());
969
+        }
970 970
 
971
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
-		$perpage 	= 20;
971
+        $offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
+        $perpage 	= 20;
973 973
 
974
-		$processRepository	= new tx_crawler_domain_process_repository();
975
-		$queueRepository	= new tx_crawler_domain_queue_repository();
974
+        $processRepository	= new tx_crawler_domain_process_repository();
975
+        $queueRepository	= new tx_crawler_domain_queue_repository();
976 976
 
977
-		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
978
-		if ($mode == 'detail') {
979
-			$where = '';
980
-		} elseif($mode == 'simple') {
981
-			$where = 'active = 1';
982
-		}
977
+        $mode = $this->pObj->MOD_SETTINGS['processListMode'];
978
+        if ($mode == 'detail') {
979
+            $where = '';
980
+        } elseif($mode == 'simple') {
981
+            $where = 'active = 1';
982
+        }
983 983
 
984
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
985
-		$allCount			= $processRepository->countAll($where);
986
-
987
-		$listView			= new tx_crawler_view_process_list();
988
-		$listView->setPageId($this->pObj->id);
989
-		$listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
990
-		$listView->setProcessCollection($allProcesses);
991
-		$listView->setCliPath($this->processManager->getCrawlerCliPath());
992
-		$listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
993
-		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
994
-		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
995
-		$listView->setActiveProcessCount($processRepository->countActive());
996
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
997
-		$listView->setMode($mode);
998
-
999
-		$paginationView		= new tx_crawler_view_pagination();
1000
-		$paginationView->setCurrentOffset($offset);
1001
-		$paginationView->setPerPage($perpage);
1002
-		$paginationView->setTotalItemCount($allCount);
1003
-
1004
-		$output = $listView->render();
1005
-
1006
-		if ($paginationView->getTotalPagesCount() > 1) {
1007
-			$output .= ' <br />'.$paginationView->render();
1008
-		}
984
+        $allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
985
+        $allCount			= $processRepository->countAll($where);
986
+
987
+        $listView			= new tx_crawler_view_process_list();
988
+        $listView->setPageId($this->pObj->id);
989
+        $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
990
+        $listView->setProcessCollection($allProcesses);
991
+        $listView->setCliPath($this->processManager->getCrawlerCliPath());
992
+        $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
993
+        $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
994
+        $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
995
+        $listView->setActiveProcessCount($processRepository->countActive());
996
+        $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
997
+        $listView->setMode($mode);
998
+
999
+        $paginationView		= new tx_crawler_view_pagination();
1000
+        $paginationView->setCurrentOffset($offset);
1001
+        $paginationView->setPerPage($perpage);
1002
+        $paginationView->setTotalItemCount($allCount);
1003
+
1004
+        $output = $listView->render();
1005
+
1006
+        if ($paginationView->getTotalPagesCount() > 1) {
1007
+            $output .= ' <br />'.$paginationView->render();
1008
+        }
1009 1009
 
1010
-		return $output;
1011
-	}
1010
+        return $output;
1011
+    }
1012 1012
 
1013
-	/**
1014
-	 * Verify that the crawler is exectuable.
1015
-	 *
1016
-	 * @access protected
1017
-	 * @return void
1018
-	 *
1019
-	 * @author Michael Klapper <[email protected]>
1020
-	 */
1021
-	protected function makeCrawlerProcessableChecks() {
1022
-		global $LANG;
1023
-
1024
-		if ($this->isCrawlerUserAvailable() === false) {
1025
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1026
-		} elseif ($this->isCrawlerUserNotAdmin() === false) {
1027
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1028
-		}
1013
+    /**
1014
+     * Verify that the crawler is exectuable.
1015
+     *
1016
+     * @access protected
1017
+     * @return void
1018
+     *
1019
+     * @author Michael Klapper <[email protected]>
1020
+     */
1021
+    protected function makeCrawlerProcessableChecks() {
1022
+        global $LANG;
1023
+
1024
+        if ($this->isCrawlerUserAvailable() === false) {
1025
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1026
+        } elseif ($this->isCrawlerUserNotAdmin() === false) {
1027
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1028
+        }
1029 1029
 
1030
-		if ($this->isPhpForkAvailable() === false) {
1031
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1032
-		}
1030
+        if ($this->isPhpForkAvailable() === false) {
1031
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1032
+        }
1033 1033
 
1034
-		$exitCode = 0;
1035
-		$out = array();
1036
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1037
-		if ($exitCode > 0) {
1038
-			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1039
-		}
1040
-	}
1034
+        $exitCode = 0;
1035
+        $out = array();
1036
+        exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1037
+        if ($exitCode > 0) {
1038
+            $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1039
+        }
1040
+    }
1041 1041
 
1042
-	/**
1043
-	 * Indicate that the required PHP method "popen" is
1044
-	 * available in the system.
1045
-	 *
1046
-	 * @access protected
1047
-	 * @return boolean
1048
-	 *
1049
-	 * @author Michael Klapper <[email protected]>
1050
-	 */
1051
-	protected function isPhpForkAvailable() {
1052
-		return function_exists('popen');
1053
-	}
1054
-
1055
-	/**
1056
-	 * Indicate that the required be_user "_cli_crawler" is
1057
-	 * global available in the system.
1058
-	 *
1059
-	 * @access protected
1060
-	 * @return boolean
1061
-	 *
1062
-	 * @author Michael Klapper <[email protected]>
1063
-	 */
1064
-	protected function isCrawlerUserAvailable() {
1065
-		$isAvailable = false;
1066
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1042
+    /**
1043
+     * Indicate that the required PHP method "popen" is
1044
+     * available in the system.
1045
+     *
1046
+     * @access protected
1047
+     * @return boolean
1048
+     *
1049
+     * @author Michael Klapper <[email protected]>
1050
+     */
1051
+    protected function isPhpForkAvailable() {
1052
+        return function_exists('popen');
1053
+    }
1054
+
1055
+    /**
1056
+     * Indicate that the required be_user "_cli_crawler" is
1057
+     * global available in the system.
1058
+     *
1059
+     * @access protected
1060
+     * @return boolean
1061
+     *
1062
+     * @author Michael Klapper <[email protected]>
1063
+     */
1064
+    protected function isCrawlerUserAvailable() {
1065
+        $isAvailable = false;
1066
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1067 1067
 
1068
-		if (is_array($userArray))
1069
-			$isAvailable = true;
1068
+        if (is_array($userArray))
1069
+            $isAvailable = true;
1070 1070
 
1071
-		return $isAvailable;
1072
-	}
1071
+        return $isAvailable;
1072
+    }
1073 1073
 
1074
-	/**
1075
-	 * Indicate that the required be_user "_cli_crawler" is
1076
-	 * has no admin rights.
1077
-	 *
1078
-	 * @access protected
1079
-	 * @return boolean
1080
-	 *
1081
-	 * @author Michael Klapper <[email protected]>
1082
-	 */
1083
-	protected function isCrawlerUserNotAdmin() {
1084
-		$isAvailable = false;
1085
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1074
+    /**
1075
+     * Indicate that the required be_user "_cli_crawler" is
1076
+     * has no admin rights.
1077
+     *
1078
+     * @access protected
1079
+     * @return boolean
1080
+     *
1081
+     * @author Michael Klapper <[email protected]>
1082
+     */
1083
+    protected function isCrawlerUserNotAdmin() {
1084
+        $isAvailable = false;
1085
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1086 1086
 
1087
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1088
-			$isAvailable = true;
1087
+        if (is_array($userArray) && $userArray[0]['admin'] == 0)
1088
+            $isAvailable = true;
1089 1089
 
1090
-		return $isAvailable;
1091
-	}
1090
+        return $isAvailable;
1091
+    }
1092 1092
 
1093
-	/**
1094
-	 * Method to handle incomming actions of the process overview
1095
-	 *
1096
-	 * @param void
1097
-	 * @return void
1098
-	 */
1099
-	protected function handleProcessOverviewActions(){
1100
-
1101
-		$crawler = $this->findCrawler();
1102
-
1103
-		switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1104
-			case 'stopCrawling' :
1105
-				//set the cli status to disable (all processes will be terminated)
1106
-				$crawler->setDisabled(true);
1107
-				break;
1108
-			case 'resumeCrawling' :
1109
-				//set the cli status to end (all processes will be terminated)
1110
-				$crawler->setDisabled(false);
1111
-				break;
1112
-			case 'addProcess' :
1113
-				$handle = $this->processManager->startProcess();
1114
-				if ($handle === false) {
1115
-					throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1116
-				}
1117
-				$this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1118
-				break;
1119
-		}
1120
-	}
1093
+    /**
1094
+     * Method to handle incomming actions of the process overview
1095
+     *
1096
+     * @param void
1097
+     * @return void
1098
+     */
1099
+    protected function handleProcessOverviewActions(){
1100
+
1101
+        $crawler = $this->findCrawler();
1102
+
1103
+        switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1104
+            case 'stopCrawling' :
1105
+                //set the cli status to disable (all processes will be terminated)
1106
+                $crawler->setDisabled(true);
1107
+                break;
1108
+            case 'resumeCrawling' :
1109
+                //set the cli status to end (all processes will be terminated)
1110
+                $crawler->setDisabled(false);
1111
+                break;
1112
+            case 'addProcess' :
1113
+                $handle = $this->processManager->startProcess();
1114
+                if ($handle === false) {
1115
+                    throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1116
+                }
1117
+                $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1118
+                break;
1119
+        }
1120
+    }
1121 1121
 
1122 1122
 
1123 1123
 
1124 1124
 
1125
-	/**
1126
-	 * Returns the singleton instance of the crawler.
1127
-	 *
1128
-	 * @param void
1129
-	 * @return tx_crawler_lib crawler object
1130
-	 * @author Timo Schmidt <[email protected]>
1131
-	 */
1132
-	protected function findCrawler(){
1133
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1134
-			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1135
-		}
1136
-		return $this->crawlerObj;
1137
-	}
1125
+    /**
1126
+     * Returns the singleton instance of the crawler.
1127
+     *
1128
+     * @param void
1129
+     * @return tx_crawler_lib crawler object
1130
+     * @author Timo Schmidt <[email protected]>
1131
+     */
1132
+    protected function findCrawler(){
1133
+        if(!$this->crawlerObj instanceof tx_crawler_lib){
1134
+            $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1135
+        }
1136
+        return $this->crawlerObj;
1137
+    }
1138 1138
 
1139 1139
 
1140 1140
 
1141
-	/*****************************
1141
+    /*****************************
1142 1142
 	 *
1143 1143
 	 * General Helper Functions
1144 1144
 	 *
1145 1145
 	 *****************************/
1146 1146
 
1147
-	/**
1148
-	 * This method is used to add a message to the internal queue
1149
-	 *
1150
-	 * NOTE:
1151
-	 * This method is basesd on TYPO3 4.3 or higher!
1152
-	 *
1153
-	 * @param  string  the message itself
1154
-	 * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1155
-	 *
1156
-	 * @access private
1157
-	 * @return void
1158
-	 */
1159
-	private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1160
-		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1161
-			'TYPO3\CMS\Core\Messaging\FlashMessage',
1162
-			$message,
1163
-			'',
1164
-			$severity
1165
-		);
1166
-
1167
-		// TODO:
1168
-		/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1169
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1170
-		$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1171
-	}
1172
-
1173
-	/**
1174
-	 * Add notice message to the user interface.
1175
-	 *
1176
-	 * NOTE:
1177
-	 * This method is basesd on TYPO3 4.3 or higher!
1178
-	 *
1179
-	 * @param string The message
1180
-	 *
1181
-	 * @access protected
1182
-	 * @return void
1183
-	 *
1184
-	 * @author Michael Klapper <[email protected]>
1185
-	 */
1186
-	protected function addNoticeMessage($message) {
1187
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1188
-	}
1189
-
1190
-	/**
1191
-	 * Add error message to the user interface.
1192
-	 *
1193
-	 * NOTE:
1194
-	 * This method is basesd on TYPO3 4.3 or higher!
1195
-	 *
1196
-	 * @param string The message
1197
-	 *
1198
-	 * @access protected
1199
-	 * @return void
1200
-	 *
1201
-	 * @author Michael Klapper <[email protected]>
1202
-	 */
1203
-	protected function addErrorMessage($message) {
1204
-		$this->isErrorDetected = TRUE;
1205
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1206
-	}
1207
-
1208
-	/**
1209
-	 * Add error message to the user interface.
1210
-	 *
1211
-	 * NOTE:
1212
-	 * This method is basesd on TYPO3 4.3 or higher!
1213
-	 *
1214
-	 * @param string The message
1215
-	 *
1216
-	 * @access protected
1217
-	 * @return void
1218
-	 *
1219
-	 * @author Michael Klapper <[email protected]>
1220
-	 */
1221
-	protected function addWarningMessage($message) {
1222
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1223
-	}
1224
-
1225
-	/**
1226
-	 * Create selector box
1227
-	 *
1228
-	 * @param	array		$optArray Options key(value) => label pairs
1229
-	 * @param	string		$name Selector box name
1230
-	 * @param	string		$value Selector box value (array for multiple...)
1231
-	 * @param	boolean		$multiple If set, will draw multiple box.
1147
+    /**
1148
+     * This method is used to add a message to the internal queue
1149
+     *
1150
+     * NOTE:
1151
+     * This method is basesd on TYPO3 4.3 or higher!
1232 1152
      *
1233
-	 * @return	string		HTML select element
1234
-	 */
1235
-	function selectorBox($optArray, $name, $value, $multiple)	{
1153
+     * @param  string  the message itself
1154
+     * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1155
+     *
1156
+     * @access private
1157
+     * @return void
1158
+     */
1159
+    private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1160
+        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1161
+            'TYPO3\CMS\Core\Messaging\FlashMessage',
1162
+            $message,
1163
+            '',
1164
+            $severity
1165
+        );
1166
+
1167
+        // TODO:
1168
+        /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1169
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1170
+        $flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1171
+    }
1172
+
1173
+    /**
1174
+     * Add notice message to the user interface.
1175
+     *
1176
+     * NOTE:
1177
+     * This method is basesd on TYPO3 4.3 or higher!
1178
+     *
1179
+     * @param string The message
1180
+     *
1181
+     * @access protected
1182
+     * @return void
1183
+     *
1184
+     * @author Michael Klapper <[email protected]>
1185
+     */
1186
+    protected function addNoticeMessage($message) {
1187
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1188
+    }
1189
+
1190
+    /**
1191
+     * Add error message to the user interface.
1192
+     *
1193
+     * NOTE:
1194
+     * This method is basesd on TYPO3 4.3 or higher!
1195
+     *
1196
+     * @param string The message
1197
+     *
1198
+     * @access protected
1199
+     * @return void
1200
+     *
1201
+     * @author Michael Klapper <[email protected]>
1202
+     */
1203
+    protected function addErrorMessage($message) {
1204
+        $this->isErrorDetected = TRUE;
1205
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1206
+    }
1207
+
1208
+    /**
1209
+     * Add error message to the user interface.
1210
+     *
1211
+     * NOTE:
1212
+     * This method is basesd on TYPO3 4.3 or higher!
1213
+     *
1214
+     * @param string The message
1215
+     *
1216
+     * @access protected
1217
+     * @return void
1218
+     *
1219
+     * @author Michael Klapper <[email protected]>
1220
+     */
1221
+    protected function addWarningMessage($message) {
1222
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1223
+    }
1224
+
1225
+    /**
1226
+     * Create selector box
1227
+     *
1228
+     * @param	array		$optArray Options key(value) => label pairs
1229
+     * @param	string		$name Selector box name
1230
+     * @param	string		$value Selector box value (array for multiple...)
1231
+     * @param	boolean		$multiple If set, will draw multiple box.
1232
+     *
1233
+     * @return	string		HTML select element
1234
+     */
1235
+    function selectorBox($optArray, $name, $value, $multiple)	{
1236 1236
 
1237
-		$options = array();
1238
-		foreach($optArray as $key => $val)	{
1239
-			$options[] = '
1237
+        $options = array();
1238
+        foreach($optArray as $key => $val)	{
1239
+            $options[] = '
1240 1240
 				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1241
-		}
1241
+        }
1242 1242
 
1243
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1243
+        $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1244 1244
 
1245
-		return $output;
1246
-	}
1245
+        return $output;
1246
+    }
1247 1247
 
1248
-	/**
1249
-	 * Activate hooks
1250
-	 *
1251
-	 * @return	void
1252
-	 */
1253
-	function runRefreshHooks() {
1254
-		$crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1255
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1256
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1257
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1258
-				if (is_object($hookObj)) {
1259
-					$hookObj->crawler_init($crawlerLib);
1260
-				}
1261
-			}
1262
-		}
1248
+    /**
1249
+     * Activate hooks
1250
+     *
1251
+     * @return	void
1252
+     */
1253
+    function runRefreshHooks() {
1254
+        $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1255
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1256
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1257
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1258
+                if (is_object($hookObj)) {
1259
+                    $hookObj->crawler_init($crawlerLib);
1260
+                }
1261
+            }
1262
+        }
1263 1263
 
1264
-	}
1264
+    }
1265 1265
 
1266
-	/**
1267
-	 * Returns the URL to the current module, including $_GET['id'].
1268
-	 *
1269
-	 * @param array $urlParameters optional parameters to add to the URL
1270
-	 * @return string
1271
-	 */
1272
-	protected function getModuleUrl(array $urlParameters = array()) {
1273
-	    if ($this->pObj->id) {
1274
-	        $urlParameters = array_merge($urlParameters, array(
1266
+    /**
1267
+     * Returns the URL to the current module, including $_GET['id'].
1268
+     *
1269
+     * @param array $urlParameters optional parameters to add to the URL
1270
+     * @return string
1271
+     */
1272
+    protected function getModuleUrl(array $urlParameters = array()) {
1273
+        if ($this->pObj->id) {
1274
+            $urlParameters = array_merge($urlParameters, array(
1275 1275
                 'id' => $this->pObj->id
1276 1276
             ));
1277
-	    }
1277
+        }
1278 1278
         return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters);
1279
-	}
1279
+    }
1280 1280
 }
1281 1281
 
1282 1282
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1283
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1283
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1284 1284
 }
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return	array		Menu array
97 97
 	 */
98
-	function modMenu()	{
98
+	function modMenu() {
99 99
 		global $LANG;
100 100
 
101
-		return array (
101
+		return array(
102 102
 			'depth' => array(
103 103
 				0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
104 104
 				1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 			// Set CSS styles specific for this document:
158
-		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
158
+		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', '
159 159
 			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
160 160
 		',$this->pObj->content);
161 161
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		*/
201 201
 
202 202
 			// Additional menus for the log type:
203
-		if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
203
+		if ($this->pObj->MOD_SETTINGS['crawlaction'] === 'log') {
204 204
 			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
205 205
 				$this->pObj->id,
206 206
 				'SET[depth]',
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 				'index.php'
210 210
 			);
211 211
 
212
-			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
212
+			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
213 213
 
214 214
 			$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
215 215
 
216
-			$h_func.= '<hr/>'.
217
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
218
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
219
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
220
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
216
+			$h_func .= '<hr/>'.
217
+					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[log_display]', $this->pObj->MOD_SETTINGS['log_display'], $this->pObj->MOD_MENU['log_display'], 'index.php', '&setID='.$setId).' - '.
218
+					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_resultLog]', $this->pObj->MOD_SETTINGS['log_resultLog'], 'index.php', '&setID='.$setId.$quiPart).' - '.
219
+					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_feVars]', $this->pObj->MOD_SETTINGS['log_feVars'], 'index.php', '&setID='.$setId.$quiPart).' - '.
220
+					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': '.
221 221
 					\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
222 222
 						$this->pObj->id,
223 223
 						'SET[itemsPerPage]',
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
231 231
 
232 232
 			// Branch based on type:
233
-		switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
233
+		switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) {
234 234
 			case 'start':
235 235
 				if (empty($this->pObj->id)) {
236 236
 					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @return	string		HTML output
280 280
 	 */
281
-	function drawURLs()	{
281
+	function drawURLs() {
282 282
 		global $BACK_PATH, $BE_USER;
283 283
 
284 284
 			// Init:
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 		$this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
288 288
 		$this->makeCrawlerProcessableChecks();
289 289
 
290
-		switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
290
+		switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) {
291 291
 			case 'midnight':
292
-				$this->scheduledTime = mktime(0,0,0);
292
+				$this->scheduledTime = mktime(0, 0, 0);
293 293
 			break;
294 294
 			case '04:00':
295
-				$this->scheduledTime = mktime(0,0,0)+4*3600;
295
+				$this->scheduledTime = mktime(0, 0, 0) + 4 * 3600;
296 296
 			break;
297 297
 			case 'now':
298 298
 			default:
@@ -312,23 +312,23 @@  discard block
 block discarded – undo
312 312
 		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
313 313
 
314 314
 		if (empty($this->incomingConfigurationSelection)
315
-			|| (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
315
+			|| (count($this->incomingConfigurationSelection) == 1 && empty($this->incomingConfigurationSelection[0]))
316 316
 			) {
317
-			$code= '
317
+			$code = '
318 318
 			<tr>
319 319
 				<td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td>
320 320
 			</tr>';
321 321
 		} else {
322
-			if($this->submitCrawlUrls){
322
+			if ($this->submitCrawlUrls) {
323 323
 				$reason = new tx_crawler_domain_reason();
324 324
 				$reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
325 325
 
326
-				if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
326
+				if ($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) { $username = $BE_USER->user['username']; }
327 327
 				$reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
328 328
 
329
-				tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
329
+				tx_crawler_domain_events_dispatcher::getInstance()->post('invokeQueueChange',
330 330
 																			$this->findCrawler()->setID,
331
-																			array(	'reason' => $reason ));
331
+																			array('reason' => $reason));
332 332
 			}
333 333
 
334 334
 			$code = $this->crawlerObj->getPageTreeAndUrls(
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
 		$this->duplicateTrack = $this->crawlerObj->duplicateTrack;
350 350
 
351 351
 		$output = '';
352
-		if ($code)	{
352
+		if ($code) {
353 353
 
354 354
 			$output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
355 355
 			$output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
356 356
 
357
-			if (!$this->submitCrawlUrls)	{
357
+			if (!$this->submitCrawlUrls) {
358 358
 				$output .= $this->drawURLs_cfgSelectors().'<br />';
359 359
 				$output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
360 360
 				$output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
361 361
 				$output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
362 362
 				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
363
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
363
+				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'<br />';
364 364
 				$output .= '<br />
365 365
 					<table class="lrPadding c-list url-table">'.
366 366
 						$this->drawURLs_printTableHeader().
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 		}
375 375
 
376 376
 			// Download Urls to crawl:
377
-		if ($this->downloadCrawlUrls)	{
377
+		if ($this->downloadCrawlUrls) {
378 378
 
379 379
 				// Creating output header:
380 380
 			$mimeType = 'application/octet-stream';
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 			Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
383 383
 
384 384
 				// Printing the content of the CSV lines:
385
-			echo implode(chr(13).chr(10),$this->downloadUrls);
385
+			echo implode(chr(13).chr(10), $this->downloadUrls);
386 386
 
387 387
 				// Exits:
388 388
 			exit;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 *
398 398
 	 * @return	string		HTML table
399 399
 	 */
400
-	function drawURLs_cfgSelectors()	{
400
+	function drawURLs_cfgSelectors() {
401 401
 
402 402
 			// depth
403 403
 		$cell[] = $this->selectorBox(
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 			$this->pObj->MOD_SETTINGS['depth'],
414 414
 			0
415 415
 		);
416
-		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
416
+		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0);
417 417
 
418 418
 			// Configurations
419 419
 		$cell[] = $this->selectorBox(
420
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
420
+			empty($availableConfigurations) ? array() : array_combine($availableConfigurations, $availableConfigurations),
421 421
 			'configurationSelection',
422 422
 			$this->incomingConfigurationSelection,
423 423
 			1
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return	string		Table header
480 480
 	 */
481
-	function drawURLs_printTableHeader()	{
481
+	function drawURLs_printTableHeader() {
482 482
 
483 483
 		$content = '
484 484
 			<tr class="bgColor5 tableheader">
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 *
517 517
 	 * @return	string		HTML output
518 518
 	 */
519
-	function drawLog()	{
519
+	function drawLog() {
520 520
 		global $BACK_PATH;
521 521
 		$output = '';
522 522
 
@@ -529,45 +529,45 @@  discard block
 block discarded – undo
529 529
 
530 530
 			// Read URL:
531 531
 		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
532
-			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
532
+			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')), TRUE);
533 533
 		}
534 534
 
535 535
 			// Look for set ID sent - if it is, we will display contents of that set:
536 536
 		$showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
537 537
 
538 538
 			// Show details:
539
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
539
+		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) {
540 540
 
541 541
 				// Get entry record:
542
-			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
542
+			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
543 543
 
544 544
 				// Explode values:
545 545
 				$resStatus = $this->getResStatus($q_entry);
546 546
 			$q_entry['parameters'] = unserialize($q_entry['parameters']);
547 547
 			$q_entry['result_data'] = unserialize($q_entry['result_data']);
548
-			if (is_array($q_entry['result_data']))	{
548
+			if (is_array($q_entry['result_data'])) {
549 549
 				$q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
550 550
 			}
551 551
 
552
-			if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
552
+			if (!$this->pObj->MOD_SETTINGS['log_resultLog']) {
553 553
 				unset($q_entry['result_data']['content']['log']);
554 554
 			}
555 555
 
556 556
 				// Print rudimentary details:
557 557
 			$output .= '
558 558
 				<br /><br />
559
-				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
560
-				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
561
-				<input type="hidden" value="' . $showSetId . '" name="setID" />
559
+				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" />
560
+				<input type="hidden" value="' . $this->pObj->id.'" name="id" />
561
+				<input type="hidden" value="' . $showSetId.'" name="setID" />
562 562
 				<br />
563
-				Current server time: ' . date('H:i:s', time()) . '<br />' .
564
-				'Status: ' . $resStatus . '<br />' .
563
+				Current server time: ' . date('H:i:s', time()).'<br />'.
564
+				'Status: '.$resStatus.'<br />'.
565 565
 				\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
566 566
 		} else {	// Show list:
567 567
 
568 568
 				// If either id or set id, show list:
569
-			if ($this->pObj->id || $showSetId)	{
570
-				if ($this->pObj->id)	{
569
+			if ($this->pObj->id || $showSetId) {
570
+				if ($this->pObj->id) {
571 571
 						// Drawing tree:
572 572
 					$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
573 573
 					$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 					);
590 590
 
591 591
 						// Get branch beneath:
592
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
592
+					if ($this->pObj->MOD_SETTINGS['depth']) {
593 593
 						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
594 594
 					}
595 595
 
596 596
 						// Traverse page tree:
597 597
 					$code = ''; $count = 0;
598
-					foreach($tree->tree as $data)	{
598
+					foreach ($tree->tree as $data) {
599 599
 						$code .= $this->drawLog_addRows(
600 600
 									$data['row'],
601
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
601
+									$data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE),
602 602
 									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
603 603
 								);
604 604
 						if (++$count == 1000) {
@@ -607,13 +607,13 @@  discard block
 block discarded – undo
607 607
 					}
608 608
 				} else {
609 609
 					$code = '';
610
-					$code.= $this->drawLog_addRows(
610
+					$code .= $this->drawLog_addRows(
611 611
 								$showSetId,
612 612
 								'Set ID: '.$showSetId
613 613
 							);
614 614
 				}
615 615
 
616
-				if ($code)	{
616
+				if ($code) {
617 617
 
618 618
 					$output .= '
619 619
 						<br /><br />
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 						<input type="hidden" value="'.$this->pObj->id.'" name="id" />
625 625
 						<input type="hidden" value="'.$showSetId.'" name="setID" />
626 626
 						<br />
627
-						'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'
627
+						'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'
628 628
 						<br /><br />
629 629
 
630 630
 
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
 					</tr>
651 651
 				';
652 652
 
653
-				$cc=0;
654
-				foreach($setList as $set)	{
655
-					$code.= '
656
-						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
653
+				$cc = 0;
654
+				foreach ($setList as $set) {
655
+					$code .= '
656
+						<tr class="bgColor'.($cc % 2 ? '-20' : '-10').'">
657 657
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
658 658
 							<td>'.$set['count_value'].'</td>
659 659
 							<td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td>
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 			}
672 672
 		}
673 673
 
674
-		if($this->CSVExport) {
674
+		if ($this->CSVExport) {
675 675
 			$this->outputCsvFile();
676 676
 		}
677 677
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
698 698
 
699 699
 			// Data:
700
-		foreach($this->CSVaccu as $row)	{
700
+		foreach ($this->CSVaccu as $row) {
701 701
 			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
702 702
 		}
703 703
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
708 708
 
709 709
 			// Printing the content of the CSV lines:
710
-		echo implode(chr(13).chr(10),$csvLines);
710
+		echo implode(chr(13).chr(10), $csvLines);
711 711
 
712 712
 			// Exits:
713 713
 		exit;
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
      *
724 724
 	 * @return string HTML <tr> content (one or more)
725 725
 	 */
726
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
726
+	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) {
727 727
 
728 728
 			// If Flush button is pressed, flush tables instead of selecting entries:
729 729
 
730
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
730
+		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
731 731
 			$doFlush = true;
732 732
 			$doFullFlush = false;
733
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
733
+		} elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
734 734
 			$doFlush = true;
735 735
 			$doFullFlush = true;
736 736
 		} else {
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		}
740 740
 
741 741
 			// Get result:
742
-		if (is_array($pageRow_setId))	{
742
+		if (is_array($pageRow_setId)) {
743 743
 			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
744 744
 		} else {
745 745
 			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
751 751
 				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
752 752
 
753
-		if (count($res))	{
753
+		if (count($res)) {
754 754
 				// Traverse parameter combinations:
755 755
 			$c = 0;
756
-			$content='';
757
-			foreach($res as $kk => $vv)	{
756
+			$content = '';
757
+			foreach ($res as $kk => $vv) {
758 758
 
759 759
 					// Title column:
760
-				if (!$c)	{
760
+				if (!$c) {
761 761
 					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
762 762
 				} else {
763 763
 					$titleClm = '';
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
 
775 775
 					// Put data into array:
776 776
 				$rowData = array();
777
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
777
+				if ($this->pObj->MOD_SETTINGS['log_resultLog']) {
778 778
 					$rowData['result_log'] = $resLog;
779 779
 				} else {
780
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
780
+					$rowData['scheduled'] = ($vv['scheduled'] > 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
781 781
 					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
782 782
 				}
783
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
783
+				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus, 50);
784 784
 				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
785 785
 				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
786
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
786
+				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : '';
787 787
 				$rowData['set_id'] = $vv['set_id'];
788 788
 
789 789
 				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
@@ -794,34 +794,34 @@  discard block
 block discarded – undo
794 794
 
795 795
 				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
796 796
 
797
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
798
-				if (version_compare(TYPO3_version,'7.0','>=')) {
799
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
797
+				$refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif';
798
+				if (version_compare(TYPO3_version, '7.0', '>=')) {
799
+					$refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif';
800 800
 				}
801 801
 
802 802
 					// Put rows together:
803
-				$content.= '
804
-					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
803
+				$content .= '
804
+					<tr class="bgColor'.($c % 2 ? '-20' : '-10').'">
805 805
 						'.$titleClm.'
806
-						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
807
-						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>';
808
-				foreach($rowData as $fKey => $value) {
806
+						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)).'">'.htmlspecialchars($vv['qid']).'</a></td>
807
+						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)).'"><img src="'.$refreshIcon.'" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>';
808
+				foreach ($rowData as $fKey => $value) {
809 809
 
810
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
811
-						$content.= '
810
+					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) {
811
+						$content .= '
812 812
 						<td>'.$value.'</td>';
813 813
 					} else {
814
-						$content.= '
814
+						$content .= '
815 815
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
816 816
 					}
817 817
 				}
818
-				$content.= '
818
+				$content .= '
819 819
 					</tr>';
820 820
 				$c++;
821 821
 
822
-				if ($this->CSVExport)	{
822
+				if ($this->CSVExport) {
823 823
 						// Only for CSV (adding qid and scheduled/exec_time if needed):
824
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
824
+					$rowData['result_log'] = implode('// ', explode(chr(10), $resLog));
825 825
 					$rowData['qid'] = $vv['qid'];
826 826
 					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
827 827
 					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 *
865 865
 	 * @return	string		Table header
866 866
 	 */
867
-	function drawLog_printTableHeader()	{
867
+	function drawLog_printTableHeader() {
868 868
 
869 869
 		$content = '
870 870
 			<tr class="bgColor5 tableheader">
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
         }
916 916
 
917 917
 	function getResStatus($vv) {
918
-		if ($vv['result_data'])	{
918
+		if ($vv['result_data']) {
919 919
 			$requestContent = unserialize($vv['result_data']);
920 920
 			$requestResult = unserialize($requestContent['content']);
921 921
 			if (is_array($requestResult)) {
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 				} else {
925 925
 					$resStatus = implode("\n", $requestResult['errorlog']);
926 926
 				}
927
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
927
+				$resLog = is_array($requestResult['log']) ? implode(chr(10), $requestResult['log']) : '';
928 928
 			} else {
929
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
929
+				$resStatus = 'Error: '.substr(preg_replace('/\s+/', ' ', strip_tags($requestContent['content'])), 0, 10000).'...';
930 930
 			}
931 931
 		} else {
932 932
 			$resStatus = '-';
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 * @param void
955 955
 	 * @return string
956 956
 	 */
957
-	protected function drawProcessOverviewAction(){
957
+	protected function drawProcessOverviewAction() {
958 958
 
959 959
 		$this->runRefreshHooks();
960 960
 
@@ -968,20 +968,20 @@  discard block
 block discarded – undo
968 968
 			$this->addErrorMessage($e->getMessage());
969 969
 		}
970 970
 
971
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
-		$perpage 	= 20;
971
+		$offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
+		$perpage = 20;
973 973
 
974
-		$processRepository	= new tx_crawler_domain_process_repository();
975
-		$queueRepository	= new tx_crawler_domain_queue_repository();
974
+		$processRepository = new tx_crawler_domain_process_repository();
975
+		$queueRepository = new tx_crawler_domain_queue_repository();
976 976
 
977 977
 		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
978 978
 		if ($mode == 'detail') {
979 979
 			$where = '';
980
-		} elseif($mode == 'simple') {
980
+		} elseif ($mode == 'simple') {
981 981
 			$where = 'active = 1';
982 982
 		}
983 983
 
984
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
984
+		$allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where);
985 985
 		$allCount			= $processRepository->countAll($where);
986 986
 
987 987
 		$listView			= new tx_crawler_view_process_list();
@@ -993,10 +993,10 @@  discard block
 block discarded – undo
993 993
 		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
994 994
 		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
995 995
 		$listView->setActiveProcessCount($processRepository->countActive());
996
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
996
+		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1));
997 997
 		$listView->setMode($mode);
998 998
 
999
-		$paginationView		= new tx_crawler_view_pagination();
999
+		$paginationView = new tx_crawler_view_pagination();
1000 1000
 		$paginationView->setCurrentOffset($offset);
1001 1001
 		$paginationView->setPerPage($perpage);
1002 1002
 		$paginationView->setTotalItemCount($allCount);
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 		$exitCode = 0;
1035 1035
 		$out = array();
1036
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1036
+		exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode);
1037 1037
 		if ($exitCode > 0) {
1038 1038
 			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1039 1039
 		}
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 	 * @param void
1097 1097
 	 * @return void
1098 1098
 	 */
1099
-	protected function handleProcessOverviewActions(){
1099
+	protected function handleProcessOverviewActions() {
1100 1100
 
1101 1101
 		$crawler = $this->findCrawler();
1102 1102
 
@@ -1129,8 +1129,8 @@  discard block
 block discarded – undo
1129 1129
 	 * @return tx_crawler_lib crawler object
1130 1130
 	 * @author Timo Schmidt <[email protected]>
1131 1131
 	 */
1132
-	protected function findCrawler(){
1133
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1132
+	protected function findCrawler() {
1133
+		if (!$this->crawlerObj instanceof tx_crawler_lib) {
1134 1134
 			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1135 1135
 		}
1136 1136
 		return $this->crawlerObj;
@@ -1232,15 +1232,15 @@  discard block
 block discarded – undo
1232 1232
      *
1233 1233
 	 * @return	string		HTML select element
1234 1234
 	 */
1235
-	function selectorBox($optArray, $name, $value, $multiple)	{
1235
+	function selectorBox($optArray, $name, $value, $multiple) {
1236 1236
 
1237 1237
 		$options = array();
1238
-		foreach($optArray as $key => $val)	{
1238
+		foreach ($optArray as $key => $val) {
1239 1239
 			$options[] = '
1240
-				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1240
+				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>';
1241 1241
 		}
1242 1242
 
1243
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1243
+		$output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>';
1244 1244
 
1245 1245
 		return $output;
1246 1246
 	}
@@ -1279,6 +1279,6 @@  discard block
 block discarded – undo
1279 1279
 	}
1280 1280
 }
1281 1281
 
1282
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1282
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) {
1283 1283
 	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1284 1284
 }
Please login to merge, or discard this patch.
class.tx_crawler_lib.php 4 patches
Doc Comments   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
      *
425 425
      * @param  string $piString                     PI to test
426 426
      * @param  array  $incomingProcInstructions     Processing instructions
427
-     * @return boolean                              TRUE if found
427
+     * @return boolean|null                              TRUE if found
428 428
      */
429 429
     public function drawURLs_PIfilter($piString, array $incomingProcInstructions) {
430 430
         if (empty($incomingProcInstructions)) {
@@ -632,6 +632,9 @@  discard block
 block discarded – undo
632 632
         return $baseUrl;
633 633
     }
634 634
 
635
+    /**
636
+     * @param integer $rootid
637
+     */
635 638
     function getConfigurationsForBranch($rootid, $depth) {
636 639
 
637 640
         $configurationsForBranch = array();
@@ -735,6 +738,7 @@  discard block
 block discarded – undo
735 738
      *
736 739
      * @param    array        Array with key (GET var name) and values (value of GET var which is configuration for expansion)
737 740
      * @param    integer        Current page ID
741
+     * @param integer $pid
738 742
      * @return    array        Array with key (GET var name) with the value being an array of all possible values for that key.
739 743
      */
740 744
     function expandParameters($paramArray, $pid)    {
@@ -853,7 +857,7 @@  discard block
 block discarded – undo
853 857
      * The number of URLs will be the multiplication of the number of parameter values for each key
854 858
      *
855 859
      * @param  array  $paramArray   Output of expandParameters(): Array with keys (GET var names) and for each an array of values
856
-     * @param  array  $urls         URLs accumulated in this array (for recursion)
860
+     * @param  string[]  $urls         URLs accumulated in this array (for recursion)
857 861
      * @return array                URLs accumulated, if number of urls exceed 'maxCompileUrls' it will return false as an error!
858 862
      */
859 863
     public function compileUrls($paramArray, $urls = array()) {
@@ -1031,6 +1035,8 @@  discard block
 block discarded – undo
1031 1035
      * @param    integer        Scheduled-time
1032 1036
      * @param     string        (optional) configuration hash
1033 1037
      * @param     bool        (optional) skip inner duplication check
1038
+     * @param string $url
1039
+     * @param double $tstamp
1034 1040
      * @return    bool        true if the url was added, false if it already existed
1035 1041
      */
1036 1042
     function addUrl (
@@ -1106,7 +1112,6 @@  discard block
 block discarded – undo
1106 1112
      * If the timestamp is in the future it will check, if the queued entry has exactly the same timestamp
1107 1113
      *
1108 1114
      * @param int $tstamp
1109
-     * @param string $parameters
1110 1115
      * @author Fabrizio Branca
1111 1116
      * @author Timo Schmidt
1112 1117
      * @return array;
@@ -1470,6 +1475,7 @@  discard block
 block discarded – undo
1470 1475
 
1471 1476
     /**
1472 1477
      * @param message
1478
+     * @param string $message
1473 1479
      */
1474 1480
     protected function log($message) {
1475 1481
         if (!empty($this->extensionSettings['logFileName'])) {
@@ -1483,7 +1489,7 @@  discard block
 block discarded – undo
1483 1489
      * @param array $url
1484 1490
      * @param string $crawlerId
1485 1491
      *
1486
-     * @return array
1492
+     * @return string[]
1487 1493
      */
1488 1494
     protected function buildRequestHeaderArray(array $url, $crawlerId) {
1489 1495
         $reqHeaders = array();
@@ -1586,6 +1592,12 @@  discard block
 block discarded – undo
1586 1592
      * @param    boolean        If set (and submitcrawlUrls is false) will fill $downloadUrls with entries)
1587 1593
      * @param    array        Array of processing instructions
1588 1594
      * @param    array        Array of configuration keys
1595
+     * @param integer $id
1596
+     * @param integer $depth
1597
+     * @param integer $scheduledTime
1598
+     * @param integer $reqMinute
1599
+     * @param boolean $submitCrawlUrls
1600
+     * @param boolean $downloadCrawlUrls
1589 1601
      * @return    string        HTML code
1590 1602
      */
1591 1603
     function getPageTreeAndUrls(
@@ -1740,6 +1752,7 @@  discard block
 block discarded – undo
1740 1752
      *
1741 1753
      * @param    array        Page row
1742 1754
      * @param    string        Page icon and title for row
1755
+     * @param string $pageTitleAndIcon
1743 1756
      * @return    string        HTML <tr> content (one or more)
1744 1757
      */
1745 1758
     public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon)    {
@@ -2040,7 +2053,7 @@  discard block
 block discarded – undo
2040 2053
     /**
2041 2054
      * Function executed by crawler_im.php cli script.
2042 2055
      *
2043
-     * @return bool
2056
+     * @return null|boolean
2044 2057
      */
2045 2058
     function CLI_main_flush() {
2046 2059
         $this->setAccessMode('cli_flush');
@@ -2097,7 +2110,7 @@  discard block
 block discarded – undo
2097 2110
      * @param  int $countInARun
2098 2111
      * @param  int $sleepTime
2099 2112
      * @param  int $sleepAfterFinish
2100
-     * @return string                   Status message
2113
+     * @return integer                   Status message
2101 2114
      */
2102 2115
     public function CLI_run($countInARun, $sleepTime, $sleepAfterFinish) {
2103 2116
         $result = 0;
@@ -2369,6 +2382,7 @@  discard block
 block discarded – undo
2369 2382
      * Used to determine timeouts and to ensure a proper cleanup if there's a timeout
2370 2383
      *
2371 2384
      * @param  string  identification string for the process
2385
+     * @param string $pid
2372 2386
      * @return boolean determines if the process is still active / has resources
2373 2387
      *
2374 2388
      * FIXME: Please remove Transaction, not needed as only a select query.
@@ -2406,7 +2420,7 @@  discard block
 block discarded – undo
2406 2420
     /**
2407 2421
      * @param bool $get_as_float
2408 2422
      *
2409
-     * @return mixed
2423
+     * @return string
2410 2424
      */
2411 2425
     protected function microtime($get_as_float = false )
2412 2426
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
             return FALSE;
1330 1330
         }
1331 1331
 
1332
- 	    // direct request
1332
+            // direct request
1333 1333
         if ($this->extensionSettings['makeDirectRequests']) {
1334 1334
             $result = $this->sendDirectRequest($originalUrl, $crawlerId);
1335 1335
             return $result;
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
      *
2361 2361
      * @return void
2362 2362
      */
2363
-     public function CLI_deleteProcessesMarkedDeleted() {
2363
+        public function CLI_deleteProcessesMarkedDeleted() {
2364 2364
         $this->db->exec_DELETEquery('tx_crawler_process', 'deleted = 1');
2365 2365
     }
2366 2366
 
Please login to merge, or discard this patch.
Spacing   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 class tx_crawler_lib {
33 33
 
34 34
     var $setID = 0;
35
-    var $processID ='';
36
-    var $max_CLI_exec_time = 3600;    // One hour is max stalled time for the CLI (If the process has had the status "start" for 3600 seconds it will be regarded stalled and a new process is started.
35
+    var $processID = '';
36
+    var $max_CLI_exec_time = 3600; // One hour is max stalled time for the CLI (If the process has had the status "start" for 3600 seconds it will be regarded stalled and a new process is started.
37 37
 
38 38
     var $duplicateTrack = array();
39 39
     var $downloadUrls = array();
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
     var $queueEntries = array();
47 47
     var $urlList = array();
48 48
 
49
-    var $debugMode=FALSE;
49
+    var $debugMode = FALSE;
50 50
 
51
-    var $extensionSettings=array();
51
+    var $extensionSettings = array();
52 52
 
53 53
     var $MP = false; // mount point
54 54
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
     private $backendUser;
73 73
 
74 74
     const CLI_STATUS_NOTHING_PROCCESSED = 0;
75
-    const CLI_STATUS_REMAIN = 1;    //queue not empty
76
-    const CLI_STATUS_PROCESSED = 2;    //(some) queue items where processed
77
-    const CLI_STATUS_ABORTED = 4;    //instance didn't finish
75
+    const CLI_STATUS_REMAIN = 1; //queue not empty
76
+    const CLI_STATUS_PROCESSED = 2; //(some) queue items where processed
77
+    const CLI_STATUS_ABORTED = 4; //instance didn't finish
78 78
     const CLI_STATUS_POLLABLE_PROCESSED = 8;
79 79
 
80 80
     /**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $this->extensionSettings['countInARun'] = 100;
166 166
         }
167 167
 
168
-        $this->extensionSettings['processLimit'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1);
168
+        $this->extensionSettings['processLimit'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1);
169 169
     }
170 170
 
171 171
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
         if (!$skipPage) {
202
-            if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('3,4', $pageRow['doktype']) || $pageRow['doktype']>=199)    {
202
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('3,4', $pageRow['doktype']) || $pageRow['doktype'] >= 199) {
203 203
                 $skipPage = true;
204 204
                 $skipMessage = 'Because doktype is not allowed';
205 205
             }
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
         if (!$skipPage) {
221 221
                 // veto hook
222 222
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'])) {
223
-                foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'] as $key => $func)    {
223
+                foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'] as $key => $func) {
224 224
                     $params = array(
225 225
                         'pageRow' => $pageRow
226 226
                     );
227 227
                     // expects "false" if page is ok and "true" or a skipMessage if this page should _not_ be crawled
228 228
                     $veto = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($func, $params, $this);
229
-                    if ($veto !== false)    {
229
+                    if ($veto !== false) {
230 230
                         $skipPage = true;
231 231
                         if (is_string($veto)) {
232 232
                             $skipMessage = $veto;
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
      * @param  string $configurationHash
277 277
      * @return boolean
278 278
      */
279
-    protected function noUnprocessedQueueEntriesForPageWithConfigurationHashExist($uid,$configurationHash) {
280
-        $configurationHash = $this->db->fullQuoteStr($configurationHash,'tx_crawler_queue');
281
-        $res = $this->db->exec_SELECTquery('count(*) as anz','tx_crawler_queue',"page_id=".intval($uid)." AND configuration_hash=".$configurationHash." AND exec_time=0");
279
+    protected function noUnprocessedQueueEntriesForPageWithConfigurationHashExist($uid, $configurationHash) {
280
+        $configurationHash = $this->db->fullQuoteStr($configurationHash, 'tx_crawler_queue');
281
+        $res = $this->db->exec_SELECTquery('count(*) as anz', 'tx_crawler_queue', "page_id=".intval($uid)." AND configuration_hash=".$configurationHash." AND exec_time=0");
282 282
         $row = $this->db->sql_fetch_assoc($res);
283 283
 
284 284
         return ($row['anz'] == 0);
@@ -343,26 +343,26 @@  discard block
 block discarded – undo
343 343
             }
344 344
         }
345 345
 
346
-        if (is_array($vv['URLs']))    {
347
-            $configurationHash     =    md5(serialize($vv));
348
-            $skipInnerCheck     =    $this->noUnprocessedQueueEntriesForPageWithConfigurationHashExist($pageRow['uid'],$configurationHash);
346
+        if (is_array($vv['URLs'])) {
347
+            $configurationHash = md5(serialize($vv));
348
+            $skipInnerCheck = $this->noUnprocessedQueueEntriesForPageWithConfigurationHashExist($pageRow['uid'], $configurationHash);
349 349
 
350
-            foreach($vv['URLs'] as $urlQuery)    {
350
+            foreach ($vv['URLs'] as $urlQuery) {
351 351
 
352
-                if ($this->drawURLs_PIfilter($vv['subCfg']['procInstrFilter'], $incomingProcInstructions))    {
352
+                if ($this->drawURLs_PIfilter($vv['subCfg']['procInstrFilter'], $incomingProcInstructions)) {
353 353
 
354 354
                     // Calculate cHash:
355
-                    if ($vv['subCfg']['cHash'])    {
355
+                    if ($vv['subCfg']['cHash']) {
356 356
                         /* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */
357 357
                         $cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Page\CacheHashCalculator');
358
-                        $urlQuery .= '&cHash=' . $cacheHash->generateForParameters($urlQuery);
358
+                        $urlQuery .= '&cHash='.$cacheHash->generateForParameters($urlQuery);
359 359
                     }
360 360
 
361 361
                     // Create key by which to determine unique-ness:
362 362
                     $uKey = $urlQuery.'|'.$vv['subCfg']['userGroups'].'|'.$vv['subCfg']['baseUrl'].'|'.$vv['subCfg']['procInstrFilter'];
363 363
 
364 364
                     // realurl support (thanks to Ingo Renner)
365
-                    $urlQuery = 'index.php' . $urlQuery;
365
+                    $urlQuery = 'index.php'.$urlQuery;
366 366
                     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl') && $vv['subCfg']['realurl']) {
367 367
                         $params = array(
368 368
                             'LD' => array(
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
                     }
376 376
 
377 377
                     // Scheduled time:
378
-                    $schTime = $scheduledTime + round(count($duplicateTrack)*(60/$reqMinute));
379
-                    $schTime = floor($schTime/60)*60;
378
+                    $schTime = $scheduledTime + round(count($duplicateTrack) * (60 / $reqMinute));
379
+                    $schTime = floor($schTime / 60) * 60;
380 380
 
381 381
                     if (isset($duplicateTrack[$uKey])) {
382 382
 
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
                         $urlList = '['.date('d.m.y H:i', $schTime).'] '.htmlspecialchars($urlQuery);
389 389
                         $this->urlList[] = '['.date('d.m.y H:i', $schTime).'] '.$urlQuery;
390 390
 
391
-                        $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')) . $urlQuery;
391
+                        $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')).$urlQuery;
392 392
 
393 393
                         // Submit for crawling!
394
-                        if ($submitCrawlUrls)    {
394
+                        if ($submitCrawlUrls) {
395 395
                             $added = $this->addUrl(
396 396
                             $pageRow['uid'],
397 397
                             $theUrl,
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                             if ($added === false) {
404 404
                                 $urlList .= ' (Url already existed)';
405 405
                             }
406
-                        } elseif ($downloadCrawlUrls)    {
406
+                        } elseif ($downloadCrawlUrls) {
407 407
                             $downloadUrls[$theUrl] = $theUrl;
408 408
                         }
409 409
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             return TRUE;
432 432
         }
433 433
 
434
-        foreach($incomingProcInstructions as $pi) {
434
+        foreach ($incomingProcInstructions as $pi) {
435 435
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($piString, $pi)) {
436 436
                 return TRUE;
437 437
             }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
     public function getPageTSconfigForId($id) {
443
-        if(!$this->MP){
443
+        if (!$this->MP) {
444 444
             $pageTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($id);
445 445
         } else {
446 446
             list(,$mountPointId) = explode('-', $this->MP);
@@ -480,24 +480,24 @@  discard block
 block discarded – undo
480 480
 
481 481
         $res = array();
482 482
 
483
-        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']))    {
483
+        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.'])) {
484 484
             $crawlerCfg = $pageTSconfig['tx_crawler.']['crawlerCfg.'];
485 485
 
486
-            if (is_array($crawlerCfg['paramSets.']))    {
487
-                foreach($crawlerCfg['paramSets.'] as $key => $values)    {
488
-                    if (!is_array($values))    {
486
+            if (is_array($crawlerCfg['paramSets.'])) {
487
+                foreach ($crawlerCfg['paramSets.'] as $key => $values) {
488
+                    if (!is_array($values)) {
489 489
 
490 490
                         // Sub configuration for a single configuration string:
491
-                        $subCfg = (array)$crawlerCfg['paramSets.'][$key.'.'];
491
+                        $subCfg = (array) $crawlerCfg['paramSets.'][$key.'.'];
492 492
                         $subCfg['key'] = $key;
493 493
 
494
-                        if (strcmp($subCfg['procInstrFilter'],''))    {
495
-                            $subCfg['procInstrFilter'] = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['procInstrFilter']));
494
+                        if (strcmp($subCfg['procInstrFilter'], '')) {
495
+                            $subCfg['procInstrFilter'] = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['procInstrFilter']));
496 496
                         }
497
-                        $pidOnlyList = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['pidsOnly'],1));
497
+                        $pidOnlyList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['pidsOnly'], 1));
498 498
 
499 499
                             // process configuration if it is not page-specific or if the specific page is the current page:
500
-                        if (!strcmp($subCfg['pidsOnly'],'') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList,$id))    {
500
+                        if (!strcmp($subCfg['pidsOnly'], '') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList, $id)) {
501 501
 
502 502
                                 // add trailing slash if not present
503 503
                             if (!empty($subCfg['baseUrl']) && substr($subCfg['baseUrl'], -1) != '/') {
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
                             $res[$key] = array();
509 509
                             $res[$key]['subCfg'] = $subCfg;
510 510
                             $res[$key]['paramParsed'] = $this->parseParams($values);
511
-                            $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'],$id);
511
+                            $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id);
512 512
                             $res[$key]['origin'] = 'pagets';
513 513
 
514 514
                                 // recognize MP value
515
-                            if(!$this->MP){
516
-                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'],array('?id='.$id));
515
+                            if (!$this->MP) {
516
+                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id));
517 517
                             } else {
518
-                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'],array('?id='.$id.'&MP='.$this->MP));
518
+                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id.'&MP='.$this->MP));
519 519
                             }
520 520
                         }
521 521
                     }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 'tx_crawler_configuration',
537 537
                 'pid',
538 538
                 intval($page['uid']),
539
-                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration')
539
+                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration')
540 540
             );
541 541
 
542 542
             if (is_array($configurationRecordsForCurrentPage)) {
@@ -545,10 +545,10 @@  discard block
 block discarded – undo
545 545
                         // check access to the configuration record
546 546
                     if (empty($configurationRecord['begroups']) || $GLOBALS['BE_USER']->isAdmin() || $this->hasGroupAccess($GLOBALS['BE_USER']->user['usergroup_cached_list'], $configurationRecord['begroups'])) {
547 547
 
548
-                        $pidOnlyList = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$configurationRecord['pidsonly'],1));
548
+                        $pidOnlyList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configurationRecord['pidsonly'], 1));
549 549
 
550 550
                             // process configuration if it is not page-specific or if the specific page is the current page:
551
-                        if (!strcmp($configurationRecord['pidsonly'],'') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList,$id)) {
551
+                        if (!strcmp($configurationRecord['pidsonly'], '') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList, $id)) {
552 552
                             $key = $configurationRecord['name'];
553 553
 
554 554
                                 // don't overwrite previously defined paramSets
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
                                     $res[$key]['subCfg'] = $subCfg;
583 583
                                     $res[$key]['paramParsed'] = $this->parseParams($configurationRecord['configuration']);
584 584
                                     $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id);
585
-                                    $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id=' . $id));
585
+                                    $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id));
586 586
                                     $res[$key]['origin'] = 'tx_crawler_configuration_'.$configurationRecord['uid'];
587 587
                                 }
588 588
                             }
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
             }
593 593
         }
594 594
 
595
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls']))    {
596
-            foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'] as $func)    {
595
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'])) {
596
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'] as $func) {
597 597
                 $params = array(
598 598
                     'res' => &$res,
599 599
                 );
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
             $res = $this->db->exec_SELECTquery(
621 621
                 '*',
622 622
                 'sys_domain',
623
-                'uid = '.$sysDomainUid .
624
-                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain') .
623
+                'uid = '.$sysDomainUid.
624
+                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain').
625 625
                 \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_domain')
626 626
             );
627 627
             $row = $this->db->sql_fetch_assoc($res);
628 628
             if ($row['domainName'] != '') {
629
-                return $urlScheme .'://'. $row['domainName'];
629
+                return $urlScheme.'://'.$row['domainName'];
630 630
             }
631 631
         }
632 632
         return $baseUrl;
@@ -637,28 +637,28 @@  discard block
 block discarded – undo
637 637
         $configurationsForBranch = array();
638 638
 
639 639
         $pageTSconfig = $this->getPageTSconfigForId($rootid);
640
-        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.']))    {
640
+        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'])) {
641 641
 
642 642
             $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
643
-            if(is_array($sets)) {
644
-                foreach($sets as $key=>$value) {
645
-                    if(!is_array($value)) continue;
646
-                    $configurationsForBranch[] = substr($key,-1)=='.'?substr($key,0,-1):$key;
643
+            if (is_array($sets)) {
644
+                foreach ($sets as $key=>$value) {
645
+                    if (!is_array($value)) continue;
646
+                    $configurationsForBranch[] = substr($key, -1) == '.' ? substr($key, 0, -1) : $key;
647 647
                 }
648 648
 
649 649
             }
650 650
         }
651 651
         $pids = array();
652 652
         $rootLine = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rootid);
653
-        foreach($rootLine as $node) {
653
+        foreach ($rootLine as $node) {
654 654
             $pids[] = $node['uid'];
655 655
         }
656 656
         /* @var \TYPO3\CMS\Backend\Tree\View\PageTreeView */
657 657
         $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
658 658
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
659
-        $tree->init('AND ' . $perms_clause);
659
+        $tree->init('AND '.$perms_clause);
660 660
         $tree->getTree($rootid, $depth, '');
661
-        foreach($tree->tree as $node) {
661
+        foreach ($tree->tree as $node) {
662 662
             $pids[] = $node['row']['uid'];
663 663
         }
664 664
 
@@ -666,12 +666,12 @@  discard block
 block discarded – undo
666 666
             '*',
667 667
             'tx_crawler_configuration',
668 668
             'pid IN ('.implode(',', $pids).') '.
669
-            \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') .
669
+            \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration').
670 670
             \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration').' '.
671 671
             \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tx_crawler_configuration').' '
672 672
         );
673 673
 
674
-        while($row = $this->db->sql_fetch_assoc($res)) {
674
+        while ($row = $this->db->sql_fetch_assoc($res)) {
675 675
             $configurationsForBranch[] = $row['name'];
676 676
         }
677 677
         $this->db->sql_free_result($res);
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
         if (empty($accessList)) {
694 694
             return true;
695 695
         }
696
-        foreach(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $groupList) as $groupUid) {
696
+        foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $groupList) as $groupUid) {
697 697
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($accessList, $groupUid)) {
698 698
                 return true;
699 699
             }
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
         $paramKeyValues = array();
713 713
         $GETparams = explode('&', $inputQuery);
714 714
 
715
-        foreach($GETparams as $paramAndValue)    {
716
-            list($p,$v) = explode('=', $paramAndValue, 2);
717
-            if (strlen($p))        {
715
+        foreach ($GETparams as $paramAndValue) {
716
+            list($p, $v) = explode('=', $paramAndValue, 2);
717
+            if (strlen($p)) {
718 718
                 $paramKeyValues[rawurldecode($p)] = rawurldecode($v);
719 719
             }
720 720
         }
@@ -737,84 +737,84 @@  discard block
 block discarded – undo
737 737
      * @param    integer        Current page ID
738 738
      * @return    array        Array with key (GET var name) with the value being an array of all possible values for that key.
739 739
      */
740
-    function expandParameters($paramArray, $pid)    {
740
+    function expandParameters($paramArray, $pid) {
741 741
         global $TCA;
742 742
 
743 743
             // Traverse parameter names:
744
-        foreach($paramArray as $p => $v)    {
744
+        foreach ($paramArray as $p => $v) {
745 745
             $v = trim($v);
746 746
 
747 747
                 // If value is encapsulated in square brackets it means there are some ranges of values to find, otherwise the value is literal
748
-            if (substr($v,0,1)==='[' && substr($v,-1)===']')    {
748
+            if (substr($v, 0, 1) === '[' && substr($v, -1) === ']') {
749 749
                     // So, find the value inside brackets and reset the paramArray value as an array.
750
-                $v = substr($v,1,-1);
750
+                $v = substr($v, 1, -1);
751 751
                 $paramArray[$p] = array();
752 752
 
753 753
                     // Explode parts and traverse them:
754
-                $parts = explode('|',$v);
755
-                foreach($parts as $pV)    {
754
+                $parts = explode('|', $v);
755
+                foreach ($parts as $pV) {
756 756
 
757 757
                         // Look for integer range: (fx. 1-34 or -40--30 // reads minus 40 to minus 30)
758
-                    if (preg_match('/^(-?[0-9]+)\s*-\s*(-?[0-9]+)$/',trim($pV),$reg))    {    // Integer range:
758
+                    if (preg_match('/^(-?[0-9]+)\s*-\s*(-?[0-9]+)$/', trim($pV), $reg)) {    // Integer range:
759 759
 
760 760
                             // Swap if first is larger than last:
761
-                        if ($reg[1] > $reg[2])    {
761
+                        if ($reg[1] > $reg[2]) {
762 762
                             $temp = $reg[2];
763 763
                             $reg[2] = $reg[1];
764 764
                             $reg[1] = $temp;
765 765
                         }
766 766
 
767 767
                             // Traverse range, add values:
768
-                        $runAwayBrake = 1000;    // Limit to size of range!
769
-                        for($a=$reg[1]; $a<=$reg[2];$a++)    {
768
+                        $runAwayBrake = 1000; // Limit to size of range!
769
+                        for ($a = $reg[1]; $a <= $reg[2]; $a++) {
770 770
                             $paramArray[$p][] = $a;
771 771
                             $runAwayBrake--;
772
-                            if ($runAwayBrake<=0)    {
772
+                            if ($runAwayBrake <= 0) {
773 773
                                 break;
774 774
                             }
775 775
                         }
776
-                    } elseif (substr(trim($pV),0,7)=='_TABLE:')    {
776
+                    } elseif (substr(trim($pV), 0, 7) == '_TABLE:') {
777 777
 
778 778
                             // Parse parameters:
779
-                        $subparts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';',$pV);
779
+                        $subparts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $pV);
780 780
                         $subpartParams = array();
781
-                        foreach($subparts as $spV)    {
782
-                            list($pKey,$pVal) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':',$spV);
781
+                        foreach ($subparts as $spV) {
782
+                            list($pKey, $pVal) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $spV);
783 783
                             $subpartParams[$pKey] = $pVal;
784 784
                         }
785 785
 
786 786
                             // Table exists:
787
-                        if (isset($TCA[$subpartParams['_TABLE']]))    {
787
+                        if (isset($TCA[$subpartParams['_TABLE']])) {
788 788
                             $lookUpPid = isset($subpartParams['_PID']) ? intval($subpartParams['_PID']) : $pid;
789 789
                             $pidField = isset($subpartParams['_PIDFIELD']) ? trim($subpartParams['_PIDFIELD']) : 'pid';
790 790
                             $where = isset($subpartParams['_WHERE']) ? $subpartParams['_WHERE'] : '';
791 791
                             $addTable = isset($subpartParams['_ADDTABLE']) ? $subpartParams['_ADDTABLE'] : '';
792 792
 
793 793
                             $fieldName = $subpartParams['_FIELD'] ? $subpartParams['_FIELD'] : 'uid';
794
-                            if ($fieldName==='uid' || $TCA[$subpartParams['_TABLE']]['columns'][$fieldName]) {
794
+                            if ($fieldName === 'uid' || $TCA[$subpartParams['_TABLE']]['columns'][$fieldName]) {
795 795
 
796 796
                                 $andWhereLanguage = '';
797 797
                                 $transOrigPointerField = $TCA[$subpartParams['_TABLE']]['ctrl']['transOrigPointerField'];
798 798
 
799 799
                                 if ($subpartParams['_ENABLELANG'] && $transOrigPointerField) {
800
-                                    $andWhereLanguage = ' AND ' . $this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']) .' <= 0 ';
800
+                                    $andWhereLanguage = ' AND '.$this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']).' <= 0 ';
801 801
                                 }
802 802
 
803
-                                $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']) .'='.intval($lookUpPid) . ' ' .
804
-                                    $andWhereLanguage . $where;
803
+                                $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']).'='.intval($lookUpPid).' '.
804
+                                    $andWhereLanguage.$where;
805 805
 
806 806
                                 $rows = $this->db->exec_SELECTgetRows(
807 807
                                     $fieldName,
808
-                                    $subpartParams['_TABLE'] . $addTable,
809
-                                    $where . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']),
808
+                                    $subpartParams['_TABLE'].$addTable,
809
+                                    $where.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']),
810 810
                                     '',
811 811
                                     '',
812 812
                                     '',
813 813
                                     $fieldName
814 814
                                 );
815 815
 
816
-                                if (is_array($rows))    {
817
-                                    $paramArray[$p] = array_merge($paramArray[$p],array_keys($rows));
816
+                                if (is_array($rows)) {
817
+                                    $paramArray[$p] = array_merge($paramArray[$p], array_keys($rows));
818 818
                                 }
819 819
                             }
820 820
                         }
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
                             'currentValue' => $pV,
831 831
                             'pid' => $pid
832 832
                         );
833
-                        foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/class.tx_crawler_lib.php']['expandParameters'] as $key => $_funcRef)    {
833
+                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/class.tx_crawler_lib.php']['expandParameters'] as $key => $_funcRef) {
834 834
                             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
835 835
                         }
836 836
                     }
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 
867 867
                 // Traverse value set:
868 868
             $newUrls = array();
869
-            foreach($urls as $url) {
870
-                foreach($valueSet as $val) {
871
-                    $newUrls[] = $url.(strcmp($val,'') ? '&'.rawurlencode($varName).'='.rawurlencode($val) : '');
869
+            foreach ($urls as $url) {
870
+                foreach ($valueSet as $val) {
871
+                    $newUrls[] = $url.(strcmp($val, '') ? '&'.rawurlencode($varName).'='.rawurlencode($val) : '');
872 872
 
873
-                    if (count($newUrls) >  \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['maxCompileUrls'], 1, 1000000000, 10000)) {
873
+                    if (count($newUrls) > \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['maxCompileUrls'], 1, 1000000000, 10000)) {
874 874
                         break;
875 875
                     }
876 876
                 }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
      */
901 901
     public function getLogEntriesForPageId($id, $filter = '', $doFlush = FALSE, $doFullFlush = FALSE, $itemsPerPage = 10) {
902 902
         // FIXME: Write Unit tests for Filters
903
-        switch($filter) {
903
+        switch ($filter) {
904 904
             case 'pending':
905 905
                 $addWhere = ' AND exec_time=0';
906 906
                 break;
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 
915 915
         // FIXME: Write unit test that ensures that the right records are deleted.
916 916
         if ($doFlush) {
917
-            $this->flushQueue( ($doFullFlush?'1=1':('page_id='.intval($id))) .$addWhere);
917
+            $this->flushQueue(($doFullFlush ? '1=1' : ('page_id='.intval($id))).$addWhere);
918 918
             return array();
919 919
         } else {
920 920
             return $this->db->exec_SELECTgetRows('*',
921 921
                 'tx_crawler_queue',
922
-                'page_id=' . intval($id) . $addWhere, '', 'scheduled DESC',
923
-                (intval($itemsPerPage)>0 ? intval($itemsPerPage) : ''));
922
+                'page_id='.intval($id).$addWhere, '', 'scheduled DESC',
923
+                (intval($itemsPerPage) > 0 ? intval($itemsPerPage) : ''));
924 924
         }
925 925
     }
926 926
 
@@ -933,9 +933,9 @@  discard block
 block discarded – undo
933 933
      * @param    integer        Limit the amount of entires per page default is 10
934 934
      * @return    array
935 935
      */
936
-    public function getLogEntriesForSetId($set_id,$filter='',$doFlush=FALSE, $doFullFlush=FALSE, $itemsPerPage=10)    {
936
+    public function getLogEntriesForSetId($set_id, $filter = '', $doFlush = FALSE, $doFullFlush = FALSE, $itemsPerPage = 10) {
937 937
         // FIXME: Write Unit tests for Filters
938
-        switch($filter)    {
938
+        switch ($filter) {
939 939
             case 'pending':
940 940
                 $addWhere = ' AND exec_time=0';
941 941
                 break;
@@ -947,14 +947,14 @@  discard block
 block discarded – undo
947 947
                 break;
948 948
         }
949 949
         // FIXME: Write unit test that ensures that the right records are deleted.
950
-        if ($doFlush)    {
951
-            $this->flushQueue($doFullFlush?'':('set_id='.intval($set_id).$addWhere));
950
+        if ($doFlush) {
951
+            $this->flushQueue($doFullFlush ? '' : ('set_id='.intval($set_id).$addWhere));
952 952
             return array();
953 953
         } else {
954 954
             return $this->db->exec_SELECTgetRows('*',
955 955
                 'tx_crawler_queue',
956
-                'set_id='.intval($set_id).$addWhere,'','scheduled DESC',
957
-                (intval($itemsPerPage)>0 ? intval($itemsPerPage) : ''));
956
+                'set_id='.intval($set_id).$addWhere, '', 'scheduled DESC',
957
+                (intval($itemsPerPage) > 0 ? intval($itemsPerPage) : ''));
958 958
         }
959 959
     }
960 960
 
@@ -964,14 +964,14 @@  discard block
 block discarded – undo
964 964
      * @param $where    SQL related filter for the entries which should be removed
965 965
      * @return void
966 966
      */
967
-    protected function flushQueue($where='') {
967
+    protected function flushQueue($where = '') {
968 968
 
969
-        $realWhere = strlen($where)>0?$where:'1=1';
969
+        $realWhere = strlen($where) > 0 ? $where : '1=1';
970 970
 
971
-        if(tx_crawler_domain_events_dispatcher::getInstance()->hasObserver('queueEntryFlush')) {
972
-            $groups = $this->db->exec_SELECTgetRows('DISTINCT set_id','tx_crawler_queue',$realWhere);
973
-            foreach($groups as $group) {
974
-                tx_crawler_domain_events_dispatcher::getInstance()->post('queueEntryFlush',$group['set_id'], $this->db->exec_SELECTgetRows('uid, set_id','tx_crawler_queue',$realWhere.' AND set_id="'.$group['set_id'].'"'));
971
+        if (tx_crawler_domain_events_dispatcher::getInstance()->hasObserver('queueEntryFlush')) {
972
+            $groups = $this->db->exec_SELECTgetRows('DISTINCT set_id', 'tx_crawler_queue', $realWhere);
973
+            foreach ($groups as $group) {
974
+                tx_crawler_domain_events_dispatcher::getInstance()->post('queueEntryFlush', $group['set_id'], $this->db->exec_SELECTgetRows('uid, set_id', 'tx_crawler_queue', $realWhere.' AND set_id="'.$group['set_id'].'"'));
975 975
             }
976 976
         }
977 977
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
      * @param    integer        Time at which to activate
989 989
      * @return    void
990 990
      */
991
-    function addQueueEntry_callBack($setId,$params,$callBack,$page_id=0,$schedule=0) {
991
+    function addQueueEntry_callBack($setId, $params, $callBack, $page_id = 0, $schedule = 0) {
992 992
 
993 993
         if (!is_array($params))    $params = array();
994 994
         $params['_CALLBACKOBJ'] = $callBack;
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             'result_data' => '',
1004 1004
         );
1005 1005
 
1006
-        $this->db->exec_INSERTquery('tx_crawler_queue',$fieldArray);
1006
+        $this->db->exec_INSERTquery('tx_crawler_queue', $fieldArray);
1007 1007
     }
1008 1008
 
1009 1009
 
@@ -1033,13 +1033,13 @@  discard block
 block discarded – undo
1033 1033
      * @param     bool        (optional) skip inner duplication check
1034 1034
      * @return    bool        true if the url was added, false if it already existed
1035 1035
      */
1036
-    function addUrl (
1036
+    function addUrl(
1037 1037
         $id,
1038 1038
         $url,
1039 1039
         array $subCfg,
1040 1040
         $tstamp,
1041
-        $configurationHash='',
1042
-        $skipInnerDuplicationCheck=false
1041
+        $configurationHash = '',
1042
+        $skipInnerDuplicationCheck = false
1043 1043
     ) {
1044 1044
 
1045 1045
         $urlAdded = false;
@@ -1050,14 +1050,14 @@  discard block
 block discarded – undo
1050 1050
         );
1051 1051
 
1052 1052
             // fe user group simulation:
1053
-        $uGs = implode(',',array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',',$subCfg['userGroups'],1)));
1054
-        if ($uGs)    {
1053
+        $uGs = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $subCfg['userGroups'], 1)));
1054
+        if ($uGs) {
1055 1055
             $parameters['feUserGroupList'] = $uGs;
1056 1056
         }
1057 1057
 
1058 1058
             // Setting processing instructions
1059
-        $parameters['procInstructions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['procInstrFilter']);
1060
-        if (is_array($subCfg['procInstrParams.']))    {
1059
+        $parameters['procInstructions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['procInstrFilter']);
1060
+        if (is_array($subCfg['procInstrParams.'])) {
1061 1061
             $parameters['procInstrParams'] = $subCfg['procInstrParams.'];
1062 1062
         }
1063 1063
 
@@ -1076,14 +1076,14 @@  discard block
 block discarded – undo
1076 1076
             'configuration' => $subCfg['key'],
1077 1077
         );
1078 1078
 
1079
-        if ($this->registerQueueEntriesInternallyOnly)    {
1079
+        if ($this->registerQueueEntriesInternallyOnly) {
1080 1080
                 //the entries will only be registered and not stored to the database
1081 1081
             $this->queueEntries[] = $fieldArray;
1082 1082
         } else {
1083 1083
 
1084
-            if(!$skipInnerDuplicationCheck){
1084
+            if (!$skipInnerDuplicationCheck) {
1085 1085
                     // check if there is already an equal entry
1086
-                $rows = $this->getDuplicateRowsIfExist($tstamp,$fieldArray);
1086
+                $rows = $this->getDuplicateRowsIfExist($tstamp, $fieldArray);
1087 1087
             }
1088 1088
 
1089 1089
             if (count($rows) == 0) {
@@ -1091,9 +1091,9 @@  discard block
 block discarded – undo
1091 1091
                 $uid = $this->db->sql_insert_id();
1092 1092
                 $rows[] = $uid;
1093 1093
                 $urlAdded = true;
1094
-                tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue',$this->setID,array('uid' => $uid, 'fieldArray' => $fieldArray));
1095
-            }else{
1096
-                tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue',$this->setID,array('rows' => $rows, 'fieldArray' => $fieldArray));
1094
+                tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue', $this->setID, array('uid' => $uid, 'fieldArray' => $fieldArray));
1095
+            } else {
1096
+                tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue', $this->setID, array('rows' => $rows, 'fieldArray' => $fieldArray));
1097 1097
             }
1098 1098
         }
1099 1099
 
@@ -1111,34 +1111,34 @@  discard block
 block discarded – undo
1111 1111
      * @author Timo Schmidt
1112 1112
      * @return array;
1113 1113
      */
1114
-    protected function getDuplicateRowsIfExist($tstamp,$fieldArray){
1114
+    protected function getDuplicateRowsIfExist($tstamp, $fieldArray) {
1115 1115
         $rows = array();
1116 1116
 
1117 1117
         $currentTime = $this->getCurrentTime();
1118 1118
 
1119 1119
             //if this entry is scheduled with "now"
1120 1120
         if ($tstamp <= $currentTime) {
1121
-            if($this->extensionSettings['enableTimeslot']){
1121
+            if ($this->extensionSettings['enableTimeslot']) {
1122 1122
                 $timeBegin     = $currentTime - 100;
1123
-                $timeEnd     = $currentTime + 100;
1124
-                $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '. $currentTime.') ';
1125
-            }else{
1126
-                $where = 'scheduled <= ' . $currentTime;
1123
+                $timeEnd = $currentTime + 100;
1124
+                $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '.$currentTime.') ';
1125
+            } else {
1126
+                $where = 'scheduled <= '.$currentTime;
1127 1127
             }
1128 1128
         } elseif ($tstamp > $currentTime) {
1129 1129
                 //entry with a timestamp in the future need to have the same schedule time
1130
-            $where = 'scheduled = ' . $tstamp ;
1130
+            $where = 'scheduled = '.$tstamp;
1131 1131
         }
1132 1132
 
1133
-        if(!empty($where)){
1133
+        if (!empty($where)) {
1134 1134
             $result = $this->db->exec_SELECTgetRows(
1135 1135
                 'qid',
1136 1136
                 'tx_crawler_queue',
1137 1137
                 $where.
1138
-                ' AND NOT exec_time' .
1138
+                ' AND NOT exec_time'.
1139 1139
                 ' AND NOT process_id '.
1140 1140
                 ' AND page_id='.intval($fieldArray['page_id']).
1141
-                ' AND parameters_hash = ' . $this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue')
1141
+                ' AND parameters_hash = '.$this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue')
1142 1142
             );
1143 1143
 
1144 1144
             if (is_array($result)) {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
      * @author Timo Schmidt <[email protected]>
1159 1159
      * @return int
1160 1160
      */
1161
-    public function getCurrentTime(){
1161
+    public function getCurrentTime() {
1162 1162
         return time();
1163 1163
     }
1164 1164
 
@@ -1180,18 +1180,18 @@  discard block
 block discarded – undo
1180 1180
     function readUrl($queueId, $force = FALSE) {
1181 1181
         $ret = 0;
1182 1182
         if ($this->debugMode) {
1183
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start ' . microtime(true), __FUNCTION__);
1183
+            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start '.microtime(true), __FUNCTION__);
1184 1184
         }
1185 1185
         // Get entry:
1186 1186
         list($queueRec) = $this->db->exec_SELECTgetRows('*', 'tx_crawler_queue',
1187
-            'qid=' . intval($queueId) . ($force ? '' : ' AND exec_time=0 AND process_scheduled > 0'));
1187
+            'qid='.intval($queueId).($force ? '' : ' AND exec_time=0 AND process_scheduled > 0'));
1188 1188
 
1189 1189
         if (!is_array($queueRec)) {
1190 1190
             return;
1191 1191
         }
1192 1192
 
1193
-        $pageUidRootTypoScript = \AOE\Crawler\Utility\TypoScriptUtility::getPageUidForTypoScriptRootTemplateInRootLine((int)$queueRec['page_id']);
1194
-        $this->initTSFE((int)$pageUidRootTypoScript);
1193
+        $pageUidRootTypoScript = \AOE\Crawler\Utility\TypoScriptUtility::getPageUidForTypoScriptRootTemplateInRootLine((int) $queueRec['page_id']);
1194
+        $this->initTSFE((int) $pageUidRootTypoScript);
1195 1195
 
1196 1196
         \AOE\Crawler\Utility\SignalSlotUtility::emitSignal(
1197 1197
             __CLASS__,
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
             //if mulitprocessing is used we need to store the id of the process which has handled this entry
1207 1207
             $field_array['process_id_completed'] = $this->processID;
1208 1208
         }
1209
-        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
1209
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1210 1210
 
1211 1211
         $result = $this->readUrl_exec($queueRec);
1212 1212
         $resultData = unserialize($result['content']);
@@ -1235,11 +1235,11 @@  discard block
 block discarded – undo
1235 1235
             array($queueId, &$field_array)
1236 1236
         );
1237 1237
 
1238
-        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
1238
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1239 1239
 
1240 1240
 
1241 1241
         if ($this->debugMode) {
1242
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop ' . microtime(true), __FUNCTION__);
1242
+            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop '.microtime(true), __FUNCTION__);
1243 1243
         }
1244 1244
 
1245 1245
         return $ret;
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
      * @param    integer        Queue field array,
1252 1252
      * @return    string
1253 1253
      */
1254
-    function readUrlFromArray($field_array)    {
1254
+    function readUrlFromArray($field_array) {
1255 1255
 
1256 1256
             // Set exec_time to lock record:
1257 1257
         $field_array['exec_time'] = $this->getCurrentTime();
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
             // Set result in log which also denotes the end of the processing of this entry.
1264 1264
         $field_array = array('result_data' => serialize($result));
1265
-        $this->db->exec_UPDATEquery('tx_crawler_queue','qid='.intval($queueId), $field_array);
1265
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1266 1266
 
1267 1267
         return $result;
1268 1268
     }
@@ -1273,17 +1273,17 @@  discard block
 block discarded – undo
1273 1273
      * @param    array        Queue record
1274 1274
      * @return    string        Result output.
1275 1275
      */
1276
-    function readUrl_exec($queueRec)    {
1276
+    function readUrl_exec($queueRec) {
1277 1277
             // Decode parameters:
1278 1278
         $parameters = unserialize($queueRec['parameters']);
1279 1279
         $result = 'ERROR';
1280
-        if (is_array($parameters))    {
1281
-            if ($parameters['_CALLBACKOBJ'])    {    // Calling object:
1280
+        if (is_array($parameters)) {
1281
+            if ($parameters['_CALLBACKOBJ']) {    // Calling object:
1282 1282
                 $objRef = $parameters['_CALLBACKOBJ'];
1283 1283
                 $callBackObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1284
-                if (is_object($callBackObj))    {
1284
+                if (is_object($callBackObj)) {
1285 1285
                     unset($parameters['_CALLBACKOBJ']);
1286
-                    $result = array('content' => serialize($callBackObj->crawler_execute($parameters,$this)));
1286
+                    $result = array('content' => serialize($callBackObj->crawler_execute($parameters, $this)));
1287 1287
                 } else {
1288 1288
                     $result = array('content' => 'No object: '.$objRef);
1289 1289
                 }
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
                 $crawlerId = $queueRec['qid'].':'.md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
1294 1294
 
1295 1295
                     // Get result:
1296
-                $result = $this->requestUrl($parameters['url'],$crawlerId);
1296
+                $result = $this->requestUrl($parameters['url'], $crawlerId);
1297 1297
 
1298
-                tx_crawler_domain_events_dispatcher::getInstance()->post('urlCrawled',$queueRec['set_id'],array('url' => $parameters['url'], 'result' => $result));
1298
+                tx_crawler_domain_events_dispatcher::getInstance()->post('urlCrawled', $queueRec['set_id'], array('url' => $parameters['url'], 'result' => $result));
1299 1299
             }
1300 1300
         }
1301 1301
 
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
      * @param  integer  $recursion      Recursion limiter for 302 redirects
1313 1313
      * @return array                    Array with content
1314 1314
      */
1315
-    function requestUrl($originalUrl, $crawlerId, $timeout=2, $recursion=10) {
1315
+    function requestUrl($originalUrl, $crawlerId, $timeout = 2, $recursion = 10) {
1316 1316
 
1317 1317
         if (!$recursion) return false;
1318 1318
 
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
             return FALSE;
1325 1325
         }
1326 1326
 
1327
-        if (!in_array($url['scheme'], array('','http','https'))) {
1327
+        if (!in_array($url['scheme'], array('', 'http', 'https'))) {
1328 1328
             if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1329 1329
             return FALSE;
1330 1330
         }
@@ -1342,14 +1342,14 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] && $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
1344 1344
             $rurl = parse_url($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
1345
-            $url['path'] = $url['scheme'] . '://' . $url['host'] . ($url['port'] > 0 ? ':' . $url['port'] : '') . $url['path'];
1345
+            $url['path'] = $url['scheme'].'://'.$url['host'].($url['port'] > 0 ? ':'.$url['port'] : '').$url['path'];
1346 1346
             $reqHeaders = $this->buildRequestHeaderArray($url, $crawlerId);
1347 1347
         }
1348 1348
 
1349 1349
         $host = $rurl['host'];
1350 1350
 
1351 1351
         if ($url['scheme'] == 'https') {
1352
-            $host = 'ssl://' . $host;
1352
+            $host = 'ssl://'.$host;
1353 1353
             $port = ($rurl['port'] > 0) ? $rurl['port'] : 443;
1354 1354
         } else {
1355 1355
             $port = ($rurl['port'] > 0) ? $rurl['port'] : 80;
@@ -1363,24 +1363,24 @@  discard block
 block discarded – undo
1363 1363
             return FALSE;
1364 1364
         } else {
1365 1365
                 // Request message:
1366
-            $msg = implode("\r\n",$reqHeaders)."\r\n\r\n";
1367
-            fputs ($fp, $msg);
1366
+            $msg = implode("\r\n", $reqHeaders)."\r\n\r\n";
1367
+            fputs($fp, $msg);
1368 1368
 
1369 1369
                 // Read response:
1370 1370
             $d = $this->getHttpResponseFromStream($fp);
1371
-            fclose ($fp);
1371
+            fclose($fp);
1372 1372
 
1373 1373
             $time = microtime(true) - $startTime;
1374
-            $this->log($originalUrl .' '.$time);
1374
+            $this->log($originalUrl.' '.$time);
1375 1375
 
1376 1376
                 // Implode content and headers:
1377 1377
             $result = array(
1378 1378
                 'request' => $msg,
1379 1379
                 'headers' => implode('', $d['headers']),
1380
-                'content' => implode('', (array)$d['content'])
1380
+                'content' => implode('', (array) $d['content'])
1381 1381
             );
1382 1382
 
1383
-            if (($this->extensionSettings['follow30x']) && ($newUrl = $this->getRequestUrlFrom302Header($d['headers'],$url['user'],$url['pass']))) {
1383
+            if (($this->extensionSettings['follow30x']) && ($newUrl = $this->getRequestUrlFrom302Header($d['headers'], $url['user'], $url['pass']))) {
1384 1384
                 $result = array_merge(array('parentRequest'=>$result), $this->requestUrl($newUrl, $crawlerId, $recursion--));
1385 1385
                 $newRequestUrl = $this->requestUrl($newUrl, $crawlerId, $timeout, --$recursion);
1386 1386
 
@@ -1419,8 +1419,8 @@  discard block
 block discarded – undo
1419 1419
 
1420 1420
         // Base path must be '/<pathSegements>/':
1421 1421
         if ($frontendBasePath != '/') {
1422
-            $frontendBasePath = '/' . ltrim($frontendBasePath, '/');
1423
-            $frontendBasePath = rtrim($frontendBasePath, '/') . '/';
1422
+            $frontendBasePath = '/'.ltrim($frontendBasePath, '/');
1423
+            $frontendBasePath = rtrim($frontendBasePath, '/').'/';
1424 1424
         }
1425 1425
 
1426 1426
         return $frontendBasePath;
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
         if (is_resource($streamPointer)) {
1452 1452
                 // read headers
1453
-            while($line = fgets($streamPointer, '2048')) {
1453
+            while ($line = fgets($streamPointer, '2048')) {
1454 1454
                 $line = trim($line);
1455 1455
                 if ($line !== '') {
1456 1456
                     $response['headers'][] = $line;
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
             }
1461 1461
 
1462 1462
                 // read content
1463
-            while($line = fgets($streamPointer, '2048')) {
1463
+            while ($line = fgets($streamPointer, '2048')) {
1464 1464
                 $response['content'][] = $line;
1465 1465
             }
1466 1466
         }
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
      */
1474 1474
     protected function log($message) {
1475 1475
         if (!empty($this->extensionSettings['logFileName'])) {
1476
-            @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His') . $message . "\n", FILE_APPEND);
1476
+            @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His').$message."\n", FILE_APPEND);
1477 1477
         }
1478 1478
     }
1479 1479
 
@@ -1489,12 +1489,12 @@  discard block
 block discarded – undo
1489 1489
         $reqHeaders = array();
1490 1490
         $reqHeaders[] = 'GET '.$url['path'].($url['query'] ? '?'.$url['query'] : '').' HTTP/1.0';
1491 1491
         $reqHeaders[] = 'Host: '.$url['host'];
1492
-        if (stristr($url['query'],'ADMCMD_previewWS')) {
1492
+        if (stristr($url['query'], 'ADMCMD_previewWS')) {
1493 1493
             $reqHeaders[] = 'Cookie: $Version="1"; be_typo_user="1"; $Path=/';
1494 1494
         }
1495 1495
         $reqHeaders[] = 'Connection: close';
1496
-        if ($url['user']!='') {
1497
-            $reqHeaders[] = 'Authorization: Basic '. base64_encode($url['user'].':'.$url['pass']);
1496
+        if ($url['user'] != '') {
1497
+            $reqHeaders[] = 'Authorization: Basic '.base64_encode($url['user'].':'.$url['pass']);
1498 1498
         }
1499 1499
         $reqHeaders[] = 'X-T3crawler: '.$crawlerId;
1500 1500
         $reqHeaders[] = 'User-Agent: TYPO3 crawler';
@@ -1509,21 +1509,21 @@  discard block
 block discarded – undo
1509 1509
      * @param    string        HTTP Auth. Password
1510 1510
      * @return    string        URL from redirection
1511 1511
      */
1512
-    protected function getRequestUrlFrom302Header($headers,$user='',$pass='') {
1513
-        if(!is_array($headers)) return false;
1514
-        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) return false;
1512
+    protected function getRequestUrlFrom302Header($headers, $user = '', $pass = '') {
1513
+        if (!is_array($headers)) return false;
1514
+        if (!(stristr($headers[0], '301 Moved') || stristr($headers[0], '302 Found') || stristr($headers[0], '302 Moved'))) return false;
1515 1515
 
1516
-        foreach($headers as $hl) {
1517
-            $tmp = explode(": ",$hl);
1516
+        foreach ($headers as $hl) {
1517
+            $tmp = explode(": ", $hl);
1518 1518
             $header[trim($tmp[0])] = trim($tmp[1]);
1519
-            if(trim($tmp[0])=='Location') break;
1519
+            if (trim($tmp[0]) == 'Location') break;
1520 1520
         }
1521
-        if(!array_key_exists('Location',$header)) return false;
1521
+        if (!array_key_exists('Location', $header)) return false;
1522 1522
 
1523
-        if($user!='') {
1524
-            if(!($tmp = parse_url($header['Location']))) return false;
1525
-            $newUrl = $tmp['scheme'] . '://' . $user . ':' . $pass . '@' . $tmp['host'] . $tmp['path'];
1526
-            if($tmp['query']!='') $newUrl .= '?' . $tmp['query'];
1523
+        if ($user != '') {
1524
+            if (!($tmp = parse_url($header['Location']))) return false;
1525
+            $newUrl = $tmp['scheme'].'://'.$user.':'.$pass.'@'.$tmp['host'].$tmp['path'];
1526
+            if ($tmp['query'] != '') $newUrl .= '?'.$tmp['query'];
1527 1527
         } else {
1528 1528
             $newUrl = $header['Location'];
1529 1529
         }
@@ -1551,15 +1551,15 @@  discard block
 block discarded – undo
1551 1551
      * @param    object        TSFE object (reference under PHP5)
1552 1552
      * @return    void
1553 1553
      */
1554
-    function fe_init(&$params, $ref)    {
1554
+    function fe_init(&$params, $ref) {
1555 1555
 
1556 1556
             // Authenticate crawler request:
1557
-        if (isset($_SERVER['HTTP_X_T3CRAWLER']))    {
1558
-            list($queueId,$hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
1559
-            list($queueRec) = $this->db->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval($queueId));
1557
+        if (isset($_SERVER['HTTP_X_T3CRAWLER'])) {
1558
+            list($queueId, $hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
1559
+            list($queueRec) = $this->db->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval($queueId));
1560 1560
 
1561 1561
                 // If a crawler record was found and hash was matching, set it up:
1562
-            if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']))    {
1562
+            if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
1563 1563
                 $params['pObj']->applicationData['tx_crawler']['running'] = TRUE;
1564 1564
                 $params['pObj']->applicationData['tx_crawler']['parameters'] = unserialize($queueRec['parameters']);
1565 1565
                 $params['pObj']->applicationData['tx_crawler']['log'] = array();
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
             /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */
1620 1620
         $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
1621 1621
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1622
-        $tree->init('AND ' . $perms_clause);
1622
+        $tree->init('AND '.$perms_clause);
1623 1623
 
1624 1624
         $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $perms_clause);
1625 1625
         if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version()) < 8000000) {
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
         }
1637 1637
 
1638 1638
             // Get branch beneath:
1639
-        if ($depth)    {
1639
+        if ($depth) {
1640 1640
             $tree->getTree($id, $depth, '');
1641 1641
         }
1642 1642
 
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
             $this->MP = false;
1649 1649
 
1650 1650
                 // recognize mount points
1651
-            if($data['row']['doktype'] == 7){
1651
+            if ($data['row']['doktype'] == 7) {
1652 1652
                 $mountpage = $this->db->exec_SELECTgetRows('*', 'pages', 'uid = '.$data['row']['uid']);
1653 1653
 
1654 1654
                     // fetch mounted pages
@@ -1658,15 +1658,15 @@  discard block
 block discarded – undo
1658 1658
                 $mountTree->init('AND '.$perms_clause);
1659 1659
                 $mountTree->getTree($mountpage[0]['mount_pid'], $depth, '');
1660 1660
 
1661
-                foreach($mountTree->tree as $mountData)    {
1661
+                foreach ($mountTree->tree as $mountData) {
1662 1662
                     $code .= $this->drawURLs_addRowsForPage(
1663 1663
                         $mountData['row'],
1664
-                        $mountData['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$mountData['row'],TRUE)
1664
+                        $mountData['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $mountData['row'], TRUE)
1665 1665
                     );
1666 1666
                 }
1667 1667
 
1668 1668
                     // replace page when mount_pid_ol is enabled
1669
-                if($mountpage[0]['mount_pid_ol']){
1669
+                if ($mountpage[0]['mount_pid_ol']) {
1670 1670
                     $data['row']['uid'] = $mountpage[0]['mount_pid'];
1671 1671
                 } else {
1672 1672
                         // if the mount_pid_ol is not set the MP must not be used for the mountpoint page
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 
1677 1677
             $code .= $this->drawURLs_addRowsForPage(
1678 1678
                 $data['row'],
1679
-                $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE)
1679
+                $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE)
1680 1680
             );
1681 1681
         }
1682 1682
 
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
             if (!empty($excludeString)) {
1701 1701
                 /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */
1702 1702
                 $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
1703
-                $tree->init('AND ' . $this->backendUser->getPagePermsClause(1));
1703
+                $tree->init('AND '.$this->backendUser->getPagePermsClause(1));
1704 1704
 
1705 1705
                 $excludeParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $excludeString);
1706 1706
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 
1710 1710
                         // default is "page only" = "depth=0"
1711 1711
                     if (empty($depth)) {
1712
-                        $depth = ( stristr($excludePart,'+')) ? 99 : 0;
1712
+                        $depth = (stristr($excludePart, '+')) ? 99 : 0;
1713 1713
                     }
1714 1714
 
1715 1715
                     $pidList[] = $pid;
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
      * @param    string        Page icon and title for row
1743 1743
      * @return    string        HTML <tr> content (one or more)
1744 1744
      */
1745
-    public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon)    {
1745
+    public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon) {
1746 1746
 
1747 1747
         $skipMessage = '';
1748 1748
 
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
         $cc = 0;
1764 1764
         $content = '';
1765 1765
         if (count($configurations)) {
1766
-            foreach($configurations as $confKey => $confArray)    {
1766
+            foreach ($configurations as $confKey => $confArray) {
1767 1767
 
1768 1768
                     // Title column:
1769 1769
                 if (!$c) {
@@ -1792,47 +1792,47 @@  discard block
 block discarded – undo
1792 1792
                     $paramExpanded = '';
1793 1793
                     $calcAccu = array();
1794 1794
                     $calcRes = 1;
1795
-                    foreach($confArray['paramExpanded'] as $gVar => $gVal)    {
1796
-                        $paramExpanded.= '
1795
+                    foreach ($confArray['paramExpanded'] as $gVar => $gVal) {
1796
+                        $paramExpanded .= '
1797 1797
                             <tr>
1798 1798
                                 <td class="bgColor4-20">'.htmlspecialchars('&'.$gVar.'=').'<br/>'.
1799 1799
                                                 '('.count($gVal).')'.
1800 1800
                                                 '</td>
1801
-                                <td class="bgColor4" nowrap="nowrap">'.nl2br(htmlspecialchars(implode(chr(10),$gVal))).'</td>
1801
+                                <td class="bgColor4" nowrap="nowrap">'.nl2br(htmlspecialchars(implode(chr(10), $gVal))).'</td>
1802 1802
                             </tr>
1803 1803
                         ';
1804
-                        $calcRes*= count($gVal);
1804
+                        $calcRes *= count($gVal);
1805 1805
                         $calcAccu[] = count($gVal);
1806 1806
                     }
1807 1807
                     $paramExpanded = '<table class="lrPadding c-list param-expanded">'.$paramExpanded.'</table>';
1808
-                    $paramExpanded.= 'Comb: '.implode('*',$calcAccu).'='.$calcRes;
1808
+                    $paramExpanded .= 'Comb: '.implode('*', $calcAccu).'='.$calcRes;
1809 1809
 
1810 1810
                         // Options
1811 1811
                     $optionValues = '';
1812
-                    if ($confArray['subCfg']['userGroups'])    {
1813
-                        $optionValues.='User Groups: '.$confArray['subCfg']['userGroups'].'<br/>';
1812
+                    if ($confArray['subCfg']['userGroups']) {
1813
+                        $optionValues .= 'User Groups: '.$confArray['subCfg']['userGroups'].'<br/>';
1814 1814
                     }
1815
-                    if ($confArray['subCfg']['baseUrl'])    {
1816
-                        $optionValues.='Base Url: '.$confArray['subCfg']['baseUrl'].'<br/>';
1815
+                    if ($confArray['subCfg']['baseUrl']) {
1816
+                        $optionValues .= 'Base Url: '.$confArray['subCfg']['baseUrl'].'<br/>';
1817 1817
                     }
1818
-                    if ($confArray['subCfg']['procInstrFilter'])    {
1819
-                        $optionValues.='ProcInstr: '.$confArray['subCfg']['procInstrFilter'].'<br/>';
1818
+                    if ($confArray['subCfg']['procInstrFilter']) {
1819
+                        $optionValues .= 'ProcInstr: '.$confArray['subCfg']['procInstrFilter'].'<br/>';
1820 1820
                     }
1821 1821
 
1822 1822
                         // Compile row:
1823 1823
                     $content .= '
1824
-                        <tr class="bgColor' . ($c%2 ? '-20':'-10') . '">
1825
-                            ' . $titleClm . '
1826
-                            <td>' . htmlspecialchars($confKey) . '</td>
1827
-                            <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td>
1824
+                        <tr class="bgColor' . ($c % 2 ? '-20' : '-10').'">
1825
+                            ' . $titleClm.'
1826
+                            <td>' . htmlspecialchars($confKey).'</td>
1827
+                            <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10).'&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))).'</td>
1828 1828
                             <td>'.$paramExpanded.'</td>
1829
-                            <td nowrap="nowrap">' . $urlList . '</td>
1830
-                            <td nowrap="nowrap">' . $optionValues . '</td>
1831
-                            <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']) . '</td>
1829
+                            <td nowrap="nowrap">' . $urlList.'</td>
1830
+                            <td nowrap="nowrap">' . $optionValues.'</td>
1831
+                            <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']).'</td>
1832 1832
                         </tr>';
1833 1833
                 } else {
1834 1834
 
1835
-                    $content .= '<tr class="bgColor'.($c%2 ? '-20':'-10') . '">
1835
+                    $content .= '<tr class="bgColor'.($c % 2 ? '-20' : '-10').'">
1836 1836
                             '.$titleClm.'
1837 1837
                             <td>'.htmlspecialchars($confKey).'</td>
1838 1838
                             <td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td>
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
             $message = !empty($skipMessage) ? ' ('.$skipMessage.')' : '';
1848 1848
 
1849 1849
                 // Compile row:
1850
-            $content.= '
1850
+            $content .= '
1851 1851
                 <tr class="bgColor-20" style="border-bottom: 1px solid black;">
1852 1852
                     <td>'.$pageTitleAndIcon.'</td>
1853 1853
                     <td colspan="6"><em>No entries</em>'.$message.'</td>
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
             $releaseStatus = $this->CLI_releaseProcesses($this->CLI_buildProcessId());
1926 1926
 
1927 1927
             $this->CLI_debug("Unprocessed Items remaining:".$this->getUnprocessedItemsCount()." (".$this->CLI_buildProcessId().")");
1928
-            $result |= ( $this->getUnprocessedItemsCount() > 0 ? self::CLI_STATUS_REMAIN : self::CLI_STATUS_NOTHING_PROCCESSED );
1928
+            $result |= ($this->getUnprocessedItemsCount() > 0 ? self::CLI_STATUS_REMAIN : self::CLI_STATUS_NOTHING_PROCCESSED);
1929 1929
         } else {
1930 1930
             $result |= self::CLI_STATUS_ABORTED;
1931 1931
         }
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
      *
1939 1939
      * @return    void
1940 1940
      */
1941
-    function CLI_main_im()    {
1941
+    function CLI_main_im() {
1942 1942
         $this->setAccessMode('cli_im');
1943 1943
 
1944 1944
         $cliObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_cli_im');
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
         $this->backendUser->setWorkspace(0);
1949 1949
 
1950 1950
             // Print help
1951
-        if (!isset($cliObj->cli_args['_DEFAULT'][1]))    {
1951
+        if (!isset($cliObj->cli_args['_DEFAULT'][1])) {
1952 1952
             $cliObj->cli_validateArgs();
1953 1953
             $cliObj->cli_help();
1954 1954
             exit;
@@ -1956,8 +1956,8 @@  discard block
 block discarded – undo
1956 1956
 
1957 1957
         $cliObj->cli_validateArgs();
1958 1958
 
1959
-        if ($cliObj->cli_argValue('-o')==='exec')    {
1960
-            $this->registerQueueEntriesInternallyOnly=TRUE;
1959
+        if ($cliObj->cli_argValue('-o') === 'exec') {
1960
+            $this->registerQueueEntriesInternallyOnly = TRUE;
1961 1961
         }
1962 1962
 
1963 1963
         if (isset($cliObj->cli_args['_DEFAULT'][2])) {
@@ -1970,16 +1970,16 @@  discard block
 block discarded – undo
1970 1970
 
1971 1971
         $configurationKeys  = $this->getConfigurationKeys($cliObj);
1972 1972
 
1973
-        if(!is_array($configurationKeys)){
1973
+        if (!is_array($configurationKeys)) {
1974 1974
             $configurations = $this->getUrlsForPageId($pageId);
1975
-            if(is_array($configurations)){
1975
+            if (is_array($configurations)) {
1976 1976
                 $configurationKeys = array_keys($configurations);
1977
-            }else{
1977
+            } else {
1978 1978
                 $configurationKeys = array();
1979 1979
             }
1980 1980
         }
1981 1981
 
1982
-        if($cliObj->cli_argValue('-o')==='queue' || $cliObj->cli_argValue('-o')==='exec'){
1982
+        if ($cliObj->cli_argValue('-o') === 'queue' || $cliObj->cli_argValue('-o') === 'exec') {
1983 1983
 
1984 1984
             $reason = new tx_crawler_domain_reason();
1985 1985
             $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
             tx_crawler_domain_events_dispatcher::getInstance()->post(
1988 1988
                 'invokeQueueChange',
1989 1989
                 $this->setID,
1990
-                array(    'reason' => $reason )
1990
+                array('reason' => $reason)
1991 1991
             );
1992 1992
         }
1993 1993
 
@@ -1998,42 +1998,42 @@  discard block
 block discarded – undo
1998 1998
         $this->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
1999 1999
         $this->getPageTreeAndUrls(
2000 2000
             $pageId,
2001
-            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_argValue('-d'),0,99),
2001
+            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_argValue('-d'), 0, 99),
2002 2002
             $this->getCurrentTime(),
2003
-            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_isArg('-n') ? $cliObj->cli_argValue('-n') : 30,1,1000),
2004
-            $cliObj->cli_argValue('-o')==='queue' || $cliObj->cli_argValue('-o')==='exec',
2005
-            $cliObj->cli_argValue('-o')==='url',
2006
-            \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$cliObj->cli_argValue('-proc'),1),
2003
+            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_isArg('-n') ? $cliObj->cli_argValue('-n') : 30, 1, 1000),
2004
+            $cliObj->cli_argValue('-o') === 'queue' || $cliObj->cli_argValue('-o') === 'exec',
2005
+            $cliObj->cli_argValue('-o') === 'url',
2006
+            \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $cliObj->cli_argValue('-proc'), 1),
2007 2007
             $configurationKeys
2008 2008
         );
2009 2009
 
2010
-        if ($cliObj->cli_argValue('-o')==='url') {
2011
-            $cliObj->cli_echo(implode(chr(10),$this->downloadUrls).chr(10),1);
2012
-        } elseif ($cliObj->cli_argValue('-o')==='exec')    {
2010
+        if ($cliObj->cli_argValue('-o') === 'url') {
2011
+            $cliObj->cli_echo(implode(chr(10), $this->downloadUrls).chr(10), 1);
2012
+        } elseif ($cliObj->cli_argValue('-o') === 'exec') {
2013 2013
             $cliObj->cli_echo("Executing ".count($this->urlList)." requests right away:\n\n");
2014
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10));
2014
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10));
2015 2015
             $cliObj->cli_echo("\nProcessing:\n");
2016 2016
 
2017
-            foreach($this->queueEntries as $queueRec)    {
2017
+            foreach ($this->queueEntries as $queueRec) {
2018 2018
                 $p = unserialize($queueRec['parameters']);
2019
-                $cliObj->cli_echo($p['url'].' ('.implode(',',$p['procInstructions']).') => ');
2019
+                $cliObj->cli_echo($p['url'].' ('.implode(',', $p['procInstructions']).') => ');
2020 2020
 
2021 2021
                 $result = $this->readUrlFromArray($queueRec);
2022 2022
 
2023 2023
                 $requestResult = unserialize($result['content']);
2024
-                if (is_array($requestResult))    {
2025
-                    $resLog = is_array($requestResult['log']) ?  chr(10).chr(9).chr(9).implode(chr(10).chr(9).chr(9),$requestResult['log']) : '';
2024
+                if (is_array($requestResult)) {
2025
+                    $resLog = is_array($requestResult['log']) ? chr(10).chr(9).chr(9).implode(chr(10).chr(9).chr(9), $requestResult['log']) : '';
2026 2026
                     $cliObj->cli_echo('OK: '.$resLog.chr(10));
2027 2027
                 } else {
2028
-                    $cliObj->cli_echo('Error checking Crawler Result: '.substr(preg_replace('/\s+/',' ',strip_tags($result['content'])),0,30000).'...'.chr(10));
2028
+                    $cliObj->cli_echo('Error checking Crawler Result: '.substr(preg_replace('/\s+/', ' ', strip_tags($result['content'])), 0, 30000).'...'.chr(10));
2029 2029
                 }
2030 2030
             }
2031
-        } elseif ($cliObj->cli_argValue('-o')==='queue')    {
2031
+        } elseif ($cliObj->cli_argValue('-o') === 'queue') {
2032 2032
             $cliObj->cli_echo("Putting ".count($this->urlList)." entries in queue:\n\n");
2033
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10));
2033
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10));
2034 2034
         } else {
2035
-            $cliObj->cli_echo(count($this->urlList)." entries found for processing. (Use -o to decide action):\n\n",1);
2036
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10),1);
2035
+            $cliObj->cli_echo(count($this->urlList)." entries found for processing. (Use -o to decide action):\n\n", 1);
2036
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10), 1);
2037 2037
         }
2038 2038
     }
2039 2039
 
@@ -2058,12 +2058,12 @@  discard block
 block discarded – undo
2058 2058
         }
2059 2059
 
2060 2060
         $cliObj->cli_validateArgs();
2061
-        $pageId = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_args['_DEFAULT'][1],0);
2061
+        $pageId = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_args['_DEFAULT'][1], 0);
2062 2062
         $fullFlush = ($pageId == 0);
2063 2063
 
2064 2064
         $mode = $cliObj->cli_argValue('-o');
2065 2065
 
2066
-        switch($mode) {
2066
+        switch ($mode) {
2067 2067
             case 'all':
2068 2068
                 $result = $this->getLogEntriesForPageId($pageId, '', true, $fullFlush);
2069 2069
                 break;
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
      * @param  tx_crawler_cli_im $cliObj    Command line object
2087 2087
      * @return mixed                        Array of keys or null if no keys found
2088 2088
      */
2089
-    protected function getConfigurationKeys(tx_crawler_cli_im &$cliObj) {
2089
+    protected function getConfigurationKeys(tx_crawler_cli_im & $cliObj) {
2090 2090
         $parameter = trim($cliObj->cli_argValue('-conf'));
2091 2091
         return ($parameter != '' ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $parameter) : array());
2092 2092
     }
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
             $purgeDate = $this->getCurrentTime() - 24 * 60 * 60 * intval($this->extensionSettings['purgeQueueDays']);
2112 2112
             $del = $this->db->exec_DELETEquery(
2113 2113
                 'tx_crawler_queue',
2114
-                'exec_time!=0 AND exec_time<' . $purgeDate
2114
+                'exec_time!=0 AND exec_time<'.$purgeDate
2115 2115
             );
2116 2116
         }
2117 2117
 
@@ -2128,10 +2128,10 @@  discard block
 block discarded – undo
2128 2128
         intval($countInARun)
2129 2129
         );
2130 2130
 
2131
-        if (count($rows)>0) {
2131
+        if (count($rows) > 0) {
2132 2132
             $quidList = array();
2133 2133
 
2134
-            foreach($rows as $r) {
2134
+            foreach ($rows as $r) {
2135 2135
                 $quidList[] = $r['qid'];
2136 2136
             }
2137 2137
 
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
                 //TODO make sure we're not taking assigned queue-entires
2143 2143
             $this->db->exec_UPDATEquery(
2144 2144
                 'tx_crawler_queue',
2145
-                'qid IN ('.implode(',',$quidList).')',
2145
+                'qid IN ('.implode(',', $quidList).')',
2146 2146
                 array(
2147 2147
                     'process_scheduled' => intval($this->getCurrentTime()),
2148 2148
                     'process_id' => $processId
@@ -2153,32 +2153,32 @@  discard block
 block discarded – undo
2153 2153
             $numberOfAffectedRows = $this->db->sql_affected_rows();
2154 2154
             $this->db->exec_UPDATEquery(
2155 2155
                 'tx_crawler_process',
2156
-                "process_id = '".$processId."'" ,
2156
+                "process_id = '".$processId."'",
2157 2157
                 array(
2158 2158
                     'assigned_items_count' => intval($numberOfAffectedRows)
2159 2159
                 )
2160 2160
             );
2161 2161
 
2162
-            if($numberOfAffectedRows == count($quidList)) {
2162
+            if ($numberOfAffectedRows == count($quidList)) {
2163 2163
                 $this->db->sql_query('COMMIT');
2164
-            } else  {
2164
+            } else {
2165 2165
                 $this->db->sql_query('ROLLBACK');
2166 2166
                 $this->CLI_debug("Nothing processed due to multi-process collision (".$this->CLI_buildProcessId().")");
2167
-                return ( $result | self::CLI_STATUS_ABORTED );
2167
+                return ($result | self::CLI_STATUS_ABORTED);
2168 2168
             }
2169 2169
 
2170 2170
 
2171 2171
 
2172
-            foreach($rows as $r)    {
2172
+            foreach ($rows as $r) {
2173 2173
                 $result |= $this->readUrl($r['qid']);
2174 2174
 
2175 2175
                 $counter++;
2176
-                usleep(intval($sleepTime));    // Just to relax the system
2176
+                usleep(intval($sleepTime)); // Just to relax the system
2177 2177
 
2178 2178
                     // if during the start and the current read url the cli has been disable we need to return from the function
2179 2179
                     // mark the process NOT as ended.
2180 2180
                 if ($this->getDisabled()) {
2181
-                    return ( $result | self::CLI_STATUS_ABORTED );
2181
+                    return ($result | self::CLI_STATUS_ABORTED);
2182 2182
                 }
2183 2183
 
2184 2184
                 if (!$this->CLI_checkIfProcessIsActive($this->CLI_buildProcessId())) {
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
                         //TODO might need an additional returncode
2188 2188
                     $result |= self::CLI_STATUS_ABORTED;
2189
-                    break;        //possible timeout
2189
+                    break; //possible timeout
2190 2190
                 }
2191 2191
             }
2192 2192
 
@@ -2199,7 +2199,7 @@  discard block
 block discarded – undo
2199 2199
             $this->CLI_debug("Nothing within queue which needs to be processed (".$this->CLI_buildProcessId().")");
2200 2200
         }
2201 2201
 
2202
-        if($counter > 0) {
2202
+        if ($counter > 0) {
2203 2203
             $result |= self::CLI_STATUS_PROCESSED;
2204 2204
         }
2205 2205
 
@@ -2211,12 +2211,12 @@  discard block
 block discarded – undo
2211 2211
      *
2212 2212
      * @return    void
2213 2213
      */
2214
-    function CLI_runHooks()    {
2214
+    function CLI_runHooks() {
2215 2215
         global $TYPO3_CONF_VARS;
2216
-        if (is_array($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks']))    {
2217
-            foreach($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'] as $objRef)    {
2216
+        if (is_array($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'])) {
2217
+            foreach ($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'] as $objRef) {
2218 2218
                 $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
2219
-                if (is_object($hookObj))    {
2219
+                if (is_object($hookObj)) {
2220 2220
                     $hookObj->crawler_init($this);
2221 2221
                 }
2222 2222
             }
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
 
2254 2254
             $currentTime = $this->getCurrentTime();
2255 2255
 
2256
-            while($row = $this->db->sql_fetch_assoc($res))    {
2256
+            while ($row = $this->db->sql_fetch_assoc($res)) {
2257 2257
                 if ($row['ttl'] < $currentTime) {
2258 2258
                     $orphanProcesses[] = $row['process_id'];
2259 2259
                 } else {
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 
2264 2264
                 // if there are less than allowed active processes then add a new one
2265 2265
             if ($processCount < intval($this->extensionSettings['processLimit'])) {
2266
-                $this->CLI_debug("add ".$this->CLI_buildProcessId()." (".($processCount+1)."/".intval($this->extensionSettings['processLimit']).")");
2266
+                $this->CLI_debug("add ".$this->CLI_buildProcessId()." (".($processCount + 1)."/".intval($this->extensionSettings['processLimit']).")");
2267 2267
 
2268 2268
                     // create new process record
2269 2269
                 $this->db->exec_INSERTquery(
@@ -2296,17 +2296,17 @@  discard block
 block discarded – undo
2296 2296
      * @param  boolean  $withinLock   show whether the DB-actions are included within an existing lock
2297 2297
      * @return boolean
2298 2298
      */
2299
-    function CLI_releaseProcesses($releaseIds, $withinLock=false) {
2299
+    function CLI_releaseProcesses($releaseIds, $withinLock = false) {
2300 2300
 
2301 2301
         if (!is_array($releaseIds)) {
2302 2302
             $releaseIds = array($releaseIds);
2303 2303
         }
2304 2304
 
2305 2305
         if (!count($releaseIds) > 0) {
2306
-            return false;   //nothing to release
2306
+            return false; //nothing to release
2307 2307
         }
2308 2308
 
2309
-        if(!$withinLock) $this->db->sql_query('BEGIN');
2309
+        if (!$withinLock) $this->db->sql_query('BEGIN');
2310 2310
 
2311 2311
             // some kind of 2nd chance algo - this way you need at least 2 processes to have a real cleanup
2312 2312
             // this ensures that a single process can't mess up the entire process table
@@ -2336,21 +2336,21 @@  discard block
 block discarded – undo
2336 2336
                 // mark all requested processes as non-active
2337 2337
         $this->db->exec_UPDATEquery(
2338 2338
             'tx_crawler_process',
2339
-            'process_id IN (\''.implode('\',\'',$releaseIds).'\') AND deleted=0',
2339
+            'process_id IN (\''.implode('\',\'', $releaseIds).'\') AND deleted=0',
2340 2340
             array(
2341 2341
                 'active'=>'0'
2342 2342
             )
2343 2343
         );
2344 2344
         $this->db->exec_UPDATEquery(
2345 2345
             'tx_crawler_queue',
2346
-            'exec_time=0 AND process_id IN ("'.implode('","',$releaseIds).'")',
2346
+            'exec_time=0 AND process_id IN ("'.implode('","', $releaseIds).'")',
2347 2347
             array(
2348 2348
                 'process_scheduled'=>0,
2349 2349
                 'process_id'=>''
2350 2350
             )
2351 2351
         );
2352 2352
 
2353
-        if(!$withinLock) $this->db->sql_query('COMMIT');
2353
+        if (!$withinLock) $this->db->sql_query('COMMIT');
2354 2354
 
2355 2355
         return true;
2356 2356
     }
@@ -2378,13 +2378,13 @@  discard block
 block discarded – undo
2378 2378
         $this->db->sql_query('BEGIN');
2379 2379
         $res = $this->db->exec_SELECTquery(
2380 2380
             'process_id,active,ttl',
2381
-            'tx_crawler_process','process_id = \''.$pid.'\'  AND deleted=0',
2381
+            'tx_crawler_process', 'process_id = \''.$pid.'\'  AND deleted=0',
2382 2382
             '',
2383 2383
             'ttl',
2384 2384
             '0,1'
2385 2385
         );
2386
-        if($row = $this->db->sql_fetch_assoc($res))    {
2387
-            $ret = intVal($row['active'])==1;
2386
+        if ($row = $this->db->sql_fetch_assoc($res)) {
2387
+            $ret = intVal($row['active']) == 1;
2388 2388
         }
2389 2389
         $this->db->sql_query('COMMIT');
2390 2390
 
@@ -2397,8 +2397,8 @@  discard block
 block discarded – undo
2397 2397
      * @return string  the ID
2398 2398
      */
2399 2399
     function CLI_buildProcessId() {
2400
-        if(!$this->processID) {
2401
-            $this->processID= \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->microtime(true));
2400
+        if (!$this->processID) {
2401
+            $this->processID = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->microtime(true));
2402 2402
         }
2403 2403
         return $this->processID;
2404 2404
     }
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
      *
2409 2409
      * @return mixed
2410 2410
      */
2411
-    protected function microtime($get_as_float = false )
2411
+    protected function microtime($get_as_float = false)
2412 2412
     {
2413 2413
         return microtime($get_as_float);
2414 2414
     }
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
      * @param  string $msg  the message
2420 2420
      */
2421 2421
     function CLI_debug($msg) {
2422
-        if(intval($this->extensionSettings['processDebug'])) {
2422
+        if (intval($this->extensionSettings['processDebug'])) {
2423 2423
             echo $msg."\n"; flush();
2424 2424
         }
2425 2425
     }
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
         $cmd  = escapeshellcmd($this->extensionSettings['phpPath']);
2440 2440
         $cmd .= ' ';
2441
-        $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler') . 'cli/bootstrap.php');
2441
+        $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler').'cli/bootstrap.php');
2442 2442
         $cmd .= ' ';
2443 2443
         $cmd .= escapeshellarg($this->getFrontendBasePath());
2444 2444
         $cmd .= ' ';
@@ -2448,10 +2448,10 @@  discard block
 block discarded – undo
2448 2448
 
2449 2449
         $startTime = microtime(true);
2450 2450
         $content = $this->executeShellCommand($cmd);
2451
-        $this->log($url . (microtime(true) - $startTime));
2451
+        $this->log($url.(microtime(true) - $startTime));
2452 2452
 
2453 2453
         $result = array(
2454
-            'request' => implode("\r\n", $requestHeaders) . "\r\n\r\n",
2454
+            'request' => implode("\r\n", $requestHeaders)."\r\n\r\n",
2455 2455
             'headers' => '',
2456 2456
             'content' => $content
2457 2457
         );
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
         $scheduledAgeInSeconds = $this->extensionSettings['cleanUpScheduledAge'] * 86400;
2472 2472
 
2473 2473
         $now = time();
2474
-        $condition = '(exec_time<>0 AND exec_time<' . ($now - $processedAgeInSeconds) . ') OR scheduled<=' . ($now - $scheduledAgeInSeconds);
2474
+        $condition = '(exec_time<>0 AND exec_time<'.($now - $processedAgeInSeconds).') OR scheduled<='.($now - $scheduledAgeInSeconds);
2475 2475
         $this->flushQueue($condition);
2476 2476
     }
2477 2477
 
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
             $GLOBALS['TT']->start();
2491 2491
         }
2492 2492
 
2493
-        $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',  $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum);
2493
+        $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum);
2494 2494
         $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
2495 2495
         $GLOBALS['TSFE']->sys_page->init(TRUE);
2496 2496
         $GLOBALS['TSFE']->connectToDB();
@@ -2503,6 +2503,6 @@  discard block
 block discarded – undo
2503 2503
     }
2504 2504
 }
2505 2505
 
2506
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php'])    {
2506
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php']) {
2507 2507
     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php']);
2508 2508
 }
Please login to merge, or discard this patch.
Braces   +48 added lines, -18 removed lines patch added patch discarded remove patch
@@ -642,7 +642,9 @@  discard block
 block discarded – undo
642 642
             $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
643 643
             if(is_array($sets)) {
644 644
                 foreach($sets as $key=>$value) {
645
-                    if(!is_array($value)) continue;
645
+                    if(!is_array($value)) {
646
+                        continue;
647
+                    }
646 648
                     $configurationsForBranch[] = substr($key,-1)=='.'?substr($key,0,-1):$key;
647 649
                 }
648 650
 
@@ -990,7 +992,9 @@  discard block
 block discarded – undo
990 992
      */
991 993
     function addQueueEntry_callBack($setId,$params,$callBack,$page_id=0,$schedule=0) {
992 994
 
993
-        if (!is_array($params))    $params = array();
995
+        if (!is_array($params)) {
996
+            $params = array();
997
+        }
994 998
         $params['_CALLBACKOBJ'] = $callBack;
995 999
 
996 1000
             // Compile value array:
@@ -1092,7 +1096,7 @@  discard block
 block discarded – undo
1092 1096
                 $rows[] = $uid;
1093 1097
                 $urlAdded = true;
1094 1098
                 tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue',$this->setID,array('uid' => $uid, 'fieldArray' => $fieldArray));
1095
-            }else{
1099
+            } else{
1096 1100
                 tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue',$this->setID,array('rows' => $rows, 'fieldArray' => $fieldArray));
1097 1101
             }
1098 1102
         }
@@ -1122,7 +1126,7 @@  discard block
 block discarded – undo
1122 1126
                 $timeBegin     = $currentTime - 100;
1123 1127
                 $timeEnd     = $currentTime + 100;
1124 1128
                 $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '. $currentTime.') ';
1125
-            }else{
1129
+            } else{
1126 1130
                 $where = 'scheduled <= ' . $currentTime;
1127 1131
             }
1128 1132
         } elseif ($tstamp > $currentTime) {
@@ -1314,18 +1318,24 @@  discard block
 block discarded – undo
1314 1318
      */
1315 1319
     function requestUrl($originalUrl, $crawlerId, $timeout=2, $recursion=10) {
1316 1320
 
1317
-        if (!$recursion) return false;
1321
+        if (!$recursion) {
1322
+            return false;
1323
+        }
1318 1324
 
1319 1325
             // Parse URL, checking for scheme:
1320 1326
         $url = parse_url($originalUrl);
1321 1327
 
1322 1328
         if ($url === FALSE) {
1323
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Could not parse_url() for string "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1329
+            if (TYPO3_DLOG) {
1330
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Could not parse_url() for string "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1331
+            }
1324 1332
             return FALSE;
1325 1333
         }
1326 1334
 
1327 1335
         if (!in_array($url['scheme'], array('','http','https'))) {
1328
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1336
+            if (TYPO3_DLOG) {
1337
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1338
+            }
1329 1339
             return FALSE;
1330 1340
         }
1331 1341
 
@@ -1359,7 +1369,9 @@  discard block
 block discarded – undo
1359 1369
         $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
1360 1370
 
1361 1371
         if (!$fp) {
1362
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1372
+            if (TYPO3_DLOG) {
1373
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1374
+            }
1363 1375
             return FALSE;
1364 1376
         } else {
1365 1377
                 // Request message:
@@ -1387,7 +1399,9 @@  discard block
 block discarded – undo
1387 1399
                 if (is_array($newRequestUrl)) {
1388 1400
                     $result = array_merge(array('parentRequest'=>$result), $newRequestUrl);
1389 1401
                 } else {
1390
-                    if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1402
+                    if (TYPO3_DLOG) {
1403
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1404
+                    }
1391 1405
                     return FALSE;
1392 1406
                 }
1393 1407
             }
@@ -1510,20 +1524,32 @@  discard block
 block discarded – undo
1510 1524
      * @return    string        URL from redirection
1511 1525
      */
1512 1526
     protected function getRequestUrlFrom302Header($headers,$user='',$pass='') {
1513
-        if(!is_array($headers)) return false;
1514
-        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) return false;
1527
+        if(!is_array($headers)) {
1528
+            return false;
1529
+        }
1530
+        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) {
1531
+            return false;
1532
+        }
1515 1533
 
1516 1534
         foreach($headers as $hl) {
1517 1535
             $tmp = explode(": ",$hl);
1518 1536
             $header[trim($tmp[0])] = trim($tmp[1]);
1519
-            if(trim($tmp[0])=='Location') break;
1537
+            if(trim($tmp[0])=='Location') {
1538
+                break;
1539
+            }
1540
+        }
1541
+        if(!array_key_exists('Location',$header)) {
1542
+            return false;
1520 1543
         }
1521
-        if(!array_key_exists('Location',$header)) return false;
1522 1544
 
1523 1545
         if($user!='') {
1524
-            if(!($tmp = parse_url($header['Location']))) return false;
1546
+            if(!($tmp = parse_url($header['Location']))) {
1547
+                return false;
1548
+            }
1525 1549
             $newUrl = $tmp['scheme'] . '://' . $user . ':' . $pass . '@' . $tmp['host'] . $tmp['path'];
1526
-            if($tmp['query']!='') $newUrl .= '?' . $tmp['query'];
1550
+            if($tmp['query']!='') {
1551
+                $newUrl .= '?' . $tmp['query'];
1552
+            }
1527 1553
         } else {
1528 1554
             $newUrl = $header['Location'];
1529 1555
         }
@@ -1974,7 +2000,7 @@  discard block
 block discarded – undo
1974 2000
             $configurations = $this->getUrlsForPageId($pageId);
1975 2001
             if(is_array($configurations)){
1976 2002
                 $configurationKeys = array_keys($configurations);
1977
-            }else{
2003
+            } else{
1978 2004
                 $configurationKeys = array();
1979 2005
             }
1980 2006
         }
@@ -2306,7 +2332,9 @@  discard block
 block discarded – undo
2306 2332
             return false;   //nothing to release
2307 2333
         }
2308 2334
 
2309
-        if(!$withinLock) $this->db->sql_query('BEGIN');
2335
+        if(!$withinLock) {
2336
+            $this->db->sql_query('BEGIN');
2337
+        }
2310 2338
 
2311 2339
             // some kind of 2nd chance algo - this way you need at least 2 processes to have a real cleanup
2312 2340
             // this ensures that a single process can't mess up the entire process table
@@ -2350,7 +2378,9 @@  discard block
 block discarded – undo
2350 2378
             )
2351 2379
         );
2352 2380
 
2353
-        if(!$withinLock) $this->db->sql_query('COMMIT');
2381
+        if(!$withinLock) {
2382
+            $this->db->sql_query('COMMIT');
2383
+        }
2354 2384
 
2355 2385
         return true;
2356 2386
     }
Please login to merge, or discard this patch.