Passed
Push — master ( d35be2...9c2cb2 )
by Patrick
02:02
created
configuration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 $this->providePermission('trapdirector/config', $this->translate('Allow to create and modify traps services'));
7 7
 
8 8
 $this->provideConfigTab('config', array(
9
-    'title' => 'Configuration',
10
-    'url'   => 'settings'
9
+	'title' => 'Configuration',
10
+	'url'   => 'settings'
11 11
 ));
12 12
 
13 13
 $section = $this->menuSection(N_('Traps'),array (
Please login to merge, or discard this patch.
application/clicommands/StatusCommand.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 class StatusCommand extends Command
18 18
 {
19 19
 	/**
20
-	* Get database counts
21
-	*
22
-	* Get number of traps, rules
23
-	*/
20
+	 * Get database counts
21
+	 *
22
+	 * Get number of traps, rules
23
+	 */
24 24
 	public function dbAction()
25 25
 	{
26 26
 		$db_prefix=$this->Config()->get('config', 'database_prefix');
Please login to merge, or discard this patch.
application/clicommands/TrapsCommand.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 class TrapsCommand extends Command
18 18
 {
19 19
 	/**
20
-	*	Delete old traps
21
-	*
22
-	*	USAGE 
23
-	*
24
-	*	icingali trapdirector traps rotate [options]
25
-	*	
26
-	*	OPTIONS
27
-	*	
28
-	*	--days	remove traps older than <n> days
29
-	*/
20
+	 *	Delete old traps
21
+	 *
22
+	 *	USAGE 
23
+	 *
24
+	 *	icingali trapdirector traps rotate [options]
25
+	 *	
26
+	 *	OPTIONS
27
+	 *	
28
+	 *	--days	remove traps older than <n> days
29
+	 */
30 30
 	public function rotateAction()
31 31
 	{
32 32
 		$module=Icinga::app()->getModuleManager()->getModule($this->getModuleName());
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	}  	
57 57
 	
58 58
 	/**
59
-	*	Reset services to OK state if timeout is passed
60
-	*
61
-	*	USAGE
62
-	*
63
-	*	icingali trapdirector traps reset_services
64
-	*
65
-	*/
59
+	 *	Reset services to OK state if timeout is passed
60
+	 *
61
+	 *	USAGE
62
+	 *
63
+	 *	icingali trapdirector traps reset_services
64
+	 *
65
+	 */
66 66
 	public function resetOKAction()
67 67
 	{
68 68
 		$module=Icinga::app()->getModuleManager()->getModule($this->getModuleName());
Please login to merge, or discard this patch.
application/forms/TrapsConfigForm.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	public function setDefaultIDODB($idoDbName)
34 34
 	{
35
-	    $this->idoDbName=$idoDbName;
36
-	    return $this;
35
+		$this->idoDbName=$idoDbName;
36
+		return $this;
37 37
 	}
38 38
 	
39
-    public function createElements(array $formData)
40
-    {
41
-        $this->addElement(
39
+	public function createElements(array $formData)
40
+	{
41
+		$this->addElement(
42 42
 			'select',
43 43
 			'config_database',
44 44
 			array(
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 			 )
73 73
 		);		
74 74
 		$this->addElement(
75
-            'text',
76
-            'config_icingaweb2_etc',
77
-            array(
78
-                    'required'      => true,
79
-                    'label'             => $this->translate('icingaweb2 config dir'),
75
+			'text',
76
+			'config_icingaweb2_etc',
77
+			array(
78
+					'required'      => true,
79
+					'label'             => $this->translate('icingaweb2 config dir'),
80 80
 					'value'			=> $this->icinga_base_path,
81
-             )
82
-        );
81
+			 )
82
+		);
83 83
 		$retval=0;
84 84
 		$output=array();
85 85
 		$snmptranslate=exec('which snmptranslate',$output,$retval);
@@ -88,68 +88,68 @@  discard block
 block discarded – undo
88 88
 			$snmptranslate='/usr/bin/snmptranslate';
89 89
 		}
90 90
 		$this->addElement(
91
-            'text',
92
-            'config_snmptranslate',
93
-            array(
94
-                    'required'      => true,
95
-                    'label'             => $this->translate('snmptranslate binary with path'),
91
+			'text',
92
+			'config_snmptranslate',
93
+			array(
94
+					'required'      => true,
95
+					'label'             => $this->translate('snmptranslate binary with path'),
96 96
 					'value'			=> $snmptranslate,
97
-             )
98
-        );
97
+			 )
98
+		);
99 99
 		$this->addElement(
100
-            'text',
101
-            'config_snmptranslate_dirs',
102
-            array(
103
-                    'required'      => true,
104
-                    'label'         => $this->translate('Path for mibs'),
100
+			'text',
101
+			'config_snmptranslate_dirs',
102
+			array(
103
+					'required'      => true,
104
+					'label'         => $this->translate('Path for mibs'),
105 105
 					'value'			=> $this->module_base_path.'/mibs',
106
-             )
107
-        );		
106
+			 )
107
+		);		
108 108
 		$this->addElement(
109
-            'text',
110
-            'config_icingacmd',
111
-            array(
112
-                    'required'      => true,
113
-                    'label'         => $this->translate('icingacmd with path'),
109
+			'text',
110
+			'config_icingacmd',
111
+			array(
112
+					'required'      => true,
113
+					'label'         => $this->translate('icingacmd with path'),
114 114
 					'value'			=> '/var/run/icinga2/cmd/icinga2.cmd',
115
-             )
116
-        );
115
+			 )
116
+		);
117 117
 		$this->addElement(
118
-		    'text',
119
-		    'config_icingaAPI_host',
120
-		    array(
121
-		        'required'      => false,
122
-		        'label'         => $this->translate('icinga2 API Host IP'),
123
-		        'value'			=> '',
124
-		    )
118
+			'text',
119
+			'config_icingaAPI_host',
120
+			array(
121
+				'required'      => false,
122
+				'label'         => $this->translate('icinga2 API Host IP'),
123
+				'value'			=> '',
124
+			)
125 125
 		);
126 126
 		$this->addElement(
127
-		    'text',
128
-		    'config_icingaAPI_port',
129
-		    array(
130
-		        'required'      => false,
131
-		        'label'         => $this->translate('icinga2 API TCP Port'),
132
-		        'value'			=> '5665',
133
-		    )
134
-		    );
127
+			'text',
128
+			'config_icingaAPI_port',
129
+			array(
130
+				'required'      => false,
131
+				'label'         => $this->translate('icinga2 API TCP Port'),
132
+				'value'			=> '5665',
133
+			)
134
+			);
135 135
 		$this->addElement(
136
-		    'text',
137
-		    'config_icingaAPI_user',
138
-		    array(
139
-		        'required'      => false,
140
-		        'label'         => $this->translate('icinga2 API username'),
141
-		        'value'			=> '',
142
-		    )
143
-        );
136
+			'text',
137
+			'config_icingaAPI_user',
138
+			array(
139
+				'required'      => false,
140
+				'label'         => $this->translate('icinga2 API username'),
141
+				'value'			=> '',
142
+			)
143
+		);
144 144
 		$this->addElement(
145
-		    'text',
146
-		    'config_icingaAPI_password',
147
-		    array(
148
-		        'required'      => false,
149
-		        'label'         => $this->translate('icinga2 API password'),
150
-		        'value'			=> '',
151
-		    )
152
-	    );
145
+			'text',
146
+			'config_icingaAPI_password',
147
+			array(
148
+				'required'      => false,
149
+				'label'         => $this->translate('icinga2 API password'),
150
+				'value'			=> '',
151
+			)
152
+		);
153 153
 		/*$this->addElement(
154 154
 		    'radio',
155 155
 		    'config_icinga2api_use',
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		        'value'			=> array('Yes', 'No'),//array('1' => 'Yes', '0' => 'No'),
160 160
 		    )
161 161
 		);*/  
162
-		    // For Icinga2 API connexion
162
+			// For Icinga2 API connexion
163 163
 	//	$icinga2API=new Fieldset('Icinga2 API connection');
164 164
 	/* 	$icinga2API_select=new radioBtn('icinga2API_use');
165 165
 		$icinga2API_select->setLabel('Use icinga2 API instead of cmd file?');
@@ -169,30 +169,30 @@  discard block
 block discarded – undo
169 169
 		]);
170 170
 		$icinga2API->add($icinga2API_select);
171 171
 		$this->add($icinga2API); */
172
-    }	
172
+	}	
173 173
 
