http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94613
Revision: 94613 Author: siebrand Date: 2011-08-16 08:31:51 +0000 (Tue, 16 Aug 2011) Log Message: ----------- stylize extension Modified Paths: -------------- trunk/extensions/SemanticSignup/INSTALL trunk/extensions/SemanticSignup/SemanticSignup.hooks.php trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php trunk/extensions/SemanticSignup/SemanticSignup.i18n.php trunk/extensions/SemanticSignup/SemanticSignup.php trunk/extensions/SemanticSignup/SemanticSignup.settings.php trunk/extensions/SemanticSignup/includes/SES_DataChecker.php trunk/extensions/SemanticSignup/includes/SES_SignupFields.php trunk/extensions/SemanticSignup/includes/SES_Special.php trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php Modified: trunk/extensions/SemanticSignup/INSTALL =================================================================== --- trunk/extensions/SemanticSignup/INSTALL 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/INSTALL 2011-08-16 08:31:51 UTC (rev 94613) @@ -1,5 +1,5 @@ These is the install file for the SemanticSignup extension. - + Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:SemanticSignup Latest version of the install file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticSignup/INSTALL?view=co Modified: trunk/extensions/SemanticSignup/SemanticSignup.hooks.php =================================================================== --- trunk/extensions/SemanticSignup/SemanticSignup.hooks.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/SemanticSignup.hooks.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -2,12 +2,12 @@ /** * Static class for hooks handled by the SemanticSignup extension. - * + * * @since 0.3 - * + * * @file SemanticSignup.hooks.php * @ingroup SemanticSignup - * + * * @licence GNU GPL v3+ * @author Jeroen De Dauw < jeroended...@gmail.com > */ @@ -17,30 +17,30 @@ * @since 0.3 * * @param $template - * + * * @return false */ public static function onUserCreateForm( $template ) { if ( is_null( Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM ) ) ) { return true; } - + $url = SemanticSignup::getTitleFor( 'SemanticSignup' )->escapeFullURL(); global $wgOut; $wgOut->redirect( $url ); - + return false; } - + /** * @since 0.3 - * + * * @return true */ public static function onParserFirstCallInit() { global $wgParser; $wgParser->setFunctionHook( 'signupfields', 'SES_SignupFields::render' ); - return true; + return true; } } Modified: trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php =================================================================== --- trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/SemanticSignup.i18n.aliases.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -12,7 +12,7 @@ */ $aliases = array(); - + $aliases['en'] = array( 'SemanticSignup' => array( 'SemanticSignup', 'Semantic Signup' ) ); Modified: trunk/extensions/SemanticSignup/SemanticSignup.i18n.php =================================================================== --- trunk/extensions/SemanticSignup/SemanticSignup.i18n.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/SemanticSignup.i18n.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -13,7 +13,7 @@ */ $messages = array(); - + $messages['en'] = array( 'semanticsignup' => 'Semantic Signup', 'ses-desc' => 'A MediaWiki extension built on top of Semantic Forms allowing to populate a user page with semantic data at signup time', Modified: trunk/extensions/SemanticSignup/SemanticSignup.php =================================================================== --- trunk/extensions/SemanticSignup/SemanticSignup.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/SemanticSignup.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -2,7 +2,7 @@ /** * Initialization file for the Semantic Signup extension. - * + * * Documentation: http://www.mediawiki.org/wiki/Extension:SemanticSignup * Support http://www.mediawiki.org/wiki/Extension_talk:SemanticSignup * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticSignup @@ -61,7 +61,7 @@ $wgAutoloadClasses['SemanticSignupSettings'] = dirname( __FILE__ ) . '/SemanticSignup.settings.php'; $wgAutoloadClasses['SemanticSignupHooks'] = dirname( __FILE__ ) . '/SemanticSignup.hooks.php'; $wgAutoloadClasses['SemanticSignup'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; -$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; +$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; $wgAutoloadClasses['SES_DataChecker'] = dirname( __FILE__ ) . '/includes/SES_DataChecker.php'; $wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_UserAccountDataChecker.php'; $wgAutoloadClasses['SES_SignupFields'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php'; Modified: trunk/extensions/SemanticSignup/SemanticSignup.settings.php =================================================================== --- trunk/extensions/SemanticSignup/SemanticSignup.settings.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/SemanticSignup.settings.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -16,7 +16,7 @@ * @author Jeroen De Dauw < jeroended...@gmail.com > */ class SemanticSignupSettings { - + protected static function getDefaultSettings() { return array( 'requireName' => false, @@ -24,23 +24,23 @@ 'botName' => '', ); } - + public static function getSettings() { static $settings = false; - + if ( $settings === false ) { $settings = array_merge( self::getDefaultSettings(), $GLOBALS['egSemanticSignupSettings'] ); } - + return $settings; } - + public static function get( $settingName ) { $settings = self::getSettings(); - return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null; + return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null; } - + } Modified: trunk/extensions/SemanticSignup/includes/SES_DataChecker.php =================================================================== --- trunk/extensions/SemanticSignup/includes/SES_DataChecker.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/includes/SES_DataChecker.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -5,58 +5,58 @@ /* * An abstract data getter and checker class. - * Its concrete subclasses should incapsulate all the necessary data getting - * and environment checks. + * Its concrete subclasses should incapsulate all the necessary data getting + * and environment checks. */ abstract class SES_DataChecker { private $mError = null; - + public function getError() { return $this->mError; } - + /* - * Get a value from the request. + * Get a value from the request. * $err_message_id specifies an error that should be thrown - * if the value is empty + * if the value is empty */ - protected function getUserDataValue($id, $err_message_id = null) + protected function getUserDataValue( $id, $err_message_id = null ) { global $wgRequest; - $value = $wgRequest->getText($id); - - if ($err_message_id && !$value) - $this->error(wfMsg($err_message_id)); - + $value = $wgRequest->getText( $id ); + + if ( $err_message_id && !$value ) + $this->error( wfMsg( $err_message_id ) ); + return $value; } - - //Checks + + // Checks private $mEnvCheckCalls = array(); - - protected function addCheck($method_callback, array $args) + + protected function addCheck( $method_callback, array $args ) { - $this->mEnvCheckCalls[] = array($method_callback, $args); + $this->mEnvCheckCalls[] = array( $method_callback, $args ); } - + protected function runChecks() { - foreach ($this->mEnvCheckCalls as $call_array) + foreach ( $this->mEnvCheckCalls as $call_array ) { - call_user_func_array($call_array[0], $call_array[1]); + call_user_func_array( $call_array[0], $call_array[1] ); } } - - //Abstracting error calls in order to make this functionality changeable in subclasses - protected function error($message) + + // Abstracting error calls in order to make this functionality changeable in subclasses + protected function error( $message ) { - throw new Exception($message); + throw new Exception( $message ); } - + abstract protected function populateData(); - + public function run() { try @@ -64,7 +64,7 @@ $this->populateData(); $this->runChecks(); } - catch (Exception $e) + catch ( Exception $e ) { $this->mError = $e->getMessage(); } Modified: trunk/extensions/SemanticSignup/includes/SES_SignupFields.php =================================================================== --- trunk/extensions/SemanticSignup/includes/SES_SignupFields.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/includes/SES_SignupFields.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -2,12 +2,12 @@ /* * Created on 6 Jan 2009 by Serhii Kutnii */ - + /* * Borrowed from standard UsercreateTemplate. Some minor changes have been made */ - -class CreateUserFieldsTemplate extends QuickTemplate + +class CreateUserFieldsTemplate extends QuickTemplate { function addInputItem( $name, $value, $type, $msg ) { $this->data['extraInput'][] = array( @@ -17,19 +17,19 @@ 'msg' => $msg, ); } - + function execute() { - + ?> <div id="userlogin"> - <h2><?php $this->msg('createaccount') ?></h2> - <p id="userloginlink"><?php $this->html('link') ?></p> - <?php $this->html('header'); /* pre-table point for form plugins... */ ?> - <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?> + <h2><?php $this->msg( 'createaccount' ) ?></h2> + <p id="userloginlink"><?php $this->html( 'link' ) ?></p> + <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?> + <?php if ( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?> <table> <tr> - <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td> + <td class="mw-label"><label for='wpName2'><?php $this->msg( 'yourname' ) ?></label></td> <td class="mw-input"> <input type='text' class='loginText' name="wpName" id="wpName2" tabindex="1" @@ -37,16 +37,16 @@ </td> </tr> <tr> - <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td> + <td class="mw-label"><label for='wpPassword2'><?php $this->msg( 'yourpassword' ) ?></label></td> <td class="mw-input"> <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2" tabindex="2" value="" size='20' /> </td> </tr> - <?php if( $this->data['usedomain'] ) { + <?php if ( $this->data['usedomain'] ) { $doms = ""; - foreach( $this->data['domainnames'] as $dom ) { + foreach ( $this->data['domainnames'] as $dom ) { $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>"; } ?> @@ -61,7 +61,7 @@ </tr> <?php } ?> <tr> - <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td> + <td class="mw-label"><label for='wpRetype'><?php $this->msg( 'yourpasswordagain' ) ?></label></td> <td class="mw-input"> <input type='password' class='loginPassword' name="wpRetype" id="wpRetype" tabindex="4" @@ -70,25 +70,25 @@ </td> </tr> <tr> - <?php if( $this->data['useemail'] ) { ?> - <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td> + <?php if ( $this->data['useemail'] ) { ?> + <td class="mw-label"><label for='wpEmail'><?php $this->msg( 'youremail' ) ?></label></td> <td class="mw-input"> <input type='text' class='loginText' name="wpEmail" id="wpEmail" tabindex="5" - value="<?php $this->text('email') ?>" size='20' /> + value="<?php $this->text( 'email' ) ?>" size='20' /> <div class="prefsectiontip"> - <?php if( $this->data['emailrequired'] ) { - $this->msgWiki('prefs-help-email-required'); + <?php if ( $this->data['emailrequired'] ) { + $this->msgWiki( 'prefs-help-email-required' ); } else { - $this->msgWiki('prefs-help-email'); + $this->msgWiki( 'prefs-help-email' ); } ?> </div> </td> <?php } ?> - <?php if( $this->data['userealname'] ) { ?> + <?php if ( $this->data['userealname'] ) { ?> </tr> <tr> - <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td> + <td class="mw-label"><label for='wpRealName'><?php $this->msg( 'yourrealname' ) ?></label></td> <td class="mw-input"> <input type='text' class='loginText' name="wpRealName" id="wpRealName" tabindex="6" @@ -104,9 +104,9 @@ if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) { foreach ( $this->data['extraInput'] as $inputItem ) { ?> <tr> - <?php + <?php if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) { - ?><td class="mw-label"><label for="<?php + ?><td class="mw-label"><label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php $this->msgWiki( $inputItem['msg'] ) ?></label><?php } else { @@ -117,17 +117,17 @@ <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php echo htmlspecialchars( $inputItem['name'] ); ?>" tabindex="<?php echo $tabIndex++; ?>" - value="<?php + value="<?php if ( $inputItem['type'] != 'checkbox' ) { echo htmlspecialchars( $inputItem['value'] ); } else { echo '1'; - } + } ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>" - <?php + <?php if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) ) - echo 'checked="checked"'; - ?> /> <?php + echo 'checked="checked"'; + ?> /> <?php if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) { ?> <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php @@ -136,8 +136,8 @@ ?> </td> </tr> -<?php - +<?php + } } ?> @@ -145,7 +145,7 @@ <td></td> </tr> </table> -<?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?> +<?php if ( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?> </div> <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div> <?php @@ -154,18 +154,18 @@ } class SES_SignupFields { - + public static function render( $args, $parser ) { $args = func_get_args(); $parser = array_shift( $args ); - + $template = new CreateUserFieldsTemplate(); $template->set( 'header', '' ); - + global $wgEnableEmail, $wgAllowRealName, $wgEmailConfirmToEdit, $wgAuth, $wgUser; - + $template->set( 'link', '' ); // TODO $template->set( 'email', '' ); // TODO $template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() ); @@ -173,27 +173,27 @@ $template->set( 'useemail', $wgEnableEmail ); $template->set( 'emailrequired', $wgEmailConfirmToEdit ); $template->set( 'canreset', $wgAuth->allowPasswordChange() ); - //$template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) ); + // $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) ); global $wgLoginLanguageSelector; # Prepare language selection links as needed - if( $wgLoginLanguageSelector ) { + if ( $wgLoginLanguageSelector ) { $template->set( 'languages', $this->makeLanguageSelector() ); } // Give authentication and captcha plugins a chance to modify the form $type = 'signup'; $wgAuth->modifyUITemplate( $template, $type ); - + ob_start(); $template->execute(); $text = ob_get_clean(); - + return array( $text, 'noparse' => true, 'isHTML' => true ); } - + } Modified: trunk/extensions/SemanticSignup/includes/SES_Special.php =================================================================== --- trunk/extensions/SemanticSignup/includes/SES_Special.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/includes/SES_Special.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -5,7 +5,7 @@ * a Semantic Forms form page that allows for signup with * adittional (structured) data that immediately gets entered * onto the user page of the new user. - * + * * @file SES_Special.php * @ingroup SemanticSignup * @@ -13,34 +13,34 @@ * @author Jeroen De Dauw < jeroended...@gmail.com > */ class SemanticSignup extends SpecialPage { - + private $mUserDataChecker = null; private $mUserPageUrl = ''; - + public function __construct() { parent::__construct( 'SemanticSignup' ); $this->mIncludable = false; $this->mUserDataChecker = new SES_UserAccountDataChecker(); } - + private function userSignup() { - //Get user input and check the environment + // Get user input and check the environment $this->mUserDataChecker->run(); - - //Throw if data getting or environment checks have failed which indicates that account creation is impossible + + // Throw if data getting or environment checks have failed which indicates that account creation is impossible $checker_error = $this->mUserDataChecker->getError(); if ( $checker_error ) { throw new Exception( $checker_error ); } - - $user = $this->mUserDataChecker->mUser; - + + $user = $this->mUserDataChecker->mUser; + $user->setEmail( $this->mUserDataChecker->mEmail ); $user->setRealName( $this->mUserDataChecker->mRealname ); - + $abortError = ''; - if( !wfRunHooks( 'AbortNewAccount', array( $user, &$abortError ) ) ) { + if ( !wfRunHooks( 'AbortNewAccount', array( $user, &$abortError ) ) ) { // Hook point to add extra creation throttles and blocks wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" ); throw new Exception( $abortError ); @@ -48,36 +48,36 @@ global $wgAccountCreationThrottle; global $wgUser; - + if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) { $key = wfMemcKey( 'acctcreate', 'ip', wfGetIP() ); $value = $wgMemc->incr( $key ); - + if ( !$value ) { $wgMemc->set( $key, 1, 86400 ); } - + if ( $value > $wgAccountCreationThrottle ) { - throw new Exception(wfMsg('ses-throttlehit')); + throw new Exception( wfMsg( 'ses-throttlehit' ) ); } } - + global $wgAuth; - + $addedUser = $wgAuth->addUser( $user, - $this->mUserDataChecker->mPassword, + $this->mUserDataChecker->mPassword, $this->mUserDataChecker->mEmail, $this->mUserDataChecker->mRealname ); - - if( !$addedUser ) { + + if ( !$addedUser ) { throw new Exception( 'externaldberror' ); - } - - + } + + $user->addToDatabase(); - + if ( $wgAuth->allowPasswordChange() ) { $user->setPassword( $this->mUserDataChecker->mPassword ); } @@ -95,39 +95,39 @@ global $wgLoginLanguageSelector; $language = $this->mUserDataChecker->mLanguage; - - if( $wgLoginLanguageSelector && $language ) { + + if ( $wgLoginLanguageSelector && $language ) { $user->setOption( 'language', $language ); } - + global $wgEmailAuthentication; - - if( $wgEmailAuthentication && User::isValidEmailAddr( $user->getEmail() ) ) { + + if ( $wgEmailAuthentication && User::isValidEmailAddr( $user->getEmail() ) ) { $status = $user->sendConfirmationMail(); - + if ( !$status->isGood() ) { throw new Exception( wfMsg( 'ses-emailfailed' ) . "\n" . $status->getMessage() ); } } - + $user->saveSettings(); wfRunHooks( 'AddNewAccount', array( $user ) ); } - + private function createUserPage() { $form_title = Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM ); $form = new Article( $form_title ); $form_definition = $form->getContent(); - + $page_title = Title::newFromText( $this->mUserDataChecker->mUser->getName(), NS_USER ); $this->mUserPageUrl = $page_title->escapeFullUrl(); global $sfgFormPrinter; - list ($form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name) = - $sfgFormPrinter->formHTML($form_definition, true, false); + list ( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name ) = + $sfgFormPrinter->formHTML( $form_definition, true, false ); $user_page = new Article( $page_title ); - + global $wgUser; $wgUser = $this->mUserDataChecker->mUser; // TODO: doEdit removed; use internal API call @@ -138,30 +138,30 @@ global $wgUser; /* - * SemanticForms disable the form automatically if current user hasn't got edit rights - * so we have to use a bot account for the form request. Current user is being saved in + * SemanticForms disable the form automatically if current user hasn't got edit rights + * so we have to use a bot account for the form request. Current user is being saved in * the $old_user variable to be restored afterwards */ $old_user = null; - if ( $wgUser->isAnon() ) { + if ( $wgUser->isAnon() ) { $old_user = $wgUser; $wgUser = User::newFromName( SemanticSignupSettings::get( 'botName' ) ); } - + $form_title = Title::newFromText( SemanticSignupSettings::get( 'formName' ), SF_NS_FORM ); $form = new Article( $form_title ); $form_definition = $form->getContent(); - + global $sfgFormPrinter; - - list ($form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name) = - $sfgFormPrinter->formHTML($form_definition, false, false); - - $text =<<<END + + list ( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name ) = + $sfgFormPrinter->formHTML( $form_definition, false, false ); + + $text = <<<END <form name="createbox" onsubmit="return validate_all()" action="" method="post" class="createbox"> END; - $text .= $form_text.'</form>'; - + $text .= $form_text . '</form>'; + global $sfgScriptPath, $sfgYUIBase, $wgOut; $mainCssUrl = $sfgScriptPath . '/skins/SF_main.css'; $wgOut->addLink( array( @@ -169,85 +169,85 @@ 'type' => 'text/css', 'media' => "screen, projection", 'href' => $mainCssUrl - )); + ) ); $wgOut->addLink( array( 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => "screen, projection", 'href' => $sfgYUIBase . "autocomplete/assets/skins/sam/autocomplete.css" - )); + ) ); $wgOut->addLink( array( 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => "screen, projection", 'href' => $sfgScriptPath . '/skins/SF_yui_autocompletion.css' - )); + ) ); $wgOut->addLink( array( 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => "screen, projection", 'href' => $sfgScriptPath . '/skins/floatbox.css' - )); - + ) ); + // FIXME: wtf? - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'yahoo/yahoo-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'dom/dom-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'event/event-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'get/get-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'connection/connection-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'json/json-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'datasource/datasource-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgYUIBase . 'autocomplete/autocomplete-min.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/SF_yui_autocompletion.js"></script>' . "\n"); - $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/floatbox.js"></script>' . "\n"); - + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'yahoo/yahoo-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'dom/dom-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'event/event-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'get/get-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'connection/connection-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'json/json-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'datasource/datasource-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgYUIBase . 'autocomplete/autocomplete-min.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/SF_yui_autocompletion.js"></script>' . "\n" ); + $wgOut->addScript( '<script type="text/javascript" src="' . $sfgScriptPath . '/libs/floatbox.js"></script>' . "\n" ); + global $wgFCKEditorDir; if ( $wgFCKEditorDir ) { - $wgOut->addScript('<script type="text/javascript" src="' . "$wgScriptPath/$wgFCKEditorDir" . '/fckeditor.js"></script>' . "\n"); + $wgOut->addScript( '<script type="text/javascript" src="' . "$wgScriptPath/$wgFCKEditorDir" . '/fckeditor.js"></script>' . "\n" ); } - + if ( !empty( $javascript_text ) ) { - $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n"); + $wgOut->addScript( ' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n" ); } - + $wgOut->addMeta( 'robots', 'noindex,nofollow' ); $wgOut->addHTML( $text ); - + // Restore the current user. if ( $old_user ) { $wgUser = $old_user; } } - + private function executeOnSubmit() { global $wgOut; - + try { $this->userSignup(); $this->createUserPage(); - + $wgOut->redirect( $this->mUserPageUrl ); - } + } catch ( Exception $e ) { $wgOut->addHTML( '<div class="error">' . $e->getMessage() . '</div>' ); $this->printForm(); } - + return true; - } - + } + public function execute( $par ) { global $wgRequest, $wgOut; - + $this->setHeaders(); - + if ( $wgRequest->getCheck( 'wpSave' ) ) { return $this->executeOnSubmit(); } else { $this->printForm(); return true; - } + } } - + } \ No newline at end of file Modified: trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php =================================================================== --- trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php 2011-08-16 08:30:41 UTC (rev 94612) +++ trunk/extensions/SemanticSignup/includes/SES_UserAccountDataChecker.php 2011-08-16 08:31:51 UTC (rev 94613) @@ -1,10 +1,10 @@ -<?php +<?php /** * Created on 7 Jan 2008 by Serhii Kutnii */ class SES_UserAccountDataChecker extends SES_DataChecker { - + public $mUsername = ''; public $mPassword = ''; public $mEmail = ''; @@ -13,7 +13,7 @@ public $mLanguage = ''; public $mRemember = false; public $mUser = null; - + protected function populateData() { $this->mUsername = $this->getUserDataValue( 'wpName', 'nousername' ); $name = trim( $this->mUsername ); @@ -21,53 +21,53 @@ if ( !$this->mUser ) { $this->error( wfMsg( 'ses-noname' ) ); } - + global $sesRealNameRequired; - $this->mRealname = $this->getUserDataValue('wpRealName', $sesRealNameRequired ? 'norealname' : null); - - $this->mPassword = $this->getUserDataValue('wpPassword'); - $retype = $this->getUserDataValue('wpRetype'); - if (strcmp($this->mPassword, $retype)) - $this->error(wfMsg('ses-nopwdmatch')); - - $this->mDomain = $this->getUserDataValue('wpDomain'); - + $this->mRealname = $this->getUserDataValue( 'wpRealName', $sesRealNameRequired ? 'norealname' : null ); + + $this->mPassword = $this->getUserDataValue( 'wpPassword' ); + $retype = $this->getUserDataValue( 'wpRetype' ); + if ( strcmp( $this->mPassword, $retype ) ) + $this->error( wfMsg( 'ses-nopwdmatch' ) ); + + $this->mDomain = $this->getUserDataValue( 'wpDomain' ); + global $wgEmailConfirmToEdit; - $this->mEmail = $this->getUserDataValue('wpEmail', $wgEmailConfirmToEdit ? 'noemailtitle' : null ); - - $this->mLanguage = $this->getUserDataValue('uselang'); - + $this->mEmail = $this->getUserDataValue( 'wpEmail', $wgEmailConfirmToEdit ? 'noemailtitle' : null ); + + $this->mLanguage = $this->getUserDataValue( 'uselang' ); + global $wgRequest; - $this->mRemember = $wgRequest->getCheck('wpRemember'); + $this->mRemember = $wgRequest->getCheck( 'wpRemember' ); } - - //Checks - + + // Checks + public function checkDomainValidity() { global $wgAuth; - - if( !$wgAuth->validDomain( $this->mDomain ) ) - $this->error(wfMsg('wrongpassword')); + + if ( !$wgAuth->validDomain( $this->mDomain ) ) + $this->error( wfMsg( 'wrongpassword' ) ); } - + public function checkDomainUser() { global $wgAuth; - if( ('local' != $this->mDomain) && ('' != $this->mDomain) - && !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists($this->mName) || !$wgAuth->authenticate($this->mName, $this->mPassword) ) ) - $this->error(wfMsg('wrongpassword')); + if ( ( 'local' != $this->mDomain ) && ( '' != $this->mDomain ) + && !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mName ) || !$wgAuth->authenticate( $this->mName, $this->mPassword ) ) ) + $this->error( wfMsg( 'wrongpassword' ) ); } - + public function checkCreatePermissions() { global $wgUser; - - if (!$wgUser->isAllowed( 'createaccount' ) || $wgUser->isBlockedFromCreateAccount() ) - $this->error(wfMsg('ses-createforbidden')); + + if ( !$wgUser->isAllowed( 'createaccount' ) || $wgUser->isBlockedFromCreateAccount() ) + $this->error( wfMsg( 'ses-createforbidden' ) ); } - + public function checkSorbs() { global $wgProxyWhitelist; @@ -75,39 +75,39 @@ $ip = wfGetIP(); if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) && $wgUser->inSorbsBlacklist( $ip ) ) - $this->error(wfMsg('sorbs_create_account_reason')); + $this->error( wfMsg( 'sorbs_create_account_reason' ) ); } - + public function checkUserExists() { - if ($this->mUser->idForName()) - $this->error(wfMsg('ses-userexists')); + if ( $this->mUser->idForName() ) + $this->error( wfMsg( 'ses-userexists' ) ); } - + public function checkPasswordLength() { - if (!$this->mUser->isValidPassword($this->mPassword)) + if ( !$this->mUser->isValidPassword( $this->mPassword ) ) { global $wgMinimalPasswordLength; - $this->error(wfMsgExt('passwordtooshort', array( 'parsemag' ), $wgMinimalPasswordLength)); + $this->error( wfMsgExt( 'passwordtooshort', array( 'parsemag' ), $wgMinimalPasswordLength ) ); } } - + public function checkEmailValidity() { global $wgEnableEmail; - if ($wgEnableEmail && !User::isValidEmailAddr($this->mEmail)) - $this->error(wfMsg('invalidemailaddress')); + if ( $wgEnableEmail && !User::isValidEmailAddr( $this->mEmail ) ) + $this->error( wfMsg( 'invalidemailaddress' ) ); } - + public function __construct() { - $this->addCheck(array(&$this, 'checkDomainValidity'), array()); - $this->addCheck(array(&$this, 'checkDomainUser'), array()); - $this->addCheck(array(&$this, 'checkCreatePermissions'), array()); - $this->addCheck(array(&$this, 'checkSorbs'), array()); - $this->addCheck(array(&$this, 'checkUserExists'), array()); - $this->addCheck(array(&$this, 'checkPasswordLength'), array()); - $this->addCheck(array(&$this, 'checkEmailValidity'), array()); + $this->addCheck( array( &$this, 'checkDomainValidity' ), array() ); + $this->addCheck( array( &$this, 'checkDomainUser' ), array() ); + $this->addCheck( array( &$this, 'checkCreatePermissions' ), array() ); + $this->addCheck( array( &$this, 'checkSorbs' ), array() ); + $this->addCheck( array( &$this, 'checkUserExists' ), array() ); + $this->addCheck( array( &$this, 'checkPasswordLength' ), array() ); + $this->addCheck( array( &$this, 'checkEmailValidity' ), array() ); } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs