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
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("'","'",$text);
- Hopefully this will not get us into problems later.
Time for another shakedown
Tags
- 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
- Thought Now have ability to style individual thoughts with CSS style sheets with 66 viewings related by tag "rte".
- Thought Invisible characters found in editor output. with 8 viewings related by tag "rte".
- Thought Fixing the "unfixable" bugs in CKEditor with 8 viewings related by tag "rte".
- Thought Test of the Opera Browser with 6 viewings related by tag "rte".
- Thought RTE Matrix with 6 viewings related by tag "rte".
- Thought is tag navigation working better now ? with 6 viewings related by tag "rte".
- Thought JavaScript based HTML editor with 6 viewings related by tag "rte".
- Thought icons with 5 viewings related by tag "rte".
- Thought Checking out the word Watch with 4 viewings related by tag "rte".
- Thought How can i deactivate paste in a rich text edit box ? with 3 viewings related by tag "rte".
- Thought about: Writely - The Web Word Processor with 3 viewings related by tag "rte".
- Thought Advanced RTE doesn't seem to have sound with 2 viewings related by tag "rte".
- Thought the rte box should be exactly as wide as the item display with 2 viewings related by tag "rte".
- Thought rte symbols used on gmail with 1 viewings related by tag "rte".
- Thought a spammers dream with 1 viewings related by tag "rte".
- Thought about: Micro Persuasion: Blog Directly from Firefox with 0 viewings related by tag "rte".
- Thought How come Winnies does not have one of these? with 0 viewings related by tag "rte".
- Thought RTE nastiness with 0 viewings related by tag "rte".
- Thought rte for item needs convenient exit for consistency with 0 viewings related by tag "rte".
- Thought Ok ... so we can do rich text editing ... with 0 viewings related by tag "rte".
- Thought this is what we are trying to prtect the rte box against with 0 viewings related by tag "rte".
- Thought test with 0 viewings related by tag "rte".
- Thought Does Color Work ? with 0 viewings related by tag "rte".
- Thought bad url removes RTE contents with 0 viewings related by tag "rte".
- Thought Test image with 0 viewings related by tag "rte".
- Thought Square brackets and rte with 0 viewings related by tag "rte".
- Thought we have two variations of permalink uri floating around with 0 viewings related by tag "rte".
- Thought rte (rich text editor) package deployed by fastblogit.com with 0 viewings related by tag "rte".
- Thought test with 0 viewings related by tag "rte".
- Thought Test - I lost bold comments on a specific [item 1460] with 0 viewings related by tag "rte".
- Thought right mouse click menu should have a paste option for the RTE with 0 viewings related by tag "rte".
- Thought I declare victory over RTE !!!!!!! with 0 viewings related by tag "rte".
- Thought Pasting Google in blogspot 's RTE box with 0 viewings related by tag "rte".
- Thought another rte with 0 viewings related by tag "rte".
- Thought another rte with 0 viewings related by tag "rte".
- Thought Final revisions for styles and fonts with 0 viewings related by tag "rte".
- Thought RTE change with 0 viewings related by tag "rte".
- Thought [title (1663)] with 0 viewings related by tag "rte".
- Thought [title (19071)] with 0 viewings related by tag "rte".
- Thought pointing to media files from the web from the rte box with 0 viewings related by tag "rte".
- Thought upload button on rte should do a user friendly fail when files are too big with 0 viewings related by tag "rte".
- Thought New version, Firefox 1.5 released today with 0 viewings related by tag "rte".
- Thought Announcement: emotlets work on rte box with 0 viewings related by tag "rte".
- Thought inserting hyperlinks over selected text containing apostrophe does not work in rte with 0 viewings related by tag "rte".
- Thought bring back the underline with 0 viewings related by tag "rte".
- Thought about: php html editor, rich text editor for php with 0 viewings related by tag "rte".
- Thought This is a tutorial on the rte software with 0 viewings related by tag "rte".
- Thought Google search for Fastblogit with 0 viewings related by tag "rte".
- Thought Is there a real time RTE box in our future ? with 0 viewings related by tag "rte".
- Thought about: online markdown editor - dillinger, the last markdown editor ever. with 0 viewings related by tag "rte".