[Privoxy-users] some help please writing a filter for a phpbb forum
René J.V. Bertin
rjvbertin at gmail.com
Tue Dec 6 21:30:45 CET 2022
Hi,
I'm active on a forum run by an admin who prefers to let members deal with broken/disabled features rather than setting up the software properly.
I've been trying to use a privoxy filter to suppress a few buttons of the posting editor which insert unsupported BBCodes. I know what html code to remove and have confirmed that it has the required effect:
>From the line
```
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[flash=]', '[/flash]','[size=]','[/size]', '[font]', '[/font]', '[anchor]', '[/anchor]', '[goto]', '[/goto]');
```
the string ", '[anchor]', '[/anchor]', '[goto]', '[/goto]'" should be removed (for good measure)
And the following 2 button definitions from `<div id="format-buttons" class="format-buttons">` should also be removed:
```
<button type="button" class="button button-secondary bbcode-anchor" name="addbbcode24" value="anchor" onclick="bbstyle(24)" title="Anchor: [anchor]Name of the anchor[/anchor]">
anchor
</button>
<button type="button" class="button button-secondary bbcode-goto" name="addbbcode26" value="goto" onclick="bbstyle(26)" title="Goto: [goto=Anchor Name]Link tekst[/goto]">
goto
</button>
```
I'm not exactly familiar with perl, but I had hoped that the following filter definition would do it (as you can see I experimented with a different approach for the 2 buttons:
```
FILTER: delcamp-forbidden-bbcodes Try to hide buttons for forbidden bbcodes on the delcamp cg forum
s|, '\[anchor\]', '\[/anchor\]', '\[goto\]', '\[/goto\]'||Uig
s|<button type="button" class="button button-secondary bbcode-anchor".*\n\
.*anchor.*\n\
.*</button>||ig
s|<button type="button" class="button button-secondary bbcode-goto".*</button>||im
```
My user.action file has
```
{ +filter{delcamp-forbidden-bbcodes} }
.classicalguitardelcamp.com
```
somewhere near the end, just above the `fragile` section. I can see that the rule is applied to the forum URLs but I see no trace of it being invoked if I activate debug 64 as suggested.
Ergo, I must be doing something wrong, or have missed something. Are these the "external filters" mentioned in the description of the `temporary-directory` feature, for instance?
Thanks in advance,
Cheers,
R.B.
More information about the Privoxy-users
mailing list