aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/path_helper.php
diff options
context:
space:
mode:
authorOliver Schramm <oliver.schramm97@gmail.com>2017-10-05 14:54:47 +0200
committerOliver Schramm <oliver.schramm97@gmail.com>2017-10-05 14:54:47 +0200
commit5514b1069968d451adb7eaf89278a6e1e5dc20df (patch)
tree245b21642c134c4509e46fab60d130065e123624 /phpBB/phpbb/path_helper.php
parent93621aa1844ab48d9bae068d9872d2c49ae86de4 (diff)
parentca5678cc1c2a1f723d39127e0c066eba6c9a3336 (diff)
downloadforums-5514b1069968d451adb7eaf89278a6e1e5dc20df.tar
forums-5514b1069968d451adb7eaf89278a6e1e5dc20df.tar.gz
forums-5514b1069968d451adb7eaf89278a6e1e5dc20df.tar.bz2
forums-5514b1069968d451adb7eaf89278a6e1e5dc20df.tar.xz
forums-5514b1069968d451adb7eaf89278a6e1e5dc20df.zip
Merge pull request #4960 from rxu/ticket/15367
[ticket/15367] Escape special characters in Sphinx search backend
Diffstat (limited to 'phpBB/phpbb/path_helper.php')
-rw-r--r--phpBB/phpbb/path_helper.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php
index 5400c1c5a6..5b6db35f23 100644
--- a/phpBB/phpbb/path_helper.php
+++ b/phpBB/phpbb/path_helper.php
@@ -21,7 +21,7 @@ class path_helper
/** @var \phpbb\symfony_request */
protected $symfony_request;
- /** @var \phpbb\filesystem */
+ /** @var \phpbb\filesystem\filesystem_interface */
protected $filesystem;
/** @var \phpbb\request\request_interface */
@@ -43,13 +43,13 @@ class path_helper
* Constructor
*
* @param \phpbb\symfony_request $symfony_request
- * @param \phpbb\filesystem $filesystem
+ * @param \phpbb\filesystem\filesystem_interface $filesystem
* @param \phpbb\request\request_interface $request
* @param string $phpbb_root_path Relative path to phpBB root
* @param string $php_ext PHP file extension
* @param mixed $adm_relative_path Relative path admin path to adm/ root
*/
- public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, \phpbb\request\request_interface $request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
+ public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\request\request_interface $request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
{
$this->symfony_request = $symfony_request;
$this->filesystem = $filesystem;
@@ -100,11 +100,18 @@ class path_helper
*/
public function update_web_root_path($path)
{
+ $web_root_path = $this->get_web_root_path();
+
+ // Removes the web root path if it is already present
+ if (strpos($path, $web_root_path) === 0)
+ {
+ $path = $this->phpbb_root_path . substr($path, strlen($web_root_path));
+ }
+
if (strpos($path, $this->phpbb_root_path) === 0)
{
$path = substr($path, strlen($this->phpbb_root_path));
- $web_root_path = $this->get_web_root_path();
if (substr($web_root_path, -8) === 'app.php/' && substr($path, 0, 7) === 'app.php')
{
$path = substr($path, 8);
@@ -489,4 +496,17 @@ class path_helper
return $page;
}
+
+ /**
+ * Tells if the router is currently in use (if the current page is a route or not)
+ *
+ * @return bool
+ */
+ public function is_router_used()
+ {
+ // Script name URI (e.g. phpBB/app.php)
+ $script_name = $this->symfony_request->getScriptName();
+
+ return basename($script_name) === 'app.' . $this->php_ext;
+ }
}