Advertisement:

Author Topic: 2.0.17: undefined variable in english language pack, new.gif shows broken image  (Read 594 times)

Offline CrankyOldguy

  • Semi-Newbie
  • *
  • Posts: 25
Realistically, this may be related to our upgrade, but when we recently upgraded from 1.x to 2.0.17 the *new* GIF indicating new posts in the forum was showing a broken image.  A quick look at the URL spotted it: .../Themes/NightBreeze20/images//new.gif

Backtracking through the theme, the broken variable was @settings['lang_images_url'], set in load.php at line 1779,
Code: [Select]
$settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']);
I did a global search of the 2.0.17 installation files and didn't find 'image_lang' set anywhere, so the quick fix was to add
Code: [Select]
$txt['image_lang'] = 'english'; at line 14 of /Themes/default/languages/index.english.php

The core & default themes should have the same broken *new* GIF on a fresh 2.0.17 install, as they have the same chunks of code as the theme we're using.

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,822
  • We were all equal in the end.
Haven't seen this in any 2.0.17 install, and have done several customizations with Nightbreeze and not seen it there, either.  How did you upgrade from 1.1 to 2.0.17?
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Project Manager
  • SMF Super Hero
  • *
  • Posts: 19,630
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • My Daily Dose Of Blasphemy
Did that happen with the default theme?
A Finnish Project Manager (Support Specialist)
Happily running multiple SMF 2.x installations.
 Fooling around with an i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline CrankyOldguy

  • Semi-Newbie
  • *
  • Posts: 25
I'll go in reverse order: yes, the default theme was effected.

I suspect they did a Large Upgrade, but they had problems as it took them 4 or 5 days.  The forum had been running since 2006 or so, and had lots of additions and deletions.  The Ultimate Profile mod meant that nearly all installed packages needed to be manually inserted.  I don't know how they managed to remove Ultimate Profile before the upgrade, as it was dug in like a tick.

Reminder that I mentioned above: I thoroughly searched the 'full install' file set, and didn't find any hits on image_lang in any file except for one line in load.php.  I checked all file types for that image_lang string.  If it's there, it's inside a compressed file and the search couldn't see it.  I don't know how far back it extends as there aren't any old versions for download that I could find.

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,822
  • We were all equal in the end.
Don't think it's a bug, more likely something broke in upgrade.  Clean set of 2.0.17 files should fix it.
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Online shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 2,994
    • sbulen on GitHub
That image_lang is missing is not a concern - I suspect it is a holdover from prior versions, where there were often language-specific images that needed to be loaded...  We don't really do that anymore.  I think it's there in case you have an old theme that still uses .gifs for text.

However, that there is no language for the user in $user_info is a problem (look further to the right on that line...).  It is supposed to fall back to that user's language.

I would double-check language installs, etc.  If you are utf8, make sure you download the utf8 language pack(s). 

Double-check the forum's default language & all supported languages, & make sure you have those language packs loaded. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline Dzonny

  • Localizer
  • SMF Super Hero
  • *
  • Posts: 12,523
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Load.php:
Code: [Select]
// Make a special URL for the language.
$settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']);
I guess that's where the text string is pulled from though.
It's from the latest github 2.0. build.

Online shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 2,994
    • sbulen on GitHub
I guess that's where the text string is pulled from though.

Only if it exists (the !empty terniary - is an if-?-then-:-else).  If it doesn't exist, it pulls from the user language, $user_info['language']. 

For it to be missing, it must be missing in BOTH places.  It still seems to me something is amiss with language selection/install.

I wouldn't worry about the image_lang - I suspect it's still there in case folks still use language-dependent .gifs in themes.  (In that case, the theme must provide the language & translations...)

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline Dzonny

  • Localizer
  • SMF Super Hero
  • *
  • Posts: 12,523
  • Gender: Male
  • No sleep...
    • dzontra.nikola on Facebook
    • Dzonny on GitHub
    • dzontranikola on LinkedIn
    • @opusteniforum on Twitter
    • Samo opusteno
Yeah, i know, I just wasn't sure why we even need it as it's removed from the default theme, but it makes sense to leave it for other themes which still has language-dependent gifs.