Difficult project of correlating inserted in-line styles in RTE and then removing all styles and scripts

This basically defines the BoxToDb() which is in common.php and is called whenever we come out of a RTE box to add data to the db. 

attempt to sanatize as per these instructions
    • unfortunately that would also remove most of the rte formatting  ... but i fixed that
  • use php strip tags function as per this comment
    • this is working
  • remove all styles except those known to be generated by rte
    • use preg_replace

      • The e modifier makes preg_replace() treat the replacement parameter as PHP code after the appropriate references substitution is done. Tip: make sure that replacement constitutes a valid PHP code string, otherwise PHP will complain about a parse error at the line containing preg_replace().
        What they don't tell you is that you should enclose the replacement string in quotes if you are using the /e modifier
      • Remove the styles of my known classess too.  They will be applied by the style sheet on display based upon the class.  However:
        • must reapply them on edit 
      • rte box styles to preserve this is working
      • however still need to parse into the style literal because rte box applies multiple styles in the same statement  .... done
        • font-style: italic;
        • font-weight: bold;
        • text-align: right;
        • text-align: justify;
        • text-align: left;
        • "margin-left: NNNpx;" (whenre NNN any number<rediculous)
        • "color: rgb(102, 0, 204);" (where the rgb vary)
  • Replaced single quotes as follows to  get some bizarre strings through  sql
    • $text=str_replace("'","&apos;",$text);
    • Hopefully this will not get us into problems later.
Time for another shakedown

Tags

  1. rte

Comments


Seth says
This project is completed except for reapplying styles on edit and of course phase 2 where we correlate thr rt2 style classess with the style sheet [see: item 1336]

See Also

  1. Thought Now have ability to style individual thoughts with CSS style sheets with 66 viewings related by tag "rte".
  2. Thought Invisible characters found in editor output. with 8 viewings related by tag "rte".
  3. Thought Fixing the "unfixable" bugs in CKEditor with 8 viewings related by tag "rte".
  4. Thought Test of the Opera Browser with 6 viewings related by tag "rte".
  5. Thought RTE Matrix with 6 viewings related by tag "rte".
  6. Thought is tag navigation working better now ? with 6 viewings related by tag "rte".
  7. Thought JavaScript based HTML editor with 6 viewings related by tag "rte".
  8. Thought icons with 5 viewings related by tag "rte".
  9. Thought Checking out the word Watch with 4 viewings related by tag "rte".
  10. Thought How can i deactivate paste in a rich text edit box ? with 3 viewings related by tag "rte".
  11. Thought about: Writely - The Web Word Processor with 3 viewings related by tag "rte".
  12. Thought Advanced RTE doesn't seem to have sound with 2 viewings related by tag "rte".
  13. Thought the rte box should be exactly as wide as the item display with 2 viewings related by tag "rte".
  14. Thought rte symbols used on gmail with 1 viewings related by tag "rte".
  15. Thought a spammers dream with 1 viewings related by tag "rte".
  16. Thought about: Micro Persuasion: Blog Directly from Firefox with 0 viewings related by tag "rte".
  17. Thought How come Winnies does not have one of these? with 0 viewings related by tag "rte".
  18. Thought RTE nastiness with 0 viewings related by tag "rte".
  19. Thought rte for item needs convenient exit for consistency with 0 viewings related by tag "rte".
  20. Thought Ok ... so we can do rich text editing ... with 0 viewings related by tag "rte".
  21. Thought this is what we are trying to prtect the rte box against with 0 viewings related by tag "rte".
  22. Thought test with 0 viewings related by tag "rte".
  23. Thought Does Color Work ? with 0 viewings related by tag "rte".
  24. Thought bad url removes RTE contents with 0 viewings related by tag "rte".
  25. Thought Test image with 0 viewings related by tag "rte".
  26. Thought Square brackets and rte with 0 viewings related by tag "rte".
  27. Thought we have two variations of permalink uri floating around with 0 viewings related by tag "rte".
  28. Thought rte (rich text editor) package deployed by fastblogit.com with 0 viewings related by tag "rte".
  29. Thought test with 0 viewings related by tag "rte".
  30. Thought Test - I lost bold comments on a specific [item 1460] with 0 viewings related by tag "rte".
  31. Thought right mouse click menu should have a paste option for the RTE with 0 viewings related by tag "rte".
  32. Thought I declare victory over RTE !!!!!!! with 0 viewings related by tag "rte".
  33. Thought Pasting Google in blogspot 's RTE box with 0 viewings related by tag "rte".
  34. Thought another rte with 0 viewings related by tag "rte".
  35. Thought another rte with 0 viewings related by tag "rte".
  36. Thought Final revisions for styles and fonts with 0 viewings related by tag "rte".
  37. Thought RTE change with 0 viewings related by tag "rte".
  38. Thought [title (1663)] with 0 viewings related by tag "rte".
  39. Thought [title (19071)] with 0 viewings related by tag "rte".
  40. Thought pointing to media files from the web from the rte box with 0 viewings related by tag "rte".
  41. Thought upload button on rte should do a user friendly fail when files are too big with 0 viewings related by tag "rte".
  42. Thought New version, Firefox 1.5 released today with 0 viewings related by tag "rte".
  43. Thought Announcement: emotlets work on rte box with 0 viewings related by tag "rte".
  44. Thought inserting hyperlinks over selected text containing apostrophe does not work in rte with 0 viewings related by tag "rte".
  45. Thought bring back the underline with 0 viewings related by tag "rte".
  46. Thought about: php html editor, rich text editor for php with 0 viewings related by tag "rte".
  47. Thought This is a tutorial on the rte software with 0 viewings related by tag "rte".
  48. Thought Google search for Fastblogit with 0 viewings related by tag "rte".
  49. Thought Is there a real time RTE box in our future ? with 0 viewings related by tag "rte".
  50. Thought about: online markdown editor - dillinger, the last markdown editor ever. with 0 viewings related by tag "rte".