Index: trunk/extensions/ConfirmEdit/Asirra.i18n.php |
— | — | @@ -1,158 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for the Asirra module of the ConfirmEdit |
5 | | - * extension. |
6 | | - * |
7 | | - * @file |
8 | | - * @ingroup Extensions |
9 | | - */ |
10 | | - |
11 | | -$messages = array(); |
12 | | - |
13 | | -/* English */ |
14 | | -$messages['en'] = array( |
15 | | - 'asirra-desc' => 'Asirra module for ConfirmEdit', |
16 | | - 'asirra-edit' => 'To help protect against automated edit spam, please select just the cat photos in the box below:', |
17 | | - 'asirra-addurl' => 'Your edit includes new external links. To help protect against automated spam, please select just the cat photos in the box below:', |
18 | | - 'asirra-badpass' => 'To help protect against automated password cracking, please select just the cat photos in the box below:', |
19 | | - 'asirra-createaccount' => 'To help protect against automated account creation, please select just the cat photos in the box below:', |
20 | | - 'asirra-createaccount-fail' => "Please correctly identify the cats.", |
21 | | - 'asirra-create' => 'To help protect against automated page creation, please select just the cat photos in the box below:', |
22 | | - 'asirra-nojs' => '\'\'\'Please enable JavaScript and resubmit the page.\'\'\'' |
23 | | -); |
24 | | - |
25 | | -/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
26 | | - * @author EugeneZelenko |
27 | | - * @author Jim-by |
28 | | - */ |
29 | | -$messages['be-tarask'] = array( |
30 | | - 'asirra-desc' => 'Модуль Asirra для ConfirmEdit', |
31 | | - 'asirra-edit' => 'Для абароны супраць спаму, калі ласка, выберыце толькі фота з катом ў полі ніжэй:', |
32 | | - 'asirra-addurl' => 'Вашае рэдагаваньне ўтрымлівае новыя вонкавыя спасылкі. Для абароны супраць спаму, калі ласка, выберыце толькі фота з катом ў полі ніжэй:', |
33 | | - 'asirra-badpass' => 'Для абароны супраць аўтаматычнага падбору паролю, калі ласка, выберыце толькі фота з катом ў полі ніжэй:', |
34 | | - 'asirra-createaccount' => 'Для абароны супраць аўтаматычнага стварэньня рахункаў, калі ласка, выберыце толькі фота з катом ў полі ніжэй:', |
35 | | - 'asirra-createaccount-fail' => 'Калі ласка, слушна выберыце катоў.', |
36 | | - 'asirra-create' => 'Для абароны супраць аўтаматычнага стварэньня старонак, калі ласка, выберыце толькі фота з катом ў полі ніжэй:', |
37 | | - 'asirra-nojs' => "'''Калі ласка, дазвольце JavaScript і дашліце старонку зноў.'''", |
38 | | -); |
39 | | - |
40 | | -/** German (Deutsch) */ |
41 | | -$messages['de'] = array( |
42 | | - 'asirra-desc' => 'Asirra-Modul für ConfirmEdit', |
43 | | - 'asirra-edit' => 'Zum Schutz vor automatisiertem Spam, wähle bitte nur die Katzen im untenstehenden Feld aus:', |
44 | | - 'asirra-addurl' => 'Deine Bearbeitung enthält neue externe Links. Zum Schutz vor automatisiertem Spam wähle bitte nur die Katzen im untenstehenden Feld aus:', |
45 | | - 'asirra-badpass' => 'Zum Schutz gegen automatisiertes Knacken von Passwörtern, wähle bitte nur die Katzen im untenstehenden Feld aus:', |
46 | | - 'asirra-createaccount' => 'Zum Schutz gegen automatisierte Erstellung von Benutzerkonten wähle bitte nur die Katzen im untenstehenden Feld aus:', |
47 | | - 'asirra-createaccount-fail' => 'Bitte wähle nur Katzen aus.', |
48 | | - 'asirra-create' => 'Zum Schutz gegen automatisierte Erstellung von Seiten, wähle bitte nur die Katzen im untenstehenden Feld aus:', |
49 | | - 'asirra-nojs' => "'''Bitte aktiviere JavaScript und sende die Seite noch einmal ab.'''", |
50 | | -); |
51 | | - |
52 | | -/** French (Français) |
53 | | - * @author Seb35 |
54 | | - */ |
55 | | -$messages['fr'] = array( |
56 | | - 'asirra-desc' => 'Module Asirra pour ConfirmEdit', |
57 | | - 'asirra-edit' => 'Pour aider à nous protéger contre le spam d’édition automatique, veuillez sélectionner uniquement les photos de chats dans la boîte ci-dessous :', |
58 | | - 'asirra-addurl' => 'Votre édition contient des liens externes. Pour nous aider à nous protéger contre le spam automatique, veuillez sélectionner uniquement les photos de chats dans la boîte ci-dessous :', |
59 | | - 'asirra-badpass' => 'Pour nous aider à nous protéger des essais automatiques de cassage de mot de passe, veuillez sélectionner uniquement les photos de chats dans la boîte ci-dessous :', |
60 | | - 'asirra-createaccount' => 'Pour nous aider à nous protéger contre la création automatique de comptes, veuillez sélectionner uniquement les photos de chats dans la boîte ci-dessous :', |
61 | | - 'asirra-createaccount-fail' => 'Veuillez identifier correctement les chats.', |
62 | | - 'asirra-create' => 'Pour nous aider à nous protéger contre la création automatique de pages, veuillez sélectionner uniquement les photos de chats dans la boîte ci-dessous :', |
63 | | - 'asirra-nojs' => "'''Veuillez activer le JavaScript et re-soumettre la page.'''", |
64 | | -); |
65 | | - |
66 | | -/** Galician (Galego) |
67 | | - * @author Toliño |
68 | | - */ |
69 | | -$messages['gl'] = array( |
70 | | - 'asirra-desc' => 'Módulo Asirra para ConfirmEdit', |
71 | | - 'asirra-edit' => 'Para axudarnos á protección contra o spam, seleccione só as fotos de gatos na caixa:', |
72 | | - 'asirra-addurl' => 'A súa edición inclúe novas ligazóns externas. Para axudar na protección contra o spam automático, seleccione só as fotos de gatos na caixa:', |
73 | | - 'asirra-badpass' => 'Para axudarnos á protección contra o roubo de contrasinais, seleccione só as fotos de gatos na caixa:', |
74 | | - 'asirra-createaccount' => 'Para axudarnos á protección contra a creación automática de contas, seleccione só as fotos de gatos na caixa:', |
75 | | - 'asirra-createaccount-fail' => 'Identifique correctamente os gatos.', |
76 | | - 'asirra-create' => 'Para axudarnos á protección contra a creación automática de páxinas, seleccione só as fotos de gatos na caixa:', |
77 | | - 'asirra-nojs' => "'''Active o JavaScript e volva enviar a páxina.'''", |
78 | | -); |
79 | | - |
80 | | -/** Interlingua (Interlingua) |
81 | | - * @author McDutchie |
82 | | - */ |
83 | | -$messages['ia'] = array( |
84 | | - 'asirra-desc' => 'Modulo de Asirra pro ConfirmEdit', |
85 | | - 'asirra-edit' => 'Pro adjutar a proteger nos contra le spam automatisate, per favor selige solmente le photos de cattos in le quadro sequente:', |
86 | | - 'asirra-addurl' => 'Iste modification include nove ligamines externe. Pro adjutar a proteger nos contra le spam automatisate, per favor selige solmente le photos de cattos in le quadro sequente:', |
87 | | - 'asirra-badpass' => 'Pro adjutar a proteger nos contra le furto automatisate de contrasignos, per favor selige solmente le photos de catto in le quadro sequente:', |
88 | | - 'asirra-createaccount' => 'Pro adjutar a proteger nos contra le creation automatisate de contos, per favor selige solmente le photos de cattos in le quadro sequente:', |
89 | | - 'asirra-createaccount-fail' => 'Per favor identifica correctemente le cattos.', |
90 | | - 'asirra-create' => 'Pro adjutar a proteger nos contra le creation automatisate de paginas, per favor selige solmente le photos de cattos in le quadro sequente:', |
91 | | - 'asirra-nojs' => "'''Per favor activa JavaScript e resubmitte le pagina.'''", |
92 | | -); |
93 | | - |
94 | | -/** Luxembourgish (Lëtzebuergesch) |
95 | | - * @author Robby |
96 | | - */ |
97 | | -$messages['lb'] = array( |
98 | | - 'asirra-desc' => 'Asirra-Modul fir ConfirmEdit', |
99 | | - 'asirra-createaccount-fail' => "Identifizéiert d'Kaze w.e.g. richteg.", |
100 | | - 'asirra-nojs' => "'''Aktivéiert w.e.g. JavaScript a schéckt d'Säit nachemol.'''", |
101 | | -); |
102 | | - |
103 | | -/** Macedonian (Македонски) |
104 | | - * @author Bjankuloski06 |
105 | | - */ |
106 | | -$messages['mk'] = array( |
107 | | - 'asirra-desc' => 'Asirra-модул за ПотврдиУредување', |
108 | | - 'asirra-edit' => 'Како заштитна мерка против автоматизиран спам, изберете ги само сликите со мачка прикажани во полето:', |
109 | | - 'asirra-addurl' => 'Во вашите измени има нови надворешни врски. Како заштитна мерка против автоматизиран спам, изберете ги само сликите со мачка прикажани во полето:', |
110 | | - 'asirra-badpass' => 'Како заштитна мерка против автоматизирано провалување на лозинки, изберете ги само сликите со мачка прикажани во полето:', |
111 | | - 'asirra-createaccount' => 'Како заштитна мерка против автоматизирано создавање на сметки, изберете ги само сликите со мачка прикажани во полето:', |
112 | | - 'asirra-createaccount-fail' => 'Посочете кои од следниве се мачки.', |
113 | | - 'asirra-create' => 'Како заштитна мерка против автоматизирано создавање на страници, изберете ги само сликите со мачка прикажани во полето:', |
114 | | - 'asirra-nojs' => "'''Овозможете JavaScript и поднесете ја страницата повторно.'''", |
115 | | -); |
116 | | - |
117 | | -/** Dutch (Nederlands) |
118 | | - * @author SPQRobin |
119 | | - * @author Siebrand |
120 | | - */ |
121 | | -$messages['nl'] = array( |
122 | | - 'asirra-desc' => 'Asirra-module voor ConfirmEdit', |
123 | | - 'asirra-edit' => 'Kies ter bescherming tegen geautomatiseerde spam de afbeeldingen met een poes in het onderstaande venster:', |
124 | | - 'asirra-addurl' => "Uw bewerking bevat nieuwe externe verwijzingen. Om te helpen beschermen tegen geautomatiseerde spam, selecteer de foto's van katten in het vak hieronder:", |
125 | | - 'asirra-badpass' => 'Kies ter bescherming tegen het automatisch kraken van wachtwoorden de afbeeldingen met een poes in het onderstaande venster:', |
126 | | - 'asirra-createaccount' => 'Kies om het automatisch aanmaken van gebruikers tegen te gaan de afbeeldingen met een poes in het onderstaande venster:', |
127 | | - 'asirra-createaccount-fail' => 'Identificeer de katten juist.', |
128 | | - 'asirra-create' => "Kies om het automatisch aanmaken van pagina's tegen te gaan de afbeeldingen met een poes in het onderstaande venster:", |
129 | | - 'asirra-nojs' => "'''Schakel JavaScript in en probeer de pagina opnieuw op te slaan.'''", |
130 | | -); |
131 | | - |
132 | | -/** Norwegian (bokmål) (Norsk (bokmål)) |
133 | | - * @author Event |
134 | | - */ |
135 | | -$messages['no'] = array( |
136 | | - 'asirra-desc' => 'Assirra-modulen for ConfirmEdit', |
137 | | - 'asirra-edit' => 'Som beskyttelse mot automatisk redigert spam, vennligst velg kun kattebildene i boksen under:', |
138 | | - 'asirra-addurl' => 'Din redigering inneholder nye eksterne lenker. Som beskyttelse mot automatisk redigert spam, vennligst velg kun kattebildene i boksen under:', |
139 | | - 'asirra-badpass' => 'Som beskyttelse mot automatisk passordknekking, vennligst velg kun kattebildene i boksen under:', |
140 | | - 'asirra-createaccount' => 'Som beskyttelse mot automatisk opprettelse av brukerkonto, vennligst velg kun kattebildene i boksen under:', |
141 | | - 'asirra-createaccount-fail' => 'Vennligst angi hva som er katter.', |
142 | | - 'asirra-create' => 'Som beskyttelse mot automatisk opprettelse av sider, vennligst velg kun kattebildene i boksen under:', |
143 | | - 'asirra-nojs' => "'''Vennligst åpne for JavaScript og lagre siden en gang til.'''", |
144 | | -); |
145 | | - |
146 | | -/** Portuguese (Português) |
147 | | - * @author Hamilton Abreu |
148 | | - */ |
149 | | -$messages['pt'] = array( |
150 | | - 'asirra-desc' => 'Módulo Asirra para o ConfirmEdit', |
151 | | - 'asirra-edit' => "Como prevenção contra sistemas automatizados de inserção de ''spam'', seleccione só as fotografias de gatos na caixa abaixo:", |
152 | | - 'asirra-addurl' => "A sua edição contém links externos novos. Como prevenção contra sistemas automatizados de inserção de ''spam'', seleccione só as fotografias de gatos na caixa abaixo:", |
153 | | - 'asirra-badpass' => 'Como prevenção com sistemas automatizados de descoberta de palavras-chave, seleccione só as fotografias de gatos na caixa abaixo:', |
154 | | - 'asirra-createaccount' => 'Como prevenção contra sistemas automatizados de criação de contas, seleccione só as fotografias de gatos na caixa abaixo:', |
155 | | - 'asirra-createaccount-fail' => 'Identifique correctamente os gatos, por favor.', |
156 | | - 'asirra-create' => 'Como prevenção contra sistemas automatizados de criação de páginas, seleccione só as fotografias de gatos na caixa abaixo:', |
157 | | - 'asirra-nojs' => "'''Possibilite o uso de JavaScript e reenvie a página, por favor.'''", |
158 | | -); |
159 | | - |
Index: trunk/extensions/ConfirmEdit/asirra_contentloaded.js |
— | — | @@ -1,50 +0,0 @@ |
2 | | -/*! |
3 | | - * contentloaded.js |
4 | | - * |
5 | | - * Author: Diego Perini (diego.perini at gmail.com) |
6 | | - * Summary: cross-browser wrapper for DOMContentLoaded |
7 | | - * Updated: 20101020 |
8 | | - * License: MIT |
9 | | - * Version: 1.2 |
10 | | - * |
11 | | - * URL: |
12 | | - * http://javascript.nwbox.com/ContentLoaded/ |
13 | | - * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE |
14 | | - * |
15 | | - */ |
16 | | - |
17 | | -// @win window reference |
18 | | -// @fn function reference |
19 | | -function contentLoaded(win, fn) { |
20 | | - |
21 | | - var done = false, top = true, |
22 | | - |
23 | | - doc = win.document, root = doc.documentElement, |
24 | | - |
25 | | - add = doc.addEventListener ? 'addEventListener' : 'attachEvent', |
26 | | - rem = doc.addEventListener ? 'removeEventListener' : 'detachEvent', |
27 | | - pre = doc.addEventListener ? '' : 'on', |
28 | | - |
29 | | - init = function(e) { |
30 | | - if (e.type == 'readystatechange' && doc.readyState != 'complete') return; |
31 | | - (e.type == 'load' ? win : doc)[rem](pre + e.type, init, false); |
32 | | - if (!done && (done = true)) fn.call(win, e.type || e); |
33 | | - }, |
34 | | - |
35 | | - poll = function() { |
36 | | - try { root.doScroll('left'); } catch(e) { setTimeout(poll, 50); return; } |
37 | | - init('poll'); |
38 | | - }; |
39 | | - |
40 | | - if (doc.readyState == 'complete') fn.call(win, 'lazy'); |
41 | | - else { |
42 | | - if (doc.createEventObject && root.doScroll) { |
43 | | - try { top = !win.frameElement; } catch(e) { } |
44 | | - if (top) poll(); |
45 | | - } |
46 | | - doc[add](pre + 'DOMContentLoaded', init, false); |
47 | | - doc[add](pre + 'readystatechange', init, false); |
48 | | - win[add](pre + 'load', init, false); |
49 | | - } |
50 | | - |
51 | | -} |
Index: trunk/extensions/ConfirmEdit/Asirra.php |
— | — | @@ -1,43 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Asirra CAPTCHA module for the ConfirmEdit MediaWiki extension. |
5 | | - * @author Bachsau |
6 | | - * |
7 | | - * Makes use of the Asirra (Animal Species Image Recognition for |
8 | | - * Restricting Access) CAPTCHA service, developed by John Douceur, Jeremy |
9 | | - * Elson and Jon Howell at Microsoft Research. |
10 | | - * |
11 | | - * Asirra uses a large set of images from http://petfinder.com. |
12 | | - * |
13 | | - * For more information about Asirra, see: |
14 | | - * http://research.microsoft.com/en-us/um/redmond/projects/asirra/ |
15 | | - * |
16 | | - * This MediaWiki code is released into the public domain, without any |
17 | | - * warranty. YOU CAN DO WITH IT WHATEVER YOU LIKE! |
18 | | - * |
19 | | - * @file |
20 | | - * @ingroup Extensions |
21 | | - */ |
22 | | - |
23 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
24 | | - exit; |
25 | | -} |
26 | | - |
27 | | -require_once dirname( __FILE__ ) . '/ConfirmEdit.php'; |
28 | | -$wgCaptchaClass = 'Asirra'; |
29 | | - |
30 | | -// Default Asirra options. |
31 | | -// Use LocalSettings.php for any changes |
32 | | -$wgAsirraEnlargedPosition = 'bottom'; |
33 | | -$wgAsirraCellsPerRow = '6'; |
34 | | -$wgAsirraScriptPath = ''; |
35 | | - |
36 | | -// AsirraXmlParser initial values |
37 | | -$wgAsirra = array |
38 | | -( |
39 | | - 'inResult' => 0, |
40 | | - 'passed' => 0 |
41 | | -); |
42 | | - |
43 | | -$wgExtensionMessagesFiles['Asirra'] = dirname( __FILE__ ) . '/Asirra.i18n.php'; |
44 | | -$wgAutoloadClasses['Asirra'] = dirname( __FILE__ ) . '/Asirra.class.php'; |
Index: trunk/extensions/ConfirmEdit/asirra_humanverify.js |
— | — | @@ -1,62 +0,0 @@ |
2 | | -/*======================================================================*\ |
3 | | -|| #################################################################### || |
4 | | -|| # Asirra module for ConfirmEdit by Bachsau # || |
5 | | -|| # ---------------------------------------------------------------- # || |
6 | | -|| # This code is released into public domain, in the hope that it # || |
7 | | -|| # will be useful, but without any warranty. # || |
8 | | -|| # ------------ YOU CAN DO WITH IT WHATEVER YOU LIKE! ------------- # || |
9 | | -|| #################################################################### || |
10 | | -\*======================================================================*/ |
11 | | - |
12 | | -var asirra_js_failed = "Please correctly identify the cats."; |
13 | | -var asirraform = document.forms[document.forms.length - 1]; |
14 | | -var submitButtonClicked = document.createElement("input"); |
15 | | -var passThroughFormSubmit = false; |
16 | | - |
17 | | -function PrepareSubmit() |
18 | | -{ |
19 | | - submitButtonClicked.type = "hidden"; |
20 | | - var inputFields = asirraform.getElementsByTagName("input"); |
21 | | - for (var i=0; i<inputFields.length; i++) |
22 | | - { |
23 | | - if (inputFields[i].type == "submit") |
24 | | - { |
25 | | - inputFields[i].onclick = function(event) |
26 | | - { |
27 | | - submitButtonClicked.name = this.name; |
28 | | - submitButtonClicked.value = this.value; |
29 | | - } |
30 | | - } |
31 | | - } |
32 | | - |
33 | | - asirraform.onsubmit = function(event) |
34 | | - { |
35 | | - return MySubmitForm(); |
36 | | - } |
37 | | -} |
38 | | - |
39 | | -function MySubmitForm() |
40 | | -{ |
41 | | - if (passThroughFormSubmit) |
42 | | - { |
43 | | - return true; |
44 | | - } |
45 | | - Asirra_CheckIfHuman(HumanCheckComplete); |
46 | | - return false; |
47 | | -} |
48 | | - |
49 | | -function HumanCheckComplete(isHuman) |
50 | | -{ |
51 | | - if (!isHuman) |
52 | | - { |
53 | | - alert(asirra_js_failed); |
54 | | - } |
55 | | - else |
56 | | - { |
57 | | - asirraform.appendChild(submitButtonClicked); |
58 | | - passThroughFormSubmit = true; |
59 | | - asirraform.submit(); |
60 | | - } |
61 | | -} |
62 | | - |
63 | | -contentLoaded(window,PrepareSubmit); |
Index: trunk/extensions/ConfirmEdit/Asirra.class.php |
— | — | @@ -1,118 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * @author Bachsau |
5 | | - */ |
6 | | - |
7 | | -class Asirra extends SimpleCaptcha |
8 | | -{ |
9 | | - // Asirra URLs |
10 | | - public $asirra_localpath = ''; |
11 | | - public $asirra_clientscript = 'http://challenge.asirra.com/js/AsirraClientSide.js'; |
12 | | - public $asirra_apiscript = 'http://challenge.asirra.com/cgi/Asirra'; |
13 | | - |
14 | | - // As we don't have to store anything but some other things to do, |
15 | | - // we're going to replace that constructor completely. |
16 | | - function __construct() |
17 | | - { |
18 | | - global $wgScriptPath, $wgAsirraScriptPath; |
19 | | - |
20 | | - // WTF isn't this in ConfirmEdit_body.php? |
21 | | - wfLoadExtensionMessages('ConfirmEdit'); |
22 | | - wfLoadExtensionMessages('Asirra'); |
23 | | - |
24 | | - // Try to find $asirra_localpath if not set |
25 | | - if (!$this -> asirra_localpath = $wgAsirraScriptPath) |
26 | | - { |
27 | | - if (strpos(__FILE__, $_SERVER['DOCUMENT_ROOT']) === 0) |
28 | | - { |
29 | | - $this -> asirra_localpath = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '(\\/*)/s', '/', dirname(__FILE__)); |
30 | | - } |
31 | | - else |
32 | | - { |
33 | | - $this -> asirra_localpath = $wgScriptPath . '/extensions/ConfirmEdit'; |
34 | | - } |
35 | | - } |
36 | | - } |
37 | | - |
38 | | - function getForm() |
39 | | - { |
40 | | - global $wgAsirraEnlargedPosition, $wgAsirraCellsPerRow, $wgOut; |
41 | | - |
42 | | - return ' |
43 | | - <script type="text/javascript" src="' . $this -> asirra_clientscript . '"></script> |
44 | | - <script type="text/javascript" src="' . $this -> asirra_localpath . '/asirra_contentloaded.js"></script> |
45 | | - <script type="text/javascript" src="' . $this -> asirra_localpath . '/asirra_humanverify.js"></script> |
46 | | - <script type="text/javascript"> |
47 | | - asirraState.SetEnlargedPosition("' . $wgAsirraEnlargedPosition . '"); |
48 | | - asirraState.SetCellsPerRow(' . $wgAsirraCellsPerRow . '); |
49 | | - var asirra_js_failed = "' . $this -> getMessage('createaccount-fail') . '" |
50 | | - </script> |
51 | | - <noscript>' . $wgOut -> parse($this -> getMessage('nojs')) . '</noscript> |
52 | | - '; |
53 | | - } |
54 | | - |
55 | | - function getMessage( $action ) |
56 | | - { |
57 | | - $name = 'asirra-' . $action; |
58 | | - $text = wfMsg($name); |
59 | | - // Obtain a more tailored message, if possible, otherwise, fall back to |
60 | | - // the default for edits |
61 | | - return wfEmptyMsg($name, $text) ? wfMsg('asirra-edit') : $text; |
62 | | - } |
63 | | - |
64 | | - // This is where the party goes on... |
65 | | - function passCaptcha() |
66 | | - { |
67 | | - global $wgRequest, $wgAsirra; |
68 | | - |
69 | | - $ticket = $wgRequest -> getVal('Asirra_Ticket'); |
70 | | - $url = $this -> asirra_apiscript . '?action=ValidateTicket&ticket=' . $ticket; |
71 | | - |
72 | | - $ch = curl_init(); |
73 | | - curl_setopt($ch, CURLOPT_URL, $url); |
74 | | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
75 | | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
76 | | - $resultXml = curl_exec($ch); |
77 | | - curl_close($ch); |
78 | | - |
79 | | - $xml_parser = xml_parser_create(); |
80 | | - xml_set_element_handler($xml_parser, 'AsirraXmlParser::startElement', 'AsirraXmlParser::endElement'); |
81 | | - xml_set_character_data_handler($xml_parser, 'AsirraXmlParser::characterData'); |
82 | | - xml_parse($xml_parser, $resultXml, 1); |
83 | | - xml_parser_free($xml_parser); |
84 | | - |
85 | | - if ($wgAsirra['passed']) |
86 | | - { |
87 | | - return true; |
88 | | - |
89 | | - } |
90 | | - return false; |
91 | | - } |
92 | | -} |
93 | | - |
94 | | -class AsirraXmlParser |
95 | | -{ |
96 | | - static function startElement($parser, $name, $attrs) |
97 | | - { |
98 | | - global $wgAsirra; |
99 | | - |
100 | | - $wgAsirra['inResult'] = ($name=="RESULT"); |
101 | | - } |
102 | | - |
103 | | - static function endElement($name) |
104 | | - { |
105 | | - global $wgAsirra; |
106 | | - |
107 | | - $wgAsirra['inResult'] = 0; |
108 | | - } |
109 | | - |
110 | | - static function characterData($parer, $data) |
111 | | - { |
112 | | - global $wgAsirra; |
113 | | - |
114 | | - if ($wgAsirra['inResult'] && $data == "Pass") |
115 | | - { |
116 | | - $wgAsirra['passed'] = 1; |
117 | | - } |
118 | | - } |
119 | | -} |