2 //@FIX: make it an revoverably error, include captcha to allow
3 // proceeding the save - else this becomes too cumbersome
5 This is an anti-spam plugin, which simply disallows adding more than
6 a given number of external links to pages. It will hurt you, if you
7 use your Wiki for creation of a link directory, otherwise it is a
8 good way to fight bored link spammers (because it makes you a less
9 interesting target if they cannot add hundreds of links at once
11 Raise or lower the allowed number as you see fit (but 15 or 20 is
15 define("EWIKI_LIMIT_LINKS", 5);
16 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_limit_adding_external_links";
18 $ewiki_t["en"]["LINK_ADDING_LIMITED"] = "Sorry, but adding links to this page is restricted to a certain amount. You reached it, and therefore page saving was cancelled.<br><br>If you're a bored link spammer, this is message is for you:<br>*hehe*, *laugh*<br>Happy Death!";
21 function ewiki_edit_save_limit_adding_external_links(&$save, &$old) {
25 preg_match_all('°(http://[^\s*<>"\'\[\]\#]+)°', $old["content"], $old_urls);
26 preg_match_all('°(http://[^\s*<>"\'\[\]\#]+)°', $save["content"], $save_urls);
27 $added_urls = array_diff($save_urls[1], $old_urls[1]);
30 if (count($added_urls) > EWIKI_LIMIT_LINKS) {
32 #-- abort saving with an error message
34 $ewiki_errmsg = ewiki_t("LINK_ADDING_LIMITED");