Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Wordpress/Vanilla Intergration Issue with single quote

I an having trouble with slashes showing up in my posts when ever someone uses a ' or any other slashable character. You can see an example of this issue I am having here:

http://dg.mmorpgaming.com/forums/comments.php?DiscussionID=4

You will notice in posts 8 and 9 that the single quote is slashed out. Is any one else having this issue with slashes?


edit: I have since moved the forums and refreshed the DB.

Comments

  • Options
    /bump
  • Options
    edited January 2007
    well I just did it myself. For some reason which I cannot seem to stop I have come up with this solution. I created an extension.

    <?php /* Extension Name: Remove Backslashes Extension Url: http://lussumo.com/doc/ Description: Removes backslashes from the posts. Version: 1.0 Author: Ian Sheridan Author Url: http://www.savagevines.com */ if( in_array($Context->SelfUrl, array('post.php','comments.php', 'index.php', 'discussion.php', 'extension.php')) ) { class RemoveBackslashesFormatter extends StringFormatter { function Parse($String, $Object, $FormatPurpose) { if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { return $this->RemoveBackslashesParse($String); } else { return $String; } } function ProtectString ($String) { return $String; } function RemoveBackslashesParse($message) { return stripslashes($message); } } $RemoveBackslashesFormatter = $Context->ObjectFactory->NewObject($Context, "RemoveBackslashesFormatter"); $Context->StringManipulator->AddGlobalManipulator("RemoveBackslashes", $RemoveBackslashesFormatter); } ?>

    All it does is removes the backslashes that are inserted by either Wordpress or Vanilla (this is the only incompatibility that I have found). To make sure that it gets used before any other extension you must edit the conf/extension.php file to make sure that this extension gets included before any of your other post filtering extensions. I probably should remove the "if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) {" too but I have not done that yet.
  • Options
    I have this problem to with WP 2.1 and Van 1.03. Be nice to know why this is happening, I know its not any WP plugins since I disabled them all. Nice script, works for the basics, still trying to find away to make it work for the Page Management Plugin :)
  • Options
    <code> <?php /* Extension Name: Remove Backslashes Extension Url: http://lussumo.com/doc/ Description: Removes backslashes from the posts. Version: 1.0 Author: Ian Sheridan Author Url: http://www.savagevines.com */ if( in_array($Context->SelfUrl, array('post.php','comments.php', 'index.php', 'discussion.php', 'extension.php')) ) { class RemoveBackslashesFormatter extends StringFormatter { function Parse($String, $Object, $FormatPurpose) { return $this->RemoveBackslashesParse($String); } function ProtectString ($String) { return $String; } function RemoveBackslashesParse($message) { return stripslashes($message); } } $RemoveBackslashesFormatter = $Context->ObjectFactory->NewObject($Context, "RemoveBackslashesFormatter"); $Context->StringManipulator->AddGlobalManipulator("RemoveBackslashes", $RemoveBackslashesFormatter); } ?> </code> As the author stated if you remove the "if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) {" it works a lot better, I removed that part in the code above for anyone else that has issues.
  • Options
    I would be surprised if this is being caused by the WP/Vanilla integration. The text of a post made in Vanilla is never touched by any WP code. This looks more like a magic quotes problem.

    Automatically inserting slashes in form inputs is called "magic quotes". It's something that PHP often does by default because it hates you. One of the purposes of the Vanilla function ForceIncomingString() is to strip out these slashes if PHP is configured to insert them.

    All I can think of is maybe you have some Vanilla extension that is somehow ruining the normally good and sane work of ForceIncomingString(). What other Vanilla extensions are you using?
  • Options
    @squirrel: magic quotes seem to be off on my server. magic_quotes_gpc Off Off magic_quotes_runtime Off Off magic_quotes_sybase Off Off I will do a clean install on my server to test Vanilla without WP integration and if all works then with integration again to try and narrow down this issue.
  • Options
    mahoddermahodder New
    edited March 2007
    I can confirm that it definitely is a WP/Vanilla Integration problem. I did a fresh install of Vanilla 1.1.1 and WP 2.1.2. Before the integration the Vanilla posts were fine and did not include the backslashes when I posted. Then I made the following changes to Vanilla to give me access to WP functions. Vanilla-1.1.1\library\Framework\Framework.Class.MySQL class MySQL extends Database { function CloseConnection() { if ($this->Connection) @mysql_close($this->Connection); } became (of course I actually put my real database info not what I shown below): class MySQL extends Database { function CloseConnection() { if ($this->Connection) @mysql_close($this->Connection); global $wpdb; $wpdb = new wpdb('DB User', 'DB password', 'DB Name', 'DB Server'); } Then made the following change: Vanilla-1.1.1\conf\database.php Added the following line: require_once('/users/myaccount/wp-blog-header.php'); Once those two changes are made it starts inserting the backslashes when ever there are quotes. I have no extensions enabled and I am using the default theme. Any ideas on what could be causing this?
  • Options
    The slash problem seems to be caused by the fact that recent versions of WordPress slash everything that gets posted. Unfortunately, Vanilla isn’t expecting this. You can keep these slashes from appearing by adding, the following lines at the end of the database.php file: $_GET = stripslashes_deep($_GET ); $_POST = stripslashes_deep($_POST ); $_COOKIE = stripslashes_deep($_COOKIE); Author of above code: filosofo Finally a workaround!
  • Options
    I just get an error when I add those lines to conf/database.php. "Call to undefined function stripslashes_deep()"
This discussion has been closed.