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

Reply
 
Thread Tools Display Modes
  #21  
Old 07-25-2005, 10:32 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
 $webpage $DB_site->query("
    SELECT *
    FROM " 
TABLE_PREFIX "userfield
"
);  

 
$webpage['text'] = stripslashes($row['text']);
            
            
//Check text-formatting settings
            
$settingvbcode iif($row['vbcodeorhtml'] == 'vbcode' AND $vboptions['webpageallowvbcode'] == '1''1''0');
            
$settinghtml iif($row['vbcodeorhtml'] == 'html' AND $vboptions['webpageallowhtml'] == '1''1''0');
            if(
$settinghtml == AND $settingvbcode == 0) {
                
$settingvbcode 1;
            }
            
            if(
$vboptions['webpagesmilies'] == and $row['usesmilies'] == 1) {
                
$settingsmilies 1; } else { $settingsmilies 0; }
            
            if(
$settingvbcode == 1) {
                
$webpage['text'] = parse_bbcode2($webpage['text'], $settinghtml1$settingsmilies$settingvbcode);
            }
            if(
$settinghtml == 1) {
                
//Remove scripts!!!
                
$webpage['text'] = preg_replace("/(\<script)(.*?)(script>)/si"""$webpage['text']);
                
//Don't hide anything!
                
$webpage['text'] = str_replace("<!--""&lt;!--"$webpage['text']);
                
//Allow specified tags (if empty in admin, ALL tags are allowed! SECURITY RISK!)
                
if($settinghtml == && !empty($vboptions['allowedhtmltags'])) {
                    
$webpage['text'] = strip_tags($webpage['text'], $vboptions['allowedhtmltags']);
                }
            }
            
            
//Javascript will not be allowed
            
$webpage['text'] = ereg_replace("~<script[^>]*>.+</script[^>]*>~isU"""$webpage['text']); 
            
            
$webpage['hits'] = $row['hits'];
            
$webpage['bgcolor'] = $row['bgcolor'];
            
$webpage['bordersize'] = $row['bordersize'];
            
$webpage['bordercolor'] = $row['bordercolor'];
            
$webpage['fontface'] = $row['fontface'];
            
$webpage['fontsize'] = $row['fontsize'];
            
$webpage['fontcolor'] = $row['fontcolor']; 
Reply With Quote
  #22  
Old 07-25-2005, 10:35 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i dont see $profilefields2[fieldx] in that code

I think the code would be something like this:


PHP Code:
 $profilefields2 $DB_site->query(
    SELECT profilefieldid, required, title, type, data, def, height 
    FROM " 
TABLE_PREFIX "profilefield 
    WHERE form = 0 OR 6 OR 7  OR 8" 
iif(!can_moderate(), 
        AND hidden = 0"
) . 
    ORDER BY displayorder 
"
);  

 
$webpage['text'] = stripslashes($row['text']); 
             
            
//Check text-formatting settings 
            
$settingvbcode iif($row['vbcodeorhtml'] == 'vbcode' AND $vboptions['webpageallowvbcode'] == '1''1''0'); 
            
$settinghtml iif($row['vbcodeorhtml'] == 'html' AND $vboptions['webpageallowhtml'] == '1''1''0'); 
            if(
$settinghtml == AND $settingvbcode == 0) { 
                
$settingvbcode 1
            } 
             
            if(
$vboptions['webpagesmilies'] == and $row['usesmilies'] == 1) { 
                
$settingsmilies 1; } else { $settingsmilies 0; } 
             
            if(
$settingvbcode == 1) { 
                
$webpage['text'] = parse_bbcode2($webpage['text'], $settinghtml1$settingsmilies$settingvbcode); 
            } 
            if(
$settinghtml == 1) { 
                
//Remove scripts!!! 
                
$webpage['text'] = preg_replace("/(\<script)(.*?)(script>)/si"""$webpage['text']); 
                
//Don't hide anything! 
                
$webpage['text'] = str_replace("<!--""&lt;!--"$webpage['text']); 
                
//Allow specified tags (if empty in admin, ALL tags are allowed! SECURITY RISK!) 
                
if($settinghtml == && !empty($vboptions['allowedhtmltags'])) { 
                    
$webpage['text'] = strip_tags($webpage['text'], $vboptions['allowedhtmltags']); 
                } 
            } 
             
            
