r94613 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94612‎ | r94613 | r94614 >
Date:08:31, 16 August 2011
Author:siebrand
Status:deferred
Tags:
Comment:
stylize extension
Modified paths:
  • /trunk/extensions/SemanticSignup/INSTALL (modified) (history)
  • /trunk/extensions/SemanticSignup/SemanticSignup.hooks.php (modified) (history)
  • /trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php (modified) (history)
  • /trunk/extensions/SemanticSignup/SemanticSignup.i18n.php (modified) (history)
  • /trunk/extensions/SemanticSignup/SemanticSignup.php (modified) (history)
  • /trunk/extensions/SemanticSignup/SemanticSignup.settings.php (modified) (history)
  • /trunk/extensions/SemanticSignup/includes/SES_DataChecker.php (modified) (history)
  • /trunk/extensions/SemanticSignup/includes/SES_SignupFields.php (modified) (history)
  • /trunk/extensions/SemanticSignup/includes/SES_Special.php (modified) (history)
  • /trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticSignup/SemanticSignup.php
@@ -2,7 +2,7 @@
33
44 /**
55 * Initialization file for the Semantic Signup extension.
6 - *
 6+ *
77 * Documentation: http://www.mediawiki.org/wiki/Extension:SemanticSignup
88 * Support http://www.mediawiki.org/wiki/Extension_talk:SemanticSignup
99 * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticSignup
@@ -61,7 +61,7 @@
6262 $wgAutoloadClasses['SemanticSignupSettings'] = dirname( __FILE__ ) . '/SemanticSignup.settings.php';
6363 $wgAutoloadClasses['SemanticSignupHooks'] = dirname( __FILE__ ) . '/SemanticSignup.hooks.php';
6464 $wgAutoloadClasses['SemanticSignup'] = dirname( __FILE__ ) . '/includes/SES_Special.php';
65 -$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php';
 65+$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php';
6666 $wgAutoloadClasses['SES_DataChecker'] = dirname( __FILE__ ) . '/includes/SES_DataChecker.php';
6767 $wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_UserAccountDataChecker.php';
6868 $wgAutoloadClasses['SES_SignupFields'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php';
Index: trunk/extensions/SemanticSignup/SemanticSignup.hooks.php
@@ -2,12 +2,12 @@
33
44 /**
55 * Static class for hooks handled by the SemanticSignup extension.
6 - *
 6+ *
77 * @since 0.3
8 - *
 8+ *
99 * @file SemanticSignup.hooks.php
1010 * @ingroup SemanticSignup
11 - *
 11+ *
1212 * @licence GNU GPL v3+
1313 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1414 */
@@ -17,30 +17,30 @@
1818 * @since 0.3
1919 *
2020 * @param $template
21 - *
 21+ *
2222 * @return false
2323 */
2424 public static function onUserCreateForm( $template ) {
2525 if ( is_null( Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM ) ) ) {
2626 return true;
2727 }
28 -
 28+
2929 $url = SemanticSignup::getTitleFor( 'SemanticSignup' )->escapeFullURL();
3030 global $wgOut;
3131 $wgOut->redirect( $url );
32 -
 32+
3333 return false;
3434 }
35 -
 35+
3636 /**
3737 * @since 0.3
38 - *
 38+ *
3939 * @return true
4040 */
4141 public static function onParserFirstCallInit() {
4242 global $wgParser;
4343 $wgParser->setFunctionHook( 'signupfields', 'SES_SignupFields::render' );
44 - return true;
 44+ return true;
4545 }
4646
4747 }
Index: trunk/extensions/SemanticSignup/INSTALL
@@ -1,5 +1,5 @@
22 These is the install file for the SemanticSignup extension.
3 -
 3+
44 Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:SemanticSignup
55 Latest version of the install file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticSignup/INSTALL?view=co
66
Index: trunk/extensions/SemanticSignup/includes/SES_Special.php
@@ -5,7 +5,7 @@
66 * a Semantic Forms form page that allows for signup with
77 * adittional (structured) data that immediately gets entered
88 * onto the user page of the new user.
9 - *
 9+ *
