This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/ssl/classes/controller/admin/ssl.php
2012-01-12 19:55:13 +11:00

82 lines
2.0 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Admin SSL functions
*
* @package OSB
* @subpackage SSL
* @category Controllers/Admin
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
protected $secure_actions = array(
'add'=>TRUE,
'list'=>TRUE,
'view'=>TRUE,
);
public function action_list() {
Block::add(array(
'title'=>_('SSL Services'),
'body'=>Table::display(
ORM::factory('ssl_ca')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>'admin/ssl/view/'),
'sign_cert'=>array('label'=>'Cert'),
'issuer()'=>array('label'=>'Issuer'),
'expires()'=>array('label'=>'Expires'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'admin/ssl/view',
)),
));
}
private function add_view($id=NULL,$output='') {
$so = ORM::factory('ssl_ca',$id);
if ($_POST) {
if (! $so->values($_POST)->check() OR ! $so->save())
throw new Kohana_Exception('Failed to save updates to data for record :record',array(':record'=>$so->id()));
else {
SystemMessage::add(array(
'title'=>'SSL Certificate Saved',
'type'=>'info',
'body'=>'SSL Certificate successfully recorded.',
));
}
}
$output .= Form::open();
$output .= View::factory('ssl/admin/add_view')
->set('so',$so)
->set('mediapath',Route::get('default/media'));
$output .= Form::submit('submit','submit',array('class'=>'form_button'));
$output .= Form::close();
return $output;
}
public function action_add() {
Block::add(array(
'title'=>_('Add SSL CA Certificate'),
'body'=>$this->add_view(),
));
}
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
Block::add(array(
'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('ssl_ca',$id)->display('sign_cert')),
'body'=>$this->add_view($id,$output),
));
}
}
?>