Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

PHPBB3-10715 bug solution #635

Closed
wants to merge 6 commits into from

3 participants

@riadhchtara

This is the first code I write for PHPBBB to solve this problem http://tracker.phpbb.com/browse/PHPBB3-10715

phpBB/includes/mcp/mcp_queue.php
@@ -177,10 +177,14 @@ function main($id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
-
+ $back_to_post="" ;
@nickvergessen Collaborator

Please see http://area51.phpbb.com/docs/30x/coding-guidelines.html#codelayout "Use spaces between tokens:" apart from that it should be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@imkingdavid

Actually, I misspoke in IRC. I said you would need to branch on develop, but this change will be in 3.0.11, which means you need to make your changes on a branch based off the develop-olympus branch instead.

phpBB/includes/mcp/mcp_queue.php
@@ -177,10 +177,14 @@ function main($id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
-
+ $back_to_post= '' ;

This line should be $back_to_post = ''; No space between the ' and the ; and add a space between the t and =.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/includes/mcp/mcp_queue.php
@@ -177,10 +177,14 @@ function main($id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
-
+ $back_to_post= '' ;
+ if(request_var('backtopost', 0)=="1" )

As per coding guidlines the line should be
if (request_var('backtopost', 0))
Note the space between if and (. You do not need to check if it is == "1" all you need to do is make sure it is true, so no equality condition really needs to be met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/includes/mcp/mcp_queue.php
@@ -177,10 +177,14 @@ function main($id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
-
+ $back_to_post= '' ;
+ if(request_var('backtopost', 0)=="1" )
+ {
+ $back_to_post="&backtopost=1";

You'll need a space on either side of the = sign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/includes/mcp/mcp_queue.php
((10 lines not shown))
$template->assign_vars(array(
'S_MCP_QUEUE' => true,
- 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),
+ 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id".$back_to_post),

Because this isusing quotation marks ", you can just put the variable into the string like this:
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id{$back_to_post}"),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/includes/mcp/mcp_queue.php
((5 lines not shown))
}
else
{
- meta_refresh(3, $redirect);
+ if(request_var('backtopost', 0)=="1" )

again, no need for the =="1". Also, since you are checking this request variable twice, you might consider doing $back_to_post = request_var('backtopost', 0); and then doing if ($back_to_post) each time you need to check it. And as before, if( should be if (.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/includes/mcp/mcp_queue.php
((5 lines not shown))
}
else
{
- meta_refresh(3, $redirect);
+ if(request_var('backtopost', 0)=="1" )
+ {
+ meta_refresh(3, $post_url );

no need for the space before the )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
phpBB/viewtopic.php
@@ -1525,7 +1525,7 @@
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
- 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&backtopost=1&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',

Check your editor's indentation settings. It looks like the indentation on this line was changed.

Sorry for these many faults, I'm not already conftable with your Code Layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@nickvergessen
Collaborator

Replaced with #637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 4 deletions.
  1. +15 −3 phpBB/includes/mcp/mcp_queue.php
  2. +1 −1  phpBB/viewtopic.php
View
18 phpBB/includes/mcp/mcp_queue.php
@@ -177,10 +177,14 @@ function main($id, $mode)
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
-
+ $back_to_post= '';
+ if (request_var('backtopost', 0))
+ {
+ $back_to_post = "&backtopost=1";
+ }
$template->assign_vars(array(
'S_MCP_QUEUE' => true,
- 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),
+ 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id{$back_to_post}"),
'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_approved'],
@@ -697,10 +701,18 @@ function approve_post($post_id_list, $id, $mode)
if (!$success_msg)
{
redirect($redirect);
+
}
else
{
- meta_refresh(3, $redirect);
+ if (request_var('backtopost', 0))
+ {
+ meta_refresh(3, $post_url);
+ }
+ else
+ {
+ meta_refresh(3, $redirect);
+ }
// If approving one post, also give links back to post...
$add_message = '';
View
2  phpBB/viewtopic.php
@@ -1525,7 +1525,7 @@
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
- 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&backtopost=1&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
Something went wrong with that request. Please try again.