1010 * @file SES_Special.php
1111 * @ingroup SemanticSignup
1212 *
@@ -13,34 +13,34 @@
1414 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1515 */
1616 class SemanticSignup extends SpecialPage {
17 -
 17+
1818 private $mUserDataChecker = null;
1919 private $mUserPageUrl = '';
20 -
 20+
2121 public function __construct() {
2222 parent::__construct( 'SemanticSignup' );
2323 $this->mIncludable = false;
2424
2525 $this->mUserDataChecker = new SES_UserAccountDataChecker();
2626 }
27 -
 27+
2828 private function userSignup() {
29 - //Get user input and check the environment
 29+ // Get user input and check the environment
3030 $this->mUserDataChecker->run();
31 -
32 - //Throw if data getting or environment checks have failed which indicates that account creation is impossible
 31+
 32+ // Throw if data getting or environment checks have failed which indicates that account creation is impossible
3333 $checker_error = $this->mUserDataChecker->getError();
3434 if ( $checker_error ) {
3535 throw new Exception( $checker_error );
3636 }
37 -
38 - $user = $this->mUserDataChecker->mUser;
39 -
 37+
 38+ $user = $this->mUserDataChecker->mUser;
 39+
4040 $user->setEmail( $this->mUserDataChecker->mEmail );
4141 $user->setRealName( $this->mUserDataChecker->mRealname );
42 -
 42+
4343 $abortError = '';
44 - if( !wfRunHooks( 'AbortNewAccount', array( $user, &$abortError ) ) ) {
 44+ if ( !wfRunHooks( 'AbortNewAccount', array( $user, &$abortError ) ) ) {
4545 // Hook point to add extra creation throttles and blocks
4646 wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
4747 throw new Exception( $abortError );
@@ -48,36 +48,36 @@
4949
5050 global $wgAccountCreationThrottle;
5151 global $wgUser;
52 -
 52+
5353 if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) {
5454 $key = wfMemcKey( 'acctcreate', 'ip', wfGetIP() );
5555 $value = $wgMemc->incr( $key );
56 -
 56+
5757 if ( !$value ) {
5858 $wgMemc->set( $key, 1, 86400 );
5959 }
60 -
 60+
6161 if ( $value > $wgAccountCreationThrottle ) {
62 - throw new Exception(wfMsg('ses-throttlehit'));
 62+ throw new Exception( wfMsg( 'ses-throttlehit' ) );
6363 }
6464 }
65 -
 65+
6666 global $wgAuth;
67 -
 67+
6868 $addedUser = $wgAuth->addUser(
6969 $user,
70 - $this->mUserDataChecker->mPassword,
 70+ $this->mUserDataChecker->mPassword,
7171 $this->mUserDataChecker->mEmail,
7272 $this->mUserDataChecker->mRealname
7373 );
74 -
75 - if( !$addedUser ) {
 74+
 75+ if ( !$addedUser ) {
7676 throw new Exception( 'externaldberror' );
77 - }
78 -
79 -
 77+ }
 78+
 79+
8080 $user->addToDatabase();
81 -
 81+
8282 if ( $wgAuth->allowPasswordChange() ) {
8383 $user->setPassword( $this->mUserDataChecker->mPassword );
8484 }
@@ -95,39 +95,39 @@
9696
9797 global $wgLoginLanguageSelector;
9898 $language = $this->mUserDataChecker->mLanguage;
99 -
100 - if( $wgLoginLanguageSelector && $language ) {
 99+
 100+ if ( $wgLoginLanguageSelector && $language ) {
101101 $user->setOption( 'language', $language );
102102 }
103 -
 103+
104104 global $wgEmailAuthentication;
105 -
106 - if( $wgEmailAuthentication && User::isValidEmailAddr( $user->getEmail() ) ) {
 105+
 106+ if ( $wgEmailAuthentication && User::isValidEmailAddr( $user->getEmail() ) ) {
107107 $status = $user->sendConfirmationMail();
108 -
 108+
109109 if ( !$status->isGood() ) {
110110 throw new Exception( wfMsg( 'ses-emailfailed' ) . "\n" . $status->getMessage() );
111111 }
112112 }
113 -
 113+
114114 $user->saveSettings();
115115 wfRunHooks( 'AddNewAccount', array( $user ) );
116116 }
117 -
 117+
118118 private function createUserPage() {
119119 $form_title = Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM );
120120 $form = new Article( $form_title );
121121 $form_definition = $form->getContent();
122 -
 122+
123123 $page_title = Title::newFromText( $this->mUserDataChecker->mUser->getName(), NS_USER );
124124 $this->mUserPageUrl = $page_title->escapeFullUrl();
125125
126126 global $sfgFormPrinter;
127 - list ($form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name) =
128 - $sfgFormPrinter->formHTML($form_definition, true, false);
 127+ list ( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name ) =
 128+ $sfgFormPrinter->formHTML( $form_definition, true, false );
129129
130130 $user_page = new Article( $page_title );
131 -
 131+
132132 global $wgUser;
133133 $wgUser = $this->mUserDataChecker->mUser;
134134 // TODO: doEdit removed; use internal API call
@@ -138,30 +138,30 @@
139139 global $wgUser;
140140
141141 /*
142 - * SemanticForms disable the form automatically if current user hasn't got edit rights
143 - * so we have to use a bot account for the form request. Current user is being saved in
 142+ * SemanticForms disable the form automatically if current user hasn't got edit rights
 143+ * so we have to use a bot account for the form request. Current user is being saved in
144144 * the $old_user variable to be restored afterwards
145145 */
146146 $old_user = null;
147 - if ( $wgUser->isAnon() ) {
 147+ if ( $wgUser->isAnon() ) {
148148 $old_user = $wgUser;
149149 $wgUser = User::newFromName( SemanticSignupSettings::get( 'botName' ) );
150150 }
151 -
 151+
152152 $form_title = Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM );
153153 $form = new Article( $form_title );
154154 $form_definition = $form->getContent();
155 -
 155+
156156 global $sfgFormPrinter;
157 -
158 - list ($form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name) =
159 - $sfgFormPrinter->formHTML($form_definition, false, false);
160 -
161 - $text =<<<END
 157+
 158+ list ( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name ) =
 159+ $sfgFormPrinter->formHTML( $form_definition, false, false );
 160+
 161+ $text = <<<END
162162 <form name="createbox" onsubmit="return validate_all()" action="" method="post" class="createbox">
163163 END;
164 - $text .= $form_text.'</form>';
165 -
 164+ $text .= $form_text . '</form>';
 165+
166166 global $sfgScriptPath, $sfgYUIBase, $wgOut;
167167 $mainCssUrl = $sfgScriptPath . '/skins/SF_main.css';
168168 $wgOut->addLink( array(
@@ -169,85 +169,85 @@
170170 'type' => 'text/css',
171171 'media' => "screen, projection",
172172 'href' => $mainCssUrl
173 - ));
 173+ ) );
174174 $wgOut->addLink( array(
175175 'rel' => 'stylesheet',
176176 'type' => 'text/css',
177177 'media' => "screen, projection",
178178 'href' => $sfgYUIBase . "autocomplete/assets/skins/sam/autocomplete.css"
179 - ));
 179+ ) );
