From 558b8ae7edc90e05e949dbb47706820d70d444a6 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 27 May 2024 05:18:08 +0000 Subject: [PATCH 1/3] [ticket/16553] Fix approve reported posts bug Fixes the module not accessible error when trying to approve a reported post. PHPBB3-16553 --- phpBB/includes/mcp/mcp_post.php | 1 + phpBB/includes/mcp/mcp_reports.php | 2 ++ phpBB/styles/prosilver/template/mcp_post.html | 2 ++ 3 files changed, 5 insertions(+) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index ff8fb743e3..f6ebe3a1bf 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -222,6 +222,7 @@ function mcp_post_details($id, $mode, $action) 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id"), + 'S_CAN_APPROVE' => $auth->acl_get('m_approve', $post_info['forum_id']), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']), 'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']), diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index d7d73ff4b0..a7c802267d 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -252,6 +252,7 @@ class mcp_reports $report_template = array( 'S_MCP_REPORT' => true, 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $post_id), + 'S_CAN_APPROVE' => $auth->acl_get('m_approve', $post_info['forum_id']), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, @@ -260,6 +261,7 @@ class mcp_reports 'S_USER_NOTES' => true, 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&p={$post_info['post_id']}") : '', + 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=" . $post_id), 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $post_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index b62ed1ad5b..7efe2da968 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -78,6 +78,7 @@

{MINI_POST_IMG} {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} » {POST_DATE}

+ {% if S_CAN_APPROVE %}
@@ -101,6 +102,7 @@

+ {% endif %} {% if S_POST_REPORTED and not S_MCP_REPORT %}

From 874fb7bf8ae5a228bd8427657f139551a4397fa1 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 27 May 2024 06:59:59 +0000 Subject: [PATCH 2/3] [ticket/16553] Use env variables in Codespaces for server name PHPBB3-16553 --- .devcontainer/resources/phpbb-config.yml | 2 +- .devcontainer/resources/setup.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.devcontainer/resources/phpbb-config.yml b/.devcontainer/resources/phpbb-config.yml index 9a9db6abff..9c781c1201 100644 --- a/.devcontainer/resources/phpbb-config.yml +++ b/.devcontainer/resources/phpbb-config.yml @@ -30,7 +30,7 @@ installer: server: cookie_secure: false server_protocol: http:// - force_server_vars: false + force_server_vars: true server_name: localhost server_port: 80 script_path: / diff --git a/.devcontainer/resources/setup.sh b/.devcontainer/resources/setup.sh index b871db11df..9d01fdf16d 100644 --- a/.devcontainer/resources/setup.sh +++ b/.devcontainer/resources/setup.sh @@ -34,6 +34,14 @@ sudo ln -s /workspaces/phpbb/phpBB /var/www/html echo "[Codespaces] Copy phpBB configuration" cp /workspaces/phpbb/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/phpBB/install/install-config.yml +# Force the server URL to reflect the Codespace +# https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace +if [ "$CODESPACES" = true ] ; then + echo "[Codespaces] Set the phpBB server name using default environment variables" + codespaces_url="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" + sed -i "s/localhost/$codespaces_url/g" /workspaces/phpbb/phpBB/install/install-config.yml +fi + # Install phpBB echo "[Codespaces] Run phpBB CLI installation" cd /workspaces/phpbb/phpBB && composer install --no-interaction From 6f345e43cbf4ac7c7bea294aaf64e603c82bde33 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 27 May 2024 07:55:08 +0000 Subject: [PATCH 3/3] [ticket/16553] Change double quotes to single quotes PHPBB3-16553 --- phpBB/includes/mcp/mcp_reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index a7c802267d..3e3a42d027 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -261,7 +261,7 @@ class mcp_reports 'S_USER_NOTES' => true, 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&p={$post_info['post_id']}") : '', - 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=" . $post_id), + 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&p=' . $post_id), 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $post_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']),