174 174
     
175
-    public function render(Zend_View_Interface $view = NULL)
176
-    {
175
+	public function render(Zend_View_Interface $view = NULL)
176
+	{
177 177
         
178 178
 
179
-        //return $html;
180
-        return parent::render($view);
181
-    }
179
+		//return $html;
180
+		return parent::render($view);
181
+	}
182 182
     
183
-    /**
184
-     * {@inheritdoc}
185
-     */
186
-    public function onSuccess()
187
-    {
188
-        parent::onSuccess();
189
-    }
183
+	/**
184
+	 * {@inheritdoc}
185
+	 */
186
+	public function onSuccess()
187
+	{
188
+		parent::onSuccess();
189
+	}
190 190
     
191
-    /**
192
-     * {@inheritdoc}
193
-     */
191
+	/**
192
+	 * {@inheritdoc}
193
+	 */
194 194
 	public function save()
195
-    {
195
+	{
196 196
 		parent::save();
197 197
 	}
198 198
 }
Please login to merge, or discard this patch.
application/controllers/ReceivedController.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	/** 
42
-	*	Trap detail page
43
-	*/	
42
+	 *	Trap detail page
43
+	 */	
44 44
 	public function trapdetailAction() 
45 45
 	{
46 46
 		
@@ -141,22 +141,22 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function hostsAction()
143 143
 	{
144
-	    $this->checkReadPermission();
145
-	    $this->prepareTabs()->activate('hosts');
144
+		$this->checkReadPermission();
145
+		$this->prepareTabs()->activate('hosts');
146 146
 	    
147
-	    $db = $this->getDb();
148
-	    $this->getTrapHostListTable()->setConnection($db);
147
+		$db = $this->getDb();
148
+		$this->getTrapHostListTable()->setConnection($db);
149 149
 	    
150
-	    // Apply pagination limits
151
-	    $this->view->table=$this->applyPaginationLimits($this->getTrapHostListTable(),$this->getModuleConfig()->itemListDisplay());
150
+		// Apply pagination limits
151
+		$this->view->table=$this->applyPaginationLimits($this->getTrapHostListTable(),$this->getModuleConfig()->itemListDisplay());
152 152
 	    
153
-	    // Set Filter
154
-	    //$postData=$this->getRequest()->getPost();
155
-	    $filter=array();
156
-	    $filter['q']=$this->params->get('q');//(isset($postData['q']))?$postData['q']:'';
157
-	    $filter['done']=$this->params->get('done');
158
-	    $this->view->filter=$filter;
159
-	    $this->view->table->updateFilter(Url::fromRequest(),$filter);
153
+		// Set Filter
154
+		//$postData=$this->getRequest()->getPost();
155
+		$filter=array();
156
+		$filter['q']=$this->params->get('q');//(isset($postData['q']))?$postData['q']:'';
157
+		$filter['done']=$this->params->get('done');
158
+		$this->view->filter=$filter;
159
+		$this->view->table->updateFilter(Url::fromRequest(),$filter);
160 160
 	}
161 161
 	
162 162
 	public function deleteAction()
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 		return $this->getTabs()->add('traps', array(
177 177
 			'label'	=> $this->translate('Traps'),
178 178
 			'url'   => $this->getModuleConfig()->urlPath() . '/received')
179
-		    )
180
-		    ->add('hosts', array(
181
-		        'label' => $this->translate('Hosts'),
182
-		        'url'   => $this->getModuleConfig()->urlPath() . '/received/hosts')
183
-		    )
184
-		    ->add('delete', array(
179
+			)
180
+			->add('hosts', array(
181
+				'label' => $this->translate('Hosts'),
182
+				'url'   => $this->getModuleConfig()->urlPath() . '/received/hosts')
183
+			)
184
+			->add('delete', array(
185 185
 			'label' => $this->translate('Delete'),
186 186
 			'url'   => $this->getModuleConfig()->urlPath() . '/received/delete')
187 187
 		  );
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableHostList.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	protected $lastHost;
22 22
 	// Filters 
23 23
 	
24
-    protected $filter;
25
-    protected $enforcedFilters = array();
26
-    protected $searchColumns = array();
24
+	protected $filter;
25
+	protected $enforcedFilters = array();
26
+	protected $searchColumns = array();
27 27
 	
28 28
 	protected function getTitles() {
29 29
 		// TODO : check moduleconfig is set
30
-	    return $this->moduleConfig->getTrapHostListTitles();
30
+		return $this->moduleConfig->getTrapHostListTitles();
31 31
 	}
32 32
 		
33 33
 	// ******************  Render table in html 
@@ -35,45 +35,45 @@  discard block
 block discarded – undo
35 35
 	// Host grouping
36 36
 	protected function renderHostIfNew($IP,$hostname)
37 37
 	{
38
-	    $view = $this->getView();
38
+		$view = $this->getView();
39 39
 	    
40
-	    if ($this->lastHost === $IP) {
41
-	        return;
42
-	    }
40
+		if ($this->lastHost === $IP) {
41
+			return;
42
+		}
43 43
 	    
44
-	    if ($this->lastHost === null) 
45
-	    {
46
-	        $htm = "<thead>\n  <tr>\n";
47
-	    } else {
48
-	        $htm = "</tbody>\n<thead>\n  <tr>\n";
49
-	    }
44
+		if ($this->lastHost === null) 
45
+		{
46
+			$htm = "<thead>\n  <tr>\n";
47
+		} else {
48
+			$htm = "</tbody>\n<thead>\n  <tr>\n";
49
+		}
50 50
 	    
51
-	    if ($this->columnCount === null) 
52
-	    {
53
-	        $this->columnCount = count($this->getTitles());
54
-	    }
51
+		if ($this->columnCount === null) 
52
+		{
53
+			$this->columnCount = count($this->getTitles());
54
+		}
55 55
 	    
56
-	    $htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($IP);
57
-	    if ($hostname != null)
58
-	    {
59
-	        $htm .= ' ('.$hostname.')';
60
-	    }
61
-	    $htm .= '</th>' . "\n";
62
-	    if ($this->lastHost === null) {
63
-	        $htm .= "  </tr>\n";
64
-	    } else {
65
-	        $htm .= "  </tr>\n</thead>\n";
66
-	    }
56
+		$htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($IP);
57
+		if ($hostname != null)
58
+		{
59
+			$htm .= ' ('.$hostname.')';
60
+		}
61
+		$htm .= '</th>' . "\n";
62
+		if ($this->lastHost === null) {
63
+			$htm .= "  </tr>\n";
64
+		} else {
65
+			$htm .= "  </tr>\n</thead>\n";
66
+		}
67 67
 	    
68
-	    $this->lastHost = $IP;
68
+		$this->lastHost = $IP;
69 69
 	    
70
-	    return $htm . "<tbody>\n";
70
+		return $htm . "<tbody>\n";
71 71
 	}		
72 72
 	
73
-    public function __toString()
74
-    {
75
-        return $this->render();
76
-    }
73
+	public function __toString()
74
+	{
75
+		return $this->render();
76
+	}
77 77
 	
78 78
 	public function render()
79 79
 	{
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 
140 140
 	}
141 141
 
142
-    public function count()
143
-    {  
144
-        $db=$this->db();
142
+	public function count()
143
+	{  
144
+		$db=$this->db();
145 145
 		
146 146
 		$query = $this->getBaseQuery();
147 147
 		$this->applyFiltersToQuery($query);
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 		
150 150
 		return count($values);
151 151
 		
152
-        //return $db->fetchOne($query);
153
-    }
152
+		//return $db->fetchOne($query);
153
+	}
154 154
 	
155
-    public function getPaginator()
156
-    {
157
-        $paginator = new Paginator();
158
-        $paginator->setQuery($this);
155
+	public function getPaginator()
156
+	{
157
+		$paginator = new Paginator();
158
+		$paginator->setQuery($this);
159 159
 
160
-        return $paginator;
161
-    }
160
+		return $paginator;
161
+	}
162 162
 	
163 163
 	// ****************** DB connection and query
164 164
 	
@@ -168,24 +168,24 @@  discard block
 block discarded – undo
168 168
 		
169 169
 		$query = $this->getBaseQuery();
170 170
 		$this->applyFiltersToQuery($query);
171
-       if ($this->hasLimit() || $this->hasOffset()) {
172
-            $query->limit($this->getLimit(), $this->getOffset());
173
-        }		
171
+	   if ($this->hasLimit() || $this->hasOffset()) {
172
+			$query->limit($this->getLimit(), $this->getOffset());
173
+		}		
174 174
 		
175 175
 		return $db->fetchAll($query);
176 176
 	}
177 177
 	 
178
-    public function getBaseQuery()
179
-    {
178
+	public function getBaseQuery()
179
+	{
180 180
 		$db=$this->db();
181 181
 		$query = $db->select()->from(
182
-            $this->moduleConfig->getTrapTableName(),
183
-		    $this->moduleConfig->getTrapHostListDisplayColumns()
184
-		    )->group(array('t.source_ip','t.source_name','t.trap_oid'))
185
-		    ->order('t.source_ip');
182
+			$this->moduleConfig->getTrapTableName(),
183
+			$this->moduleConfig->getTrapHostListDisplayColumns()
184
+			)->group(array('t.source_ip','t.source_name','t.trap_oid'))
185
+			->order('t.source_ip');
186 186
 
187
-        return $query;
188
-    }	 
187
+		return $query;
188
+	}	 
189 189
 	