180180 $wgOut->addLink( array(
181181 'rel' => 'stylesheet',
182182 'type' => 'text/css',
183183 'media' => "screen, projection",
184184 'href' => $sfgScriptPath . '/skins/SF_yui_autocompletion.css'
185 - ));
 185+ ) );
186186 $wgOut->addLink( array(
187187 'rel' => 'stylesheet',
188188 'type' => 'text/css',
189189 'media' => "screen, projection",
190190 'href' => $sfgScriptPath . '/skins/floatbox.css'
191 - ));
192 -
 191+ ) );
 192+
193193 // FIXME: wtf?
194 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'yahoo/yahoo-min.js"></script>' . "\n");
195 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'dom/dom-min.js"></script>' . "\n");
196 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'event/event-min.js"></script>' . "\n");
197 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'get/get-min.js"></script>' . "\n");
198 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'connection/connection-min.js"></script>' . "\n");
199 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'json/json-min.js"></script>' . "\n");
200 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'datasource/datasource-min.js"></script>' . "\n");
201 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'autocomplete/autocomplete-min.js"></script>' . "\n");
202 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/SF_yui_autocompletion.js"></script>' . "\n");
203 - $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/floatbox.js"></script>' . "\n");
204 -
 194+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'yahoo/yahoo-min.js"></script>' . "\n" );
 195+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'dom/dom-min.js"></script>' . "\n" );
 196+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'event/event-min.js"></script>' . "\n" );
 197+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'get/get-min.js"></script>' . "\n" );
 198+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'connection/connection-min.js"></script>' . "\n" );
 199+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'json/json-min.js"></script>' . "\n" );
 200+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'datasource/datasource-min.js"></script>' . "\n" );
 201+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'autocomplete/autocomplete-min.js"></script>' . "\n" );
 202+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/SF_yui_autocompletion.js"></script>' . "\n" );
 203+ $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/floatbox.js"></script>' . "\n" );
 204+
