From 13c2f8d968ed5d76ff7d2272046a34e05ecd38da Mon Sep 17 00:00:00 2001 From: ZerooCool Date: Tue, 30 Jun 2020 22:36:36 +0200 Subject: [PATCH 1/3] Make Opengraph really functional 3 URLs of images used on social networks are passed in absolute URL. Note that I did not pass all the images in absolute URLs, but, it could be consistent to do so, but, if the images work, maybe a relative call is more efficient? Remove the version of PrivateBin, at the end of each image. This apparently prevents the opengraph from working, and, so I deleted on all of the images, to remain consistent at this level. This will make fewer requests, and, anyway, the images are not intended to change with each version. --- cfg/conf.sample.php | 4 ++++ lib/Configuration.php | 1 + lib/Controller.php | 1 + tpl/bootstrap.php | 12 ++++++------ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index e2ba01a1..06f403ef 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -7,6 +7,10 @@ ; (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 +; path = "" + ; enable or disable the discussion feature, defaults to true discussion = true diff --git a/lib/Configuration.php b/lib/Configuration.php index 89db37ae..90134c1f 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -38,6 +38,7 @@ class Configuration private static $_defaults = array( 'main' => array( 'name' => 'PrivateBin', + 'path' => '', 'discussion' => true, 'opendiscussion' => false, 'password' => true, diff --git a/lib/Controller.php b/lib/Controller.php index 0c039f5f..6b6769d9 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -369,6 +369,7 @@ class Controller $page = new View; $page->assign('NAME', $this->_conf->getKey('name')); + $page->assign('PATH', I18n::_($this->_conf->getKey('path'))); $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 c06372ee..899be8b7 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -74,11 +74,11 @@ endif; - - - + + + - + @@ -86,11 +86,11 @@ endif; - + - + From e61c44ef466c802581f3f72b5e8f712262965a82 Mon Sep 17 00:00:00 2001 From: ZerooCool Date: Wed, 1 Jul 2020 19:47:12 +0200 Subject: [PATCH 2/3] Make Opengraph really functional Make Opengraph really functional Change : #664 for #651 --- cfg/conf.sample.php | 2 +- lib/Configuration.php | 2 +- lib/Controller.php | 2 +- tpl/bootstrap.php | 6 +++--- tst/ViewTest.php | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index 06f403ef..6b9295e4 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -9,7 +9,7 @@ ; 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 -; path = "" +; basepath = "" ; enable or disable the discussion feature, defaults to true discussion = true diff --git a/lib/Configuration.php b/lib/Configuration.php index 90134c1f..f929c816 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -38,7 +38,7 @@ class Configuration private static $_defaults = array( 'main' => array( 'name' => 'PrivateBin', - 'path' => '', + 'basepath' => '', 'discussion' => true, 'opendiscussion' => false, 'password' => true, diff --git a/lib/Controller.php b/lib/Controller.php index 6b6769d9..744a5237 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -369,7 +369,7 @@ class Controller $page = new View; $page->assign('NAME', $this->_conf->getKey('name')); - $page->assign('PATH', I18n::_($this->_conf->getKey('path'))); + $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 899be8b7..003c668a 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -74,7 +74,7 @@ endif; - + @@ -86,11 +86,11 @@ endif; - + - + diff --git a/tst/ViewTest.php b/tst/ViewTest.php index 7bab1663..2be83b43 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -34,6 +34,7 @@ class ViewTest extends PHPUnit_Framework_TestCase /* Setup Routine */ $page = new View; $page->assign('NAME', 'PrivateBinTest'); + $page->assign('BASEPATH', false); $page->assign('ERROR', self::$error); $page->assign('STATUS', self::$status); $page->assign('VERSION', self::$version); From 4204e4b8b72dd5cc0899fbc7495c96f828c3a6af Mon Sep 17 00:00:00 2001 From: El RIDO Date: Fri, 3 Jul 2020 21:00:42 +0200 Subject: [PATCH 3/3] make StyleCI happy and change unit test to use a string --- lib/Configuration.php | 2 +- tst/ViewTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Configuration.php b/lib/Configuration.php index f929c816..06783706 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -38,7 +38,7 @@ class Configuration private static $_defaults = array( 'main' => array( 'name' => 'PrivateBin', - 'basepath' => '', + 'basepath' => '', 'discussion' => true, 'opendiscussion' => false, 'password' => true, diff --git a/tst/ViewTest.php b/tst/ViewTest.php index 2be83b43..61530521 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -34,7 +34,7 @@ class ViewTest extends PHPUnit_Framework_TestCase /* Setup Routine */ $page = new View; $page->assign('NAME', 'PrivateBinTest'); - $page->assign('BASEPATH', false); + $page->assign('BASEPATH', ''); $page->assign('ERROR', self::$error); $page->assign('STATUS', self::$status); $page->assign('VERSION', self::$version);