mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 06:51:33 +02:00
[ticket/13713] Fix case for phpBB directory
PHPBB3-13713
This commit is contained in:
62
phpBB/phpbb/mention/controller/mention.php
Normal file
62
phpBB/phpbb/mention/controller/mention.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\mention\controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class mention
|
||||
{
|
||||
/** @var \phpbb\di\service_collection */
|
||||
protected $mention_sources;
|
||||
|
||||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var string */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var string */
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
public function __construct($mention_sources, \phpbb\request\request_interface $request, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->mention_sources = $mention_sources;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->request->is_ajax())
|
||||
{
|
||||
redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext));
|
||||
}
|
||||
|
||||
$keyword = $this->request->variable('keyword', '', true);
|
||||
$topic_id = $this->request->variable('topic_id', 0);
|
||||
$names = [];
|
||||
|
||||
foreach ($this->mention_sources as $source)
|
||||
{
|
||||
$names = array_merge($names, $source->get($keyword, $topic_id));
|
||||
}
|
||||
|
||||
return new JsonResponse(array_values($names));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user