205205 global $wgFCKEditorDir;
206206 if ( $wgFCKEditorDir ) {
207 - $wgOut->addScript('<script type="text/javascript" src="' . "$wgScriptPath/$wgFCKEditorDir" . '/fckeditor.js"></script>' . "\n");
 207+ $wgOut->addScript( '<script type="text/javascript" src="' . "$wgScriptPath/$wgFCKEditorDir" . '/fckeditor.js"></script>' . "\n" );
208208 }
209 -
 209+
210210 if ( !empty( $javascript_text ) ) {
211 - $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n");
 211+ $wgOut->addScript( ' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n" );
212212 }
213 -
 213+
214214 $wgOut->addMeta( 'robots', 'noindex,nofollow' );
215215 $wgOut->addHTML( $text );
216 -
 216+
217217 // Restore the current user.
218218 if ( $old_user ) {
219219 $wgUser = $old_user;
220220 }
221221 }
222 -
 222+
223223 private function executeOnSubmit() {
224224 global $wgOut;
225 -
 225+
226226 try {
227227 $this->userSignup();
228228 $this->createUserPage();
229 -
 229+
230230 $wgOut->redirect( $this->mUserPageUrl );
231 - }
 231+ }
232232 catch ( Exception $e ) {
233233 $wgOut->addHTML( '<div class="error">' . $e->getMessage() . '</div>' );
234234 $this->printForm();
235235 }
236 -
 236+
237237 return true;
238 - }
239 -
 238+ }
 239+
240240 public function execute( $par ) {
241241 global $wgRequest, $wgOut;
242 -
 242+
243243 $this->setHeaders();
244 -
 244+
245245 if ( $wgRequest->getCheck( 'wpSave' ) ) {
246246 return $this->executeOnSubmit();
247247 } else {
248248 $this->printForm();
249249 return true;
250 - }
 250+ }
251251 }
252 -
 252+
253253 }
254254
\ No newline at end of file
Index: trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php
@@ -1,10 +1,10 @@
2 -<?php
 2+<?php
