Completed
Push — issue/103 ( 39a4ee )
by Tomas Norre
12:28
created
domain/process/class.tx_crawler_domain_process.php 1 patch
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -24,145 +24,145 @@
 block discarded – undo
24 24
 
25 25
 class tx_crawler_domain_process extends tx_crawler_domain_lib_abstract_dbobject {
26 26
 
27
-	CONST STATE_RUNNING = 'running';
28
-	CONST STATE_CANCELLED = 'cancelled';
29
-	CONST STATE_COMPLETED = 'completed';
30
-
31
-	/**
32
-	 * @var string table name
33
-	 */
34
-	protected static $tableName = 'tx_crawler_process';
35
-
36
-	/**
37
-	 * Returns the activity state for this process
38
-	 *
39
-	 * @param void
40
-	 * @return boolean
41
-	 */
42
-	public function getActive() {
43
-		return $this->row['active'];
44
-	}
45
-
46
-	/**
47
-	 * Returns the identifier for the process
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getProcess_id() {
52
-		return $this->row['process_id'];
53
-	}
54
-
55
-	/**
56
-	 * Returns the timestamp of the exectime for the first relevant queue item.
57
-	 * This can be used to determine the runtime
58
-	 *
59
-	 * @return int
60
-	 */
61
-	public function getTimeForFirstItem() {
62
-		$queueRepository = new tx_crawler_domain_queue_repository();
63
-		$entry = $queueRepository->findYoungestEntryForProcess($this);
64
-
65
-		return $entry->getExecutionTime();
66
-	}
67
-
68
-	/**
69
-	 * Returns the timestamp of the exectime for the last relevant queue item.
70
-	 * This can be used to determine the runtime
71
-	 *
72
-	 * @return int
73
-	 */
74
-	public function getTimeForLastItem() {
75
-		$queueRepository = new tx_crawler_domain_queue_repository();
76
-		$entry = $queueRepository->findOldestEntryForProcess($this);
77
-
78
-		return $entry->getExecutionTime();
79
-	}
80
-
81
-	/**
82
-	 * Returns the difference between first and last processed item
83
-	 *
84
-	 * @return int
85
-	 */
86
-	public function getRuntime() {
87
-		return $this->getTimeForLastItem() - $this->getTimeForFirstItem();
88
-	}
89
-
90
-	/**
91
-	 * Returns the ttl of the process
92
-	 *
93
-	 * @return int
94
-	 */
95
-	public function getTTL() {
96
-		return $this->row['ttl'];
97
-	}
98
-
99
-	/**
100
-	 * Counts the number of items which need to be processed
101
-	 *
102
-	 * @author Timo Schmidt <[email protected]>
103
-	 * @param void
104
-	 * @return int
105
-	 */
106
-	public function countItemsProcessed() {
107
-		$queueRepository = new tx_crawler_domain_queue_repository();
108
-		return $queueRepository->countExecutedItemsByProcess($this);
109
-	}
110
-
111
-	/**
112
-	 * Counts the number of items which still need to be processed
113
-	 *
114
-	 * @author Timo Schmidt <[email protected]>
115
-	 * @param void
116
-	 * @return int
117
-	 */
118
-	public function countItemsToProcess() {
119
-		$queueRepository = new tx_crawler_domain_queue_repository();
120
-		return $queueRepository->countNonExecutedItemsByProcess($this);
121
-	}
122
-
123
-	/**
124
-	 * Returns the Progress of a crawling process as a percentage value
125
-	 *
126
-	 * @param void
127
-	 * @return float
128
-	 */
129
-	public function getProgress() {
130
-		$all = $this->countItemsAssigned();
131
-		if ($all<=0) {
132
-			return 0;
133
-		}
134
-
135
-		$res = round((100 / $all) * $this->countItemsProcessed());
136
-
137
-		if ($res > 100.0) {
138
-			return 100.0;
139
-		}
140
-		return $res;
141
-	}
142
-
143
-	/**
144
-	 * Returns the number of assigned Entrys
145
-	 *
146
-	 * @return int
147
-	 */
148
-	public function countItemsAssigned() {
149
-		return $this->row['assigned_items_count'];
150
-	}
151
-
152
-	/**
153
-	 * Return the processes current state
154
-	 *
155
-	 * @param void
156
-	 * @return string 'running'|'cancelled'|'completed'
157
-	 */
158
-	public function getState() {
159
-		if ($this->getActive() && $this->getProgress() < 100) {
160
-			$stage = tx_crawler_domain_process::STATE_RUNNING;
161
-		} elseif (!$this->getActive() && $this->getProgress() < 100) {
162
-			$stage = tx_crawler_domain_process::STATE_CANCELLED;
163
-		} else {
164
-			$stage = tx_crawler_domain_process::STATE_COMPLETED;
165
-		}
166
-		return $stage;
167
-	}
27
+    CONST STATE_RUNNING = 'running';
28
+    CONST STATE_CANCELLED = 'cancelled';
29
+    CONST STATE_COMPLETED = 'completed';
30
+
31
+    /**
32
+     * @var string table name
33
+     */
34
+    protected static $tableName = 'tx_crawler_process';
35
+
36
+    /**
37
+     * Returns the activity state for this process
38
+     *
39
+     * @param void
40
+     * @return boolean
41
+     */
42
+    public function getActive() {
43
+        return $this->row['active'];
44
+    }
45
+
46
+    /**
47
+     * Returns the identifier for the process
48
+     *
49
+     * @return string
50
+     */
51
+    public function getProcess_id() {
52
+        return $this->row['process_id'];
53
+    }
54
+
55
+    /**
56
+     * Returns the timestamp of the exectime for the first relevant queue item.
57
+     * This can be used to determine the runtime
58
+     *
59
+     * @return int
60
+     */
61
+    public function getTimeForFirstItem() {
62
+        $queueRepository = new tx_crawler_domain_queue_repository();
63
+        $entry = $queueRepository->findYoungestEntryForProcess($this);
64
+
65
+        return $entry->getExecutionTime();
66
+    }
67
+
68
+    /**
69
+     * Returns the timestamp of the exectime for the last relevant queue item.
70
+     * This can be used to determine the runtime
71
+     *
72
+     * @return int
73
+     */
74
+    public function getTimeForLastItem() {
75
+        $queueRepository = new tx_crawler_domain_queue_repository();
76
+        $entry = $queueRepository->findOldestEntryForProcess($this);
77
+
78
+        return $entry->getExecutionTime();
79
+    }
80
+
81
+    /**
82
+     * Returns the difference between first and last processed item
83
+     *
84
+     * @return int
85
+     */
86
+    public function getRuntime() {
87
+        return $this->getTimeForLastItem() - $this->getTimeForFirstItem();
88
+    }
89
+
90
+    /**
91
+     * Returns the ttl of the process
92
+     *
93
+     * @return int
94
+     */
95
+    public function getTTL() {
96
+        return $this->row['ttl'];
97
+    }
98
+
99
+    /**
100
+     * Counts the number of items which need to be processed
101
+     *
102
+     * @author Timo Schmidt <[email protected]>
103
+     * @param void
104
+     * @return int
105
+     */
106
+    public function countItemsProcessed() {
107
+        $queueRepository = new tx_crawler_domain_queue_repository();
108
+        return $queueRepository->countExecutedItemsByProcess($this);
109
+    }
110
+
111
+    /**
112
+     * Counts the number of items which still need to be processed
113
+     *
114
+     * @author Timo Schmidt <[email protected]>
115
+     * @param void
116
+     * @return int
117
+     */
118
+    public function countItemsToProcess() {
119
+        $queueRepository = new tx_crawler_domain_queue_repository();
120
+        return $queueRepository->countNonExecutedItemsByProcess($this);
121
+    }
122
+
123
+    /**
124
+     * Returns the Progress of a crawling process as a percentage value
125
+     *
126
+     * @param void
127
+     * @return float
128
+     */
129
+    public function getProgress() {
130
+        $all = $this->countItemsAssigned();
131
+        if ($all<=0) {
132
+            return 0;
133
+        }
134
+
135
+        $res = round((100 / $all) * $this->countItemsProcessed());
136
+
137
+        if ($res > 100.0) {
138
+            return 100.0;
139
+        }
140
+        return $res;
141
+    }
142
+
143
+    /**
144
+     * Returns the number of assigned Entrys
145
+     *
146
+     * @return int
147
+     */
148
+    public function countItemsAssigned() {
149
+        return $this->row['assigned_items_count'];
150
+    }
151
+
152
+    /**
153
+     * Return the processes current state
154
+     *
155
+     * @param void
156
+     * @return string 'running'|'cancelled'|'completed'
157
+     */
158
+    public function getState() {
159
+        if ($this->getActive() && $this->getProgress() < 100) {
160
+            $stage = tx_crawler_domain_process::STATE_RUNNING;
161
+        } elseif (!$this->getActive() && $this->getProgress() < 100) {
162
+            $stage = tx_crawler_domain_process::STATE_CANCELLED;
163
+        } else {
164
+            $stage = tx_crawler_domain_process::STATE_COMPLETED;
165
+        }
166
+        return $stage;
167
+    }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
domain/process/class.tx_crawler_domain_process_collection.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -41,62 +41,62 @@
 block discarded – undo
41 41
  */
42 42
 class tx_crawler_domain_process_collection extends ArrayObject {
43 43
 
44
-	/**
45
-	 * Method to retrieve an element from the collection.
46
-	 * @access public
47
- 	 * @throws Exception
48
-	 * @return tx_crawler_domain_process
49
-	 */
50
-	public function offsetGet($index) {
51
-		if (! parent::offsetExists($index)) {
52
-			throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
53
-		}
54
-		return parent::offsetGet($index);
55
-	}
44
+    /**
45
+     * Method to retrieve an element from the collection.
46
+     * @access public
47
+     * @throws Exception
48
+     * @return tx_crawler_domain_process
49
+     */
50
+    public function offsetGet($index) {
51
+        if (! parent::offsetExists($index)) {
52
+            throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
53
+        }
54
+        return parent::offsetGet($index);
55
+    }
56 56
 
57
-	/**
58
-	 * Method to add an element to the collection-
59
-	 *
60
-	 * @param mixed $index
61
-	 * @param tx_crawler_domain_process $subject
62
-	 * @throws InvalidArgumentException
63
-	 * @return void
64
-	 */
65
-	public function offsetSet($index, $subject) {
66
-		if (! $subject instanceof tx_crawler_domain_process ) {
67
-			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68
-		}
69
-		parent::offsetSet($index, $subject);
70
-	}
57
+    /**
58
+     * Method to add an element to the collection-
59
+     *
60
+     * @param mixed $index
61
+     * @param tx_crawler_domain_process $subject
62
+     * @throws InvalidArgumentException
63
+     * @return void
64
+     */
65
+    public function offsetSet($index, $subject) {
66
+        if (! $subject instanceof tx_crawler_domain_process ) {
67
+            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68
+        }
69
+        parent::offsetSet($index, $subject);
70
+    }
71 71
 
72
-	/**
73
-	 * Method to append an element to the collection
74
-	 * @param tx_crawler_domain_process $subject
75
-	 * @throws InvalidArgumentException
76
-	 * @return void
77
-	 */
78
-	public function append($subject) {
79
-		if (! $subject instanceof tx_crawler_domain_process ) {
80
-			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81
-		}
82
-		parent::append($subject);
83
-	}
72
+    /**
73
+     * Method to append an element to the collection
74
+     * @param tx_crawler_domain_process $subject
75
+     * @throws InvalidArgumentException
76
+     * @return void
77
+     */
78
+    public function append($subject) {
79
+        if (! $subject instanceof tx_crawler_domain_process ) {
80
+            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81
+        }
82
+        parent::append($subject);
83
+    }
84 84
 	
85
-	/**
86
-	 * returns array of process ids of the current collection
87
-	 * @return array
88
-	 */
89
-	public function getProcessIds() {
90
-		$result=array();
91
-		foreach ($this->getIterator() as $value) {
92
-			$result[]=$value->getProcess_id();
93
-		}
94
-		return $result;
95
-	}
85
+    /**
86
+     * returns array of process ids of the current collection
87
+     * @return array
88
+     */
89
+    public function getProcessIds() {
90
+        $result=array();
91
+        foreach ($this->getIterator() as $value) {
92
+            $result[]=$value->getProcess_id();
93
+        }
94
+        return $result;
95
+    }
96 96
 }
97 97
 
98 98
 
99 99
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']) {
100
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']);
100
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']);
101 101
 }
