There's been a problem in our board with displaying sigs, you see the actual code rather than the link.
I found it, and into the bargain, I've updated the code so that the signature also properly displays BBCode
Now I have a minor problem. (There's always a problem, right? ) All kidding aside, though, I am very new to coding PHP so it is probably something stupid and obvious.
On the Your Account index page where it displays your signature, there is of course not yet a provision for parsing BBCode. I figured I would just drag in BBCode.php and run it through bbencode_second_pass. However, I keep getting the error
"Fatal error: Call to a member function on a non-object in .../includes/bbcode.php on line 83"
(The line in question is: $tpl_filename = $template->make_filename('bbcode.tpl'); )
I have left my code commented out in the page if anyone wants to take a crack at it, I'd love to have it complete.
The fix is somewhat lengthy, so I tossed the page into a zip file and put it in the PHP Nuke Fixes and Tweaks downloads section of my website, http://www.savebigo.com
You're of course welcome to register if you want to see it working.
The fix begins on line 1163. The code that I am undoubtedly messing up begins on line 249.
Enjoy.
Last edited by Zola on Sun Sep 12, 2004 2:58 am; edited 1 time in total
I see by your sig that this board also ought to get and apply the bug fix.
deja_vu Nuke Cadet
Joined: Aug 28, 2004
Posts: 6
Posted:
Sat Sep 11, 2004 1:22 pm
Isnt the code for images
Code:
[img=http://www.yourdomain/image.jpg]
Like that?
That's What I thought!
Zola -
Did you manage to get that fix working? If not how about adding it to www.codingforums.com and getting the answer from them?
This is a fix that I thought would have been addressed in 7.4 (but hasnt!).
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sat Sep 11, 2004 2:26 pm
deja_vu wrote:
Isnt the code for images
Code:
[img=http://www.yourdomain/image.jpg]
Like that?
That's What I thought!
Zola -
Did you manage to get that fix working? If not how about adding it to www.codingforums.com and getting the answer from them?
This is a fix that I thought would have been addressed in 7.4 (but hasnt!).
Oh, the fix works It works perfectly, html displays as it should as does BB image code.
I just stuck it on my website because it was quite substantial in length and I figured it was easier to have the entire modified page in hand, since the code goes into several different spots.
Anyone is welcome to download it, just head over to www.savebigo.com and go to the downloads section, you needn't register to get it or anything.
The only section that requires registration is the forums themselves, but you can see the fix at work there if you care to sign up. I would love to hear back from people about it, so feel free to drop me a mail or rate the download or what have you.
Should I post the link to the fix at the other board too, do you think?
What I needed help with (and a friend has given me a couple of suggestions to try that I've not yet had time to check) is that in the User Display, there is no provision for parsing BB code. When I attempted to run it through the existing functions, I got an error and I am just not sure what caused it or why. I left that section in the page but commented out so that it would be available to anyone who was interested in looking at it--I know where it needs to be, I'm just not sure why I am getting the error I am getting.
I'll keep at it, or if someone knows and can tell me, that's great too. In the meantime, the main part of the problem is fixed.
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sun Sep 12, 2004 3:05 am
As my roommate summed it up: Epiphany sucks.
At least, it does when it strikes about ten minutes before you're going to turn in for the night.
However, my loss of sleep is your gain, because what struck me like a bolt of lightning was the reason I was getting that error--for whatever reason, it was assigning the wrong path to bbcode.tpl.
A simple control structure added to bbcode.php corrected that, and all the code works.
You can now use both html and bbcode in your sig, both work as they should. "Your Account" page now displays the sig instead of the code, and the extra info is properly stripped out when it is loaded into the text box for editing.
www.savebigo.com , same filename, just updated to final version.
One expects it will work with most of the other versions having this problem, it's a very straightforward fix.
deja_vu Nuke Cadet
Joined: Aug 28, 2004
Posts: 6
Posted:
Sun Sep 12, 2004 7:24 am
Quote:
A simple control structure added to bbcode.php corrected that, and all the code works.
Glad you managed to fix it Zola. But I've re-downed ot from your site and seems like the same file. I'm no expert on PHP. But my Sig is still the same the site over.
▼▼▼ LOL ▼▼▼
_________________
BrainSmashR Support Mod
Joined: Jan 05, 2004
Posts: 1390
Location: Louisiana, USA
Posted:
Sun Sep 12, 2004 7:51 am
I'll never understand why you guys have so much trouble with your signatures.
1)Click "Preferences" in the navbar at the top of this site.
3) Make sure you have Enable BBcode and Attach Signature both checked yes
4) Click Save
As you can see, it works and I'll be changing mine after a few hours.....hopefully you'll see this post by then
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sun Sep 12, 2004 7:54 am
deja_vu wrote:
Quote:
A simple control structure added to bbcode.php corrected that, and all the code works.
Glad you managed to fix it Zola. But I've re-downed ot from your site and seems like the same file. I'm no expert on PHP. But my Sig is still the same the site over.
▼▼▼ LOL ▼▼▼
*laughs*
I can't spell for beans when I'm overtired.
I have the CORRECT zip file up now. (TourAccountUpdate.zip just isn't quite the same--I realized that I didn't get the overwrite warning, but it just didn't sink in... )
Let me know how it works.
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sun Sep 12, 2004 8:25 am
BrainSmashR wrote:
I'll never understand why you guys have so much trouble with your signatures.
1)Click "Preferences" in the navbar at the top of this site.
3) Make sure you have Enable BBcode and Attach Signature both checked yes
4) Click Save
As you can see, it works and I'll be changing mine after a few hours.....hopefully you'll see this post by then
That didn't work on my site.
The problem was in the original function save_user.
Line 1129 reads:
$user_sig = htmlspecialchars($user_sig);
Of course, if that's the only thing that you do, you're going to end up with your html converted to special characters like < and > --and that is precisely what I observed in the database after it was posted.
So what I did, in short, was to process the sig code with the existing functions prior to putting it into the database, which is why BBcode now works in the signatures as well.
I also fixed the code so that it displayed properly in the text area, updated it to display line breaks properly, and added the parsing to the Your Account section of the page so the sig would display there as well.
BrainSmashR Support Mod
Joined: Jan 05, 2004
Posts: 1390
Location: Louisiana, USA
Posted:
Sun Sep 12, 2004 8:48 am
I'm glad you fixed it.....could you explain the problem in English?
What exactly was the signature that you were unable to display?
Not the signature.php, but rather what you were actually typing in the signature box.
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sun Sep 12, 2004 10:30 am
BrainSmashR wrote:
I'm glad you fixed it.....could you explain the problem in English?
What exactly was the signature that you were unable to display?
Not the signature.php, but rather what you were actually typing in the signature box.
I was trying to include an image in my signature. The preferences were properly set to allow the appropriate tags, I'm an admin there and I checked.
I'm reproducing the bug for you at this moment, just look at my signature. You don't see signature, you see what I had for html.
This is the image in question:
Obviously, this is an intermittent error but is very reproducible. When I did some digging, instead of seeing something like
Code:
[img:uid123 blah]http://zolaweb.com/images/anizolazone.gif[uid123:/img], what I was actually seeing in the database was something more like this:
I finally tracked it down to Line 1129 in Your_Account.php
As far as I could see, after you have set your signature for the first time, nothing gets processed in subsequent updates. You press the submit button and it goes to the following code:
There is absolutely no parsing of the signature prior to this, it just goes straight to htmlspecialchars, which will convert < to a < and so forth, and that is how it goes into the database. When it is displayed, the tags are thus messed up so the parser doesn't recognize links or BB code and activate.
So what I did was to insert code that called the appropriate functions so that the signature was properly parsed prior to insertion into the database.
It had the additional benefit of making the BBCode work because it gets sent through prepare_message and the UID's are then inserted as they should be.
That took care of the display on the board. Of course, the problem remained in the user look up page (which is also the my account page) because there was no provision for parsing in that section.
The error I was asking about in my original post turned out to be because for reasons known only to itself, the parser wasn't looking for the template in the right place. I fixed that by the simple expedient of explicitly declaring the path if a check variable was assigned, and that was the change to bbcode.php
Last but not least was updating the part of the form that displayed the signature for editing so that the UID's were stripped out as they should be so that the user only sees the proper tags they used in the first place.
Why does it do this? I don't know. I was just looking for the simplest possible fix short of ripping it apart and re-writing the whole function.
I was just looking for the simplest possible fix short of ripping it apart and re-writing the whole function.
The quickest way would be to show me EXACTLY what you typed in the signature box. That way I can show you EXACTLY what the problem is instead of trying to guess what the problem is.
As you can see, I included your graphic without altering one bit of the Nukecops code.
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Zola Nuke Soldier
Joined: Sep 01, 2004
Posts: 21
Posted:
Sun Sep 12, 2004 10:45 am
BrainSmashR wrote:
Quote:
I was just looking for the simplest possible fix short of ripping it apart and re-writing the whole function.
The quickest way would be to show me EXACTLY what you typed in the signature box. That way I can show you EXACTLY what the problem is instead of trying to guess what the problem is.
As you can see, I included your graphic without altering one bit of the Nukecops code.
You are seeing EXACTLY what I typed in. That's what I typed into the signature box, and that's EXACTLY how it displays.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum