]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Class/Bconsole.php
baculum: Assign Baculum copyright to Kern Sibbald
[bacula/bacula] / gui / baculum / protected / Class / Bconsole.php
index e5eaeee649d2b12ed30ea915de23a2462220743a..073f90aaf2c67a862092d1a7a962e051841dd32a 100644 (file)
@@ -1,20 +1,23 @@
 <?php
-/**
- * Bacula® - The Network Backup Solution
- * Baculum - Bacula web interface
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2015 Marcin Haba
+ * Copyright (C) 2013-2016 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
- * The main author of Bacula is Kern Sibbald, with contributions from many
- * others, a complete list can be found in the file AUTHORS.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
  *
  * You may use this file and others of this release according to the
  * license defined in the LICENSE file, which includes the Affero General
  * Public License, v3.0 ("AGPLv3") and some additional permissions and
  * terms pursuant to its AGPLv3 Section 7.
  *
- * Bacula® is a registered trademark of Kern Sibbald.
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
  */
 
 Prado::using('Application.Class.ConfigurationManager');
@@ -25,7 +28,7 @@ class Bconsole extends TModule {
 
        const SUDO = 'sudo';
 
-       const BCONSOLE_COMMAND_PATTERN = "%s%s -c %s %s <<END_OF_DATA\n%s\nquit\n<<END_OF_DATA";
+       const BCONSOLE_COMMAND_PATTERN = "%s%s -c %s %s <<END_OF_DATA\n%s\nquit\nEND_OF_DATA";
 
        const BCONSOLE_DIRECTORS_PATTERN = "%s%s -c %s -l";
 
@@ -74,7 +77,7 @@ class Bconsole extends TModule {
                        }
                }
                $output = count($output) > 1 ? array_values($output) : array_shift($output);
-               return (object)array('output' => $output, 'exitcode' => $exitcode);
+               return (object)array('output' => $output, 'exitcode' => (integer)$exitcode);
        }
 
        public function bconsoleCommand($director, array $command, $user = null) {
@@ -88,6 +91,7 @@ class Bconsole extends TModule {
        }
 
        private function execCommand($director, array $command, $user) {
+               $cmd = '';
                if(!is_null($director) && $this->isValidDirector($director) === false) {
                        $output = array(BconsoleError::MSG_ERROR_INVALID_DIRECTOR, '');
                        $exitcode = BconsoleError::ERROR_INVALID_DIRECTOR;
@@ -134,7 +138,8 @@ class Bconsole extends TModule {
        public function testBconsoleCommand(array $command, $bconsoleCmdPath, $bconsoleCfgPath, $useSudo) {
                $this->setEnvironmentParams($bconsoleCmdPath, $bconsoleCfgPath, null, $useSudo);
                $director = array_shift($this->getDirectors()->output);
-               return $this->bconsoleCommand($director, $command);             
+               $result = $this->bconsoleCommand($director, $command);
+               return $result;
        }
 }
-?>
\ No newline at end of file
+?>