TinyPortal

Development => Support => Topic started by: Skhilled on July 18, 2010, 06:27:09 PM

Title: Undefined index: Global_character_set error
Post by: Skhilled on July 18, 2010, 06:27:09 PM
After installing 5.2, I am getting the following 2 errors twice each when viewing the frontpage:

http://www.skhilled.com/docs/index.php?
8: Undefined index: global_character_set
File: /home/skhilled/public_html/docs/Sources/TPortal.php
Line: 1277

http://www.skhilled.com/docs/index.php?
8: Undefined index: global_character_set
File: /home/skhilled/public_html/docs/Sources/TPortal.php
Line: 1276


Guests are also generating these errors.
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 19, 2010, 04:46:59 PM
What are your frontpage settings?
Title: Re: Undefined index: Global_character_set error
Post by: Skhilled on July 20, 2010, 03:41:10 PM
As shown in the images below:
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 21, 2010, 03:35:54 PM
Open Sources/TPortal.php and goto line 1269. It should be right before this code:
while($row = tpdb_fetch_assoc($request))
            {
                // expand the vislaoptions
                $row['visual_options'] = explode(",", $row['options']);



Add this line before that code:
$context['character_set'] = empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set'];


Then find this code just below that:
                $row['body'] = html_entity_decode($row['body'],ENT_QUOTES, $modSettings['global_character_set']);
                $row['intro'] = html_entity_decode($row['intro'],ENT_QUOTES, $modSettings['global_character_set']);


Replace with this:
                $row['body'] = html_entity_decode($row['body'],ENT_QUOTES, $context['character_set']);
                $row['intro'] = html_entity_decode($row['intro'],ENT_QUOTES, $context['character_set']);


I think that should fix it. This problem exists in the single page option as well. Bloc will need to add a fix for it. I'm not sure if this would be the proper way to fix it, but I think it does. :)
Title: Re: Undefined index: Global_character_set error
Post by: Skhilled on July 21, 2010, 04:05:02 PM
Thank you, sir. I'll give this a try. :)
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on July 21, 2010, 05:08:26 PM
Thanks for the code IchBin.  O0
This same error has been showing up in the log for the FamilyForum... applying the code edits seemly makes no difference as the errors still happen, for guests and members as well.

QuoteGuest
http://www.ourfamilyforum.org/FamilyForum/index.php?
8: Undefined index: global_character_set
File: /home/kenkayjm/public_html/FamilyForum/Sources/TPortal.php
Line: 1325

Jake
8: Undefined index: global_character_set
File: /home/kenkayjm/public_html/FamilyForum/Sources/TPortal.php
Line: 1326
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 21, 2010, 08:41:36 PM
What are your frontpage settings Ken? I mentioned this will happen with another setup because I didn't fix them all. I just wanted to test it for Skhilleds setup.
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on July 21, 2010, 10:04:04 PM
Sorry, should have posted those.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi26.tinypic.com%2Fdwzb0n.jpg&hash=cfa375d0f4f823d6b967bd574ef45870b9b28873)

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi26.tinypic.com%2F2h7phxt.jpg&hash=2b2f52cbcbc77bee18578ed581472509156b98fd)
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 21, 2010, 11:21:38 PM
If you added the below line from my previous post, please remove it as I've put it in a better place now. On about line 1172 after the global line of the doTPFrontpage() function add this line:
$context['character_set'] = empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set'];

On about line 1323 replace these lines:
                $row['body'] = html_entity_decode($row['body'],ENT_QUOTES, $modSettings['global_character_set']);
                $row['intro'] = html_entity_decode($row['intro'],ENT_QUOTES, $modSettings['global_character_set']);


With this:
                $row['body'] = html_entity_decode($row['body'],ENT_QUOTES, $context['character_set']);
                $row['intro'] = html_entity_decode($row['intro'],ENT_QUOTES, $context['character_set']);


Hopefully that will fix it. I really don't understand why global_character_set would be undefined, so I'm just taking a line out of SMF's code that seems to work for a few things. :) Let me know if that does the trick, if so maybe I'll add it to the repository.
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on July 22, 2010, 02:01:14 PM
Thanks Brad.

Those changes kill the forum and throw this error page:
Quote
Parse error: syntax error, unexpected T_VARIABLE in /home/kenkayjm/public_html/FamilyForum/Sources/TPortal.php on line 1173

BTW... The 'replace' code was found on line 1323.
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 22, 2010, 03:40:28 PM
Hmm... I don't see any problems with the code I posted, could you attach the file so I can look at it?
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on July 22, 2010, 05:14:47 PM
Quote from: IchBin on July 22, 2010, 03:40:28 PM
Hmm... I don't see any problems with the code I posted, could you attach the file so I can look at it?

Sure thing, the edited file is attached... do you need to see a copy of the working files?

Ps: Is my issue different than the one posted by Skhilled?
It was not my intention to hijack Steve's topic so maybe my part should be split out into a separate topic. 
Title: Re: Undefined index: Global_character_set error
Post by: IchBin on July 22, 2010, 06:01:35 PM
Nah, it's still the same issue but just in a different spot really. You did make a booboo. In my post above I said to add the line right after the global line in the doTPfrontpage() function. You added this code:

doTPfrontpage()

Instead of this code:
$context['character_set'] = empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set'];

:D

Attached the fixed file.
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on July 22, 2010, 07:50:21 PM
Quote from: IchBin on July 22, 2010, 06:01:35 PM
You did make a booboo. :D

What? (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.ourfamilyforum.org%2FFamilyForum%2FSmileys%2Fdefault%2Fyikes.gif&hash=66033241bd0e7963c32b9c81eb31f7b754e2fa97)




Thanks Brad, that file works... no more errors.  O0
Title: Re: Undefined index: Global_character_set error
Post by: Skhilled on July 25, 2010, 06:37:25 PM
[quote author=Ken. link=topic=33022.msg265177#msg265177
It was not my intention to hijack Steve's topic

Yes, it was! LOL

Thanks, Brad. The original solution works for me works perfectly!  8)

EDIT: As you can see the quotes are not working correctly for me. I have even modified it to try and fix it several times but no joy.
Title: Re: Undefined index: Global_character_set error
Post by: starcad on August 16, 2010, 04:13:39 AM
Thanks Ichbin, I was having the same issue and that code seems to work.
Title: Re: Undefined index: Global_character_set error
Post by: Ken. on August 16, 2010, 10:29:42 AM
Quote from: Skhilled on July 25, 2010, 06:37:25 PM
Quote from: Ken. link=topic=33022.msg265177#msg265177
It was not my intention to hijack Steve's topic
/quote]

Yes, it was! LOL


(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.ourfamilyforum.org%2FFamilyForum%2FSmileys%2Fdefault%2F4chsmu1.gif&hash=8385fcec4c0753ae3cf3a4ca485c4624010a94dd)