@@ -40,8 +40,7 @@ |
||
40 | 40 | $query = $dataBase->select()->from($Config->getTrapRuleName(),array('COUNT(*)')); |
41 | 41 | printf("Number of rules : %s\n", $dataBase->fetchOne($query) ); |
42 | 42 | |
43 | - } |
|
44 | - catch (Exception $e) |
|
43 | + } catch (Exception $e) |
|
45 | 44 | { |
46 | 45 | printf('Error in DB : %s\n', $e->getMessage()); |
47 | 46 | } |
@@ -42,14 +42,12 @@ discard block |
||
42 | 42 | if ($days=='<default>') |
43 | 43 | { |
44 | 44 | $trap->eraseOldTraps(); |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | $trap->eraseOldTraps($days); |
49 | 48 | } |
50 | 49 | |
51 | - } |
|
52 | - catch (Exception $e) |
|
50 | + } catch (Exception $e) |
|
53 | 51 | { |
54 | 52 | echo 'Error in updating : ' . $e->getMessage(); |
55 | 53 | } |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | try |
75 | 73 | { |
76 | 74 | $trap->reset_services(); |
77 | - } |
|
78 | - catch (Exception $e) |
|
75 | + } catch (Exception $e) |
|
79 | 76 | { |
80 | 77 | echo 'ERROR : '. $e->getMessage(); |
81 | 78 | } |
@@ -256,7 +256,9 @@ discard block |
||
256 | 256 | $first=1; |
257 | 257 | foreach($this->moduleConfig->getTrapListSearchColumns() as $column) |
258 | 258 | { |
259 | - if ($first==0) $sql.=' OR '; |
|
259 | + if ($first==0) { |
|
260 | + $sql.=' OR '; |
|
261 | + } |
|
260 | 262 | $first=0; |
261 | 263 | $sql.=" ".$column." LIKE '%".$this->filter_query."%' "; |
262 | 264 | } |
@@ -264,10 +266,14 @@ discard block |
||
264 | 266 | } |
265 | 267 | if ($this->filter_done == 1) |
266 | 268 | { |
267 | - if ($sql != '') $sql.=' AND '; |
|
269 | + if ($sql != '') { |
|
270 | + $sql.=' AND '; |
|
271 | + } |
|
268 | 272 | $sql.="(status != 'done')"; |
269 | 273 | } |
270 | - if ($sql != '') $query->where($sql); |
|
274 | + if ($sql != '') { |
|
275 | + $query->where($sql); |
|
276 | + } |
|
271 | 277 | return $query; |
272 | 278 | } |
273 | 279 |
@@ -99,13 +99,11 @@ discard block |
||
99 | 99 | if (isset($oidName['name'])) |
100 | 100 | { |
101 | 101 | $val=$oidName['name']; |
102 | - } |
|
103 | - else |
|
102 | + } else |
|
104 | 103 | { |
105 | 104 | $val = $row->$rowkey; |
106 | 105 | } |
107 | - } |
|
108 | - else |
|
106 | + } else |
|
109 | 107 | { |
110 | 108 | $val = $row->$rowkey; |
111 | 109 | } |
@@ -114,8 +112,7 @@ discard block |
||
114 | 112 | if ($row->$rowkey == null) |
115 | 113 | { |
116 | 114 | $val = $row->host_group_name; |
117 | - } |
|
118 | - else |
|
115 | + } else |
|
119 | 116 | { |
120 | 117 | $val = $row->$rowkey; |
121 | 118 | } |
@@ -214,7 +214,9 @@ discard block |
||
214 | 214 | $first=1; |
215 | 215 | foreach($this->moduleConfig->getTrapListSearchColumns() as $column) |
216 | 216 | { |
217 | - if ($first==0) $sql.=' OR '; |
|
217 | + if ($first==0) { |
|
218 | + $sql.=' OR '; |
|
219 | + } |
|
218 | 220 | $first=0; |
219 | 221 | $sql.=" CAST(".$column." AS char(100)) LIKE '%".$this->filter_query."%' "; |
220 | 222 | } |
@@ -222,10 +224,14 @@ discard block |
||
222 | 224 | } |
223 | 225 | if ($this->filter_done == 1) |
224 | 226 | { |
225 | - if ($sql != '') $sql.=' AND '; |
|
227 | + if ($sql != '') { |
|
228 | + $sql.=' AND '; |
|
229 | + } |
|
226 | 230 | $sql.="(status != 'done')"; |
227 | 231 | } |
228 | - if ($sql != '') $query->where($sql); |
|
232 | + if ($sql != '') { |
|
233 | + $query->where($sql); |
|
234 | + } |
|
229 | 235 | return $query; |
230 | 236 | } |
231 | 237 |
@@ -164,8 +164,7 @@ discard block |
||
164 | 164 | if (property_exists($result,'status')) |
165 | 165 | { |
166 | 166 | $message=$result->status; |
167 | - } |
|
168 | - else |
|
167 | + } else |
|
169 | 168 | { |
170 | 169 | $message="Unkown status"; |
171 | 170 | } |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | if (isset($result->results[0])) |
177 | 176 | { |
178 | 177 | return array(true,'code '.$result->results[0]->code.' : '.$result->results[0]->status); |
179 | - } |
|
180 | - else |
|
178 | + } else |
|
181 | 179 | { |
182 | 180 | return array(false,'Service not found'); |
183 | 181 | } |
@@ -219,8 +217,7 @@ discard block |
||
219 | 217 | if (property_exists($result,'status')) |
220 | 218 | { |
221 | 219 | throw new Exception('Ret code ' .$result->error.' : ' . $result->status); |
222 | - } |
|
223 | - else |
|
220 | + } else |
|
224 | 221 | { |
225 | 222 | throw new Exception('Ret code ' .$result->error.' : Unkown status'); |
226 | 223 | } |
@@ -265,8 +262,7 @@ discard block |
||
265 | 262 | if (property_exists($result,'status')) |
266 | 263 | { |
267 | 264 | throw new Exception('Ret code ' .$result->error.' : ' . $result->status); |
268 | - } |
|
269 | - else |
|
265 | + } else |
|
270 | 266 | { |
271 | 267 | throw new Exception('Ret code ' .$result->error.' : Unkown status'); |
272 | 268 | } |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | if (! $input) { |
18 | 18 | $inputStream=fopen('php://stdin', 'r'); |
19 | 19 | $rule=chop(fgets($inputStream)); |
20 | -} else |
|
20 | +} else { |
|
21 | 21 | $rule=$options['r']; |
22 | +} |
|
22 | 23 | |
23 | 24 | try |
24 | 25 | { |
@@ -28,8 +29,7 @@ discard block |
||
28 | 29 | $val = $trap->evaluation($rule,$item); |
29 | 30 | if ($val==true) { printf( "true"); } else { printf( "false");} |
30 | 31 | printf("\n"); |
31 | -} |
|
32 | -catch (Exception $e) { printf("%s\n",$e->getMessage()); exit(1);} |
|
32 | +} catch (Exception $e) { printf("%s\n",$e->getMessage()); exit(1);} |
|
33 | 33 | |
34 | 34 | exit(0); |
35 | 35 | ?> |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | if ($this->params->get('rule') !== null) |
52 | 52 | { |
53 | 53 | $this->view->rule= $this->params->get('rule'); |
54 | - } |
|
55 | - else |
|
54 | + } else |
|
56 | 55 | { |
57 | 56 | $this->view->rule=''; |
58 | 57 | } |
@@ -113,8 +112,7 @@ discard block |
||
113 | 112 | try |
114 | 113 | { |
115 | 114 | $hosts=$this->getHostByIP($hostfilter); |
116 | - } |
|
117 | - catch (Exception $e) |
|
115 | + } catch (Exception $e) |
|
118 | 116 | { |
119 | 117 | $this->displayExitError('Add handler : get host by IP/Name ',$e->getMessage()); |
120 | 118 | } |
@@ -127,8 +125,7 @@ discard block |
||
127 | 125 | // Tell JS to get services when page is loaded |
128 | 126 | $this->view->serviceGet=true; |
129 | 127 | |
130 | - } |
|
131 | - else |
|
128 | + } else |
|
132 | 129 | { |
133 | 130 | foreach($hosts as $key=>$val) |
134 | 131 | { |
@@ -178,11 +175,14 @@ discard block |
||
178 | 175 | $allObjects[$val->oid]=null; |
179 | 176 | } |
180 | 177 | } |
181 | - if ($allObjects!=null) // in case trap doesn't have objects or is not resolved |
|
178 | + if ($allObjects!=null) { |
|
179 | + // in case trap doesn't have objects or is not resolved |
|
182 | 180 | { |
183 | 181 | foreach ($allObjects as $key => $val) |
184 | 182 | { |
185 | - if ($val==null) { continue; } |
|
183 | + if ($val==null) { continue; |
|
184 | + } |
|
185 | + } |
|
186 | 186 | array_push($this->view->objectList, array( |
187 | 187 | $oid_index, |
188 | 188 | $key, |
@@ -231,8 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | $this->view->warning_message='Host '.$this->view->hostname. ' doesn\'t exists anymore'; |
233 | 233 | $this->view->serviceGet=false; |
234 | - } |
|
235 | - else |
|
234 | + } else |
|
236 | 235 | { |
237 | 236 | // Tell JS to get services when page is loaded |
238 | 237 | $this->view->serviceGet=true; |
@@ -241,14 +240,12 @@ discard block |
||
241 | 240 | if (count($serviceID) ==0) |
242 | 241 | { |
243 | 242 | $this->view->warning_message=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore'; |
244 | - } |
|
245 | - else |
|
243 | + } else |
|
246 | 244 | { |
247 | 245 | $this->view->serviceSet=$serviceID[0]->id; |
248 | 246 | } |
249 | 247 | } |
250 | - } |
|
251 | - else |
|
248 | + } else |
|
252 | 249 | { |
253 | 250 | $this->view->selectGroup=true; |
254 | 251 | // Check if groupe exists |
@@ -257,8 +254,7 @@ discard block |
||
257 | 254 | { |
258 | 255 | $this->view->warning_message='HostGroup '.$this->view->hostgroupname. ' doesn\'t exists anymore'; |
259 | 256 | $this->view->serviceGroupGet=false; |
260 | - } |
|
261 | - else |
|
257 | + } else |
|
262 | 258 | { |
263 | 259 | $grpServices=$this->getServicesByHostGroupid($group_get[0]->id); |
264 | 260 | $foundGrpService=0; |
@@ -281,9 +277,11 @@ discard block |
||
281 | 277 | } |
282 | 278 | $this->view->mainoid=$ruleDetail->trap_oid; |
283 | 279 | $oidName=$this->getMIB()->translateOID($ruleDetail->trap_oid); |
284 | - if ($oidName != null) // oid is found in mibs |
|
280 | + if ($oidName != null) { |
|
281 | + // oid is found in mibs |
|
285 | 282 | { |
286 | - $this->view->mib=$oidName['mib']; |
|
283 | + $this->view->mib=$oidName['mib']; |
|
284 | + } |
|
287 | 285 | $this->view->name=$oidName['name']; |
288 | 286 | $this->view->trapListForMIB=$this->getMIB() |
289 | 287 | ->getTrapList($oidName['mib']); |
@@ -310,8 +308,7 @@ discard block |
||
310 | 308 | $object['type'], |
311 | 309 | $object['type_enum'] |
312 | 310 | )); |
313 | - } |
|
314 | - else |
|
311 | + } else |
|
315 | 312 | { |
316 | 313 | array_push($curObjectList, array( |
317 | 314 | $index, |
@@ -369,8 +366,7 @@ discard block |
||
369 | 366 | try |
370 | 367 | { |
371 | 368 | $this->deleteRule($postData[$params['db_rule']['post']]); |
372 | - } |
|
373 | - catch (Exception $e) |
|
369 | + } catch (Exception $e) |
|
374 | 370 | { |
375 | 371 | $this->_helper->json(array('status'=>$e->getMessage())); |
376 | 372 | return; |
@@ -384,13 +380,15 @@ discard block |
||
384 | 380 | } |
385 | 381 | foreach (array_keys($params) as $key) |
386 | 382 | { |
387 | - if ($params[$key]['post']==null) continue; // data not sent in post vars |
|
383 | + if ($params[$key]['post']==null) { |
|
384 | + continue; |
|
385 | + } |
|
386 | + // data not sent in post vars |
|
388 | 387 | if (! isset($postData[$params[$key]['post']])) |
389 | 388 | { |
390 | 389 | // should not happen as the js checks data |
391 | 390 | $this->_helper->json(array('status'=>'No ' . $key)); |
392 | - } |
|
393 | - else |
|
391 | + } else |
|
394 | 392 | { |
395 | 393 | $data=$postData[$params[$key]['post']]; |
396 | 394 | if ($data!=null && $data !="") |
@@ -420,8 +418,7 @@ discard block |
||
420 | 418 | $this->_helper->json(array('status'=>"Invalid service id : Please re enter service")); |
421 | 419 | return; |
422 | 420 | } |
423 | - } |
|
424 | - else |
|
421 | + } else |
|
425 | 422 | { |
426 | 423 | $object=$this->getObjectNameByid($params['hostid']['val']); |
427 | 424 | if ($params['host_name']['val'] != $object->name1) |
@@ -445,14 +442,12 @@ discard block |
||
445 | 442 | if ($params['db_rule']['val'] == -1 ) |
446 | 443 | { |
447 | 444 | $ruleID=$this->addHandlerRule($dbparams); |
448 | - } |
|
449 | - else |
|
445 | + } else |
|
450 | 446 | { |
451 | 447 | $this->updateHandlerRule($dbparams,$params['db_rule']['val']); |
452 | 448 | $ruleID=$params['db_rule']['val']; |
453 | 449 | } |
454 | - } |
|
455 | - catch (Exception $e) |
|
450 | + } catch (Exception $e) |
|
456 | 451 | { |
457 | 452 | $this->_helper->json(array('status'=>$e->getMessage())); |
458 | 453 | return; |
@@ -483,9 +478,10 @@ discard block |
||
483 | 478 | ->from($this->getModuleConfig()->getTrapTableName(),$elmts) |
484 | 479 | ->where('id=?',$trapid); |
485 | 480 | $trapDetail=$db->fetchRow($query); |
486 | - if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid); |
|
487 | - } |
|
488 | - catch (Exception $e) |
|
481 | + if ( $trapDetail == null ) { |
|
482 | + throw new Exception('No traps was found with id = '.$trapid); |
|
483 | + } |
|
484 | + } catch (Exception $e) |
|
489 | 485 | { |
490 | 486 | $this->displayExitError('Add handler : get trap detail returning : '.print_r($trapDetail,true),$e->getMessage()); |
491 | 487 | return; |
@@ -518,8 +514,7 @@ discard block |
||
518 | 514 | ->where('trap_id=?',$trapid); |
519 | 515 | $trapDetail=$db->fetchAll($query); |
520 | 516 | // if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid); |
521 | - } |
|
522 | - catch (Exception $e) |
|
517 | + } catch (Exception $e) |
|
523 | 518 | { |
524 | 519 | $this->displayExitError('Add handler : get trap data detail : ',$e->getMessage()); |
525 | 520 | return array(); |
@@ -545,9 +540,10 @@ discard block |
||
545 | 540 | ->from($this->getModuleConfig()->getTrapRuleName(),$queryArray) |
546 | 541 | ->where('id=?',$ruleid); |
547 | 542 | $ruleDetail=$db->fetchRow($query); |
548 | - if ( $ruleDetail == null ) throw new Exception('No rule was found with id = '.$ruleid); |
|
549 | - } |
|
550 | - catch (Exception $e) |
|
543 | + if ( $ruleDetail == null ) { |
|
544 | + throw new Exception('No rule was found with id = '.$ruleid); |
|
545 | + } |
|
546 | + } catch (Exception $e) |
|
551 | 547 | { |
552 | 548 | $this->displayExitError('Update handler : get rule detail',$e->getMessage()); |
553 | 549 | return array(); |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | if (isset($postData['hostFilter'])) |
21 | 21 | { |
22 | 22 | $hostFilter=$postData['hostFilter']; |
23 | - } |
|
24 | - else |
|
23 | + } else |
|
25 | 24 | { |
26 | 25 | $this->_helper->json(array('status'=>'KO')); |
27 | 26 | return; |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | if (isset($postData['hostFilter'])) |
49 | 48 | { |
50 | 49 | $hostFilter=$postData['hostFilter']; |
51 | - } |
|
52 | - else |
|
50 | + } else |
|
53 | 51 | { |
54 | 52 | $this->_helper->json(array('status'=>'Error : no filter')); |
55 | 53 | return; |
@@ -79,8 +77,7 @@ discard block |
||
79 | 77 | if (isset($postData['host'])) |
80 | 78 | { |
81 | 79 | $host=$postData['host']; |
82 | - } |
|
83 | - else |
|
80 | + } else |
|
84 | 81 | { |
85 | 82 | $this->_helper->json(array('status'=>'No Hosts','hostid' => -1)); |
86 | 83 | return; |
@@ -91,8 +88,7 @@ discard block |
||
91 | 88 | { |
92 | 89 | $this->_helper->json(array('status'=>'More than one host matches','hostid' => -1)); |
93 | 90 | return; |
94 | - } |
|
95 | - else if (count($hostArray) == 0) |
|
91 | + } else if (count($hostArray) == 0) |
|
96 | 92 | { |
97 | 93 | $this->_helper->json(array('status'=>'No host matches','hostid' => -1)); |
98 | 94 | return; |
@@ -123,8 +119,7 @@ discard block |
||
123 | 119 | if (isset($postData['host'])) |
124 | 120 | { |
125 | 121 | $host=$postData['host']; |
126 | - } |
|
127 | - else |
|
122 | + } else |
|
128 | 123 | { |
129 | 124 | $this->_helper->json(array('status'=>'No Hosts','hostid' => -1)); |
130 | 125 | return; |
@@ -135,8 +130,7 @@ discard block |
||
135 | 130 | { |
136 | 131 | $this->_helper->json(array('status'=>'More than one hostgroup matches','hostid' => -1)); |
137 | 132 | return; |
138 | - } |
|
139 | - else if (count($hostArray) == 0) |
|
133 | + } else if (count($hostArray) == 0) |
|
140 | 134 | { |
141 | 135 | $this->_helper->json(array('status'=>'No hostgroup matches','hostid' => -1)); |
142 | 136 | return; |
@@ -163,8 +157,7 @@ discard block |
||
163 | 157 | if (isset($postData['mib'])) |
164 | 158 | { |
165 | 159 | $mib=$postData['mib']; |
166 | - } |
|
167 | - else |
|
160 | + } else |
|
168 | 161 | { |
169 | 162 | $this->_helper->json(array('status'=>'No mib')); |
170 | 163 | return; |
@@ -173,8 +166,7 @@ discard block |
||
173 | 166 | { |
174 | 167 | $traplist=$this->getMIB()->getTrapList($mib); |
175 | 168 | $retTraps=array('status'=>'OK','traps' => $traplist); |
176 | - } |
|
177 | - catch (Exception $e) |
|
169 | + } catch (Exception $e) |
|
178 | 170 | { |
179 | 171 | $retTraps=array('status' => 'Error getting mibs'); |
180 | 172 | } |
@@ -192,8 +184,7 @@ discard block |
||
192 | 184 | if (isset($postData['trap'])) |
193 | 185 | { |
194 | 186 | $trap=$postData['trap']; |
195 | - } |
|
196 | - else |
|
187 | + } else |
|
197 | 188 | { |
198 | 189 | $this->_helper->json(array('status'=>'No trap')); |
199 | 190 | return; |
@@ -202,8 +193,7 @@ discard block |
||
202 | 193 | { |
203 | 194 | $objectlist=$this->getMIB()->getObjectList($trap); |
204 | 195 | $retObjects=array('status'=>'OK','objects' => $objectlist); |
205 | - } |
|
206 | - catch (Exception $e) |
|
196 | + } catch (Exception $e) |
|
207 | 197 | { |
208 | 198 | $retObjects=array('status' => 'not found'); |
209 | 199 | } |
@@ -218,8 +208,7 @@ discard block |
||
218 | 208 | try |
219 | 209 | { |
220 | 210 | $miblist=$this->getMIB()->getMIBList(); |
221 | - } |
|
222 | - catch (Exception $e) |
|
211 | + } catch (Exception $e) |
|
223 | 212 | { |
224 | 213 | $miblist=array('Error getting mibs'); |
225 | 214 | } |
@@ -237,8 +226,7 @@ discard block |
||
237 | 226 | if (isset($postData['oid'])) |
238 | 227 | { |
239 | 228 | $oid=$postData['oid']; |
240 | - } |
|
241 | - else |
|
229 | + } else |
|
242 | 230 | { |
243 | 231 | $this->_helper->json(array('status'=>'No oid')); |
244 | 232 | return; |
@@ -249,8 +237,7 @@ discard block |
||
249 | 237 | { |
250 | 238 | $this->_helper->json(array('status'=>'Not found')); |
251 | 239 | return; |
252 | - } |
|
253 | - else |
|
240 | + } else |
|
254 | 241 | { |
255 | 242 | $this->_helper->json( |
256 | 243 | array('status'=>'OK', |
@@ -283,8 +270,7 @@ discard block |
||
283 | 270 | $this->_helper->json(array('status'=>'invalid days : '.$days)); |
284 | 271 | return; |
285 | 272 | } |
286 | - } |
|
287 | - else |
|
273 | + } else |
|
288 | 274 | { |
289 | 275 | $this->_helper->json(array('status'=>'No days')); |
290 | 276 | return; |
@@ -297,8 +283,7 @@ discard block |
||
297 | 283 | $this->_helper->json(array('status'=>'unknown action '.$action)); |
298 | 284 | return; |
299 | 285 | } |
300 | - } |
|
301 | - else |
|
286 | + } else |
|
302 | 287 | { |
303 | 288 | $this->_helper->json(array('status'=>'No action')); |
304 | 289 | return; |
@@ -308,8 +293,7 @@ discard block |
||
308 | 293 | try |
309 | 294 | { |
310 | 295 | $this->setDBConfigValue('db_remove_days',$days); |
311 | - } |
|
312 | - catch (Exception $e) |
|
296 | + } catch (Exception $e) |
|
313 | 297 | { |
314 | 298 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
315 | 299 | return; |
@@ -327,8 +311,7 @@ discard block |
||
327 | 311 | $Trap = new Trap($icingaweb2_etc); |
328 | 312 | $Trap->setLogging($debug_level,'syslog'); |
329 | 313 | $Trap->eraseOldTraps($days); |
330 | - } |
|
331 | - catch (Exception $e) |
|
314 | + } catch (Exception $e) |
|
332 | 315 | { |
333 | 316 | $this->_helper->json(array('status'=>'execute error : '.$e->getMessage() )); |
334 | 317 | return; |
@@ -356,8 +339,7 @@ discard block |
||
356 | 339 | $this->_helper->json(array('status'=>'invalid destination : '.$destination)); |
357 | 340 | return; |
358 | 341 | } |
359 | - } |
|
360 | - else |
|
342 | + } else |
|
361 | 343 | { |
362 | 344 | $this->_helper->json(array('status'=>'No destination')); |
363 | 345 | } |
@@ -370,14 +352,12 @@ discard block |
||
370 | 352 | $this->_helper->json(array('status'=>'File not writable : '.$file)); |
371 | 353 | return; |
372 | 354 | } |
373 | - } |
|
374 | - else |
|
355 | + } else |
|
375 | 356 | { |
376 | 357 | if ($destination != 'file') |
377 | 358 | { |
378 | 359 | $file=null; |
379 | - } |
|
380 | - else |
|
360 | + } else |
|
381 | 361 | { |
382 | 362 | $this->_helper->json(array('status'=>'No file')); |
383 | 363 | return; |
@@ -387,8 +367,7 @@ discard block |
||
387 | 367 | if (isset($postData['level'])) |
388 | 368 | { |
389 | 369 | $level=$postData['level']; |
390 | - } |
|
391 | - else |
|
370 | + } else |
|
392 | 371 | { |
393 | 372 | $this->_helper->json(array('status'=>'No level')); |
394 | 373 | return; |
@@ -399,8 +378,7 @@ discard block |
||
399 | 378 | $this->setDBConfigValue('log_destination',$destination); |
400 | 379 | $this->setDBConfigValue('log_file',$file); |
401 | 380 | $this->setDBConfigValue('log_level',$level); |
402 | - } |
|
403 | - catch (Exception $e) |
|
381 | + } catch (Exception $e) |
|
404 | 382 | { |
405 | 383 | $this->_helper->json(array('status'=>'Save error : '.$e->getMessage() )); |
406 | 384 | return; |
@@ -422,8 +400,7 @@ discard block |
||
422 | 400 | if (isset($postData['rule'])) |
423 | 401 | { |
424 | 402 | $rule=$postData['rule']; |
425 | - } |
|
426 | - else |
|
403 | + } else |
|
427 | 404 | { |
428 | 405 | $this->_helper->json(array('status'=>'No Rule')); |
429 | 406 | } |
@@ -435,8 +412,7 @@ discard block |
||
435 | 412 | $this->_helper->json(array('status'=>'unknown action '.$action)); |
436 | 413 | return; |
437 | 414 | } |
438 | - } |
|
439 | - else |
|
415 | + } else |
|
440 | 416 | { |
441 | 417 | $this->_helper->json(array('status'=>'No action')); |
442 | 418 | return; |
@@ -453,8 +429,7 @@ discard block |
||
453 | 429 | // Eval |
454 | 430 | $item=0; |
455 | 431 | $rule=$Trap->evaluation($rule,$item); |
456 | - } |
|
457 | - catch (Exception $e) |
|
432 | + } catch (Exception $e) |
|
458 | 433 | { |
459 | 434 | $this->_helper->json(array('status'=>'Evaluation error : '.$e->getMessage() )); |
460 | 435 | return; |