From d5473beac0fb8fdd2b11be1f7fd286d2aaed1649 Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Tue, 22 Oct 2013 09:58:40 -0400
Subject: [PATCH] - Display server name in all web domains select fields so that you know which domain from which server you select.
---
interface/lib/classes/functions.inc.php | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 0801c1c..f708834 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -129,11 +129,36 @@
return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep);
}
+ //* convert currency formatted number back to floating number
+ public function currency_unformat($number) {
+ global $app;
+
+ $number_format_dec_point = $app->lng('number_format_dec_point');
+ $number_format_thousands_sep = $app->lng('number_format_thousands_sep');
+ if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
+
+ if($number_format_thousands_sep != '') $number = str_replace($number_format_thousands_sep, '', $number);
+ if($number_format_dec_point != '.' && $number_format_dec_point != '') $number = str_replace($number_format_dec_point, '.', $number);
+
+ return (double)$number;
+ }
+
public function get_ispconfig_url() {
+ global $app;
+
$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
- $url .= '://'.$_SERVER['SERVER_NAME'];
- if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
- $url .= ':'.$_SERVER['SERVER_PORT'];
+ if($_SERVER['SERVER_NAME'] != '_') {
+ $url .= '://'.$_SERVER['SERVER_NAME'];
+ if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
+ $url .= ':'.$_SERVER['SERVER_PORT'];
+ }
+ } else {
+ $app->uses("getconf");
+ $server_config = $app->getconf->get_server_config(1,'server');
+ $url .= '://'.$server_config['hostname'];
+ if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
+ $url .= ':'.$_SERVER['SERVER_PORT'];
+ }
}
return $url;
}
@@ -303,7 +328,7 @@
}
public function intval($string, $force_numeric = false) {
- if(intval($string) == 2147483647) {
+ if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
if($force_numeric == true) return floatval($string);
elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
else return 0;
--
Gitblit v1.9.1