Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2002, 09:03 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Parsing HTML code from a template, to PM. Help??

I'm creating a hack that during one of the processes it takes HTML code from a template and sends it to a specified user as a personal message.

The only problem is the HTML code is not parsed.

Say my template called priv_forwardpost contains:
Code:
<a href="http://www.lycos.com">hello</a>
Well, in the PM to that user, when he reads it will show exactly as:
Code:
<a href="http://www.lycos.com">hello</a>
With not links. I have tried using htmlspecialchars() or bbcodeparse() or addslashes(), just to see if they would do anything put they don't

Basically here is the small part of my code where the problem exists:
PHP Code:
eval("\$message = \"".gettemplate("priv_forwardpost",1,0)."\";");

$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,messageread,folderid) VALUES (NULL,$pm_userid,$pm_userid,$bbuserinfo[userid],'".addslashes(htmlspecialchars($pm_title))."','".addslashes($message)."',".time().",0,0)"); 
So how can I get it when the user views the PM, the $message is parsed and HTML shows?

Thanks if you can help.
Reply With Quote
  #2  
Old 10-27-2002, 09:07 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would have thought the problem would have been that the PM system doesn't parse HTML (for security reasons) which is why it is appearing as the source.
Reply With Quote
  #3  
Old 10-27-2002, 09:33 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've found this more than likely to be the problem after viewing private.php.

What I'm needing help for then is a way to bypass the block just for my hack, but not to interfer with regular PM messanging.


For example, say my template priv_forwardpost contained this:
Code:
[_url]http://www.lycos.com[/url]
(without the underscore)

Now, wouldn't it seem logical that if I sent this into the database using addslashes(), then it would produce normal when viewing the PM? As parsed?

Only problem is that I can't even get this submitted into the database without recieving a database error, something about it containing bbcode in the template is interferring...
Reply With Quote
  #4  
Old 10-27-2002, 09:44 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should work, I don't see why it shouldn't (I don't know if the " around $message will make a difference or not?).

PHP Code:
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,messageread,folderid) VALUES (NULL,$pm_userid,$pm_userid,$bbuserinfo[userid],'".addslashes(htmlspecialchars($pm_title))."','".addslashes("$message")."',".time().",0,0)"); 
It should parse the vB Code like it would if a user was sending it.
Reply With Quote
  #5  
Old 10-27-2002, 10:08 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok..lol, I've found the error but now I'm pondering on a way to fix it.

It error was in the [_url][/url] tag, because in my real code the url contains variables, such as $userid. And code between [_url][/url] cannot contain variables, because they don't get parsed.

Now I'm thinking of a way to get these variables parsed before being submitted into the database..
Reply With Quote
  #6  
Old 10-27-2002, 11:06 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BUAHAH!!
Finally figured it out, thanks for your help anyway NTLDR

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04058 seconds
  • Memory Usage 2,220KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete