Completed
Push — issue/203 ( 66dda3...51c0a4 )
by Tomas Norre
32:37 queued 23:42
created
modfunc1/class.tx_crawler_modfunc1.php 1 patch
Indentation   +919 added lines, -919 removed lines patch added patch discarded remove patch
@@ -35,126 +35,126 @@  discard block
 block discarded – undo
35 35
  * @subpackage tx_crawler
36 36
  */
37 37
 class tx_crawler_modfunc1 extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
38
-		// Internal, dynamic:
39
-	var $duplicateTrack = array();
40
-	var $submitCrawlUrls = FALSE;
41
-	var $downloadCrawlUrls = FALSE;
38
+        // Internal, dynamic:
39
+    var $duplicateTrack = array();
40
+    var $submitCrawlUrls = FALSE;
41
+    var $downloadCrawlUrls = FALSE;
42 42
 
43
-	var $scheduledTime = 0;
44
-	var $reqMinute = 0;
43
+    var $scheduledTime = 0;
44
+    var $reqMinute = 0;
45 45
 
46
-	/**
47
-	 * @var array holds the selection of configuration from the configuration selector box
48
-	 */
49
-	var $incomingConfigurationSelection = array();
46
+    /**
47
+     * @var array holds the selection of configuration from the configuration selector box
48
+     */
49
+    var $incomingConfigurationSelection = array();
50 50
 
51
-	/**
52
-	 * @var tx_crawler_lib
53
-	 */
54
-	var $crawlerObj;
51
+    /**
52
+     * @var tx_crawler_lib
53
+     */
54
+    var $crawlerObj;
55 55
 
56
-	var $CSVaccu = array();
56
+    var $CSVaccu = array();
57 57
 
58
-	/**
59
-	 * If true the user requested a CSV export of the queue
60
-	 *
61
-	 * @var boolean
62
-	 */
63
-	var $CSVExport = FALSE;
64
-
65
-	var $downloadUrls = array();
58
+    /**
59
+     * If true the user requested a CSV export of the queue
60
+     *
61
+     * @var boolean
62
+     */
63
+    var $CSVExport = FALSE;
66 64
 
67
-	/**
68
-	 * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
69
-	 *
70
-	 * @var array
71
-	 */
72
-	protected $extensionSettings = array();
65
+    var $downloadUrls = array();
73 66
 
74
-	/**
75
-	 * Indicate that an flash message with an error is present.
76
-	 *
77
-	 * @var boolean
78
-	 */
79
-	protected $isErrorDetected = false;
80
-
81
-	/**
82
-	 * the constructor
83
-	 */
84
-	public function __construct() {
85
-		$this->processManager = new tx_crawler_domain_process_manager();
86
-	}
87
-
88
-	/**
89
-	 * Additions to the function menu array
90
-	 *
91
-	 * @return	array		Menu array
92
-	 */
93
-	function modMenu()	{
94
-		global $LANG;
95
-
96
-		return array (
97
-			'depth' => array(
98
-				0 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
99
-				1 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
100
-				2 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
101
-				3 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
102
-				4 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
103
-				99 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
104
-			),
105
-			'crawlaction' => array(
106
-				'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
107
-				'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
108
-				'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
109
-			),
110
-			'log_resultLog' => '',
111
-			'log_feVars' => '',
112
-			'processListMode' => '',
113
-			'log_display' => array(
114
-				'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
115
-				'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
116
-				'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
117
-			),
118
-			'itemsPerPage' => array(
119
-				'5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
120
-				'10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
121
-				'50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
122
-				'0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
123
-			)
124
-		);
125
-	}
67
+    /**
68
+     * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
69
+     *
70
+     * @var array
71
+     */
72
+    protected $extensionSettings = array();
126 73
 
127
-	/**
128
-	 * Load extension settings
129
-	 *
130
-	 * @param void
131
-	 * @return void
132
-	 */
133
-	protected function loadExtensionSettings() {
134
-		$this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
135
-	}
136
-
137
-	/**
138
-	 * Main function
139
-	 *
140
-	 * @return	string		HTML output
141
-	 */
142
-	function main() {
143
-		global $LANG, $BACK_PATH;
74
+    /**
75
+     * Indicate that an flash message with an error is present.
76
+     *
77
+     * @var boolean
78
+     */
79
+    protected $isErrorDetected = false;
80
+
81
+    /**
82
+     * the constructor
83
+     */
84
+    public function __construct() {
85
+        $this->processManager = new tx_crawler_domain_process_manager();
86
+    }
87
+
88
+    /**
89
+     * Additions to the function menu array
90
+     *
91
+     * @return	array		Menu array
92
+     */
93
+    function modMenu()	{
94
+        global $LANG;
95
+
96
+        return array (
97
+            'depth' => array(
98
+                0 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
99
+                1 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
100
+                2 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
101
+                3 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
102
+                4 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
103
+                99 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
104
+            ),
105
+            'crawlaction' => array(
106
+                'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
107
+                'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
108
+                'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
109
+            ),
110
+            'log_resultLog' => '',
111
+            'log_feVars' => '',
112
+            'processListMode' => '',
113
+            'log_display' => array(
114
+                'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
115
+                'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
116
+                'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
117
+            ),
118
+            'itemsPerPage' => array(
119
+                '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
120
+                '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
121
+                '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
122
+                '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
123
+            )
124
+        );
125
+    }
126
+
127
+    /**
128
+     * Load extension settings
129
+     *
130
+     * @param void
131
+     * @return void
132
+     */
133
+    protected function loadExtensionSettings() {
134
+        $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
135
+    }
136
+
137
+    /**
138
+     * Main function
139
+     *
140
+     * @return	string		HTML output
141
+     */
142
+    function main() {
143
+        global $LANG, $BACK_PATH;
144 144
 
145
-		$this->incLocalLang();
145
+        $this->incLocalLang();
146 146
 
147
-		$this->loadExtensionSettings();
148
-		if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
149
-			$this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
150
-		}
147
+        $this->loadExtensionSettings();
148
+        if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
149
+            $this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
150
+        }
151 151
 
152
-			// Set CSS styles specific for this document:
153
-		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
152
+            // Set CSS styles specific for this document:
153
+        $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
154 154
 			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
155 155
 		',$this->pObj->content);
156 156
 
157
-		$this->pObj->content .= '<style type="text/css"><!--
157
+        $this->pObj->content .= '<style type="text/css"><!--
158 158
 			table.url-table,
159 159
 			table.param-expanded,
160 160
 			table.crawlerlog {
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 		<link rel="stylesheet" type="text/css" href="'.$BACK_PATH.'../typo3conf/ext/crawler/template/res.css" />
173 173
 		';
174 174
 
175
-			// Type function menu:
176
-		$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
177
-			$this->pObj->id,
178
-			'SET[crawlaction]',
179
-			$this->pObj->MOD_SETTINGS['crawlaction'],
180
-			$this->pObj->MOD_MENU['crawlaction'],
181
-			'index.php'
182
-		);
175
+            // Type function menu:
176
+        $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
177
+            $this->pObj->id,
178
+            'SET[crawlaction]',
179
+            $this->pObj->MOD_SETTINGS['crawlaction'],
180
+            $this->pObj->MOD_MENU['crawlaction'],
181
+            'index.php'
182
+        );
183 183
 
184
-		/*
184
+        /*
185 185
 			// Showing depth-menu in certain cases:
186 186
 		if ($this->pObj->MOD_SETTINGS['crawlaction']!=='cli' && $this->pObj->MOD_SETTINGS['crawlaction']!== 'multiprocess' && ($this->pObj->MOD_SETTINGS['crawlaction']!=='log' || $this->pObj->id))	{
187 187
 			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
@@ -194,63 +194,63 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 		*/
196 196
 
197
-			// Additional menus for the log type:
198
-		if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
199
-			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
200
-				$this->pObj->id,
201
-				'SET[depth]',
202
-				$this->pObj->MOD_SETTINGS['depth'],
203
-				$this->pObj->MOD_MENU['depth'],
204
-				'index.php'
205
-			);
197
+            // Additional menus for the log type:
198
+        if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
199
+            $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
200
+                $this->pObj->id,
201
+                'SET[depth]',
202
+                $this->pObj->MOD_SETTINGS['depth'],
203
+                $this->pObj->MOD_MENU['depth'],
204
+                'index.php'
205
+            );
206
+
207
+            $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
208
+
209
+            $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
210
+
211
+            $h_func.= '<hr/>'.
212
+                    $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) . ' - ' .
213
+                    $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) . ' - ' .
214
+                    $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) . ' - ' .
215
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
216
+                    \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
217
+                        $this->pObj->id,
218
+                        'SET[itemsPerPage]',
219
+                        $this->pObj->MOD_SETTINGS['itemsPerPage'],
220
+                        $this->pObj->MOD_MENU['itemsPerPage'],
221
+                        'index.php'
222
+                    );
223
+        }
206 224
 
207
-			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
208
-
209
-			$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
210
-
211
-			$h_func.= '<hr/>'.
212
-					$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) . ' - ' .
213
-					$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) . ' - ' .
214
-					$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) . ' - ' .
215
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
216
-					\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
217
-						$this->pObj->id,
218
-						'SET[itemsPerPage]',
219
-						$this->pObj->MOD_SETTINGS['itemsPerPage'],
220
-						$this->pObj->MOD_MENU['itemsPerPage'],
221
-						'index.php'
222
-					);
223
-		}
225
+        $theOutput= $this->pObj->doc->spacer(5);
226
+        $theOutput.= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
224 227
 