102 102
 ?>
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
domain/events/interface.tx_crawler_domain_events_observer.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 
25 25
 interface tx_crawler_domain_events_observer {
26 26
 
27
-	/**
28
-	 * This method should be implemented by the observer to register events
29
-	 * that should be forwarded to the observer
30
-	 *
31
-	 * @param tx_crawler_domain_events_dispatcher $dispatcher
32
-	 * @return boolean
33
-	 */
34
-	public function registerObservers(tx_crawler_domain_events_dispatcher $dispatcher);
27
+    /**
28
+     * This method should be implemented by the observer to register events
29
+     * that should be forwarded to the observer
30
+     *
31
+     * @param tx_crawler_domain_events_dispatcher $dispatcher
32
+     * @return boolean
33
+     */
34
+    public function registerObservers(tx_crawler_domain_events_dispatcher $dispatcher);
35 35
 }
36 36
 
37 37
 ?>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
domain/events/class.tx_crawler_domain_events_dispatcher.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -52,32 +52,32 @@  discard block
 block discarded – undo
52 52
  */
53 53
 class tx_crawler_domain_events_dispatcher {
54 54
 
55
-	/**
56
-	 * @var array of tx_crawler_domain_events_observer objects;
57
-	 */
58
-	protected $observers;
55
+    /**
56
+     * @var array of tx_crawler_domain_events_observer objects;
57
+     */
58
+    protected $observers;
59 59
 
60
-	/**
61
-	 * @var tx_crawler_domain_events_dispatcher
62
-	 */
63
-	protected static $instance;
60
+    /**
61
+     * @var tx_crawler_domain_events_dispatcher
62
+     */
63
+    protected static $instance;
64 64
 
65
-	/**
66
-	 * The __constructor is private because the dispatcher is a singleton
67
-	 *
68
-	 * @param void
69
-	 * @return void
70
-	 */
65
+    /**
66
+     * The __constructor is private because the dispatcher is a singleton
67
+     *
68
+     * @param void
69
+     * @return void
70
+     */
71 71
     protected function __construct() {
72
-    	$this->observers = array();
73
-    	if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76
-				if (method_exists($hookObj, 'registerObservers')) {
77
-					$hookObj->registerObservers($this);
78
-				}
79
-			}
80
-		}
72
+        $this->observers = array();
73
+        if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76
+                if (method_exists($hookObj, 'registerObservers')) {
77
+                    $hookObj->registerObservers($this);
78
+                }
79
+            }
80
+        }
81 81
     }
82 82
 
83 83
     /**
@@ -86,62 +86,62 @@  discard block
 block discarded – undo
86 86
      * @param void
87 87
      * @return array array with registered events.
88 88
      */
89
-	protected function getEvents() {
90
-		return array_keys($this->observers);
91
-	}
89
+    protected function getEvents() {
90
+        return array_keys($this->observers);
91
+    }
92 92
 
93
-	/**
94
-	 * This method can be used to add an observer for an event to the dispatcher
95
-	 *
96
-	 * @param tx_crawler_domain_events_observer $observer_object
97
-	 * @param string $observer_method
98
-	 * @param string $event
99
-	 * @return void
100
-	 */
101
-	public function addObserver(tx_crawler_domain_events_observer $observer_object, $observer_method, $event) {
102
-		$this->observers[$event][] = array('object' => $observer_object, 'method' => $observer_method);
103
-	}
93
+    /**
94
+     * This method can be used to add an observer for an event to the dispatcher
95
+     *
96
+     * @param tx_crawler_domain_events_observer $observer_object
97
+     * @param string $observer_method
98
+     * @param string $event
99
+     * @return void
100
+     */
101
+    public function addObserver(tx_crawler_domain_events_observer $observer_object, $observer_method, $event) {
102
+        $this->observers[$event][] = array('object' => $observer_object, 'method' => $observer_method);
103
+    }
104 104
 
105
-	/**
106
-	 * Enables checking whether a certain event is observed by anyone
107
-	 *
108
-	 * @param string $event
109
-	 * @return boolean
110
-	 */
111
-	public function hasObserver($event) {
112
-		return count($this->observers[$event]) > 0;
113
-	}
105
+    /**
106
+     * Enables checking whether a certain event is observed by anyone
107
+     *
108
+     * @param string $event
109
+     * @return boolean
110
+     */
111
+    public function hasObserver($event) {
112
+        return count($this->observers[$event]) > 0;
113
+    }
114 114
 
115
-	/**
116
-	 * This method should be used to post a event to the dispatcher. Each
117
-	 * registered observer will be notified about the event.
118
-	 *
119
-	 * @param string $event
120
-	 * @param string $group
121
-	 * @param mixed $attachedData
122
-	 * @return void
123
-	 */
124
-	public function post($event, $group, $attachedData) {
125
-		if(is_array($this->observers[$event])) {
126
-			foreach($this->observers[$event] as $eventObserver) {
127
-				call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
128
-			}
129
-		}
130
-	}
115
+    /**
116
+     * This method should be used to post a event to the dispatcher. Each
117
+     * registered observer will be notified about the event.
118
+     *
119
+     * @param string $event
120
+     * @param string $group
121
+     * @param mixed $attachedData
122
+     * @return void
123
+     */
124
+    public function post($event, $group, $attachedData) {
125
+        if(is_array($this->observers[$event])) {
126
+            foreach($this->observers[$event] as $eventObserver) {
127
+                call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
128
+            }
129
+        }
130
+    }
131 131
 
132
-	/**
133
-	 * Returns the instance of the dispatcher singleton
134
-	 *
135
-	 * @param void
136
-	 * @return tx_crawler_domain_events_dispatcher
137
-	 */
138
-	public static function getInstance() {
132
+    /**
133
+     * Returns the instance of the dispatcher singleton
134
+     *
135
+     * @param void
136
+     * @return tx_crawler_domain_events_dispatcher
137
+     */
138
+    public static function getInstance() {
139 139
 
140
-		if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141
-			$dispatcher = new tx_crawler_domain_events_dispatcher();
142
-			self::$instance = $dispatcher;
143
-		}
140
+        if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141
+            $dispatcher = new tx_crawler_domain_events_dispatcher();
142
+            self::$instance = $dispatcher;
143
+        }
144 144
 
145
-		return self::$instance;
146
-	}
145
+        return self::$instance;
146
+    }
147 147
 }
Please login to merge, or discard this patch.
view/class.tx_crawler_view_pagination.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -24,121 +24,121 @@
 block discarded – undo
24 24
 
