Open Source Billing
This commit is contained in:
53
modules/domain/classes/Domain.php
Normal file
53
modules/domain/classes/Domain.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class looks after DOMAIN NAME products
|
||||
*
|
||||
* @package Domain
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.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<';
|
||||
}
|
||||
}
|
||||
?>
|
26
modules/domain/classes/Model/Domain/Registrar.php
Normal file
26
modules/domain/classes/Model/Domain/Registrar.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Domain TLD Registrars
|
||||
*
|
||||
* @package Domain
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Domain_Registrar extends ORM_OSB {
|
||||
/**
|
||||
* The button that provides a login to the Registrar to manage the domain license
|
||||
*/
|
||||
public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
|
||||
$c = sprintf('Service_Domain_%s',$this->file);
|
||||
if (! class_exists($c))
|
||||
return '';
|
||||
|
||||
$po = new $c($this->id);
|
||||
|
||||
return $po->manage_button($spdo,$t);
|
||||
}
|
||||
}
|
||||
?>
|
19
modules/domain/classes/Model/Domain/TLD.php
Normal file
19
modules/domain/classes/Model/Domain/TLD.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Domain TLD
|
||||
*
|
||||
* @package Domain
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Domain_Tld extends ORM_OSB {
|
||||
protected $_display_filters = array(
|
||||
'name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
);
|
||||
}
|
||||
?>
|
41
modules/domain/classes/Model/Product/Plugin/Domain.php
Normal file
41
modules/domain/classes/Model/Product/Plugin/Domain.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports DOMAIN products
|
||||
*
|
||||
* @package Domain
|
||||
* @category Plugins
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Product_Plugin_Domain extends Model_Product_Plugin {
|
||||
// This model doesnt have a database table
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
// Our required abstract methods
|
||||
public function admin_update() {}
|
||||
public function feature_summary() {}
|
||||
|
||||
// @todo This is not used, but should be.
|
||||
public function order_features() {
|
||||
$output = '';
|
||||
$t = ORM::factory('Domain_TLD');
|
||||
|
||||
// @todo Change this to a view.
|
||||
$output = sprintf('<table class="box-full"><tr class="head"><td>%s</td></tr><tr><td>',_('Domains are available with the following suffixes'));
|
||||
$output .= Table::display(
|
||||
$t->list_active(),
|
||||
25,
|
||||
array(
|
||||
'display("name")'=>array('label'=>'TLD Suffix'),
|
||||
),
|
||||
array(
|
||||
));
|
||||
$output .= '</td></tr></table>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
83
modules/domain/classes/Model/Service/Plugin/Domain.php
Normal file
83
modules/domain/classes/Model/Service/Plugin/Domain.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports Services
|
||||
*
|
||||
* @package Domain
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 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_lastsync'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
// Required abstract functions
|
||||
public function admin_update() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function expire() {
|
||||
return $this->domain_expire;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
public function service_view() {
|
||||
return View::factory('service/user/plugin/domain/view')
|
||||
->set('so',$this);
|
||||
}
|
||||
|
||||
public function username_value() {
|
||||
return $this->registrar_username;
|
||||
}
|
||||
|
||||
public function password_value() {
|
||||
return $this->registrar_password;
|
||||
}
|
||||
|
||||
/**
|
||||
* This provides us with a manage button to jump to the registrar
|
||||
* to manage the domain.
|
||||
*/
|
||||
public function manage_button($t='') {
|
||||
if (! parent::manage_button($t))
|
||||
return NULL;
|
||||
|
||||
return ($this->username_value() AND $this->password_value()) ? $this->domain_registrar->manage_button($this,$t) : _('Please contact us');
|
||||
}
|
||||
|
||||
public function manage_dns_button() {
|
||||
return $this->service_plugin_host->manage_button('service_plugin_host');
|
||||
}
|
||||
}
|
||||
?>
|
55
modules/domain/classes/Service/Domain.php
Normal file
55
modules/domain/classes/Service/Domain.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class will take care of Domain Registrars.
|
||||
*
|
||||
* @package Domain
|
||||
* @category Service
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.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(Model_Service_Plugin_Domain $spdo,$t);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
?>
|
22
modules/domain/classes/Service/Domain/Manual.php
Normal file
22
modules/domain/classes/Service/Domain/Manual.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is able to interact with TPP
|
||||
*
|
||||
* @package Domain
|
||||
* @category Service
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 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(Model_Service_Plugin_Domain $spdo,$t) {
|
||||
return _('Please contact us');
|
||||
}
|
||||
}
|
||||
?>
|
34
modules/domain/classes/Service/Domain/PlanetDomain.php
Normal file
34
modules/domain/classes/Service/Domain/PlanetDomain.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 Domain
|
||||
* @category Service
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 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(Model_Service_Plugin_Domain $spdo,$t) {
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
sprintf('%s/%s',$this->so->whitelabel_url,'newdnr/action/user/login.jsp'),
|
||||
array('target'=>'pd','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
|
||||
);
|
||||
$output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
|
||||
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
|
||||
$output .= Form::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden'));
|
||||
$output .= Form::close();
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
|
||||
|
||||
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 Domain
|
||||
* @category Service
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 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(Model_Service_Plugin_Domain $spdo,$t) {
|
||||
$debug = FALSE;
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
$debug ? 'debug/site' : sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'),
|
||||
array('target'=>'tpp','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
|
||||
);
|
||||
$output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
|
||||
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
|
||||
$output .= Form::close();
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
|
||||
|
||||
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