33
44 /**
55 * Created on 7 Jan 2008 by Serhii Kutnii
66 */
77 class SES_UserAccountDataChecker extends SES_DataChecker {
8 -
 8+
99 public $mUsername = '';
1010 public $mPassword = '';
1111 public $mEmail = '';
@@ -13,7 +13,7 @@
1414 public $mLanguage = '';
1515 public $mRemember = false;
1616 public $mUser = null;
17 -
 17+
1818 protected function populateData() {
1919 $this->mUsername = $this->getUserDataValue( 'wpName', 'nousername' );
2020 $name = trim( $this->mUsername );
@@ -21,53 +21,53 @@
2222 if ( !$this->mUser ) {
2323 $this->error( wfMsg( 'ses-noname' ) );
2424 }
25 -
 25+
2626 global $sesRealNameRequired;
27 - $this->mRealname = $this->getUserDataValue('wpRealName', $sesRealNameRequired ? 'norealname' : null);
28 -
29 - $this->mPassword = $this->getUserDataValue('wpPassword');
30 - $retype = $this->getUserDataValue('wpRetype');
31 - if (strcmp($this->mPassword, $retype))
32 - $this->error(wfMsg('ses-nopwdmatch'));
33 -
34 - $this->mDomain = $this->getUserDataValue('wpDomain');
35 -
 27+ $this->mRealname = $this->getUserDataValue( 'wpRealName', $sesRealNameRequired ? 'norealname' : null );
 28+
 29+ $this->mPassword = $this->getUserDataValue( 'wpPassword' );
 30+ $retype = $this->getUserDataValue( 'wpRetype' );
 31+ if ( strcmp( $this->mPassword, $retype ) )
 32+ $this->error( wfMsg( 'ses-nopwdmatch' ) );
 33+
 34+ $this->mDomain = $this->getUserDataValue( 'wpDomain' );
 35+
3636 global $wgEmailConfirmToEdit;
37 - $this->mEmail = $this->getUserDataValue('wpEmail', $wgEmailConfirmToEdit ? 'noemailtitle' : null );
38 -
39 - $this->mLanguage = $this->getUserDataValue('uselang');
40 -
 37+ $this->mEmail = $this->getUserDataValue( 'wpEmail', $wgEmailConfirmToEdit ? 'noemailtitle' : null );
 38+
 39+ $this->mLanguage = $this->getUserDataValue( 'uselang' );
 40+
4141 global $wgRequest;
42 - $this->mRemember = $wgRequest->getCheck('wpRemember');
 42+ $this->mRemember = $wgRequest->getCheck( 'wpRemember' );
4343 }
44 -
45 - //Checks
46 -
 44+
 45+ // Checks
 46+
4747 public function checkDomainValidity()
4848 {
4949 global $wgAuth;
50 -
51 - if( !$wgAuth->validDomain( $this->mDomain ) )
52 - $this->error(wfMsg('wrongpassword'));
 50+
 51+ if ( !$wgAuth->validDomain( $this->mDomain ) )
 52+ $this->error( wfMsg( 'wrongpassword' ) );
5353 }
54 -
 54+
5555 public function checkDomainUser()
5656 {
5757 global $wgAuth;
5858
59 - if( ('local' != $this->mDomain) && ('' != $this->mDomain)
60 - && !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists($this->mName) || !$wgAuth->authenticate($this->mName, $this->mPassword) ) )
61 - $this->error(wfMsg('wrongpassword'));
 59+ if ( ( 'local' != $this->mDomain ) && ( '' != $this->mDomain )
 60+ && !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mName ) || !$wgAuth->authenticate( $this->mName, $this->mPassword ) ) )
 61+ $this->error( wfMsg( 'wrongpassword' ) );
6262 }
63 -
 63+
6464 public function checkCreatePermissions()
6565 {
6666 global $wgUser;
67 -
68 - if (!$wgUser->isAllowed( 'createaccount' ) || $wgUser->isBlockedFromCreateAccount() )
69 - $this->error(wfMsg('ses-createforbidden'));
 67+
 68+ if ( !$wgUser->isAllowed( 'createaccount' ) || $wgUser->isBlockedFromCreateAccount() )
 69+ $this->error( wfMsg( 'ses-createforbidden' ) );
7070 }
71 -
 71+
7272 public function checkSorbs()
7373 {
7474 global $wgProxyWhitelist;
@@ -75,39 +75,39 @@
7676 $ip = wfGetIP();
7777 if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) &&
7878 $wgUser->inSorbsBlacklist( $ip ) )
79 - $this->error(wfMsg('sorbs_create_account_reason'));
 79+ $this->error( wfMsg( 'sorbs_create_account_reason' ) );
8080 }
81 -
 81+
8282 public function checkUserExists()
8383 {
84 - if ($this->mUser->idForName())
85 - $this->error(wfMsg('ses-userexists'));
 84+ if ( $this->mUser->idForName() )
 85+ $this->error( wfMsg( 'ses-userexists' ) );
8686 }
87 -
 87+
8888 public function checkPasswordLength()
8989 {
90 - if (!$this->mUser->isValidPassword($this->mPassword))
 90+ if ( !$this->mUser->isValidPassword( $this->mPassword ) )
9191 {
9292 global $wgMinimalPasswordLength;
93 - $this->error(wfMsgExt('passwordtooshort', array( 'parsemag' ), $wgMinimalPasswordLength));
 93+ $this->error( wfMsgExt( 'passwordtooshort', array( 'parsemag' ), $wgMinimalPasswordLength ) );
9494 }
9595 }
96 -
 96+
9797 public function checkEmailValidity()
9898 {
9999 global $wgEnableEmail;
100 - if ($wgEnableEmail && !User::isValidEmailAddr($this->mEmail))
101 - $this->error(wfMsg('invalidemailaddress'));
 100+ if ( $wgEnableEmail && !User::isValidEmailAddr( $this->mEmail ) )
 101+ $this->error( wfMsg( 'invalidemailaddress' ) );
102102 }
103 -
 103+