25 25
 class tx_crawler_view_pagination {
26 26
 
27
-	/**
28
-	 * @var string template path
29
-	 */
30
-	protected $template = 'EXT:crawler/template/pagination.php';
31
-
32
-	/**
33
-	 * @var int $perpage number of items perPage
34
-	 */
35
-	protected $perPage;
36
-
37
-	/**
38
-	 * @var int $currentOffset current offset
39
-	 */
40
-	protected $currentOffset;
41
-
42
-	/**
43
-	 * @var int $totalItemCount number of total item
44
-	 */
45
-	protected $totalItemCount;
46
-
47
-	/**
48
-	 * @var string $baseUrl
49
-	 */
50
-	protected $baseUrl;
51
-
52
-
53
-
54
-
55
-	/**
56
-	 * Method to render the view.
57
-	 *
58
-	 * @return string html content
59
-	 */
60
-	public function render() {
61
-		ob_start();
62
-		$this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
63
-		include($this->template);
64
-		$content = ob_get_contents();
65
-		ob_end_clean();
66
-
67
-		return $content;
68
-	}
69
-
70
-	/**
71
-	 * Returns the currently configured offset-
72
-	 * @return int
73
-	 */
74
-	public function getCurrentOffset() {
75
-		return $this->currentOffset;
76
-	}
77
-
78
-	/**
79
-	 * Method to read the number of items per page
80
-	 *
81
-	 * @return int
82
-	 */
83
-	public function getPerPage() {
84
-		return $this->perPage;
85
-	}
86
-
87
-	/**
88
-	 * Method to set the current offset from start
89
-	 *
90
-	 * @param int $currentOffset
91
-	 */
92
-	public function setCurrentOffset($currentOffset) {
93
-		$this->currentOffset = $currentOffset;
94
-	}
95
-
96
-	/**
97
-	 * Number of items per page.
98
-	 *
99
-	 * @param int $perPage
100
-	 */
101
-	public function setPerPage($perPage) {
102
-		$this->perPage = $perPage;
103
-	}
104
-
105
-	/**
106
-	 * returns the total number of items
107
-	 * @return int
108
-	 */
109
-	public function getTotalItemCount() {
110
-		return $this->totalItemCount;
111
-	}
112
-
113
-	/**
114
-	 * Method to set the total number of items in the pagination
115
-	 *
116
-	 * @param int $totalItemCount
117
-	 */
118
-	public function setTotalItemCount($totalItemCount) {
119
-		$this->totalItemCount = $totalItemCount;
120
-	}
121
-
122
-	/**
123
-	 * Returns the total number of pages needed to  display all content which
124
-	 * is paginatable
125
-	 *
126
-	 * @return double
127
-	 */
128
-	public function getTotalPagesCount() {
129
-	 	return ceil($this->getTotalItemCount() / $this->getPerPage());
130
-	}
131
-
132
-	/**
133
-	 * This method is used to caluclate the label for a pageoffset,
134
-	 * in normal cases its the internal offset + 1
135
-	 *
136
-	 * @param int $pageoffset
137
-	 * @return int
138
-	 */
139
-	protected function getLabelForPageOffset($pageoffset) {
140
-		return $pageoffset + 1;
141
-	}
27
+    /**
28
+     * @var string template path
29
+     */
30
+    protected $template = 'EXT:crawler/template/pagination.php';
31
+
32
+    /**
33
+     * @var int $perpage number of items perPage
34
+     */
35
+    protected $perPage;
36
+
37
+    /**
38
+     * @var int $currentOffset current offset
39
+     */
40
+    protected $currentOffset;
41
+
42
+    /**
43
+     * @var int $totalItemCount number of total item
44
+     */
45
+    protected $totalItemCount;
46
+
47
+    /**
48
+     * @var string $baseUrl
49
+     */
50
+    protected $baseUrl;
51
+
52
+
53
+
54
+
55
+    /**
56
+     * Method to render the view.
57
+     *
58
+     * @return string html content
59
+     */
60
+    public function render() {
61
+        ob_start();
62
+        $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
63
+        include($this->template);
64
+        $content = ob_get_contents();
65
+        ob_end_clean();
66
+
67
+        return $content;
68
+    }
69
+
70
+    /**
71
+     * Returns the currently configured offset-
72
+     * @return int
73
+     */
74
+    public function getCurrentOffset() {
75
+        return $this->currentOffset;
76
+    }
77
+
78
+    /**
79
+     * Method to read the number of items per page
80
+     *
81
+     * @return int
82
+     */
83
+    public function getPerPage() {
84
+        return $this->perPage;
85
+    }
86
+
87
+    /**
88
+     * Method to set the current offset from start
89
+     *
90
+     * @param int $currentOffset
91
+     */
92
+    public function setCurrentOffset($currentOffset) {
93
+        $this->currentOffset = $currentOffset;
94
+    }
95
+
96
+    /**
97
+     * Number of items per page.
98
+     *
99
+     * @param int $perPage
100
+     */
101
+    public function setPerPage($perPage) {
102
+        $this->perPage = $perPage;
103
+    }
104
+
105
+    /**
106
+     * returns the total number of items
107
+     * @return int
108
+     */
109
+    public function getTotalItemCount() {
110
+        return $this->totalItemCount;
111
+    }
112
+
113
+    /**
114
+     * Method to set the total number of items in the pagination
115
+     *
116
+     * @param int $totalItemCount
117
+     */
118
+    public function setTotalItemCount($totalItemCount) {
119
+        $this->totalItemCount = $totalItemCount;
120
+    }
121
+
122
+    /**
123
+     * Returns the total number of pages needed to  display all content which
124
+     * is paginatable
125
+     *
126
+     * @return double
127
+     */
128
+    public function getTotalPagesCount() {
129
+            return ceil($this->getTotalItemCount() / $this->getPerPage());
130
+    }
131
+
132
+    /**
133
+     * This method is used to caluclate the label for a pageoffset,
134
+     * in normal cases its the internal offset + 1
135
+     *
136
+     * @param int $pageoffset
137
+     * @return int
138
+     */
139
+    protected function getLabelForPageOffset($pageoffset) {
140
+        return $pageoffset + 1;
141
+    }
142 142
 
143 143
 }
144 144
 
Please login to merge, or discard this patch.
Configuration/TCA/Overrides/tx_crawler_configuration.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 
4 4
 // Compatibility with 6.2
5 5
 if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
6
-  $GLOBALS['TCA']['tx_crawler_configuration']['columns']['processing_instruction_filter']['config']['renderMode'] = 'checkbox';
6
+    $GLOBALS['TCA']['tx_crawler_configuration']['columns']['processing_instruction_filter']['config']['renderMode'] = 'checkbox';
7 7
 }
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_REQUESTTYPE')) {
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.
modfunc1/class.tx_crawler_modfunc1.php 1 patch
Indentation   +916 added lines, -916 removed lines patch added patch discarded remove patch
@@ -40,126 +40,126 @@  discard block
 block discarded – undo
40 40
  * @subpackage tx_crawler
41 41
  */
42 42
 class tx_crawler_modfunc1 extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
43
-		// Internal, dynamic:
44
-	var $duplicateTrack = array();
45
-	var $submitCrawlUrls = FALSE;
46
-	var $downloadCrawlUrls = FALSE;
43
+        // Internal, dynamic:
44
+    var $duplicateTrack = array();
45
+    var $submitCrawlUrls = FALSE;
46
+    var $downloadCrawlUrls = FALSE;
47 47
 
48
-	var $scheduledTime = 0;
49
-	var $reqMinute = 0;
48
+    var $scheduledTime = 0;
49
+    var $reqMinute = 0;
50 50
 
51
-	/**
52
-	 * @var array holds the selection of configuration from the configuration selector box
53
-	 */
54
-	var $incomingConfigurationSelection = array();
51
+    /**
52
+     * @var array holds the selection of configuration from the configuration selector box
53
+     */
54
+    var $incomingConfigurationSelection = array();
55 55
 
56
-	/**
57
-	 * @var tx_crawler_lib
58
-	 */
59
-	var $crawlerObj;
56
+    /**
57
+     * @var tx_crawler_lib
58
+     */
59
+    var $crawlerObj;
60 60
 
61
-	var $CSVaccu = array();
61
+    var $CSVaccu = array();
62 62
 
63
-	/**
64
-	 * If true the user requested a CSV export of the queue
65
-	 *
66
-	 * @var boolean
67
-	 */
68
-	var $CSVExport = FALSE;
69
-
70
-	var $downloadUrls = array();
63
+    /**
64
+     * If true the user requested a CSV export of the queue
65
+     *
66
+     * @var boolean
67
+     */
68
+    var $CSVExport = FALSE;
71 69
 
72
-	/**
73
-	 * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
74
-	 *
75
-	 * @var array
76
-	 */
77
-	protected $extensionSettings = array();
70
+    var $downloadUrls = array();
78 71
 
79
-	/**
80
-	 * Indicate that an flash message with an error is present.
81
-	 *
82
-	 * @var boolean
83
-	 */
84
-	protected $isErrorDetected = false;
85
-
86
-	/**
87
-	 * the constructor
88
-	 */
89
-	public function __construct() {
90
-		$this->processManager = new tx_crawler_domain_process_manager();
91
-	}
92
-
93
-	/**
94
-	 * Additions to the function menu array
95
-	 *
96
-	 * @return	array		Menu array
97
-	 */
98
-	function modMenu()	{
99
-		global $LANG;
100
-
101
-		return array (
102
-			'depth' => array(
103
-				0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
104
-				1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
105
-				2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
106
-				3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
107
-				4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
108
-				99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
109
-			),
110
-			'crawlaction' => array(
111
-				'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
112
-				'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
113
-				'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
114
-			),
115
-			'log_resultLog' => '',
116
-			'log_feVars' => '',
117
-			'processListMode' => '',
118
-			'log_display' => array(
119
-				'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
120
-				'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
121
-				'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
122
-			),
123
-			'itemsPerPage' => array(
124
-				'5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
125
-				'10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
126
-				'50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
127
-				'0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
128
-			)
129
-		);
130
-	}
72
+    /**
73
+     * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
74
+     *
75
+     * @var array
76
+     */
77
+    protected $extensionSettings = array();
131 78
 
132
-	/**
133
-	 * Load extension settings
134
-	 *
135
-	 * @param void
136
-	 * @return void
137
-	 */
138
-	protected function loadExtensionSettings() {
139
-		$this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
140
-	}
141
-
142
-	/**
143
-	 * Main function
144
-	 *
145
-	 * @return	string		HTML output
146
-	 */
147
-	function main() {
148
-		global $LANG, $BACK_PATH;
79
+    /**
80
+     * Indicate that an flash message with an error is present.
81
+     *
82
+     * @var boolean
83
+     */
84
+    protected $isErrorDetected = false;
85
+
86
+    /**
87
+     * the constructor
88
+     */
89
+    public function __construct() {
90
+        $this->processManager = new tx_crawler_domain_process_manager();
91
+    }
92
+
93
+    /**
94
+     * Additions to the function menu array
95
+     *
96
+     * @return	array		Menu array
97
+     */
98
+    function modMenu()	{
99
+        global $LANG;
100
+
101
+        return array (
102
+            'depth' => array(
103
+                0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
104
+                1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
105
+                2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
106
+                3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
107
+                4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
108
+                99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
109
+            ),
110
+            'crawlaction' => array(
111
+                'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
112
+                'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
113
+                'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
114
+            ),
115
+            'log_resultLog' => '',
116
+            'log_feVars' => '',
117
+            'processListMode' => '',
118
+            'log_display' => array(
119
+                'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
120
+                'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
121
+                'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
122
+            ),
123
+            'itemsPerPage' => array(
124
+                '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
125
+                '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
126
+                '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
127
+                '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
128
+            )
129
+        );
130
+    }
131
+
132
+    /**
133
+     * Load extension settings
134
+     *
135
+     * @param void
136
+     * @return void
137
+     */
138
+    protected function loadExtensionSettings() {
139
+        $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
140
+    }
141
+
142
+    /**
143
+     * Main function
144
+     *
145
+     * @return	string		HTML output
146
+     */
147
+    function main() {
148
+        global $LANG, $BACK_PATH;
149 149
 
150
-		$this->incLocalLang();
150
+        $this->incLocalLang();
151 151
 
152
-		$this->loadExtensionSettings();
153
-		if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
154
-			$this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
155
-		}
152
+        $this->loadExtensionSettings();
153
+        if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
154
+            $this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
155
+        }
156 156
 
157
-			// Set CSS styles specific for this document:
158
-		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
157
+            // Set CSS styles specific for this document:
158
+        $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
159 159
 			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
160 160
 		',$this->pObj->content);
161 161
 
162
-		$this->pObj->content .= '<style type="text/css"><!--
162
+        $this->pObj->content .= '<style type="text/css"><!--
163 163
 			table.url-table,
164 164
 			table.param-expanded,
165 165
 			table.crawlerlog {
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 		<link rel="stylesheet" type="text/css" href="'.$BACK_PATH.'../typo3conf/ext/crawler/template/res.css" />
178 178
 		';
179 179
 
180
-			// Type function menu:
181
-		$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
182
-			$this->pObj->id,
183
-			'SET[crawlaction]',
184
-			$this->pObj->MOD_SETTINGS['crawlaction'],
185
-			$this->pObj->MOD_MENU['crawlaction'],
186
-			'index.php'
187
-		);
180
+            // Type function menu:
181
+        $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
182
+            $this->pObj->id,
183
+            'SET[crawlaction]',
184
+            $this->pObj->MOD_SETTINGS['crawlaction'],
185
+            $this->pObj->MOD_MENU['crawlaction'],
186
+            'index.php'
187
+        );
188 188
 
