From d7896fbd958d22b73bcca5c1370df64f5e666118 Mon Sep 17 00:00:00 2001 From: rugk Date: Sat, 20 Aug 2016 18:53:07 +0200 Subject: [PATCH] Fix header link in subdir installations Now this does link to PrivateBin and not to the top-root (file) of the webserver --- tpl/bootstrap-compact.php | 2 +- tpl/bootstrap-dark-page.php | 2 +- tpl/bootstrap-dark.php | 2 +- tpl/bootstrap-page.php | 2 +- tpl/bootstrap.php | 2 +- .../random_compat/other/build_phar.php | 57 +++++++++++++++++++ 6 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 vendor/paragonie/random_compat/other/build_phar.php diff --git a/tpl/bootstrap-compact.php b/tpl/bootstrap-compact.php index e1a61297..1fa5bd0e 100644 --- a/tpl/bootstrap-compact.php +++ b/tpl/bootstrap-compact.php @@ -74,7 +74,7 @@ endif; - + <?php echo I18n::_('PrivateBin'); ?> diff --git a/tpl/bootstrap-dark-page.php b/tpl/bootstrap-dark-page.php index 3582c830..f0b5752b 100644 --- a/tpl/bootstrap-dark-page.php +++ b/tpl/bootstrap-dark-page.php @@ -73,7 +73,7 @@ endif; - + <?php echo I18n::_('PrivateBin'); ?> diff --git a/tpl/bootstrap-dark.php b/tpl/bootstrap-dark.php index b91e8121..a6792ee6 100644 --- a/tpl/bootstrap-dark.php +++ b/tpl/bootstrap-dark.php @@ -73,7 +73,7 @@ endif; - + <?php echo I18n::_('PrivateBin'); ?> diff --git a/tpl/bootstrap-page.php b/tpl/bootstrap-page.php index 9bc03a6d..69b8a582 100644 --- a/tpl/bootstrap-page.php +++ b/tpl/bootstrap-page.php @@ -73,7 +73,7 @@ endif; - + <?php echo I18n::_('PrivateBin'); ?> diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 840cc558..37f9d89c 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; - + <?php echo I18n::_('PrivateBin'); ?> diff --git a/vendor/paragonie/random_compat/other/build_phar.php b/vendor/paragonie/random_compat/other/build_phar.php new file mode 100644 index 00000000..70ef4b2e --- /dev/null +++ b/vendor/paragonie/random_compat/other/build_phar.php @@ -0,0 +1,57 @@ +buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +}