diff --git a/admin/pages/servers.php b/admin/pages/servers.php
index e818d6a..17f1ca2 100644
--- a/admin/pages/servers.php
+++ b/admin/pages/servers.php
@@ -16,7 +16,8 @@ public function __construct() {
$this->navlist[] = array("View All Servers", "server_go.png", "view");
$this->navlist[] = array("Add Server", "server_add.png", "add");
- //@todo this foreach for something lighter
+ //@todo change this and user a simple array
+ /*
$files = $main->folderFiles(LINK."servers/");
require_once LINK.'servers/panel.php';
if(is_array($files) && count($files) > 0) {
@@ -29,7 +30,9 @@ public function __construct() {
}
}
}
- $this->array_type = $values;
+ $values = array('whm'=>'cPanel/WHM');
+ */
+ $this->array_type = array('whm'=>'cPanel/WHM','da'=>'Direct Admin', 'ispconfig'=>'ISPConfig3', 'test'=>'Test');
}
public function description() {
@@ -58,7 +61,8 @@ public function content() { # Displays the page
}
}
//$array['TYPE'] = $this->array_type;
- $array['TYPE'] = $main->dropDown("type", $this->array_type, 0, 0);
+ //$array['TYPE'] = $main->dropDown("type", $this->array_type, 0, 0);
+ $array['TYPE'] = $main->createSelect("type", $this->array_type, '' ,array('onchange'=>'serverchange(this.value)'));
echo $style->replaceVar("tpl/servers/addserver.tpl", $array);
break;
@@ -93,15 +97,16 @@ public function content() { # Displays the page
$array['HASH'] = $data['accesshash'];
$array['ID'] = $data['id'];
- $array['TYPE'] = $main->dropDown("type", $this->array_type, $data['type'], 0);
+ //$array['TYPE'] = $main->dropDown("type", $this->array_type, $data['type'], 0);
+ $array['TYPE'] = $main->createSelect("type", $this->array_type, $data['type'], array('onchange'=>'serverchange(this.value)'));
- global $server;
- $server_php = $server->loadServer($data['id']);
- $server_status = $server_php->getServerStatus();
-
+ global $server;
+ $serverphp = $server->loadServer($data['id']);
+ $server_status = $serverphp->getServerStatus();
+
//Testing connection
- $array['SERVER_STATUS'] = $server_php->testConnection();
- echo $style->replaceVar("tpl/servers/viewserver.tpl", $array);
+ $array['SERVER_STATUS'] = $serverphp->testConnection();
+ echo $style->replaceVar("tpl/servers/viewserver.tpl", $array);
}
} else {
//@todo replace this queries
diff --git a/includes/ajax.php b/includes/ajax.php
index e376fba..e26331f 100755
--- a/includes/ajax.php
+++ b/includes/ajax.php
@@ -652,7 +652,7 @@ public function serverhash() {
require_once LINK.'servers/panel.php';
if (in_array($type, $server->getAvailablePanels())) {
require_once LINK ."servers/". $type .".php";
- $server = new $type;
+ $server = new $type(-1);
if($server->hash) {
echo 0;
} else {
@@ -670,7 +670,7 @@ public function editserverhash() {
require_once LINK.'servers/panel.php';
if (in_array($type, $server->getAvailablePanels())) {
require_once LINK."servers/". $type .".php";
- $serverphp = new $type();
+ $serverphp = new $type(-1);
if($serverphp->hash) {
echo 0;
} else {
diff --git a/includes/servers/ispconfig.php b/includes/servers/ispconfig.php
index d48c525..0a8c165 100644
--- a/includes/servers/ispconfig.php
+++ b/includes/servers/ispconfig.php
@@ -17,17 +17,21 @@ class ispconfig extends Panel {
public function __construct($server_id = null) {
global $main;
- parent::__construct($server_id);
- $this->status = false;
- if (!empty($server_id)) {
- if ($this->_testConnection()) {
- $this->status = true;
- $main->addlog('ispconfig::construct testing connection ok');
+ //@todo fix me this is an ugly fix to avoid the useless calls in the ajax::editserverhash and ajax::serverhash
+ if ($server_id != '-1') {
+ parent::__construct($server_id);
+ $this->status = false;
+ if (!empty($server_id)) {
+ if ($this->_testConnection()) {
+ $this->status = true;
+ $main->addlog('ispconfig::construct Testing connection ok');
+ } else {
+ $main->addlog('ispconfig::construct Testing connection failed');
+ }
} else {
- $main->addlog('ispconfig::construct testing connection failed');
+ $main->addlog('ispconfig::server id not provided');
}
}
- $main->addlog('ispconfig::server id not provided');
}
public function getSessionId() {
@@ -66,13 +70,12 @@ public function load() {
global $main;
$my_session_id = $this->getSessionId();
//Try to check if there is already a soap client available
- if (isset($this->_soap_client) && !empty($this->_soap_client) && !empty($my_session_id)) {
- $main->addLog("ispconfig::load returning existent SOAP client");
+ /*if (isset($this->_soap_client) && !empty($this->_soap_client) && !empty($my_session_id)) {
+ $main->addLog("ispconfig::load Returning SOAP client already set");
return $this->_soap_client;
- } else {
- //$main->addlog($this->getServerId());
+ } else {*/
$data = $this->serverDetails($this->getServerId());
- if (!empty($data) && is_array($data)) {
+ if (!empty($data) && is_array($data)) {
// $host_parts = parse_url($data['host']);
//$data['host'] = $host_parts['scheme'].$host_parts['host'].$host_parts['path'];
@@ -88,6 +91,7 @@ public function load() {
if ($this->debug) {echo 'Logged into remote server successfully. The SessionID is '.$session_id.'
';}
$main->addLog("ispconfig::load Session id $session_id");
$this->session_id = $session_id;
+ $this->_soap_client = $client;
return $client;
}
} catch (SoapFault $e) {
@@ -99,7 +103,7 @@ public function load() {
}
$main->addLog("ispconfig::load error seems that the server id is wrong");
return false;
- }
+
}
/**
@@ -271,7 +275,7 @@ private function remote($action, $params = array()) {
break;
}
if ($this->debug) { echo 'Result: '; var_dump($soap_result); echo '------------------>>
';}
- $main->addLog("Result of ispconfig:: $action - ".print_r($soap_result,1));
+ $main->addLog("Result of ispconfig:: $action : ".print_r($soap_result,1));
return $soap_result;
} catch (SoapFault $e) {
$main->addLog("ispconfig::remote Soap error: ".$e->getMessage());
@@ -915,7 +919,11 @@ public function getSiteStatus($order_id) {
}
public function getServerStatus() {
+ global $main;
+ $main->addlog("ispconfig::getServerStatus");
if ($this->status) {
+
+ $main->addlog("ispconfig::getServerStatus status = true");
//we should use only the load function
$server_params['server_id'] = $this->getServerId();
$server_params['section'] = 'web';
@@ -928,6 +936,8 @@ public function getServerStatus() {
$result = false;
}
return $result;
+ } else {
+ $main->addlog("ispconfig::getServerStatus status = false");
}
return false;
}
diff --git a/includes/servers/panel.php b/includes/servers/panel.php
index d0696e7..cee9057 100644
--- a/includes/servers/panel.php
+++ b/includes/servers/panel.php
@@ -33,12 +33,14 @@ public function GenPassword() {
public function serverDetails($server) {
global $db, $main;
if (!empty($server)) {
- $sql = "SELECT * FROM `
servers` WHERE `id` = '{$db->strip($server)}'"; + $server = $db->strip($server); + $sql = "SELECT * FROMservers WHERE id = $server"; $query = $db->query($sql); if($db->num_rows($query) > 0) { return $db->fetch_array($query, 'ASSOC'); } } else { + $main->addlog('panel::serverDetails server id is not set'); return false; } } diff --git a/includes/tpl/orderform/orderform.tpl b/includes/tpl/orderform/orderform.tpl index 751071b..53719f7 100755 --- a/includes/tpl/orderform/orderform.tpl +++ b/includes/tpl/orderform/orderform.tpl @@ -297,9 +297,9 @@ function nextstep() { //Check if an invoice is generated $.get("function=ispaid", function(invoice_id) { if(invoice_id != "") { - //window.location = "../client/?page=invoices&iid="+invoice_id; + window.location = "../client/?page=invoices&iid="+invoice_id; } else { - //window.location = "../client/?page=invoices"; + window.location = "../client/?page=invoices"; } }); diff --git a/includes/tpl/servers/addserver.tpl b/includes/tpl/servers/addserver.tpl index bce0c4c..3c9e84e 100644 --- a/includes/tpl/servers/addserver.tpl +++ b/includes/tpl/servers/addserver.tpl @@ -37,7 +37,10 @@ $(window).load(function () { Type: -+ + %TYPE% + + diff --git a/includes/tpl/servers/viewserver.tpl b/includes/tpl/servers/viewserver.tpl index 2ef8059..c3c8853 100644 --- a/includes/tpl/servers/viewserver.tpl +++ b/includes/tpl/servers/viewserver.tpl @@ -55,7 +55,7 @@ $(window).load(function () { Type: - + %TYPE%