mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/15245] Fix images in feeds when accessing via app.php
PHPBB3-15245
This commit is contained in:
parent
d095e620c1
commit
27ae01c27a
3 changed files with 23 additions and 8 deletions
|
@ -18,6 +18,7 @@ services:
|
|||
class: phpbb\feed\helper
|
||||
arguments:
|
||||
- '@config'
|
||||
- '@path_helper'
|
||||
- '@user'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
|
|
|
@ -21,6 +21,9 @@ class helper
|
|||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\path_helper */
|
||||
protected $path_helper;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
|
@ -33,14 +36,16 @@ class helper
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param string $phpbb_root_path Root path
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\path_helper $path_helper Path helper object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param string $phpbb_root_path Root path
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||
public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->path_helper = $path_helper;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpEx = $phpEx;
|
||||
|
@ -113,7 +118,7 @@ class helper
|
|||
$content = str_replace('<br />', '<br />' . "\n", $content);
|
||||
|
||||
// Convert smiley Relative paths to Absolute path, Windows style
|
||||
$content = str_replace($this->phpbb_root_path . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content);
|
||||
$content = str_replace($this->path_helper->get_web_root_path() . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content);
|
||||
|
||||
// Remove "Select all" link and mouse events
|
||||
$content = str_replace('<a href="#" onclick="selectCode(this); return false;">' . $this->user->lang['SELECT_ALL_CODE'] . '</a>', '', $content);
|
||||
|
@ -152,7 +157,7 @@ class helper
|
|||
$content .= implode('<br />', $post_attachments);
|
||||
|
||||
// Convert attachments' relative path to absolute path
|
||||
$content = str_replace($this->phpbb_root_path . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content);
|
||||
$content = str_replace($this->path_helper->get_web_root_path() . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content);
|
||||
}
|
||||
|
||||
// Remove Comments from inline attachments [ia]
|
||||
|
|
|
@ -31,13 +31,22 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case
|
|||
|
||||
$this->filesystem = new \phpbb\filesystem();
|
||||
$config = new \phpbb\config\config(array());
|
||||
$path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
'php'
|
||||
);
|
||||
$user = new \phpbb\user(
|
||||
new \phpbb\language\language(
|
||||
new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)
|
||||
),
|
||||
'\phpbb\datetime'
|
||||
);
|
||||
$feed_helper = new \phpbb\feed\helper($config, $user, $phpbb_root_path, $phpEx);
|
||||
$feed_helper = new \phpbb\feed\helper($config, $path_helper, $user, $phpbb_root_path, $phpEx);
|
||||
$db = $this->new_dbal();
|
||||
$cache = new \phpbb_mock_cache();
|
||||
$auth = new \phpbb\auth\auth();
|
||||
|
|
Loading…
Add table
Reference in a new issue