104104 public function __construct()
105105 {
106 - $this->addCheck(array(&$this, 'checkDomainValidity'), array());
107 - $this->addCheck(array(&$this, 'checkDomainUser'), array());
108 - $this->addCheck(array(&$this, 'checkCreatePermissions'), array());
109 - $this->addCheck(array(&$this, 'checkSorbs'), array());
110 - $this->addCheck(array(&$this, 'checkUserExists'), array());
111 - $this->addCheck(array(&$this, 'checkPasswordLength'), array());
112 - $this->addCheck(array(&$this, 'checkEmailValidity'), array());
 106+ $this->addCheck( array( &$this, 'checkDomainValidity' ), array() );
 107+ $this->addCheck( array( &$this, 'checkDomainUser' ), array() );
 108+ $this->addCheck( array( &$this, 'checkCreatePermissions' ), array() );
 109+ $this->addCheck( array( &$this, 'checkSorbs' ), array() );
 110+ $this->addCheck( array( &$this, 'checkUserExists' ), array() );
 111+ $this->addCheck( array( &$this, 'checkPasswordLength' ), array() );
 112+ $this->addCheck( array( &$this, 'checkEmailValidity' ), array() );
113113 }
114114 }
Index: trunk/extensions/SemanticSignup/includes/SES_SignupFields.php
@@ -2,12 +2,12 @@
33 /*
44 * Created on 6 Jan 2009 by Serhii Kutnii
55 */
6 -
 6+
77 /*
88 * Borrowed from standard UsercreateTemplate. Some minor changes have been made
99 */
10 -
11 -class CreateUserFieldsTemplate extends QuickTemplate
 10+
 11+class CreateUserFieldsTemplate extends QuickTemplate