225
-		$theOutput= $this->pObj->doc->spacer(5);
226
-		$theOutput.= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
227
-
228
-			// Branch based on type:
229
-		switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
230
-			case 'start':
231
-				if (empty($this->pObj->id)) {
232
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
233
-				} else {
234
-					$theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
235
-				}
236
-				break;
237
-			case 'log':
238
-				if (empty($this->pObj->id)) {
239
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
240
-				} else {
241
-					$theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
242
-				}
243
-				break;
244
-			case 'cli':
245
-				$theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
246
-				break;
247
-			case 'multiprocess':
248
-				$theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
249
-				break;
250
-		}
228
+            // Branch based on type:
229
+        switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
230
+            case 'start':
231
+                if (empty($this->pObj->id)) {
232
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
233
+                } else {
234
+                    $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
235
+                }
236
+                break;
237
+            case 'log':
238
+                if (empty($this->pObj->id)) {
239
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
240
+                } else {
241
+                    $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
242
+                }
243
+                break;
244
+            case 'cli':
245
+                $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
246
+                break;
247
+            case 'multiprocess':
248
+                $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
249
+                break;
250
+        }
251 251
 
252
-		return $theOutput;
253
-	}
252
+        return $theOutput;
253
+    }
254 254
 
255 255
 
256 256
 
@@ -263,176 +263,176 @@  discard block
 block discarded – undo
263 263
 
264 264
 
265 265
 
266
-	/*******************************
266
+    /*******************************
267 267
 	 *
268 268
 	 * Generate URLs for crawling:
269 269
 	 *
270 270
 	 ******************************/
271 271
 
272
-	/**
273
-	 * Produces a table with overview of the URLs to be crawled for each page
274
-	 *
275
-	 * @return	string		HTML output
276
-	 */
277
-	function drawURLs()	{
278
-		global $BACK_PATH, $BE_USER;
279
-
280
-			// Init:
281
-		$this->duplicateTrack = array();
282
-		$this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
283
-		$this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
284
-		$this->makeCrawlerProcessableChecks();
285
-
286
-		switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
287
-			case 'midnight':
288
-				$this->scheduledTime = mktime(0,0,0);
289
-			break;
290
-			case '04:00':
291
-				$this->scheduledTime = mktime(0,0,0)+4*3600;
292
-			break;
293
-			case 'now':
294
-			default:
295
-				$this->scheduledTime = time();
296
-			break;
297
-		}
298
-		// $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
299
-		// TODO: check relevance
300
-		$this->reqMinute = 1000;
272
+    /**
273
+     * Produces a table with overview of the URLs to be crawled for each page
274
+     *
275
+     * @return	string		HTML output
276
+     */
277
+    function drawURLs()	{
278
+        global $BACK_PATH, $BE_USER;
279
+
280
+            // Init:
281
+        $this->duplicateTrack = array();
282
+        $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
283
+        $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
284
+        $this->makeCrawlerProcessableChecks();
285
+
286
+        switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
287
+            case 'midnight':
288
+                $this->scheduledTime = mktime(0,0,0);
289
+            break;
290
+            case '04:00':
291
+                $this->scheduledTime = mktime(0,0,0)+4*3600;
292
+            break;
293
+            case 'now':
294
+            default:
295
+                $this->scheduledTime = time();
296
+            break;
297
+        }
298
+        // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
299
+        // TODO: check relevance
300
+        $this->reqMinute = 1000;
301 301
 
302 302
 
303
-		$this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
304
-		$this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
303
+        $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
304
+        $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
305 305
 
306
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
307
-		$this->crawlerObj->setAccessMode('gui');
308
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
306
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
307
+        $this->crawlerObj->setAccessMode('gui');
308
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
309 309
 
310
-		if (empty($this->incomingConfigurationSelection)
311
-			|| (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
312
-			) {
313
-			$code= '
310
+        if (empty($this->incomingConfigurationSelection)
311
+            || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
312
+            ) {
313
+            $code= '
314 314
 			<tr>
315 315
 				<td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td>
316 316
 			</tr>';
317
-		} else {
318
-			if($this->submitCrawlUrls){
319
-				$reason = new tx_crawler_domain_reason();
320
-				$reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
321
-
322
-				if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
323
-				$reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
324
-
325
-				tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
326
-																			$this->findCrawler()->setID,
327
-																			array(	'reason' => $reason ));
328
-			}
329
-
330
-			$code = $this->crawlerObj->getPageTreeAndUrls(
331
-				$this->pObj->id,
332
-				$this->pObj->MOD_SETTINGS['depth'],
333
-				$this->scheduledTime,
334
-				$this->reqMinute,
335
-				$this->submitCrawlUrls,
336
-				$this->downloadCrawlUrls,
337
-				array(), // Do not filter any processing instructions
338
-				$this->incomingConfigurationSelection
339
-			);
317
+        } else {
318
+            if($this->submitCrawlUrls){
319
+                $reason = new tx_crawler_domain_reason();
320
+                $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
321
+
322
+                if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
323
+                $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
324
+
325
+                tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
326
+                                                                            $this->findCrawler()->setID,
327
+                                                                            array(	'reason' => $reason ));
328
+            }
329
+
330
+            $code = $this->crawlerObj->getPageTreeAndUrls(
331
+                $this->pObj->id,
332
+                $this->pObj->MOD_SETTINGS['depth'],
333
+                $this->scheduledTime,
334
+                $this->reqMinute,
335
+                $this->submitCrawlUrls,
336
+                $this->downloadCrawlUrls,
337
+                array(), // Do not filter any processing instructions
338
+                $this->incomingConfigurationSelection
339
+            );
340 340
 
341 341
 
342
-		}
342
+        }
343 343
 
344
-		$this->downloadUrls = $this->crawlerObj->downloadUrls;
345
-		$this->duplicateTrack = $this->crawlerObj->duplicateTrack;
344
+        $this->downloadUrls = $this->crawlerObj->downloadUrls;
345
+        $this->duplicateTrack = $this->crawlerObj->duplicateTrack;
346 346
 
347
-		$output = '';
348
-		if ($code)	{
347
+        $output = '';
348
+        if ($code)	{
349 349
 
350
-			$output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
351
-			$output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
350
+            $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
351
+            $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
352 352
 
353
-			if (!$this->submitCrawlUrls)	{
354
-				$output .= $this->drawURLs_cfgSelectors().'<br />';
355
-				$output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
356
-				$output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
357
-				$output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
358
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
359
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
360
-				$output .= '<br />
353
+            if (!$this->submitCrawlUrls)	{
354
+                $output .= $this->drawURLs_cfgSelectors().'<br />';
355
+                $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
356
+                $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
357
+                $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
358
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
359
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
360
+                $output .= '<br />
361 361
 					<table class="lrPadding c-list url-table">'.
362
-						$this->drawURLs_printTableHeader().
363
-						$code.
364
-					'</table>';
365
-			} else {
366
-				$output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
367
-				$output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
368
-				$output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
369
-			}
370
-		}
371
-
372
-			// Download Urls to crawl:
373
-		if ($this->downloadCrawlUrls)	{
374
-
375
-				// Creating output header:
376
-			$mimeType = 'application/octet-stream';
377
-			Header('Content-Type: '.$mimeType);
378
-			Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
379
-
380
-				// Printing the content of the CSV lines:
381
-			echo implode(chr(13).chr(10),$this->downloadUrls);
382
-
383
-				// Exits:
384
-			exit;
385
-		}
362
+                        $this->drawURLs_printTableHeader().
363
+                        $code.
364
+                    '</table>';
365
+            } else {
366
+                $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
367
+                $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
368
+                $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
369
+            }
370
+        }
386 371
 
387
-			// Return output:
388
-		return 	$output;
389
-	}
372
+            // Download Urls to crawl:
373
+        if ($this->downloadCrawlUrls)	{
390 374
 
391
-	/**
392
-	 * Draws the configuration selectors for compiling URLs:
393
-	 *
394
-	 * @return	string		HTML table
395
-	 */
396
-	function drawURLs_cfgSelectors()	{
375
+                // Creating output header:
376
+            $mimeType = 'application/octet-stream';
377
+            Header('Content-Type: '.$mimeType);
378
+            Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
397 379
 
398
-			// depth
399
-		$cell[] = $this->selectorBox(
400
-			array(
401
-				0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
402
-				1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
403
-				2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
404
-				3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
405
-				4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
406
-				99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
407
-			),
408
-			'SET[depth]',
409
-			$this->pObj->MOD_SETTINGS['depth'],
410
-			0
411
-		);
412
-		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
380
+                // Printing the content of the CSV lines:
381
+            echo implode(chr(13).chr(10),$this->downloadUrls);
413 382
 
414
-			// Configurations
415
-		$cell[] = $this->selectorBox(
416
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
417
-			'configurationSelection',
418
-			$this->incomingConfigurationSelection,
419
-			1
420
-		);
383
+                // Exits:
384
+            exit;
385
+        }
421 386
 
422
-			// Scheduled time:
423
-		$cell[] = $this->selectorBox(
424
-			array(
425
-				'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
426
-				'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
427
-				'04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
428
-			),
429
-			'tstamp',
430
-			\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
431
-			0
432
-		);
387
+            // Return output:
388
+        return 	$output;
389
+    }
433 390
 
434
-		// TODO: check relevance
435
-		/*
391
+    /**
392
+     * Draws the configuration selectors for compiling URLs:
393
+     *
394
+     * @return	string		HTML table
395
+     */
396
+    function drawURLs_cfgSelectors()	{
397
+
398
+            // depth
399
+        $cell[] = $this->selectorBox(
400
+            array(
401
+                0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
402
+                1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
403
+                2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
404
+                3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
405
+                4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
406
+                99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
407
+            ),
408
+            'SET[depth]',
409
+            $this->pObj->MOD_SETTINGS['depth'],
410
+            0
411
+        );
412
+        $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
413
+
414
+            // Configurations
415
+        $cell[] = $this->selectorBox(
416
+            empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
417
+            'configurationSelection',
418
+            $this->incomingConfigurationSelection,
419
+            1
420
+        );
421
+
422
+            // Scheduled time:
423
+        $cell[] = $this->selectorBox(
424
+            array(
425
+                'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
426
+                'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
427
+                '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
428
+            ),
429
+            'tstamp',
430
+            \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
431
+            0
432
+        );
433
+
434
+        // TODO: check relevance
435
+        /*
436 436
 			// Requests per minute:
437 437
 		$cell[] = $this->selectorBox(
438 438
 			array(
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		);
454 454
 		*/
455 455
 
456
-		$output = '
456
+        $output = '
457 457
 			<table class="lrPadding c-list">
458 458
 				<tr class="bgColor5 tableheader">
459 459
 					<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.depth').':</td>
@@ -466,17 +466,17 @@  discard block
 block discarded – undo
466 466
 				</tr>
467 467
 			</table>';
468 468
 
469
-		return $output;
470
-	}
469
+        return $output;
470
+    }
471 471
 
