Warning: The author of this contribution does not provide support for it anymore.

Custom Header Logo

Bug on Version 1.2.7 - Custom Header Logo

Bug on Version 1.2.7

by Leinad4Mind » Sun Jan 12, 2014 11:10 pm

Hi there, I've been using this MOD since the first version. And with this new amazing version, after some months using, I've found a little bug that I would like to solve.

In ACP, on the Add Page Logo:

I've put on "page name": viewtopic
And on "page query": t=330

Because I wanted the banner to appear in this topic only: viewtopic.php?f=81&t=330

The BUG is, that banner, appeared on this page: viewtopic.php?f=21&t=1598&start=3300 (because it has "t=330" on the "start=3300".

Any way to solve this?
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Bug on Version 1.2.7

by Balint » Mon Jan 13, 2014 6:48 am

Could you please try and change "t=330" in your page query to "&t=330" and add the same entry with the page query "?t=330" ?

The script works with a simple string comparison so it's not quite simple to filter out "start=3300"...
User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: Bug on Version 1.2.7

by Leinad4Mind » Mon Jan 13, 2014 1:43 pm

None of the page work, because it doesn't recognize the "&".

And the bugs happen too on "t=3300" because I assume it is recognizing as "*t=330*" Maybe we need to change to "*t=330" it will fix many cases.

But the ideal, is that we could choose the right path "f=21&t=330" and just accept that one. It could have "?f=21&t=330&view=unread#unread", so I think that the url should pass on some regular expression, to filter out "f=21&t=330" or just the value of "t=".
And on ACP we putted just the number of the topic.

Best Regards
Last edited by Leinad4Mind on Mon Jan 13, 2014 2:12 pm
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Bug on Version 1.2.7

by Balint » Mon Jan 13, 2014 1:52 pm

I'll debug the MOD today or tomorrow and try to find a solution for you.
User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: Bug on Version 1.2.7

by Balint » Mon Jan 13, 2014 5:55 pm

I debugged a little and found this acceptable for now (at least for your case). With the changes an entry like "t=330" will show up on "start=3300" but a "*t=330" won't (put an asterisk at the beginning of any page query where you don't want to match other variables!).

NOTE: this won't work for queries with more than one parameter, e.g. "t=330&bla=blubb" !

Open up includes/functions.php.
Find:

Code: Select all

               if (stripos($user->page['query_string'], $row['page_query']) !== false || $row['page_query'] == '*' || $row['page_query'] == $user->page['query_string'])
               {
                  $site_logo_custom = $row['page_logo'];
                  $header_background_custom = $row['page_background_logo'];
                  break;
               }


Replace with:

Code: Select all

               // strict checking
               if (stripos($row['page_query'], '*') == 0 && strlen($row['page_query']) > 0)
               {
                  $querypieces = explode("&", $user->page['query_string']);
                  foreach ($querypieces as $querypiece)
                  {
                     if($querypiece == ltrim($row['page_query'], "*"))
                     {
                        $site_logo_custom = $row['page_logo'];
                        $header_background_custom = $row['page_background_logo'];
                        break 2;
                     }
                  }
               }
   
               // normal checking
               if (stripos($user->page['query_string'], $row['page_query']) !== false || $row['page_query'] == '*')
               {
                  $site_logo_custom = $row['page_logo'];
                  $header_background_custom = $row['page_background_logo'];
                  break;
               }
User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact: