<?php
/*
 * ##################################################################
 * Created on: Jul 28, 2005
 * File name:  plesk.php 
 * ##################################################################
 * This code is a sole property of netenberg.com 
 * ##################################################################
 */
function killAccount($plesk_server, $plesk_user, $plesk_password, $usessl, $order_data, & $plesk, $plesk_hash)
{
    preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    
    $plesk->order_data = $order_data;
     
    $plesk->kill_plesk_account();
    return $plesk->result;
}
function suspendAccount($plesk_server, $plesk_user, $plesk_password, $usessl, $order_data, & $plesk, $plesk_hash)
{
	preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    
    $plesk->order_data = $order_data; 
    
    $plesk->suspend_plesk_account();
    return $plesk->result;
} 
function unsuspendAccount($plesk_server, $plesk_user, $plesk_password, $usessl, $order_data, & $plesk, $plesk_hash)
{
    preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    
    $plesk->order_data = $order_data;
        
    $plesk->unsuspend_plesk_account();
    return $plesk->result;
} 
function createAccount($plesk_server, $plesk_user, $plesk_password, $usessl, $package_data, $order_data, & $plesk, $plesk_hash)
{
    preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    
    $plesk->limits     = $package_data;   
    $plesk->order_data = $order_data;
    foreach($plesk->permissions as $k=>$v)
    	$plesk->permissions[$k] = $package_data[$k];
    $result = $plesk->create_plesk_account();
    return $result;
}
function listAccounts($plesk_server, $plesk_user, $plesk_password, $usessl, & $plesk, $plesk_hash)
{
	preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    $plesk->list_plesk_accounts();
    return $plesk->result;
}
function listPackages($plesk_server, $plesk_user, $plesk_password, $usessl, & $plesk, $plesk_hash)
{
    preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    $plesk->list_plesk_packages();
    return $plesk->result;
}
function syncPackage($plesk_server, $plesk_user, $plesk_password, $usessl, $package_data, $submit, & $plesk, $plesk_hash)
{
    preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, $plesk, $plesk_hash);
    $plesk->create_plesk_package($submit);
    return $plesk->result;
}
function preparePlugin($plesk_server, $plesk_user, $plesk_password, $usessl, & $plesk, $plesk_hash)
{
    $plesk->plesk_server     = $plesk_server;
    $plesk->plesk_user       = $plesk_user;
    $plesk->plesk_password   = $plesk_password;
    $plesk->plesk_hash       = $plesk_hash;    
    $plesk->usessl           = $usessl;
    $plesk->plesk_port       = 8443;  
    $plesk->proto          = "http://";
    if($plesk->usessl == 1)
    {
        $plesk->proto      = "https://";
    }
}
?>