Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/16558] Improve viewonline page #6031

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

v12mike
Copy link
Contributor

@v12mike v12mike commented Jul 28, 2020

Pages that are not handled by viewonline now shown as "Unrecognised Page"
Admins see the URI of session table page

PHPBB3-16558

Checklist:

  • Correct branch: master for new features; 3.3.x & 3.2.x for fixes
  • Tests pass
  • Code follows coding guidelines: master, 3.3.x and 3.2.x
  • Commit follows commit message format

Tracker ticket (set the ticket ID to your ticket ID):

https://tracker.phpbb.com/browse/PHPBB3-16558

Pages that are not handled by viewonline now shown as "Unrecognised Page"
Admins see the URI of session table page

PHPBB3-16558
Copy link
Contributor

@rxu rxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall point can be also reached with an extension, just for example like it's done with the Pages here https://github.com/phpbb-extensions/pages/blob/17a0438177c84a6d0be8a5b242bfa5abdc40cb28/event/listener.php#L134 or with this one https://github.com/rxu/detailed_viewonline (this one is by me, sorry).

And fingers crossed it won't break extensions as well :)

phpBB/viewonline.php Outdated Show resolved Hide resolved
phpBB/viewonline.php Outdated Show resolved Hide resolved
phpBB/viewonline.php Outdated Show resolved Hide resolved
@@ -835,6 +835,7 @@
'UNREAD_MESSAGES' => 'Unread messages',
'UNREAD_POST' => 'Unread post',
'UNREAD_POSTS' => 'Unread posts',
'UNRECOGNISED_PAGE' => 'Unrecognised page',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that will confuse a lot of users and will generate lots of support topics like What does the Unrecognized page mean?.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that were a problem, would it be more sensible to omit unrecognised page reports to users other than admins?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so as that would lead to even more confusing: like having 10 users online in stats you'll get f.e. 1 user on viewonline page for regular user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you prefer to display incorrect information rather than correct information?
Am I misunderstanding the purpose of the viewonline page?

@@ -263,6 +263,55 @@
case 'viewtopic':
$forum_id = $row['session_forum_id'];

if (!$forum_id)
{
$array_match_index = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably should be a cleaner way than match exactly index of 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the constant there because it applies to several following regexs and it seemed easier to support if the regex gets changed in the future. alternatives welcome.

phpBB/viewonline.php Show resolved Hide resolved
@3D-I
Copy link
Contributor

3D-I commented Jul 29, 2020

Personally, I don't see the need for this.

Remove unsupport PHP syntax

PHPBB3-16558
Fix memory leak

PHPBB3-16558
@rxu
Copy link
Contributor

rxu commented Jul 29, 2020

Personally, I don't see the need for this.

Tend to agree.

Fix overload of variables

PHPBB3-16558
@iMattPro
Copy link
Member

I also don't really see the need for this. Extensions that add their own pages can handle this (not that many actually add their own pages) and it's quite easy with an event. As for the core, well within the core itself there shouldn't be any unrecognized pages really, so this shouldn't really be in the core.

@v12mike
Copy link
Contributor Author

v12mike commented Oct 21, 2021

This patch has nothing to do with extensions. It is fixing a deficiency in core phpBB that means that a range of core pages are not correctly identified on the view users page.

break;
}
if ($auth->acl_get('a_'))
{
$location .= '<br>' . substr($row['session_page'], 0, 99);
Copy link
Member

@iMattPro iMattPro Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is, um, weird. Shouldn't just be some arbitrary sub string. Also shouldn't be using HTML in PHP. Should instead be

$location .= nl2br("\n{$row['session_page']}");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it was bad practice to have HTML there, and I have removed it.
I felt that the substring is necessary because extremely long urls with trailing garbage (from bad bots??) caused the html formatting of the whole page to get broken

Copy link
Member

@Nicofuma Nicofuma Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of thing should be done in the template ideally

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if you thought showing the URL would be of any use, trimming it down to only part of the URL makes it of very little use again. Not to mention a 99 character URL would probably still break layout in mobile. If you're worried about layout, then you should address that in the template with CSS like an overflow scroll for example. Or use CSS to have it wrap without breaking the layout. Or, also in Twig, use tags and functions like length and slice to only show it up to x num of chars, and add an ellipses to longer strings, and show the full url in a mouseover hover.

remove html from php file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants