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:
54
modules/domain/classes/domain.php
Normal file
54
modules/domain/classes/domain.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class looks after DOMAIN NAME products
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Product
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class DOMAIN {
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return ADSL
|
||||
*/
|
||||
public static function instance() {
|
||||
return new DOMAIN;
|
||||
}
|
||||
|
||||
public function product_view($data) {
|
||||
}
|
||||
|
||||
public function contract_view($data,$price_base,$price_setup) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect information for the cart
|
||||
*/
|
||||
public function product_cart() {
|
||||
$output = '';
|
||||
|
||||
$output .= '<script type="text/javascript">//<![CDATA[
|
||||
$(document).ready(function() {
|
||||
$("input[type=submit]").attr("disabled","disabled");
|
||||
});
|
||||
//]]></script>
|
||||
';
|
||||
|
||||
$output .= View::factory('domain/cart');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function NS(Model_Service_Plugin_Domain $o) {
|
||||
if ($o->registrar_ns)
|
||||
return is_array($o->registrar_ns) ? implode(',',$o->registrar_ns) : '>Invalid<';
|
||||
else
|
||||
return is_array($o->domain_registrar->whitelabel_ns) ? implode(',',$o->domain_registrar->whitelabel_ns) : '>Unknown<';
|
||||
}
|
||||
}
|
||||
?>
|
27
modules/domain/classes/model/domain/registrar.php
Normal file
27
modules/domain/classes/model/domain/registrar.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Domain TLD Registrars
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Host_TLD_Registrar
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Domain_Registrar extends ORMOSB {
|
||||
/**
|
||||
* The button that provides a login to the Registrar to manage the domain license
|
||||
*/
|
||||
public function manage_button($u,$p,$d) {
|
||||
$c = sprintf('Service_Domain_%s',$this->file);
|
||||
if (! class_exists($c))
|
||||
return '';
|
||||
|
||||
$po = new $c($this->id);
|
||||
|
||||
return $po->manage_button($u,$p,$d);
|
||||
}
|
||||
}
|
||||
?>
|
20
modules/domain/classes/model/domain/tld.php
Normal file
20
modules/domain/classes/model/domain/tld.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Domain TLD
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Domains
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Domain_TLD extends ORMOSB {
|
||||
protected $_display_filters = array(
|
||||
'name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
);
|
||||
}
|
||||
?>
|
71
modules/domain/classes/model/service/plugin/domain.php
Normal file
71
modules/domain/classes/model/service/plugin/domain.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Services
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage DOMAIN
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Service_Plugin_Domain extends Model_Service_Plugin {
|
||||
protected $_table_name = 'service__domain';
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
// Relationships
|
||||
protected $_has_one = array(
|
||||
'domain_tld'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
|
||||
'domain_registrar'=>array('foreign_key'=>'id','far_key'=>'domain_registrar_id'),
|
||||
'service_plugin_host'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'),
|
||||
);
|
||||
protected $_belongs_to = array(
|
||||
'service'=>array(),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'domain_expire'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'domain_name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
'registrar_ns'=>array(
|
||||
array('Domain::NS',array(':model')),
|
||||
),
|
||||
'registrar_lastsync'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
// Required abstract functions
|
||||
public function service_view() {
|
||||
return View::factory('service/user/plugin/domain/view')
|
||||
->set('so',$this);
|
||||
}
|
||||
|
||||
public function name() {
|
||||
return sprintf('%s.%s',$this->display('domain_name'),$this->domain_tld->display('name'));
|
||||
}
|
||||
|
||||
public function service_name() {
|
||||
return sprintf('%s - %s',_('Domain Name License'),$this->name());
|
||||
}
|
||||
|
||||
protected function _admin_update() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This provides us with a manage button to jump to the registrar
|
||||
* to manage the domain.
|
||||
*/
|
||||
public function manage_button() {
|
||||
return ($this->registrar_username AND $this->registrar_password) ? $this->domain_registrar->manage_button($this->registrar_username,$this->registrar_password,$this->name()) : _('Please contact us');
|
||||
}
|
||||
|
||||
public function manage_dns_button() {
|
||||
return $this->service_plugin_host->manage_button();
|
||||
}
|
||||
}
|
||||
?>
|
56
modules/domain/classes/service/domain.php
Normal file
56
modules/domain/classes/service/domain.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_Domain {
|
||||
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('domain_registrar',$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;
|
||||
}
|
||||
}
|
||||
?>
|
23
modules/domain/classes/service/domain/manual.php
Normal file
23
modules/domain/classes/service/domain/manual.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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_Domain_Manual extends Service_Domain {
|
||||
private $login_acnt_field = '';
|
||||
private $login_user_field = '';
|
||||
private $login_pass_field = '';
|
||||
|
||||
// Our required abstract classes
|
||||
public function manage_button($u,$p,$d) {
|
||||
return _('Please contact us');
|
||||
}
|
||||
}
|
||||
?>
|
35
modules/domain/classes/service/domain/planetdomain.php
Normal file
35
modules/domain/classes/service/domain/planetdomain.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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_Domain_PlanetDomain extends Service_Domain {
|
||||
private $login_acnt_field = '';
|
||||
private $login_user_field = 'login.username';
|
||||
private $login_pass_field = 'login.password';
|
||||
|
||||
// Our required abstract classes
|
||||
public function manage_button($u,$p,$d) {
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
sprintf('%s/%s',$this->so->whitelabel_url,'newdnr/action/user/login.jsp'),
|
||||
array('target'=>'pd','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::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden'));
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
34
modules/domain/classes/service/domain/tpp.php
Normal file
34
modules/domain/classes/service/domain/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_Domain_TPP extends Service_Domain {
|
||||
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;
|
||||
}
|
||||
}
|
||||
?>
|
51
modules/domain/views/service/user/plugin/domain/view.php
Normal file
51
modules/domain/views/service/user/plugin/domain/view.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<!-- //@todo To translate -->
|
||||
<table class="box-full">
|
||||
<tr>
|
||||
<td class="head" colspan="2">Service Details</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="width: 40%;">Domain Name</td>
|
||||
<td style="width: 60%;" class="data"><?php echo $so->name(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Domain Expire</td>
|
||||
<td class="data"><?php echo $so->display('domain_expire'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Domain Primary Name Servers</td>
|
||||
<td class="data"><?php echo $so->display('registrar_ns'); ?> <span style="small">(Last Sync: <?php echo $so->display('registrar_lastsync'); ?>)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Domain Auth Password</td>
|
||||
<td class="data"><?php echo $so->display('registrar_auth_password'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Domain Type</td>
|
||||
<td class="data"><?php echo $so->display('registrar_type'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width: 50%">
|
||||
<table width="100%">
|
||||
<?php if ($x=$so->manage_button()) { ?>
|
||||
<tr>
|
||||
<td style="width: 40%;">Manage Registrar</td>
|
||||
<td style="width: 60%;" class="data"><?php echo $x; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if ($x=$so->manage_dns_button()) { ?>
|
||||
<tr>
|
||||
<td style="width: 40%;">Manage DNS</td>
|
||||
<td style="width: 60%;" class="data"><?php echo $x; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
Reference in New Issue
Block a user