Misc fixes from live
This commit is contained in:
parent
df74512105
commit
425ea9ff10
@ -26,6 +26,8 @@ abstract class ORM extends lnApp_ORM {
|
||||
$this->where($this->_object_name.'.site_id','=',Company::instance()->site());
|
||||
|
||||
// Ensure we Cache our queries
|
||||
// @todo: Disabled as it is not working as expected
|
||||
/*
|
||||
$caching = FALSE;
|
||||
foreach ($this->_db_pending as $method)
|
||||
if ($method['name'] == 'cached') {
|
||||
@ -35,6 +37,7 @@ abstract class ORM extends lnApp_ORM {
|
||||
|
||||
if (! $caching)
|
||||
$this->cached(Kohana::$config->load('cache.orm.'.$this->_table_name));
|
||||
*/
|
||||
|
||||
return parent::_build($type);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class ADSL_Billing_Exetelvisp {
|
||||
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3])));
|
||||
$result[$service]['credit'] = str_replace('$','',$record[6]);
|
||||
|
||||
} elseif (preg_match('/Excess usage charges for /',$record[3])) {
|
||||
} elseif (preg_match('/Excess usage charges/',$record[3])) {
|
||||
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3])));
|
||||
$result[$service]['excess'] = str_replace('$','',$record[7]);
|
||||
|
||||
|
@ -19,6 +19,10 @@ class Model_Charge extends ORM_OSB implements Invoicable {
|
||||
'invoice_item'=>array('far_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_compress_column = array(
|
||||
'attributes',
|
||||
);
|
||||
|
||||
protected $_nullifempty = array(
|
||||
'attributes',
|
||||
);
|
||||
|
@ -27,6 +27,8 @@
|
||||
<dd><?php echo HTML::anchor($o->registrar->whitelabel_url,NULL); ?></dd>
|
||||
<dt>Username</dt>
|
||||
<dd><?php echo $o->registrar_username; ?></dd>
|
||||
<dt>Password</dt>
|
||||
<dd><?php echo $o->registrar_password; ?></dd>
|
||||
<?php endif ?>
|
||||
</div> <!-- dl-horizontal -->
|
||||
</fieldset>
|
||||
|
@ -19,6 +19,8 @@
|
||||
<dd><?php echo HTML::anchor($o->host->whitelabel_url,NULL); ?></dd>
|
||||
<dt>Username</dt>
|
||||
<dd><?php echo $o->host_username; ?></dd>
|
||||
<dt>Password</dt>
|
||||
<dd><?php echo $o->host_password; ?></dd>
|
||||
<?php endif ?>
|
||||
</div> <!-- dl-horizontal -->
|
||||
</fieldset>
|
||||
|
@ -222,9 +222,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
* Check the reminder value
|
||||
*/
|
||||
public function remind($key) {
|
||||
if (isset($this->reminders[$key]))
|
||||
return (is_array($this->reminders[$key])) ? end($this->reminders[$key]) : $this->reminders[$key];
|
||||
else
|
||||
if (isset($this->reminders[$key])) {
|
||||
$x = $this->reminders[$key];
|
||||
return is_array($x) ? end($x) : $x;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,16 @@ class Controller_Reseller_SSL extends Controller_SSL {
|
||||
);
|
||||
|
||||
public function action_list() {
|
||||
$o = ORM::factory('SSL_CA')->where_authorised($this->ao);
|
||||
if ($this->request->param('id') != 'Y')
|
||||
$o->where_active();
|
||||
|
||||
Block::factory()
|
||||
->title('SSL CA Certificates')
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->jssort('ca')
|
||||
->data(ORM::factory('SSL_CA')->where_authorised($this->ao)->where_active()->find_all())
|
||||
->data($o->find_all())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'sign_cert'=>'Cert',
|
||||
|
@ -56,8 +56,12 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
public function __call($name,$args) {
|
||||
$m = 'get_'.$name;
|
||||
|
||||
if (method_exists($this->_so,$m))
|
||||
if ($this->isCSR() AND method_exists($this,$m))
|
||||
return $this->{$m}($args);
|
||||
|
||||
elseif (method_exists($this->_so,$m))
|
||||
return $this->_so->{$m}($args);
|
||||
|
||||
else
|
||||
throw new Kohana_Exception('Unknown method :method',array(':method'=>$name));
|
||||
}
|
||||
@ -72,6 +76,13 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this just a CSR?
|
||||
*/
|
||||
public function isCSR() {
|
||||
return ! $this->cert AND $this->csr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all our CA Certs for this certificate
|
||||
*/
|
||||
@ -103,16 +114,32 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function get_dn() {
|
||||
return SSL::csrsubject($this->csr);
|
||||
}
|
||||
|
||||
public function get_valid_to() {
|
||||
// @todo
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
* Renew an SSL Certificate
|
||||
*/
|
||||
// @todo: Renew renews the expiry date as 1 day too early.
|
||||
public function renew($force=FALSE) {
|
||||
$sslo = SSL::instance($this->cert);
|
||||
$ssl_conf = Kohana::$config->load('ssl');
|
||||
|
||||
// If our certificate is not old enough skip
|
||||
if ($sslo->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
if ($this->cert) {
|
||||
$sslo = SSL::instance($this->cert);
|
||||
|
||||
// If our certificate is not old enough skip
|
||||
if ($sslo->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
|
||||
} elseif (! $this->csr) {
|
||||
throw new Kohana_Exception('Unable to renew, no CERT or CSR');
|
||||
}
|
||||
|
||||
$today = mktime(0,0,0,date('n'),date('j'),date('Y'));
|
||||
$days = (int)(($this->service->invoiced_to()-$today)/86400);
|
||||
|
@ -28,7 +28,7 @@ class SSL {
|
||||
private static function _dec_to_hex($number) {
|
||||
$hex = array();
|
||||
|
||||
if ($number == 0)
|
||||
if ($number == 0 OR ! $number)
|
||||
return '00';
|
||||
|
||||
while ($number > 0) {
|
||||
|
@ -6,38 +6,40 @@
|
||||
<dt>DN</dt>
|
||||
<dd><?php echo $o->dn(); ?></dd>
|
||||
|
||||
<dt>Serial Number</dt>
|
||||
<dd><?php echo $o->serial(); ?></dd>
|
||||
<?php if (! $o->isCSR()) : ?>
|
||||
<dt>Serial Number</dt>
|
||||
<dd><?php echo $o->serial(); ?></dd>
|
||||
|
||||
<dt>Subject Key Id</dt>
|
||||
<dd><?php echo $o->ski(); ?></dd>
|
||||
<dt>Subject Key Id</dt>
|
||||
<dd><?php echo $o->ski(); ?></dd>
|
||||
|
||||
<dt>Issuer</dt>
|
||||
<dd>
|
||||
<?php if ($o->validCA() AND $o->authorised($o->ca)) : ?>
|
||||
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->ca->id,$o->issuer()); ?>
|
||||
<?php else : ?>
|
||||
<?php echo $o->issuer(); ?>
|
||||
<?php endif ?>
|
||||
</dd>
|
||||
<dt>Issuer</dt>
|
||||
<dd>
|
||||
<?php if ($o->validCA() AND $o->authorised($o->ca)) : ?>
|
||||
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->ca->id,$o->issuer()); ?>
|
||||
<?php else : ?>
|
||||
<?php echo $o->issuer(); ?>
|
||||
<?php endif ?>
|
||||
</dd>
|
||||
|
||||
<dt>Issuer Serial</dt>
|
||||
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
|
||||
<dt>Issuer Serial</dt>
|
||||
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
|
||||
|
||||
<dt>Valid From</dt>
|
||||
<dd><?php echo $o->valid_from(TRUE); ?></dd>
|
||||
<dt>Valid From</dt>
|
||||
<dd><?php echo $o->valid_from(TRUE); ?></dd>
|
||||
|
||||
<dt>Valid To</dt>
|
||||
<dd><?php echo $o->valid_to(TRUE); ?></dd>
|
||||
<dt>Valid To</dt>
|
||||
<dd><?php echo $o->valid_to(TRUE); ?></dd>
|
||||
|
||||
<dt>Hash</dt>
|
||||
<dd><?php echo $o->hash(); ?></dd>
|
||||
<dt>Hash</dt>
|
||||
<dd><?php echo $o->hash(); ?></dd>
|
||||
|
||||
<dt>Version</dt>
|
||||
<dd><?php echo $o->version(); ?></dd>
|
||||
<dt>Version</dt>
|
||||
<dd><?php echo $o->version(); ?></dd>
|
||||
|
||||
<dt>Algorithm</dt>
|
||||
<dd><?php echo $o->algorithm(); ?></dd>
|
||||
<dt>Algorithm</dt>
|
||||
<dd><?php echo $o->algorithm(); ?></dd>
|
||||
<?php endif ?>
|
||||
|
||||
</div> <!-- dl-horizontal -->
|
||||
</fieldset>
|
||||
|
Reference in New Issue
Block a user