<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress support forums Topic: WP Integration - Slashes the root of all evil</title>
<link>http://bbpress.org/forums/</link>
<description>bbPress support forums Topic: WP Integration - Slashes the root of all evil</description>
<language>en</language>
<pubDate>Thu, 20 Nov 2008 21:43:28 +0000</pubDate>

<item>
<title>pashka80 on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-4918</link>
<pubDate>Mon, 26 Feb 2007 19:35:27 +0000</pubDate>
<dc:creator>pashka80</dc:creator>
<guid isPermaLink="false">4918@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;jmmhm
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-4000</link>
<pubDate>Sun, 04 Feb 2007 23:20:02 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">4000@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Yes. I figured that's what it was called - I just couldn't find it referenced in the source anywhere. I must have grepped badly. Will try that out.
&#60;/p&#62;</description>
</item>
<item>
<title>thomasklaiber on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3998</link>
<pubDate>Sun, 04 Feb 2007 21:57:08 +0000</pubDate>
<dc:creator>thomasklaiber</dc:creator>
<guid isPermaLink="false">3998@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;In bbpress it is called 'bb_init' ... do you mean this?
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3997</link>
<pubDate>Sun, 04 Feb 2007 21:38:40 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3997@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I brain locked. bb_head is probably too late for this. Is there an equivalent of the 'init' hook for bbPress? In WordPress, that filter hook gets run after the environment initializes. That's when the code I included would need to be run. I can't seem to find an applicable filter hook called that early.
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3995</link>
<pubDate>Sun, 04 Feb 2007 17:53:20 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3995@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Would the solution be to execute a stripslashes_deep on GET, POST, etc if WP_BB is true? Seems kinda dangerous - but bbpress doesn't expect this in a non-integrated environment, so undoing what wp-settings.php does (which gets run when you include wp-config to get the WordPress API) seems harmless enough.&#60;/p&#62;
&#60;p&#62;Maybe something along the lines of:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;function bb_undo_wp_slashes() {&#60;br /&#62;
$_GET = stripslashes_deep($_GET );&#60;br /&#62;
$_POST = stripslashes_deep($_POST );&#60;br /&#62;
$_COOKIE = stripslashes_deep($_COOKIE);&#60;br /&#62;
$_SERVER = stripslashes_deep($_SERVER);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and call that as a filter for bb_head?&#60;/p&#62;
&#60;p&#62;&#60;code&#62;if (defined(&#38;#39;WP_BB&#38;#39;) &#38;#38;&#38;amp; WP_BB) add_action(&#38;#39;bb_head&#38;#39;, &#38;#39;bb_undo_wp_slashes&#38;#39;);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I think bb_head is called after the environment is setup.&#60;/p&#62;
&#60;p&#62;I may give this a try. Thoughts from developers who know more about bbPress than I?
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3994</link>
<pubDate>Sun, 04 Feb 2007 17:41:17 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3994@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Weird. I have magic quotes off. However, I notice that wp-settings adds slashes to EVERY request in wp-settings:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// If already slashed, strip.&#60;br /&#62;
if ( get_magic_quotes_gpc() ) {&#60;br /&#62;
        $_GET    = stripslashes_deep($_GET   );&#60;br /&#62;
        $_POST   = stripslashes_deep($_POST  );&#60;br /&#62;
        $_COOKIE = stripslashes_deep($_COOKIE);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// Escape with wpdb.&#60;br /&#62;
$_GET    = add_magic_quotes($_GET   );&#60;br /&#62;
$_POST   = add_magic_quotes($_POST  );&#60;br /&#62;
$_COOKIE = add_magic_quotes($_COOKIE);&#60;br /&#62;
$_SERVER = add_magic_quotes($_SERVER);&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Is bbpress not expecting this? This might explain the double slashing even if magic quotes is off (I checked my php.ini - it is off)
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3993</link>
<pubDate>Sun, 04 Feb 2007 17:34:35 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3993@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;So I've been digging further into the strange behavior I've had with slashes in posts AND with HTML tag attributes being yanked out.&#60;/p&#62;
&#60;p&#62;It's all related. Apparently, there is some type of problem where slashes get added TWICE when the WP intergation is on. This is why slashes start showing up everywhere and why kses fails.&#60;/p&#62;
&#60;p&#62;I finally discovered that even though the stripslashes filter is called before bb_filter_kses, there are still slashes in front of the quotes of the attributes. So they get tossed.&#60;/p&#62;
&#60;p&#62;So I took out all the stripslashes hacks I had put into the title and post routines and called stripslashes TWICE as a pre_post filter. Voila - attributes are preserved. &#60;/p&#62;
&#60;p&#62;&#60;code&#62;add_filter('pre_post', 'stripslashes', 40);&#60;br /&#62;
add_filter('pre_post', 'stripslashes', 45); // 2nd Time&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I also added this little section in default-filters.php:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// Slash problems when integrated with WordPress&#60;br /&#62;
if (defined('WP_BB') &#38;#38;&#38;amp; WP_BB) {&#60;br /&#62;
        add_filter('post_text', 'stripslashes');&#60;br /&#62;
        add_filter('get_topic_title', 'stripslashes');&#60;br /&#62;
        add_filter('get_bb_title', 'stripslashes');&#60;br /&#62;
        add_filter('edit_text', 'stripslashes');&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;And it stripped out the slashes in titles, browser bars, posts, edit screens, etc. (Note there is a missing semi-colon after the sort_tag_heat_map line - you need to add on if you put this at the end)&#60;/p&#62;
&#60;p&#62;This is still a hack. I don't have magic quotes on. I still need to dig and find out why there seems to be alternate behavior when wordpress is integrated or not. Maybe WordPress is turning on magic quotes and bbPress doesn't expect it to be on?&#60;/p&#62;
&#60;p&#62;Still digging.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
