Many misc fixes

This commit is contained in:
Deon George
2012-02-22 19:15:46 +11:00
parent f0f6479ca2
commit d9c3394b0f
14 changed files with 47 additions and 18 deletions

View File

@@ -80,10 +80,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
public function _details($type) {
switch ($type) {
case 'invoice_detail_items':
return array(
_('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
_('Contract Until')=>$this->contract_date_end(),
);
return array();
break;
default:
return parent::$_details($type);
@@ -125,17 +122,19 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
public function renew() {
$d = SSL::details($this->cert);
$ssl_conf = Kohana::config('ssl');
// @todo change this so an admin can force this.
$force = TRUE;
// If our certificate is not old enough skip
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400)
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
return FALSE;
$res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->ssl->days,array(
$res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->service->product->plugin()->days,array(
'config'=>$ssl_conf['config'],
'x509_extensions'=>$this->ssl->extensions,
'x509_extensions'=>$this->service->product->plugin()->extensions,
),time());
if (openssl_x509_export($res,$cert)) {
if ($res AND openssl_x509_export($res,$cert)) {
$this->cert = $cert;
$this->save();