472
-	/**
473
-	 * Create Table header row for URL display
474
-	 *
475
-	 * @return	string		Table header
476
-	 */
477
-	function drawURLs_printTableHeader()	{
472
+    /**
473
+     * Create Table header row for URL display
474
+     *
475
+     * @return	string		Table header
476
+     */
477
+    function drawURLs_printTableHeader()	{
478 478
 
479
-		$content = '
479
+        $content = '
480 480
 			<tr class="bgColor5 tableheader">
481 481
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
482 482
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.key').':</td>
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.parameters').':</td>
488 488
 			</tr>';
489 489
 
490
-		return $content;
491
-	}
490
+        return $content;
491
+    }
492 492
 
493 493
 
494 494
 
@@ -501,110 +501,110 @@  discard block
 block discarded – undo
501 501
 
502 502
 
503 503
 
504
-	/*******************************
504
+    /*******************************
505 505
 	 *
506 506
 	 * Shows log of indexed URLs
507 507
 	 *
508 508
 	 ******************************/
509 509
 
510
-	/**
511
-	 * Shows the log of indexed URLs
512
-	 *
513
-	 * @return	string		HTML output
514
-	 */
515
-	function drawLog()	{
516
-		global $BACK_PATH;
517
-		$output = '';
518
-
519
-			// Init:
520
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
521
-		$this->crawlerObj->setAccessMode('gui');
522
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
523
-
524
-		$this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
525
-
526
-			// Read URL:
527
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read'))	{
528
-			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
529
-		}
510
+    /**
511
+     * Shows the log of indexed URLs
512
+     *
513
+     * @return	string		HTML output
514
+     */
515
+    function drawLog()	{
516
+        global $BACK_PATH;
517
+        $output = '';
518
+
519
+            // Init:
520
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
521
+        $this->crawlerObj->setAccessMode('gui');
522
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
523
+
524
+        $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
525
+
526
+            // Read URL:
527
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read'))	{
528
+            $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
529
+        }
530 530
 
531
-			// Look for set ID sent - if it is, we will display contents of that set:
532
-		$showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
531
+            // Look for set ID sent - if it is, we will display contents of that set:
532
+        $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
533 533
 
534
-			// Show details:
535
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
534
+            // Show details:
535
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
536 536
 
537
-				// Get entry record:
538
-			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
537
+                // Get entry record:
538
+            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
539 539
 
540
-				// Explode values:
541
-				$resStatus = $this->getResStatus($q_entry);
542
-			$q_entry['parameters'] = unserialize($q_entry['parameters']);
543
-			$q_entry['result_data'] = unserialize($q_entry['result_data']);
544
-			if (is_array($q_entry['result_data']))	{
545
-				$q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
546
-			}
540
+                // Explode values:
541
+                $resStatus = $this->getResStatus($q_entry);
542
+            $q_entry['parameters'] = unserialize($q_entry['parameters']);
543
+            $q_entry['result_data'] = unserialize($q_entry['result_data']);
544
+            if (is_array($q_entry['result_data']))	{
545
+                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
546
+            }
547 547
 
548
-			if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
549
-				unset($q_entry['result_data']['content']['log']);
550
-			}
548
+            if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
549
+                unset($q_entry['result_data']['content']['log']);
550
+            }
551 551
 
552
-				// Print rudimentary details:
553
-			$output .= '
552
+                // Print rudimentary details:
553
+            $output .= '
554 554
 				<br /><br />
555 555
 				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
556 556
 				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
557 557
 				<input type="hidden" value="' . $showSetId . '" name="setID" />
558 558
 				<br />
559 559
 				Current server time: ' . date('H:i:s', time()) . '<br />' .
560
-				'Status: ' . $resStatus . '<br />' .
561
-				\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
562
-		} else {	// Show list:
563
-
564
-				// If either id or set id, show list:
565
-			if ($this->pObj->id || $showSetId)	{
566
-				if ($this->pObj->id)	{
567
-						// Drawing tree:
568
-					$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
569
-					$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
570
-					$tree->init('AND '.$perms_clause);
571
-
572
-						// Set root row:
573
-					$HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
574
-					$HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
575
-					$tree->tree[] = Array(
576
-						'row' => $this->pObj->pageinfo,
577
-						'HTML' => $HTML
578
-					);
579
-
580
-						// Get branch beneath:
581
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
582
-						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
583
-					}
584
-
585
-						// Traverse page tree:
586
-					$code = ''; $count = 0;
587
-					foreach($tree->tree as $data)	{
588
-						$code .= $this->drawLog_addRows(
589
-									$data['row'],
590
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
591
-									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
592
-								);
593
-						if (++$count == 1000) {
594
-							break;
595
-						}
596
-					}
597
-				} else {
598
-					$code = '';
599
-					$code.= $this->drawLog_addRows(
600
-								$showSetId,
601
-								'Set ID: '.$showSetId
602
-							);
603
-				}
604
-
605
-				if ($code)	{
606
-
607
-					$output .= '
560
+                'Status: ' . $resStatus . '<br />' .
561
+                \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
562
+        } else {	// Show list:
563
+
564
+                // If either id or set id, show list:
565
+            if ($this->pObj->id || $showSetId)	{
566
+                if ($this->pObj->id)	{
567
+                        // Drawing tree:
568
+                    $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
569
+                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
570
+                    $tree->init('AND '.$perms_clause);
571
+
572
+                        // Set root row:
573
+                    $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
574
+                    $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
575
+                    $tree->tree[] = Array(
576
+                        'row' => $this->pObj->pageinfo,
577
+                        'HTML' => $HTML
578
+                    );
579
+
580
+                        // Get branch beneath:
581
+                    if ($this->pObj->MOD_SETTINGS['depth'])	{
582
+                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
583
+                    }
584
+
585
+                        // Traverse page tree:
586
+                    $code = ''; $count = 0;
587
+                    foreach($tree->tree as $data)	{
588
+                        $code .= $this->drawLog_addRows(
589
+                                    $data['row'],
590
+                                    $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
591
+                                    intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
592
+                                );
593
+                        if (++$count == 1000) {
594
+                            break;
595
+                        }
596
+                    }
597
+                } else {
598
+                    $code = '';
599
+                    $code.= $this->drawLog_addRows(
600
+                                $showSetId,
601
+                                'Set ID: '.$showSetId
602
+                            );
603
+                }
604
+
605
+                if ($code)	{
606
+
607
+                    $output .= '
608 608
 						<br /><br />
609 609
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" />
610 610
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" />
@@ -618,20 +618,20 @@  discard block
 block discarded – undo
618 618
 
619 619
 
620 620
 						<table class="lrPadding c-list crawlerlog">'.
621
-							$this->drawLog_printTableHeader().
622
-							$code.
623
-						'</table>';
624
-				}
625
-			} else {	// Otherwise show available sets:
626
-				$setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
627
-								'set_id, count(*) as count_value, scheduled',
628
-								'tx_crawler_queue',
629
-								'',
630
-								'set_id, scheduled',
631
-								'scheduled DESC'
632
-							);
633
-
634
-				$code = '
621
+                            $this->drawLog_printTableHeader().
622
+                            $code.
623
+                        '</table>';
624
+                }
625
+            } else {	// Otherwise show available sets:
626
+                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
627
+                                'set_id, count(*) as count_value, scheduled',
628
+                                'tx_crawler_queue',
629
+                                '',
630
+                                'set_id, scheduled',
631
+                                'scheduled DESC'
632
+                            );
633
+
634
+                $code = '
635 635
 					<tr class="bgColor5 tableheader">
636 636
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>
637 637
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td>
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 					</tr>
640 640
 				';
641 641
 
642
-				$cc=0;
643
-				foreach($setList as $set)	{
644
-					$code.= '
642
+                $cc=0;
643
+                foreach($setList as $set)	{
644
+                    $code.= '
645 645
 						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
646 646
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
647 647
 							<td>'.$set['count_value'].'</td>
@@ -649,218 +649,218 @@  discard block
 block discarded – undo
649 649
 						</tr>
650 650
 					';
651 651
 
652
-					$cc++;
653
-				}
652
+                    $cc++;
653
+                }
654 654
 
655
-				$output .= '
655
+                $output .= '
656 656
 					<br /><br />
657 657
 					<table class="lrPadding c-list">'.
658
-						$code.
659
-					'</table>';
660
-			}
661
-		}
658
+                        $code.
659
+                    '</table>';
660
+            }
661
+        }
662 662
 
663
-		if($this->CSVExport) {
664
-			$this->outputCsvFile();
665
-		}
663
+        if($this->CSVExport) {
664
+            $this->outputCsvFile();
665
+        }
666 666
 
667
-			// Return output
668
-		return 	$output;
669
-	}
667
+            // Return output
668
+        return 	$output;
669
+    }
670 670
 
