mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +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
|
class: phpbb\feed\helper
|
||||||
arguments:
|
arguments:
|
||||||
- '@config'
|
- '@config'
|
||||||
|
- '@path_helper'
|
||||||
- '@user'
|
- '@user'
|
||||||
- '%core.root_path%'
|
- '%core.root_path%'
|
||||||
- '%core.php_ext%'
|
- '%core.php_ext%'
|
||||||
|
|
|
@ -21,6 +21,9 @@ class helper
|
||||||
/** @var \phpbb\config\config */
|
/** @var \phpbb\config\config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
/** @var \phpbb\path_helper */
|
||||||
|
protected $path_helper;
|
||||||
|
|
||||||
/** @var \phpbb\user */
|
/** @var \phpbb\user */
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
@ -33,14 +36,16 @@ class helper
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param \phpbb\config\config $config Config object
|
* @param \phpbb\config\config $config Config object
|
||||||
* @param \phpbb\user $user User object
|
* @param \phpbb\path_helper $path_helper Path helper object
|
||||||
* @param string $phpbb_root_path Root path
|
* @param \phpbb\user $user User object
|
||||||
* @param string $phpEx PHP file extension
|
* @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->config = $config;
|
||||||
|
$this->path_helper = $path_helper;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->phpEx = $phpEx;
|
$this->phpEx = $phpEx;
|
||||||
|
@ -113,7 +118,7 @@ class helper
|
||||||
$content = str_replace('<br />', '<br />' . "\n", $content);
|
$content = str_replace('<br />', '<br />' . "\n", $content);
|
||||||
|
|
||||||
// Convert smiley Relative paths to Absolute path, Windows style
|
// 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
|
// 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);
|
$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);
|
$content .= implode('<br />', $post_attachments);
|
||||||
|
|
||||||
// Convert attachments' relative path to absolute path
|
// 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]
|
// 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();
|
$this->filesystem = new \phpbb\filesystem();
|
||||||
$config = new \phpbb\config\config(array());
|
$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(
|
$user = new \phpbb\user(
|
||||||
new \phpbb\language\language(
|
new \phpbb\language\language(
|
||||||
new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)
|
new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)
|
||||||
),
|
),
|
||||||
'\phpbb\datetime'
|
'\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();
|
$db = $this->new_dbal();
|
||||||
$cache = new \phpbb_mock_cache();
|
$cache = new \phpbb_mock_cache();
|
||||||
$auth = new \phpbb\auth\auth();
|
$auth = new \phpbb\auth\auth();
|
||||||
|
|
Loading…
Add table
Reference in a new issue