From 327f9afbc0e015864c64b29b412e03142f40ca16 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 16 May 2010 23:05:13 +0200 Subject: [PATCH 1/8] [ticket/8792] Add LDAP_SEARCH_FAILED string for when ldap_search() fails. No longer use LDAP_NO_SERVER_CONNECTION in case ldap_search() fails. Add and use LDAP_SEARCH_FAILED instead, so users can tell the difference between ldap_connect() failing and ldap_search() failing. PHPBB3-8792 --- phpBB/includes/auth/auth_ldap.php | 2 +- phpBB/language/en/common.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index a6092baba5..e8c957aaa3 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -74,7 +74,7 @@ function init_ldap() if ($search === false) { - return $user->lang['LDAP_NO_SERVER_CONNECTION']; + return $user->lang['LDAP_SEARCH_FAILED']; } $result = @ldap_get_entries($ldap, $search); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a3d47b5b59..325a20bf02 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -295,6 +295,7 @@ $lang = array_merge($lang, array( 'LAST_VISIT' => 'Last visit', 'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.', 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', + 'LDAP_SEARCH_FAILED' => 'An error occured while searching the LDAP directory.', 'LEGEND' => 'Legend', 'LOCATION' => 'Location', 'LOCK_POST' => 'Lock post', From c1a4cb1d01dc19650219566b60671abc767af662 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 16 May 2010 18:24:26 -0400 Subject: [PATCH 2/8] [ticket/7782] Send status line using refactored download/file.php logic. PHPBB3-7782 --- phpBB/download/file.php | 10 +--------- phpBB/includes/functions.php | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 00b8e2e656..2154847865 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -670,15 +670,7 @@ function set_modified_headers($stamp, $browser) { if ($last_load !== false && $last_load >= $stamp) { - if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') - { - // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though - header('Status: 304 Not Modified', true, 304); - } - else - { - header('HTTP/1.0 304 Not Modified', true, 304); - } + send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers header('Pragma: public'); header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..bc7c426e44 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,27 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + if (isset($_SERVER['HTTP_VERSION'])) + { + $version = $_SERVER['HTTP_VERSION']; + } + else + { + $version = 'HTTP/1.0'; + } + header("$version $code $message", true, $code); + } +} + //Form validation @@ -3623,7 +3644,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { - header("HTTP/1.x 404 Not Found"); + send_status_line(404, 'Not Found'); } $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; From 691f682fc2a69fed28bdca76f714d20be9277af6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 16 May 2010 19:52:01 -0400 Subject: [PATCH 3/8] [ticket/7782] Added phpdoc comment for send_status_line function. PHPBB3-7782 --- phpBB/includes/functions.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc7c426e44..178bb3ff3f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,26 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +/** +* Outputs correct status line header. +* +* Depending on php sapi one of the two following forms is used: +* +* Status: 404 Not Found +* +* HTTP/1.x 404 Not Found +* +* HTTP version is taken from HTTP_VERSION environment variable, +* and defaults to 1.0. +* +* Sample usage: +* +* send_status_line(404, 'Not Found'); +* +* @param int $code HTTP status code +* @param string $message Message for the status code +* @return void +*/ function send_status_line($code, $message) { if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') From d721e94b888b657c8e36729db2c455812308cdc3 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 17 May 2010 02:01:13 -0400 Subject: [PATCH 4/8] [ticket/7782] Added spaces. PHPBB3-7782 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 178bb3ff3f..862ab3b367 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2600,7 +2600,7 @@ function meta_refresh($time, $url, $disable_cd_check = false) */ function send_status_line($code, $message) { - if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') { // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though header("Status: $code $message", true, $code); From c185e45e09032e3ac32149a91f0133deb425acaa Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 17 May 2010 14:14:53 -0400 Subject: [PATCH 5/8] [ticket/7782] Return 404 HTTP status code for nonexistent attachments. PHPBB3-7782 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 862ab3b367..3e80f93114 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3662,7 +3662,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $user->setup(); } - if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { send_status_line(404, 'Not Found'); } From b6df5bdb14615dfdd3b41651934575882a1455c5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 24 May 2010 23:32:18 +0200 Subject: [PATCH 6/8] [ticket/8936] Subsilver2 missing reply-to-all feature. PHPBB3-8936 --- phpBB/styles/subsilver2/template/ucp_pm_message_footer.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html b/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html index 314d03caf3..d1ef5ebd10 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html @@ -14,6 +14,7 @@ {L_PRINT_PM} | {L_FORWARD_PM} + | {L_REPLY_TO_ALL} From 9e2499385590248c2ba9c932463e5cf7d5c74109 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 26 May 2010 01:38:19 +0200 Subject: [PATCH 7/8] [ticket/9135] Fix report-icon for moderators in PM folders. There was a S_TOPIC_REPORTED switch in the template of prosilver, which should indicate whether the PM is reported. But the variable was neither filled, nor named correctly. Now it is filled with a boolean and a link to the report is displayed for permitted users. PHPBB3-9135 --- phpBB/includes/ucp/ucp_pm_viewfolder.php | 26 ++++++++++++++++++- phpBB/language/en/common.php | 1 + .../prosilver/template/ucp_pm_viewfolder.html | 2 +- .../template/ucp_pm_viewfolder.html | 3 +++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 665dd2c83f..6b7172ca2b 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -170,10 +170,12 @@ function view_folder($id, $mode, $folder_id, $folder) 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, + 'S_PM_REPORTED' => (isset($row['report_id'])) ? true : false, 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, 'U_VIEW_PM' => ($row['pm_deleted']) ? '' : $view_message_url, 'U_REMOVE_PM' => ($row['pm_deleted']) ? $remove_message_url : '', + 'U_MCP_REPORT' => (isset($row['report_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $row['report_id']) : '', 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '') ); } @@ -183,6 +185,7 @@ function view_folder($id, $mode, $folder_id, $folder) 'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false, 'S_SHOW_COLOUR_LEGEND' => true, + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'PM_REPORTED'), 'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false) ); } @@ -502,7 +505,7 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour + $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u WHERE t.user_id = $user_id AND p.author_id = u.user_id @@ -512,13 +515,34 @@ function get_pm_from($folder_id, $folder, $user_id) ORDER BY $sql_sort_order"; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $pm_reported = array(); while ($row = $db->sql_fetchrow($result)) { $rowset[$row['msg_id']] = $row; $pm_list[] = $row['msg_id']; + if ($row['message_reported']) + { + $pm_reported[] = $row['msg_id']; + } } $db->sql_freeresult($result); + // Fetch the report_ids, if there are any reported pms. + if (!empty($pm_reported) && $auth->acl_getf_global('m_report')) + { + $sql = 'SELECT pm_id, report_id + FROM ' . REPORTS_TABLE . ' + WHERE report_closed = 0 + AND ' . $db->sql_in_set('pm_id', $pm_reported); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['pm_id']]['report_id'] = $row['report_id']; + } + $db->sql_freeresult($result); + } + $pm_list = ($store_reverse) ? array_reverse($pm_list) : $pm_list; return array( diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a3d47b5b59..a4e58f038e 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -420,6 +420,7 @@ $lang = array_merge($lang, array( 'PIXEL' => 'px', 'PLAY_QUICKTIME_FILE' => 'Play Quicktime file', 'PM' => 'PM', + 'PM_REPORTED' => 'Click to view report', 'POSTING_MESSAGE' => 'Posting message in %s', 'POSTING_PRIVATE_MESSAGE' => 'Composing private message', 'POST' => 'Post', diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index 7b309a74f7..d7e02e405e 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -71,7 +71,7 @@
{L_PM_FROM_REMOVED_AUTHOR} - {REPORTED_IMG} {messagerow.ATTACH_ICON_IMG}
+ {REPORTED_IMG} {messagerow.ATTACH_ICON_IMG}
{L_MESSAGE_TO} {messagerow.RECIPIENTS}{L_MESSAGE_BY_AUTHOR} {messagerow.MESSAGE_AUTHOR_FULL} » {messagerow.SENT_TIME}
{L_SENT_AT}: {messagerow.SENT_TIME}
diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html index 1663502865..f0b076edb2 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html @@ -81,6 +81,9 @@ {messagerow.SUBJECT} + + {REPORTED_IMG}  +
{L_PM_FROM_REMOVED_AUTHOR} From 4746a60d221d2e32c98eff1f44d996bf7296e737 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 May 2010 15:17:03 +0200 Subject: [PATCH 8/8] [ticket/9094] Hide "Copy permissions" message, when permissions were copied. When creating a forum, you afterwards read "Forum created successfully. Now you are able to set permissions for this forum.", also when you already copied the permissions from another forum. PHPBB3-9094 --- phpBB/includes/acp/acp_forums.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 541a514bef..6261f866bb 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -190,12 +190,14 @@ class acp_forums $forum_perm_from = request_var('forum_perm_from', 0); $cache->destroy('sql', FORUMS_TABLE); + $copied_permissions = false; // Copy permissions? if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) { copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); cache_moderators(); + $copied_permissions = true; } /* Commented out because of questionable UI workflow - re-visit for 3.0.7 else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) @@ -211,13 +213,13 @@ class acp_forums $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; // Redirect to permissions - if ($auth->acl_get('a_fauth')) + if ($auth->acl_get('a_fauth') && !$copied_permissions) { $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); } // redirect directly to permission settings screen if authed - if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) + if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) { meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); }