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

Resource locator does not find admin template files from extensions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Extensions
    • Labels:
      None
    • Environment:
      php 5.3.3, MySQL 5.1.66, Chrome 25

      Description

      After commit 4dcc8cabae670e0ee57a489e7e13c2f93d99753a, the resource locator does not recognize admin template files from extensions. For example, if my extension has a acp module (test_module.php) that uses template file acp_test.html located in root/ext/my/extension/adm/style/acp_test.html, visiting this page in acp results in an error (resource not found in...)

      Globalizing the admin path doesn't seem to work well with locating admin template files from extensions. Adding $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './'; back in adm/index.php seems to fix this.

        Issue Links

          Activity

          Hide
          nickvergessen Joas Schilling added a comment -

          This blocks all extensions from having their acp style files in the right directory.
          Might be worth fixing before A1

          Show
          nickvergessen Joas Schilling added a comment - This blocks all extensions from having their acp style files in the right directory. Might be worth fixing before A1
          Hide
          nickvergessen Joas Schilling added a comment -

          Okay, the problem here is $finder->sanitise_directory() just like in PHPBB3-10844

          The problem is, that it does not strip of ../ when possible.
          So after the directory was cleaned, it tries to look at /adm/../adm/style instead of /adm/style
          you can easily test this by adding

          		if ($directory == '/adm/../adm/style')
          		{
          			$directory = '/adm/style';
          		}

          right before the return of that function.

          Seems like replacing the regex in that function with $directory = phpbb_clean_path($directory); solves this problem. This function removes ./ and ../ (with removing the last folder step).

          Show
          nickvergessen Joas Schilling added a comment - Okay, the problem here is $finder->sanitise_directory() just like in PHPBB3-10844 The problem is, that it does not strip of ../ when possible. So after the directory was cleaned, it tries to look at /adm/../adm/style instead of /adm/style you can easily test this by adding if ($directory == '/adm/../adm/style') { $directory = '/adm/style'; } right before the return of that function. Seems like replacing the regex in that function with $directory = phpbb_clean_path($directory); solves this problem. This function removes ./ and ../ (with removing the last folder step).
          Hide
          VSE Matt Friedman added a comment -

          This has been re-broken by the following commit:
          https://github.com/phpbb/phpbb3/commit/869e00a23b0400b9ad81c1130227cc4c29d6a38d
          [ticket/11362] Move phpbb_clean_path into a simple filesystem service

          We're back to geting this error:
          style resource locator: File for handle body does not exist. Could not find: ./../adm/style/acp_myextension.html, ./../adm/style/acp_myextension.html

          Of course, the extension file would be in the extensions directory... not in phpBB's core adm directory

          Show
          VSE Matt Friedman added a comment - This has been re-broken by the following commit: https://github.com/phpbb/phpbb3/commit/869e00a23b0400b9ad81c1130227cc4c29d6a38d [ticket/11362] Move phpbb_clean_path into a simple filesystem service We're back to geting this error: style resource locator: File for handle body does not exist. Could not find: ./../adm/style/acp_myextension.html, ./../adm/style/acp_myextension.html Of course, the extension file would be in the extensions directory... not in phpBB's core adm directory
          Hide
          nickvergessen Joas Schilling added a comment -

          This was actually broken by the solution of http://tracker.phpbb.com/browse/PHPBB3-10844

          Created a new ticket: http://tracker.phpbb.com/browse/PHPBB3-11549

          Show
          nickvergessen Joas Schilling added a comment - This was actually broken by the solution of http://tracker.phpbb.com/browse/PHPBB3-10844 Created a new ticket: http://tracker.phpbb.com/browse/PHPBB3-11549

            People

            • Assignee:
              nickvergessen Joas Schilling
              Reporter:
              Blitze Blitze
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development