Updates for SSL Certificates
This commit is contained in:
@@ -12,8 +12,9 @@
|
||||
*/
|
||||
class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
protected $secure_actions = array(
|
||||
'add'=>TRUE,
|
||||
'list'=>TRUE,
|
||||
'update'=>TRUE,
|
||||
'view'=>TRUE,
|
||||
);
|
||||
|
||||
public function action_list() {
|
||||
@@ -23,7 +24,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
ORM::factory('ssl_ca')->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'admin/ssl/update/'),
|
||||
'id'=>array('label'=>'ID','url'=>'admin/ssl/view/'),
|
||||
'sign_cert'=>array('label'=>'Cert'),
|
||||
'issuer()'=>array('label'=>'Issuer'),
|
||||
'expires()'=>array('label'=>'Expires'),
|
||||
@@ -31,31 +32,49 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
array(
|
||||
'page'=>TRUE,
|
||||
'type'=>'select',
|
||||
'form'=>'admin/ssl/update',
|
||||
'form'=>'admin/ssl/view',
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
public function action_update() {
|
||||
list($id,$output) = Table::page(__METHOD__);
|
||||
|
||||
private function add_view($id=NULL,$output='') {
|
||||
$so = ORM::factory('ssl_ca',$id);
|
||||
|
||||
if (! $so->loaded())
|
||||
Request::current()->redirect('welcome/index');
|
||||
|
||||
if ($_POST) {
|
||||
if (! $so->values($_POST)->update()->saved())
|
||||
throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id()));
|
||||
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 .= View::factory($this->viewpath())
|
||||
$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',_('Update SSL Service'),$so->id,$so->display('sign_cert')),
|
||||
'body'=>$output,
|
||||
'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('ssl_ca',$id)->display('sign_cert')),
|
||||
'body'=>$this->add_view($id,$output),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user