PDA

View Full Version : Inferno Shoutbox - Backslashes on Apostrophes? ( "\")


Inked_Mono
08-28-2016, 02:57 AM
Hey there! I'm having an issue with my shoutbox where any time an apostrophe is used, it seems to add a backslash as well. This also happens with quotes.

http://i.imgur.com/Pb4TrHL.png

Any idea what the cause might be?

MarkFL
08-28-2016, 05:02 AM
I would suggest asking about this in the modification's thread...that way the devloper of the mod will be more likely to see your question. :)

Inked_Mono
08-28-2016, 04:35 PM
I would suggest asking about this in the modification's thread...that way the devloper of the mod will be more likely to see your question. :)

I'd be extremely surprised if they were still offering support, haha. Thanks though, I'll give it a shot!

MarkFL
08-28-2016, 05:15 PM
I'd be extremely surprised if they were still offering support, haha. Thanks though, I'll give it a shot!

Even if the developer is long gone from vBorg, others who have installed and using it would be more likely to see your question there as well.

In general we ask that questions regarding mods that are available here be posted in the thread pertaining to the mod, not only for the reasons I stated, but it is better for site organization as well. :)

Inked_Mono
08-29-2016, 03:41 AM
Hey, I know this was in the wrong section to begin with, but in case someone searches up the same thing, I thought I'd post the fix I was able to come up with!

Search tags: Inferno Shoutbox V3 AJAX

Fix:

In the infernoshout.php file look for the method in charge of submitting the shout:

if ($_POST['do'] == 'shout' && ($message = trim($_REQUEST['message'])) != '')
{
$vbulletin->input->clean_array_gpc('r', array(
'message' => TYPE_STR,
));

$message = trim($vbulletin->GPC['message']);

if ($vbulletin->userinfo['userid'] > 0)
{
$infernoshout->load_engine('shout');

$shout = new shout;
$shout->process($message);
}
}

Call the stripslashes() method on the message call. Stripslashes() is generally used with the PHP directive magic_quotes_gpc is toggled on (which is generally set to on by default before PHP 5.4). Your code will look something like this:

if ($_POST['do'] == 'shout' && ($message = trim($_REQUEST['message'])) != '')
{
$vbulletin->input->clean_array_gpc('r', array(
'message' => TYPE_STR,
));

$message = trim($vbulletin->GPC['message']);

if ($vbulletin->userinfo['userid'] > 0)
{
$infernoshout->load_engine('shout');

$shout = new shout;
$shout->process(stripslashes($message));
}
}

This will return your string with blackslashes stripped off. (\' becomes ' and so on.) Double backwards (\\) are made into a single backslash (\).

Cheers!