LxCenter HyperVM & Kloxo Support

Forum



Members   Search      Help    Register    Login    Home
Home » Kloxo Community Support » API and Integration » AccountLab Plus(A working plugin)
AccountLab Plus [message #89250] Wed, 21 September 2011 23:18 Go to next message
Walter  
Messages: 865
Registered: February 2009
Location: Florianopolis / BR
Senior Master
Forum Moderator
LxCenter Project Manager

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. Smile


[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 Go to previous messageGo to next message
h1pn0z3 is currently offline h1pn0z3  Romania
Messages: 4
Registered: September 2011
Member
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 Go to previous messageGo to next message
hackinho is currently offline hackinho  Brazil
Messages: 8
Registered: September 2011
Member
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 Go to previous messageGo to next message
h1pn0z3 is currently offline h1pn0z3  Romania
Messages: 4
Registered: September 2011
Member
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 #89300 is a reply to message #89299] Thu, 22 September 2011 14:26 Go to previous messageGo to next message
shazar is currently offline shazar  United States
Messages: 1856
Registered: May 2011
Grandmaster
LxCenter Core Team Member
LxCenter Representative
Your webserver logs should give you more info on exactly what caused the 500 error.

https://www.mercuryvps.com
HyperVM Xen VPS hosting
Re: AccountLab Plus [message #89303 is a reply to message #89250] Thu, 22 September 2011 14:37 Go to previous messageGo to next message
hackinho is currently offline hackinho  Brazil
Messages: 8
Registered: September 2011
Member
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 Go to previous messageGo to next message
h1pn0z3 is currently offline h1pn0z3  Romania
Messages: 4
Registered: September 2011
Member
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 #89307 is a reply to message #89306] Thu, 22 September 2011 15:22 Go to previous messageGo to next message
shazar is currently offline shazar  United States
Messages: 1856
Registered: May 2011
Grandmaster
LxCenter Core Team Member
LxCenter Representative
I think the logs are in another location. Check the phpinfo for the exact. I don't know it off hand.

https://www.mercuryvps.com
HyperVM Xen VPS hosting
Re: AccountLab Plus [message #89308 is a reply to message #89307] Thu, 22 September 2011 15:58 Go to previous messageGo to next message
h1pn0z3 is currently offline h1pn0z3  Romania
Messages: 4
Registered: September 2011
Member
hi , i turned the php logging on and restarted the server but still no text in the file Neutral , have a look if it helps prvhost. com /phpinfo.php
Re: AccountLab Plus [message #89311 is a reply to message #89308] Thu, 22 September 2011 16:21 Go to previous messageGo to next message
hackinho is currently offline hackinho  Brazil
Messages: 8
Registered: September 2011
Member
does the following (h1pn0z3) gives me access data by mp so I can help you better ok.
Re: AccountLab Plus [message #89316 is a reply to message #89311] Thu, 22 September 2011 19:22 Go to previous messageGo to next message
shazar is currently offline shazar  United States
Messages: 1856
Registered: May 2011
Grandmaster
LxCenter Core Team Member
LxCenter Representative
The log should be: /home/httpd/<domain>/stats

https://www.mercuryvps.com
HyperVM Xen VPS hosting
Re: AccountLab Plus [message #90079 is a reply to message #89250] Tue, 18 October 2011 01:09 Go to previous messageGo to next message
danreb is currently offline danreb  Philippines
Messages: 1
Registered: October 2011
Location: Philippines
Member

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
Re: AccountLab Plus [message #90108 is a reply to message #90079] Wed, 19 October 2011 01:27 Go to previous message
mustafaramadhan is currently offline mustafaramadhan  Indonesia
Messages: 5669
Registered: December 2010
Location: Yogyakarta
Super Grandmaster
Forum Moderator

http://sourceforge.net/projects/accountlabplus/

http://download.lxcenter.org/kdev.png
..:: MRatWork ::..
Server/Web-integrator - perfect not always more useful

--- Need KVM/OpenVZ VPS? - click here (Kloxo-MR READY!) ---

For bug/feature/security - Member rank status

http://download.lxcenter.org/hdev.png
Previous Topic:getting information from slaves
Next Topic:ReadMe
Goto Forum:
  


Current Time: Mon May 20 00:35:34 EDT 2013

Total time taken to generate the page: 0.01278 seconds
.:: Contact :: Home :: Privacy ::.

Click here to lend your support to: LxCenter and make a donation at www.pledgie.com !

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software