phpBB

Code Changes

File: phpbb/path_helper.php

  Unmodified   Added   Modified   Removed
Line 38Line 38

/** @var string */
protected $web_root_path;


/** @var string */
protected $web_root_path;

 

/** @var bool Flag whether we're in adm path */
protected $in_adm_path = false;


/**
* Constructor


/**
* Constructor

Line 117Line 120
				$path = substr($path, 8);
}


				$path = substr($path, 8);
}


			return $this->filesystem->clean_path($web_root_path . $path);







			$path = $this->filesystem->clean_path($web_root_path . $path);

// Further clean path if we're in adm
if ($this->in_adm_path && strpos($path, $this->phpbb_root_path . $this->adm_relative_path) === 0)
{
$path = substr($path, strlen($this->phpbb_root_path . $this->adm_relative_path));
}

		}

return $path;

		}

return $path;

Line 151Line 160
	*/
public function get_web_root_path()
{

	*/
public function get_web_root_path()
{

		if ($this->symfony_request === null)

		if (null !== $this->web_root_path)

		{

		{

			return $this->phpbb_root_path;

			return $this->web_root_path;

		}


		}


		if (null !== $this->web_root_path)

		if (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH)

		{

		{

			return $this->web_root_path;

			return $this->web_root_path = generate_board_url() . '/';

		}

// We do not need to escape $path_info, $request_uri and $script_name because we can not find their content in the result.

		}

// We do not need to escape $path_info, $request_uri and $script_name because we can not find their content in the result.

Line 179Line 188
		if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri))
{
return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path);

		if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri))
{
return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path);

 
		}

if ($path_info === '/' && defined('ADMIN_START') && preg_match('/\/' . preg_quote($this->adm_relative_path, '/') . 'index\.' . $this->php_ext . '$/', $script_name))
{
$this->in_adm_path = true;

		}

/*

		}

/*

Line 218Line 232
				$this->symfony_request->get('_referer'),
$absolute_board_url
);

				$this->symfony_request->get('_referer'),
$absolute_board_url
);

			return $this->web_root_path = $this->phpbb_root_path . $referer_web_root_path;

			return $this->web_root_path = $referer_web_root_path;

		}

// How many corrections might we need?

		}

// How many corrections might we need?

Line 236Line 250

// Prepend ../ to the phpbb_root_path as many times as / exists in path_info
$this->web_root_path = $this->filesystem->clean_path(


// Prepend ../ to the phpbb_root_path as many times as / exists in path_info
$this->web_root_path = $this->filesystem->clean_path(

			'./' . str_repeat('../', $corrections) . $this->phpbb_root_path

			'./' . str_repeat('../', max(0, $corrections)) . $this->phpbb_root_path

		);
return $this->web_root_path;
}

		);
return $this->web_root_path;
}

Line 264Line 278
				$relative_referer_path = substr($relative_referer_path, 0, $has_params);
}
$corrections = substr_count($relative_referer_path, '/');

				$relative_referer_path = substr($relative_referer_path, 0, $has_params);
}
$corrections = substr_count($relative_referer_path, '/');

			return $this->phpbb_root_path . str_repeat('../', $corrections - 1);

			return $this->phpbb_root_path . str_repeat('../', max(0, $corrections - 1));

		}

// If not, it's a bit more complicated. We go to the parent directory

		}

// If not, it's a bit more complicated. We go to the parent directory