diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-12-07 13:23:57 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-12-07 13:23:57 +0100 |
commit | 8bbede425193caa57be81638b8377c2c9a21e022 (patch) | |
tree | 8bfcf49e84ff917b4dd34e1936f5b0024e556906 /phpBB | |
parent | 8370857f0408b9610ba80e9bc06cde19c8e58983 (diff) | |
download | forums-8bbede425193caa57be81638b8377c2c9a21e022.tar forums-8bbede425193caa57be81638b8377c2c9a21e022.tar.gz forums-8bbede425193caa57be81638b8377c2c9a21e022.tar.bz2 forums-8bbede425193caa57be81638b8377c2c9a21e022.tar.xz forums-8bbede425193caa57be81638b8377c2c9a21e022.zip |
[ticket/11997] Add method for controller redirect URLs to path helper
This method will allow us to get proper redirect URLs for controllers.
PHPBB3-11997
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/phpbb/path_helper.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 71252ac05b..f6587fa101 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -183,4 +183,28 @@ class path_helper */ return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1); } + + /** + * Get the redirect URL for controllers + * + * @param string $url URL to the controller + * + * @param string Redirect URL for controller + */ + public function get_controller_redirect_url($url) + { + // Remove predecing dots + $url = ltrim($this->remove_web_root_path($url), '.'); + + // Get position of URL delimiter + $delimiter_position = strpos($url, '/'); + + // Add URL delimiter in front of path if it doesn't exist + if ($delimiter_position === false || $delimiter_position > 1) + { + $url = '/' . $url; + } + + return generate_board_url() . $url; + } } |