@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | $this->Config()->saveIni(); |
53 | 53 | $this->view->configErrorDetected='Configuration is empty : you can run install script with parameters (see Automatic installation below)'; |
54 | 54 | //$emptyConfig=1; |
55 | - } |
|
56 | - catch (Exception $e) |
|
55 | + } catch (Exception $e) |
|
57 | 56 | { |
58 | 57 | $this->view->configErrorDetected=$e->getMessage(); |
59 | 58 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | $this->view->apimessage='API config : ' . $e->getMessage(); |
142 | 141 | $this->view->apimessageError=true; |
143 | 142 | } |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | $this->view->apimessage='API parameters not configured'; |
148 | 146 | $this->view->apimessageError=true; |
@@ -208,7 +206,9 @@ discard block |
||
208 | 206 | $input="154865134987aaaa"; |
209 | 207 | exec("$phpBin -r \"echo '$input';\"",$output,$retCode); |
210 | 208 | |
211 | - if (! isset($output[0])) $output[0]="NO OUT"; |
|
209 | + if (! isset($output[0])) { |
|
210 | + $output[0]="NO OUT"; |
|
211 | + } |
|
212 | 212 | |
213 | 213 | if ($retCode == 0 && preg_match("/$input/",$output[0]) == 1) |
214 | 214 | { |
@@ -310,8 +310,7 @@ discard block |
||
310 | 310 | $this->getUIDatabase()->testGetDb(); // Get DB in test mode |
311 | 311 | printf('Schema already exists'); |
312 | 312 | |
313 | - } |
|
314 | - catch (DBException $e) |
|
313 | + } catch (DBException $e) |
|
315 | 314 | { |
316 | 315 | |
317 | 316 | printf('Creating schema : <br>'); |
@@ -367,8 +366,7 @@ discard block |
||
367 | 366 | $this->getUIDatabase()->testGetDb(); // Get DB in test mode |
368 | 367 | echo 'Schema already exists and is up to date<br>'; |
369 | 368 | return; |
370 | - } |
|
371 | - catch (DBException $e) |
|
369 | + } catch (DBException $e) |
|
372 | 370 | { |
373 | 371 | $dberror=$e->getArray(); |
374 | 372 | } |
@@ -439,10 +437,12 @@ discard block |
||
439 | 437 | } |
440 | 438 | $psOutput=array(); |
441 | 439 | $getenforce = ''; |
442 | - if(is_executable('/usr/sbin/getenforce')) // SELinux handling |
|
440 | + if(is_executable('/usr/sbin/getenforce')) { |
|
441 | + // SELinux handling |
|
443 | 442 | { |
444 | 443 | $getenforce = exec('/usr/sbin/getenforce 2>/dev/null'); |
445 | 444 | } |
445 | + } |
|
446 | 446 | if(!$getenforce === 'Enforcing') |
447 | 447 | { |
448 | 448 | exec('ps --no-headers -o command -C snmptrapd',$psOutput); |
@@ -452,16 +452,18 @@ discard block |
||
452 | 452 | } |
453 | 453 | // Assume there is only one line... TODO : see if there is a better way to do this |
454 | 454 | $line = preg_replace('/^.*snmptrapd /','',$psOutput[0]); |
455 | - if (!preg_match('/-n/',$line)) |
|
456 | - return array(1,'snmptrapd has no -n option : '.$line); |
|
457 | - if (!preg_match('/-O[^ ]*n/',$line)) |
|
458 | - return array(1,'snmptrapd has no -On option : '.$line); |
|
459 | - if (!preg_match('/-O[^ ]*e/',$line)) |
|
460 | - return array(1,'snmptrapd has no -Oe option : '.$line); |
|
455 | + if (!preg_match('/-n/',$line)) { |
|
456 | + return array(1,'snmptrapd has no -n option : '.$line); |
|
457 | + } |
|
458 | + if (!preg_match('/-O[^ ]*n/',$line)) { |
|
459 | + return array(1,'snmptrapd has no -On option : '.$line); |
|
460 | + } |
|
461 | + if (!preg_match('/-O[^ ]*e/',$line)) { |
|
462 | + return array(1,'snmptrapd has no -Oe option : '.$line); |
|
463 | + } |
|
461 | 464 | |
462 | 465 | return array(0,'snmptrapd listening to UDP/162, options : '.$line); |
463 | - } |
|
464 | - else |
|
466 | + } else |
|
465 | 467 | { |
466 | 468 | return array(0,'A daemon (hidden by SELinux) is listening on UDP/162'); |
467 | 469 | } |