671
-	/**
672
-	 * Outputs the CSV file and sets the correct headers
673
-	 */
674
-	protected function outputCsvFile() {
671
+    /**
672
+     * Outputs the CSV file and sets the correct headers
673
+     */
674
+    protected function outputCsvFile() {
675 675
 
676
-		if (!count($this->CSVaccu)) {
677
-			$this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
678
-			return;
679
-		}
676
+        if (!count($this->CSVaccu)) {
677
+            $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
678
+            return;
679
+        }
680 680
 
681
-		$csvLines = array();
681
+        $csvLines = array();
682 682
 
683
-			// Field names:
684
-		reset($this->CSVaccu);
685
-		$fieldNames = array_keys(current($this->CSVaccu));
686
-		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
683
+            // Field names:
684
+        reset($this->CSVaccu);
685
+        $fieldNames = array_keys(current($this->CSVaccu));
686
+        $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
687 687
 
688
-			// Data:
689
-		foreach($this->CSVaccu as $row)	{
690
-			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
691
-		}
688
+            // Data:
689
+        foreach($this->CSVaccu as $row)	{
690
+            $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
691
+        }
692 692
 
693
-			// Creating output header:
694
-		$mimeType = 'application/octet-stream';
695
-		Header('Content-Type: '.$mimeType);
696
-		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
693
+            // Creating output header:
694
+        $mimeType = 'application/octet-stream';
695
+        Header('Content-Type: '.$mimeType);
696
+        Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
697 697
 
698
-			// Printing the content of the CSV lines:
699
-		echo implode(chr(13).chr(10),$csvLines);
698
+            // Printing the content of the CSV lines:
699
+        echo implode(chr(13).chr(10),$csvLines);
700 700
 
701
-			// Exits:
702
-		exit;
703
-	}
701
+            // Exits:
702
+        exit;
703
+    }
704 704
 
705
-	/**
706
-	 * Create the rows for display of the page tree
707
-	 * For each page a number of rows are shown displaying GET variable configuration
708
-	 *
709
-	 * @param array $pageRow_setId Page row or set-id
710
-	 * @param string $titleString Title string
711
-	 * @param int $itemsPerPage Items per Page setting
705
+    /**
706
+     * Create the rows for display of the page tree
707
+     * For each page a number of rows are shown displaying GET variable configuration
712 708
      *
713
-	 * @return string HTML <tr> content (one or more)
714
-	 */
715
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
716
-
717
-			// If Flush button is pressed, flush tables instead of selecting entries:
718
-
719
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
720
-			$doFlush = true;
721
-			$doFullFlush = false;
722
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
723
-			$doFlush = true;
724
-			$doFullFlush = true;
725
-		} else {
726
-			$doFlush = false;
727
-			$doFullFlush = false;
728
-		}
709
+     * @param array $pageRow_setId Page row or set-id
710
+     * @param string $titleString Title string
711
+     * @param int $itemsPerPage Items per Page setting
712
+     *
713
+     * @return string HTML <tr> content (one or more)
714
+     */
715
+    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
716
+
717
+            // If Flush button is pressed, flush tables instead of selecting entries:
718
+
719
+        if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
720
+            $doFlush = true;
721
+            $doFullFlush = false;
722
+        } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
723
+            $doFlush = true;
724
+            $doFullFlush = true;
725
+        } else {
726
+            $doFlush = false;
727
+            $doFullFlush = false;
728
+        }
729 729
 
730
-			// Get result:
731
-		if (is_array($pageRow_setId))	{
732
-			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
733
-		} else {
734
-			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
735
-		}
730
+            // Get result:
731
+        if (is_array($pageRow_setId))	{
732
+            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
733
+        } else {
734
+            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
735
+        }
736 736
 
737
-			// Init var:
738
-		$colSpan = 9
739
-				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
740
-				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
741
-
742
-		if (count($res))	{
743
-				// Traverse parameter combinations:
744
-			$c = 0;
745
-			$content='';
746
-			foreach($res as $kk => $vv)	{
747
-
748
-					// Title column:
749
-				if (!$c)	{
750
-					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
751
-				} else {
752
-					$titleClm = '';
753
-				}
754
-
755
-					// Result:
756
-				$resLog = $this->getResultLog($vv);
757
-
758
-				$resStatus = $this->getResStatus($vv);
759
-				$resFeVars = $this->getResFeVars($vv);
760
-
761
-					// Compile row:
762
-				$parameters = unserialize($vv['parameters']);
763
-
764
-					// Put data into array:
765
-				$rowData = array();
766
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
767
-					$rowData['result_log'] = $resLog;
768
-				} else {
769
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
770
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
771
-				}
772
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
773
-				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
774
-				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
775
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
776
-				$rowData['set_id'] = $vv['set_id'];
777
-
778
-				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
779
-					$rowData['tsfe_id'] = $resFeVars['id'];
780
-					$rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
781
-					$rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
782
-				}
783
-
784
-				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
785
-
786
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
787
-				if (version_compare(TYPO3_version,'7.0','>=')) {
788
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
789
-				}
790
-
791
-					// Put rows together:
792
-				$content.= '
737
+            // Init var:
738
+        $colSpan = 9
739
+                + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
740
+                + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
741
+
742
+        if (count($res))	{
743
+                // Traverse parameter combinations:
744
+            $c = 0;
745
+            $content='';
746
+            foreach($res as $kk => $vv)	{
747
+
748
+                    // Title column:
749
+                if (!$c)	{
750
+                    $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
751
+                } else {
752
+                    $titleClm = '';
753
+                }
754
+
755
+                    // Result:
756
+                $resLog = $this->getResultLog($vv);
757
+
758
+                $resStatus = $this->getResStatus($vv);
759
+                $resFeVars = $this->getResFeVars($vv);
760
+
761
+                    // Compile row:
762
+                $parameters = unserialize($vv['parameters']);
763
+
764
+                    // Put data into array:
765
+                $rowData = array();
766
+                if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
767
+                    $rowData['result_log'] = $resLog;
768
+                } else {
769
+                    $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
770
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
771
+                }
772
+                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
773
+                $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
774
+                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
775
+                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
776
+                $rowData['set_id'] = $vv['set_id'];
777
+
778
+                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
779
+                    $rowData['tsfe_id'] = $resFeVars['id'];
780
+                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
781
+                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
782
+                }
783
+
784
+                $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
785
+
786
+                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
787
+                if (version_compare(TYPO3_version,'7.0','>=')) {
788
+                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
789
+                }
790
+
791
+                    // Put rows together:
792
+                $content.= '
793 793
 					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
794 794
 						'.$titleClm.'
795 795
 						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
796 796
 						<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>';
797
-				foreach($rowData as $fKey => $value) {
797
+                foreach($rowData as $fKey => $value) {
798 798
 
799
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
800
-						$content.= '
799
+                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
800
+                        $content.= '
801 801
 						<td>'.$value.'</td>';
802
-					} else {
803
-						$content.= '
802
+                    } else {
803
+                        $content.= '
804 804
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
805
-					}
806
-				}
807
-				$content.= '
805
+                    }
806
+                }
807
+                $content.= '
808 808
 					</tr>';
809
-				$c++;
810
-
811
-				if ($this->CSVExport)	{
812
-						// Only for CSV (adding qid and scheduled/exec_time if needed):
813
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
814
-					$rowData['qid'] = $vv['qid'];
815
-					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
816
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
817
-					$this->CSVaccu[] = $rowData;
818
-				}
819
-			}
820
-		} else {
809
+                $c++;
810
+
811
+                if ($this->CSVExport)	{
812
+                        // Only for CSV (adding qid and scheduled/exec_time if needed):
813
+                    $rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
814
+                    $rowData['qid'] = $vv['qid'];
815
+                    $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
816
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
817
+                    $this->CSVaccu[] = $rowData;
818
+                }
819
+            }
820
+        } else {
821 821
 
822
-				// Compile row:
823
-			$content = '
822
+                // Compile row:
823
+            $content = '
824 824
 				<tr class="bgColor-20">
825 825
 					<td>'.$titleString.'</td>
826 826
 					<td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td>
827 827
 				</tr>';
828
-		}
828
+        }
829 829
 
830
-		return $content;
831
-	}
830
+        return $content;
831
+    }
832 832
 
833
-	/**
834
-	 * Find Fe vars
835
-	 *
836
-	 * @param array $row
837
-	 * @return array
838
-	 */
839
-	function getResFeVars($row) {
840
-		$feVars = array();
841
-
842
-		if ($row['result_data']) {
843
-			$resultData = unserialize($row['result_data']);
844
-			$requestResult = unserialize($resultData['content']);
845
-			$feVars = $requestResult['vars'];
846
-		}
833
+    /**
834
+     * Find Fe vars
835
+     *
836
+     * @param array $row
837
+     * @return array
838
+     */
839
+    function getResFeVars($row) {
840
+        $feVars = array();
841
+
842
+        if ($row['result_data']) {
843
+            $resultData = unserialize($row['result_data']);
844
+            $requestResult = unserialize($resultData['content']);
845
+            $feVars = $requestResult['vars'];
846
+        }
847 847
 
848
-		return $feVars;
849
-	}
848
+        return $feVars;
849
+    }
850 850
 
