Fixed Multiple bugs in WHMCS module

Added module debug logging
Fixed simple bugs in function result codes returns
This commit is contained in:
kotso 2015-03-25 01:23:28 +04:00
parent 2e78f1e3c9
commit 63e3728999

View file

@ -43,6 +43,8 @@ function vesta_CreateAccount($params) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl); $answer = curl_exec($curl);
logModuleCall('vesta','CreateAccount_UserAccount','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
// Enable ssh access // Enable ssh access
if(($answer == 'OK') && ($params["configoption2"] == 'on')) { if(($answer == 'OK') && ($params["configoption2"] == 'on')) {
$postvars = array( $postvars = array(
@ -62,6 +64,8 @@ function vesta_CreateAccount($params) {
curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl); $answer = curl_exec($curl);
logModuleCall('vesta','CreateAccount_EnableSSH','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
} }
// Add domain // Add domain
@ -84,6 +88,8 @@ function vesta_CreateAccount($params) {
curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl); $answer = curl_exec($curl);
logModuleCall('vesta','CreateAccount_AddDomain','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
} }
} }
@ -92,8 +98,8 @@ function vesta_CreateAccount($params) {
} else { } else {
$result = $answer; $result = $answer;
} }
return $result;
return $result;
} }
function vesta_TerminateAccount($params) { function vesta_TerminateAccount($params) {
@ -122,6 +128,8 @@ function vesta_TerminateAccount($params) {
$answer = curl_exec($curl); $answer = curl_exec($curl);
} }
logModuleCall('vesta','TerminateAccount','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
if($answer == 'OK') { if($answer == 'OK') {
$result = "success"; $result = "success";
} else { } else {
@ -129,7 +137,6 @@ function vesta_TerminateAccount($params) {
} }
return $result; return $result;
} }
function vesta_SuspendAccount($params) { function vesta_SuspendAccount($params) {
@ -158,12 +165,15 @@ function vesta_SuspendAccount($params) {
$answer = curl_exec($curl); $answer = curl_exec($curl);
} }
logModuleCall('vesta','SuspendAccount','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
if($answer == 'OK') { if($answer == 'OK') {
$result = "success"; $result = "success";
} else { } else {
$result = $answer; $result = $answer;
} }
return $result;
} }
function vesta_UnsuspendAccount($params) { function vesta_UnsuspendAccount($params) {
@ -192,12 +202,15 @@ function vesta_UnsuspendAccount($params) {
$answer = curl_exec($curl); $answer = curl_exec($curl);
} }
logModuleCall('vesta','UnsuspendAccount','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
if($answer == 'OK') { if($answer == 'OK') {
$result = "success"; $result = "success";
} else { } else {
$result = $answer; $result = $answer;
} }
return $result;
} }
function vesta_ChangePassword($params) { function vesta_ChangePassword($params) {
@ -227,13 +240,15 @@ function vesta_ChangePassword($params) {
$answer = curl_exec($curl); $answer = curl_exec($curl);
} }
logModuleCall('vesta','ChangePassword','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
if($answer == 'OK') { if($answer == 'OK') {
$result = "success"; $result = "success";
} else { } else {
$result = $answer; $result = $answer;
} }
return $result; return $result;
} }
function vesta_ChangePackage($params) { function vesta_ChangePackage($params) {
@ -263,13 +278,15 @@ function vesta_ChangePackage($params) {
$answer = curl_exec($curl); $answer = curl_exec($curl);
} }
logModuleCall('vesta','ChangePackage','https://'.$params["serverhostname"].':8083/api/'$postdata,$answer);
if($answer == 'OK') { if($answer == 'OK') {
$result = "success"; $result = "success";
} else { } else {
$result = $answer; $result = $answer;
} }
return $result;
return $result;
} }
function vesta_ClientArea($params) { function vesta_ClientArea($params) {