diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index 6b9295e4..e2ba01a1 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -7,10 +7,6 @@ ; (optional) set a project name to be displayed on the website ; name = "PrivateBin" -; The full URL, with the domain name and directories that point to the PrivateBin files -; This URL is essential to allow Opengraph images to be displayed on social networks -; basepath = "" - ; enable or disable the discussion feature, defaults to true discussion = true diff --git a/lib/Configuration.php b/lib/Configuration.php index 06783706..89db37ae 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -38,7 +38,6 @@ class Configuration private static $_defaults = array( 'main' => array( 'name' => 'PrivateBin', - 'basepath' => '', 'discussion' => true, 'opendiscussion' => false, 'password' => true, diff --git a/lib/Controller.php b/lib/Controller.php index 744a5237..0c039f5f 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -369,7 +369,6 @@ class Controller $page = new View; $page->assign('NAME', $this->_conf->getKey('name')); - $page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath'))); $page->assign('ERROR', I18n::_($this->_error)); $page->assign('STATUS', I18n::_($this->_status)); $page->assign('VERSION', self::VERSION); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 003c668a..d3c8925e 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -3,6 +3,19 @@ use PrivateBin\I18n; $isCpct = substr($template, 9, 8) === '-compact'; $isDark = substr($template, 9, 5) === '-dark'; $isPage = substr($template, -5) === '-page'; +$protocol = 'http:'; +if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { + $protocol = 'https:'; +} +if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && ('https' == $_SERVER['HTTP_X_FORWARDED_PROTO'])) { + // none secure, assumed trusted proxy, however won't threaten client security + $protocol = 'https:'; +} +$host = $_SERVER['HTTP_HOST']; +if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { + // none secure, assumed trusted proxy, however won't threaten client security + $host = $_SERVER['HTTP_X_FORWARDED_HOST']; +} ?>
@@ -74,7 +87,7 @@ endif; - + img/apple-touch-icon.png" sizes="180x180" /> @@ -86,11 +99,11 @@ endif; - + img/apple-touch-icon.png" /> - + img/apple-touch-icon.png" /> diff --git a/tst/ViewTest.php b/tst/ViewTest.php index 61530521..7bab1663 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -34,7 +34,6 @@ class ViewTest extends PHPUnit_Framework_TestCase /* Setup Routine */ $page = new View; $page->assign('NAME', 'PrivateBinTest'); - $page->assign('BASEPATH', ''); $page->assign('ERROR', self::$error); $page->assign('STATUS', self::$status); $page->assign('VERSION', self::$version);