851
-	/**
852
-	 * Create Table header row (log)
853
-	 *
854
-	 * @return	string		Table header
855
-	 */
856
-	function drawLog_printTableHeader()	{
851
+    /**
852
+     * Create Table header row (log)
853
+     *
854
+     * @return	string		Table header
855
+     */
856
+    function drawLog_printTableHeader()	{
857 857
 
858
-		$content = '
858
+        $content = '
859 859
 			<tr class="bgColor5 tableheader">
860 860
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
861 861
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td>
862 862
 				<td>&nbsp;</td>'.
863
-				($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
863
+                ($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
864 864
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : '
865 865
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td>
866 866
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').'
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td>
870 870
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td>
871 871
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'.
872
-				($this->pObj->MOD_SETTINGS['log_feVars'] ? '
872
+                ($this->pObj->MOD_SETTINGS['log_feVars'] ? '
873 873
 				<td>'.htmlspecialchars('TSFE->id').'</td>
874 874
 				<td>'.htmlspecialchars('TSFE->gr_list').'</td>
875 875
 				<td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').'
876 876
 			</tr>';
877 877
 
878
-		return $content;
879
-	}
878
+        return $content;
879
+    }
880 880
 
881 881
         /**
882 882
          * Extract the log information from the current row and retrive it as formatted string.
@@ -903,25 +903,25 @@  discard block
 block discarded – undo
903 903
                 return $content;
904 904
         }
905 905
 
906
-	function getResStatus($vv) {
907
-		if ($vv['result_data'])	{
908
-			$requestContent = unserialize($vv['result_data']);
909
-			$requestResult = unserialize($requestContent['content']);
910
-			if (is_array($requestResult)) {
911
-				if (empty($requestResult['errorlog'])) {
912
-					$resStatus = 'OK';
913
-				} else {
914
-					$resStatus = implode("\n", $requestResult['errorlog']);
915
-				}
916
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
917
-			} else {
918
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
919
-			}
920
-		} else {
921
-			$resStatus = '-';
922
-		}
923
-		return $resStatus;
924
-	}
906
+    function getResStatus($vv) {
907
+        if ($vv['result_data'])	{
908
+            $requestContent = unserialize($vv['result_data']);
909
+            $requestResult = unserialize($requestContent['content']);
910
+            if (is_array($requestResult)) {
911
+                if (empty($requestResult['errorlog'])) {
912
+                    $resStatus = 'OK';
913
+                } else {
914
+                    $resStatus = implode("\n", $requestResult['errorlog']);
915
+                }
916
+                $resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
917
+            } else {
918
+                $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
919
+            }
920
+        } else {
921
+            $resStatus = '-';
922
+        }
923
+        return $resStatus;
924
+    }
925 925
 
926 926
 
927 927
 
@@ -930,344 +930,344 @@  discard block
 block discarded – undo
930 930
 
931 931
 
932 932
 
933
-	/*****************************
933
+    /*****************************
934 934
 	 *
935 935
 	 * CLI status display
936 936
 	 *
937 937
 	 *****************************/
938 938
 
939
-	/**
940
-	 * This method is used to show an overview about the active an the finished crawling processes
941
-	 *
942
-	 * @author Timo Schmidt
943
-	 * @param void
944
-	 * @return string
945
-	 */
946
-	protected function drawProcessOverviewAction(){
947
-
948
-		$this->runRefreshHooks();
949
-
950
-		global $BACK_PATH;
951
-		$this->makeCrawlerProcessableChecks();
952
-
953
-		$crawler = $this->findCrawler();
954
-		try {
955
-			$this->handleProcessOverviewActions();
956
-		} catch (Exception $e) {
957
-			$this->addErrorMessage($e->getMessage());
958
-		}
939
+    /**
940
+     * This method is used to show an overview about the active an the finished crawling processes
941
+     *
942
+     * @author Timo Schmidt
943
+     * @param void
944
+     * @return string
945
+     */
946
+    protected function drawProcessOverviewAction(){
947
+
948
+        $this->runRefreshHooks();
949
+
950
+        global $BACK_PATH;
951
+        $this->makeCrawlerProcessableChecks();
952
+
953
+        $crawler = $this->findCrawler();
954
+        try {
955
+            $this->handleProcessOverviewActions();
956
+        } catch (Exception $e) {
957
+            $this->addErrorMessage($e->getMessage());
958
+        }
959 959
 
960
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
-		$perpage 	= 20;
960
+        $offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
+        $perpage 	= 20;
962 962
 
963
-		$processRepository	= new tx_crawler_domain_process_repository();
964
-		$queueRepository	= new tx_crawler_domain_queue_repository();
963
+        $processRepository	= new tx_crawler_domain_process_repository();
964
+        $queueRepository	= new tx_crawler_domain_queue_repository();
965 965
 
966
-		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
967
-		if ($mode == 'detail') {
968
-			$where = '';
969
-		} elseif($mode == 'simple') {
970
-			$where = 'active = 1';
971
-		}
966
+        $mode = $this->pObj->MOD_SETTINGS['processListMode'];
967
+        if ($mode == 'detail') {
968
+            $where = '';
969
+        } elseif($mode == 'simple') {
970
+            $where = 'active = 1';
971
+        }
972 972
 
973
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
974
-		$allCount			= $processRepository->countAll($where);
975
-
976
-		$listView			= new tx_crawler_view_process_list();
977
-		$listView->setPageId($this->pObj->id);
978
-		$listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
979
-		$listView->setProcessCollection($allProcesses);
980
-		$listView->setCliPath($this->processManager->getCrawlerCliPath());
981
-		$listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
982
-		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
983
-		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
984
-		$listView->setActiveProcessCount($processRepository->countActive());
985
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
986
-		$listView->setMode($mode);
987
-
988
-		$paginationView		= new tx_crawler_view_pagination();
989
-		$paginationView->setCurrentOffset($offset);
990
-		$paginationView->setPerPage($perpage);
991
-		$paginationView->setTotalItemCount($allCount);
992
-
993
-		$output = $listView->render();
994
-
995
-		if ($paginationView->getTotalPagesCount() > 1) {
996
-			$output .= ' <br />'.$paginationView->render();
997
-		}
973
+        $allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
974
+        $allCount			= $processRepository->countAll($where);
975
+
976
+        $listView			= new tx_crawler_view_process_list();
977
+        $listView->setPageId($this->pObj->id);
978
+        $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
979
+        $listView->setProcessCollection($allProcesses);
980
+        $listView->setCliPath($this->processManager->getCrawlerCliPath());
981
+        $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
982
+        $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
983
+        $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
984
+        $listView->setActiveProcessCount($processRepository->countActive());
985
+        $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
986
+        $listView->setMode($mode);
987
+
988
+        $paginationView		= new tx_crawler_view_pagination();
989
+        $paginationView->setCurrentOffset($offset);
990
+        $paginationView->setPerPage($perpage);
991
+        $paginationView->setTotalItemCount($allCount);
992
+
993
+        $output = $listView->render();
994
+
995
+        if ($paginationView->getTotalPagesCount() > 1) {
996
+            $output .= ' <br />'.$paginationView->render();
997
+        }
998 998
 
999
-		return $output;
1000
-	}
999
+        return $output;
1000
+    }
1001 1001
 
1002
-	/**
1003
-	 * Verify that the crawler is exectuable.
1004
-	 *
1005
-	 * @access protected
1006
-	 * @return void
1007
-	 *
1008
-	 * @author Michael Klapper <[email protected]>
1009
-	 */
1010
-	protected function makeCrawlerProcessableChecks() {
1011
-		global $LANG;
1012
-
1013
-		if ($this->isCrawlerUserAvailable() === false) {
1014
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1015
-		} elseif ($this->isCrawlerUserNotAdmin() === false) {
1016
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1017
-		}
1002
+    /**
1003
+     * Verify that the crawler is exectuable.
1004
+     *
1005
+     * @access protected
1006
+     * @return void
1007
+     *
1008
+     * @author Michael Klapper <[email protected]>
1009
+     */
1010
+    protected function makeCrawlerProcessableChecks() {
1011
+        global $LANG;
1012
+
1013
+        if ($this->isCrawlerUserAvailable() === false) {
1014
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1015
+        } elseif ($this->isCrawlerUserNotAdmin() === false) {
1016
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1017
+        }
1018 1018
 
1019
-		if ($this->isPhpForkAvailable() === false) {
1020
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1021
-		}
1019
+        if ($this->isPhpForkAvailable() === false) {
1020
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1021
+        }
1022 1022
 
1023
-		$exitCode = 0;
1024
-		$out = array();
1025
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1026
-		if ($exitCode > 0) {
1027
-			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1028
-		}
1029
-	}
1023
+        $exitCode = 0;
1024
+        $out = array();
1025
+        exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1026
+        if ($exitCode > 0) {
1027
+            $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1028
+        }
1029
+    }
1030 1030
 
1031
-	/**
1032
-	 * Indicate that the required PHP method "popen" is
1033
-	 * available in the system.
1034
-	 *
1035
-	 * @access protected
1036
-	 * @return boolean
1037
-	 *
1038
-	 * @author Michael Klapper <[email protected]>
1039
-	 */
1040
-	protected function isPhpForkAvailable() {
1041
-		return function_exists('popen');
1042
-	}
1043
-
1044
-	/**
1045
-	 * Indicate that the required be_user "_cli_crawler" is
1046
-	 * global available in the system.
1047
-	 *
1048
-	 * @access protected
1049
-	 * @return boolean
1050
-	 *
1051
-	 * @author Michael Klapper <[email protected]>
1052
-	 */
1053
-	protected function isCrawlerUserAvailable() {
1054
-		$isAvailable = false;
1055
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1031
+    /**
1032
+     * Indicate that the required PHP method "popen" is
1033
+     * available in the system.
1034
+     *
1035
+     * @access protected
1036
+     * @return boolean
1037
+     *
1038
+     * @author Michael Klapper <[email protected]>
1039
+     */
1040
+    protected function isPhpForkAvailable() {
1041
+        return function_exists('popen');
1042
+    }
1043
+
1044
+    /**
1045
+     * Indicate that the required be_user "_cli_crawler" is
1046
+     * global available in the system.
1047
+     *
1048
+     * @access protected
1049
+     * @return boolean
1050
+     *
1051
+     * @author Michael Klapper <[email protected]>
1052
+     */
1053
+    protected function isCrawlerUserAvailable() {
1054
+        $isAvailable = false;
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
-		return $isAvailable;
1061
-	}
1060
+        return $isAvailable;
1061
+    }
1062 1062
 
1063
-	/**
1064
-	 * Indicate that the required be_user "_cli_crawler" is
1065
-	 * has no admin rights.
1066
-	 *
1067
-	 * @access protected
1068
-	 * @return boolean
1069
-	 *
1070
-	 * @author Michael Klapper <[email protected]>
1071
-	 */
1072
-	protected function isCrawlerUserNotAdmin() {
1073
-		$isAvailable = false;
1074
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1063
+    /**
1064
+     * Indicate that the required be_user "_cli_crawler" is
1065
+     * has no admin rights.
1066
+     *
1067
+     * @access protected
1068
+     * @return boolean
1069
+     *
1070
+     * @author Michael Klapper <[email protected]>
1071
+     */
1072
+    protected function isCrawlerUserNotAdmin() {
1073
+        $isAvailable = false;
1074
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1075 1075
 
1076
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1077
-			$isAvailable = true;
1076
+        if (is_array($userArray) && $userArray[0]['admin'] == 0)
1077
+            $isAvailable = true;
1078 1078
 
1079
-		return $isAvailable;
1080
-	}
1079
+        return $isAvailable;
1080
+    }
1081 1081
 
1082
-	/**
1083
-	 * Method to handle incomming actions of the process overview
1084
-	 *
1085
-	 * @param void
1086
-	 * @return void
1087
-	 */
1088
-	protected function handleProcessOverviewActions(){
1089
-
1090
-		$crawler = $this->findCrawler();
1091
-
1092
-		switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1093
-			case 'stopCrawling' :
1094
-				//set the cli status to disable (all processes will be terminated)
1095
-				$crawler->setDisabled(true);
1096
-				break;
1097
-			case 'resumeCrawling' :
1098
-				//set the cli status to end (all processes will be terminated)
1099
-				$crawler->setDisabled(false);
1100
-				break;
1101
-			case 'addProcess' :
1102
-				$handle = $this->processManager->startProcess();
1103
-				if ($handle === false) {
1104
-					throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1105
-				}
1106
-				$this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1107
-				break;
1108
-		}
1109
-	}
1082
+    /**
1083
+     * Method to handle incomming actions of the process overview
1084
+     *
1085
+     * @param void
1086
+     * @return void
1087
+     */
1088
+    protected function handleProcessOverviewActions(){
1089
+
1090
+        $crawler = $this->findCrawler();
1091
+
1092
+        switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1093
+            case 'stopCrawling' :
1094
+                //set the cli status to disable (all processes will be terminated)
1095
+                $crawler->setDisabled(true);
1096
+                break;
1097
+            case 'resumeCrawling' :
1098
+                //set the cli status to end (all processes will be terminated)
1099
+                $crawler->setDisabled(false);
1100
+                break;
1101
+            case 'addProcess' :
1102
+                $handle = $this->processManager->startProcess();
1103
+                if ($handle === false) {
1104
+                    throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1105
+                }
1106
+                $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1107
+                break;
1108
+        }
1109
+    }
1110 1110
 
1111 1111
 
1112 1112
 
1113 1113
 
1114
-	/**
1115
-	 * Returns the singleton instance of the crawler.
1116
-	 *
1117
-	 * @param void
1118
-	 * @return tx_crawler_lib crawler object
1119
-	 * @author Timo Schmidt <[email protected]>
1120
-	 */
1121
-	protected function findCrawler(){
1122
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1123
-			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1124
-		}
1125
-		return $this->crawlerObj;
1126
-	}
1114
+    /**
1115
+     * Returns the singleton instance of the crawler.
1116
+     *
1117
+     * @param void
1118
+     * @return tx_crawler_lib crawler object
1119
+     * @author Timo Schmidt <[email protected]>
1120
+     */
1121
+    protected function findCrawler(){
1122
+        if(!$this->crawlerObj instanceof tx_crawler_lib){
1123
+            $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1124
+        }
1125
+        return $this->crawlerObj;
1126
+    }
1127 1127
 
1128 1128
 
1129 1129
 
1130
-	/*****************************
1130
+    /*****************************
1131 1131
 	 *
1132 1132
 	 * General Helper Functions
1133 1133
 	 *
1134 1134
 	 *****************************/
1135 1135
 
1136
-	/**
1137
-	 * This method is used to add a message to the internal queue
1138
-	 *
1139
-	 * NOTE:
1140
-	 * This method is basesd on TYPO3 4.3 or higher!
1141
-	 *
1142
-	 * @param  string  the message itself
1143
-	 * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1144
-	 *
1145
-	 * @access private
1146
-	 * @return void
1147
-	 */
1148
-	private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1149
-		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1150
-			'TYPO3\CMS\Core\Messaging\FlashMessage',
1151
-			$message,
1152
-			'',
1153
-			$severity
1154
-		);
1155
-
1156
-		// TODO:
1157
-		/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1158
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1159
-		$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1160
-	}
1161
-
1162
-	/**
1163
-	 * Add notice message to the user interface.
1164
-	 *
1165
-	 * NOTE:
1166
-	 * This method is basesd on TYPO3 4.3 or higher!
1167
-	 *
1168
-	 * @param string The message
1169
-	 *
1170
-	 * @access protected
1171
-	 * @return void
1172
-	 *
1173
-	 * @author Michael Klapper <[email protected]>
1174
-	 */
1175
-	protected function addNoticeMessage($message) {
1176
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1177
-	}
1178
-
1179
-	/**
1180
-	 * Add error message to the user interface.
1181
-	 *
1182
-	 * NOTE:
1183
-	 * This method is basesd on TYPO3 4.3 or higher!
1184
-	 *
1185
-	 * @param string The message
1186
-	 *
1187
-	 * @access protected
1188
-	 * @return void
1189
-	 *
1190
-	 * @author Michael Klapper <[email protected]>
1191
-	 */
1192
-	protected function addErrorMessage($message) {
1193
-		$this->isErrorDetected = TRUE;
1194
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1195
-	}
1196
-
1197
-	/**
1198
-	 * Add error message to the user interface.
1199
-	 *
1200
-	 * NOTE:
1201
-	 * This method is basesd on TYPO3 4.3 or higher!
1202
-	 *
1203
-	 * @param string The message
1204
-	 *
1205
-	 * @access protected
1206
-	 * @return void
1207
-	 *
1208
-	 * @author Michael Klapper <[email protected]>
1209
-	 */
1210
-	protected function addWarningMessage($message) {
1211
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1212
-	}
1213
-
1214
-	/**
1215
-	 * Create selector box
1216
-	 *
1217
-	 * @param	array		$optArray Options key(value) => label pairs
1218
-	 * @param	string		$name Selector box name
1219
-	 * @param	string		$value Selector box value (array for multiple...)
1220
-	 * @param	boolean		$multiple If set, will draw multiple box.
1136
+    /**
1137
+     * This method is used to add a message to the internal queue
1138
+     *
1139
+     * NOTE:
1140
+     * This method is basesd on TYPO3 4.3 or higher!
1221 1141
      *
1222
-	 * @return	string		HTML select element
1223
-	 */
1224
-	function selectorBox($optArray, $name, $value, $multiple)	{
1142
+     * @param  string  the message itself
1143
+     * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1144
+     *
1145
+     * @access private
1146
+     * @return void
1147
+     */
1148
+    private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1149
+        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1150
+            'TYPO3\CMS\Core\Messaging\FlashMessage',
1151
+            $message,
1152
+            '',
1153
+            $severity
1154
+        );
1155
+
1156
+        // TODO:
1157
+        /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1158
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1159
+        $flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1160
+    }
1161
+
1162
+    /**
1163
+     * Add notice message to the user interface.
1164
+     *
1165
+     * NOTE:
1166
+     * This method is basesd on TYPO3 4.3 or higher!
1167
+     *
1168
+     * @param string The message
1169
+     *
1170
+     * @access protected
1171
+     * @return void
1172
+     *
1173
+     * @author Michael Klapper <[email protected]>
1174
+     */
1175
+    protected function addNoticeMessage($message) {
1176
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1177
+    }
1178
+
1179
+    /**
1180
+     * Add error message to the user interface.
1181
+     *
1182
+     * NOTE:
1183
+     * This method is basesd on TYPO3 4.3 or higher!
1184
+     *
1185
+     * @param string The message
1186
+     *
1187
+     * @access protected
1188
+     * @return void
1189
+     *
1190
+     * @author Michael Klapper <[email protected]>
1191
+     */
1192
+    protected function addErrorMessage($message) {
1193
+        $this->isErrorDetected = TRUE;
1194
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1195
+    }
1196
+
1197
+    /**
1198
+     * Add error message to the user interface.
1199
+     *
1200
+     * NOTE:
1201
+     * This method is basesd on TYPO3 4.3 or higher!
1202
+     *
1203
+     * @param string The message
1204
+     *
1205
+     * @access protected
1206
+     * @return void
1207
+     *
1208
+     * @author Michael Klapper <[email protected]>
1209
+     */
1210
+    protected function addWarningMessage($message) {
1211
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1212
+    }
1213
+
1214
+    /**
1215
+     * Create selector box
1216
+     *
1217
+     * @param	array		$optArray Options key(value) => label pairs
1218
+     * @param	string		$name Selector box name
1219
+     * @param	string		$value Selector box value (array for multiple...)
1220
+     * @param	boolean		$multiple If set, will draw multiple box.
1221
+     *
1222
+     * @return	string		HTML select element
1223
+     */
1224
+    function selectorBox($optArray, $name, $value, $multiple)	{
1225 1225
 
1226
-		$options = array();
1227
-		foreach($optArray as $key => $val)	{
1228
-			$options[] = '
1226
+        $options = array();
1227
+        foreach($optArray as $key => $val)	{
1228
+            $options[] = '
1229 1229
 				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1230
-		}
1230
+        }
1231 1231
 
1232
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1232
+        $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1233 1233
 
1234
-		return $output;
1235
-	}
1234
+        return $output;
1235
+    }
1236 1236
 
