This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/host/classes/Host/Plugin/Cpanel.php

82 lines
2.2 KiB
PHP
Raw Normal View History

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) {
return $this->render_button($t,$spho->service_id,$spho->username_value(),substr(md5($spho->password_value()),0,8));
}
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();
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$sid,$t)));
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();
}
}
?>