You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 37 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Fixed: Signature Display Problem in 7.2--Complete! [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Thu Sep 02, 2004 6:00 pm Reply with quoteBack to top

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 Smile

Now I have a minor problem. (There's always a problem, right? Twisted Evil ) 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. Smile


Last edited by Zola on Sun Sep 12, 2004 2:58 am; edited 1 time in total
Find all posts by ZolaView user's profileSend private message
~corky~
Major
Major


Joined: Feb 13, 2004
Posts: 777


PostPosted: Thu Sep 02, 2004 7:36 pm Reply with quoteBack to top

nice jobbbbb

_________________
Free Christian Support and Advice
[b][COLOR=Red]Web Hosting Coupons, Rebates, and Reviews[/COLOR][/b]
Find all posts by ~corky~View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Wed Sep 08, 2004 1:40 pm Reply with quoteBack to top

~corky~ wrote:
nice jobbbbb


Thanks, ~corky~!

I see by your sig that this board also ought to get and apply the bug fix. Wink
Find all posts by ZolaView user's profileSend private message
deja_vu
Nuke Cadet
Nuke Cadet


Joined: Aug 28, 2004
Posts: 6


PostPosted: Sat Sep 11, 2004 1:22 pm Reply with quoteBack to top

Isnt the code for images
Code:
[img=http://www.yourdomain/image.jpg]


Like that?

That's What I thought! Smile

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!).
Find all posts by deja_vuView user's profileSend private message
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sat Sep 11, 2004 2:26 pm Reply with quoteBack to top

deja_vu wrote:
Isnt the code for images
Code:
[img=http://www.yourdomain/image.jpg]


Like that?

That's What I thought! Smile

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 Smile 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. Smile

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. Smile
Find all posts by ZolaView user's profileSend private message
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sun Sep 12, 2004 3:05 am Reply with quoteBack to top

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. Evil or Very Mad

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.
Find all posts by ZolaView user's profileSend private message
deja_vu
Nuke Cadet
Nuke Cadet


Joined: Aug 28, 2004
Posts: 6


PostPosted: Sun Sep 12, 2004 7:24 am Reply with quoteBack to top

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. Sad

▼▼▼ LOL ▼▼▼

_________________
Image
Find all posts by deja_vuView user's profileSend private message
BrainSmashR
Support Mod
Support Mod


Joined: Jan 05, 2004
Posts: 1390

Location: Louisiana, USA

PostPosted: Sun Sep 12, 2004 7:51 am Reply with quoteBack to top

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.

2) Enter this code in the signature box:
Code:

[img]http://www.leonsmy.pwp.blueyonder.co.uk/dejavu.jpg[/img]


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 Very Happy

_________________
ImageImage
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Find all posts by BrainSmashRView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN MessengerICQ Number
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sun Sep 12, 2004 7:54 am Reply with quoteBack to top

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. Sad

▼▼▼ LOL ▼▼▼


*laughs*

I can't spell for beans when I'm overtired. Wink

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... Embarassed )

Let me know how it works. Smile
Find all posts by ZolaView user's profileSend private message
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sun Sep 12, 2004 8:25 am Reply with quoteBack to top

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.

2) Enter this code in the signature box:
Code:

[img]http://www.leonsmy.pwp.blueyonder.co.uk/dejavu.jpg[/img]


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 Very Happy


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.
Find all posts by ZolaView user's profileSend private message
BrainSmashR
Support Mod
Support Mod


Joined: Jan 05, 2004
Posts: 1390

Location: Louisiana, USA

PostPosted: Sun Sep 12, 2004 8:48 am Reply with quoteBack to top

I'm glad you fixed it.....could you explain the problem in English? Embarassed

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.

_________________
ImageImage
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Find all posts by BrainSmashRView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN MessengerICQ Number
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sun Sep 12, 2004 10:30 am Reply with quoteBack to top

BrainSmashR wrote:
I'm glad you fixed it.....could you explain the problem in English? Embarassed

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:

Image

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:

&lt;img src=&quot;http://zolaweb.com/images/anizolazone.gif&quot;&gt;


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:

Code:
1119: function saveuser($realname, $user_email, $femail, $user_website, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_interests, $newsletter, $user_viewemail, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_attachsig, $user_allowbbcode, $user_allowhtml, $user_allowsmile, $user_timezone, $user_dateformat, $user_sig, $bio, $user_password, $vpass, $username, $user_id) {
1120:        global $user, $cookie, $userinfo, $EditedMessage, $user_prefix, $db, $module_name, $minpass;
1121:        cookiedecode($user);
1122:        $check = $cookie[1];
1123:        $check2 = $cookie[2];
1124:        $sql = "SELECT user_id, user_password FROM ".$user_prefix."_users WHERE username='$check'";
1125:       $result = $db->sql_query($sql);
1126:       $row = $db->sql_fetchrow($result);
1127:       $vuid = intval($row[user_id]);
1128:       $ccpass = $row[user_password];

Here's our culprit:

****1129:******    $user_sig = htmlspecialchars($user_sig);

There is absolutely no parsing of the signature prior to this, it just goes straight to htmlspecialchars, which will convert < to a &lt; 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. Wink

I hope that makes more sense?

_________________
[img]http://zolaweb.com/images/anizolazone.gif[/img]
Find all posts by ZolaView user's profileSend private message
BrainSmashR
Support Mod
Support Mod


Joined: Jan 05, 2004
Posts: 1390

Location: Louisiana, USA

PostPosted: Sun Sep 12, 2004 10:41 am Reply with quoteBack to top

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.

Code:

[img]http://zolaweb.com/images/anizolazone.gif[/img][url=http://www.brainsmashr.com][img]http://www.brainsmashr.com/signature3.php[/img][/url]

_________________
ImageImage
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Find all posts by BrainSmashRView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN MessengerICQ Number
Zola
Nuke Soldier
Nuke Soldier


Joined: Sep 01, 2004
Posts: 21


PostPosted: Sun Sep 12, 2004 10:45 am Reply with quoteBack to top

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.

_________________
[img]http://zolaweb.com/images/anizolazone.gif[/img]
Find all posts by ZolaView user's profileSend private message
BrainSmashR
Support Mod
Support Mod


Joined: Jan 05, 2004
Posts: 1390

Location: Louisiana, USA

PostPosted: Sun Sep 12, 2004 10:47 am Reply with quoteBack to top

Don't use html in your signature.

If you intend to use that image for your signature, please edit it so that it is no more than 100px in height.

Code:

[img]http://zolaweb.com/images/anizolazone.gif[/img] [img]http://www.zolaweb.com/images/anizolazone.gif[/img] [img]http://zolaweb.com/images/anizolazone.gif[/img]

_________________
ImageImage
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
Find all posts by BrainSmashRView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN MessengerICQ Number
Display posts from previous:      
Post new topic  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.309 Seconds - 192 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::