@@ -65,8 +65,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -292,8 +283,7 @@ discard block |
||
| 292 | 283 | $this->_helper->json(array('status'=>'invalid destination : '.$destination)); |
| 293 | 284 | return; |
| 294 | 285 | } |
| 295 | - } |
|
| 296 | - else |
|
| 286 | + } else |
|
| 297 | 287 | { |
| 298 | 288 | $this->_helper->json(array('status'=>'No destination')); |
| 299 | 289 | } |
@@ -306,14 +296,12 @@ discard block |
||
| 306 | 296 | $this->_helper->json(array('status'=>'File not writable : '.$file)); |
| 307 | 297 | return; |
| 308 | 298 | } |
| 309 | - } |
|
| 310 | - else |
|
| 299 | + } else |
|
| 311 | 300 | { |
| 312 | 301 | if ($destination != 'file') |
| 313 | 302 | { |
| 314 | 303 | $file=null; |
| 315 | - } |
|
| 316 | - else |
|
| 304 | + } else |
|
| 317 | 305 | { |
| 318 | 306 | $this->_helper->json(array('status'=>'No file')); |
| 319 | 307 | return; |
@@ -323,8 +311,7 @@ discard block |
||
| 323 | 311 | if (isset($postData['level'])) |
| 324 | 312 | { |
| 325 | 313 | $level=$postData['level']; |
| 326 | - } |
|
| 327 | - else |
|
| 314 | + } else |
|
| 328 | 315 | { |
| 329 | 316 | $this->_helper->json(array('status'=>'No level')); |
| 330 | 317 | return; |
@@ -335,8 +322,7 @@ discard block |
||
| 335 | 322 | $this->setDBConfigValue('log_destination',$destination); |
| 336 | 323 | $this->setDBConfigValue('log_file',$file); |
| 337 | 324 | $this->setDBConfigValue('log_level',$level); |
| 338 | - } |
|
| 339 | - catch (Exception $e) |
|
| 325 | + } catch (Exception $e) |
|
| 340 | 326 | { |
| 341 | 327 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
| 342 | 328 | return; |
@@ -358,8 +344,7 @@ discard block |
||
| 358 | 344 | if (isset($postData['rule'])) |
| 359 | 345 | { |
| 360 | 346 | $rule=$postData['rule']; |
| 361 | - } |
|
| 362 | - else |
|
| 347 | + } else |
|
| 363 | 348 | { |
| 364 | 349 | $this->_helper->json(array('status'=>'No Rule')); |
| 365 | 350 | } |
@@ -371,8 +356,7 @@ discard block |
||
| 371 | 356 | $this->_helper->json(array('status'=>'unknown action '.$action)); |
| 372 | 357 | return; |
| 373 | 358 | } |
| 374 | - } |
|
| 375 | - else |
|
| 359 | + } else |
|
| 376 | 360 | { |
| 377 | 361 | $this->_helper->json(array('status'=>'No action')); |
| 378 | 362 | return; |
@@ -389,8 +373,7 @@ discard block |
||
| 389 | 373 | // Eval |
| 390 | 374 | $item=0; |
| 391 | 375 | $rule=$Trap->ruleClass->evaluation($rule,$item); |
| 392 | - } |
|
| 393 | - catch (Exception $e) |
|
| 376 | + } catch (Exception $e) |
|
| 394 | 377 | { |
| 395 | 378 | $this->_helper->json(array('status'=>'Evaluation error : '.$e->getMessage() )); |
| 396 | 379 | return; |
@@ -412,8 +395,7 @@ discard block |
||
| 412 | 395 | if (isset($postData['name'])) |
| 413 | 396 | { |
| 414 | 397 | $pluginName=$postData['name']; |
| 415 | - } |
|
| 416 | - else |
|
| 398 | + } else |
|
| 417 | 399 | { |
| 418 | 400 | $this->_helper->json(array('status'=>'No plugin name')); |
| 419 | 401 | } |
@@ -425,8 +407,7 @@ discard block |
||
| 425 | 407 | $this->_helper->json(array('status'=>'unknown action '.$action)); |
| 426 | 408 | return; |
| 427 | 409 | } |
| 428 | - } |
|
| 429 | - else |
|
| 410 | + } else |
|
| 430 | 411 | { |
| 431 | 412 | $this->_helper->json(array('status'=>'No action')); |
| 432 | 413 | return; |
@@ -441,8 +422,7 @@ discard block |
||
| 441 | 422 | $action=($action == 'enable') ? true : false; |
| 442 | 423 | $retVal=$Trap->pluginClass->enablePlugin($pluginName, $action); |
| 443 | 424 | |
| 444 | - } |
|
| 445 | - catch (Exception $e) |
|
| 425 | + } catch (Exception $e) |
|
| 446 | 426 | { |
| 447 | 427 | $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() )); |
| 448 | 428 | return; |
@@ -450,8 +430,7 @@ discard block |
||
| 450 | 430 | if ($retVal === true) |
| 451 | 431 | { |
| 452 | 432 | $this->_helper->json(array('status'=>'OK')); |
| 453 | - } |
|
| 454 | - else |
|
| 433 | + } else |
|
| 455 | 434 | { |
| 456 | 435 | $this->_helper->json(array('status'=>'Error, see logs')); |
| 457 | 436 | } |
@@ -468,8 +447,7 @@ discard block |
||
| 468 | 447 | if (isset($postData['function'])) |
| 469 | 448 | { |
| 470 | 449 | $functionString=$postData['function']; |
| 471 | - } |
|
| 472 | - else |
|
| 450 | + } else |
|
| 473 | 451 | { |
| 474 | 452 | $this->_helper->json(array('status'=>'No function name')); |
| 475 | 453 | } |
@@ -481,8 +459,7 @@ discard block |
||
| 481 | 459 | $this->_helper->json(array('status'=>'unknown action '.$action)); |
| 482 | 460 | return; |
| 483 | 461 | } |
| 484 | - } |
|
| 485 | - else |
|
| 462 | + } else |
|
| 486 | 463 | { |
| 487 | 464 | $this->_helper->json(array('status'=>'No action')); |
| 488 | 465 | return; |
@@ -499,8 +476,7 @@ discard block |
||
| 499 | 476 | $functionString = $Trap->ruleClass->eval_cleanup($functionString); |
| 500 | 477 | // Eval functions |
| 501 | 478 | $result = $Trap->pluginClass->evaluateFunctionString($functionString); |
| 502 | - } |
|
| 503 | - catch (Exception $e) |
|
| 479 | + } catch (Exception $e) |
|
| 504 | 480 | { |
| 505 | 481 | $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() )); |
| 506 | 482 | return; |