190 190
 	// ****************** Filters
191 191
 
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 		$this->filter_done=(isset($filter['done']))?$this->filter_done=$filter['done']:0;
216 216
 	}
217 217
 	
218
-    protected function getSearchColumns()
219
-    {
220
-        return $this->getColumns();
221
-    }
218
+	protected function getSearchColumns()
219
+	{
220
+		return $this->getColumns();
221
+	}
222 222
 	
223 223
 	public function getColumns()
224 224
 	{
225 225
 		return $this->moduleConfig->getTrapListDisplayColumns();
226 226
 	}
227 227
 
228
-    public function setFilter($filter)
229
-    {
230
-        $this->filter = $filter;
231
-        return $this;
232
-    }
228
+	public function setFilter($filter)
229
+	{
230
+		$this->filter = $filter;
231
+		return $this;
232
+	}
233 233
 	
234 234
 	public function getFilterEditor(Request $request)
235
-    {
236
-        $filterEditor = Widget::create('filterEditor')
237
-            ->setColumns(array_keys($this->getColumns()))
238
-            ->setSearchColumns(array_keys($this->getSearchColumns()))
239
-            ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
240
-            ->ignoreParams('page')
241
-            ->handleRequest($request);
235
+	{
236
+		$filterEditor = Widget::create('filterEditor')
237
+			->setColumns(array_keys($this->getColumns()))
238
+			->setSearchColumns(array_keys($this->getSearchColumns()))
239
+			->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
240
+			->ignoreParams('page')
241
+			->handleRequest($request);
242 242
 
243
-        $filter = $filterEditor->getFilter();
244
-        $this->setFilter($filter);
243
+		$filter = $filterEditor->getFilter();
244
+		$this->setFilter($filter);
245 245
 
246
-        return $filterEditor;
247
-    }
246
+		return $filterEditor;
247
+	}
248 248
 	
