View Full Version : Parse bbcode/clean_gpc.
Kyojii
04-04-2012, 10:28 AM
I've been trying to do it this way but it keeps telling me I'm using clean_gpc wrong.
<?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']);
?>
Fatal error: Call to a member function clean_gpc() on a non-object on line 6
nhawk
04-04-2012, 10:51 AM
Try..
$input->clean_gpc('p', 'article', TYPE_STR);
Kyojii
04-04-2012, 10:55 AM
Still having the same problem :\ new code below.
<?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']);
?>
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:
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
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().
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.
kh99 always beats me to these things,
That's because I have too much spare time. :)
Pandemikk
04-04-2012, 11:46 PM
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 :\
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.