Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#271866 - 10/12/2005 21:22 Spoiler/ROT13 code
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
I really like the way Bitt's ROT13 spoiler works, so I am going to implement it on the board. One piece I need though is PHP 4 code to do the following:

Take the string $Body, and ROT13 text between [rot13] this text [/rot13].

I'm horrible with string manipulation code, so I'm hoping someone here well versed in PHP can make the one line needed to do this.

Top
#271867 - 10/12/2005 21:46 Re: Spoiler/ROT13 code [Re: drakino]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Could be done in one line, but for clarity, three:

preg_match("!\[rot13\]([^[]+)\[/rot13\]!i", $body, $match);
$text = $match[1];
$rot13 = str_rot13($text);
_________________________
- Tony C
my empeg stuff

Top
#271868 - 10/12/2005 23:09 Re: Spoiler/ROT13 code [Re: tonyc]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Another test of the [spoiler] [/spoiler] tags

Spoiler:
Jbbg! Tbg Vg

There is one limitation though, only one spoiler per post.


Edited by drakino (10/12/2005 23:44)

Top
#271869 - 10/12/2005 23:46 Re: Spoiler/ROT13 code [Re: drakino]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
And a test to see what happens with multiple spoilers in the same thread.

Spoiler:
Grfgvat, 1 gjb guerr

Top
#271870 - 11/12/2005 02:50 Re: Spoiler/ROT13 code [Re: drakino]
jimhogan
carpal tunnel

Registered: 06/10/1999
Posts: 2591
Loc: Seattle, WA, U.S.A.
Quote:
And a test to see what happens with multiple spoilers in the same thread.

Spoiler:
I gotta say, that's pretty fuc&yg;b&tg;&yg;/b&tg;king cool!
_________________________
Jim


'Tis the exceptional fellow who lies awake at night thinking of his successes.

Top
#271871 - 11/12/2005 03:44 Re: Spoiler/ROT13 code [Re: jimhogan]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Ok, looks like it might need a bit of work, no idea why it is going bezerk there...

FYI, the board censor should be off.

Top
#271872 - 11/12/2005 04:31 Re: Spoiler/ROT13 code [Re: drakino]
jimhogan
carpal tunnel

Registered: 06/10/1999
Posts: 2591
Loc: Seattle, WA, U.S.A.
Quote:
FYI, the board censor should be off.

Pissah!
_________________________
Jim


'Tis the exceptional fellow who lies awake at night thinking of his successes.

Top
#271873 - 11/12/2005 05:31 Re: Spoiler/ROT13 code [Re: drakino]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Spoiler:
Fhcre pbby!
_________________________
Bitt Faulk

Top
#271874 - 11/12/2005 05:38 Re: Spoiler/ROT13 code [Re: drakino]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
It looks like it's also rot13'ing the the HTML codes in some weird way.

It looks like Jim was trying to do the "exple[i][/i]tive" trick, which at some point the board turned into "exple<i></i>tive", which for some reason got turned into "exple&gt;i&lt;&gt;/i&lt;tive", which the new code turned into the crud that appears there. I don't know why it multiplies itself, though.

If I understood what was changing it into the "&gt;"-style character entities, I might have a better idea how to avoid it. Maybe it's holding it that way in the database where they get changed back to "<"s when written out. The obvious thing to do would be to avoid changing HTML character entities, but I don't see a really efficient way to do that at the moment. You can't do it with your matching code very easily, and you can't do it with the javascript very easily, not that I think that's the place where it matters anyway.

I think you'll somehow have to match all the stuff inside the spoiler tags that isn't an HTML character entity, but you'll have to do that in a loop, and, it would seem, some sort of recursive addressible regex. I'll leave that up to someone more familiar with PHP.

That colored-text thing is looking more attractive all the time, huh?


Edited by wfaulk (11/12/2005 05:47)
_________________________
Bitt Faulk

Top
#271875 - 11/12/2005 05:42 Re: Spoiler/ROT13 code [Re: wfaulk]
jimhogan
carpal tunnel

Registered: 06/10/1999
Posts: 2591
Loc: Seattle, WA, U.S.A.
Quote:
It looks like Jim was trying to do the "expletive" trick,

Spoiler:
Url. jung gur shpx vf vg gb lbh, ru?'
_________________________
Jim


'Tis the exceptional fellow who lies awake at night thinking of his successes.

Top
#271876 - 11/12/2005 05:47 Re: Spoiler/ROT13 code [Re: jimhogan]
lectric
pooh-bah

Registered: 20/01/2002
Posts: 2085
Loc: New Orleans, LA
Spoiler:
Ebpxa, I wish more boards would use this.

Top
#271877 - 11/12/2005 06:04 Re: Spoiler/ROT13 code [Re: wfaulk]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
It probably has to do with where I put the spoiler code in the file. It goes through and searches for the UBB code to then replace with HTML, one item at a time. Bumping it up higher should fix it. I'll tinker with it more tomorrow.

