TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 423
  • Total: 423

no captcha in Hobbit theme

Started by TauTau, June 14, 2009, 08:08:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ZarPrime

For everybody else who is wondering why I thought this may have been caused by a file edit to correct a TP error, the same thing happened to FUBAR when he edited the TPmodules.php file and it added 2 blank lines into the file when he edited it.  This happened to me as well when I tried to correct the smileysEnabled error so I knew what to look for.  The fix was to fix the error in a program that won't add the extra lines, like context, a program that will save php files correctly.  After I fixed the error and saved it correctly my Captcha started working fine again.  If you are interested in reading FUBAR's topic on SMF the link is here ...
http://www.simplemachines.org/community/index.php?topic=313434.msg2081300#msg2081300

ZarPrime

ZarPrime

TauTau,

Also, the error you mention is probably because of an error in one of your German Language files.  You might want to default you Forum to English Language and check to see if that error still happens.

ZarPrime

IchBin

You can indeed see it is the German language causing the problem by viewing the page in English.
http://www.die-erben-mittelerdes.de/smf/index.php?action=register;language=english

TauTau

#13
ok, I took a look now at the file mentioned in the error log (already got 138 pages of error messages, and that's without many users accessing ;)). The file smf/Themes/default/languages/TPShout.german-utf8.php merely contains txt variables, and I never touched it. The error messages however tell something about constants and offsets, none of which is defined there.
What I find a bit strange also, is that the files are referenced from /smf/Themes/default, is that the normal behaviour? Shouldn't they be used from the used theme folder?
Since I got no error message from the captcha problem, and it indeed is caused by the language as IchBin found out, what language file could be of problem there? (though I assume that also would be only defined txt variables, and how could there be an error?)
Since all files used besides the Theme are official downloads and untampered, why am I the only one having that problem? Everyone else still using ISO8859?;)

Edit: I switched the site to english, and it seems the Shoutbox problem is still something different:
Quote
8: Undefined offset: 1080
File: /var/www/web4/web/smf/Themes/default/languages/TPShout.english.php (main_above sub template - eval?)
Line: 489

TauTau

Still playing around... I got to the point, where the Shoutbox works when set to english. I removed all the offending button definitions from index.template.php (seems it really IS a theme problem):
for example, this

echo '<li', $current_action == 'forum' ? ' class="chosen"' : '', '><a href="', $scripturl, '?action=forum"><b>' , Forum , '</b></a></li>';


caused a "undefined constant Forum" Error. I have no idea why that is, since to me this looks like pure html code, where "Forum" just is text.

This one

echo '<li', $current_action == 'links' ? ' class="chosen"' : '', '><a href="', $scripturl, '?action=links"><b>' , $txt[1080] , '</b></a></li>';


caused the "illegal offset 1080" Error. Coming from perl, this goes beyond my php knowledge, is that how a offset within a string is defined? Obviously 1080 seems a bit high ;)

Though, commenting all those out, I got it working in english with the shoutbox and captcha.

As soon as I switch to german-utf8 though, the shoutbox and captcha are gone. Seems the code is really woven between all those files, I have no idea where to trace that down...
Is it safe to assume that the problem now is down to SMF? Since there always was TPShout.german-utf-8.php referenced, I'm not so sure about this...

I also got another error message, but can't reproduce it (it looks like a module problem though):

Quote
http://www.die-erben-mittelerdes.de/smf/index.php?action=tpmod;shout=admin
Apply Filter: Only show the errors with the same message
2: Illegal offset type in isset or empty
File: /var/www/web4/web/smf/Sources/TPmodules.php
Line: 1994

the offending line is this:


elseif($precode == 'tpmod='){
if($context['TPortal']['action']=='tpmod' && isset($_GET[$body]))
$show=true;
}




TauTau

#15
so, I got a bit further. After searching the SMF forums for a while, I found something captcha related, and it made me curious:
http://www.simplemachines.org/community/index.php?topic=313567.0

that user just did an upgrade and then captcha didn't work anymore. So I installed the filecheck tool from here
http://www.simplemachines.org/community/index.php?topic=300626.msg1989826#msg1989826

and found that a lot of the TP.german-utf8 files were saved as UTF-8 BOM (that is with signature). I opened that files with notepad2 and set the encoding to UTF, and now the captcha shows also up with german language. Also a lot of the TPsomething.php files had trailing newlines, dunno if that is really important, but I cleaned it up. The shoutbox still doesn't come up though.

The language files I used are the ones from the download section here, so maybe the maintainer should take a look at them...

Edit: correction, the shoutbox also comes up now (gotta enable it, too ;))

IchBin

Any time you see PHP code go from single quote to comma, and then comma to single quote, it is telling you to escape to PHP and then back. And since you have only put the word 'forum' in between there, PHP assumes you are using PHP. Since you have no dollar sign indicating a variable, it assumes you are using a constant. Hence the constant error. All you need to do is get rid of the single quote and commas and make your line look like this:
echo '<li', $current_action == 'forum' ? ' class="chosen"' : '', '><a href="', $scripturl, '?action=forum"><b>Forum</b></a></li>';


In order to figure out why the language files are causing the problem, I would take them all out, and add one by one back in until you see the problem again.

G6Cad

You know that you have to check the languages for your blocks to show ?

English will always show, but if you have set your forum to use german, you need to name the block and activate it for german language to.
Edit the blocks one by one and name them in your language and save, that will bring in the block when you switch to German

ZarPrime

TauTau,

The trailing newlines does indeed seem to be the problem.  There seems to be a problem with dynamic images like the Captcha image when those 2 extra lines are saved in the php files.

When did you download the German Language Packs?  The latest ones approved for YP 1.0 Beta 4 were approved and uploaded only 3 days ago (June 12th).  Are these the ones you got?  If there is a problem with the UTF8 package then maybe G6 will see this and step in here as she remade the UTF8 package after The_Gentleman uploaded them, but I'm not sure what she did.  I will ask her to take a look at this topic.

The latest Language Packs that were uploaded the other day are in the download section ...

TP Beta4 German ISO Translation ...
http://www.tinyportal.net/index.php?action=tpmod;dl=item1112

TP Beta4 German UTF8 Translation ...
http://www.tinyportal.net/index.php?action=tpmod;dl=item1113

If this problem is now fixed, then we can mark this topic as solved.  That way, if the only issue is adding another button to the Hobbit theme you can post a new topic in Fussilet's theme board for help on that.

FWIW, when editing php files, SMF seems to be very particular on how the files are saved so a program that saves the files correctly is imperative.  I am not familiar with the Notepad2 you mentioned earlier but a lot of people use Notepad ++ (Is that the same program?) and there are others that are very good.  I have like 4 or 5 different programs that let me work on php but the one I seem to use the most is Context.

ZarPrime

Edit:  Sorry G6, I didn't see that you already responded here before I posted.

TauTau

Quote from: IchBinâ„¢ on June 15, 2009, 02:52:06 PM
All you need to do is get rid of the single quote and commas and make your line look like this:
echo '<li', $current_action == 'forum' ? ' class="chosen"' : '', '><a href="', $scripturl, '?action=forum"><b>Forum</b></a></li>';


ok, I can see the problem now... One of the reasons I always hated the mixing of php and html ;)

Quote
In order to figure out why the language files are causing the problem, I would take them all out, and add one by one back in until you see the problem again.

yeah, gotta take a look at that, since with SMF MediaGallery Errors are back again when I set to german-utf8... (Funnily it's always with TPShout)

This website is proudly hosted on Crocweb Cloud Website Hosting.