249
-    protected function applyFiltersToQuery($query)
250
-    {
249
+	protected function applyFiltersToQuery($query)
250
+	{
251 251
 		
252 252
 		$sql='';
253 253
 		if ($this->filter_query != '')
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 			$sql.="(status != 'done')";
269 269
 		}
270 270
 		if ($sql != '') $query->where($sql);		
271
-        return $query;
272
-    }	
271
+		return $query;
272
+	}	
273 273
 
274 274
 }
275 275
 
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTable.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 	// view limits
28 28
 	protected $limit;
29
-    protected $offset;
29
+	protected $offset;
30 30
 
31 31
 	// Used for rendering days in list
32 32
 	protected $columnCount;
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 	
35 35
 	// Filters 
36 36
 	
37
-    protected $filter;
38
-    protected $enforcedFilters = array();
39
-    protected $searchColumns = array();
37
+	protected $filter;
38
+	protected $enforcedFilters = array();
39
+	protected $searchColumns = array();
40 40
 	
41 41
 	
42 42
 	// Must return titles in array ( id => display_name )
43 43
 	abstract protected function getTitles();
44 44
 	// ****************** Day header
45
-    protected function renderDayIfNew($timestamp)
46
-    {
47
-        $view = $this->getView();
45
+	protected function renderDayIfNew($timestamp)
46
+	{
47
+		$view = $this->getView();
48 48
 
49 49
 		// Check for date local format
50
-        if (in_array(setlocale(LC_ALL, 0), array('en_US.UTF-8', 'C'))) {
51
-            $day = date('l, jS F Y', (int) $timestamp);
52
-        } else {
53
-            $day = strftime('%A, %e. %B, %Y', (int) $timestamp);
54
-        }
55
-
56
-        if ($this->lastDay === $day) {
57
-            return;
58
-        }
59
-
60
-        if ($this->lastDay === null) {
61
-            $htm = "<thead>\n  <tr>\n";
62
-        } else {
63
-            $htm = "</tbody>\n<thead>\n  <tr>\n";
64
-        }
65
-
66
-        if ($this->columnCount === null) {
67
-            $this->columnCount = count($this->getTitles());
68
-        }
69
-
70
-        $htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($day) . '</th>' . "\n";
71
-        if ($this->lastDay === null) {
72
-            $htm .= "  </tr>\n";
73
-        } else {
74
-            $htm .= "  </tr>\n</thead>\n";
75
-        }
76
-
77
-        $this->lastDay = $day;
78
-
79
-        return $htm . "<tbody>\n";
80
-    }		
50
+		if (in_array(setlocale(LC_ALL, 0), array('en_US.UTF-8', 'C'))) {
51
+			$day = date('l, jS F Y', (int) $timestamp);
52
+		} else {
53
+			$day = strftime('%A, %e. %B, %Y', (int) $timestamp);
54
+		}
55
+
56
+		if ($this->lastDay === $day) {
57
+			return;
58
+		}
59
+
60
+		if ($this->lastDay === null) {
61
+			$htm = "<thead>\n  <tr>\n";
62
+		} else {
63
+			$htm = "</tbody>\n<thead>\n  <tr>\n";
64
+		}
65
+
66
+		if ($this->columnCount === null) {
67
+			$this->columnCount = count($this->getTitles());
68
+		}
69
+
70
+		$htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($day) . '</th>' . "\n";
71
+		if ($this->lastDay === null) {
72
+			$htm .= "  </tr>\n";
73
+		} else {
74
+			$htm .= "  </tr>\n</thead>\n";
75
+		}
76
+
77
+		$this->lastDay = $day;
78
+
79
+		return $htm . "<tbody>\n";
80
+	}		
81 81
 	// ******************  Render table in html  
