From a24dab4a0b769e4cf75a2a832a6fe3d798a5aef2 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 22 Apr 2013 07:20:49 +0000 Subject: [PATCH] =?UTF-8?q?Ajoute=20l'aide=20pour=20quelqu'un=20qui=20veux?= =?UTF-8?q?=20scripter=20le=20d=C3=A9marrage=20ou=20l'arret=20d'une=20vm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/admin/vm.php | 36 ++++++++++++++++++++++++++++++++++-- bureau/class/m_lxc.php | 2 +- bureau/class/m_mem.php | 2 +- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/bureau/admin/vm.php b/bureau/admin/vm.php index 56680de1..39ee322b 100644 --- a/bureau/admin/vm.php +++ b/bureau/admin/vm.php @@ -1,21 +1,35 @@ array ("get", "string", ''), + "script" => array ("get", "boolean", 0), ); getFields($fields); if (in_array($action, array('start', 'stop', 'monit'))) { $res = $hooks->invoke($action, array(), 'lxc'); -printvar($res); } $infos = $lxc->getvm(); +if ($script) { + // FIXME afficher les variables pertinentes de manière pertinente pour quelqu'un qui veux scripter :) + print_r($infos); + if (isset($res)) print_r($res); + die(); +} + +# Show the header after the "if script" ;) +include_once("head.php"); + +# Debug +echo "
debugres
"; +if (isset($res)) { printvar($res); } +echo "infos getvm"; printvar($infos); +echo "
"; ?>

@@ -49,6 +63,24 @@ printvar($infos); } // empty infos ?> +
+
+
+
+
+ +
+http://user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=start' ?>
+
+ +
+http://user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=stop' ?>
+
+ +
+http://user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1' ?>
+
+
diff --git a/bureau/class/m_lxc.php b/bureau/class/m_lxc.php index 6dca0497..64bb7ae8 100644 --- a/bureau/class/m_lxc.php +++ b/bureau/class/m_lxc.php @@ -90,7 +90,7 @@ class m_lxc implements vm $res = $this->sendMessage('start', $user, $pass, $uid); if ($res === FALSE) - return $this->error[0]; + return $this->error; else { $data = unserialize($res); diff --git a/bureau/class/m_mem.php b/bureau/class/m_mem.php index d3f3d00a..ac7c0c20 100644 --- a/bureau/class/m_mem.php +++ b/bureau/class/m_mem.php @@ -238,7 +238,7 @@ class m_mem { return false; } if ($_REQUEST["username"] && $_REQUEST["password"]) { - return $this->login($_REQUEST["username"],$_REQUEST["password"],$_REQUEST["restrictip"]); + return $this->login($_REQUEST["username"],$_REQUEST["password"], (isset($_REQUEST["restrictip"])?$_REQUEST["restrictip"]:0) ); } } // end isset $_COOKIE["session"]=isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";