From f52de04d050e93914d144421fd6ae0f1982e35e9 Mon Sep 17 00:00:00 2001
From: Michael Fürmann <michael@spicyweb.de>
Date: Tue, 03 Mar 2015 09:57:09 -0500
Subject: [PATCH] Handle host-specific ssl certificates

---
 interface/web/mail/xmpp_domain_edit.php |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/interface/web/mail/xmpp_domain_edit.php b/interface/web/mail/xmpp_domain_edit.php
index 2844a27..b30d4d1 100644
--- a/interface/web/mail/xmpp_domain_edit.php
+++ b/interface/web/mail/xmpp_domain_edit.php
@@ -49,14 +49,16 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-    var $_xmpp_type = 'domain';
+    var $_xmpp_type = 'server';
 
     function onLoad() {
         $show_type = 'server';
-        if(isset($_GET['type']) && $_GET['type'] == 'modules') {
+        if(isset($_REQUEST['type']) && $_REQUEST['type'] == 'modules') {
             $show_type = 'modules';
-        } elseif(isset($_GET['type']) && $_GET['type'] == 'muc') {
+        } elseif(isset($_REQUEST['type']) && $_REQUEST['type'] == 'muc') {
             $show_type = 'muc';
+        }elseif(isset($_REQUEST['type']) && $_REQUEST['type'] == 'ssl') {
+            $show_type = 'ssl';
         }
 
         $_SESSION['s']['var']['xmpp_type'] = $show_type;
@@ -363,6 +365,21 @@
             }
         }
 
+        if($this->_xmpp_type == 'ssl'){
+            //* Check that all fields for the SSL cert creation are filled
+            if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') {
+                if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'<br />';
+                if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'<br />';
+                if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'<br />';
+                if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
+                if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
+            }
+
+            if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
+                if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'<br />';
+            }
+        }
+
         //* make sure that the xmpp domain is lowercase
         if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
 

--
Gitblit v1.9.1