From 2719a18f7fc6ee3112c3ebc73d50e7c4d2f9d57f Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 10 Nov 2013 18:31:58 -0800 Subject: [PATCH] [ticket/11915] Make it possible to display trigger_error() messages to user. PHPBB3-11915 --- phpBB/posting.php | 24 +++++++++++++++++-- phpBB/styles/prosilver/template/plupload.html | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 1711b91093..6066511d1c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -255,8 +255,18 @@ if (!$auth->acl_get('f_read', $forum_id)) { trigger_error('USER_CANNOT_READ'); } + $message = $user->lang['LOGIN_EXPLAIN_POST']; - login_box('', $user->lang['LOGIN_EXPLAIN_POST']); + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); } // Permission to do the action asked? @@ -326,8 +336,18 @@ if (!$is_authed) { trigger_error('USER_CANNOT_' . strtoupper($check_auth)); } + $message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]; - login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); } // Is the user able to post within this forum? diff --git a/phpBB/styles/prosilver/template/plupload.html b/phpBB/styles/prosilver/template/plupload.html index 2f68fe3efe..dbcea32455 100644 --- a/phpBB/styles/prosilver/template/plupload.html +++ b/phpBB/styles/prosilver/template/plupload.html @@ -51,7 +51,7 @@ phpbb.plupload = { unique_names: true, filters: [{FILTERS}], {S_RESIZE} - headers: {'X-PHPBB-USING-PLUPLOAD': '1'}, + headers: {'X-PHPBB-USING-PLUPLOAD': '1', 'X-Requested-With': 'XMLHttpRequest'}, file_data_name: 'fileupload', multipart_params: {'add_file': '{LA_ADD_FILE}'}, img_path: '{T_ASSETS_PATH}/plupload/jquery.plupload.queue/img',