1237
-	/**
1238
-	 * Activate hooks
1239
-	 *
1240
-	 * @return	void
1241
-	 */
1242
-	function runRefreshHooks() {
1243
-		$crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1244
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1245
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1246
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1247
-				if (is_object($hookObj)) {
1248
-					$hookObj->crawler_init($crawlerLib);
1249
-				}
1250
-			}
1251
-		}
1237
+    /**
1238
+     * Activate hooks
1239
+     *
1240
+     * @return	void
1241
+     */
1242
+    function runRefreshHooks() {
1243
+        $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1244
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1245
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1246
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1247
+                if (is_object($hookObj)) {
1248
+                    $hookObj->crawler_init($crawlerLib);
1249
+                }
1250
+            }
1251
+        }
1252 1252
 
1253
-	}
1253
+    }
1254 1254
 
1255
-	/**
1256
-	 * Returns the URL to the current module, including $_GET['id'].
1257
-	 *
1258
-	 * @param array $urlParameters optional parameters to add to the URL
1259
-	 * @return string
1260
-	 */
1261
-	protected function getModuleUrl(array $urlParameters = array()) {
1262
-	    if ($this->pObj->id) {
1263
-	        $urlParameters = array_merge($urlParameters, array(
1255
+    /**
1256
+     * Returns the URL to the current module, including $_GET['id'].
1257
+     *
1258
+     * @param array $urlParameters optional parameters to add to the URL
1259
+     * @return string
1260
+     */
1261
+    protected function getModuleUrl(array $urlParameters = array()) {
1262
+        if ($this->pObj->id) {
1263
+            $urlParameters = array_merge($urlParameters, array(
1264 1264
                 'id' => $this->pObj->id
1265 1265
             ));
1266
-	    }
1266
+        }
1267 1267
         return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters);
1268
-	}
1268
+    }
1269 1269
 }