189
-		/*
189
+        /*
190 190
 			// Showing depth-menu in certain cases:
191 191
 		if ($this->pObj->MOD_SETTINGS['crawlaction']!=='cli' && $this->pObj->MOD_SETTINGS['crawlaction']!== 'multiprocess' && ($this->pObj->MOD_SETTINGS['crawlaction']!=='log' || $this->pObj->id))	{
192 192
 			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
@@ -199,62 +199,62 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 		*/
201 201
 
202
-			// Additional menus for the log type:
203
-		if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
204
-			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
205
-				$this->pObj->id,
206
-				'SET[depth]',
207
-				$this->pObj->MOD_SETTINGS['depth'],
208
-				$this->pObj->MOD_MENU['depth'],
209
-				'index.php'
210
-			);
202
+            // Additional menus for the log type:
203
+        if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
204
+            $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
205
+                $this->pObj->id,
206
+                'SET[depth]',
207
+                $this->pObj->MOD_SETTINGS['depth'],
208
+                $this->pObj->MOD_MENU['depth'],
209
+                'index.php'
210
+            );
211
+
212
+            $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
213
+
214
+            $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
215
+
216
+            $h_func.= '<hr/>'.
217
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
218
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
219
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
220
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
221
+                    \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
222
+                        $this->pObj->id,
223
+                        'SET[itemsPerPage]',
224
+                        $this->pObj->MOD_SETTINGS['itemsPerPage'],
225
+                        $this->pObj->MOD_MENU['itemsPerPage'],
226
+                        'index.php'
227
+                    );
228
+        }
211 229
 
212
-			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
213
-
214
-			$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
215
-
216
-			$h_func.= '<hr/>'.
217
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
218
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
219
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
220
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
221
-					\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
222
-						$this->pObj->id,
223
-						'SET[itemsPerPage]',
224
-						$this->pObj->MOD_SETTINGS['itemsPerPage'],
225
-						$this->pObj->MOD_MENU['itemsPerPage'],
226
-						'index.php'
227
-					);
228
-		}
230
+        $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
229 231
 
230
-		$theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
231
-
232
-			// Branch based on type:
233
-		switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
234
-			case 'start':
235
-				if (empty($this->pObj->id)) {
236
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
237
-				} else {
238
-					$theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
239
-				}
240
-				break;
241
-			case 'log':
242
-				if (empty($this->pObj->id)) {
243
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
244
-				} else {
245
-					$theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
246
-				}
247
-				break;
248
-			case 'cli':
249
-				$theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
250
-				break;
251
-			case 'multiprocess':
252
-				$theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
253
-				break;
254
-		}
232
+            // Branch based on type:
233
+        switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
234
+            case 'start':
235
+                if (empty($this->pObj->id)) {
236
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
237
+                } else {
238
+                    $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
239
+                }
240
+                break;
241
+            case 'log':
242
+                if (empty($this->pObj->id)) {
243
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
244
+                } else {
245
+                    $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
246
+                }
247
+                break;
248
+            case 'cli':
249
+                $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
250
+                break;
251
+            case 'multiprocess':
252
+                $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
253
+                break;
254
+        }
255 255
 
256
-		return $theOutput;
257
-	}
256
+        return $theOutput;
257
+    }
258 258
 
259 259
 
260 260
 
@@ -267,176 +267,176 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 
270
-	/*******************************
270
+    /*******************************
271 271
 	 *
272 272
 	 * Generate URLs for crawling:
273 273
 	 *
274 274
 	 ******************************/
275 275
 
276
-	/**
277
-	 * Produces a table with overview of the URLs to be crawled for each page
278
-	 *
279
-	 * @return	string		HTML output
280
-	 */
281
-	function drawURLs()	{
282
-		global $BACK_PATH, $BE_USER;
283
-
284
-			// Init:
285
-		$this->duplicateTrack = array();
286
-		$this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
287
-		$this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
288
-		$this->makeCrawlerProcessableChecks();
289
-
290
-		switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
291
-			case 'midnight':
292
-				$this->scheduledTime = mktime(0,0,0);
293
-			break;
294
-			case '04:00':
295
-				$this->scheduledTime = mktime(0,0,0)+4*3600;
296
-			break;
297
-			case 'now':
298
-			default:
299
-				$this->scheduledTime = time();
300
-			break;
301
-		}
302
-		// $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
303
-		// TODO: check relevance
304
-		$this->reqMinute = 1000;
276
+    /**
277
+     * Produces a table with overview of the URLs to be crawled for each page
278
+     *
279
+     * @return	string		HTML output
280
+     */
281
+    function drawURLs()	{
282
+        global $BACK_PATH, $BE_USER;
283
+
284
+            // Init:
285
+        $this->duplicateTrack = array();
286
+        $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
287
+        $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
288
+        $this->makeCrawlerProcessableChecks();
289
+
290
+        switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
291
+            case 'midnight':
292
+                $this->scheduledTime = mktime(0,0,0);
293
+            break;
294
+            case '04:00':
295
+                $this->scheduledTime = mktime(0,0,0)+4*3600;
296
+            break;
297
+            case 'now':
298
+            default:
299
+                $this->scheduledTime = time();
300
+            break;
301
+        }
302
+        // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
303
+        // TODO: check relevance
304
+        $this->reqMinute = 1000;
305 305
 
306 306
 
307
-		$this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
308
-		$this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
307
+        $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
308
+        $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
309 309
 
310
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
311
-		$this->crawlerObj->setAccessMode('gui');
312
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
310
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
311
+        $this->crawlerObj->setAccessMode('gui');
312
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
313 313
 
314
-		if (empty($this->incomingConfigurationSelection)
315
-			|| (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
316
-			) {
317
-			$code= '
314
+        if (empty($this->incomingConfigurationSelection)
315
+            || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
316
+            ) {
317
+            $code= '
318 318
 			<tr>
319 319
 				<td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td>
320 320
 			</tr>';
321
-		} else {
322
-			if($this->submitCrawlUrls){
323
-				$reason = new tx_crawler_domain_reason();
324
-				$reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
321
+        } else {
322
+            if($this->submitCrawlUrls){
323
+                $reason = new tx_crawler_domain_reason();
324
+                $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
325
+
326
+                if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
327
+                $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
328
+
329
+                tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
330
+                                                                            $this->findCrawler()->setID,
331
+                                                                            array(	'reason' => $reason ));
332
+            }
333
+
334
+            $code = $this->crawlerObj->getPageTreeAndUrls(
335
+                $this->pObj->id,
336
+                $this->pObj->MOD_SETTINGS['depth'],
337
+                $this->scheduledTime,
338
+                $this->reqMinute,
339
+                $this->submitCrawlUrls,
340
+                $this->downloadCrawlUrls,
341
+                array(), // Do not filter any processing instructions
342
+                $this->incomingConfigurationSelection
343
+            );
325 344
 
326
-				if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
327
-				$reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
328 345
 
329
-				tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
330
-																			$this->findCrawler()->setID,
331
-																			array(	'reason' => $reason ));
332
-			}
333
-
334
-			$code = $this->crawlerObj->getPageTreeAndUrls(
335
-				$this->pObj->id,
336
-				$this->pObj->MOD_SETTINGS['depth'],
337
-				$this->scheduledTime,
338
-				$this->reqMinute,
339
-				$this->submitCrawlUrls,
340
-				$this->downloadCrawlUrls,
341
-				array(), // Do not filter any processing instructions
342
-				$this->incomingConfigurationSelection
343
-			);
344
-
345
-
346
-		}
346
+        }
347 347
 
348
-		$this->downloadUrls = $this->crawlerObj->downloadUrls;
349
-		$this->duplicateTrack = $this->crawlerObj->duplicateTrack;
348
+        $this->downloadUrls = $this->crawlerObj->downloadUrls;
349
+        $this->duplicateTrack = $this->crawlerObj->duplicateTrack;
350 350
 
351
-		$output = '';
352
-		if ($code)	{
351
+        $output = '';
352
+        if ($code)	{
353 353
 
354
-			$output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
355
-			$output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
354
+            $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
355
+            $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
356 356
 
357
-			if (!$this->submitCrawlUrls)	{
358
-				$output .= $this->drawURLs_cfgSelectors().'<br />';
359
-				$output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
360
-				$output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
361
-				$output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
362
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
363
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
364
-				$output .= '<br />
357
+            if (!$this->submitCrawlUrls)	{
358
+                $output .= $this->drawURLs_cfgSelectors().'<br />';
359
+                $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
360
+                $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
361
+                $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
362
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
363
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
364
+                $output .= '<br />
365 365
 					<table class="lrPadding c-list url-table">'.
366
-						$this->drawURLs_printTableHeader().
367
-						$code.
368
-					'</table>';
369
-			} else {
370
-				$output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
371
-				$output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
372
-				$output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
373
-			}
374
-		}
375
-
376
-			// Download Urls to crawl:
377
-		if ($this->downloadCrawlUrls)	{
378
-
379
-				// Creating output header:
380
-			$mimeType = 'application/octet-stream';
381
-			Header('Content-Type: '.$mimeType);
382
-			Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
383
-
384
-				// Printing the content of the CSV lines:
385
-			echo implode(chr(13).chr(10),$this->downloadUrls);
366
+                        $this->drawURLs_printTableHeader().
367
+                        $code.
368
+                    '</table>';
369
+            } else {
370
+                $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
371
+                $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
372
+                $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
373
+            }
374
+        }
386 375
 
387
-				// Exits:
388
-			exit;
389
-		}
376
+            // Download Urls to crawl:
377
+        if ($this->downloadCrawlUrls)	{
390 378
 
391
-			// Return output:
392
-		return 	$output;
393
-	}
379
+                // Creating output header:
380
+            $mimeType = 'application/octet-stream';
381
+            Header('Content-Type: '.$mimeType);
382
+            Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
394 383
 
395
-	/**
396
-	 * Draws the configuration selectors for compiling URLs:
397
-	 *
398
-	 * @return	string		HTML table
399
-	 */
400
-	function drawURLs_cfgSelectors()	{
384
+                // Printing the content of the CSV lines:
385
+            echo implode(chr(13).chr(10),$this->downloadUrls);
401 386
 
402
-			// depth
403
-		$cell[] = $this->selectorBox(
404
-			array(
405
-				0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
406
-				1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
407
-				2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
408
-				3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
409
-				4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
410
-				99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
411
-			),
412
-			'SET[depth]',
413
-			$this->pObj->MOD_SETTINGS['depth'],
414
-			0
415
-		);
416
-		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
417
-
418
-			// Configurations
419
-		$cell[] = $this->selectorBox(
420
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
421
-			'configurationSelection',
422
-			$this->incomingConfigurationSelection,
423
-			1
424
-		);
387
+                // Exits:
388
+            exit;
389
+        }
425 390
 
