aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/controller/helper.php
diff options
context:
space:
mode:
authorNicofuma <github@nicofuma.fr>2015-05-17 20:02:29 +0200
committerNicofuma <github@nicofuma.fr>2015-05-17 20:02:29 +0200
commitc967ba7b9ba42d9cf72cd1bb0927ae5214894eda (patch)
tree6c745160d09d0bdc14c4c4b3cee036da99f2d792 /phpBB/phpbb/controller/helper.php
parent3b91b243b0a89916619bb4dd6bd36aa6a62be5bf (diff)
parent309a6b931340d56353ac7ec4cd29add35b33e889 (diff)
downloadforums-c967ba7b9ba42d9cf72cd1bb0927ae5214894eda.tar
forums-c967ba7b9ba42d9cf72cd1bb0927ae5214894eda.tar.gz
forums-c967ba7b9ba42d9cf72cd1bb0927ae5214894eda.tar.bz2
forums-c967ba7b9ba42d9cf72cd1bb0927ae5214894eda.tar.xz
forums-c967ba7b9ba42d9cf72cd1bb0927ae5214894eda.zip
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/phpbb/controller/helper.php')
-rw-r--r--phpBB/phpbb/controller/helper.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index 1518169458..3782512fa4 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -13,6 +13,7 @@
namespace phpbb\controller;
+use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
@@ -215,12 +216,31 @@ class helper
public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200)
{
array_unshift($parameters, $message);
+ $message_text = call_user_func_array(array($this->user, 'lang'), $parameters);
+ $message_title = $this->user->lang($title);
+
+ if ($this->request->is_ajax())
+ {
+ global $refresh_data;
+
+ return new JsonResponse(
+ array(
+ 'MESSAGE_TITLE' => $message_title,
+ 'MESSAGE_TEXT' => $message_text,
+ 'S_USER_WARNING' => false,
+ 'S_USER_NOTICE' => false,
+ 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null
+ ),
+ $code
+ );
+ }
+
$this->template->assign_vars(array(
- 'MESSAGE_TEXT' => call_user_func_array(array($this->user, 'lang'), $parameters),
- 'MESSAGE_TITLE' => $this->user->lang($title),
+ 'MESSAGE_TEXT' => $message_text,
+ 'MESSAGE_TITLE' => $message_title,
));
- return $this->render('message_body.html', $this->user->lang($title), $code);
+ return $this->render('message_body.html', $message_title, $code);
}
/**