Work on Email and other major consistency work

This commit is contained in:
Deon George
2013-11-22 15:36:50 +11:00
parent 89deb9c97b
commit c18d5a3881
55 changed files with 550 additions and 575 deletions

View File

@@ -116,44 +116,19 @@ class Controller_Reseller_SSL extends Controller_SSL {
public function action_renew() {
$so = ORM::factory('Service',Request::current()->param('id'));
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account)) {
SystemMessage::factory()
->title('SSL Certificate not updated')
->type('error')
->body('Either the Service doesnt exist, or you are not authorised to see it');
HTTP::redirect('welcome');
}
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
$so->plugin()->renew();
HTTP::redirect(URL::link('user','service/view/'.$so->id));
}
private function add_edit($id=NULL,$output='') {
$sco = ORM::factory('SSL_CA',$id);
if ($_POST) {
// Entry updated
if ($sco->values($_POST)->check()) {
try {
$sco->save();
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your Charge record has been recorded/updated.'));
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('models');
SystemMessage::factory()
->title('Record NOT updated')
->type('error')
->body(join('<br/>',array_values($errors)));
$sco->reload();
}
}
}
if ($_POST AND $sco->values($_POST)->changed() AND ! ($this->save($sco)))
$sco->reload();
return View::factory('ssl/reseller/add_edit')
->set('o',$sco);

View File

@@ -15,13 +15,13 @@ class Controller_User_SSL extends Controller_SSL {
);
public function action_download() {
$id = $_POST['sid'];
$so = ORM::factory('Service',$id);
$so = ORM::factory('Service',$this->request->post('sid'));
if (! $so->loaded())
HTTP::redirect('welcome/index');
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
$passwd = $this->request->post('passwd');
$passwd = $_POST['passwd'];
if (strlen($passwd) < Kohana::$config->load('ssl')->minpass_length) {
SystemMessage::add(array(
'title'=>_('Validation failed'),
@@ -32,11 +32,6 @@ class Controller_User_SSL extends Controller_SSL {
HTTP::redirect(URL::link('user','service/view/'.$so->id));
}
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account)) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;
}
// Log the download
$smo = $so->service_memo;
$smo->service_id = $so->id;
@@ -49,10 +44,11 @@ class Controller_User_SSL extends Controller_SSL {
openssl_pkcs12_export_to_file($so->plugin()->cert,$file,$so->plugin()->pk,$passwd,array('extracerts'=>$so->plugin()->cacerts()));
$x = file_get_contents($file);
unlink($file);
$this->auto_render = FALSE;
$this->response->headers('Content-Type','application/pks12');
$this->response->headers('Content-Disposition','attachment; filename="'.basename($file).'"');
$this->response->body($x);
$this->auto_render = FALSE;
}
}
?>