Passed
Push — master ( 409614...84c1e8 )
by Patrick
02:14
created
application/controllers/HelperController.php 1 patch
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
 		if (isset($postData['host']))
66 66
 		{
67 67
 			$host=$postData['host'];
68
-		}
69
-		else
68
+		} else
70 69
 		{
71 70
 			$this->_helper->json(array('status'=>'No Hosts','hostid' => -1));
72 71
 			return;
@@ -77,8 +76,7 @@  discard block
 block discarded – undo
77 76
 		{	
78 77
 			$this->_helper->json(array('status'=>'More than one host matches','hostid' => -1));
79 78
 			return;
80
-		}
81
-		else if (count($hostArray) == 0)
79
+		} else if (count($hostArray) == 0)
82 80
 		{
83 81
 			$this->_helper->json(array('status'=>'No host matches','hostid' => -1));
84 82
 			return;
@@ -114,8 +112,7 @@  discard block
 block discarded – undo
114 112
 		{	
115 113
 			$this->_helper->json(array('status'=>'More than one hostgroup matches','hostid' => -1));
116 114
 			return;
117
-		}
118
-		else if (count($hostArray) == 0)
115
+		} else if (count($hostArray) == 0)
119 116
 		{
120 117
 			$this->_helper->json(array('status'=>'No hostgroup matches','hostid' => -1));
121 118
 			return;
@@ -146,8 +143,7 @@  discard block
 block discarded – undo
146 143
 		{
147 144
 			$traplist=$this->getMIB()->getTrapList($mib);
148 145
 			$retTraps=array('status'=>'OK','traps' => $traplist);
149
-		} 
150
-		catch (Exception $e) 
146
+		} catch (Exception $e) 
151 147
 		{ 
152 148
 			$retTraps=array('status' => 'Error getting mibs');
153 149
 		}
@@ -169,8 +165,7 @@  discard block
 block discarded – undo
169 165
 		{
170 166
 			$objectlist=$this->getMIB()->getObjectList($trap);
171 167
 			$retObjects=array('status'=>'OK','objects' => $objectlist);
172
-		} 
173
-		catch (Exception $e) 
168
+		} catch (Exception $e) 
174 169
 		{ 
175 170
 			$retObjects=array('status' => 'not found');
176 171
 		}
@@ -185,8 +180,7 @@  discard block
 block discarded – undo
185 180
 		try
186 181
 		{
187 182
 			$miblist=$this->getMIB()->getMIBList();
188
-		} 
189
-		catch (Exception $e) 
183
+		} catch (Exception $e) 
190 184
 		{ 
191 185
 			$miblist=array('Error getting mibs');
192 186
 		}
@@ -209,8 +203,7 @@  discard block
 block discarded – undo
209 203
 		{
210 204
 			$this->_helper->json(array('status'=>'Not found'));
211 205
 			return;
212
-		}
213
-		else
206
+		} else
214 207
 		{
215 208
 			$this->_helper->json(
216 209
 				array('status'=>'OK',
@@ -244,8 +237,7 @@  discard block
 block discarded – undo
244 237
 			try
245 238
 			{
246 239
 				$this->setDBConfigValue('db_remove_days',$days);
247
-			}
248
-			catch (Exception $e)
240
+			} catch (Exception $e)
249 241
 			{
250 242
 				$this->_helper->json(array('status'=>'Save error : '.$e->getMessage() ));
251 243
 				return;
@@ -263,8 +255,7 @@  discard block
 block discarded – undo
263 255
 				$trap = new Trap($icingaweb2_etc);
264 256
 				$trap->setLogging($debug_level,'syslog');
265 257
 				$trap->eraseOldTraps($days);
266
-			}
267
-			catch (Exception $e)
258
+			} catch (Exception $e)
268 259
 			{
269 260
 				$this->_helper->json(array('status'=>'execute error : '.$e->getMessage() ));
270 261
 				return;
@@ -301,14 +292,12 @@  discard block
 block discarded – undo
301 292
 			    $this->_helper->json(array('status'=>'File not writable :  '.$file));
302 293
 			    return;
303 294
 			}
304
-		}
305
-		else
295
+		} else
306 296
 		{
307 297
 			if ($destination != 'file')
308 298
 			{
309 299
 				$file=null;
310
-			}
311
-			else
300
+			} else
312 301
 			{
313 302
 				$this->_helper->json(array('status'=>'No file'));
314 303
 				return;
@@ -322,8 +311,7 @@  discard block
 block discarded – undo
322 311
 			$this->setDBConfigValue('log_destination',$destination);
323 312
 			$this->setDBConfigValue('log_file',$file);
324 313
 			$this->setDBConfigValue('log_level',$level);
325
-		}
326
-		catch (Exception $e)
314
+		} catch (Exception $e)
327 315
 		{
328 316
 			$this->_helper->json(array('status'=>'Save error : '.$e->getMessage() ));
329 317
 			return;
@@ -359,8 +347,7 @@  discard block
 block discarded – undo
359 347
 	            // Eval
360 348
 	            $item=0;
361 349
 	            $rule=$trap->ruleClass->evaluation($rule,$item);
362
-	        }
363
-	        catch (Exception $e)
350
+	        } catch (Exception $e)
364 351
 	        {
365 352
 	            $this->_helper->json(array('status'=>'Evaluation error : '.$e->getMessage() ));
366 353
 	            return;
@@ -393,8 +380,7 @@  discard block
 block discarded – undo
393 380
             $action=($action == 'enable') ? true : false;
394 381
             $retVal=$trap->pluginClass->enablePlugin($pluginName, $action);
395 382
             
396
-        }
397
-        catch (Exception $e)
383
+        } catch (Exception $e)
398 384
         {
399 385
             $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() ));
400 386
             return;
@@ -402,8 +388,7 @@  discard block
 block discarded – undo
402 388
         if ($retVal === true)
403 389
         {
404 390
             $this->_helper->json(array('status'=>'OK'));
405
-        }
406
-        else
391
+        } else
407 392
         {
408 393
             $this->_helper->json(array('status'=>'Error, see logs'));
409 394
         }
@@ -434,8 +419,7 @@  discard block
 block discarded – undo
434 419
 	        $functionString = $trap->ruleClass->eval_cleanup($functionString);
435 420
 	        // Eval functions
436 421
 	        $result = $trap->pluginClass->evaluateFunctionString($functionString);	        
437
-	    }
438
-	    catch (Exception $e)
422
+	    } catch (Exception $e)
439 423
 	    {
440 424
 	        $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() ));
441 425
 	        return;
Please login to merge, or discard this patch.