82
-    public function __toString()
83
-    {
84
-        return $this->render();
85
-    }
82
+	public function __toString()
83
+	{
84
+		return $this->render();
85
+	}
86 86
 	
87 87
 	abstract public function render();
88 88
 	
@@ -92,76 +92,76 @@  discard block
 block discarded – undo
92 92
 		$this->moduleConfig = $conf;
93 93
 	}
94 94
 	// ******************  View get/set
95
-    protected function getView()
96
-    {
97
-        if ($this->view === null) {
98
-            $this->view = Icinga::app()->getViewRenderer()->view;
99
-        }
100
-        return $this->view;
101
-    }
95
+	protected function getView()
96
+	{
97
+		if ($this->view === null) {
98
+			$this->view = Icinga::app()->getViewRenderer()->view;
99
+		}
100
+		return $this->view;
101
+	}
102 102
 
103
-    public function setView($view)
104
-    {
105
-        $this->view = $view;
106
-    }	
103
+	public function setView($view)
104
+	{
105
+		$this->view = $view;
106
+	}	
107 107
 	
108 108
 	// Limits
109 109
 	
110
-    public function limit($count = null, $offset = null)
111
-    {
112
-        $this->limit = $count;
113
-        $this->offset = $offset;
110
+	public function limit($count = null, $offset = null)
111
+	{
112
+		$this->limit = $count;
113
+		$this->offset = $offset;
114 114
 
115
-        return $this;
116
-    }
115
+		return $this;
116
+	}
117 117
 
118
-    public function hasLimit()
119
-    {
120
-        return $this->limit !== null;
121
-    }
118
+	public function hasLimit()
119
+	{
120
+		return $this->limit !== null;
121
+	}
122 122
 
123
-    public function getLimit()
124
-    {
125
-        return $this->limit;
126
-    }
123
+	public function getLimit()
124
+	{
125
+		return $this->limit;
126
+	}
127 127
 
128
-    public function hasOffset()
129
-    {
130
-        return $this->offset !== null;
131
-    }
128
+	public function hasOffset()
129
+	{
130
+		return $this->offset !== null;
131
+	}
132 132
 
133
-    public function getOffset()
134
-    {
135
-        return $this->offset;
136
-    }
133
+	public function getOffset()
134
+	{
135
+		return $this->offset;
136
+	}
137 137
 	
138 138
 	abstract function count();
139 139
 	
140
-    public function getPaginator()
141
-    {
142
-        $paginator = new Paginator();
143
-        $paginator->setQuery($this);
140
+	public function getPaginator()
141
+	{
142
+		$paginator = new Paginator();
143
+		$paginator->setQuery($this);
144 144
 
145
-        return $paginator;
146
-    }
145
+		return $paginator;
146
+	}
147 147
 	
148 148
 	// ****************** DB connection and query
149 149
 	
150
-    public function setConnection(Selectable $connection)
151
-    {
152
-        $this->connection = $connection;
153
-        return $this;
154
-    }
150
+	public function setConnection(Selectable $connection)
151
+	{
152
+		$this->connection = $connection;
153
+		return $this;
154
+	}
155 155
 
156
-    protected function connection()
157
-    {
158
-        return $this->connection;
159
-    }
156
+	protected function connection()
157
+	{
158
+		return $this->connection;
159
+	}
160 160
 
161
-    protected function db()
162
-    {
163
-        return $this->connection()->getConnection();
164
-    }
161
+	protected function db()
162
+	{
163
+		return $this->connection()->getConnection();
164
+	}
165 165
 	
166 166
 	protected function getTable()
167 167
 	{
@@ -169,52 +169,52 @@  discard block
 block discarded – undo
169 169
 		
170 170
 		$query = $this->getBaseQuery();
171 171
 		
172
-       if ($this->hasLimit() || $this->hasOffset()) {
173
-            $query->limit($this->getLimit(), $this->getOffset());
174
-        }		
172
+	   if ($this->hasLimit() || $this->hasOffset()) {
173
+			$query->limit($this->getLimit(), $this->getOffset());
174
+		}		
175 175
 		
176 176
 		return $db->fetchAll($query);
177 177
 	}
178 178
 	 
179
-    abstract public function getBaseQuery(); 
179
+	abstract public function getBaseQuery(); 
180 180
 	
181 181
 	// ****************** Filters
182 182
 
183
-    protected function getSearchColumns()
184
-    {
185
-        return $this->getColumns();
186
-    }
183
+	protected function getSearchColumns()
184
+	{
185
+		return $this->getColumns();
186
+	}
187 187
 	
188 188
 	abstract public function getColumns();
189 189
 
190
-    public function setFilter($filter)
191
-    {
192
-        $this->filter = $filter;
193
-        return $this;
194
-    }
190
+	public function setFilter($filter)
191
+	{
192
+		$this->filter = $filter;
193
+		return $this;
194
+	}
195 195
 	
196 196
 	public function getFilterEditor(Request $request)
