2013-10-10 02:44:53 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides CPANEL support
|
|
|
|
*
|
|
|
|
* @package Host
|
|
|
|
* @category Plugins
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
|
|
|
abstract class Host_Plugin_Cpanel extends Host_Plugin {
|
|
|
|
// Service Object
|
|
|
|
# protected $protocol = '1.6.0.0';
|
|
|
|
# protected $path = 'enterprise/control/agent.php';
|
|
|
|
# protected $packet;
|
|
|
|
# protected $xml;
|
|
|
|
# protected $_loaded = FALSE;
|
|
|
|
|
|
|
|
// Manage UI Login Attributes
|
|
|
|
protected $url = 'login';
|
|
|
|
protected $login_acnt_field = '';
|
|
|
|
protected $login_user_field = 'user';
|
|
|
|
protected $login_pass_field = 'pass';
|
|
|
|
|
|
|
|
// Our required abstract classes
|
|
|
|
public function serialize() {
|
|
|
|
return (string)$this->_object;
|
|
|
|
}
|
|
|
|
public function unserialize($s) {
|
|
|
|
$this->_object = XML::factory(NULL,NULL,$s);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __get($index) {
|
|
|
|
echo __METHOD__;die();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function admin_update() {
|
|
|
|
echo __METHOD__;die();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function manage_button(Model_Service_Plugin_Host $spho,$t) {
|
2014-05-20 11:49:52 +00:00
|
|
|
return $this->render_button($t,$spho->service_id,$spho->username(),substr(md5($spho->password()),0,8));
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
public function admin_manage_button(Model_Host_Server $hso,$t) {
|
|
|
|
return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function render_button($t,$sid,$u,$p) {
|
|
|
|
$debug = FALSE;
|
|
|
|
$output = '';
|
|
|
|
|
|
|
|
$output .= Form::open(
|
|
|
|
$debug ? 'debug/site' : sprintf('%s/%s',$this->hso->manage_url,$this->url),
|
|
|
|
array('target'=>'w24','method'=>'post','id'=>sprintf('id_%s_%s',$sid,$t))
|
|
|
|
);
|
|
|
|
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden','id'=>sprintf('u_%s_%s',$sid,$t)));
|
|
|
|
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden','id'=>sprintf('p_%s_%s',$sid,$t)));
|
|
|
|
$output .= Form::close();
|
2013-06-04 11:50:41 +00:00
|
|
|
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$sid,$t)));
|
2013-10-10 02:44:53 +00:00
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function init() {
|
|
|
|
echo __METHOD__;die();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function server_command(XML $xml) {
|
|
|
|
echo __METHOD__;die();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loaded() {
|
|
|
|
return $this->_loaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function render(XML $xml) {
|
|
|
|
echo __METHOD__;die();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|