vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Parse bbcode/clean_gpc. (https://vborg.vbsupport.ru/showthread.php?t=281100)

Kyojii 04-04-2012 10:28 AM

Parse bbcode/clean_gpc.
 
I've been trying to do it this way but it keeps telling me I'm using clean_gpc wrong.

Code:

<?php
chdir("../");
require_once('./global.php');
require_once('./includes/class_bbcode.php');

$input->clean_gpc('p', $_POST['article'], TYPE_STR);

$bbcode_parser =& new vB_BbCodeParser($GLOBALS['vbulletin'], fetch_tag_list(),false);
echo $bbcode_parser->do_parse($GPC['article']);
?>

Quote:

Fatal error: Call to a member function clean_gpc() on a non-object on line 6

nhawk 04-04-2012 10:51 AM

Try..

Code:

$input->clean_gpc('p', 'article', TYPE_STR);

Kyojii 04-04-2012 10:55 AM

Still having the same problem :\ new code below.

Code:

<?php
chdir("../");
require_once('./global.php');
require_once('./includes/class_bbcode.php');

$input->clean_gpc('p', 'article', TYPE_STR);

$bbcode_parser =& new vB_BbCodeParser($GLOBALS['vbulletin'], fetch_tag_list(),false);
echo $bbcode_parser->do_parse($GPC['article']);
?>


kh99 04-04-2012 11:07 AM

Try using $vbulletin->input->clean_gpc (and also $vbulletin->GPC to access the value).

Pandemikk 04-04-2012 01:03 PM

kh99 always beats me to these things, but I just want to add that using -> after a variable should only be done if you have instantiated a class with it.

For example:

PHP Code:

class foo {
    function 
bar() {
        echo 
'Foo is a class, bar is a method';
    }
}

$input = new foo();
$input->bar(); 


Kyojii 04-04-2012 06:52 PM

Quote:

Originally Posted by kh99 (Post 2316649)
Try using $vbulletin->input->clean_gpc (and also $vbulletin->GPC to access the value).

Thanks that worked I thought $vbulletin was set as a global in global.php since on other pages I was able to write queries with $db->query_read() instead of $vbulletin->db->query_read().

kh99 04-04-2012 06:56 PM

Quote:

Originally Posted by Kyojii (Post 2316776)
Thanks that worked I thought $vbulletin was set as a global in global.php since on other pages I was able to write queries with $db->query_read() instead of $vbulletin->db->query_read().

That works because $db is defined separately as another reference to the db object.


Quote:

Originally Posted by Pandemikk (Post 2316674)
kh99 always beats me to these things,

That's because I have too much spare time. :)

Pandemikk 04-04-2012 11:46 PM

Quote:

Originally Posted by Kyojii (Post 2316776)
Thanks that worked I thought $vbulletin was set as a global in global.php since on other pages I was able to write queries with $db->query_read() instead of $vbulletin->db->query_read().

$vbulletin is an instance of the vbulletin class. :)

You were using $input, which is not an instance of any class- especially of vBulletin's! Can I ask why you were using $input?

Kyojii 04-06-2012 01:02 AM

I don't know :\


All times are GMT. The time now is 03:59 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.01060 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete