diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 9da8f89310a..27c6bbeed73 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -187,10 +187,18 @@ print ' '."\n"; print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + if (! getIsHTTPS()) { + $langs->load("errors"); + print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; + } + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; print ''."\n"; } else { - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + if (! getIsHTTPS()) { + $langs->load("errors"); + print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; + } + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; print ''."\n"; print ''."\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index db05f29fe5a..56103e2dc11 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2897,6 +2897,26 @@ function getUserRemoteIP() return $ip; } +/** + * Return if we are using a HTTPS connexion + * Check HTTPS (no way to be modified by user but may be empty or wrong if user is using a proxy) + * Take HTTP_X_FORWARDED_PROTO (defined when using proxy) + * Then HTTP_X_FORWARDED_SSL + * + * @return boolean True if user is using HTTPS + */ +function getIsHTTPS() +{ + $isSecure = false; + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { + $isSecure = true; + } + elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { + $isSecure = true; + } + return $isSecure; +} + /** * Return a country code from IP. Empty string if not found. * diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 501a3005860..9a20094a7aa 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -283,3 +283,4 @@ WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were re WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into ECM database index table WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list +WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. \ No newline at end of file diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2b29bbfd229..6a9cbf112df 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -769,7 +769,8 @@ span.fa.fa-plus-circle.paddingleft { padding-bottom: 2px; } -.fa-toggle-on, .fa-toggle-off { font-size: 2em; } +.size15x { font-size: 1.5em; } +.fa-toggle-on, .fa-toggle-off, .size2x { font-size: 2em; } .websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off, .asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off, .tdwebsitesearchresult .fa-toggle-on, .tdwebsitesearchresult .fa-toggle-off diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 01cace5a5e8..550f80216d2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -840,7 +840,8 @@ body[class*="colorblind-"] .text-success{ color: rgb() !important; } -.fa-toggle-on, .fa-toggle-off { font-size: 2em; } +.size15x { font-size: 1.5em; } +.fa-toggle-on, .fa-toggle-off, .size2x { font-size: 2em; } .websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off, .asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom;