diff options
author | Máté Bartus <mate.bartus@gmail.com> | 2016-03-08 22:18:42 +0100 |
---|---|---|
committer | Máté Bartus <mate.bartus@gmail.com> | 2016-03-08 22:18:42 +0100 |
commit | a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68 (patch) | |
tree | ea7793775abbd1b0f5a052054bcfa3c5e1af7187 | |
parent | 9d7b6260bd1ef0a0a07af7ec5cd2c1955f31a74c (diff) | |
parent | 7c45ed0733d525d466ba6d45a13b50e5fc553126 (diff) | |
download | forums-a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68.tar forums-a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68.tar.gz forums-a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68.tar.bz2 forums-a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68.tar.xz forums-a01e3a0ffa2d9fb4d609317aa5e2caed4c521a68.zip |
Merge branch '3.1.x' into 3.2.x
* 3.1.x:
[ticket/14132] Use transaction for adding notifications to type table
[ticket/14519] Skip query if all unread notifications are retrieved
[ticket/14483] Do not send headers by default on access via controller
Conflicts:
phpBB/phpbb/notification/manager.php
-rw-r--r-- | phpBB/includes/functions.php | 27 | ||||
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 9 | ||||
-rw-r--r-- | phpBB/phpbb/notification/manager.php | 4 |
3 files changed, 26 insertions, 14 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5125a601d6..94a8e7a405 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4071,7 +4071,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) /** * Generate page header */ -function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum') +function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = true) { global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; global $phpbb_dispatcher, $request, $phpbb_container, $phpbb_admin_path; @@ -4416,17 +4416,22 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'SITE_LOGO_IMG' => $user->img('site_logo'), )); - // An array of http headers that phpbb will set. The following event may override these. - $http_headers = array( - // application/xhtml+xml not used because of IE - 'Content-type' => 'text/html; charset=UTF-8', - 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', - ); - if (!empty($user->data['is_bot'])) + $http_headers = array(); + + if ($send_headers) { - // Let reverse proxies know we detected a bot. - $http_headers['X-PHPBB-IS-BOT'] = 'yes'; + // An array of http headers that phpbb will set. The following event may override these. + $http_headers += array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + ); + if (!empty($user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $http_headers['X-PHPBB-IS-BOT'] = 'yes'; + } } /** diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index e98de0e771..9dbc3737f7 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -80,12 +80,13 @@ class helper * @param bool $display_online_list Do we display online users list * @param int $item_id Restrict online users to item id * @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id + * @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers. * * @return Response object containing rendered page */ - public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum') + public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false) { - page_header($page_title, $display_online_list, $item_id, $item); + page_header($page_title, $display_online_list, $item_id, $item, $send_headers); $this->template->set_filenames(array( 'body' => $template_file, @@ -93,7 +94,9 @@ class helper page_footer(true, false, false); - return new Response($this->template->assign_display('body'), $status_code); + $headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array(); + + return new Response($this->template->assign_display('body'), $status_code, $headers); } /** diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index ea1b800dc5..3265bcb629 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -899,6 +899,8 @@ class manager { $notification_type_ids = $this->cache->get('notification_type_ids'); + $this->db->sql_transaction('begin'); + if ($notification_type_ids === false) { $notification_type_ids = array(); @@ -933,6 +935,8 @@ class manager $this->cache->put('notification_type_ids', $notification_type_ids); } + $this->db->sql_transaction('commit'); + return $notification_type_ids[$notification_type_name]; } |