1212 {
1313 function addInputItem( $name, $value, $type, $msg ) {
1414 $this->data['extraInput'][] = array(
@@ -17,19 +17,19 @@
1818 'msg' => $msg,
1919 );
2020 }
21 -
 21+
2222 function execute() {
23 -
 23+
2424 ?>
2525 <div id="userlogin">
2626
27 - <h2><?php $this->msg('createaccount') ?></h2>
28 - <p id="userloginlink"><?php $this->html('link') ?></p>
29 - <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
30 - <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
 27+ <h2><?php $this->msg( 'createaccount' ) ?></h2>
 28+ <p id="userloginlink"><?php $this->html( 'link' ) ?></p>
 29+ <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
 30+ <?php if ( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
3131 <table>
3232 <tr>
33 - <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
 33+ <td class="mw-label"><label for='wpName2'><?php $this->msg( 'yourname' ) ?></label></td>
3434 <td class="mw-input">
3535 <input type='text' class='loginText' name="wpName" id="wpName2"
3636 tabindex="1"
@@ -37,16 +37,16 @@
3838 </td>
3939 </tr>
4040 <tr>
41 - <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
 41+ <td class="mw-label"><label for='wpPassword2'><?php $this->msg( 'yourpassword' ) ?></label></td>
4242 <td class="mw-input">
4343 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
4444 tabindex="2"
4545 value="" size='20' />
4646 </td>
4747 </tr>
48 - <?php if( $this->data['usedomain'] ) {
 48+ <?php if ( $this->data['usedomain'] ) {
4949 $doms = "";
50 - foreach( $this->data['domainnames'] as $dom ) {
 50+ foreach ( $this->data['domainnames'] as $dom ) {
5151 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
5252 }
5353 ?>
@@ -61,7 +61,7 @@
6262 </tr>
6363 <?php } ?>
6464 <tr>
65 - <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
 65+ <td class="mw-label"><label for='wpRetype'><?php $this->msg( 'yourpasswordagain' ) ?></label></td>
6666 <td class="mw-input">
6767 <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
6868 tabindex="4"
@@ -70,25 +70,25 @@
7171 </td>
7272 </tr>
7373 <tr>
74 - <?php if( $this->data['useemail'] ) { ?>
75 - <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
 74+ <?php if ( $this->data['useemail'] ) { ?>
 75+ <td class="mw-label"><label for='wpEmail'><?php $this->msg( 'youremail' ) ?></label></td>
7676 <td class="mw-input">
7777 <input type='text' class='loginText' name="wpEmail" id="wpEmail"
7878 tabindex="5"
79 - value="<?php $this->text('email') ?>" size='20' />
 79+ value="<?php $this->text( 'email' ) ?>" size='20' />
8080 <div class="prefsectiontip">
81 - <?php if( $this->data['emailrequired'] ) {
82 - $this->msgWiki('prefs-help-email-required');
 81+ <?php if ( $this->data['emailrequired'] ) {
 82+ $this->msgWiki( 'prefs-help-email-required' );
8383 } else {
84 - $this->msgWiki('prefs-help-email');
 84+ $this->msgWiki( 'prefs-help-email' );
8585 } ?>
8686 </div>
8787 </td>
8888 <?php } ?>
89 - <?php if( $this->data['userealname'] ) { ?>
 89+ <?php if ( $this->data['userealname'] ) { ?>
9090 </tr>
9191 <tr>
92 - <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
 92+ <td class="mw-label"><label for='wpRealName'><?php $this->msg( 'yourrealname' ) ?></label></td>
9393 <td class="mw-input">
9494 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
9595 tabindex="6"
@@ -104,9 +104,9 @@
105105 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
106106 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
107107 <tr>
108 - <?php
 108+ <?php
109109 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
110 - ?><td class="mw-label"><label for="<?php
 110+ ?><td class="mw-label"><label for="<?php
111111 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
112112 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
113113 } else {
@@ -117,17 +117,17 @@
118118 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
119119 echo htmlspecialchars( $inputItem['name'] ); ?>"
120120 tabindex="<?php echo $tabIndex++; ?>"
121 - value="<?php
 121+ value="<?php
122122 if ( $inputItem['type'] != 'checkbox' ) {
123123 echo htmlspecialchars( $inputItem['value'] );
124124 } else {
125125 echo '1';
126 - }
 126+ }
127127 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
128 - <?php
 128+ <?php
129129 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
130 - echo 'checked="checked"';
131 - ?> /> <?php
 130+ echo 'checked="checked"';
 131+ ?> /> <?php
132132 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
133133 ?>
134134 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
@@ -136,8 +136,8 @@
137137 ?>
138138 </td>
139139 </tr>
140 -<?php
141 -
 140+<?php
 141+
142142 }
143143 }
144144 ?>
@@ -145,7 +145,7 @@
146146 <td></td>
147147 </tr>
148148 </table>
149 -<?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
 149+<?php if ( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
150150 </div>
151151 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
152152 <?php
@@ -154,18 +154,18 @@
155155 }
156156
157157 class SES_SignupFields {
158 -
 158+
159159 public static function render( $args, $parser ) {
160160 $args = func_get_args();
161161
162162 $parser = array_shift( $args );
163 -
 163+
164164 $template = new CreateUserFieldsTemplate();
165165
166166 $template->set( 'header', '' );
167 -
 167+
168168 global $wgEnableEmail, $wgAllowRealName, $wgEmailConfirmToEdit, $wgAuth, $wgUser;
169 -
 169+
170170 $template->set( 'link', '' ); // TODO
171171 $template->set( 'email', '' ); // TODO
172172 $template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() );
@@ -173,27 +173,27 @@
174174 $template->set( 'useemail', $wgEnableEmail );
175175 $template->set( 'emailrequired', $wgEmailConfirmToEdit );
176176 $template->set( 'canreset', $wgAuth->allowPasswordChange() );
177 - //$template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) );
 177+ // $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) );
178178
179179 global $wgLoginLanguageSelector;
180180 # Prepare language selection links as needed
181 - if( $wgLoginLanguageSelector ) {
 181+ if ( $wgLoginLanguageSelector ) {
182182 $template->set( 'languages', $this->makeLanguageSelector() );
183183 }
184184
185185 // Give authentication and captcha plugins a chance to modify the form
186186 $type = 'signup';
187187 $wgAuth->modifyUITemplate( $template, $type );
188 -
 188+
189189 ob_start();
190190 $template->execute();
191191 $text = ob_get_clean();
192 -
 192+
193193 return array(
194194 $text,
195195 'noparse' => true,
196196 'isHTML' => true
197197 );
198198 }
199 -
 199+
200200 }
Index: trunk/extensions/SemanticSignup/includes/SES_DataChecker.php
@@ -5,58 +5,58 @@
66
77 /*
88 * An abstract data getter and checker class.
9 - * Its concrete subclasses should incapsulate all the necessary data getting
10 - * and environment checks.
 9+ * Its concrete subclasses should incapsulate all the necessary data getting
 10+ * and environment checks.
1111 */
1212 abstract class SES_DataChecker
1313 {
1414 private $mError = null;
15 -
 15+
1616 public function getError()
1717 {
1818 return $this->mError;
1919 }
20 -
 20+
2121 /*
22 - * Get a value from the request.
 22+ * Get a value from the request.
2323 * $err_message_id specifies an error that should be thrown
24 - * if the value is empty
 24+ * if the value is empty
2525 */
26 - protected function getUserDataValue($id, $err_message_id = null)
 26+ protected function getUserDataValue( $id, $err_message_id = null )
2727 {
2828 global $wgRequest;
29 - $value = $wgRequest->getText($id);
30 -
31 - if ($err_message_id && !$value)
32 - $this->error(wfMsg($err_message_id));
33 -
 29+ $value = $wgRequest->getText( $id );
 30+
 31+ if ( $err_message_id && !$value )
 32+ $this->error( wfMsg( $err_message_id ) );
 33+
3434 return $value;
3535 }
36 -
37 - //Checks
 36+
 37+ // Checks
3838 private $mEnvCheckCalls = array();
39 -
40 - protected function addCheck($method_callback, array $args)
 39+
 40+ protected function addCheck( $method_callback, array $args )
4141 {
42 - $this->mEnvCheckCalls[] = array($method_callback, $args);
 42+ $this->mEnvCheckCalls[] = array( $method_callback, $args );
4343 }
44 -
 44+
4545 protected function runChecks()
4646 {
47 - foreach ($this->mEnvCheckCalls as $call_array)
 47+ foreach ( $this->mEnvCheckCalls as $call_array )
4848 {
49 - call_user_func_array($call_array[0], $call_array[1]);
 49+ call_user_func_array( $call_array[0], $call_array[1] );
5050 }
5151 }
52 -
53 - //Abstracting error calls in order to make this functionality changeable in subclasses
54 - protected function error($message)
 52+
 53+ // Abstracting error calls in order to make this functionality changeable in subclasses
 54+ protected function error( $message )
5555 {
56 - throw new Exception($message);
 56+ throw new Exception( $message );
5757 }
58 -
 58+
5959 abstract protected function populateData();
60 -
 60+
6161 public function run()
6262 {
6363 try
@@ -64,7 +64,7 @@
6565 $this->populateData();
6666 $this->runChecks();
6767 }
68 - catch (Exception $e)
 68+ catch ( Exception $e )
6969 {
7070 $this->mError = $e->getMessage();
7171 }
Index: trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php
@@ -12,7 +12,7 @@
1313 */
1414
1515 $aliases = array();
16 -
 16+
1717 $aliases['en'] = array(
1818 'SemanticSignup' => array( 'SemanticSignup', 'Semantic Signup' )
1919 );
Index: trunk/extensions/SemanticSignup/SemanticSignup.i18n.php
@@ -13,7 +13,7 @@
1414 */
1515
1616 $messages = array();
17 -
 17+
1818 $messages['en'] = array(
1919 'semanticsignup' => 'Semantic Signup',
2020 'ses-desc' => 'A MediaWiki extension built on top of Semantic Forms allowing to populate a user page with semantic data at signup time',
Index: trunk/extensions/SemanticSignup/SemanticSignup.settings.php
@@ -16,7 +16,7 @@
1717 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1818 */
1919 class SemanticSignupSettings {
20 -
 20+
2121 protected static function getDefaultSettings() {
2222 return array(
2323 'requireName' => false,
@@ -24,23 +24,23 @@
2525 'botName' => '',
2626 );
2727 }
28 -
 28+
2929 public static function getSettings() {
3030 static $settings = false;
31 -
 31+
3232 if ( $settings === false ) {
3333 $settings = array_merge(
3434 self::getDefaultSettings(),
3535 $GLOBALS['egSemanticSignupSettings']
3636 );
3737 }
38 -
 38+
3939 return $settings;
4040 }
41 -
 41+
4242 public static function get( $settingName ) {
4343 $settings = self::getSettings();
44 - return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null;
 44+ return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null;
4545 }
46 -
 46+
4747 }