3 This MpiPlugin should be called from the BannedLinks or BlockedLinks
4 pages to ease injecting fresh URLs (it strips "http://" and "www."
5 prefixes, titles and thereby yields shorter matching patterns).
8 $ewiki_plugins["mpi"]["registerspam"] = "ewiki_mpi_registerspam";
10 function ewiki_mpi_registerspam($action, &$args, &$iii, &$s) {
14 if (!$_POST["regspam"]) {
16 <form action="$_SERVER[REQUEST_URI]" method="POST" enctype="multipart/form-data">
17 <textarea name="add_spam" cols="50" rows="3"></textarea><br/>
18 <input type="submit" name="regspam" value="add listed urls" />
25 $text = $_REQUEST["add_spam"];
26 ewiki_scan_wikiwords($text, $uu);
28 foreach ($uu as $href=>$uu) {
29 if ($l = strpos($href, "://")) {
30 // filter out redundant pattern parts
31 $href = substr($href, $l + 3);
32 if (strpos($href, "www.")===0) {
33 $href = substr($href, 4);
35 $href = trim($href, "/");
36 $ls[] = strtok($href, " ");
41 $ls = array_unique($ls);
42 $data = ewiki_db::GET($ewiki_id);
43 foreach (explode("\n", trim($data["refs"])) as $href) {
44 if (in_array($href, $ls)) {
45 unset($ls[array_search($href, $ls)]);
49 #-- add to current page
51 $inj = "* [" . implode("], [", $ls) . "]\n";
52 $data["content"] = preg_replace("/(^[-*#])/m", "$inj$1", $data["content"], 1);
53 ewiki_db::UPDATE($data);
55 ewiki_db::WRITE($data);
56 return "\n<div class=\"system-message ok\">new links added as patterns here (please go back and reload page to see it)</div>\n";
59 return "\n<div class=\"system-message failure\">no new links found, please add the patterns by hand then</div>\n";