Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [34618] trunk/extensions

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


skizzerz at svn

May 11, 2008, 9:29 AM

Post #1 of 1 (11 views)
Permalink
SVN: [34618] trunk/extensions

Revision: 34618
Author: skizzerz
Date: 2008-05-11 16:29:40 +0000 (Sun, 11 May 2008)

Log Message:
-----------
Adding SimpleAntiSpam extension

Added Paths:
-----------
trunk/extensions/SimpleAntiSpam/
trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.i18n.php
trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.php

Added: trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.i18n.php
===================================================================
--- trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.i18n.php (rev 0)
+++ trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.i18n.php 2008-05-11 16:29:40 UTC (rev 34618)
@@ -0,0 +1,12 @@
+<?php
+
+$messages = array();
+
+/** English
+ * @author Ryan Schmidt
+ */
+$messages['en'] = array(
+ 'simpleantispam' => 'Your edit triggered the anti-spam mechanism',
+ 'simpleantispam-label' => 'Anti-spam check. Do <strong>NOT</strong> fill this in!',
+ 'simpleantispam-desc' => 'Adds a simple spam/bot check to forms',
+ );
\ No newline at end of file


Property changes on: trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.i18n.php
___________________________________________________________________
Name: svn:eol-style
+ native

Added: trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.php
===================================================================
--- trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.php (rev 0)
+++ trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.php 2008-05-11 16:29:40 UTC (rev 34618)
@@ -0,0 +1,57 @@
+<?php
+/*
+* SimpleSpam extension by Ryan Schmidt
+* Adds a simple spam/bot check to forms
+* Does not affect real users in any way/shape/form
+*/
+
+if(!defined('MEDIAWIKI')) {
+ efSimpleAntiSpamInstall();
+ die(1);
+}
+
+$wgExtensionCredits['other'][] = array(
+'name' => 'SimpleAntiSpam',
+'description' => 'Adds a simple spam/bot check to forms',
+'descriptionmsg' => 'simpleantispam-desc',
+'author' => 'Ryan Schmidt',
+'url' => 'http://www.mediawiki.org/wiki/Extension:SimpleAntiSpam',
+'version' => '1.0',
+);
+
+$wgExtensionMessagesFiles['simpleantispam'] = dirname(__FILE__) . '/SimpleAntiSpam.i18n.php';
+$wgHooks['EditPage::showEditForm:fields'][] = 'efSimpleAntiSpamField';
+$wgHooks['EditPage::attemptSave'][] = 'efSimpleAntiSpamCheck';
+
+//add the form field
+function efSimpleAntiSpamField(&$editpage, &$out) {
+ wfLoadExtensionMessages('simpleantispam');
+ $out->addHTML("<div id=\"antispam-containter\" style=\"display: none\">\n
+<label for=\"wpAntispam\">".wfMsg('simpleantispam-label')."</label> <input type=\"text\" name=\"wpAntispam\" value=\"\" />\n
+</div>\n");
+ return true;
+}
+
+//check for the field and if it isn't empty, negate the save
+function efSimpleAntiSpamCheck($editpage) {
+ global $wgRequest;
+ if($wgRequest->getText('wpAntispam') !== '') {
+ wfLoadExtensionMessages('simpleantispam');
+ $editpage->spamPage();
+ return false;
+ }
+ return true;
+}
+
+//gives installation directions if this script is accessed directly and not via the wiki
+//don't try to localize the messages in this function, you'll just fail epicly
+function efSimpleAntiSpamInstall() {
+ $i = <<<EOM
+ This is an extension to the MediaWiki software and cannot be used standalone.
+ To install this on the wiki, add the following line to LocalSettings.php:
+ <tt>require_once("\$IP/extensions/SimpleAntiSpam/SimpleAntiSpam.php");</tt>
+ To verify the installation, browse to the Special:Version page on your wiki.
+EOM;
+ echo($i);
+ return;
+}
\ No newline at end of file


Property changes on: trunk/extensions/SimpleAntiSpam/SimpleAntiSpam.php
___________________________________________________________________
Name: svn:eol-style
+ native



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.