197
-    {
198
-        $filterEditor = Widget::create('filterEditor')
199
-            ->setColumns(array_keys($this->getColumns()))
200
-            ->setSearchColumns(array_keys($this->getSearchColumns()))
201
-            ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
202
-            ->ignoreParams('page')
203
-            ->handleRequest($request);
197
+	{
198
+		$filterEditor = Widget::create('filterEditor')
199
+			->setColumns(array_keys($this->getColumns()))
200
+			->setSearchColumns(array_keys($this->getSearchColumns()))
201
+			->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
202
+			->ignoreParams('page')
203
+			->handleRequest($request);
204 204
 
205
-        $filter = $filterEditor->getFilter();
206
-        $this->setFilter($filter);
205
+		$filter = $filterEditor->getFilter();
206
+		$this->setFilter($filter);
207 207
 
208
-        return $filterEditor;
209
-    }
208
+		return $filterEditor;
209
+	}
210 210
 	
211 211
 	protected function renderFilter($filter)
212 212
 	{ // TODO : create a better filter wher user can choose host/oid to filter
213 213
 	}
214 214
 	
215
-    protected function applyFiltersToQuery($query)
216
-    {
217
-        /*
215
+	protected function applyFiltersToQuery($query)
216
+	{
217
+		/*
218 218
 		$filter = null;
219 219
         $enforced = $this->enforcedFilters;
220 220
         if ($this->filter && ! $this->filter->isEmpty()) {
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
             $query->where($this->renderFilter($filter));
231 231
         }
232 232
 		*/
233
-        return $query;
234
-    }	
233
+		return $query;
234
+	}	
235 235
 
236 236
 }
237 237
 
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableList.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	
21 21
 	// Filters 
22 22
 	
23
-    protected $filter;
24
-    protected $enforcedFilters = array();
25
-    protected $searchColumns = array();
23
+	protected $filter;
24
+	protected $enforcedFilters = array();
25
+	protected $searchColumns = array();
26 26
 	
27 27
 	protected function getTitles() {
28 28
 		// TODO : check moduleconfig is set
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 		
32 32
 	// ******************  Render table in html  
33
-    public function __toString()
34
-    {
35
-        return $this->render();
36
-    }
33
+	public function __toString()
34
+	{
35
+		return $this->render();
36
+	}
37 37
 	
38 38
 	public function render()
39 39
 	{
@@ -97,26 +97,26 @@  discard block
 block discarded – undo
97 97
 
98 98
 	}
99 99
 
100
-    public function count()
101
-    {
102
-        $db=$this->db();
100
+	public function count()
101
+	{
102
+		$db=$this->db();
103 103
 		
104 104
 		$query = $db->select()->from(
105
-            $this->moduleConfig->getTrapTableName(),
106
-            array('COUNT(*)')
107
-        );
105
+			$this->moduleConfig->getTrapTableName(),
106
+			array('COUNT(*)')
107
+		);
108 108
 		$this->applyFiltersToQuery($query);
109 109
 		
110
-        return $db->fetchOne($query);
111
-    }
110
+		return $db->fetchOne($query);
111
+	}
112 112
 	
113
-    public function getPaginator()
114
-    {
115
-        $paginator = new Paginator();
116
-        $paginator->setQuery($this);
113
+	public function getPaginator()
114
+	{
115
+		$paginator = new Paginator();
116
+		$paginator->setQuery($this);
117 117
 
118
-        return $paginator;
119
-    }
118
+		return $paginator;
119
+	}
120 120
 	
121 121
 	// ****************** DB connection and query
122 122
 	
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 		
127 127
 		$query = $this->getBaseQuery();
128 128
 		$this->applyFiltersToQuery($query);
129
-       if ($this->hasLimit() || $this->hasOffset()) {
130
-            $query->limit($this->getLimit(), $this->getOffset());
131
-        }		
129
+	   if ($this->hasLimit() || $this->hasOffset()) {
130
+			$query->limit($this->getLimit(), $this->getOffset());
131
+		}		
132 132
 		
133 133
 		return $db->fetchAll($query);
134 134
 	}
135 135
 	 
136
-    public function getBaseQuery()
137
-    {
136
+	public function getBaseQuery()
137
+	{
138 138
 		$db=$this->db();
139 139
 		
140 140
 		$query = $db->select()->from(
141
-            $this->moduleConfig->getTrapTableName(),
142
-            $this->moduleConfig->getTrapListDisplayColumns()
143
-        )->order('timestamp DESC');
141
+			$this->moduleConfig->getTrapTableName(),
142
+			$this->moduleConfig->getTrapListDisplayColumns()
143
+		)->order('timestamp DESC');
144 144
 
145
-        return $query;
146
-    }	 
145
+		return $query;
146
+	}	 
147 147
 	
148 148
 	// ****************** Filters
149 149
 
@@ -173,39 +173,39 @@  discard block
 block discarded – undo
173 173
 		$this->filter_done=(isset($filter['done']))?$this->filter_done=$filter['done']:0;
174 174
 	}
175 175
 	
