Some refactoring done

This commit is contained in:
Christopher York 2013-05-17 23:31:53 -05:00
parent 6f54db6d2d
commit 0e9529a8d2
7 changed files with 79 additions and 68 deletions

View file

@ -76,14 +76,14 @@ function websitepanel_addons_AddonActivation($params)
$wsp = new WebsitePanel($srvSettings['username'], $srvSettings['password'], $modSettings['serverhost'], $modSettings['serverport'], (($modSettings['serversecured']) == 'on' ? TRUE : FALSE));
// Grab the user's details from WebsitePanel in order to get the user's id
$user = $wsp->get_user_by_username($username);
$user = $wsp->getUserByUsername($username);
if (empty($user))
{
return;
}
// Get the user's current WebsitePanel hosting space Id (Hosting Plan)
$package = $wsp->get_user_packages($user['UserId']);
$package = $wsp->getUserPackages($user['UserId']);
$packageId = $package['PackageId'];
if (empty($packageId))
{
@ -97,7 +97,7 @@ function websitepanel_addons_AddonActivation($params)
$addonIsIpAddress = $addon['is_ipaddress'];
// Add the Addon Plan to the customer's WebsitePanel package / hosting space
$results = $wsp->add_package_addon_by_id($packageId, $addonPlanId);
$results = $wsp->addPackageAddonById($packageId, $addonPlanId);
// Check the results to verify that the addon has been successfully allocated
if ($results['Result'] > 0)
@ -105,7 +105,7 @@ function websitepanel_addons_AddonActivation($params)
// If this addon is an IP address addon - attempt to randomly allocate an IP address to the customer's hosting space
if ($addonIsIpAddress)
{
$wsp->package_allocate_ipaddress($packageId);
$wsp->packageAllocateIpAddress($packageId);
}
}
}

View file

@ -65,7 +65,7 @@ function websitepanel_sync_ClientEdit($params)
$wsp = new WebsitePanel($srvSettings['username'], $srvSettings['password'], $modSettings['serverhost'], $modSettings['serverport'], (($modSettings['serversecured']) == 'on' ? TRUE : FALSE));
// Get all WSP users with the old email
$items = (array)$wsp->get_users_paged_recursive(1, 'Email', $params['olddata']['email'], 0, 0, '');
$items = (array)$wsp->getUsersPagedRecursive(1, 'Email', $params['olddata']['email'], 0, 0, '');
// Load / parse the XML response
$xml = simplexml_load_string($items['any']);
@ -80,10 +80,10 @@ function websitepanel_sync_ClientEdit($params)
// Set the current root element and get the users details from WebsitePanel
// We cannot use the details provided by the get_users_paged_recursive method as it does not return all the required elements to fully update the user
$currentRoot = $rootPath->Table1->$i;
$userDetails = (array)$wsp->get_user_by_username($currentRoot->Username);
$userDetails = (array)$wsp->getUserByUsername($currentRoot->Username);
// Update the current user
$wsp->update_user_details($userDetails['RoleId'], (($userDetails['RoleId'] == 2) ? 'Reseller' : 'User'), $userDetails['StatusId'], $userDetails['Status'], $userDetails['LoginStatusId'], $userDetails['LoginStatus'], $userDetails['FailedLogins'], $userDetails['UserId'], $userDetails['OwnerId'], $userDetails['Created'], $userDetails['Changed'], $userDetails['IsDemo'], $userDetails['IsPeer'], $currentRoot->Comments, $userDetails['Username'], $userDetails['Password'], $params['firstname'], $params['lastname'], $params['email'], $params['phonenumber'], $params['postcode'], '', '', '', '', $params['country'], $params['address1'] . (!empty($params['address2']) ? " {$params['address2']}" : ''), $params['city'], $params['state'], TRUE, $params['companyname'], (($userDetails['RoleId'] == 2) ? TRUE : FALSE));
$wsp->updateUserDetails($userDetails['RoleId'], (($userDetails['RoleId'] == 2) ? 'Reseller' : 'User'), $userDetails['StatusId'], $userDetails['Status'], $userDetails['LoginStatusId'], $userDetails['LoginStatus'], $userDetails['FailedLogins'], $userDetails['UserId'], $userDetails['OwnerId'], $userDetails['Created'], $userDetails['Changed'], $userDetails['IsDemo'], $userDetails['IsPeer'], $currentRoot->Comments, $userDetails['Username'], $userDetails['Password'], $params['firstname'], $params['lastname'], $params['email'], $params['phonenumber'], $params['postcode'], '', '', '', '', $params['country'], $params['address1'] . (!empty($params['address2']) ? " {$params['address2']}" : ''), $params['city'], $params['state'], TRUE, $params['companyname'], (($userDetails['RoleId'] == 2) ? TRUE : FALSE));
// Add log entry to client log
logactivity("WebsitePanel Sync - Account {$currentRoot->Username} contact details updated successfully", $params['userid']);