To ensure it gets displayed properly every time, the ROT13 code is what is actually being stored in the database. For some reason with your javascript only code, it was decoding it initially from time to time if multiple ones were on the page.

As far as the color thing, that would make us like so many other boards. Kinda cool to have something unique here for the obscuring code.

Top
#271878 - 11/12/2005 12:47 Re: Spoiler/ROT13 code [Re: drakino]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Now don't y'all go overboard with this, kids.. it may also impact the ability of our already feeble search engine to locate such info with a Search later!

Cool, though!


Edited by mlord (12/12/2005 02:53)

Top
#271879 - 11/12/2005 14:45 Re: Spoiler/ROT13 code [Re: mlord]
lectric
pooh-bah

Registered: 20/01/2002
Posts: 2085
Loc: New Orleans, LA
Hmm... will it? The post is still in plain text, but the browser is just interpreting it differently.

test: Spoiler:
ebg13frnepu


Edited by lectric (11/12/2005 14:46)

Top
#271880 - 11/12/2005 14:47 Re: Spoiler/ROT13 code [Re: lectric]
lectric
pooh-bah

Registered: 20/01/2002
Posts: 2085
Loc: New Orleans, LA
Ooh, you're right.....

Top
#271881 - 12/12/2005 19:44 Re: Spoiler/ROT13 code [Re: mlord]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Didn't even think of the search aspect. Though I do have to agree, this does need to be used on a limited basis.

I may go in later and try to find a way to encrypt it during the HTML generation, and not the database phase where it is now.

As far as the search in general, I'll be trying to expand the Google search I just added. They have a site map thing that I need to make to try and ensure their results are up to date. They already spider the site quite frequently.

Top
#271882 - 12/12/2005 21:50 Re: Spoiler/ROT13 code [Re: drakino]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Quote:
I'll be trying to expand the Google search I just added.


Woohoo! Maybe I'll be able to find stuff now! I never did get along with the regular BBS search engine -- It and I think differently.

Cheers

Top
#271883 - 12/12/2005 21:57 Re: Spoiler/ROT13 code [Re: mlord]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
What can you do with Google that you can't do with the builtin search? The builtin one allows AND, OR, and NOT searches on words and phrases (though not complex combinations of them, not that Google allows that, either, AFAIK). It can, in combination, restrict to poster, time, and forum. Seems to me that it's more powerful than Google.
_________________________
Bitt Faulk

Top
#271884 - 13/12/2005 01:21 Re: Spoiler/ROT13 code [Re: jimhogan]
gbeer
carpal tunnel

Registered: 17/12/2000
Posts: 2665
Loc: Manteca, California
Quote:
Quote:
It looks like Jim was trying to do the "expletive" trick,

<font class="small">Spoiler:<br/></font><span onMouseOver="javascript:rot13(this)" onMouseOut="javascript:rot13(this)">Url. jung gur shpx vf vg gb lbh, ru?'</span>


Quoting breaks it?
_________________________
Glenn

Top
#271885 - 13/12/2005 06:41 Re: Spoiler/ROT13 code [Re: gbeer]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Spoiler:
Dhbgvat fcbvyref fubhyqa'g or oebxra nsgre guvf. Gur byq barf jvyy erznva hadhbgnoyr, ohg arj barf fubhyq or

As far as the PRE tag, it causes more problems then it solves, as a long spoiler won't be word wrapped properly, and manually word wrapping caused even weirder issues. For now, just hover over the beginning of a spoiler.

Top
#271886 - 13/12/2005 06:41 Re: Spoiler/ROT13 code [Re: drakino]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Quote:
Spoiler:
Dhbgvat fcbvyref fubhyqa'g or oebxra nsgre guvf. Gur byq barf jvyy erznva hadhbgnoyr, ohg arj barf fubhyq or


Top
#271887 - 14/12/2005 03:15 Re: Spoiler/ROT13 code [Re: drakino]
gbeer
carpal tunnel

Registered: 17/12/2000
Posts: 2665
Loc: Manteca, California
Spoiler:
Zr purpxvat gb frr ubj vg jbexf.

a-ok, works fine for one without much privlege.
_________________________
Glenn

Top
#271888 - 04/04/2007 13:37 Re: Spoiler/ROT13 code [Re: drakino]
Geoff
enthusiast

Registered: 21/08/1999
Posts: 381
Loc: Northern Ireland
Quote:
As far as the PRE tag, it causes more problems then it solves, as a long spoiler won't be word wrapped properly, and manually word wrapping caused even weirder issues. For now, just hover over the beginning of a spoiler.


Guess what's managed to capture my interest today? (it's been one of those days!)

Would it be reasonably straightforward to have the spoiler use a monospaced font by adding a class attribute to the spoiler's <span> tag and then modify the style sheet to set the font-family for that class.

Something like:
Code:
<span class="spoiler" onmouseover=...>


in the HTML and then
Code:
.spoiler { font-family: monospace, courier; }


in the CSS?
_________________________
Geoff
---- -------
Mk1 Blue - was 4GB, now 16GB
Mk2 Red - was 12GB, now 60GB

Top