From c54d8c724ed33b8cdd9f055994fdef3ebcc0c06f Mon Sep 17 00:00:00 2001 From: Victor Emanouilov Date: Fri, 10 Apr 2020 11:27:23 +0300 Subject: [PATCH] add WEB_ROOT constant to allow theme and static asset files loaded from a different web root URL --- index.php | 1 + modules/api_login/api.php | 2 ++ modules/pgp/modules.php | 6 +++--- modules/smtp/modules.php | 12 ++++++------ modules/themes/modules.php | 2 +- scripts/config_gen.php | 1 + scripts/create_account.php | 1 + scripts/create_config.php | 1 + scripts/delete_account.php | 1 + scripts/update_password.php | 1 + tests/phpunit/bootstrap.php | 1 + 11 files changed, 19 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index cb7f486816..7c6f463cfe 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,7 @@ */ define('APP_PATH', ''); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); define('DEBUG_MODE', true); define('CACHE_ID', ''); define('SITE_ID', ''); diff --git a/modules/api_login/api.php b/modules/api_login/api.php index 3f5f19169b..3f05ae165a 100644 --- a/modules/api_login/api.php +++ b/modules/api_login/api.php @@ -8,6 +8,8 @@ /* Constants */ define('DEBUG_MODE', false); define('APP_PATH', dirname(dirname(dirname(__FILE__))).'/'); +define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); define('CONFIG_FILE', APP_PATH.'hm3.rc'); /* Init the framework */ diff --git a/modules/pgp/modules.php b/modules/pgp/modules.php index a4f5820f9a..f091b58cd9 100644 --- a/modules/pgp/modules.php +++ b/modules/pgp/modules.php @@ -107,7 +107,7 @@ protected function output() { return; } $pub_keys = $this->get('pgp_public_keys', array()); - $res = ''; + $res = ''; $res .= '
'; $res .= ''; @@ -132,7 +132,7 @@ protected function output() { class Hm_Output_pgp_settings_start extends Hm_Output_Module { protected function output() { $res = '
'.$this->trans('PGP Settings').'
'; - $res .= ''; + $res .= ''; return $res; } } @@ -199,7 +199,7 @@ protected function output() { */ class Hm_Output_pgp_msg_controls extends Hm_Output_Module { protected function output() { - return ''. + return ''. '
'.prompt_for_passhrase($this); } } diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index b86ab66545..e9e044ae93 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -652,8 +652,8 @@ protected function output() { } $res = ''; if ($html == 1) { - $res .= ''. - ''. + $res .= ''. + ''. ''; } $res .= ''. @@ -681,9 +681,9 @@ protected function output() { $this->trans('Subject').'" />'; if ($html == 2) { - $res .= ''. - ''. - ''. + $res .= ''. + ''. + ''. ''; } $res .= ''; diff --git a/modules/themes/modules.php b/modules/themes/modules.php index 02b3c43dd9..18b62a8e67 100644 --- a/modules/themes/modules.php +++ b/modules/themes/modules.php @@ -62,7 +62,7 @@ class Hm_Output_theme_css extends Hm_Output_Module { */ protected function output() { if ($this->get('theme') && in_array($this->get('theme'), array_keys($this->get('themes', array())), true) && $this->get('theme') != 'default') { - return ''; + return ''; } } } diff --git a/scripts/config_gen.php b/scripts/config_gen.php index 6e55131a9c..95f7bee42d 100644 --- a/scripts/config_gen.php +++ b/scripts/config_gen.php @@ -14,6 +14,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(__FILE__)).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); chdir(APP_PATH); /* get the framework */ diff --git a/scripts/create_account.php b/scripts/create_account.php index 8372db8285..c9fa0ee757 100644 --- a/scripts/create_account.php +++ b/scripts/create_account.php @@ -21,6 +21,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(__FILE__)).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); /* get the framework */ require APP_PATH.'lib/framework.php'; diff --git a/scripts/create_config.php b/scripts/create_config.php index f317737223..2ab8a7e3d4 100644 --- a/scripts/create_config.php +++ b/scripts/create_config.php @@ -9,6 +9,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(__FILE__)).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); /* get the framework */ require APP_PATH.'lib/framework.php'; diff --git a/scripts/delete_account.php b/scripts/delete_account.php index 1d2753945d..639ab9cdf1 100644 --- a/scripts/delete_account.php +++ b/scripts/delete_account.php @@ -20,6 +20,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(__FILE__)).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); /* get the framework */ require APP_PATH.'lib/framework.php'; diff --git a/scripts/update_password.php b/scripts/update_password.php index d0a3708ecd..9f6a15ac78 100644 --- a/scripts/update_password.php +++ b/scripts/update_password.php @@ -21,6 +21,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(__FILE__)).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); /* get the framework */ require APP_PATH.'lib/framework.php'; diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index a5790d2757..9cab67ed47 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -11,6 +11,7 @@ /* determine current absolute path used for require statements */ define('APP_PATH', dirname(dirname(dirname(__FILE__))).'/'); define('VENDOR_PATH', APP_PATH.'vendor/'); +define('WEB_ROOT', ''); /* random id */ define('SITE_ID', 'randomid');