Edit post bugfix for b2 GeSHi syntax highlighter hack

You will find that if you edit a post after making it, any backslashes you have in your code will get stripped. To fix this behavior, modify the "editpost" branch of the switch statement in b2edit.php. Comment out the call to the balanceTags() method and add a call to addSlashes() as shown below.

  1. case "editpost":
  3. $standalone = 1;
  4. require_once("./b2header.php");
  5. if ($user_level == 0 || $user_level == 1)
  6. die ("Cheatin' uh ?");
  8. if (!isset($blog_ID)) {
  9. $blog_ID = 1;
  10. }
  11. $post_ID = $HTTP_POST_VARS["post_ID"];
  12. $post_category = intval($HTTP_POST_VARS["post_category"]);
  13. $post_autobr = intval($HTTP_POST_VARS["post_autobr"]);
  14. // Removed as part of the GeSHi Syntax Highlighter hack
  15. //$content = balanceTags($HTTP_POST_VARS["content"]);
  16. $content = format_to_post($content);
  17. // Add slashes, part of the GeSHi Syntax Highlighter hack
  18. $content = addslashes ( $content );
  19. $post_title = addslashes($HTTP_POST_VARS["post_title"]);

Note: Since the GeSHi hack currently removes the call to balanceTags(), you need to take care to make sure that you close any and all HTML tags you include in your post and to escape characters such as the less-than sign (<). Otherwise the display of your site and/or your XML feed may break (had it happen to me yesterday!)

By the way, try clicking on some of the keywords (like isset or addslashes) in the code listing above... cool, isn't it? GeSHi rocks! :)