426
-			// Scheduled time:
427
-		$cell[] = $this->selectorBox(
428
-			array(
429
-				'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
430
-				'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
431
-				'04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
432
-			),
433
-			'tstamp',
434
-			\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
435
-			0
436
-		);
391
+            // Return output:
392
+        return 	$output;
393
+    }
437 394
 
438
-		// TODO: check relevance
439
-		/*
395
+    /**
396
+     * Draws the configuration selectors for compiling URLs:
397
+     *
398
+     * @return	string		HTML table
399
+     */
400
+    function drawURLs_cfgSelectors()	{
401
+
402
+            // depth
403
+        $cell[] = $this->selectorBox(
404
+            array(
405
+                0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
406
+                1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
407
+                2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
408
+                3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
409
+                4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
410
+                99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
411
+            ),
412
+            'SET[depth]',
413
+            $this->pObj->MOD_SETTINGS['depth'],
414
+            0
415
+        );
416
+        $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
417
+
418
+            // Configurations
419
+        $cell[] = $this->selectorBox(
420
+            empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
421
+            'configurationSelection',
422
+            $this->incomingConfigurationSelection,
423
+            1
424
+        );
425
+
426
+            // Scheduled time:
427
+        $cell[] = $this->selectorBox(
428
+            array(
429
+                'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
430
+                'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
431
+                '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
432
+            ),
433
+            'tstamp',
434
+            \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
435
+            0
436
+        );
437
+
438
+        // TODO: check relevance
439
+        /*
440 440
 			// Requests per minute:
441 441
 		$cell[] = $this->selectorBox(
442 442
 			array(
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		);
458 458
 		*/
459 459
 
460
-		$output = '
460
+        $output = '
461 461
 			<table class="lrPadding c-list">
462 462
 				<tr class="bgColor5 tableheader">
463 463
 					<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.depth').':</td>
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 				</tr>
471 471
 			</table>';
472 472
 
473
-		return $output;
474
-	}
473
+        return $output;
474
+    }
475 475
 
476
-	/**
477
-	 * Create Table header row for URL display
478
-	 *
479
-	 * @return	string		Table header
480
-	 */
481
-	function drawURLs_printTableHeader()	{
476
+    /**
477
+     * Create Table header row for URL display
478
+     *
479
+     * @return	string		Table header
480
+     */
481
+    function drawURLs_printTableHeader()	{
482 482
 
483
-		$content = '
483
+        $content = '
484 484
 			<tr class="bgColor5 tableheader">
485 485
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
486 486
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.key').':</td>
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.parameters').':</td>
492 492
 			</tr>';
493 493
 
494
-		return $content;
495
-	}
494
+        return $content;
495
+    }
496 496
 
497 497
 
498 498
 
@@ -505,75 +505,75 @@  discard block
 block discarded – undo
505 505
 
506 506
 
507 507
 
508
-	/*******************************
508
+    /*******************************
509 509
 	 *
510 510
 	 * Shows log of indexed URLs
511 511
 	 *
512 512
 	 ******************************/
513 513
 
514
-	/**
515
-	 * Shows the log of indexed URLs
516
-	 *
517
-	 * @return	string		HTML output
518
-	 */
519
-	function drawLog()	{
520
-		global $BACK_PATH;
521
-		$output = '';
522
-
523
-			// Init:
524
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
525
-		$this->crawlerObj->setAccessMode('gui');
526
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
527
-
528
-		$this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
529
-
530
-			// Read URL:
531
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
532
-			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
533
-		}
514
+    /**
515
+     * Shows the log of indexed URLs
516
+     *
517
+     * @return	string		HTML output
518
+     */
519
+    function drawLog()	{
520
+        global $BACK_PATH;
521
+        $output = '';
522
+
523
+            // Init:
524
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
525
+        $this->crawlerObj->setAccessMode('gui');
526
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
527
+
528
+        $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
529
+
530
+            // Read URL:
531
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
532
+            $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
533
+        }
534 534
 
535
-			// Look for set ID sent - if it is, we will display contents of that set:
536
-		$showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
535
+            // Look for set ID sent - if it is, we will display contents of that set:
536
+        $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
537 537
 
538
-			// Show details:
539
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
538
+            // Show details:
539
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
540 540
 
541
-				// Get entry record:
542
-			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
541
+                // Get entry record:
542
+            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
543 543
 
544
-				// Explode values:
545
-				$resStatus = $this->getResStatus($q_entry);
546
-			$q_entry['parameters'] = unserialize($q_entry['parameters']);
547
-			$q_entry['result_data'] = unserialize($q_entry['result_data']);
548
-			if (is_array($q_entry['result_data']))	{
549
-				$q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
550
-			}
544
+                // Explode values:
545
+                $resStatus = $this->getResStatus($q_entry);
546
+            $q_entry['parameters'] = unserialize($q_entry['parameters']);
547
+            $q_entry['result_data'] = unserialize($q_entry['result_data']);
548
+            if (is_array($q_entry['result_data']))	{
549
+                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
550
+            }
551 551
 
552
-			if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
553
-				unset($q_entry['result_data']['content']['log']);
554
-			}
552
+            if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
553
+                unset($q_entry['result_data']['content']['log']);
554
+            }
555 555
 
556
-				// Print rudimentary details:
557
-			$output .= '
556
+                // Print rudimentary details:
557
+            $output .= '
558 558
 				<br /><br />
559 559
 				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
560 560
 				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
561 561
 				<input type="hidden" value="' . $showSetId . '" name="setID" />
562 562
 				<br />
563 563
 				Current server time: ' . date('H:i:s', time()) . '<br />' .
564
-				'Status: ' . $resStatus . '<br />' .
565
-				\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
566
-		} else {	// Show list:
567
-
568
-				// If either id or set id, show list:
569
-			if ($this->pObj->id || $showSetId)	{
570
-				if ($this->pObj->id)	{
571
-						// Drawing tree:
572
-					$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
573
-					$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
574
-					$tree->init('AND '.$perms_clause);
575
-
576
-						// Set root row:
564
+                'Status: ' . $resStatus . '<br />' .
565
+                \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
566
+        } else {	// Show list:
567
+
568
+                // If either id or set id, show list:
569
+            if ($this->pObj->id || $showSetId)	{
570
+                if ($this->pObj->id)	{
571
+                        // Drawing tree:
572
+                    $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
573
+                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
574
+                    $tree->init('AND '.$perms_clause);
575
+
576
+                        // Set root row:
577 577
                     if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version()) < 8000000) {
578 578
                         $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord(
579 579
                             'pages',
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
                         $iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory');
584 584
                         $HTML = $iconFactory->getIconForRecord('pages', $this->pObj->pageinfo, Icon::SIZE_SMALL)->render();
585 585
                     }
586
-					$tree->tree[] = Array(
587
-						'row' => $this->pObj->pageinfo,
588
-						'HTML' => $HTML
589
-					);
590
-
591
-						// Get branch beneath:
592
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
593
-						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
594
-					}
595
-
596
-						// Traverse page tree:
597
-					$code = ''; $count = 0;
598
-					foreach($tree->tree as $data)	{
599
-						$code .= $this->drawLog_addRows(
600
-									$data['row'],
601
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
602
-									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
603
-								);
604
-						if (++$count == 1000) {
605
-							break;
606
-						}
607
-					}
608
-				} else {
609
-					$code = '';
610
-					$code.= $this->drawLog_addRows(
611
-								$showSetId,
612
-								'Set ID: '.$showSetId
613
-							);
614
-				}
615
-
616
-				if ($code)	{
617
-
618
-					$output .= '
586
+                    $tree->tree[] = Array(
587
+                        'row' => $this->pObj->pageinfo,
588
+                        'HTML' => $HTML
589
+                    );
590
+
591
+                        // Get branch beneath:
592
+                    if ($this->pObj->MOD_SETTINGS['depth'])	{
593
+                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
594
+                    }
595
+
596
+                        // Traverse page tree:
597
+                    $code = ''; $count = 0;
598
+                    foreach($tree->tree as $data)	{
599
+                        $code .= $this->drawLog_addRows(
600
+                                    $data['row'],
601
+                                    $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
602
+                                    intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
603
+                                );
604
+                        if (++$count == 1000) {
605
+                            break;
606
+                        }
607
+                    }
608
+                } else {
609
+                    $code = '';
610
+                    $code.= $this->drawLog_addRows(
611
+                                $showSetId,
612
+                                'Set ID: '.$showSetId
613
+                            );
614
+                }
615
+
616
+                if ($code)	{
617
+
618
+                    $output .= '
619 619
 						<br /><br />
620 620
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" />
621 621
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" />
@@ -629,20 +629,20 @@  discard block
 block discarded – undo
629 629
 
630 630
 
631 631
 						<table class="lrPadding c-list crawlerlog">'.
632
-							$this->drawLog_printTableHeader().
633
-							$code.
634
-						'</table>';
635
-				}
636
-			} else {	// Otherwise show available sets:
637
-				$setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
638
-								'set_id, count(*) as count_value, scheduled',
639
-								'tx_crawler_queue',
640
-								'',
641
-								'set_id, scheduled',
642
-								'scheduled DESC'
643
-							);
644
-
645
-				$code = '
632
+                            $this->drawLog_printTableHeader().
633
+                            $code.
634
+                        '</table>';
635
+                }
636
+            } else {	// Otherwise show available sets:
637
+                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
638
+                                'set_id, count(*) as count_value, scheduled',
639
+                                'tx_crawler_queue',
640
+                                '',
641
+                                'set_id, scheduled',
642
+                                'scheduled DESC'
643
+                            );
644
+
645
+                $code = '
646 646
 					<tr class="bgColor5 tableheader">
647 647
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>
648 648
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td>
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 					</tr>
651 651
 				';
652 652
 
653
-				$cc=0;
654
-				foreach($setList as $set)	{
655
-					$code.= '
653
+                $cc=0;
654
+                foreach($setList as $set)	{
655
+                    $code.= '
656 656
 						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
657 657
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
658 658
 							<td>'.$set['count_value'].'</td>
@@ -660,218 +660,218 @@  discard block
 block discarded – undo
660 660
 						</tr>
661 661
 					';
662 662
 
663
-					$cc++;
664
-				}
663
+                    $cc++;
664
+                }
665 665
 
666
-				$output .= '
666
+                $output .= '
667 667
 					<br /><br />
668 668
 					<table class="lrPadding c-list">'.
669
-						$code.
670
-					'</table>';
671
-			}
672
-		}
669
+                        $code.
670
+                    '</table>';
671
+            }
672
+        }
673 673
 
674
-		if($this->CSVExport) {
675
-			$this->outputCsvFile();
676
-		}
674
+        if($this->CSVExport) {
675
+            $this->outputCsvFile();
676
+        }
677 677
 
678
-			// Return output
679
-		return 	$output;
680
-	}
678
+            // Return output
679
+        return 	$output;
680
+    }
681 681
 
