Major work to domain and hosting
Minor updates for ADSL services Updates to Sort::MAsort() Move core OSB items under application/ Moved ACCOUNT functions under application Minor updates to task
This commit is contained in:
24
modules/host/classes/model/host/server.php
Normal file
24
modules/host/classes/model/host/server.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports OSB Web Hosting
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Product
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Host_Server extends ORMOSB {
|
||||
public function manage_button($u,$p,$d) {
|
||||
$c = sprintf('Service_Host_%s',$this->provision_plugin);
|
||||
if (! class_exists($c))
|
||||
return '';
|
||||
|
||||
$po = new $c($this->id);
|
||||
|
||||
return $po->manage_button($u,$p,$d);
|
||||
}
|
||||
}
|
||||
?>
|
57
modules/host/classes/model/service/plugin/host.php
Normal file
57
modules/host/classes/model/service/plugin/host.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Services
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Hosting
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
||||
protected $_table_name = 'service__hosting';
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
// Relationships
|
||||
protected $_has_one = array(
|
||||
'domain_tld'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
|
||||
'host_server'=>array('far_key'=>'host_server_id','foreign_key'=>'id'),
|
||||
);
|
||||
protected $_belongs_to = array(
|
||||
'service'=>array(),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'domain_name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
'host_expire'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
// Required abstract functions
|
||||
public function service_view() {
|
||||
return View::factory('service/user/plugin/host/view')
|
||||
->set('so',$this);
|
||||
}
|
||||
|
||||
public function name() {
|
||||
return sprintf('%s.%s',$this->display('domain_name'),$this->domain_tld->display('name'));
|
||||
}
|
||||
|
||||
protected function _admin_update() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This provides us with a manage button to jump to the hosting server
|
||||
* to manage the domain.
|
||||
*/
|
||||
public function manage_button() {
|
||||
return ($this->host_username AND $this->host_password) ? $this->host_server->manage_button($this->host_username,$this->host_password,$this->name()) : '';
|
||||
}
|
||||
}
|
||||
?>
|
56
modules/host/classes/service/host.php
Normal file
56
modules/host/classes/service/host.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class will take care of Domain Registrars.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Service
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class Service_Host {
|
||||
protected $so;
|
||||
protected $fetchresult = NULL;
|
||||
// @todo These options should be centrally defined
|
||||
protected $curlopts = array(
|
||||
CURLOPT_CONNECTTIMEOUT => 60,
|
||||
CURLOPT_FAILONERROR => TRUE,
|
||||
CURLOPT_FOLLOWLOCATION => FALSE,
|
||||
CURLOPT_HEADER => FALSE,
|
||||
CURLOPT_HTTPPROXYTUNNEL => FALSE,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_SSL_VERIFYHOST => FALSE,
|
||||
CURLOPT_SSL_VERIFYPEER => FALSE,
|
||||
CURLOPT_VERBOSE => FALSE,
|
||||
);
|
||||
|
||||
/**
|
||||
* Setup this class. We need to get our supplier details out of the database.
|
||||
*/
|
||||
public function __construct($sid) {
|
||||
$this->so = ORM::factory('host_server',$sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Our HTML button that will enable us to manage this domain.
|
||||
*/
|
||||
abstract public function manage_button($u,$p,$d);
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return HeadImage
|
||||
*/
|
||||
public static function instance($supplier) {
|
||||
$sc = sprintf('%s_%s',get_called_class(),$supplier);
|
||||
|
||||
if (! class_exists($sc))
|
||||
throw new Kohana_Exception('Class doesnt exist for :supplier',array(':supplier'=>$supplier));
|
||||
else
|
||||
return new $sc;
|
||||
}
|
||||
}
|
||||
?>
|
34
modules/host/classes/service/host/plesk.php
Normal file
34
modules/host/classes/service/host/plesk.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is able to interact with PLESK
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Service
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Service_Host_Plesk extends Service_Host {
|
||||
private $login_acnt_field = '';
|
||||
private $login_user_field = 'login_name';
|
||||
private $login_pass_field = 'passwd';
|
||||
|
||||
// Our required abstract classes
|
||||
public function manage_button($u,$p,$d) {
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
sprintf('%s/%s',$this->so->manage_url,'login_up.php3'),
|
||||
array('target'=>'w24','method'=>'post')
|
||||
);
|
||||
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden'));
|
||||
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden'));
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
34
modules/host/classes/service/host/tpp.php
Normal file
34
modules/host/classes/service/host/tpp.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is able to interact with TPP
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Service
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Service_Host_TPP extends Service_Host {
|
||||
private $login_acnt_field = '';
|
||||
private $login_user_field = 'login';
|
||||
private $login_pass_field = 'password';
|
||||
|
||||
// Our required abstract classes
|
||||
public function manage_button($u,$p,$d) {
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'),
|
||||
array('target'=>'tpp','method'=>'post')
|
||||
);
|
||||
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden'));
|
||||
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden'));
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user