176
-    protected function getSearchColumns()
177
-    {
178
-        return $this->getColumns();
179
-    }
176
+	protected function getSearchColumns()
177
+	{
178
+		return $this->getColumns();
179
+	}
180 180
 	
181 181
 	public function getColumns()
182 182
 	{
183 183
 		return $this->moduleConfig->getTrapListDisplayColumns();
184 184
 	}
185 185
 
186
-    public function setFilter($filter)
187
-    {
188
-        $this->filter = $filter;
189
-        return $this;
190
-    }
186
+	public function setFilter($filter)
187
+	{
188
+		$this->filter = $filter;
189
+		return $this;
190
+	}
191 191
 	
192 192
 	public function getFilterEditor(Request $request)
193
-    {
194
-        $filterEditor = Widget::create('filterEditor')
195
-            ->setColumns(array_keys($this->getColumns()))
196
-            ->setSearchColumns(array_keys($this->getSearchColumns()))
197
-            ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
198
-            ->ignoreParams('page')
199
-            ->handleRequest($request);
200
-
201
-        $filter = $filterEditor->getFilter();
202
-        $this->setFilter($filter);
203
-
204
-        return $filterEditor;
205
-    }
193
+	{
194
+		$filterEditor = Widget::create('filterEditor')
195
+			->setColumns(array_keys($this->getColumns()))
196
+			->setSearchColumns(array_keys($this->getSearchColumns()))
197
+			->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
198
+			->ignoreParams('page')
199
+			->handleRequest($request);
200
+
201
+		$filter = $filterEditor->getFilter();
202
+		$this->setFilter($filter);
203
+
204
+		return $filterEditor;
205
+	}
206 206
 	
207
-    protected function applyFiltersToQuery($query)
208
-    {
207
+	protected function applyFiltersToQuery($query)
208
+	{
209 209
 		
210 210
 		$sql='';
211 211
 		if ($this->filter_query != '')
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 			$sql.="(status != 'done')";
227 227
 		}
228 228
 		if ($sql != '') $query->where($sql);		
229
-        return $query;
230
-    }	
229
+		return $query;
230
+	}	
231 231
 
232 232
 }
233 233
 
Please login to merge, or discard this patch.
library/Trapdirector/Config/TrapModuleConfig.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 class TrapModuleConfig
6 6
 {
7
-    /********** Database configuration ***********************/
7
+	/********** Database configuration ***********************/
8 8
 	// Database prefix for tables 
9
-    protected $table_prefix; //< Database prefix for tables 	
9
+	protected $table_prefix; //< Database prefix for tables 	
10 10
 	protected $DBConfigDefaults=array(
11 11
 		'db_remove_days' => 60, // number of days before removing traps
12 12
 		'log_destination' => 'syslog', // Log destination for trap handler
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
 	// Note : must have 'source_ip' and 'last_sent'
114 114
 	public function getTrapHostListDisplayColumns()
115 115
 	{
116
-	    return array(
117
-	        'source_name'  =>  't.source_name',
118
-	        'source_ip'    =>  't.source_ip',
119
-	        'trap_oid'     =>  't.trap_oid',
120
-	        'count'        =>  'count(*)',
121
-	        'last_sent'    =>  'UNIX_TIMESTAMP(max(t.date_received))'
122
-	    );
116
+		return array(
117
+			'source_name'  =>  't.source_name',
118
+			'source_ip'    =>  't.source_ip',
119
+			'trap_oid'     =>  't.trap_oid',
120
+			'count'        =>  'count(*)',
121
+			'last_sent'    =>  'UNIX_TIMESTAMP(max(t.date_received))'
122
+		);
123 123
 	}
124 124
 
125 125
 	public function getTrapHostListSearchColumns()
126 126
 	{
127
-	    return array(); // No search needed on this table
127
+		return array(); // No search needed on this table
128 128
 	}
129 129
 	// Titles display in Trap List table
130 130
 	public function getTrapHostListTitles()
131 131
 	{
132
-	    return array(
133
-	        'trap_oid'		=> 'Trap OID',
134
-	        'count'		    => 'Number of traps received',
135
-	        'last_sent'     => 'Last trap received'
136
-	    );
132
+		return array(
133
+			'trap_oid'		=> 'Trap OID',
134
+			'count'		    => 'Number of traps received',
135
+			'last_sent'     => 'Last trap received'
136
+		);
137 137
 	}
138 138
 	
139 139
 	
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			'revert_ok'		=> 'r.revert_ok',
189 189
 			'display'		=> 'r.display',
190 190
 			'modified'		=> 'UNIX_TIMESTAMP(r.modified)',
191
-            'modifier'		=> 'r.modifier'
191
+			'modifier'		=> 'r.modifier'
192 192
 		);
193 193
 	}	
194 194
 		
Please login to merge, or discard this patch.