682
-	/**
683
-	 * Outputs the CSV file and sets the correct headers
684
-	 */
685
-	protected function outputCsvFile() {
682
+    /**
683
+     * Outputs the CSV file and sets the correct headers
684
+     */
685
+    protected function outputCsvFile() {
686 686
 
687
-		if (!count($this->CSVaccu)) {
688
-			$this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
689
-			return;
690
-		}
687
+        if (!count($this->CSVaccu)) {
688
+            $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
689
+            return;
690
+        }
691 691
 
692
-		$csvLines = array();
692
+        $csvLines = array();
693 693
 
694
-			// Field names:
695
-		reset($this->CSVaccu);
696
-		$fieldNames = array_keys(current($this->CSVaccu));
697
-		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
694
+            // Field names:
695
+        reset($this->CSVaccu);
696
+        $fieldNames = array_keys(current($this->CSVaccu));
697
+        $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
698 698
 
699
-			// Data:
700
-		foreach($this->CSVaccu as $row)	{
701
-			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
702
-		}
699
+            // Data:
700
+        foreach($this->CSVaccu as $row)	{
701
+            $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
702
+        }
703 703
 
704
-			// Creating output header:
705
-		$mimeType = 'application/octet-stream';
706
-		Header('Content-Type: '.$mimeType);
707
-		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
704
+            // Creating output header:
705
+        $mimeType = 'application/octet-stream';
706
+        Header('Content-Type: '.$mimeType);
707
+        Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
708 708
 
709
-			// Printing the content of the CSV lines:
710
-		echo implode(chr(13).chr(10),$csvLines);
709
+            // Printing the content of the CSV lines:
710
+        echo implode(chr(13).chr(10),$csvLines);
711 711
 
712
-			// Exits:
713
-		exit;
714
-	}
712
+            // Exits:
713
+        exit;
714
+    }
715 715
 
716
-	/**
717
-	 * Create the rows for display of the page tree
718
-	 * For each page a number of rows are shown displaying GET variable configuration
719
-	 *
720
-	 * @param array $pageRow_setId Page row or set-id
721
-	 * @param string $titleString Title string
722
-	 * @param int $itemsPerPage Items per Page setting
716
+    /**
717
+     * Create the rows for display of the page tree
718
+     * For each page a number of rows are shown displaying GET variable configuration
723 719
      *
724
-	 * @return string HTML <tr> content (one or more)
725
-	 */
726
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
727
-
728
-			// If Flush button is pressed, flush tables instead of selecting entries:
729
-
730
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
731
-			$doFlush = true;
732
-			$doFullFlush = false;
733
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
734
-			$doFlush = true;
735
-			$doFullFlush = true;
736
-		} else {
737
-			$doFlush = false;
738
-			$doFullFlush = false;
739
-		}
720
+     * @param array $pageRow_setId Page row or set-id
721
+     * @param string $titleString Title string
722
+     * @param int $itemsPerPage Items per Page setting
723
+     *
724
+     * @return string HTML <tr> content (one or more)
725
+     */
726
+    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
727
+
728
+            // If Flush button is pressed, flush tables instead of selecting entries:
729
+
730
+        if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
731
+            $doFlush = true;
732
+            $doFullFlush = false;
733
+        } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
734
+            $doFlush = true;
735
+            $doFullFlush = true;
736
+        } else {
737
+            $doFlush = false;
738
+            $doFullFlush = false;
739
+        }
740 740
 
741
-			// Get result:
742
-		if (is_array($pageRow_setId))	{
743
-			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
744
-		} else {
745
-			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
746
-		}
741
+            // Get result:
742
+        if (is_array($pageRow_setId))	{
743
+            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
744
+        } else {
745
+            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
746
+        }
747
+
748
+            // Init var:
749
+        $colSpan = 9
750
+                + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
751
+                + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
752
+
753
+        if (count($res))	{
754
+                // Traverse parameter combinations:
755
+            $c = 0;
756
+            $content='';
757
+            foreach($res as $kk => $vv)	{
758
+
759
+                    // Title column:
760
+                if (!$c)	{
761
+                    $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
762
+                } else {
763
+                    $titleClm = '';
764
+                }
765
+
766
+                    // Result:
767
+                $resLog = $this->getResultLog($vv);
768
+
769
+                $resStatus = $this->getResStatus($vv);
770
+                $resFeVars = $this->getResFeVars($vv);
771
+
772
+                    // Compile row:
773
+                $parameters = unserialize($vv['parameters']);
774
+
775
+                    // Put data into array:
776
+                $rowData = array();
777
+                if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
778
+                    $rowData['result_log'] = $resLog;
779
+                } else {
780
+                    $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
781
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
782
+                }
783
+                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
784
+                $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
785
+                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
786
+                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
787
+                $rowData['set_id'] = $vv['set_id'];
788
+
789
+                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
790
+                    $rowData['tsfe_id'] = $resFeVars['id'];
791
+                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
792
+                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
793
+                }
747 794
 
748
-			// Init var:
749
-		$colSpan = 9
750
-				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
751
-				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
752
-
753
-		if (count($res))	{
754
-				// Traverse parameter combinations:
755
-			$c = 0;
756
-			$content='';
757
-			foreach($res as $kk => $vv)	{
758
-
759
-					// Title column:
760
-				if (!$c)	{
761
-					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
762
-				} else {
763
-					$titleClm = '';
764
-				}
765
-
766
-					// Result:
767
-				$resLog = $this->getResultLog($vv);
768
-
769
-				$resStatus = $this->getResStatus($vv);
770
-				$resFeVars = $this->getResFeVars($vv);
771
-
772
-					// Compile row:
773
-				$parameters = unserialize($vv['parameters']);
774
-
775
-					// Put data into array:
776
-				$rowData = array();
777
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
778
-					$rowData['result_log'] = $resLog;
779
-				} else {
780
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
781
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
782
-				}
783
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
784
-				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
785
-				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
786
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
787
-				$rowData['set_id'] = $vv['set_id'];
788
-
789
-				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
790
-					$rowData['tsfe_id'] = $resFeVars['id'];
791
-					$rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
792
-					$rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
793
-				}
794
-
795
-				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
796
-
797
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
798
-				if (version_compare(TYPO3_version,'7.0','>=')) {
799
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
800
-				}
801
-
802
-					// Put rows together:
803
-				$content.= '
795
+                $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
796
+
797
+                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
798
+                if (version_compare(TYPO3_version,'7.0','>=')) {
799
+                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
800
+                }
801
+
802
+                    // Put rows together:
803
+                $content.= '
804 804
 					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
805 805
 						'.$titleClm.'
806 806
 						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
807 807
 						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>';
808
-				foreach($rowData as $fKey => $value) {
808
+                foreach($rowData as $fKey => $value) {
809 809
 
810
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
811
-						$content.= '
810
+                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
811
+                        $content.= '
812 812
 						<td>'.$value.'</td>';
813
-					} else {
814
-						$content.= '
813
+                    } else {
814
+                        $content.= '
815 815
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
816
-					}
817
-				}
818
-				$content.= '
816
+                    }
817
+                }
818
+                $content.= '
819 819
 					</tr>';
820
-				$c++;
821
-
822
-				if ($this->CSVExport)	{
823
-						// Only for CSV (adding qid and scheduled/exec_time if needed):
824
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
825
-					$rowData['qid'] = $vv['qid'];
826
-					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
827
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
828
-					$this->CSVaccu[] = $rowData;
829
-				}
830
-			}
831
-		} else {
820
+                $c++;
821
+
822
+                if ($this->CSVExport)	{
823
+                        // Only for CSV (adding qid and scheduled/exec_time if needed):
824
+                    $rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
825
+                    $rowData['qid'] = $vv['qid'];
826
+                    $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
827
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
828
+                    $this->CSVaccu[] = $rowData;
829
+                }
830
+            }
831
+        } else {
832 832
 
833
-				// Compile row:
834
-			$content = '
833
+                // Compile row:
834
+            $content = '
835 835
 				<tr class="bgColor-20">
836 836
 					<td>'.$titleString.'</td>
837 837
 					<td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td>
838 838
 				</tr>';
839
-		}
839
+        }
840 840
 
841
-		return $content;
842
-	}
841
+        return $content;
842
+    }
843 843
 
844
-	/**
845
-	 * Find Fe vars
846
-	 *
847
-	 * @param array $row
848
-	 * @return array
849
-	 */
850
-	function getResFeVars($row) {
851
-		$feVars = array();
852
-
853
-		if ($row['result_data']) {
854
-			$resultData = unserialize($row['result_data']);
855
-			$requestResult = unserialize($resultData['content']);
856
-			$feVars = $requestResult['vars'];
857
-		}
844
+    /**
845
+     * Find Fe vars
846
+     *
847
+     * @param array $row
848
+     * @return array
849
+     */
850
+    function getResFeVars($row) {
851
+        $feVars = array();
852
+
853
+        if ($row['result_data']) {
854
+            $resultData = unserialize($row['result_data']);
855
+            $requestResult = unserialize($resultData['content']);
856
+            $feVars = $requestResult['vars'];
857
+        }
858 858
 
859
-		return $feVars;
860
-	}
859
+        return $feVars;
860
+    }
861 861
 
