Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WHMPHP Plugin
#1
Do you have a master reseller? But, THT only supports the root way of making resellers.
If you have WHMPHP, your in luck!!

First, open THTROOT/includes/servers/whm.php
After the comments, add
PHP Code:
require_once('THTPATHFULL/includes/whmphp.php'); 

We put it one directory below because it will be included twice when you make a server.

Find:
PHP Code:
private $server

Add After:
PHP Code:
private $pass "CPANEL PASS";
private 
$whmphp;
private 
$user "CPANEL USERNAME"// This may be refrenceable
function whm() {
        
$this->whmphp = new whmphp("YOURIP",$this->user,$this->pass); // Not localhost


Find:
PHP Code:
public function signup($server$reseller$user ''$email ''$pass '') { 

Replace Function With:
PHP Code:
public function signup($server$reseller$user ''$email ''$pass '') {
        global 
$main;
        global 
$db;
        if (
$user == '') { $user $main->getvar['username']; }
        if (
$email == '') { $email $main->getvar['email']; }
        if (
$pass == '') { $pass $main->getvar['password']; }
        
$this->server $server;
        if (
$reseller) {
            
$r $this->whmphp->createreseller($main->getvar['fplan'],$user,$pass,$main->getvar['fdom'],$email);
            echo 
$r[1];
            return 
$r[0];
        } else {
            
$action "/xml-api/createacct".
                        
"?username="$user "".
                        
"&password="$pass ."".
                        
"&domain="$main->getvar['fdom'] ."".
                        
"&plan="$main->getvar['fplan'] ."".
                        
"&contactemail="$email ."";
            
$command $this->remote($action);
            
            if(
$command->result->status == 1) {
                return 
true;    
            }
            else {
                echo 
"Error: "$command->result->statusmsg;    
            }
        }
    } 

Find:
PHP Code:
public function suspend($user$server$reason false) { 

Replace Function With:
PHP Code:
public function suspend($user$server$reason false) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->suspendreseller($user);
        } else {
            
$action "/xml-api/suspendacct?user=" strtolower($user);
            
$command $this->remote($action);
                    if(
$reason == false) {
                        
$command $this->remote($action);
                    }
                    else {
                        
$command $this->remote($action "&reason=" str_replace(" ""%20"$reason));
                    }
            if(
$command->result->status == 1) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Find:
PHP Code:
public function unsuspend($user$server) { 

Replace Function With:
PHP Code:
public function unsuspend($user$server) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->unsuspendreseller($user);
        } else {
            
$action "/xml-api/unsuspendacct?user=" strtolower($user);
            
$command $this->remote($action);
            if(
$command->result->status == 1) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Find:
PHP Code:
public function terminate($user$server) { 

Replace Function With:
PHP Code:
public function terminate($user$server) {
        
$this->server $server;
        if (
$server == 1) {
            return 
$this->whmphp->terminatereseller($user);
        } else {
            
$action "/xml-api/removeacct?user=" strtolower($user);
            
$command $this->remote($action0true);
            if(
$command == true) {
                return 
true;
            }
            else {
                return 
false;
            }
        }
    } 

Download Attachment
Place in: THTROOT/includes/

Your resellers must user the server ID 1. If you have to, switch the server id.
You will need 2 servers of the same details.
One with ID 1 for WHMPHP, one with another ID for whm.

Feel free to IM me for support:
[email protected]
[email protected]
jerryinchost (Yahoo)
ismywb (Skype)

edit: forgot to attach whmphp.php


Attached Files
.php   whmphp.php (Size: 9.84 KB / Downloads: 686)
Reply
#2
what version is this for tryed on version 1.2.3 but it doesnt work and now it wont let me add,view,delete servers unless i restore the files Smile but i need it to work with WHMPHP could you please help
Reply
#3
I get a blank page with this plugin when adding a server...
Reply
#4
Sorry guys, I forgot to mention this:
PHP Code:
require_once('THTPATHFULL/includes/whmphp.php'); 
THTPATHFULL should be replaced with full path to THT. IE: /home/user/www/order
Reply
#5
Interesting. I'll have to look into this. Maybe we can add this to TheHostingTool at some point? Smile
Kevin Mark - TheHostingTool Lead Developer
Reply
#6
That would be nice. Big Grin If you do, would you mind adding credit to me in it? like, whmphp module created by Jerry Johnson?
Reply
#7
Hi, I have found a bug in whmphp.php and I have a fix.

By the way, if I haven't said this, I am saying it now, this is not to be used by the root account to create master resellers, if it for masters resellers to create resellers.


Attached Files
.php   whmphp.php (Size: 4.42 KB / Downloads: 558)
Reply
#8
Can anyone confirm that these updates work?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)