1270 1270
 
1271 1271
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1272
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1272
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1273 1273
 }
1274 1274
\ No newline at end of file
Please login to merge, or discard this patch.
template/process/list.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 	<?php echo $this->getRefreshLink(); ?>
6 6
 	<?php echo $this->getEnableDisableLink(); ?>
7 7
 	<?php
8
-		// Check if ActiveProcess is reached
9
-		if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getActiveProcessCount()) < \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getMaxActiveProcessCount())) {
10
-			echo $this->getAddLink();
11
-		}
12
-	?>
8
+        // Check if ActiveProcess is reached
9
+        if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getActiveProcessCount()) < \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getMaxActiveProcessCount())) {
10
+            echo $this->getAddLink();
11
+        }
12
+    ?>
13 13
 	<?php echo $this->getModeLink(); ?>
14 14
 </div>
15 15
 
Please login to merge, or discard this patch.
ext_autoload.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler');
3 3
 return array(
4
-	'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
-	'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
-	'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
-	'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
-	'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
-	'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
-	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
-	'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
-	'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
-	'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
-	'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
-	'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
-	'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
-	'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
-	'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
-	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
-	'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
-	'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
-	'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
-	'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
4
+    'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
+    'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
+    'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
+    'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
+    'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
+    'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
+    'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
+    'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
+    'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
+    'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
+    'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
+    'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
+    'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
+    'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
+    'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
+    'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
+    'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
+    'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
+    'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
+    'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
24 24
 );
Please login to merge, or discard this patch.
cli/crawler_multiprocess.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 if (!defined('TYPO3_cliMode')) {
3
-	die('You cannot run this script directly!');
3
+    die('You cannot run this script directly!');
4 4
 }
5 5
 
6 6
 $processManager = new tx_crawler_domain_process_manager();
7 7
 $timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000;
8 8
 
9 9
 try {
10
-	$processManager->multiProcess($timeout);
10
+    $processManager->multiProcess($timeout);
11 11
 } catch (Exception $e) {
12
-	echo PHP_EOL . $e->getMessage();
12
+    echo PHP_EOL . $e->getMessage();
13 13
 }
Please login to merge, or discard this patch.
cli/class.tx_crawler_cli.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,29 +37,29 @@
 block discarded – undo
37 37
  */
38 38
 class tx_crawler_cli extends \TYPO3\CMS\Core\Controller\CommandLineController {
39 39
 
40
-	/**
41
-	 * Constructor
42
-	 *
43
-	 * @return	void
44
-	 */
45
-	function __construct() {
46
-		parent::__construct();
40
+    /**
41
+     * Constructor
42
+     *
43
+     * @return	void
44
+     */
45
+    function __construct() {
46
+        parent::__construct();
47 47
 
48
-		$this->cli_options[] = array('-h', 'Show the help', '');
49
-		$this->cli_options[] = array('--help', 'Same as -h', '');
50
-		$this->cli_options[] = array('--countInARun count', 'Amount of pages', 'How many pages should be crawled during that run.');
51
-		$this->cli_options[] = array('--sleepTime milliseconds', 'Millisecounds to relax system during crawls', 'Amount of millisecounds which the system should use to relax between crawls.');
52
-		$this->cli_options[] = array('--sleepAfterFinish seconds', 'Secounds to relax system after all crawls.', 'Amount of secounds which the system should use to relax after all crawls are done.');
48
+        $this->cli_options[] = array('-h', 'Show the help', '');
49
+        $this->cli_options[] = array('--help', 'Same as -h', '');
50
+        $this->cli_options[] = array('--countInARun count', 'Amount of pages', 'How many pages should be crawled during that run.');
51
+        $this->cli_options[] = array('--sleepTime milliseconds', 'Millisecounds to relax system during crawls', 'Amount of millisecounds which the system should use to relax between crawls.');
52
+        $this->cli_options[] = array('--sleepAfterFinish seconds', 'Secounds to relax system after all crawls.', 'Amount of secounds which the system should use to relax after all crawls are done.');
53 53
 
54
-		// Setting help texts:
55
-		$this->cli_help['name'] = 'crawler CLI interface -- Crawling the URLs from the queue';
56
-		$this->cli_help['synopsis'] = '###OPTIONS###';
57
-		$this->cli_help['description'] = "";
58
-		$this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler\nWill trigger the crawler which starts to process the queue entires\n";
59
-		$this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2010';
60
-	}
54
+        // Setting help texts:
55
+        $this->cli_help['name'] = 'crawler CLI interface -- Crawling the URLs from the queue';
56
+        $this->cli_help['synopsis'] = '###OPTIONS###';
57
+        $this->cli_help['description'] = "";
58
+        $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler\nWill trigger the crawler which starts to process the queue entires\n";
59
+        $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2010';
60
+    }
61 61
 }
62 62
 
63 63
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']) {
64
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']);
64
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']);
65 65
 }
Please login to merge, or discard this patch.
cli/class.tx_crawler_cli_im.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -37,41 +37,41 @@
 block discarded – undo
37 37
  */
38 38
 class tx_crawler_cli_im extends \TYPO3\CMS\Core\Controller\CommandLineController {
39 39
 
40
-	/**
41
-	 * Constructor
42
-	 *
43
-	 * @return	void
44
-	 */
45
-	function __construct() {
46
-		parent::__construct();
40
+    /**
41
+     * Constructor
42
+     *
43
+     * @return	void
44
+     */
45
+    function __construct() {
46
+        parent::__construct();
47 47
 
48
-		// Adding options to help archive:
49
-		/**
50
-		* We removed the "proc" option as it seemd not to be working any more. But as the complete handling of the crawler has changed regarding the configuration
51
-		* this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs
52
-		* has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there).
53
-		* This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension.
54
-		*/
55
-		// $this->cli_options[] = array('-proc listOfProcInstr', 'Comma list of processing instructions. These are the "actions" carried out when crawling and you must specify at least one. Depends on third-party extensions. Examples are "tx_cachemgm_recache" from "cachemgm" extension (will recache pages), "tx_staticpub_publish" from "staticpub" (publishing pages to static files) or "tx_indexedsearch_reindex" from "indexed_search" (indexes pages).');
56
-		// TODO: cleanup here!
57
-		$this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include.");
58
-		$this->cli_options[] = array('-o mode', 'Output mode: "url", "exec", "queue"', "Specifies output modes\nurl : Will list URLs which wget could use as input.\nqueue: Will put entries in queue table.\nexec: Will execute all entries right away!");
59
-		$this->cli_options[] = array('-n number', 'Number of items per minute.', 'Specifies how many items are put in the queue per minute. Only valid for output mode "queue"');
60
-		$this->cli_options[] = array('-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations');
61
-		#		$this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n  0 = all output\n  1 = info and greater (default)\n  2 = warnings and greater\n  3 = errors");
48
+        // Adding options to help archive:
49
+        /**
50
+         * We removed the "proc" option as it seemd not to be working any more. But as the complete handling of the crawler has changed regarding the configuration
51
+         * this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs
52
+         * has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there).
53
+         * This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension.
54
+         */
55
+        // $this->cli_options[] = array('-proc listOfProcInstr', 'Comma list of processing instructions. These are the "actions" carried out when crawling and you must specify at least one. Depends on third-party extensions. Examples are "tx_cachemgm_recache" from "cachemgm" extension (will recache pages), "tx_staticpub_publish" from "staticpub" (publishing pages to static files) or "tx_indexedsearch_reindex" from "indexed_search" (indexes pages).');
56
+        // TODO: cleanup here!
57
+        $this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include.");
58
+        $this->cli_options[] = array('-o mode', 'Output mode: "url", "exec", "queue"', "Specifies output modes\nurl : Will list URLs which wget could use as input.\nqueue: Will put entries in queue table.\nexec: Will execute all entries right away!");
59
+        $this->cli_options[] = array('-n number', 'Number of items per minute.', 'Specifies how many items are put in the queue per minute. Only valid for output mode "queue"');
60
+        $this->cli_options[] = array('-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations');
61
+        #		$this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n  0 = all output\n  1 = info and greater (default)\n  2 = warnings and greater\n  3 = errors");
62 62
 
63
-		// Setting help texts:
64
-		$this->cli_help['name'] = 'crawler CLI interface -- Submitting URLs to be crawled via CLI interface.';
65
-		$this->cli_help['synopsis'] = 'page_id ###OPTIONS###';
66
-		$this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It can put entries in the queue from command line options, return the list of URLs and even execute all entries right away without having to queue them up - this can be useful for immediate re-cache, re-indexing or static publishing from command line.";
67
-		$this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_im 7 -d=2 -conf=<configurationKey> -o=exec\nWill re-cache pages from page 7 and two levels down, executed immediately.\n";
68
-		$this->cli_help['examples'].= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n";
69
-		$this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009';
70
-	}
63
+        // Setting help texts:
64
+        $this->cli_help['name'] = 'crawler CLI interface -- Submitting URLs to be crawled via CLI interface.';
65
+        $this->cli_help['synopsis'] = 'page_id ###OPTIONS###';
66
+        $this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It can put entries in the queue from command line options, return the list of URLs and even execute all entries right away without having to queue them up - this can be useful for immediate re-cache, re-indexing or static publishing from command line.";
67
+        $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_im 7 -d=2 -conf=<configurationKey> -o=exec\nWill re-cache pages from page 7 and two levels down, executed immediately.\n";
68
+        $this->cli_help['examples'].= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n";
69
+        $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009';
70
+    }
71 71
 }
