Download & Extend

Logotool: Display mode - Specified logos not working

Project:Logo Tool
Version:6.x-2.0-beta1
Component:Code
Category:bug report
Priority:critical
Assigned:criscom
Status:closed (fixed)

Issue Summary

When assigning logos to specific site the Specified logos display mode wouldn't work. Logotool only displayed the default logo.

Apparently we found a quick fix to the problem in line 285 in logotool.module. There we changed a single number. After that change Logo tool Specified logos display worked like a charm.

line 285:

before:
preg_match($regexp, substr($_SERVER['REQUEST_URI'], 1), $match);

after:
preg_match($regexp, substr($_SERVER['REQUEST_URI'], 4), $match);

Comments

#1

Sorry, to have posted one issue twice.

In the above description, sentence one goes as follows:

When assigning logos to specific nodes ...

#2

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#3

Status:closed (fixed)» active

Here's what worked for me. The above solution did not work. This also works if path is an alias, node or view:

function logotool_fetch_matches() {
  $path = drupal_lookup_path('source', substr($_SERVER['REQUEST_URI'], 1)) ? drupal_lookup_path('source', substr($_SERVER['REQUEST_URI'], 1)) :  substr($_SERVER['REQUEST_URI'], 1);
  foreach (explode("\n", variable_get('logotool_pages', '')) as $page) {
    $explode = explode("|", $page);
    $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($explode[0], '/')) .')$/';
    preg_match($regexp, $path, $match);
    if ($match) {
      return $explode[1];
    }
  }
  return FALSE;
} // logotool_fetch_matches

#4

thanks, @awolfey - that's almost it.

if anyone doesn't know where to place your correction, it's lines 281 - 291 of logotool.module .

@pobster: care to make an official release with this nice bug fix? :]

also, there's a difference between example.com AND example.com/node.

to solve it, enter both descriptions below:

<front>|home.png
|home.png

(that's right - nothing to the left but the pipe.)

one more thing - if you're using i18n (I am) you'll need to specify */ eg.: example.com/en/

hope this helps ;] cheers

#5

I am tempted to make an official release but there's a few things holding me back still and tbh, I've too many modules and not enough time to make them all perfect... Here's what I'm currently thinking I should finish;

  • <front> should be able to cope with all frontpage situations, you shouldn't need to specify both <front> and nothing to match the frontpage
  • Move all the matching out of variables and into db tables, I feel that the overuse of variables in this module confuses people
  • Put the internationalisation back in... The system should (again) be able to cope with handling different languages, it's unacceptable to expect users to enter individual matches for each language they want to support, this should be more automated
  • Testing... This module when I created it for D6.x was used on two sites, one of mine which I don't even really use anymore and a work one; http://www.redbeemedia.com/tvproduction - I didn't (and still haven't) tested it thoroughly enough for every situation, I highly expect there are things I've overlooked still? But what puzzles me the most is that some of the 'fixes' I've seen on these threads don't make sense in my head? I can only assume perhaps that apache handles things differently to other webservers? I need to sort out a common method which will work for *everyone* before there can be an official release

Pobster

#6

ok! thanks for the reply.

unfortunately, I can only help with testing. I'm not that fluent in PHP ;]

as for i18n I think it makes sense to have a logo for each language - therefore example.com would show the original logo, example.com/pt the Portuguese logo, example.com/nz the Maori logo and so on.

there might even be an integration with Domain Access - but once again, no time for that :/

#7

I think the reason the original fix fails on the front page here is due to the fact that the front page path is usually just the empty string. So an extra case needs to be put in place to handle that. Here's a patch that should work with aliases as the original fix does as well as fix the front page issue.

AttachmentSize
front_fix_531216.patch 1 KB

#8

Ah yeah, that looks more like it. I'll test and roll out, thanks.

Pobster

#9

Version:6.x-1.x-dev» 6.x-2.0-beta1
Status:active» fixed

Moved to drupal_match_path for matching, will hopefully be fine now.

...Incidentally, locale support is back.

Pobster

#10

cool, thanks a lot. :)

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.