aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-26 20:49:23 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-26 20:49:23 +0200
commit8bb25589ffae1e7b8562b429ea945bfcbe491b8a (patch)
tree9d11026c1da6b2ef75a9e72fdf11b23256c32085
parentdd5273871a74d01d87fa1eaad7aa53bc1c148f85 (diff)
URL absolue pour token
Corrige https://github.com/marienfressinaud/FreshRSS/issues/213 Abandonne le protocole relatif "//" et repasse à des "http://" ou "https://" explicites
-rw-r--r--app/views/configure/display.phtml2
-rwxr-xr-xlib/minz/Url.php13
2 files changed, 9 insertions, 6 deletions
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index 0f89437ac..09ac011af 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -56,7 +56,7 @@
<?php $token = $this->conf->token (); ?>
<div class="group-controls">
<input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>"/>
- <i class="icon i_help"></i> <?php echo Translate::t('explain_token', Url::display(), $token); ?>
+ <i class="icon i_help"></i> <?php echo Translate::t('explain_token', Url::display(null, 'html', true), $token); ?>
</div>
</div>
diff --git a/lib/minz/Url.php b/lib/minz/Url.php
index 9bda98363..4a703e64b 100755
--- a/lib/minz/Url.php
+++ b/lib/minz/Url.php
@@ -22,11 +22,14 @@ class Url {
$url_string = '';
if ($absolute) {
- $protocol = (is_array ($url) && isset ($url['protocol'])) ? ($url['protocol'] . ':') : ''; //Empty protocol will use automatic http or https
- $url_string = $protocol
- . '//'
- . Request::getDomainName ()
- . Request::getBaseUrl ();
+ if (is_array ($url) && isset ($url['protocol'])) {
+ $protocol = $url['protocol'];
+ } elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
+ $protocol = 'https:';
+ } else {
+ $protocol = 'http:';
+ }
+ $url_string = $protocol . '//' . Request::getDomainName () . Request::getBaseUrl ();
}
else {
$url_string = '.';