@@ -84,10 +84,11 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $host = $this->getHostByFilter( |
| 86 | 86 | 'host.__name=="'. $name .'"'); |
| 87 | - if (isset($host[0])) |
|
| 88 | - return $host[0]; |
|
| 89 | - else |
|
| 90 | - return NULL; |
|
| 87 | + if (isset($host[0])) { |
|
| 88 | + return $host[0]; |
|
| 89 | + } else { |
|
| 90 | + return NULL; |
|
| 91 | + } |
|
| 91 | 92 | } |
| 92 | 93 | |
| 93 | 94 | /** |
@@ -173,8 +174,7 @@ discard block |
||
| 173 | 174 | { |
| 174 | 175 | $serviceList[$service->name]= |
| 175 | 176 | array('num'=> 1 ,'__name' => $service->__name,'display_name' => $service->display_name); |
| 176 | - } |
|
| 177 | - else |
|
| 177 | + } else |
|
| 178 | 178 | { |
| 179 | 179 | $serviceList[$service->name]['num']++; |
| 180 | 180 | } |
@@ -131,9 +131,11 @@ discard block |
||
| 131 | 131 | $this->icingaAPI = new Icinga2API($host,$port); |
| 132 | 132 | $this->icingaAPI->setCredentials($user, $pass); |
| 133 | 133 | list($ret,$message) = $this->icingaAPI->test($this->getModuleConfig()->getapiUserPermissions()); |
| 134 | - if ($ret === TRUE) // On error, switch to ido DB |
|
| 134 | + if ($ret === TRUE) { |
|
| 135 | + // On error, switch to ido DB |
|
| 135 | 136 | { |
| 136 | 137 | $this->apiMode = FALSE; |
| 138 | + } |
|
| 137 | 139 | return $this->getUIDatabase(); |
| 138 | 140 | } |
| 139 | 141 | $this->apiMode = TRUE; |
@@ -213,7 +215,9 @@ discard block |
||
| 213 | 215 | if ($this->MIBData == null) |
| 214 | 216 | { |
| 215 | 217 | $dbConn = $this->getUIDatabase()->getDbConn(); |
| 216 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 218 | + if ($dbConn === null) { |
|
| 219 | + throw new \ErrorException('uncatched db error'); |
|
| 220 | + } |
|
| 217 | 221 | $this->MIBData=new MIBLoader( |
| 218 | 222 | $this->Config()->get('config', 'snmptranslate'), |
| 219 | 223 | $this->Config()->get('config', 'snmptranslate_dirs'), |
@@ -283,7 +287,9 @@ discard block |
||
| 283 | 287 | $catString=''; |
| 284 | 288 | foreach ($catArray as $index => $value) |
| 285 | 289 | { |
| 286 | - if ($catString != '' ) $catString .= '!'; |
|
| 290 | + if ($catString != '' ) { |
|
| 291 | + $catString .= '!'; |
|
| 292 | + } |
|
| 287 | 293 | $catString .= $index . ':' . $value; |
| 288 | 294 | } |
| 289 | 295 | $this->getUIDatabase()->setDBConfigValue('handler_categories', $catString); |
@@ -293,8 +299,12 @@ discard block |
||
| 293 | 299 | { |
| 294 | 300 | $catArray = $this->getHandlersCategory(); |
| 295 | 301 | $i=1; |
| 296 | - while (isset($catArray[$i]) && $i < 100) $i++; |
|
| 297 | - if ($i == 100) throw new ProgrammingError('Category array error'); |
|
| 302 | + while (isset($catArray[$i]) && $i < 100) { |
|
| 303 | + $i++; |
|
| 304 | + } |
|
| 305 | + if ($i == 100) { |
|
| 306 | + throw new ProgrammingError('Category array error'); |
|
| 307 | + } |
|
| 298 | 308 | $catArray[$i] = $catName; |
| 299 | 309 | $this->setHandlerCategory($catArray); |
| 300 | 310 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | $this->prepareTabs()->activate('status'); |
| 26 | 26 | |
| 27 | 27 | $dbConn = $this->getUIDatabase()->getDb(); |
| 28 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 28 | + if ($dbConn === null) { |
|
| 29 | + throw new \ErrorException('uncatched db error'); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $handlerTable = new HandlerTable( |
| 31 | 33 | $this->moduleConfig->getTrapRuleName(), |
@@ -84,8 +86,7 @@ discard block |
||
| 84 | 86 | if ($this->params->get('rule') !== null) |
| 85 | 87 | { |
| 86 | 88 | $this->view->rule= $this->params->get('rule'); |
| 87 | - } |
|
| 88 | - else |
|
| 89 | + } else |
|
| 89 | 90 | { |
| 90 | 91 | $this->view->rule=''; |
| 91 | 92 | } |
@@ -139,8 +140,7 @@ discard block |
||
| 139 | 140 | try |
| 140 | 141 | { |
| 141 | 142 | $hosts=$this->getIdoConn()->getHostByIP($hostfilter); |
| 142 | - } |
|
| 143 | - catch (Exception $e) |
|
| 143 | + } catch (Exception $e) |
|
| 144 | 144 | { |
| 145 | 145 | $this->displayExitError('Add handler : get host by IP/Name ',$e->getMessage()); |
| 146 | 146 | } |
@@ -153,8 +153,7 @@ discard block |
||
| 153 | 153 | // Tell JS to get services when page is loaded |
| 154 | 154 | $this->view->serviceGet=true; |
| 155 | 155 | |
| 156 | - } |
|
| 157 | - else |
|
| 156 | + } else |
|
| 158 | 157 | { |
| 159 | 158 | foreach($hosts as $key=>$val) |
| 160 | 159 | { |
@@ -204,11 +203,14 @@ discard block |
||
| 204 | 203 | $allObjects[$val->oid]=null; |
| 205 | 204 | } |
| 206 | 205 | } |
| 207 | - if ($allObjects!=null) // in case trap doesn't have objects or is not resolved |
|
| 206 | + if ($allObjects!=null) { |
|
| 207 | + // in case trap doesn't have objects or is not resolved |
|
| 208 | 208 | { |
| 209 | 209 | foreach ($allObjects as $key => $val) |
| 210 | 210 | { |
| 211 | - if ($val==null) { continue; } |
|
| 211 | + if ($val==null) { continue; |
|
| 212 | + } |
|
| 213 | + } |
|
| 212 | 214 | array_push($this->view->objectList, array( |
| 213 | 215 | $oid_index, |
| 214 | 216 | $key, |
@@ -240,8 +242,7 @@ discard block |
||
| 240 | 242 | { |
| 241 | 243 | $this->view->warning_message='Host '.$this->view->hostname. ' doesn\'t exists anymore'; |
| 242 | 244 | $this->view->serviceGet=false; |
| 243 | - } |
|
| 244 | - else |
|
| 245 | + } else |
|
| 245 | 246 | { |
| 246 | 247 | // Tell JS to get services when page is loaded |
| 247 | 248 | $this->view->serviceGet=true; |
@@ -250,8 +251,7 @@ discard block |
||
| 250 | 251 | if (count($serviceID) ==0) |
| 251 | 252 | { |
| 252 | 253 | $this->view->warning_message=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore'; |
| 253 | - } |
|
| 254 | - else |
|
| 254 | + } else |
|
| 255 | 255 | { |
| 256 | 256 | $this->view->serviceSet=$serviceID[0]->id; |
| 257 | 257 | } |
@@ -270,8 +270,7 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | $this->view->warning_message='HostGroup '.$this->view->hostgroupname. ' doesn\'t exists anymore'; |
| 272 | 272 | $this->view->serviceGroupGet=false; |
| 273 | - } |
|
| 274 | - else |
|
| 273 | + } else |
|
| 275 | 274 | { |
| 276 | 275 | $grpServices=$this->getIdoConn()->getServicesByHostGroupid($group_get[0]->id); |
| 277 | 276 | $foundGrpService=0; |
@@ -323,8 +322,7 @@ discard block |
||
| 323 | 322 | $object['type'], |
| 324 | 323 | $object['type_enum'] |
| 325 | 324 | )); |
| 326 | - } |
|
| 327 | - else |
|
| 325 | + } else |
|
| 328 | 326 | { |
| 329 | 327 | array_push($curObjectList, array( |
| 330 | 328 | $index, |
@@ -402,8 +400,7 @@ discard block |
||
| 402 | 400 | $this->view->selectGroup=false; |
| 403 | 401 | // Check if hostname still exists |
| 404 | 402 | $this->add_check_host_exists($ruleDetail); |
| 405 | - } |
|
| 406 | - else |
|
| 403 | + } else |
|
| 407 | 404 | { |
| 408 | 405 | $this->view->selectGroup=true; |
| 409 | 406 | $this->add_check_hostgroup_exists($ruleDetail); // Check if groupe exists |
@@ -411,9 +408,11 @@ discard block |
||
| 411 | 408 | |
| 412 | 409 | $this->view->mainoid=$ruleDetail->trap_oid; |
| 413 | 410 | $oidName=$this->getMIB()->translateOID($ruleDetail->trap_oid); |
| 414 | - if ($oidName != null) // oid is found in mibs |
|
| 411 | + if ($oidName != null) { |
|
| 412 | + // oid is found in mibs |
|
| 415 | 413 | { |
| 416 | - $this->view->mib=$oidName['mib']; |
|
| 414 | + $this->view->mib=$oidName['mib']; |
|
| 415 | + } |
|
| 417 | 416 | $this->view->name=$oidName['name']; |
| 418 | 417 | $this->view->trapListForMIB=$this->getMIB() |
| 419 | 418 | ->getTrapList($oidName['mib']); |
@@ -470,8 +469,7 @@ discard block |
||
| 470 | 469 | try |
| 471 | 470 | { |
| 472 | 471 | $this->getUIDatabase()->deleteRule($postData[$params['db_rule']['post']]); |
| 473 | - } |
|
| 474 | - catch (Exception $e) |
|
| 472 | + } catch (Exception $e) |
|
| 475 | 473 | { |
| 476 | 474 | $this->_helper->json(array('status'=>$e->getMessage(),'location'=>'Deleting Rule')); |
| 477 | 475 | return; |
@@ -485,13 +483,15 @@ discard block |
||
| 485 | 483 | } |
| 486 | 484 | foreach (array_keys($params) as $key) |
| 487 | 485 | { |
| 488 | - if ($params[$key]['post']==null) continue; // data not sent in post vars |
|
| 486 | + if ($params[$key]['post']==null) { |
|
| 487 | + continue; |
|
| 488 | + } |
|
| 489 | + // data not sent in post vars |
|
| 489 | 490 | if (! isset($postData[$params[$key]['post']])) |
| 490 | 491 | { |
| 491 | 492 | // should not happen as the js checks data |
| 492 | 493 | $this->_helper->json(array('status'=>'No ' . $key)); |
| 493 | - } |
|
| 494 | - else |
|
| 494 | + } else |
|
| 495 | 495 | { |
| 496 | 496 | $data=$postData[$params[$key]['post']]; |
| 497 | 497 | if ($data!=null && $data !="") |
@@ -507,7 +507,9 @@ discard block |
||
| 507 | 507 | if (! $isHostGroup ) |
| 508 | 508 | { // checks if selection by host |
| 509 | 509 | $hostAddr=$this->getIdoConn()->getHostInfoByID($params['hostid']['val']); |
| 510 | - if ($hostAddr === NULL) throw new \Exception("No object found"); |
|
| 510 | + if ($hostAddr === NULL) { |
|
| 511 | + throw new \Exception("No object found"); |
|
| 512 | + } |
|
| 511 | 513 | $params['ip4']['val']=$hostAddr->ip4; |
| 512 | 514 | $params['ip6']['val']=$hostAddr->ip6; |
| 513 | 515 | $checkHostName=$hostAddr->name; |
@@ -524,8 +526,7 @@ discard block |
||
| 524 | 526 | $this->_helper->json(array('status'=>"Invalid service id : Please re enter service",'sent'=>$params['serviceid']['val'],'found'=>$serviceName[0]->__name)); |
| 525 | 527 | return; |
| 526 | 528 | } |
| 527 | - } |
|
| 528 | - else |
|
| 529 | + } else |
|
| 529 | 530 | { |
| 530 | 531 | if (!is_numeric($params['serviceid']['val'])) |
| 531 | 532 | { |
@@ -540,8 +541,7 @@ discard block |
||
| 540 | 541 | return; |
| 541 | 542 | } |
| 542 | 543 | } |
| 543 | - } |
|
| 544 | - else |
|
| 544 | + } else |
|
| 545 | 545 | { |
| 546 | 546 | if ($this->apiMode == TRUE) |
| 547 | 547 | { |
@@ -551,8 +551,7 @@ discard block |
||
| 551 | 551 | $this->_helper->json(array('status'=>"Invalid object group id : Please re enter service")); |
| 552 | 552 | return; |
| 553 | 553 | } |
| 554 | - } |
|
| 555 | - else |
|
| 554 | + } else |
|
| 556 | 555 | { |
| 557 | 556 | $object=$this->getUIDatabase()->getObjectNameByid($params['hostid']['val']); |
| 558 | 557 | if ($params['host_name']['val'] != $object->name1) |
@@ -578,14 +577,12 @@ discard block |
||
| 578 | 577 | if ($params['db_rule']['val'] == -1 || $params['action_form']['val'] == 'clone') |
| 579 | 578 | { // If no rule number or action is clone, add the handler |
| 580 | 579 | $ruleID=$this->getUIDatabase()->addHandlerRule($dbparams); |
| 581 | - } |
|
| 582 | - else |
|
| 580 | + } else |
|
| 583 | 581 | { |
| 584 | 582 | $this->getUIDatabase()->updateHandlerRule($dbparams,$params['db_rule']['val']); |
| 585 | 583 | $ruleID=$params['db_rule']['val']; |
| 586 | 584 | } |
| 587 | - } |
|
| 588 | - catch (Exception $e) |
|
| 585 | + } catch (Exception $e) |
|
| 589 | 586 | { |
| 590 | 587 | $this->_helper->json(array('status'=>$e->getMessage(),'location'=>'Add/update Rule','line'=>$e->getLine(),'file'=>$e->getFile())); |
| 591 | 588 | return; |
@@ -604,7 +601,9 @@ discard block |
||
| 604 | 601 | $queryArray=$this->getModuleConfig()->trapDetailQuery(); |
| 605 | 602 | |
| 606 | 603 | $dbConn = $this->getUIDatabase()->getDbConn(); |
| 607 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 604 | + if ($dbConn === null) { |
|
| 605 | + throw new \ErrorException('uncatched db error'); |
|
| 606 | + } |
|
| 608 | 607 | // *************** Get main data |
| 609 | 608 | // extract columns and titles; |
| 610 | 609 | $elmts=NULL; |
@@ -622,8 +621,7 @@ discard block |
||
| 622 | 621 | $trapDetail = 'NULL'; |
| 623 | 622 | throw new Exception('No traps was found with id = '.$trapid); |
| 624 | 623 | } |
| 625 | - } |
|
| 626 | - catch (Exception $e) |
|
| 624 | + } catch (Exception $e) |
|
| 627 | 625 | { |
| 628 | 626 | $this->displayExitError('Add handler : get trap detail returning : '.print_r($trapDetail,true),$e->getMessage()); |
| 629 | 627 | return; |
@@ -643,7 +641,9 @@ discard block |
||
| 643 | 641 | $queryArrayData=$this->getModuleConfig()->trapDataDetailQuery(); |
| 644 | 642 | |
| 645 | 643 | $dbConn = $this->getUIDatabase()->getDbConn(); |
| 646 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 644 | + if ($dbConn === null) { |
|
| 645 | + throw new \ErrorException('uncatched db error'); |
|
| 646 | + } |
|
| 647 | 647 | // *************** Get object data |
| 648 | 648 | // extract columns and titles; |
| 649 | 649 | $data_elmts=NULL; |
@@ -657,8 +657,7 @@ discard block |
||
| 657 | 657 | ->where('trap_id=?',$trapid); |
| 658 | 658 | $trapDetail=$dbConn->fetchAll($query); |
| 659 | 659 | // if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid); |
| 660 | - } |
|
| 661 | - catch (Exception $e) |
|
| 660 | + } catch (Exception $e) |
|
| 662 | 661 | { |
| 663 | 662 | $this->displayExitError('Add handler : get trap data detail : ',$e->getMessage()); |
| 664 | 663 | return array(); |
@@ -678,7 +677,9 @@ discard block |
||
| 678 | 677 | $queryArray=$this->getModuleConfig()->ruleDetailQuery(); |
| 679 | 678 | |
| 680 | 679 | $dbConn = $this->getUIDatabase()->getDbConn(); |
| 681 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 680 | + if ($dbConn === null) { |
|
| 681 | + throw new \ErrorException('uncatched db error'); |
|
| 682 | + } |
|
| 682 | 683 | // *************** Get main data |
| 683 | 684 | try |
| 684 | 685 | { |
@@ -686,9 +687,10 @@ discard block |
||
| 686 | 687 | ->from($this->getModuleConfig()->getTrapRuleName(),$queryArray) |
| 687 | 688 | ->where('id=?',$ruleid); |
| 688 | 689 | $ruleDetail=$dbConn->fetchRow($query); |
| 689 | - if ( $ruleDetail == null ) throw new Exception('No rule was found with id = '.$ruleid); |
|
| 690 | - } |
|
| 691 | - catch (Exception $e) |
|
| 690 | + if ( $ruleDetail == null ) { |
|
| 691 | + throw new Exception('No rule was found with id = '.$ruleid); |
|
| 692 | + } |
|
| 693 | + } catch (Exception $e) |
|
| 692 | 694 | { |
| 693 | 695 | $this->displayExitError('Update handler : get rule detail',$e->getMessage()); |
| 694 | 696 | throw new Exception('Error : ' . $e->getMessage()); |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $hosts=$this->getIdoConn()->getHostByNameOrIP($hostFilter); |
| 28 | 28 | $retHosts['test']=count($hosts); |
| 29 | - } |
|
| 30 | - else |
|
| 29 | + } else |
|
| 31 | 30 | { |
| 32 | 31 | $hosts=$this->getIdoConn()->getHostByIP($hostFilter); |
| 33 | 32 | } |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | if (isset($postData['host'])) |
| 74 | 73 | { |
| 75 | 74 | $host=$postData['host']; |
| 76 | - } |
|
| 77 | - else |
|
| 75 | + } else |
|
| 78 | 76 | { |
| 79 | 77 | $this->_helper->json(array('status'=>'No Hosts','hostid' => -1)); |
| 80 | 78 | return; |
@@ -85,8 +83,7 @@ discard block |
||
| 85 | 83 | { |
| 86 | 84 | $this->_helper->json(array('status'=>'More than one host matches','hostid' => -1)); |
| 87 | 85 | return; |
| 88 | - } |
|
| 89 | - else if (count($hostArray) == 0) |
|
| 86 | + } else if (count($hostArray) == 0) |
|
| 90 | 87 | { |
| 91 | 88 | $this->_helper->json(array('status'=>'No host matches','hostid' => -1)); |
| 92 | 89 | return; |
@@ -122,8 +119,7 @@ discard block |
||
| 122 | 119 | { |
| 123 | 120 | $this->_helper->json(array('status'=>'More than one hostgroup matches','hostid' => -1)); |
| 124 | 121 | return; |
| 125 | - } |
|
| 126 | - else if (count($hostArray) == 0) |
|
| 122 | + } else if (count($hostArray) == 0) |
|
| 127 | 123 | { |
| 128 | 124 | $this->_helper->json(array('status'=>'No hostgroup matches','hostid' => -1)); |
| 129 | 125 | return; |
@@ -154,8 +150,7 @@ discard block |
||
| 154 | 150 | { |
| 155 | 151 | $traplist=$this->getMIB()->getTrapList($mib); |
| 156 | 152 | $retTraps=array('status'=>'OK','traps' => $traplist); |
| 157 | - } |
|
| 158 | - catch (Exception $e) |
|
| 153 | + } catch (Exception $e) |
|
| 159 | 154 | { |
| 160 | 155 | $retTraps=array('status' => 'Error getting mibs'); |
| 161 | 156 | } |
@@ -177,8 +172,7 @@ discard block |
||
| 177 | 172 | { |
| 178 | 173 | $objectlist=$this->getMIB()->getObjectList($trap); |
| 179 | 174 | $retObjects=array('status'=>'OK','objects' => $objectlist); |
| 180 | - } |
|
| 181 | - catch (Exception $e) |
|
| 175 | + } catch (Exception $e) |
|
| 182 | 176 | { |
| 183 | 177 | $retObjects=array('status' => 'not found'); |
| 184 | 178 | } |
@@ -193,8 +187,7 @@ discard block |
||
| 193 | 187 | try |
| 194 | 188 | { |
| 195 | 189 | $miblist=$this->getMIB()->getMIBList(); |
| 196 | - } |
|
| 197 | - catch (Exception $e) |
|
| 190 | + } catch (Exception $e) |
|
| 198 | 191 | { |
| 199 | 192 | $miblist=array('Error getting mibs'); |
| 200 | 193 | } |
@@ -217,8 +210,7 @@ discard block |
||
| 217 | 210 | { |
| 218 | 211 | $this->_helper->json(array('status'=>'Not found')); |
| 219 | 212 | return; |
| 220 | - } |
|
| 221 | - else |
|
| 213 | + } else |
|
| 222 | 214 | { |
| 223 | 215 | $this->_helper->json( |
| 224 | 216 | array('status'=>'OK', |
@@ -253,8 +245,7 @@ discard block |
||
| 253 | 245 | try |
| 254 | 246 | { |
| 255 | 247 | $this->getUIDatabase()->setDBConfigValue('db_remove_days',$days); |
| 256 | - } |
|
| 257 | - catch (Exception $e) |
|
| 248 | + } catch (Exception $e) |
|
| 258 | 249 | { |
| 259 | 250 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
| 260 | 251 | return; |
@@ -272,8 +263,7 @@ discard block |
||
| 272 | 263 | $trap = new Trap($icingaweb2_etc); |
| 273 | 264 | $trap->setLogging($debug_level,'syslog'); |
| 274 | 265 | $trap->eraseOldTraps($days); |
| 275 | - } |
|
| 276 | - catch (Exception $e) |
|
| 266 | + } catch (Exception $e) |
|
| 277 | 267 | { |
| 278 | 268 | $this->_helper->json(array('status'=>'execute error : '.$e->getMessage() )); |
| 279 | 269 | return; |
@@ -300,8 +290,7 @@ discard block |
||
| 300 | 290 | { |
| 301 | 291 | $this->getUIDatabase()->setDBConfigValue('use_SnmpTrapAddess',$snmpUse); |
| 302 | 292 | $this->getUIDatabase()->setDBConfigValue('SnmpTrapAddess_oid',$snmpOID); |
| 303 | - } |
|
| 304 | - catch (Exception $e) |
|
| 293 | + } catch (Exception $e) |
|
| 305 | 294 | { |
| 306 | 295 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
| 307 | 296 | return; |
@@ -338,14 +327,12 @@ discard block |
||
| 338 | 327 | $this->_helper->json(array('status'=>'File not writable : '.$file)); |
| 339 | 328 | return; |
| 340 | 329 | } |
| 341 | - } |
|
| 342 | - else |
|
| 330 | + } else |
|
| 343 | 331 | { |
| 344 | 332 | if ($destination != 'file') |
| 345 | 333 | { |
| 346 | 334 | $file=null; |
| 347 | - } |
|
| 348 | - else |
|
| 335 | + } else |
|
| 349 | 336 | { |
| 350 | 337 | $this->_helper->json(array('status'=>'No file')); |
| 351 | 338 | return; |
@@ -359,8 +346,7 @@ discard block |
||
| 359 | 346 | $this->getUIDatabase()->setDBConfigValue('log_destination',$destination); |
| 360 | 347 | $this->getUIDatabase()->setDBConfigValue('log_file',$file); |
| 361 | 348 | $this->getUIDatabase()->setDBConfigValue('log_level',$level); |
| 362 | - } |
|
| 363 | - catch (Exception $e) |
|
| 349 | + } catch (Exception $e) |
|
| 364 | 350 | { |
| 365 | 351 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
| 366 | 352 | return; |
@@ -396,8 +382,7 @@ discard block |
||
| 396 | 382 | // Eval |
| 397 | 383 | $item=0; |
| 398 | 384 | $rule=$trap->ruleClass->evaluation($rule,$item); |
| 399 | - } |
|
| 400 | - catch (Exception $e) |
|
| 385 | + } catch (Exception $e) |
|
| 401 | 386 | { |
| 402 | 387 | $this->_helper->json(array('status'=>'Evaluation error : '.$e->getMessage() )); |
| 403 | 388 | return; |
@@ -430,8 +415,7 @@ discard block |
||
| 430 | 415 | $action=($action == 'enable') ? true : false; |
| 431 | 416 | $retVal=$trap->pluginClass->enablePlugin($pluginName, $action); |
| 432 | 417 | |
| 433 | - } |
|
| 434 | - catch (Exception $e) |
|
| 418 | + } catch (Exception $e) |
|
| 435 | 419 | { |
| 436 | 420 | $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() )); |
| 437 | 421 | return; |
@@ -439,8 +423,7 @@ discard block |
||
| 439 | 423 | if ($retVal === true) |
| 440 | 424 | { |
| 441 | 425 | $this->_helper->json(array('status'=>'OK')); |
| 442 | - } |
|
| 443 | - else |
|
| 426 | + } else |
|
| 444 | 427 | { |
| 445 | 428 | $this->_helper->json(array('status'=>'Error, see logs')); |
| 446 | 429 | } |
@@ -471,8 +454,7 @@ discard block |
||
| 471 | 454 | $functionString = $trap->ruleClass->eval_cleanup($functionString); |
| 472 | 455 | // Eval functions |
| 473 | 456 | $result = $trap->pluginClass->evaluateFunctionString($functionString); |
| 474 | - } |
|
| 475 | - catch (Exception $e) |
|
| 457 | + } catch (Exception $e) |
|
| 476 | 458 | { |
| 477 | 459 | $this->_helper->json(array('status'=>'Action error : '.$e->getMessage() )); |
| 478 | 460 | return; |