//Javascript will not be allowed 
            
$webpage['text'] = ereg_replace("~<script[^>]*>.+</script[^>]*>~isU"""$webpage['text']); 


However.... i know i have to edit alot where it sais $webpage['text'] but how would i edit it so that it works as $profilefields2['fieldx'] where x is the profilefieldid
Reply With Quote
  #23  
Old 07-26-2005, 10:35 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'm assuming webpage[text] is the field you're reffering to from the useroptions right?

then that being the case you could just select that field with a query assign it to webpage text and voila you have what you need.

but in these peoblems it's hard to help as it's less about pointing out the error in the code, it's more about building the code and with limted info that's very hard

ps replace you're iff's with trinary operators and also you'll find data from the DB selects alot faster when columns are specified as opposed to wild cards.
Reply With Quote
  #24  
Old 07-26-2005, 02:53 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm sorry but i am not a php coder, i am still in the learning process when it comes to php. If i have not been sepcific as to what it is i want to do let me say it once more :

The $webpage[text] has limits as to what html is allowed.... i would like the same for $post[fieldx] (where x is the ID of the profile field). I would just like for $post[fieldx] to follow the same html rules as $webpage[text]


Thanks once again,
Gio
Reply With Quote
  #25  
Old 07-26-2005, 02:56 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what is the query $webpage?
Reply With Quote
  #26  
Old 07-26-2005, 03:16 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[high]*gio~logist takes a ballpark*[/high]

PHP Code:
            if($settingvbcode == 1) {
                
$webpage['text'] = parse_bbcode2($webpage['text'], $settinghtml1$settingsmilies$settingvbcode);
            }
            if(
$settinghtml == 1) {
                
//Remove scripts!!!
                
$webpage['text'] = preg_replace("/(\<script)(.*?)(script>)/si"""$webpage['text']);
                
//Don't hide anything!
                
$webpage['text'] = str_replace("<!--""&lt;!--"$webpage['text']);
                
//Allow specified tags (if empty in admin, ALL tags are allowed! SECURITY RISK!)
                
if($settinghtml == && !empty($vboptions['allowedhtmltags'])) {
                    
$webpage['text'] = strip_tags($webpage['text'], $vboptions['allowedhtmltags']);
                }
            }
            
            
//Javascript will not be allowed
            
$webpage['text'] = ereg_replace("~<script[^>]*>.+</script[^>]*>~isU"""$webpage['text']); 
            
            
$webpage['hits'] = $row['hits'];
            
$webpage['bgcolor'] = $row['bgcolor'];
            
$webpage['bordersize'] = $row['bordersize'];
            
$webpage['bordercolor'] = $row['bordercolor'];
            
$webpage['fontface'] = $row['fontface'];
            
$webpage['fontsize'] = $row['fontsize'];
            
$webpage['fontcolor'] = $row['fontcolor']; 
This?
Reply With Quote
  #27  
Old 07-26-2005, 03:22 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nope, it will be above that and it should say something like $webtext = $DB_site->query("

etc
Reply With Quote
  #28  
Old 07-26-2005, 03:29 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is what i've seen so far that looks anything like what you posted

PHP Code:
    $sql mysql_query("SELECT * FROM user_webpage WHERE userid = ".GBUSERID."");
    
    if(
mysql_num_rows($sql) == 0) {
        
        
//Create ext. profile
        
$createsql mysql_query("INSERT INTO user_webpage (userid,hits,vbcodeorhtml) VALUES (".GBUSERID.",'1','".$vboptions['webpagevbcodeorhtml']."')");
        
//ladda om $sql v?rde
        
$sql mysql_query("SELECT * FROM user_webpage WHERE userid = ".GBUSERID."");
        
    } 
Reply With Quote
  #29  
Old 07-26-2005, 03:33 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

find the $row variable's creation.
Reply With Quote
  #30  
Old 07-26-2005, 03:37 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THIS?

PHP Code:
            $webpage['text'] = stripslashes($row['text']); 
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 10:45 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06685 seconds
  • Memory Usage 2,330KB
  • 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
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete