Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9801

Users on custom pages outside the board directory are being displayed on Index page

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.7-PL1
    • Fix Version/s: 3.1.0-RC2
    • Component/s: None
    • Labels:
    • Environment:
      PHP 5.3.1, MySQL(i) 5.1.41, Firefox 3.6 & IE8

      Description

      When you create a custom page that is located on www.example.com and your board is inside www.example.com/community/, viewonline will display users on the custom page as if they were on the index page of the board.

      The problem is this preg_match function in viewonline.php:

      	preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page);
      

      If the saved session_page looks like ../test.php, this preg_match will just remove the session_page and the $on_page will be set as empty array.
      For the time being I just changed the if statement directly afterwards from this:

      	if (!sizeof($on_page))
      	{
      		$on_page[1] = '';
      	}
      

      To this:

      	if (!sizeof($on_page))
      	{
      		// if user is on a page like ../example.php, show that
      		if(substr($row['session_page'],0,3) == '../')
      		{
      			$ext_spot = strrpos($row['session_page'], '.');
      			$on_page[1] = substr($row['session_page'], 0, $ext_spot);
      		}
      		else
      		{
      			$on_page[1] = '';
      		}
      	}
      

      But that is just a mean fix to me. It's probably best to change the preg_match regex.

        Activity

        Hide
        igorw Igor Wiedler [X] (Inactive) added a comment -

        Ascraeus will provide hooks for this. I don't think we should change it in 3.0.

        Show
        igorw Igor Wiedler [X] (Inactive) added a comment - Ascraeus will provide hooks for this. I don't think we should change it in 3.0.
        Hide
        stokerpiller stokerpiller [X] (Inactive) added a comment -

        I can confirm that Marc's fix is working.

        Show
        stokerpiller stokerpiller [X] (Inactive) added a comment - I can confirm that Marc's fix is working.

          People

          • Assignee:
            Marc Marc
            Reporter:
            marc1706 marc1706
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development