Skip to content

Commit

Permalink
a bunch more fixs and improvements throughout the class and plugin code
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Jul 1, 2017
1 parent f0b0098 commit 1e0f940
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public static function getActivate(GenericEvent $event) {
myadmin_log(self::$module, 'info', "Calling vesta = new VestaCP($ip, $user, ****************)", __LINE__, __FILE__);
$vesta = new VestaCP($ip, $user, $pass);
$package = 'default';
myadmin_log(self::$module, 'info', "Calling vesta->create_account({$username}, ****************, {$event['email']}, {$data['name']}, {$package})", __LINE__, __FILE__);
if ($vesta->create_account($username, $password, $event['email'], $data['name'], $package)) {
request_log(self::$module, $serviceClass->getCustid(), __FUNCTION__, 'vesta', 'create_account', array('username' => $username, 'password' => $password, 'email' => $event['email'], 'name' => $data['name'], 'package' => $package), $vesta->response);
myadmin_log(self::$module, 'info', "Calling vesta->createAccount({$username}, ****************, {$event['email']}, {$data['name']}, {$package})", __LINE__, __FILE__);
if ($vesta->createAccount($username, $password, $event['email'], $data['name'], $package)) {
request_log(self::$module, $serviceClass->getCustid(), __FUNCTION__, 'vesta', 'createAccount', array('username' => $username, 'password' => $password, 'email' => $event['email'], 'name' => $data['name'], 'package' => $package), $vesta->response);
myadmin_log(self::$module, 'info', 'Success, Response: '.var_export($vesta->response, TRUE), __LINE__, __FILE__);
$ip = $serverdata[$settings['PREFIX'].'_ip'];
$db = get_module_db(self::$module);
Expand All @@ -55,7 +55,7 @@ function_requirements('website_welcome_email');
website_welcome_email($serviceClass->getId());
$event['success'] = TRUE;
} else {
request_log(self::$module, $serviceClass->getCustid(), __FUNCTION__, 'vesta', 'create_account', array('username' => $username, 'password' => $password, 'email' => $event['email'], 'name' => $data['name'], 'package' => $package), $vesta->response);
request_log(self::$module, $serviceClass->getCustid(), __FUNCTION__, 'vesta', 'createAccount', array('username' => $username, 'password' => $password, 'email' => $event['email'], 'name' => $data['name'], 'package' => $package), $vesta->response);
add_output('Error Creating Website');
myadmin_log(self::$module, 'info', 'Failure, Response: '.var_export($vesta->response, TRUE), __LINE__, __FILE__);
$event['success'] = FALSE;
Expand All @@ -74,8 +74,8 @@ public static function getReactivate(GenericEvent $event) {
list($user, $pass) = explode(':', $hash);
myadmin_log(self::$module, 'info', 'VestaCP Reactivation', __LINE__, __FILE__);
$vesta = new VestaCP($ip, $user, $pass);
myadmin_log(self::$module, 'info', "Calling vesta->unsuspend_account({$serviceClass->getUsername()})", __LINE__, __FILE__);
if ($vesta->unsuspend_account($serviceClass->getUsername())) {
myadmin_log(self::$module, 'info', "Calling vesta->unsuspendAccount({$serviceClass->getUsername()})", __LINE__, __FILE__);
if ($vesta->unsuspendAccount($serviceClass->getUsername())) {
myadmin_log(self::$module, 'info', 'Success, Response: '.json_encode($vesta->response), __LINE__, __FILE__);
} else {
myadmin_log(self::$module, 'info', 'Failure, Response: '.json_encode($vesta->response), __LINE__, __FILE__);
Expand All @@ -98,7 +98,7 @@ public static function getChangeIp(GenericEvent $event) {
$event['status_text'] = 'Error Code '.$result['faultcode'].': '.$result['fault'];
} else {
$GLOBALS['tf']->history->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getIp());
$service->set_ip($event['newip'])->save();
$serviceClass->set_ip($event['newip'])->save();
$event['status'] = 'ok';
$event['status_text'] = 'The IP Address has been changed.';
}
Expand Down
19 changes: 9 additions & 10 deletions src/VestaCP.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($hostname = '', $username = '', $password = '') {
* @param string $package
* @return bool|mixed|string
*/
public function create_account($username, $password, $email, $name, $package = 'default') {
public function createAccount($username, $password, $email, $name, $package = 'default') {
$firstName = trim(mb_substr($name, 0, mb_strpos(' ', $name)));
$lastName = trim(mb_substr($name, mb_strpos(' ', $name) + 1));
$vstReturncode = 'yes';
Expand Down Expand Up @@ -90,7 +90,7 @@ public function create_account($username, $password, $email, $name, $package = '
* @param string $username
* @param string $domain
*/
public function add_web_dns_mail_domain($username, $domain) {
public function addWebDnsMailDomain($username, $domain) {
$vstReturncode = 'yes';
$vstCommand = 'v-add-domain';

Expand Down Expand Up @@ -130,7 +130,7 @@ public function add_web_dns_mail_domain($username, $domain) {
* @param string $dbUser
* @param string $dbPass
*/
public function add_database($username, $dbName, $dbUser, $dbPass) {
public function addDatabase($username, $dbName, $dbUser, $dbPass) {
$vstReturncode = 'yes';
$vstCommand = 'v-add-database';

Expand Down Expand Up @@ -169,7 +169,7 @@ public function add_database($username, $dbName, $dbUser, $dbPass) {
* @param string $username
* @param string $format
*/
public function list_account($username, $format = 'json') {
public function listAccount($username, $format = 'json') {
$vstCommand = 'v-list_user';

// Prepare POST query
Expand Down Expand Up @@ -205,7 +205,7 @@ public function list_account($username, $format = 'json') {
* @param string $domain
* @param string $format
*/
public function list_web_domains($username, $domain, $format = 'json') {
public function listWebDomains($username, $domain, $format = 'json') {
$vstCommand = 'v-list-web-domain';

// Prepare POST query
Expand Down Expand Up @@ -240,7 +240,7 @@ public function list_web_domains($username, $domain, $format = 'json') {
/**
* @param string $username
*/
public function delete_account($username) {
public function deleteAccount($username) {
$vstReturncode = 'yes';
$vstCommand = 'v-delete-user';

Expand Down Expand Up @@ -276,7 +276,7 @@ public function delete_account($username) {
/**
* @param string $username
*/
public function suspend_account($username) {
public function suspendAccount($username) {
$vstReturncode = 'yes';
$vstCommand = 'v-suspend-user';

Expand Down Expand Up @@ -312,7 +312,7 @@ public function suspend_account($username) {
/**
* @param string $username
*/
public function unsuspend_account($username) {
public function unsuspendAccount($username) {
$vstReturncode = 'yes';
$vstCommand = 'v-unsuspend-user';

Expand Down Expand Up @@ -349,9 +349,8 @@ public function unsuspend_account($username) {
* @param string $username
* @param string $password
*/
public function check_user_pass($username, $password) {
public function checkUserPass($username, $password) {
$vstCommand = 'v-check-user-password';
$vstReturncode = 'yes';

// Prepare POST query
$postvars = array(
Expand Down

0 comments on commit 1e0f940

Please sign in to comment.