From ab4f589816fb2ec00066d21456b0177e48152867 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 5 Dec 2013 11:50:49 +0100 Subject: [PATCH] add new template-variables (SERVER_HOSTNAME, SERVER_IP, SERVER_IP and DOMAINNAME) to create-customer-email-template, fixes #432 Signed-off-by: Michael Kaufmann (d00p) --- admin_customers.php | 19 ++++++++++++++++++- lng/english.lng.php | 4 ++++ lng/german.lng.php | 4 ++++ .../admin/templates/templates_add_2.tpl | 16 ++++++++++++++++ .../admin/templates/templates_edit.tpl | 16 ++++++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/admin_customers.php b/admin_customers.php index b3322be2..0e0906f9 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -917,6 +917,8 @@ if ($page == 'customers' Database::pexecute($ins_stmt, array('name' => $loginname)); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added ftp-account for user '" . $loginname . "'"); + $_stdsubdomain = ''; + if ($createstdsubdomain == '1') { if (isset($settings['system']['stdsubdomain']) @@ -968,13 +970,28 @@ if ($page == 'customers' if ($sendpassword == '1') { + $srv_hostname = $settings['system']['hostname']; + if ($settings['system']['froxlordirectlyviahostname'] == '0') { + $srv_hostname .= '/froxlor'; + } + + $srv_ip_stmt = Database::prepare(" + SELECT ip, port FROM `".TABLE_PANEL_IPSANDPORTS."` + WHERE `id` = :defaultip + "); + $srv_ip = Database::pexecute_first($srv_ip_stmt, array('defaultip' => $settings['system']['defaultip'])); + $replace_arr = array( 'FIRSTNAME' => $firstname, 'NAME' => $name, 'COMPANY' => $company, 'SALUTATION' => getCorrectUserSalutation(array('firstname' => $firstname, 'name' => $name, 'company' => $company)), 'USERNAME' => $loginname, - 'PASSWORD' => $password + 'PASSWORD' => $password, + 'SERVER_HOSTNAME' => $srv_hostname, + 'SERVER_IP' => isset($srv_ip['ip']) ? $srv_ip['ip'] : '', + 'SERVER_PORT' => isset($srv_ip['port']) ? $srv_ip['port'] : '', + 'DOMAINNAME' => $_stdsubdomain ); // Get mail templates from database; the ones from 'admin' are fetched for fallback diff --git a/lng/english.lng.php b/lng/english.lng.php index bc67069b..3c88b237 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1996,3 +1996,7 @@ $lng['serversettings']['allow_error_report_customer']['description'] = 'Please n $lng['admin']['phpsettings']['enable_slowlog'] = 'Enable slowlog (per domain)'; $lng['admin']['phpsettings']['request_terminate_timeout'] = 'Request terminate-timeout'; $lng['admin']['phpsettings']['request_slowlog_timeout'] = 'Request slowlog-timeout'; +$lng['admin']['templates']['SERVER_HOSTNAME'] = 'Replaces the system-hostname (URL to froxlor)'; +$lng['admin']['templates']['SERVER_IP'] = 'Replaces the default server ip-address'; +$lng['admin']['templates']['SERVER_PORT'] = 'Replaces the default server port'; +$lng['admin']['templates']['DOMAINNAME'] = 'Replaces the customers standard-subdomain (can be empty if none is generated)'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 4cba2b95..c8f0c637 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1722,3 +1722,7 @@ $lng['serversettings']['allow_error_report_customer']['description'] = 'Bitte be $lng['admin']['phpsettings']['enable_slowlog'] = 'FPM slowlog pro Domain aktivieren'; $lng['admin']['phpsettings']['request_terminate_timeout'] = 'Request terminate-timeout'; $lng['admin']['phpsettings']['request_slowlog_timeout'] = 'Request slowlog-timeout'; +$lng['admin']['templates']['SERVER_HOSTNAME'] = 'Wird mit dem System-Hostname (URL zu froxlor) ersetzt'; +$lng['admin']['templates']['SERVER_IP'] = 'Wird mit der standard System IP-Adresse ersetzt'; +$lng['admin']['templates']['SERVER_PORT'] = 'Wird mit dem standard Port ersetzt'; +$lng['admin']['templates']['DOMAINNAME'] = 'Wird mit der Standardsubdomain des Kunden ersetzt (kann leer sein, wenn keine erstellt werden soll)'; diff --git a/templates/Froxlor/admin/templates/templates_add_2.tpl b/templates/Froxlor/admin/templates/templates_add_2.tpl index ab4863a9..6efdfdc8 100644 --- a/templates/Froxlor/admin/templates/templates_add_2.tpl +++ b/templates/Froxlor/admin/templates/templates_add_2.tpl @@ -77,6 +77,22 @@ $header {PASSWORD} {$lng['admin']['templates']['PASSWORD']} + + {SERVER_HOSTNAME} + {$lng['admin']['templates']['SERVER_HOSTNAME']} + + + {SERVER_IP} + {$lng['admin']['templates']['SERVER_IP']} + + + {SERVER_PORT} + {$lng['admin']['templates']['SERVER_PORT']} + + + {DOMAINNAME} + {$lng['admin']['templates']['DOMAINNAME']} + {$lng['admin']['templates']['pop_success']} diff --git a/templates/Froxlor/admin/templates/templates_edit.tpl b/templates/Froxlor/admin/templates/templates_edit.tpl index 9ea66452..61de306b 100644 --- a/templates/Froxlor/admin/templates/templates_edit.tpl +++ b/templates/Froxlor/admin/templates/templates_edit.tpl @@ -78,6 +78,22 @@ $header {PASSWORD} {$lng['admin']['templates']['PASSWORD']} + + {SERVER_HOSTNAME} + {$lng['admin']['templates']['SERVER_HOSTNAME']} + + + {SERVER_IP} + {$lng['admin']['templates']['SERVER_IP']} + + + {SERVER_PORT} + {$lng['admin']['templates']['SERVER_PORT']} + + + {DOMAINNAME} + {$lng['admin']['templates']['DOMAINNAME']} + {$lng['admin']['templates']['pop_success']}