862
-	/**
863
-	 * Create Table header row (log)
864
-	 *
865
-	 * @return	string		Table header
866
-	 */
867
-	function drawLog_printTableHeader()	{
862
+    /**
863
+     * Create Table header row (log)
864
+     *
865
+     * @return	string		Table header
866
+     */
867
+    function drawLog_printTableHeader()	{
868 868
 
869
-		$content = '
869
+        $content = '
870 870
 			<tr class="bgColor5 tableheader">
871 871
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
872 872
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td>
873 873
 				<td>&nbsp;</td>'.
874
-				($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
874
+                ($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
875 875
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : '
876 876
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td>
877 877
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').'
@@ -880,14 +880,14 @@  discard block
 block discarded – undo
880 880
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td>
881 881
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td>
882 882
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'.
883
-				($this->pObj->MOD_SETTINGS['log_feVars'] ? '
883
+                ($this->pObj->MOD_SETTINGS['log_feVars'] ? '
884 884
 				<td>'.htmlspecialchars('TSFE->id').'</td>
885 885
 				<td>'.htmlspecialchars('TSFE->gr_list').'</td>
886 886
 				<td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').'
887 887
 			</tr>';
888 888
 
889
-		return $content;
890
-	}
889
+        return $content;
890
+    }
891 891
 
892 892
         /**
893 893
          * Extract the log information from the current row and retrive it as formatted string.
@@ -914,25 +914,25 @@  discard block
 block discarded – undo
914 914
                 return $content;
915 915
         }
916 916
 
917
-	function getResStatus($vv) {
918
-		if ($vv['result_data'])	{
919
-			$requestContent = unserialize($vv['result_data']);
920
-			$requestResult = unserialize($requestContent['content']);
921
-			if (is_array($requestResult)) {
922
-				if (empty($requestResult['errorlog'])) {
923
-					$resStatus = 'OK';
924
-				} else {
925
-					$resStatus = implode("\n", $requestResult['errorlog']);
926
-				}
927
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
928
-			} else {
929
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
930
-			}
931
-		} else {
932
-			$resStatus = '-';
933
-		}
934
-		return $resStatus;
935
-	}
917
+    function getResStatus($vv) {
918
+        if ($vv['result_data'])	{
919
+            $requestContent = unserialize($vv['result_data']);
920
+            $requestResult = unserialize($requestContent['content']);
921
+            if (is_array($requestResult)) {
922
+                if (empty($requestResult['errorlog'])) {
923
+                    $resStatus = 'OK';
924
+                } else {
925
+                    $resStatus = implode("\n", $requestResult['errorlog']);
926
+                }
927
+                $resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
928
+            } else {
929
+                $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
930
+            }
931
+        } else {
932
+            $resStatus = '-';
933
+        }
934
+        return $resStatus;
935
+    }
936 936
 
937 937
 
938 938
 
@@ -941,344 +941,344 @@  discard block
 block discarded – undo
941 941
 
942 942
 
943 943
 
944
-	/*****************************
944
+    /*****************************
945 945
 	 *
946 946
 	 * CLI status display
947 947
 	 *
948 948
 	 *****************************/
949 949
 
950
-	/**
951
-	 * This method is used to show an overview about the active an the finished crawling processes
952
-	 *
953
-	 * @author Timo Schmidt
954
-	 * @param void
955
-	 * @return string
956
-	 */
957
-	protected function drawProcessOverviewAction(){
958
-
959
-		$this->runRefreshHooks();
960
-
961
-		global $BACK_PATH;
962
-		$this->makeCrawlerProcessableChecks();
963
-
964
-		$crawler = $this->findCrawler();
965
-		try {
966
-			$this->handleProcessOverviewActions();
967
-		} catch (Exception $e) {
968
-			$this->addErrorMessage($e->getMessage());
969
-		}
950
+    /**
951
+     * This method is used to show an overview about the active an the finished crawling processes
952
+     *
953
+     * @author Timo Schmidt
954
+     * @param void
955
+     * @return string
956
+     */
957
+    protected function drawProcessOverviewAction(){
958
+
959
+        $this->runRefreshHooks();
960
+
961
+        global $BACK_PATH;
962
+        $this->makeCrawlerProcessableChecks();
963
+
964
+        $crawler = $this->findCrawler();
965
+        try {
966
+            $this->handleProcessOverviewActions();
967
+        } catch (Exception $e) {
968
+            $this->addErrorMessage($e->getMessage());
969
+        }
970 970
 
971
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
-		$perpage 	= 20;
971
+        $offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
972
+        $perpage 	= 20;
973 973
 
974
-		$processRepository	= new tx_crawler_domain_process_repository();
975
-		$queueRepository	= new tx_crawler_domain_queue_repository();
974
+        $processRepository	= new tx_crawler_domain_process_repository();
975
+        $queueRepository	= new tx_crawler_domain_queue_repository();
976 976
 
977
-		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
978
-		if ($mode == 'detail') {
979
-			$where = '';
980
-		} elseif($mode == 'simple') {
981
-			$where = 'active = 1';
982
-		}
977
+        $mode = $this->pObj->MOD_SETTINGS['processListMode'];
978
+        if ($mode == 'detail') {
979
+            $where = '';
980
+        } elseif($mode == 'simple') {
981
+            $where = 'active = 1';
982
+        }
983 983
 
984
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
985
-		$allCount			= $processRepository->countAll($where);
986
-
987
-		$listView			= new tx_crawler_view_process_list();
988
-		$listView->setPageId($this->pObj->id);
989
-		$listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
990
-		$listView->setProcessCollection($allProcesses);
991
-		$listView->setCliPath($this->processManager->getCrawlerCliPath());
992
-		$listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
993
-		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
994
-		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
995
-		$listView->setActiveProcessCount($processRepository->countActive());
996
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
997
-		$listView->setMode($mode);
998
-
999
-		$paginationView		= new tx_crawler_view_pagination();
1000
-		$paginationView->setCurrentOffset($offset);
1001
-		$paginationView->setPerPage($perpage);
1002
-		$paginationView->setTotalItemCount($allCount);
1003
-
1004
-		$output = $listView->render();
1005
-
1006
-		if ($paginationView->getTotalPagesCount() > 1) {
1007
-			$output .= ' <br />'.$paginationView->render();
1008
-		}
984
+        $allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
985
+        $allCount			= $processRepository->countAll($where);
986
+
987
+        $listView			= new tx_crawler_view_process_list();
988
+        $listView->setPageId($this->pObj->id);
989
+        $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
990
+        $listView->setProcessCollection($allProcesses);
991
+        $listView->setCliPath($this->processManager->getCrawlerCliPath());
992
+        $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
993
+        $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
994
+        $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
995
+        $listView->setActiveProcessCount($processRepository->countActive());
996
+        $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
997
+        $listView->setMode($mode);
998
+
999
+        $paginationView		= new tx_crawler_view_pagination();
1000
+        $paginationView->setCurrentOffset($offset);
1001
+        $paginationView->setPerPage($perpage);
1002
+        $paginationView->setTotalItemCount($allCount);
1003
+
1004
+        $output = $listView->render();
1005
+
1006
+        if ($paginationView->getTotalPagesCount() > 1) {
1007
+            $output .= ' <br />'.$paginationView->render();
1008
+        }
1009 1009
 
1010
-		return $output;
1011
-	}
1010
+        return $output;
1011
+    }
1012 1012
 
1013
-	/**
1014
-	 * Verify that the crawler is exectuable.
1015
-	 *
1016
-	 * @access protected
1017
-	 * @return void
1018
-	 *
1019
-	 * @author Michael Klapper <[email protected]>
1020
-	 */
1021
-	protected function makeCrawlerProcessableChecks() {
1022
-		global $LANG;
1023
-
1024
-		if ($this->isCrawlerUserAvailable() === false) {
1025
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1026
-		} elseif ($this->isCrawlerUserNotAdmin() === false) {
1027
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1028
-		}
1013
+    /**
1014
+     * Verify that the crawler is exectuable.
1015
+     *
1016
+     * @access protected
1017
+     * @return void
1018
+     *
1019
+     * @author Michael Klapper <[email protected]>
1020
+     */
1021
+    protected function makeCrawlerProcessableChecks() {
1022
+        global $LANG;
1023
+
1024
+        if ($this->isCrawlerUserAvailable() === false) {
1025
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1026
+        } elseif ($this->isCrawlerUserNotAdmin() === false) {
1027
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1028
+        }
1029 1029
 
1030
-		if ($this->isPhpForkAvailable() === false) {
1031
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1032
-		}
1030
+        if ($this->isPhpForkAvailable() === false) {
1031
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1032
+        }
1033 1033
 
1034
-		$exitCode = 0;
1035
-		$out = array();
1036
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1037
-		if ($exitCode > 0) {
1038
-			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1039
-		}
1040
-	}
1034
+        $exitCode = 0;
1035
+        $out = array();
1036
+        exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1037
+        if ($exitCode > 0) {
1038
+            $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1039
+        }
1040
+    }
1041 1041
 
1042
-	/**
1043
-	 * Indicate that the required PHP method "popen" is
1044
-	 * available in the system.
1045
-	 *
1046
-	 * @access protected
1047
-	 * @return boolean
1048
-	 *
1049
-	 * @author Michael Klapper <[email protected]>
1050
-	 */
1051
-	protected function isPhpForkAvailable() {
1052
-		return function_exists('popen');
1053
-	}
1054
-
1055
-	/**
1056
-	 * Indicate that the required be_user "_cli_crawler" is
1057
-	 * global available in the system.
1058
-	 *
1059
-	 * @access protected
1060
-	 * @return boolean
1061
-	 *
1062
-	 * @author Michael Klapper <[email protected]>
1063
-	 */
1064
-	protected function isCrawlerUserAvailable() {
1065
-		$isAvailable = false;
1066
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1042
+    /**
1043
+     * Indicate that the required PHP method "popen" is
1044
+     * available in the system.
1045
+     *
1046
+     * @access protected
1047
+     * @return boolean
1048
+     *
1049
+     * @author Michael Klapper <[email protected]>
1050
+     */
1051
+    protected function isPhpForkAvailable() {
1052
+        return function_exists('popen');
1053
+    }
1054
+
1055
+    /**
1056
+     * Indicate that the required be_user "_cli_crawler" is
1057
+     * global available in the system.
1058
+     *
1059
+     * @access protected
1060
+     * @return boolean
1061
+     *
1062
+     * @author Michael Klapper <[email protected]>
1063
+     */
1064
+    protected function isCrawlerUserAvailable() {
1065
+        $isAvailable = false;
1066
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1067 1067
 
1068
-		if (is_array($userArray))
1069
-			$isAvailable = true;
1068
+        if (is_array($userArray))
1069
+            $isAvailable = true;
1070 1070
 
1071
-		return $isAvailable;
1072
-	}
1071
+        return $isAvailable;
1072
+    }
1073 1073
 
1074
-	/**
1075
-	 * Indicate that the required be_user "_cli_crawler" is
1076
-	 * has no admin rights.
1077
-	 *
1078
-	 * @access protected
1079
-	 * @return boolean
1080
-	 *
1081
-	 * @author Michael Klapper <[email protected]>
1082
-	 */
1083
-	protected function isCrawlerUserNotAdmin() {
1084
-		$isAvailable = false;
1085
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1074
+    /**
1075
+     * Indicate that the required be_user "_cli_crawler" is
1076
+     * has no admin rights.
1077
+     *
1078
+     * @access protected
1079
+     * @return boolean
1080
+     *
1081
+     * @author Michael Klapper <[email protected]>
1082
+     */
1083
+    protected function isCrawlerUserNotAdmin() {
1084
+        $isAvailable = false;
1085
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1086 1086
 
1087
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1088
-			$isAvailable = true;
1087
+        if (is_array($userArray) && $userArray[0]['admin'] == 0)
1088
+            $isAvailable = true;
1089 1089
 
1090
-		return $isAvailable;
1091
-	}
1090
+        return $isAvailable;
1091
+    }
1092 1092
 
1093
-	/**
1094
-	 * Method to handle incomming actions of the process overview
1095
-	 *
1096
-	 * @param void
1097
-	 * @return void
1098
-	 */
1099
-	protected function handleProcessOverviewActions(){
1100
-
1101
-		$crawler = $this->findCrawler();
1102
-
1103
-		switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1104
-			case 'stopCrawling' :
1105
-				//set the cli status to disable (all processes will be terminated)
1106
-				$crawler->setDisabled(true);
1107
-				break;
1108
-			case 'resumeCrawling' :
1109
-				//set the cli status to end (all processes will be terminated)
1110
-				$crawler->setDisabled(false);
1111
-				break;
1112
-			case 'addProcess' :
1113
-				$handle = $this->processManager->startProcess();
1114
-				if ($handle === false) {
1115
-					throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1116
-				}
1117
-				$this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1118
-				break;
1119
-		}
1120
-	}
1093
+    /**
1094
+     * Method to handle incomming actions of the process overview
1095
+     *
1096
+     * @param void
1097
+     * @return void
1098
+     */
1099
+    protected function handleProcessOverviewActions(){
1100
+
1101
+        $crawler = $this->findCrawler();
1102
+
1103
+        switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1104
+            case 'stopCrawling' :
1105
+                //set the cli status to disable (all processes will be terminated)
1106
+                $crawler->setDisabled(true);
1107
+                break;
1108
+            case 'resumeCrawling' :
1109
+                //set the cli status to end (all processes will be terminated)
1110
+                $crawler->setDisabled(false);
1111
+                break;
1112
+            case 'addProcess' :
1113
+                $handle = $this->processManager->startProcess();
1114
+                if ($handle === false) {
1115
+                    throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1116
+                }
1117
+                $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1118
+                break;
1119
+        }
1120
+    }
1121 1121
 
1122 1122
 
1123 1123
 
1124 1124
 
1125
-	/**
1126
-	 * Returns the singleton instance of the crawler.
1127
-	 *
1128
-	 * @param void
1129
-	 * @return tx_crawler_lib crawler object
1130
-	 * @author Timo Schmidt <[email protected]>
1131
-	 */
1132
-	protected function findCrawler(){
1133
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1134
-			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1135
-		}
1136
-		return $this->crawlerObj;
1137
-	}
1125
+    /**
1126
+     * Returns the singleton instance of the crawler.
1127
+     *
1128
+     * @param void
1129
+     * @return tx_crawler_lib crawler object
1130
+     * @author Timo Schmidt <[email protected]>
1131
+     */
1132
+    protected function findCrawler(){
1133
+        if(!$this->crawlerObj instanceof tx_crawler_lib){
1134
+            $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1135
+        }
1136
+        return $this->crawlerObj;
1137
+    }
1138 1138
 
1139 1139
 
1140 1140
 
1141
-	/*****************************
1141
+    /*****************************
1142 1142
 	 *
1143 1143
 	 * General Helper Functions
1144 1144
 	 *
1145 1145
 	 *****************************/
1146 1146
 
1147
-	/**
1148
-	 * This method is used to add a message to the internal queue
1149
-	 *
1150
-	 * NOTE:
1151
-	 * This method is basesd on TYPO3 4.3 or higher!
1152
-	 *
1153
-	 * @param  string  the message itself
1154
-	 * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1155
-	 *
1156
-	 * @access private
1157
-	 * @return void
1158
-	 */
1159
-	private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1160
-		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1161
-			'TYPO3\CMS\Core\Messaging\FlashMessage',
1162
-			$message,
1163
-			'',
1164
-			$severity
1165
-		);
1166
-
1167
-		// TODO:
1168
-		/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1169
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1170
-		$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1171
-	}
1172
-
1173
-	/**
1174
-	 * Add notice message to the user interface.
1175
-	 *
1176
-	 * NOTE:
1177
-	 * This method is basesd on TYPO3 4.3 or higher!
1178
-	 *
1179
-	 * @param string The message
1180
-	 *
1181
-	 * @access protected
1182
-	 * @return void
1183
-	 *
1184
-	 * @author Michael Klapper <[email protected]>
1185
-	 */
1186
-	protected function addNoticeMessage($message) {
1187
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1188
-	}
1189
-
1190
-	/**
1191
-	 * Add error message to the user interface.
1192
-	 *
1193
-	 * NOTE:
1194
-	 * This method is basesd on TYPO3 4.3 or higher!
1195
-	 *
1196
-	 * @param string The message
1197
-	 *
1198
-	 * @access protected
1199
-	 * @return void
1200
-	 *
1201
-	 * @author Michael Klapper <[email protected]>
1202
-	 */
1203
-	protected function addErrorMessage($message) {
1204
-		$this->isErrorDetected = TRUE;
1205
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1206
-	}
1207
-
1208
-	/**
1209
-	 * Add error message to the user interface.
1210
-	 *
1211
-	 * NOTE:
1212
-	 * This method is basesd on TYPO3 4.3 or higher!
1213
-	 *
1214
-	 * @param string The message
1215
-	 *
1216
-	 * @access protected
1217
-	 * @return void
1218
-	 *
1219
-	 * @author Michael Klapper <[email protected]>
1220
-	 */
1221
-	protected function addWarningMessage($message) {
1222
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1223
-	}
1224
-
1225
-	/**
1226
-	 * Create selector box
1227
-	 *
1228
-	 * @param	array		$optArray Options key(value) => label pairs
1229
-	 * @param	string		$name Selector box name
1230
-	 * @param	string		$value Selector box value (array for multiple...)
1231
-	 * @param	boolean		$multiple If set, will draw multiple box.
1147
+    /**
1148
+     * This method is used to add a message to the internal queue
1149
+     *
1150
+     * NOTE:
1151
+     * This method is basesd on TYPO3 4.3 or higher!
1232 1152
      *
1233
-	 * @return	string		HTML select element
1234
-	 */
1235
-	function selectorBox($optArray, $name, $value, $multiple)	{
1153
+     * @param  string  the message itself
1154
+     * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1155
+     *
1156
+     * @access private
1157
+     * @return void
1158
+     */
1159
+    private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1160
+        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1161
+            'TYPO3\CMS\Core\Messaging\FlashMessage',
1162
+            $message,
1163
+            '',
1164
+            $severity
1165
+        );
1166
+
1167
+        // TODO:
1168
+        /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1169
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1170
+        $flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1171
+    }
1172
+
1173
+    /**
1174
+     * Add notice message to the user interface.
1175
+     *
1176
+     * NOTE:
1177
+     * This method is basesd on TYPO3 4.3 or higher!
1178
+     *
1179
+     * @param string The message
1180
+     *
1181
+     * @access protected
1182
+     * @return void
1183
+     *
1184
+     * @author Michael Klapper <[email protected]>
1185
+     */
1186
+    protected function addNoticeMessage($message) {
1187
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1188
+    }
1189
+
1190
+    /**
1191
+     * Add error message to the user interface.
1192
+     *
1193
+     * NOTE:
1194
+     * This method is basesd on TYPO3 4.3 or higher!
1195
+     *
1196
+     * @param string The message
1197
+     *
1198
+     * @access protected
1199
+     * @return void
1200
+     *
1201
+     * @author Michael Klapper <[email protected]>
1202
+     */
1203
+    protected function addErrorMessage($message) {
1204
+        $this->isErrorDetected = TRUE;
1205
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1206
+    }
1207
+
1208
+    /**
1209
+     * Add error message to the user interface.
1210
+     *
1211
+     * NOTE:
1212
+     * This method is basesd on TYPO3 4.3 or higher!
1213
+     *
1214
+     * @param string The message
1215
+     *
1216
+     * @access protected
1217
+     * @return void
1218
+     *
1219
+     * @author Michael Klapper <[email protected]>
1220
+     */
1221
+    protected function addWarningMessage($message) {
1222
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1223
+    }
1224
+
1225
+    /**
1226
+     * Create selector box
1227
+     *
1228
+     * @param	array		$optArray Options key(value) => label pairs
1229
+     * @param	string		$name Selector box name
1230
+     * @param	string		$value Selector box value (array for multiple...)
1231
+     * @param	boolean		$multiple If set, will draw multiple box.
1232
+     *
1233
+     * @return	string		HTML select element
1234
+     */
1235
+    function selectorBox($optArray, $name, $value, $multiple)	{
1236 1236
 
1237
-		$options = array();
1238
-		foreach($optArray as $key => $val)	{
1239
-			$options[] = '
1237
+        $options = array();
1238
+        foreach($optArray as $key => $val)	{
1239
+            $options[] = '
1240 1240
 				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1241
-		}
1241
+        }
1242 1242
 
1243
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1243
+        $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1244 1244
 
1245
-		return $output;
1246
-	}
1245
+        return $output;
1246
+    }
1247 1247
 
