Home » Kloxo Community Support » API and Integration » AccountLab Plus(A working plugin)
| AccountLab Plus [message #89250] |
Wed, 21 September 2011 23:18  |
|
Our friend "hackinho" posted in the Portuguese forum a revised plugin for Kloxo on ALP.
Here it is:
<?php
class lxadminHandler
{
/*
* Constructor
*/
function lxadminHandler()
{
$this->initFields();
}
/*
* Instantiate fields
*/
function initFields()
{
$this->error = false;
$this->result = null;
$this->limits = array();
$this->permissions = array();
$this->order_data = array();
}
function suspend($host, $user, $password, $usessl, $suspenduser)
{
$result = $this->lxreq("class=client&name={$suspenduser}&action=update&subaction=disable", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
$return['result'] = 1;
$return['response'] = $result->message; //Success (you can change the message if you wish)
}else{
$return['result'] = 0;
$return['response'] = $result->message; //Error (you can change the message if you wish)
}
return $return;
}
function unsuspend($host, $user, $password, $usessl, $suspenduser)
{
$result = $this->lxreq("class=client&name={$suspenduser}&action=update&subaction=enable", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
$return['result'] = 1;
$return['response'] = $result->message; //Success (you can change the message if you wish)
}else{
$return['result'] = 0;
$return['response'] = $result->message; //Error (you can change the message if you wish)
}
return $return;
}
function killacct($host, $user, $password, $usessl, $killuser)
{
$result = $this->lxreq("class=client&name={$killuser}&action=delete", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
$return['result'] = 1;
$return['response'] = $result->message; //Success (you can change the message if you wish)
}else{
$return['result'] = 0;
$return['response'] = $result->message; //Error (you can change the message if you wish)
}
return $return;
}
function createacct($host, $user, $password, $usessl, $acctdomain, $acctuser, $acctpass,
$acctplan)
{
$dnstemplate = 'default.dnst'; //Put your DNS Template here
$result = $this->lxreq("class=client&name={$acctuser}&action=add&v-password={$acctpass}&v-type=customer&v-plan_name={$acctplan}&v-domain_name={$acctdomain}&v-dnstemplate_name={$dnstemplate}", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
$return['result'] = 1;
$return['response'] = $result->message; //Success (you can change the message if you wish)
}else{
$return['result'] = 0;
$return['response'] = $result->message; //Error (you can change the message if you wish)
}
return $return;
}
function listdomains($host, $user, $password, $usessl)
{
$result = $this->lxreq("login-class=client&action=simplelist&resource=domain", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
foreach($result->result as $object){
$return[$object] = $object;
}
}else{
$return = $result->message;
}
return $return;
}
function listaccts($host, $user, $password, $usessl)
{
$result = $this->lxreq("login-class=client&action=simplelist&resource=client", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
foreach($result->result as $object){
$return[$object] = $object;
}
}else{
$return = $result->message;
}
return $return;
}
/*
//function to merge packages and templates
function listpkgs($host, $user, $password, $usessl)
{
if ($user == "admin")
$result = $this->lxreq("login-class=client&action=simplelist&resource=dnstemplate",
$host, $user, $password, $usessl);
else
$result = $this->lxreq("login-class=client&action=simplelist&resource=dnstemplate&parent-class=client&parent-name=${user}",
$host, $user, $password, $usessl);
$output = explode("&", $result);
$return1 = array();
foreach ($output as $v)
if (!empty($v)) {
$t = explode("=", $v);
$return1[$t[1]] = $t[1];
}
$return2 = $this->listcpkgs($host, $user, $password, $usessl);
$return = array_intersect($return1, $return2);
//print_r($return);
return $return;
}
*/
//original name of function listcpkgs
function listpkgs($host, $user, $password, $usessl)
{
$result = $this->lxreq("action=simplelist&resource=resourceplan", $host, $user, $password, $usessl);
$result = json_decode($result);
if($result->return == 'success'){
foreach($result->result as $object){
$return[$object.'___client-'."$user"] = $object.'___client-'."$user";
}
}else{
$return = $result->message;
}
return $return;
}
function lxreq($request, $host, $user, $password, $usessl)
{
/*
$ch = curl_init();
if ($usessl) {
$u = "https://${host}:7777/webcommand.php?login-class=client&login-name=${user}&login-password=${password}&output-type=json&" .
$request;
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_URL, $u);
} else {
$u = "http://${host}:7778/webcommand.php?login-class=client&login-name=${user}&login-password=${password}&output-type=json&" .
$request;
curl_setopt($ch, CURLOPT_URL, $u);
}
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
*/
if($usessl == true){$s= 's'; $port = '7777';}else{$port = '7778';}
$u = "http{$s}://${host}:{$port}/webcommand.php?login-class=client&login-name=${user}&login-password=${password}&output-type=json&{$request}";
if(!function_exists('file_get_contents')){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
}else{
$data = file_get_contents($u);
}
return $data;
}
}
//Updated and Adapted for JSON by Hackinho in Sept 21 2011 at 22:06
?>
Make sure to thank him if it works for you.
[Updated on: Wed, 21 September 2011 23:34] Report message to a moderator
|
|
|
| Re: AccountLab Plus [message #89296 is a reply to message #89250] |
Thu, 22 September 2011 12:44   |
|
|
Hellow , i installed and added the server plan etc. but when i want to test it , to "buy" a free plan , i complete the registration form but when i hit Continue(at the form with the email password address etc. ) i get a window in the browser saying "The server returned the following HTTP status: 500 Received: " any help? Thank you
|
|
|
| Re: AccountLab Plus [message #89298 is a reply to message #89296] |
Thu, 22 September 2011 13:45   |
|
hello, the problem is on the alp and not in the plugin, I suggest you go to plan and place as follows.
on the General tab.
Force to register domain or subdomain = no.
Offer Domains with = yes.
Offer with Subdomains = yes.
try it and see if it works because both the pluing kloxo how others are requiring the registration of domain time to create the account.
any questions post here again.
sorry for english, I am Brazilian and not the English domain.
Thank you.
|
|
|
| Re: AccountLab Plus [message #89299 is a reply to message #89298] |
Thu, 22 September 2011 13:52   |
|
Hy , thanks for the fast response , i did what you said but its not working .. same error , also in the ALP admin panel when i click Synchronize to the server a error page appears : "HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request." , im using google chrome , i hope you can help me , thanks again
also if this helps , im using CentOs 5.6 , httpd-2.2.17-lxcenter.1 , mysql-5.0.92-lxcenter.1 , php-5.2.17-1 and the latest kloxo 6.1.6
[Updated on: Thu, 22 September 2011 13:55] Report message to a moderator
|
|
| |
| Re: AccountLab Plus [message #89303 is a reply to message #89250] |
Thu, 22 September 2011 14:37   |
|
friend, just out of curiosity you are using a separate server from the alp in kloxo because pluing tested the local network, if you are using more server computers kloxo and alp dirent also check your firewall and see if you are using the Apache and Permissions certain because the folder does not run well on alp lightttp, check the logs kloxo and also serves the web post here.
no doubt return here.
Friend also whether it is using the latest version of the alp that can be found here
sourceforge.net / projects / accountlabplus /
Thank you.
[Updated on: Thu, 22 September 2011 14:40] Report message to a moderator
|
|
|
| Re: AccountLab Plus [message #89306 is a reply to message #89303] |
Thu, 22 September 2011 15:16   |
|
|
kloxo and alp are on the same computer , and alp is the latest version , Server version: Apache/2.2.17 (Unix) , and in the logs from /var/log/ there is nothing related to kloxo or alp sorry i am not an advanced linux user ...
|
|
| | | | |
| Re: AccountLab Plus [message #90079 is a reply to message #89250] |
Tue, 18 October 2011 01:09   |
|
Good Day,
Where do I drop this file in accountlab plus?
Should I put this the directory:
system/classes
and replace the original file there?
I just want to confirm first.
Thanks
|
|
| |
| |
 |
Goto Forum:
Current Time: Mon May 20 00:35:34 EDT 2013
Total time taken to generate the page: 0.01278 seconds
|