72 72
 
73 73
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']) {
74
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']);
74
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']);
75 75
 }
76 76
 
77 77
 ?>
Please login to merge, or discard this patch.
cli/bootstrap.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@  discard block
 block discarded – undo
5 5
  * Retrieve path (taken from cli_dispatch.phpsh)
6 6
  */
7 7
 
8
-	// Get path to this script
8
+    // Get path to this script
9 9
 $tempPathThisScript = isset($_SERVER['argv'][0]) ? $_SERVER['argv'][0] : (isset($_ENV['_']) ? $_ENV['_'] : $_SERVER['_']);
10 10
 
11
-	// Resolve path
11
+    // Resolve path
12 12
 if (!isAbsPath($tempPathThisScript)) {
13
-	$workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd();
14
-	if ($workingDirectory) {
15
-		$tempPathThisScript = $workingDirectory . '/' . preg_replace('/\.\//', '', $tempPathThisScript);
16
-		if (!@is_file($tempPathThisScript)) {
17
-			die('Relative path found, but an error occured during resolving of the absolute path: ' . $tempPathThisScript . PHP_EOL);
18
-		}
19
-	} else {
20
-		die('Relative path found, but resolving absolute path is not supported on this platform.' . PHP_EOL);
21
-	}
13
+    $workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd();
14
+    if ($workingDirectory) {
15
+        $tempPathThisScript = $workingDirectory . '/' . preg_replace('/\.\//', '', $tempPathThisScript);
16
+        if (!@is_file($tempPathThisScript)) {
17
+            die('Relative path found, but an error occured during resolving of the absolute path: ' . $tempPathThisScript . PHP_EOL);
18
+        }
19
+    } else {
20
+        die('Relative path found, but resolving absolute path is not supported on this platform.' . PHP_EOL);
21
+    }
22 22
 }
23 23
 
24 24
 $typo3Root = preg_replace('#typo3conf/ext/crawler/cli/bootstrap.php$#', '', $tempPathThisScript);
@@ -30,33 +30,33 @@  discard block
 block discarded – undo
30 30
  */
31 31
 $additionalHeaders = unserialize(base64_decode($_SERVER['argv'][3]));
32 32
 if (is_array($additionalHeaders)) {
33
-	foreach ($additionalHeaders as $additionalHeader) {
34
-		if (strpos($additionalHeader, ':') !== FALSE) {
35
-			list($key, $value) = explode(':', $additionalHeader, 2);
36
-			$key = str_replace('-', '_', strtoupper(trim($key)));
37
-			if ($key != 'HOST') {
38
-				$_SERVER['HTTP_' . $key] = $value;
39
-			}
40
-		}
41
-	}
33
+    foreach ($additionalHeaders as $additionalHeader) {
34
+        if (strpos($additionalHeader, ':') !== FALSE) {
35
+            list($key, $value) = explode(':', $additionalHeader, 2);
36
+            $key = str_replace('-', '_', strtoupper(trim($key)));
37
+            if ($key != 'HOST') {
38
+                $_SERVER['HTTP_' . $key] = $value;
39
+            }
40
+        }
41
+    }
42 42
 }
43 43
 
44 44
 
45
-	// put parsed query parts into $_GET array
45
+    // put parsed query parts into $_GET array
46 46
 $urlParts = parse_url($_SERVER['argv'][2]);
47
-	// Populating $_GET
47
+    // Populating $_GET
48 48
 parse_str($urlParts['query'], $_GET);
49
-	// Populating $_REQUEST
49
+    // Populating $_REQUEST
50 50
 parse_str($urlParts['query'], $_REQUEST);
51
-	// Populating $_POST
51
+    // Populating $_POST
52 52
 $_POST = array();
53
-	// Populating $_COOKIE
53
+    // Populating $_COOKIE
54 54
 $_COOKIE = array();
55 55
 
56
-	// Get the TYPO3_SITE_PATH of the website frontend:
56
+    // Get the TYPO3_SITE_PATH of the website frontend:
57 57
 $typo3SitePath = $_SERVER['argv'][1];
58 58
 
59
-	// faking the environment
59
+    // faking the environment
60 60
 $_SERVER['DOCUMENT_ROOT'] = preg_replace('#' . preg_quote($typo3SitePath, '#') . '$#', '', $typo3Root);
61 61
 $_SERVER['HTTP_USER_AGENT'] = 'CLI Mode';
62 62
 $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $urlParts['host'];
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
 $_SERVER['REQUEST_URI'] = $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : '');
67 67
 $_SERVER['REQUEST_METHOD'] = 'GET';
68 68
 
69
-	// Define a port if used in the URL:
69
+    // Define a port if used in the URL:
70 70
 if (isset($urlParts['port'])) {
71
-	$_SERVER['HTTP_HOST'] .= ':' . $urlParts['port'];
72
-	$_SERVER['SERVER_PORT'] = $urlParts['port'];
71
+    $_SERVER['HTTP_HOST'] .= ':' . $urlParts['port'];
72
+    $_SERVER['SERVER_PORT'] = $urlParts['port'];
73 73
 }
74 74
 
75
-	// Define HTTPS disposal:
75
+    // Define HTTPS disposal:
76 76
 if ($urlParts['scheme'] === 'https') {
77
-	$_SERVER['HTTPS'] = 'on';
77
+    $_SERVER['HTTPS'] = 'on';
78 78
 }
79 79
 
80 80
 chdir($typo3Root);
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
  * @return boolean
89 89
  */
90 90
 function isAbsPath($path) {
91
-		// on Windows also a path starting with a drive letter is absolute: X:/
92
-	if (stristr(PHP_OS, 'win') && substr($path, 1, 2) === ':/') {
93
-		return TRUE;
94
-	}
91
+        // on Windows also a path starting with a drive letter is absolute: X:/
92
+    if (stristr(PHP_OS, 'win') && substr($path, 1, 2) === ':/') {
93
+        return TRUE;
94
+    }
95 95
 
96
-		// path starting with a / is always absolute, on every system
97
-	return (substr($path, 0, 1) === '/');
96
+        // path starting with a / is always absolute, on every system
97
+    return (substr($path, 0, 1) === '/');
98 98
 }
Please login to merge, or discard this patch.
cli/class.tx_crawler_cli_flush.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,30 +37,30 @@
 block discarded – undo
37 37
  */
38 38
 class tx_crawler_cli_flush extends \TYPO3\CMS\Core\Controller\CommandLineController {
39 39
 
40
-	/**
41
-	 * Constructor
42
-	 *
43
-	 * @return	void
44
-	 */
45
-	function __construct() {
46
-		parent::__construct();
40
+    /**
41
+     * Constructor
42
+     *
43
+     * @return	void
44
+     */
45
+    function __construct() {
46
+        parent::__construct();
47 47
 
48
-			// Adding options to help archive:
49
-		$this->cli_options[] = array('-o mode', 'Output mode: "finished", "all", "pending"', "Specifies the type queue entries which is flushed in the process.");
50
-		#		$this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n  0 = all output\n  1 = info and greater (default)\n  2 = warnings and greater\n  3 = errors");
48
+            // Adding options to help archive:
49
+        $this->cli_options[] = array('-o mode', 'Output mode: "finished", "all", "pending"', "Specifies the type queue entries which is flushed in the process.");
50
+        #		$this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n  0 = all output\n  1 = info and greater (default)\n  2 = warnings and greater\n  3 = errors");
51 51
 
52
-			// Setting help texts:
53
-		$this->cli_help['name'] = 'crawler CLI interface -- Cleaning up the queue.';
54
-		$this->cli_help['synopsis'] = 'page_id ###OPTIONS###';
55
-		$this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It will remove queue entires and perform a cleanup.";
56
-		$this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_flush 5 -o=finished\nWill remove all finished queue-entries in the sub-branch of page 5\n";
57
-		$this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_flush 0 -o=all\nWill remove all queue-entries for every page\n";
58
-		$this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009';
59
-	}
52
+            // Setting help texts:
53
+        $this->cli_help['name'] = 'crawler CLI interface -- Cleaning up the queue.';
54
+        $this->cli_help['synopsis'] = 'page_id ###OPTIONS###';
55
+        $this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It will remove queue entires and perform a cleanup.";
56
+        $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_flush 5 -o=finished\nWill remove all finished queue-entries in the sub-branch of page 5\n";
57
+        $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_flush 0 -o=all\nWill remove all queue-entries for every page\n";
58
+        $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009';
59
+    }
60 60
 }
61 61
 
62 62
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_flush.php']) {
63
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_flush.php']);
63
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_flush.php']);
64 64
 }
65 65
 
66 66
 ?>
Please login to merge, or discard this patch.
class.tx_crawler_lib.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
         return time();
1150 1150
     }
1151 1151
 
1152
-     /************************************
1152
+        /************************************
1153 1153
      *
1154 1154
      * URL reading
1155 1155
      *
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
             return FALSE;
1317 1317
         }
1318 1318
 
1319
- 	    // direct request
1319
+            // direct request
1320 1320
         if ($this->extensionSettings['makeDirectRequests']) {
1321 1321
             $result = $this->sendDirectRequest($originalUrl, $crawlerId);
1322 1322
             return $result;
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
      *
2329 2329
      * @return void
2330 2330
      */
2331
-     public function CLI_deleteProcessesMarkedDeleted() {
2331
+        public function CLI_deleteProcessesMarkedDeleted() {
2332 2332
         $this->db->exec_DELETEquery('tx_crawler_process', 'deleted = 1');
2333 2333
     }
2334 2334
 
Please login to merge, or discard this patch.