sandman Posted April 22, 2007 Author Posted April 22, 2007 (edited) I'm trying to write a stringregexp to catch all html tags except the basics (b, i, u, and s) but it isn't going so well...I don't think StringRegExp() is necessary.. just do something like this: StringReplace($content, "<span>", "") Ah, but you would have to do every single tag individually.. Edit: Double post.. oops.. sorry! Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 (edited) got it! Run this on all of your posts before putting them into the database: Func _StringStripBadHtml ($s) Return StringRegExpReplace ($s, "(</?[^<>buis]>)|(</?[^/<>][^<>]+>)", "") EndFunc That will allow basic tags: <b>, <i>, <u>, and <s>, but it will delete any other html tags, including <script>. *is proud* edit: oh, and that is tested. It definitely works. Edited April 22, 2007 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 (edited) got it! Run this on all of your posts before putting them into the database: Func _StringStripBadHtml ($s) Return StringRegExpReplace ($s, "(</?[^<>buis]>)|(</?[^/<>][^<>]+>)", "") EndFunc That will allow basic tags: <b>, <i>, <u>, and <s>, but it will delete any other html tags, including <script>. *is proud* edit: oh, and that is tested. It definitely works.Oh, hehe.. scratch my last post, I didn't know StringRegExp() had that capability. Edit: I am adding it into the mod for v0.2 Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 Oh, hehe.. scratch my last post, I didn't know StringRegExp() had that capability.Edit: I am adding it into the mod for v0.2 yeah, regular expressions are pretty powerful if you know what you're doing. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 (edited) Okay, v0.2 is up for grabs. Check the first post for download. Senton-Bomb.. do you think you could set up the host again now that its secure? Edit: Whoa, I think all my posts on this topic have been edited at least twice.. Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 StringReplace(StringReplace(StringReplace($s, @CRLF, @CR), @LF, @CR), @CR, "<br />") The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 That's added into v0.2 also. thanks! [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 example site: http://blog.theguy0000.com The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 (edited) example site: http://blog.theguy0000.comYou need to add default.css into your website root Another edit : Also, I forgot to change one variable.. the line break thingy won't work. I will edit this again when I have posted the fixed version. Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 fixed admin.auw: ;admin.auw ;HTML coding and AU3 Coding by sandman (may_contain_peanuts2@yahoo.com) ;CSS skin by www.freecsstemplates.com #include "web.au3" #include <File.au3> _StartWebApp("BlogIt Administration") Global $content = "<link rel='stylesheet' href='..\default.css'><div id='logo'><h1><a href='#'>blogit</a></h1><h2><a href='#'>administration panel</a></h2></div><div id='menu'><ul><li class='active'><a href='index.auw' title=''>Homepage</a></li><li><a href='#' title=''>Archive</a></li></ul></div><div id='wrapper'> <div id='col-two'><div class='boxed'><h2 class='title'>add an entry</h2><div class='content'><form method='get' width=100%><textarea rows='10' cols='70%' name='content'></textarea><div id='smallfont'>HTML code is allowed, except any CSS references, DIV, SPAN, or P tags.</div><p align='right'><input type='reset' value='Clear Form' name='B2'><input type='submit' value='Submit Post'></p></form>" If _Get("content") = "" Then Echo($content) Else $content &= "<center><img src='loading.gif' width='32' height='32'><br>Please wait.. posting entry." Echo($content) $newentry = _Get("content") $entry = StringReplace($newentry, "+", " ") $headerthingy = "<div class='boxed'><h2 class='title'>Post</h2><div class='content'>" ;add to the post header $headerPG = FileOpen("html/postheader.html", 01) $footerPG = FileRead("html/postfooter.html", 01) $entryy = StringRegExpReplace ($entry, "(</?[^<>buis]>)|(</?[^/<>][^<>]+>)", "") $entryyy = StringReplace(StringReplace(StringReplace($entryy, @CRLF, @CR), @LF, @CR), @CR, "<br />") ;automatically change line breaks to <br /> FileWriteLine($headerPG, @CRLF & $headerthingy & $entryyy & $footerPG & "</div></div>") If @Error Then _MsgBox(@error) ;create the archive file _FileCreate("entries\" & @YEAR & "." & @MON & "." & @YDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & ".txt") FileWrite("entries\" & @YEAR & "." & @MON & "." & @YDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & ".txt", $entryy) Sleep(2000) $content = "<br>Entry posted! <a href='index.auw'>View Your Blog</a>" Echo($content) EndIf The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 Thanks, I fixed that.. but in your code you also need to change the archive file to write from $entryyy, not $entryy. Anyway, new bugfixed version is up.. please get the new one. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
sandman Posted April 22, 2007 Author Posted April 22, 2007 (edited) New bug found: Along with the new allowing of <a> tags, now every post is linked. Theguy0000 is fixing it right now.. Oh, man.. that makes me feel unimportant. Well, it'll be fixed soon. Edit: Oops.. double post again :"> Anyway, that wasn't a real bug, just an unclosed <a> tag. Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 22, 2007 Posted April 22, 2007 New bug found: Along with the new allowing of <a> tags, now every post is linked. Theguy0000 is fixing it right now..Oh, man.. that makes me feel unimportant. Well, it'll be fixed soon.it's not a problem with the code. It is not a bug. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
jvanegmond Posted April 22, 2007 Posted April 22, 2007 (edited) I'm trying to write a stringregexp to catch all html tags except the basics (b, i, u, and s) but it isn't going so well...Me and RazerM wrote this for Cobra.. Back in the days.. edit: code was corrupted due to forum update. Edited February 10, 2012 by Manadar github.com/jvanegmond
theguy0000 Posted April 22, 2007 Posted April 22, 2007 you do know that I already got it working, right? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 22, 2007 Author Posted April 22, 2007 Yeah, we did it in a way that's a little bit simpler $entry = StringRegExpReplace($newentry, '(</?[^<>buis]>)|(</?[^/<>a][^<>]+>)', "") [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
jvanegmond Posted April 22, 2007 Posted April 22, 2007 (edited) What RazerM and me did is totally different, it's much more a simulation of BB code then stripping not allowed HTML tags. The function I posted also allows for colors and gradients in text and smilies, which is a lot more functionality then what you build and that is why it are so many more lines.. We have different goals in mind, but I figured you may as well want it. @Sandman, . Edited April 22, 2007 by Manadar github.com/jvanegmond
sandman Posted April 23, 2007 Author Posted April 23, 2007 Archiving is now optional in 0.21.. check the new download on my first post. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
theguy0000 Posted April 24, 2007 Posted April 24, 2007 updated to 0.21, now the css doesnt work on anything. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
sandman Posted April 24, 2007 Author Posted April 24, 2007 (edited) 0.21 had very minimal changes.. it still should work fine. Edit: Oh, wait.. I may have changed one of the header files by accident. I updated the ZIP download on my first post, if that's not the problem, tell me right away Edited April 24, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now