@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** Mib management |
| 68 | - * Post param : action=update_mib_db : update mib database |
|
| 69 | - * Post param : ation=check_update : check if mib update is finished |
|
| 70 | - * File post : mibfile -> save mib file |
|
| 71 | - */ |
|
| 68 | + * Post param : action=update_mib_db : update mib database |
|
| 69 | + * Post param : ation=check_update : check if mib update is finished |
|
| 70 | + * File post : mibfile -> save mib file |
|
| 71 | + */ |
|
| 72 | 72 | public function mibAction() |
| 73 | 73 | { |
| 74 | 74 | $this->prepareTabs()->activate('mib'); |
@@ -87,22 +87,22 @@ discard block |
||
| 87 | 87 | $return=exec('icingacli trapdirector mib update --pid /tmp/trapdirector_update.pid'); |
| 88 | 88 | if (preg_match('/OK/',$return)) |
| 89 | 89 | { |
| 90 | - $this->_helper->json(array('status'=>'OK')); |
|
| 90 | + $this->_helper->json(array('status'=>'OK')); |
|
| 91 | 91 | } |
| 92 | 92 | // Error |
| 93 | 93 | $this->_helper->json(array('status'=>$return)); |
| 94 | 94 | } |
| 95 | 95 | if ($action == 'check_update') |
| 96 | 96 | { |
| 97 | - $file=@fopen('/tmp/trapdirector_update.pid','r'); |
|
| 98 | - if ($file == false) |
|
| 99 | - { // process is dead |
|
| 100 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'Cannot open file')); |
|
| 101 | - return; |
|
| 102 | - } |
|
| 103 | - $pid=fgets($file); |
|
| 104 | - $output=array(); |
|
| 105 | - $retVal=0; |
|
| 97 | + $file=@fopen('/tmp/trapdirector_update.pid','r'); |
|
| 98 | + if ($file == false) |
|
| 99 | + { // process is dead |
|
| 100 | + $this->_helper->json(array('status'=>'tu quoque fili','err'=>'Cannot open file')); |
|
| 101 | + return; |
|
| 102 | + } |
|
| 103 | + $pid=fgets($file); |
|
| 104 | + $output=array(); |
|
| 105 | + $retVal=0; |
|
| 106 | 106 | exec('ps '.$pid,$output,$retVal); |
| 107 | 107 | if ($retVal == 0) |
| 108 | 108 | { // process is alive |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | { // process is dead |
| 113 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
|
| 113 | + $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $this->_helper->json(array('status'=>'ERR : no '.$action.' action possible' )); |
@@ -123,26 +123,26 @@ discard block |
||
| 123 | 123 | $destDir=array_shift($DirConf); |
| 124 | 124 | if (!is_dir($destDir)) |
| 125 | 125 | { |
| 126 | - $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration"; |
|
| 126 | + $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration"; |
|
| 127 | 127 | } |
| 128 | 128 | else |
| 129 | 129 | { |
| 130 | - if (!is_writable($destDir)) |
|
| 131 | - { |
|
| 132 | - $this->view->uploadStatus="ERROR : $destDir directory is not writable"; |
|
| 133 | - } |
|
| 134 | - else |
|
| 135 | - { |
|
| 136 | - $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | - if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
|
| 138 | - { |
|
| 139 | - $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
|
| 140 | - } |
|
| 141 | - else |
|
| 142 | - { |
|
| 143 | - $this->view->uploadStatus="File $name uploaded in $destDir"; |
|
| 144 | - } |
|
| 145 | - } |
|
| 130 | + if (!is_writable($destDir)) |
|
| 131 | + { |
|
| 132 | + $this->view->uploadStatus="ERROR : $destDir directory is not writable"; |
|
| 133 | + } |
|
| 134 | + else |
|
| 135 | + { |
|
| 136 | + $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | + if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
|
| 138 | + { |
|
| 139 | + $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
|
| 140 | + } |
|
| 141 | + else |
|
| 142 | + { |
|
| 143 | + $this->view->uploadStatus="File $name uploaded in $destDir"; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | } |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | // TODO : see if useless |
| 276 | 276 | class UploadForm extends Form |
| 277 | 277 | { |
| 278 | - public function __construct($options = null) |
|
| 279 | - { |
|
| 280 | - parent::__construct($options); |
|
| 281 | - $this->addElements2(); |
|
| 282 | - } |
|
| 278 | + public function __construct($options = null) |
|
| 279 | + { |
|
| 280 | + parent::__construct($options); |
|
| 281 | + $this->addElements2(); |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - public function addElements2() |
|
| 285 | - { |
|
| 286 | - // File Input |
|
| 287 | - $file = new File('mib-file'); |
|
| 288 | - $file->setLabel('Mib upload'); |
|
| 289 | - //->setAttrib('multiple', null); |
|
| 290 | - $this->addElement($file); |
|
| 284 | + public function addElements2() |
|
| 285 | + { |
|
| 286 | + // File Input |
|
| 287 | + $file = new File('mib-file'); |
|
| 288 | + $file->setLabel('Mib upload'); |
|
| 289 | + //->setAttrib('multiple', null); |
|
| 290 | + $this->addElement($file); |
|
| 291 | 291 | $button = new Submit("upload",array('ignore'=>false)); |
| 292 | 292 | $this->addElement($button);//->setIgnore(false); |
| 293 | - } |
|
| 293 | + } |
|
| 294 | 294 | } |