Re: stripBadHTML bug - well kinda

"Luis M" <[email protected]> Mon, 21 Jul 2003 11:49:27 -0400
Newsgroups gmane.comp.cms.phpslash.devel
Message-ID <[email protected]>
[snip]

>    $str = eregi_replace("<a([^>]*)href=\"?([^\"]*)\"?([^>]*)>",
>                          "<a href=\\2>", $str);
>

[snip]

>    $str = eregi_replace("<a([^>]*)href=\"?([^\"]*)[\"|>]?([^>]*)>",
>                          "<a href=\\2>", $str);
>
>But I haven't gotten it to work just right...

maybe:
$str = eregi_replace("<a([^>]*)href=\"?([^\"]*)\"*([^>]*)>",
                           "<a href=\\2>", $str);
To match 0 or more times the double quote. Note that this regex would fail 
misserably if people use single quotes also:
< a href = ' this is valid html ' >
< a href = ' this is not valid >

In fact, the regex is not even checking for it...

>
>I know this isn't something that many folks are likely to do, but for
>this type of interface it's good to correct simple typos if you can..
>

Better yet is to move away from this system and do a simplify interface for 
composing messages/stories, etc... I heard a lot of noise about this some 
time ago here in the -devel list. I hope somebody is working on it.
In fact, since phpslash project is GPL'ed and other GPL'ed projects already 
have this functionality, maybe we should just copy and paste this code from 
them. phpBB is the best I have seen so far. Allowing users to do simle 
things as:
[link=this is a URL] text to be linked[/link]
or just [link=http:server] which also becomes a link showing the URL as the 
text to be clicked.
And a lot of nice mnemonics like "[b]" for "bold", "[i]" for "italics" and 
so on, which may or may not match their HTML counter parts < B > and < I > 
respectively. It's very awkward for people relatively new to the web and 
HTML to know how to use HTML tags properly.

In addition, while we are at it, I know php coders don't like to use 
client-side scripting languages, but, as an alternative, a 
javascript/orwhateverotherstandardscript, template could be provided to 
replace the standard non-javascript ones found in the "basic" and "default" 
directories. Something that gives users a way of clicking on a button that 
adds the tags mentioned about for them: B I Link and others.
We should learn from phpBB and similar projects about the ease of use they 
provide to new users and the simplicity for instalation (phpBB installs with 
one click after knowing the username, password and database to use). Just 
ideas for the next realeas ;-) Joe?


----)(-----
Luis Mondesi
System Administrator
LatinoMixed.com

[email protected]

"...The Mac does this so smoothly, it feels like an extension of your mind." 
- Paula Speer, MacWorld Magazine 2003-04

Public signature: http://www.latinomixed.com/lems1/public-a.asc

_________________________________________________________________
MSN Messenger : discutez en direct avec vos amis ! 
http://www.msn.fr/msger/default.asp



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0