From 8173c6f28d9fd55fa249d76330bf7709923c4fcd Mon Sep 17 00:00:00 2001 From: Falko Timme Date: Wed, 7 Jan 2015 14:40:35 +0100 Subject: [PATCH] - Added option to fill fields on SSL tab with client data by clicking on a link. --- interface/lib/classes/db_mysql.inc.php | 2 +- interface/web/sites/ajax_get_json.php | 38 +++++++++++++++++++ .../sites/lib/lang/de_web_vhost_domain.lng | 3 ++ .../sites/lib/lang/en_web_vhost_domain.lng | 3 ++ .../sites/templates/web_vhost_domain_ssl.htm | 34 ++++++++++++++++- interface/web/sites/web_vhost_domain_edit.php | 12 ++++++ 6 files changed, 90 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php index d9ec9b8d0..c076c356e 100644 --- a/interface/lib/classes/db_mysql.inc.php +++ b/interface/lib/classes/db_mysql.inc.php @@ -252,7 +252,7 @@ class db extends mysqli $sQuery = call_user_func_array(array(&$this, '_build_query_string'), $aArgs); $this->securityScan($sQuery); - $this->_iQueryId = mysqli_query($this->_iConnId, $sQuery); + $this->_iQueryId = @mysqli_query($this->_iConnId, $sQuery); if (!$this->_iQueryId) { $this->_sqlerror('Falsche Anfrage / Wrong Query', false, 'SQL-Query = ' . $sQuery); return false; diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index fb2f1c093..243c158da 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -201,6 +201,44 @@ if ($type == 'getdirectivesnippet') { $json = json_encode($snippets); } +if($type == 'getclientssldata'){ + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", intval($web_id)); + $sys_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE groupid = ?", intval($web['sys_groupid'])); + $client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", intval($sys_group['client_id'])); + if(is_array($client) && !empty($client)){ + if($client['telephone'] == '' && $client['mobile'] != '') $client['telephone'] = $client['mobile']; + + $fname = ''; + $lname = ''; + $parts = preg_split("/\s+/", $client['contact_name']); + if(sizeof($parts) == 2){ + $fname = $parts[0]; + $lname = $parts[1]; + } + if(sizeof($parts) > 2){ + $fname = $parts[0].' '; + for($i=1;$ifunctions->json_encode($client); +} + //} header('Content-type: application/json'); diff --git a/interface/web/sites/lib/lang/de_web_vhost_domain.lng b/interface/web/sites/lib/lang/de_web_vhost_domain.lng index a6b866df3..7917cae90 100644 --- a/interface/web/sites/lib/lang/de_web_vhost_domain.lng +++ b/interface/web/sites/lib/lang/de_web_vhost_domain.lng @@ -137,4 +137,7 @@ $wb['apache_directive_blocked_error'] = 'Die Apache Direktive wurde durch die Si $wb['btn_save_txt'] = 'Speichern'; $wb['btn_cancel_txt'] = 'Abbrechen'; $wb['enable_spdy_txt'] = 'Aktiviere SPDY'; +$wb['load_client_data_txt'] = 'Kundendaten übernehmen'; +$wb['load_my_data_txt'] = 'Meine Kontaktdaten laden'; +$wb['reset_client_data_txt'] = 'Daten verwerfen'; ?> diff --git a/interface/web/sites/lib/lang/en_web_vhost_domain.lng b/interface/web/sites/lib/lang/en_web_vhost_domain.lng index 3be30d054..8af57ff82 100644 --- a/interface/web/sites/lib/lang/en_web_vhost_domain.lng +++ b/interface/web/sites/lib/lang/en_web_vhost_domain.lng @@ -140,4 +140,7 @@ $wb['subdomain_error_empty'] = 'The subdommain field is empty or contains invali $wb['btn_save_txt'] = "Save"; $wb['btn_cancel_txt'] = "Cancel"; $wb['enable_spdy_txt'] = 'Enable SPDY'; +$wb['load_client_data_txt'] = 'Load client details'; +$wb['load_my_data_txt'] = 'Load my contact details'; +$wb['reset_client_data_txt'] = 'Reset data'; ?> diff --git a/interface/web/sites/templates/web_vhost_domain_ssl.htm b/interface/web/sites/templates/web_vhost_domain_ssl.htm index e910e22b1..90467468d 100644 --- a/interface/web/sites/templates/web_vhost_domain_ssl.htm +++ b/interface/web/sites/templates/web_vhost_domain_ssl.htm @@ -14,6 +14,12 @@
+ + +
@@ -37,7 +43,7 @@
- + @@ -83,3 +89,29 @@
+ \ No newline at end of file diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 27ece43ef..6e7d4347f 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -142,6 +142,8 @@ class page_action extends tform_actions { $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); if($this->_vhostdomain_type != 'domain') $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); + + $is_admin = false; //* Client: If the logged in user is not admin and has no sub clients (no reseller) if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { @@ -451,6 +453,8 @@ class page_action extends tform_actions { //* Admin: If the logged in user is admin } else { + + $is_admin = true; if($this->_vhostdomain_type == 'domain') { // The user is admin, so we fill in all IP addresses of the server @@ -700,6 +704,14 @@ class page_action extends tform_actions { $app->tpl->setVar('vhostdomain_type', $this->_vhostdomain_type); $app->tpl->setVar('is_spdy_enabled', ($web_config['enable_spdy'] === 'y')); + $app->tpl->setVar("is_admin", $is_admin); + + if($this->id > 0) { + $tmp_web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", intval($this->id)); + $tmp_sys_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE groupid = ?", intval($tmp_web['sys_groupid'])); + if(intval($tmp_sys_group['client_id']) > 0) $tmp_client = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = ?", intval($tmp_sys_group['client_id'])); + if(is_array($tmp_client) && !empty($tmp_client) && trim($this->dataRecord['ssl_organisation']) == '' && trim($this->dataRecord['ssl_locality']) == '' && trim($this->dataRecord['ssl_state']) == '' && trim($this->dataRecord['ssl_organisation_unit']) == '') $app->tpl->setVar("show_helper_links", true); + } parent::onShowEnd(); } -- GitLab