1248
-	/**
1249
-	 * Activate hooks
1250
-	 *
1251
-	 * @return	void
1252
-	 */
1253
-	function runRefreshHooks() {
1254
-		$crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1255
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1256
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1257
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1258
-				if (is_object($hookObj)) {
1259
-					$hookObj->crawler_init($crawlerLib);
1260
-				}
1261
-			}
1262
-		}
1248
+    /**
1249
+     * Activate hooks
1250
+     *
1251
+     * @return	void
1252
+     */
1253
+    function runRefreshHooks() {
1254
+        $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1255
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1256
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1257
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1258
+                if (is_object($hookObj)) {
1259
+                    $hookObj->crawler_init($crawlerLib);
1260
+                }
1261
+            }
1262
+        }
1263 1263
 
1264
-	}
1264
+    }
1265 1265
 
1266
-	/**
1267
-	 * Returns the URL to the current module, including $_GET['id'].
1268
-	 *
1269
-	 * @param array $urlParameters optional parameters to add to the URL
1270
-	 * @return string
1271
-	 */
1272
-	protected function getModuleUrl(array $urlParameters = array()) {
1273
-	    if ($this->pObj->id) {
1274
-	        $urlParameters = array_merge($urlParameters, array(
1266
+    /**
1267
+     * Returns the URL to the current module, including $_GET['id'].
1268
+     *
1269
+     * @param array $urlParameters optional parameters to add to the URL
1270
+     * @return string
1271
+     */
1272
+    protected function getModuleUrl(array $urlParameters = array()) {
1273
+        if ($this->pObj->id) {
1274
+            $urlParameters = array_merge($urlParameters, array(
1275 1275
                 'id' => $this->pObj->id
1276 1276
             ));
1277
-	    }
1277
+        }
1278 1278
         return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters);
1279
-	}
1279
+    }
1280 1280
 }
1281 1281
 
1282 1282
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1283
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1283
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1284 1284
 }
Please login to merge, or discard this patch.
class.tx_crawler_lib.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
             return FALSE;
1330 1330
         }
1331 1331
 
1332
- 	    // direct request
1332
+            // direct request
1333 1333
         if ($this->extensionSettings['makeDirectRequests']) {
1334 1334
             $result = $this->sendDirectRequest($originalUrl, $crawlerId);
1335 1335
             return $result;
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
      *
2361 2361
      * @return void
2362 2362
      */
2363
-     public function CLI_deleteProcessesMarkedDeleted() {
2363
+        public function CLI_deleteProcessesMarkedDeleted() {
2364 2364
         $this->db->exec_DELETEquery('tx_crawler_process', 'deleted = 1');
2365 2365
     }
2366 2366
 
Please login to merge, or discard this patch.