public function index() { global $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgSuppressFooter, $wgSuppressAds, $wgSuppressToolbar, $fbOnLoginJsOverride, $wgRequest, $wgUser; wfProfileIn(__METHOD__); // hide some default oasis UI things $wgSuppressWikiHeader = true; $wgSuppressPageHeader = true; $wgSuppressFooter = false; $wgSuppressAds = true; $wgSuppressToolbar = true; // store the fact we're on CNW F::app()->wg->atCreateNewWikiPage = true; // reuiqred for FB Connect to work $this->response->addAsset('extensions/wikia/UserLogin/js/UserLoginFacebookPageInit.js'); // fbconnected means user has gone through step 2 to login via facebook. // Therefore, we need to reload some values and start at the step after signup/login $fbconnected = $wgRequest->getVal('fbconnected'); $fbreturn = $wgRequest->getVal('fbreturn'); if (!empty($fbconnected) && $fbconnected === '1' || !empty($fbreturn) && $fbreturn === '1') { $this->LoadState(); $this->currentStep = 'DescWiki'; } else { $this->currentStep = ''; } // form field values $hubs = WikiFactoryHub::getInstance(); $this->aCategories = $hubs->getCategories(); $this->aTopLanguages = explode(',', wfMsg('autocreatewiki-language-top-list')); $languages = wfGetFixedLanguageNames(); asort($languages); $this->aLanguages = $languages; $useLang = $wgRequest->getVal('uselang', $wgUser->getOption('language')); // falling back to english (BugId:3538) if (!array_key_exists($useLang, $this->aLanguages)) { $useLang = 'en'; } $params['wikiLanguage'] = empty($useLang) ? $this->wg->LanguageCode : $useLang; // precedence: selected form field, uselang, default wiki lang // facebook callback overwrite on login. CreateNewWiki re-uses current login stuff. $fbOnLoginJsOverride = 'WikiBuilder.fbLoginCallback();'; // export info if user is logged in $this->isUserLoggedIn = $wgUser->isLoggedIn(); // remove wikia plus for now for all languages $this->skipWikiaPlus = true; $this->keys = CreateNewWikiObfuscate::generateValidSeeds(); $_SESSION['cnw-answer'] = CreateNewWikiObfuscate::generateAnswer($this->keys); // prefill $params['wikiName'] = $wgRequest->getVal('wikiName', ''); $params['wikiDomain'] = $wgRequest->getVal('wikiDomain', ''); $this->params = $params; $this->signupUrl = ''; if (!empty($this->wg->EnableUserLoginExt)) { $signupTitle = Title::newFromText('UserSignup', NS_SPECIAL); $this->signupUrl = $signupTitle->getFullURL(); } wfProfileOut(__METHOD__); }
function execute($modal = false) { global $wgOut, $wgStylePath, $wgStyleVersion, $wgBlankImgUrl; $wgOut->addScript('<link rel="stylesheet" type="text/css" href="' . $wgStylePath . '/wikia/common/NewUserRegister.css?' . $wgStyleVersion . "\" />\n"); if (!array_key_exists('message', $this->data)) { $this->data['message'] = ""; } if (!array_key_exists('ajax', $this->data)) { $this->data['ajax'] = ""; } ?> <div id="fbConnectModal" title="<?php $this->msg('fbconnect-modal-title'); ?> " > <?php if ($this->data['message'] && !$this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> </h2> <?php } ?> <?php $this->html('message'); ?> </div> <?php } ?> <div class="visualClear"></div> <div id="userloginErrorBox" style="margin-bottom:0;" > <table> <tr> <td style="vertical-align:top;"> <span style="position: relative; top: -1px;"><img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> </td> <td> <div id="userloginInnerErrorBox"></div> </td> </table> </div> <table id="userloginSpecial" style='margin-top:0px;cell-spacing:0px' width="100%"> <tr> <td width="55%" style="border:none; vertical-align: top;"> <div id="userRegisterAjax"> <form id="fb_userajaxregisterform" method="post" action="<?php $this->text('actioncreate'); ?> "> <input type='hidden' name='wpNameChoice' value='manual' /> <?php if ($this->data['message'] && $this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box" style="margin:0px"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> :</h2> <?php } ?> <?php $this->html('message'); ?> </div> <div class="visualClear"></div> <?php } ?> <?php $this->html('header'); /* pre-table point for form plugins... */ ?> <?php /* LoginLanguageSelector used to be here, moved downward and modified as part of rt#16889 */ ?> <table class="wpAjaxRegisterTable" style="width: 573px;" > <colgroup> <col width="275" /> <col width="330" /> </colgroup> <tr class="wpAjaxLoginPreLine" > <td class="wpAjaxLoginInput" id="wpFBNameTD"> <label for='wpName2'><?php $this->msg('yourname'); ?> </label><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='text' name="wpName2" id="wpFBName" value="<?php $this->text('name'); ?> " size='20' /> </td> <td rowspan="3" id="wpFBLoginInfo" > <div> <?php echo wfMsg('fbconnect-msg-for-existing-users', array("\$1" => Title::makeTitle(NS_SPECIAL, "Signup")->getFullUrl(array("showLoginAndConnect" => "true")))); ?> </div> </td> </tr> <tr class="wpAjaxLoginPreLine" > <td class="wpAjaxLoginInput" id="wplangTD"> <?php global $wgLanguageCode; $aLanguages = wfGetFixedLanguageNames(); // If we have a language setting from facebook, just hide that in the form, otherwise show // the normal dropdown. $allLanguageCodes = array_keys($aLanguages); // We get a language code from facebook, so we have to see if it is one we can use. $uselang = false; //(isset($this->data['uselang'])?$this->data['uselang']:""); if ($uselang && in_array($uselang, $allLanguageCodes)) { print "<input type='hidden' name='uselang' id='uselang' value='{$uselang}'/>\n"; } else { // If we didn't get an acceptable language from facebook, display the form. ?> <label for='uselang'><?php $this->msg('yourlanguage'); ?> </label> <br> <select style="height:22px;" name="uselang" id="uselang"><?php $aTopLanguages = explode(',', wfMsg('wikia-language-top-list')); asort($aLanguages); if (!empty($aTopLanguages) && is_array($aTopLanguages)) { ?> <optgroup label="<?php echo wfMsg('wikia-language-top', count($aTopLanguages)); ?> "> <?php $isSelected = false; foreach ($aTopLanguages as $sLang) { $selected = ''; if (!$isSelected && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $aLanguages[$sLang]; ?> </option> <?php } ?> </optgroup> <?php } ?> <optgroup label="<?php echo wfMsg('wikia-language-all'); ?> "> <?php if (!empty($aLanguages) && is_array($aLanguages)) { ?> <?php $isSelected = false; foreach ($aLanguages as $sLang => $sLangName) { $selected = ''; if (empty($isSelected) && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $sLangName; ?> </option> <?php } ?> </optgroup> <?php } ?> </select> <?php } ?> <?php /* <td class="mw-input" rowspan="2" style='vertical-align:top;'> <div id="msgToExistingUsers" style="width:240px;"> <?php // The login button should open the ajax login dialog and select the login-and-connect form. $jsHref = "openLoginAndConnect();return false;"; print wfMsg('fbconnect-msg-for-existing-users', $jsHref); ?> </div> */ ?> </td> </tr> <tr class="wpAjaxLoginPreLine" > <td class="wpAjaxLoginInput" id="wpFBEmailTD"> <?php if ($this->data['useemail']) { ?> <label for='wpEmail'><?php echo wfMsg('fbconnect-signup-mail'); ?> </label><a style='float:left' id="wpEmailInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='text' name="wpEmail" id="wpFBEmail" value="<?php $this->text('email'); ?> " size='20' /> <?php } ?> </tr> <tr class="wpAjaxLoginPreLine" > <td class="mw-input" style="padding-top:5px;" colspan="2" > <?php $tabIndex = 8; if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) { foreach ($this->data['extraInput'] as $inputItem) { ?> <?php if (!empty($inputItem['msg']) && $inputItem['type'] != 'checkbox') { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> "><?php $this->msgWiki($inputItem['msg']); ?> </label><?php } ?> <input style="float:left;" type="<?php echo htmlspecialchars($inputItem['type']); ?> " name="<?php echo htmlspecialchars($inputItem['name']); ?> " tabindex="<?php echo $tabIndex++; ?> " value="<?php if ($inputItem['type'] != 'checkbox') { echo htmlspecialchars($inputItem['value']); } else { echo '1'; } ?> " id="<?php echo htmlspecialchars($inputItem['name']); ?> " <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['value'])) { echo 'checked="checked"'; } ?> /> <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['msg'])) { ?> <span class="fbConnectCblable" ><?php $this->msgHtml($inputItem['msg']); ?> </span><?php } ?> <?php // The checkboxes for which fields to auto-update on every future facebook connection for this user. print $this->html('updateOptions'); ?> <?php } } ?> </td> </tr> <tr class="wpAjaxLoginPreLine" > <td class="mw-input" colspan="2"> <div id="termsOfUse"> <?php $this->msgWiki('prefs-help-terms'); ?> </div> </td> </tr> <?php global $fbEnablePushToFacebook; if (!empty($fbEnablePushToFacebook)) { ?> <tr id='fbConnectPushEventBar' > <td colspan='2' class="fbConnectPushEventBar" > <?php print wfMsg('fbconnect-prefsheader'); ?> </td> </tr> <tr> <td colspan='2' id="fbConnectPushEventBarButton" class="fbConnectPushEventBarlink" > <a id='fbConnectPushEventBar_show' href='#'><?php echo wfMsg("fbconnect-prefs-show"); ?> </a> <a id='fbConnectPushEventBar_hide' href='#' style='display:none'><?php echo wfMsg("fbconnect-prefs-hide"); ?> </a> </td> </tr> <tr> <td class="fbConnectPushEventToggles" style='display:none' > <?php echo wfMsg('fbconnect-prefs-post'); ?> <br><br> </td> </tr> <?php $prefs = FBConnectPushEvent::getPreferencesToggles(true); ?> <?php foreach ($prefs as $key => $value) { ?> <?php if ($key % 2 == 0) { ?> <tr class='wpAjaxLoginPreLine fbConnectPushEventToggles' style='display:none'> <?php } ?> <td <?php if (!empty($value['fullLine'])) { ?> colspan=2 <?php } ?> > <input <?php if (!empty($value['checked'])) { ?> checked="checked" <?php } ?> type='checkbox' value='1' id="<?php echo $value['id']; ?> " name="<?php echo $value['name']; ?> "/> <label for="<?php echo $value['id']; ?> "><?php echo $value['shortText']; ?> </label> </td> <?php if ($key % 2 == 1 || count($prefs) - 1 == $key) { ?> </tr> <?php } ?> <?php } ?> <?php } ?> </table> <input type="submit" value="Register" style="position: absolute; left: -10000px; width: 0" /> <?php if (@$this->haveData('uselang')) { ?> <input type="hidden" name="uselang" value="<?php $this->text('uselang'); ?> " /><?php } ?> <input type="hidden" id="wpCreateaccountXSteer" name="wpCreateaccount" value="true" > </div> </td> </tr> </table> <div id="signupWhyProvide"></div> <div id="signupend" style="clear: both;height: 12px;"><?php $this->msgWiki('signupend'); ?> </div> <div class="modalToolbar neutral"> <input type="submit" id="wpCreateaccountXSteer" name="wpCreateaccountMail" onclick="return UserRegistration.submitForm_fb();" value="<?php print wfMsg("createaccount"); ?> " /> <!-- <input type="button" id="wpCreateaccountClose" class="secondary" onclick="AjaxLogin.close(); return false;" value="<?php print wfMsg("Cancel"); ?> " /> --> </div> </form> </div> <script type='text/javascript'> var prefs_help_mailmesg = "<?php echo str_replace("\n", " ", wfMsg('prefs-help-mailmesg')); ?> "; var prefs_help_email = "<?php echo str_replace("\n", " ", wfMsg('prefs-help-email')); ?> "; $(document).ready(function(){ //override submitForm UserRegistration = {}; $('#wpEmailInfo').bind('click', function(){ $.showModal(prefs_help_mailmesg, prefs_help_email, { 'id': 'wpEmailInfoModal' }); }); UserRegistration.errorMessages = { main: '<?php echo addslashes(wfMsg('userlogin-form-error')); ?> ', username: '******'noname')); ?> ', email: '<?php echo addslashes(wfMsg('userlogin-bad-email')); ?> ' }; UserRegistration.checkEmail = function() { var email = $('#wpFBEmail').val(); if (email == '' || (!email.match(/^[a-z0-9._%+-]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4}$/mi)) ) { UserRegistration.toggleError('wpFBEmailTD', 'err'); return false; } UserRegistration.toggleError('wpFBEmailTD', 'ok') return true; } UserRegistration.checkUsername = function(callback) { UserRegistration.checkUsername.statusAjax = true; UserRegistration.toggleError('wpFBNameTD', 'progress'); $.getJSON(wgScript + '?action=ajax&rs=cxValidateUserName', {uName: $('#wpFBName').val()}, function(json){ UserRegistration.checkUsername.statusAjax = false; if (json.result == 'OK') { UserRegistration.toggleError('wpFBNameTD', 'ok'); $("#wpFBNameError").hide(); callback(true); } else { UserRegistration.toggleError('wpFBNameTD', 'err'); $("#wpFBNameError").show(); callback(false, json.msg); } }); } UserRegistration.toggleError = function(id, show) { if (show == 'ok') { $('#' + id + ' img:first').removeClass().addClass('sprite ok'); } else if (show == 'clear') { $('#' + id + ' img:first').removeClass(); } else if (show == 'progress') { $('#' + id + ' img:first').removeClass().addClass('sprite progress'); } else { $('#' + id + ' img:first').removeClass().addClass('sprite error'); } } UserRegistration.submitForm_fb = function() { var errors = []; var errorsHTML = ''; UserRegistration.checkUsername( function(username_status, msg) { if( username_status && UserRegistration.checkEmail() ) { $("#fb_userajaxregisterform").submit(); return true; } else { $('#userloginErrorBox').show(); var errors = []; var errorsHTML = ''; if ( !username_status ) { errors.push(msg); } if ( !UserRegistration.checkEmail() ) errors.push(UserRegistration.errorMessages['email']); if (errors.length == 1) { //one errorsHTML = errors[0]; $('#userloginInnerErrorBox').html(errorsHTML); } else { //more errorsHTML = '<strong>' + UserRegistration.errorMessages['main'] + '</strong><ul>'; for (err in errors) errorsHTML += '<li>' + errors[err] + '</li>'; errorsHTML += '</ul>'; $('#userloginInnerErrorBox').html(errorsHTML); } } } ); } UserRegistration.checkUsername(function() {}); $('#wpFBName').change( function() { UserRegistration.checkUsername(function() {}); } ); $('#wpFBEmail').change( UserRegistration.checkEmail ); // Control show/hide of push-event preferences. $('#fbConnectPushEventBar_show').click(function(){ $('#fbConnectPushEventBar_show').hide(); $('.fbConnectPushEventToggles').show(); $('#fbConnectPushEventBar_hide').show(); return false; }); $('#fbConnectPushEventBar_hide').click(function(){ $('#fbConnectPushEventBar_hide').hide(); $('.fbConnectPushEventToggles').hide(); $('#fbConnectPushEventBar_show').show(); return false; }); }); </script> <?php }
function execute() { global $wgOut, $wgStylePath, $wgBlankImgUrl; $wgOut->addScript('<link rel="stylesheet" type="text/css" href="' . $wgStylePath . '/wikia/common/NewUserRegister.css' . "\" />\n"); if (!array_key_exists('message', $this->data)) { $this->data['message'] = ""; } if (!array_key_exists('ajax', $this->data)) { $this->data['ajax'] = ""; } if ($this->data['message'] && !$this->data['ajax']) { ?> <div class="visualClear"></div> <?php } ?> <br/> <script type="text/javascript"> // Ajax Login functionality, added here var AjaxLogin2 = {}; </script> <table id="userloginSpecial" width="100%"> <tr> <td width="55%" style="border-right: 1px solid #AAA; vertical-align: top;"> <?php global $wgUser; if ($wgUser->isAllowed('createaccount')) { ?> <div class="loginHeader dark_text_1"><?php $this->msg('create-account-new'); ?> </div> <div id="userloginErrorBox"> <?php if ($this->data['messagetype'] == 'error' && $this->data['actiontype'] == 'signup') { $wgOut->addHTML('<style type="text/css"> #userloginErrorBox { display: block !important; } </style>'); } ?> <img alt="status" class="sprite error" src="<?php print $wgBlankImgUrl; ?> "/> <span id="userloginInnerErrorBox"> </span> </div> <?php $this->html('message'); ?> <div id="userlogin<?php if ($this->data['ajax']) { ?> Ajax<?php } ?> "> <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('actioncreate'); ?> "> <?php if ($this->data['message'] && $this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box" style="margin:0px"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> :</h2> <?php } ?> <?php $this->html('message'); ?> </div> <div class="visualClear"></div> <?php } ?> <?php $this->html('header'); /* pre-table point for form plugins... */ ?> <?php /* LoginLanguageSelector used to be here, moved downward and modified as part of rt#16889 */ ?> <table width="100%"> <colgroup> <col width="*" /> </colgroup> <tr> <td class="mw-input" id="wpNameTD"> <label for='wpName2'><?php $this->msg('yourname'); ?> </label> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/><br/> <input type='text' class='loginText' name="wpName" id="wpName2" value="<?php $this->text('name'); ?> " size='20' /> </td> </tr> <tr> <?php if ($this->data['useemail']) { ?> <td class="mw-input" id="wpEmailTD"> <label for='wpEmail'><?php $this->msg('signup-mail'); ?> </label><a id="wpEmailInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/><br/> <input type='text' class='loginText' name="wpEmail" id="wpEmail" value="<?php $this->text('email'); ?> " size='20' /> </td> <?php } ?> </tr> <tr> <td class="mw-input" id="wpPasswordTD"> <label for='wpPassword2'><?php $this->msg('yourpassword'); ?> </label> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/><br/> <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2" value="" size='20' /> </td> </tr> <?php if ($this->data['usedomain']) { $doms = ""; foreach ($this->data['domainnames'] as $dom) { $doms .= "<option>" . htmlspecialchars($dom) . "</option>"; } ?> <tr> <td class="mw-input"> <?php $this->msg('yourdomainname'); ?> <br/> <select name="wpDomain" value="<?php $this->text('domain'); ?> "> <?php echo $doms; ?> </select> </td> </tr> <?php } ?> <tr> <td class="mw-input" id="wpRetypeTD"> <label for='wpRetype'><?php $this->msg('yourpasswordagain'); ?> </label> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/><br/> <input type='password' class='loginPassword' name="wpRetype" id="wpRetype" value="" size='20' /> </td> </tr> <tr> <td class="mw-input"> <label for='uselang'><?php $this->msg('yourlanguage'); ?> </label><br/> <select name="uselang" id="uselang"> <?php global $wgLanguageCode; $isSelected = false; $aTopLanguages = explode(',', wfMsg('wikia-language-top-list')); $aLanguages = wfGetFixedLanguageNames(); asort($aLanguages); if (!empty($aTopLanguages) && is_array($aTopLanguages)) { ?> <optgroup label="<?php echo wfMsg('wikia-language-top', count($aTopLanguages)); ?> "> <?php foreach ($aTopLanguages as $sLang) { $selected = ''; if (!$isSelected && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $aLanguages[$sLang]; ?> </option> <?php } ?> </optgroup> <?php } ?> <optgroup label="<?php echo wfMsg('wikia-language-all'); ?> "> <?php if (!empty($aLanguages) && is_array($aLanguages)) { foreach ($aLanguages as $sLang => $sLangName) { if (empty($isSelected) && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $sLangName; ?> </option> <?php } ?> </optgroup> <?php } ?> </select> </td> </tr> <tr> <td class="mw-input" id="wpBirthDateTD"> <label for='wpBirthYear'><?php $this->msg('yourbirthdate'); ?> </label><a id="wpBirthDateInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/><br/> <select name="wpBirthYear" id="wpBirthYear"> <option value="-1"><?php $this->msg('userlogin-choose-year'); ?> </option> <?php $setYear = $this->data['birthyear']; $maxYear = date('Y'); for ($year = $maxYear; $year >= 1900; $year--) { $selected = $setYear == $year ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$year}\"{$selected}>{$year}</option>"; } ?> </select> <select name="wpBirthMonth" id="wpBirthMonth"> <option value="-1"><?php $this->msg('userlogin-choose-month'); ?> </option> <?php $setMonth = $this->data['birthmonth']; for ($month = 1; $month <= 12; $month++) { $selected = $setMonth == $month ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$month}\"{$selected}>{$month}</option>"; } ?> </select> <select name="wpBirthDay" id="wpBirthDay"> <option value="-1"><?php $this->msg('userlogin-choose-day'); ?> </option> <?php $setDay = $this->data['birthday']; for ($day = 1; $day <= 31; $day++) { $selected = $setDay == $day ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$day}\"{$selected}>{$day}</option>"; } ?> </select> </td> </tr> <?php if ($this->haveData('captcha')) { ?> <tr> <td> <div id="blurryword"><span class="pseudolabel"><?php $this->msg('usercaptcha'); ?> </span><a id="wpUserCaptchaInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></div> </td> </tr> <tr> <td class="mw-input"> <?php $this->html('captcha'); ?> </td> </tr> <?php } if ($this->data['canremember']) { ?> <tr> <td class="mw-input"> <input type='checkbox' name="wpRemember" value="1" id="wpRemember" <?php if ($this->data['remember']) { ?> checked="checked"<?php } ?> /> <label for="wpRemember" class="plain"><?php $this->msg('remembermypassword'); ?> </label> </td> </tr> <?php } $tabIndex = 8; if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) { foreach ($this->data['extraInput'] as $inputItem) { ?> <tr> <td class="mw-input"> <?php if (!empty($inputItem['msg']) && $inputItem['type'] != 'checkbox') { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> "><?php $this->msgWiki($inputItem['msg']); ?> </label><?php } ?> <input type="<?php echo htmlspecialchars($inputItem['type']); ?> " name="<?php echo htmlspecialchars($inputItem['name']); ?> " tabindex="<?php echo $tabIndex++; ?> " value="<?php if ($inputItem['type'] != 'checkbox') { echo htmlspecialchars($inputItem['value']); } else { echo '1'; } ?> " id="<?php echo htmlspecialchars($inputItem['name']); ?> " <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['value'])) { echo 'checked="checked"'; } ?> /> <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['msg'])) { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> " class="plain"><?php $this->msg($inputItem['msg']); ?> </label><?php } ?> </td> </tr> <?php } } ?> <?php if ($this->data['useemail']) { ?> <tr> <td class="mw-input" > <div id="termsOfUse"> <?php $this->msgWiki('prefs-help-terms'); ?> </div> </td> </tr> <?php } ?> <tr> <td class="mw-submit"> <input onclick="UserRegistration.submitForm(); return false;" id="wpCreateaccountX" type="submit" value="<?php echo wfMsg("createaccount"); ?> " /> <?php if ($this->data['createemail']) { ?> <input id="wpCreateaccountX" value="<?php echo wfMsg("createaccountmail"); ?> " onclick="$('#wpCreateaccountXSteer').value = false; $('#wpCreateaccountYSteer').value = true; UserRegistration.submitForm();" /> <input type="hidden" id="wpCreateaccountYSteer" name="wpCreateaccountMail" value="false" /> <?php } else { ?> <input type="hidden" id="wpCreateaccountXSteer" name="wpCreateaccount" value="true" /> <?php } ?> </td> </tr> </table> <script type="text/javascript"> // Ajax Login functionality, added here AjaxLogin2.formSubmitHandler = function(ev) { AjaxLogin2.form.log('AjaxLogin2: selected action = '+ AjaxLogin2.action); var controlbox = document.getElementById('ControlBox'); var newButton = document.createElement('input'); if(AjaxLogin2.action == 'password') { newButton.name = 'wpMailmypassword'; newButton.value = '1'; newButton.type = 'hidden'; controlbox.appendChild(newButton); } else { newButton.name = 'wpLoginattempt'; newButton.value = '1'; newButton.type = 'hidden'; controlbox.appendChild(newButton); } } AjaxLogin2.handleFailure = function () { AjaxLogin2.form.log('AjaxLogin2: handleFailure was called'); } AjaxLogin2.displayReason = function (reason) { $('#userloginInnerErrorBox2').css('display', '').html(reason); $('#userloginErrorBox2').show(); } AjaxLogin2.blockLoginForm = function (block) { AjaxLogin2.form.find('input').attr('disabled', (block ? true : false)); } AjaxLogin2.ajaxRegisterConfirm = function (ev) { AjaxLogin2.form.log('AjaxLogin2: ajaxRegisterConfirm()'); if($('#wpPreview').length && $('#wpLogin').length) { // todo ??? check if(typeof(ajaxLogin2)!="undefined" && !confirm(ajaxLogin2)) { ev.preventDefault(); } } } var UserRegistration = {}; UserRegistration.errorNick = false; //nick checking can be disabled UserRegistration.errorEmail = UserRegistration.errorPass = UserRegistration.errorRetype = UserRegistration.errorDate = true; UserRegistration.dateAccessed = 0; UserRegistration.errorMessages = { main: '<?php echo addslashes(wfMsg('userlogin-form-error')); ?> ', username: '******'noname')); ?> ', email: '<?php echo addslashes(wfMsg('userlogin-bad-email')); ?> ', password: '******'userlogin-bad-password')); ?> ', repassword: '******'userlogin-bad-repassword')); ?> ', birthday: '<?php echo addslashes(wfMsg('userlogin-bad-birthday')); ?> ' }; UserRegistration.fillErrors = function() { var errors = []; var errorsHTML = ''; if (UserRegistration.errorNick) errors.push(UserRegistration.errorMessages['username']); if (UserRegistration.errorEmail) errors.push(UserRegistration.errorMessages['email']); if (UserRegistration.errorPass) errors.push(UserRegistration.errorMessages['password']); if (UserRegistration.errorRetype) errors.push(UserRegistration.errorMessages['repassword']); if (UserRegistration.errorDate) errors.push(UserRegistration.errorMessages['birthday']); if (errors.length == 0) { //hide $('#userloginErrorBox').hide(); } else if (errors.length == 1) { //one errorsHTML = errors[0]; $('#userloginInnerErrorBox').html(errorsHTML); $('#userloginErrorBox').show(); } else { //more errorsHTML = '<strong>' + UserRegistration.errorMessages['main'] + '</strong><ul>'; for (err in errors) errorsHTML += '<li>' + errors[err] + '</li>'; errorsHTML += '</ul>'; $('#userloginInnerErrorBox').html(errorsHTML); $('#userloginErrorBox').show(); } } UserRegistration.checkForm = function() { UserRegistration.dateAccessed = 2; //check date on submit UserRegistration.checkUsername(); UserRegistration.checkDate(); UserRegistration.checkEmail(); UserRegistration.checkPass(); UserRegistration.checkRetype(); UserRegistration.fillErrors(); return !(UserRegistration.errorNick || UserRegistration.errorEmail || UserRegistration.errorPass || UserRegistration.errorRetype || UserRegistration.errorDate); } UserRegistration.update_day_field = function() { var year = document.getElementById('wpBirthYear').value; var month = document.getElementById('wpBirthMonth').value; var day = document.getElementById('wpBirthDay'); var day_length = day.length; var max_days = (year == -1 || month == -1) ? 31 : new Date(year, month, 0).getDate(); var day_diff = max_days - (day_length - 1); if (day_diff > 0) { for(n=0; n<day_diff; n++) { var newOption = document.createElement('option'); newOption.value = newOption.innerHTML = day_length + n; day.appendChild(newOption); } } else if (day_diff < 0) { for(n=0; n<-day_diff; n++) { day.remove(day.length - 1); } } } UserRegistration.init = function() { AjaxLogin2.form = $('#userajaxloginform2'); AjaxLogin2.form.submit(AjaxLogin2.formSubmitHandler).log('AjaxLogin2: init()'); // initial check, if not empty... if ($('#wpEmail').attr('value') != '') { UserRegistration.checkEmail(); } } UserRegistration.checkUsername = function() { $.getJSON(wgScript + '?action=ajax&rs=cxValidateUserName', {uName: $('#wpName2').attr('value')}, function(json){ if (json.result == 'OK') { UserRegistration.toggleError('wpNameTD', 'ok'); UserRegistration.errorNick = false; } else { UserRegistration.toggleError('wpNameTD', 'err'); UserRegistration.errorNick = true; } }); } $(UserRegistration.init); $('#wpEmailInfo').bind('click', function(){ $.showModal(prefs_help_mailmesg, prefs_help_email, { 'id': 'wpEmailInfoModal' }); }); $('#wpBirthDateInfo').bind('click', function(){ $.showModal(prefs_help_birthmesg, prefs_help_birthinfo, { 'id': 'wpBirthDateInfoModal' }); }); $('#wpUserCaptchaInfo').bind('click', function(){ $.showModal(prefs_help_blurmesg, prefs_help_blurinfo, { 'id': 'wpUserCaptchaInfoModal' }); }); UserRegistration.toggleError = function(id, show) { if (show == 'ok') { $('#' + id + ' img:first').removeClass().addClass('sprite ok'); } else if (show == 'clear') { $('#' + id + ' img:first').removeClass(); } else if (show == 'progress') { $('#' + id + ' img:first').removeClass().addClass('sprite progress'); } else { $('#' + id + ' img:first').removeClass().addClass('sprite error'); } } UserRegistration.checkEmail = function() { var email_elem = document.getElementById('wpEmail') ; if (email_elem) { var email = email_elem.value; if (email == '') { UserRegistration.toggleError('wpEmailTD', 'clear'); UserRegistration.errorEmail = false; } else if (email.match(/^[a-z0-9._%+-]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4}$/mi)) { UserRegistration.toggleError('wpEmailTD', 'ok'); UserRegistration.errorEmail = false; } else { UserRegistration.toggleError('wpEmailTD'); UserRegistration.errorEmail = true; } } else { UserRegistration.errorEmail = false ; } } UserRegistration.checkPass = function() { var pass = document.getElementById('wpPassword2').value; var name = document.getElementById('wpName2').value; if (pass == name) { UserRegistration.toggleError('wpPasswordTD'); UserRegistration.errorPass = true; } else { var passLen = document.getElementById('wpPassword2').value.length; if (passLen >= <?php global $wgMinimalPasswordLength; echo $wgMinimalPasswordLength; ?> ) { UserRegistration.toggleError('wpPasswordTD', 'ok'); UserRegistration.errorPass = false; } else { UserRegistration.toggleError('wpPasswordTD'); UserRegistration.errorPass = true; } } } UserRegistration.checkRetype = function() { var pass = document.getElementById('wpPassword2').value; var pass2= document.getElementById('wpRetype').value; if (pass == pass2) { if ('' == pass2) { UserRegistration.toggleError('wpRetypeTD', 'clear'); UserRegistration.errorRetype = false; } else { UserRegistration.toggleError('wpRetypeTD', 'ok'); UserRegistration.errorRetype = false; } } else { UserRegistration.toggleError('wpRetypeTD'); UserRegistration.errorRetype = true; } } UserRegistration.checkDate = function() { UserRegistration.update_day_field(); //add/remove days according to the year & month var year = document.getElementById('wpBirthYear').value; var month = document.getElementById('wpBirthMonth').value; var day = document.getElementById('wpBirthDay').value; if (UserRegistration.dateAccessed == 1) { UserRegistration.toggleError('wpBirthDateTD', 'clear'); } else if (UserRegistration.dateAccessed == 2 && year != -1 && month != -1 && day != -1) { UserRegistration.toggleError('wpBirthDateTD', 'ok'); UserRegistration.errorDate = false; } else if(UserRegistration.dateAccessed == 2) { UserRegistration.toggleError('wpBirthDateTD', 'err'); UserRegistration.errorDate = true; } } UserRegistration.submitForm = function() { if (UserRegistration.checkForm()) { $('#userlogin2').submit(); } } $('#wpBirthYear').bind('focus', function(){UserRegistration.dateAccessed = 1;}); $('#wpBirthMonth').bind('focus', function(){UserRegistration.dateAccessed = 1;}); $('#wpBirthDay').bind('focus', function(){UserRegistration.dateAccessed = 1;}); $('#wpName2').bind('focus', function(){if (UserRegistration.dateAccessed == 1) {UserRegistration.dateAccessed = 2; UserRegistration.checkDate();}}); $('#wpName2').bind('blur', function(){ UserRegistration.toggleError('wpNameTD', 'progress'); UserRegistration.checkUsername(); UserRegistration.checkPass(); }); if (document.getElementById('wpEmail')) { $('#wpEmail').bind('focus', function(){if (UserRegistration.dateAccessed == 1) {UserRegistration.dateAccessed = 2; UserRegistration.checkDate();}}); $('#wpEmail').bind('blur', UserRegistration.checkEmail); } $('#wpPassword2').bind('focus', function(){if (UserRegistration.dateAccessed == 1) {UserRegistration.dateAccessed = 2; UserRegistration.checkDate();}}); $('#wpRetype').bind('focus', function(){if (UserRegistration.dateAccessed == 1) {UserRegistration.dateAccessed = 2; UserRegistration.checkDate();}}); $('#wpRealName').bind('focus', function(){if (UserRegistration.dateAccessed == 1) {UserRegistration.dateAccessed = 2; UserRegistration.checkDate();}}); $('#wpName2').bind('keyup', function(){ UserRegistration.toggleError('wpNameTD', 'clear'); }); $('#wpBirthYear').bind('change', UserRegistration.checkDate); $('#wpBirthMonth').bind('change', UserRegistration.checkDate); $('#wpBirthDay').bind('change', UserRegistration.checkDate); $('#wpPassword2').bind('blur', function(){UserRegistration.checkPass(); UserRegistration.checkRetype();}); $('#wpRetype').bind('blur', UserRegistration.checkRetype); </script> <input type="submit" value="Register" style="position: absolute; left: -10000px; width: 0" /> <?php if (@$this->haveData('uselang')) { ?> <input type="hidden" name="uselang" value="<?php $this->text('uselang'); ?> " /><?php } ?> </form> </div> <?php } else { //display message about not being able to create an account? } // end createaccount test ?> </td> <td width="45%" style="vertical-align: top;"> <div class="loginHeader rightSideElem dark_text_1"><?php $this->msg('log-in-new'); ?> </div> <form action="<?php $this->text('actionlogin'); ?> " method="post" style="margin: 10px;" name="userajaxloginform2" id="userajaxloginform2"> <div id="userloginMessageBox"> <?php if ($this->data['messagetype'] != 'error' && $this->data['actiontype'] == 'login') { $wgOut->addHTML('<style type="text/css"> #userloginMessageBox { display: block !important; } </style>'); $this->html('message'); } ?> </div> <div id="userloginErrorBox2"> <?php if ($this->data['messagetype'] == 'error' && $this->data['actiontype'] == 'login') { $wgOut->addHTML('<style type="text/css"> #userloginErrorBox2 { display: block !important; } </style>'); } ?> <img alt="status" class="sprite error" src="<?php print $wgBlankImgUrl; ?> "/> <span id="userloginInnerErrorBox2"> <?php $this->html('message'); ?> </span> </div> <label for="wpName2Ajax" style="display: block; font-weight: bold;"><?php echo wfMsg("yourname"); ?> </label> <table> <tr> <td id="ajaxlogin_username_cell2"> <input type="text" name="wpName" id="wpName2Ajax" tabindex="101" size="20" class="loginText" value="<?php $this->text('name'); ?> "/> </td> <td></td> </tr> </table> <div style="display: block; margin-top: 8px"> <label for="wpPassword2Ajax" style="font-weight: bold;"><?php echo wfMsg("signup-password"); ?> </label> <a id="wpMailmypassword" href="#" style="font-size: 9pt;" onclick="AjaxLogin2.action='password'; AjaxLogin2.form.submit();"><?php echo wfMsg('mailmypassword'); ?> </a> </div> <table> <tr> <td id="ajaxlogin_password_cell2"> <input type="password" name="wpPassword" id="wpPassword2Ajax" tabindex="102" size="20" class="loginPassword" /> </td> <?php global $wgEnableEmail, $wgAuth; if ($wgEnableEmail && $wgAuth->allowPasswordChange()) { ?> </td> <?php } ?> </tr> </table> <div style="margin: 10px 0;"> <input type="checkbox" name="wpRemember" id="wpRemember2Ajax" tabindex="104" value="1" /> <div id="ControlBox" style="display:none"></div> <label for="wpRemember2Ajax" class="plain"><?php echo wfMsg('remembermypassword'); ?> </label> </div> <?php if (@$this->haveData('token')) { ?> <input type="hidden" name="wpLoginToken" value="<?php $this->text('token'); ?> " /><?php } ?> <input onclick="AjaxLogin2.action='login';" id="wpLoginattempt" type="submit" value="<?php echo wfMsg("login"); ?> " /> </form> <div id="loginIntro" class="accent rightSideElem"> <div class="announcementHeader dark_text_2"> <?php $this->msg('registerintro-title'); ?> </div> <div class="announcementText"> <table> <tr><td> <?php $this->msg('registerintro-text'); ?> </td> <td> <?php global $wgBlankImgUrl; ?> <img src="<?php echo $wgBlankImgUrl; ?> " alt="<?php $this->msg('registerintro-title'); ?> " width="145" height="148" id="userlogin-accent-image" /> </td> </tr> </table> </div> </div> </td> </tr> </table> <div id="signupWhyProvide"></div> <div id="signupend" style="clear: both;"><?php $this->msgWiki('signupend'); ?> </div> <?php }
private function showActivity($subpage = '') { global $wgUser, $wgContLang, $wgLang, $wgOut, $wgJsMimeType, $wgResourceBasePath; wfProfileIn(__METHOD__); $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/jquery/datatables/jquery.dataTables.min.js\"></script>\n"); @(list(, $pyear, $pmonth, $plang, $pcat) = explode("/", $subpage)); $aTopLanguages = explode(',', wfMsg('wikistats_language_toplist')); $aLanguages = wfGetFixedLanguageNames(); asort($aLanguages); #- $hubs = WikiFactoryHub::getInstance(); $_cats = $hubs->getCategories(); $aCategories = array(); if (!empty($_cats)) { foreach ($_cats as $id => $cat) { if (!isset($aCategories[$id])) { $aCategories[$id] = $cat['name']; if ($pcat == $cat['name']) { $pcat = intval($id); } } } } if (!is_numeric($pcat)) { $pcat = 0; } if (empty($pyear)) { $pyear = date('Y'); } if (empty($pmonth)) { $pmonth = date('m'); } #$rows = $this->mStats->userEdits(1); $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $oTmpl->set_vars(array("user" => $wgUser, "cityId" => $this->mCityId, "wgContLang" => $wgContLang, "wgLang" => $wgLang, "topLanguages" => $aTopLanguages, "aLanguages" => $aLanguages, "categories" => $aCategories, "pyear" => $pyear, "pmonth" => $pmonth, "plang" => !empty($plang) ? $plang : $wgLang->getCode(), "pcat" => $pcat)); $wgOut->addHTML($oTmpl->render("wiki_activity")); wfProfileOut(__METHOD__); }
/** * @param $user User * @param $context IContextSource * @param $defaultPreferences * @return void */ static function profilePreferences($user, IContextSource $context, &$defaultPreferences) { global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode, $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars, $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication, $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress; ## User info ##################################### // Information panel $defaultPreferences['username'] = array('type' => 'info', 'label-message' => 'username', 'default' => $user->getName(), 'section' => 'personal/info'); $defaultPreferences['userid'] = array('type' => 'info', 'label-message' => 'uid', 'default' => $user->getId(), 'section' => 'personal/info'); # Get groups to which the user belongs $userEffectiveGroups = $user->getEffectiveGroups(); $userGroups = $userMembers = array(); foreach ($userEffectiveGroups as $ueg) { if ($ueg == '*') { // Skip the default * group, seems useless here continue; } $groupName = User::getGroupName($ueg); $userGroups[] = User::makeGroupLinkHTML($ueg, $groupName); $memberName = User::getGroupMember($ueg, $user->getName()); $userMembers[] = User::makeGroupLinkHTML($ueg, $memberName); } asort($userGroups); asort($userMembers); $lang = $context->getLanguage(); $defaultPreferences['usergroups'] = array('type' => 'info', 'label' => $context->msg('prefs-memberingroups')->numParams(count($userGroups))->parse(), 'default' => $context->msg('prefs-memberingroups-type', $lang->commaList($userGroups), $lang->commaList($userMembers))->plain(), 'raw' => true, 'section' => 'personal/info'); $defaultPreferences['editcount'] = array('type' => 'info', 'label-message' => 'prefs-edits', 'default' => $lang->formatNum($user->getEditCount()), 'section' => 'personal/info'); if ($user->getRegistration()) { $displayUser = $context->getUser(); $userRegistration = $user->getRegistration(); $defaultPreferences['registrationdate'] = array('type' => 'info', 'label-message' => 'prefs-registration', 'default' => $context->msg('prefs-registration-date-time', $lang->userTimeAndDate($userRegistration, $displayUser), $lang->userDate($userRegistration, $displayUser), $lang->userTime($userRegistration, $displayUser))->parse(), 'section' => 'personal/info'); } // Actually changeable stuff $defaultPreferences['realname'] = array('type' => $wgAuth->allowPropChange('realname') ? 'text' : 'info', 'default' => $user->getRealName(), 'section' => 'personal/info', 'label-message' => 'yourrealname', 'help-message' => 'prefs-help-realname'); $defaultPreferences['gender'] = array('type' => 'select', 'section' => 'personal/info', 'options' => array($context->msg('gender-male')->text() => 'male', $context->msg('gender-female')->text() => 'female', $context->msg('gender-unknown')->text() => 'unknown'), 'label-message' => 'yourgender', 'help-message' => 'prefs-help-gender'); if ($wgAuth->allowPasswordChange()) { $link = Linker::link(SpecialPage::getTitleFor('ChangePassword'), $context->msg('prefs-resetpass')->escaped(), array(), array('returnto' => SpecialPage::getTitleFor('Preferences'))); $defaultPreferences['password'] = array('type' => 'info', 'raw' => true, 'default' => $link, 'label-message' => 'yourpassword', 'section' => 'personal/info'); } if ($wgCookieExpiration > 0) { $defaultPreferences['rememberpassword'] = array('type' => 'toggle', 'label' => $context->msg('tog-rememberpassword')->numParams(ceil($wgCookieExpiration / (3600 * 24)))->text(), 'section' => 'personal/info'); } // Language /** WIKIA CHANGE BEGIN **/ $languages = wfGetFixedLanguageNames(); /** WIKIA CHANGE END **/ if (!array_key_exists($wgLanguageCode, $languages)) { $languages[$wgLanguageCode] = $wgLanguageCode; } ksort($languages); $options = array(); foreach ($languages as $code => $name) { $display = wfBCP47($code) . ' - ' . $name; $options[$display] = $code; } $defaultPreferences['language'] = array('type' => 'select', 'section' => 'personal/i18n', 'options' => $options, 'label-message' => 'yourlanguage'); /* see if there are multiple language variants to choose from*/ $variantArray = array(); if (!$wgDisableLangConversion) { $variants = $wgContLang->getVariants(); foreach ($variants as $v) { $v = str_replace('_', '-', strtolower($v)); $variantArray[$v] = $wgContLang->getVariantname($v, false); } $options = array(); foreach ($variantArray as $code => $name) { $display = wfBCP47($code) . ' - ' . $name; $options[$display] = $code; } if (count($variantArray) > 1) { $defaultPreferences['variant'] = array('label-message' => 'yourvariant', 'type' => 'select', 'options' => $options, 'section' => 'personal/i18n', 'help-message' => 'prefs-help-variant'); } } if (count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) { $defaultPreferences['noconvertlink'] = array('type' => 'toggle', 'section' => 'personal/i18n', 'label-message' => 'tog-noconvertlink'); } // show a preview of the old signature first $oldsigWikiText = $wgParser->preSaveTransform("~~~", $context->getTitle(), $user, ParserOptions::newFromContext($context)); $oldsigHTML = $context->getOutput()->parseInline($oldsigWikiText, true, true); $defaultPreferences['oldsig'] = array('type' => 'info', 'raw' => true, 'label-message' => 'tog-oldsig', 'default' => $oldsigHTML, 'section' => 'personal/signature'); $defaultPreferences['nickname'] = array('type' => $wgAuth->allowPropChange('nickname') ? 'text' : 'info', 'maxlength' => $wgMaxSigChars, 'label-message' => 'yournick', 'validation-callback' => array('Preferences', 'validateSignature'), 'section' => 'personal/signature', 'filter-callback' => array('Preferences', 'cleanSignature')); $defaultPreferences['fancysig'] = array('type' => 'toggle', 'label-message' => 'tog-fancysig', 'help-message' => 'prefs-help-signature', 'section' => 'personal/signature'); ## Email stuff if ($wgEnableEmail) { $helpMessages[] = $wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email'; if ($wgEnableUserEmail) { // additional messages when users can send email to each other $helpMessages[] = 'prefs-help-email-others'; } $link = Linker::link(SpecialPage::getTitleFor('ChangeEmail'), $context->msg($user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail')->escaped(), array(), array('returnto' => SpecialPage::getTitleFor('Preferences'))); $emailAddress = $user->getEmail() ? htmlspecialchars($user->getEmail()) : ''; if ($wgAuth->allowPropChange('emailaddress')) { $emailAddress .= $emailAddress == '' ? $link : " ({$link})"; } $defaultPreferences['emailaddress'] = array('type' => 'info', 'raw' => true, 'default' => $emailAddress, 'label-message' => 'youremail', 'section' => 'personal/email', 'help-messages' => $helpMessages); $disableEmailPrefs = false; if ($wgEmailAuthentication) { /* Wikia change - begin */ $emailauthenticated = ''; wfRunHooks('PreferencesGetEmailAuthentication', array(&$user, $context, &$disableEmailPrefs, &$emailauthenticated)); if (empty($emailauthenticated)) { /* Wikia change - end */ if ($user->getEmail()) { if ($user->getEmailAuthenticationTimestamp()) { // date and time are separate parameters to facilitate localisation. // $time is kept for backward compat reasons. // 'emailauthenticated' is also used in SpecialConfirmemail.php $displayUser = $context->getUser(); $emailTimestamp = $user->getEmailAuthenticationTimestamp(); $time = $lang->userTimeAndDate($emailTimestamp, $displayUser); $d = $lang->userDate($emailTimestamp, $displayUser); $t = $lang->userTime($emailTimestamp, $displayUser); $emailauthenticated = $context->msg('emailauthenticated', $time, $d, $t)->parse() . '<br />'; $disableEmailPrefs = false; } else { $disableEmailPrefs = true; $emailauthenticated = $context->msg('emailnotauthenticated')->parse() . '<br />' . Linker::linkKnown(SpecialPage::getTitleFor('Confirmemail'), $context->msg('emailconfirmlink')->escaped()) . '<br />'; } } else { $disableEmailPrefs = true; $emailauthenticated = $context->msg('noemailprefs')->escaped(); } } $defaultPreferences['emailauthentication'] = array('type' => 'info', 'raw' => true, 'section' => 'personal/email', 'label-message' => 'prefs-emailconfirm-label', 'default' => $emailauthenticated); } if ($wgEnableUserEmail && $user->isAllowed('sendemail')) { $defaultPreferences['disablemail'] = array('type' => 'toggle', 'invert' => true, 'section' => 'personal/email', 'label-message' => 'allowemail', 'disabled' => $disableEmailPrefs); $defaultPreferences['ccmeonemails'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-ccmeonemails', 'disabled' => $disableEmailPrefs); } if ($wgEnotifWatchlist) { $defaultPreferences['enotifwatchlistpages'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-enotifwatchlistpages', 'disabled' => $disableEmailPrefs); } if ($wgEnotifUserTalk) { $defaultPreferences['enotifusertalkpages'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-enotifusertalkpages', 'disabled' => $disableEmailPrefs); } if ($wgEnotifUserTalk || $wgEnotifWatchlist) { $defaultPreferences['enotifminoredits'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-enotifminoredits', 'disabled' => $disableEmailPrefs); if ($wgEnotifRevealEditorAddress) { $defaultPreferences['enotifrevealaddr'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-enotifrevealaddr', 'disabled' => $disableEmailPrefs); } } /* Wikia change begin - @author: Inez */ $defaultPreferences['marketingallowed'] = array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'tog-marketingallowed'); /* Wikia change end */ } }
public function index() { global $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgSuppressFooter, $wgSuppressAds, $wgSuppressToolbar, $fbOnLoginJsOverride, $wgRequest, $wgUser; wfProfileIn(__METHOD__); // hide some default oasis UI things $wgSuppressWikiHeader = true; $wgSuppressPageHeader = true; $wgSuppressFooter = false; $wgSuppressAds = true; $wgSuppressToolbar = true; // store the fact we're on CNW $this->wg->atCreateNewWikiPage = true; if (!$this->wg->User->isLoggedIn() && !empty($this->wg->EnableFacebookClientExt)) { // required for FB Connect to work $this->response->addAsset('extensions/wikia/UserLogin/js/UserLoginFacebookPageInit.js'); } // fbconnected means user has gone through step 2 to login via facebook. // Therefore, we need to reload some values and start at the step after signup/login $fbconnected = $wgRequest->getVal('fbconnected'); $fbreturn = $wgRequest->getVal('fbreturn'); if (!empty($fbconnected) && $fbconnected === '1' || !empty($fbreturn) && $fbreturn === '1') { $this->LoadState(); $currentStep = 'DescWiki'; } else { $currentStep = ''; } $this->setupVerticalsAndCategories(); $this->aTopLanguages = explode(',', wfMsg('autocreatewiki-language-top-list')); $languages = wfGetFixedLanguageNames(); asort($languages); $this->aLanguages = $languages; $useLang = $wgRequest->getVal('uselang', $wgUser->getGlobalPreference('language')); // squash language dialects (same wiki language for different dialects) $useLang = $this->squashLanguageDialects($useLang); // falling back to english (BugId:3538) if (!array_key_exists($useLang, $this->aLanguages)) { $useLang = 'en'; } $params['wikiLanguage'] = empty($useLang) ? $this->wg->LanguageCode : $useLang; // precedence: selected form field, uselang, default wiki lang // export info if user is logged in $this->isUserLoggedIn = $wgUser->isLoggedIn(); // remove wikia plus for now for all languages $skipWikiaPlus = true; $keys = CreateNewWikiObfuscate::generateValidSeeds(); $_SESSION['cnw-answer'] = CreateNewWikiObfuscate::generateAnswer($this->keys); $this->wg->Out->addJsConfigVars(['wgLangAllAgesOpt' => self::LANG_ALL_AGES_OPT]); // prefill $params['wikiName'] = $wgRequest->getVal('wikiName', ''); $params['wikiDomain'] = $wgRequest->getVal('wikiDomain', ''); $params['LangAllAgesOpt'] = self::LANG_ALL_AGES_OPT; $this->params = $params; $this->signupUrl = ''; $signupTitle = Title::newFromText('UserSignup', NS_SPECIAL); if ($wgRequest->getInt('nocaptchatest')) { $this->signupUrl = $signupTitle->getFullURL('nocaptchatest=1'); } else { $this->signupUrl = $signupTitle->getFullURL(); } // Make various parsed messages and status available in JS // Necessary because JSMessages does not support parsing $this->wikiBuilderCfg = array('name-wiki-submit-error' => wfMessage('cnw-name-wiki-submit-error')->escaped(), 'desc-wiki-submit-error' => wfMessage('cnw-desc-wiki-submit-error')->escaped(), 'currentstep' => $currentStep, 'skipwikiaplus' => $skipWikiaPlus, 'descriptionplaceholder' => wfMessage('cnw-desc-placeholder')->escaped(), 'cnw-error-general' => wfMessage('cnw-error-general')->parse(), 'cnw-error-general-heading' => wfMessage('cnw-error-general-heading')->escaped(), 'cnw-keys' => $keys); // theme designer application theme settings $this->applicationThemeSettings = SassUtil::getApplicationThemeSettings(); wfProfileOut(__METHOD__); }
function execute() { global $wgOut, $wgStylePath, $wgStyleVersion, $wgBlankImgUrl; $wgOut->addScript('<link rel="stylesheet" type="text/css" href="' . $wgStylePath . '/wikia/common/NewUserRegister.css?' . $wgStyleVersion . "\" />\n"); if (!array_key_exists('message', $this->data)) { $this->data['message'] = ""; } if (!array_key_exists('ajax', $this->data)) { $this->data['ajax'] = ""; } if ($this->data['message'] && !$this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> </h2> <?php } ?> <?php $this->html('message'); ?> </div> <div class="visualClear"></div> <?php } ?> <br/> <table id="userloginSpecial" width="100%"> <tr> <td width="55%" style="border-right: 1px solid #AAA; vertical-align: top;"> <div class="loginHeader dark_text_1"><?php $this->msg('create-account-new'); ?> </div> <div id="userloginErrorBox"> <table> <tr> <td style="vertical-align:top;"> <span style="position: relative; top: -1px;"><img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> </td> <td> <div id="userloginInnerErrorBox"> </td> </table> </div> </div> <div id="userlogin<?php if ($this->data['ajax']) { ?> Ajax<?php } ?> "> <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('actioncreate'); ?> " onsubmit="return UserRegistration.checkForm()"> <?php // TODO: Check to see if 'createToken' is still used at all. if (@$this->haveData('createToken') || @$this->haveData('token')) { ?> <input type="hidden" name="wpCreateaccountToken" value="<?php if (@$this->haveData('createToken')) { $this->text('createToken'); } else { if (@$this->haveData('token')) { $this->text('token'); } } ?> " /><?php } if ($this->data['message'] && $this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box" style="margin:0px"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> :</h2> <?php } ?> <?php $this->html('message'); ?> </div> <div class="visualClear"></div> <?php } ?> <?php $this->html('header'); /* pre-table point for form plugins... */ ?> <?php /* LoginLanguageSelector used to be here, moved downward and modified as part of rt#16889 */ ?> <table width="100%"> <colgroup> <col width="*" /> </colgroup> <tr> <td class="mw-input" id="wpNameTD"> <label for='wpName2'><?php $this->msg('yourname'); ?> </label><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span><br/> <input type='text' class='loginText' name="wpName" id="wpName2" value="<?php $this->text('name'); ?> " size='20' /> </td> </tr> <tr> <?php if ($this->data['useemail']) { ?> <td class="mw-input" id="wpEmailTD"> <label for='wpEmail'><?php $this->msg('signup-mail'); ?> </label><a id="wpEmailInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span><br/> <input type='text' class='loginText' name="wpEmail" id="wpEmail" value="<?php $this->text('email'); ?> " size='20' /> </td> <?php } ?> </tr> <tr> <td class="mw-input" id="wpPasswordTD"> <label for='wpPassword2'><?php $this->msg('yourpassword'); ?> </label><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span><br/> <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2" value="" size='20' /> </td> </tr> <?php if ($this->data['usedomain']) { $doms = ""; foreach ($this->data['domainnames'] as $dom) { $doms .= "<option>" . htmlspecialchars($dom) . "</option>"; } ?> <tr> <td class="mw-input"> <?php $this->msg('yourdomainname'); ?> <br/> <select name="wpDomain" value="<?php $this->text('domain'); ?> "> <?php echo $doms; ?> </select> </td> </tr> <?php } ?> <tr> <td class="mw-input" id="wpRetypeTD"> <label for='wpRetype'><?php $this->msg('yourpasswordagain'); ?> </label><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span><br/> <input type='password' class='loginPassword' name="wpRetype" id="wpRetype" value="" size='20' /> </td> </tr> <tr> <td class="mw-input"> <label for='uselang'><?php $this->msg('yourlanguage'); ?> </label><br/> <select name="uselang" id="uselang"> <?php global $wgLanguageCode; $isSelected = false; $aTopLanguages = explode(',', wfMsg('wikia-language-top-list')); $aLanguages = wfGetFixedLanguageNames(); asort($aLanguages); if (!empty($aTopLanguages) && is_array($aTopLanguages)) { ?> <optgroup label="<?php echo wfMsg('wikia-language-top', count($aTopLanguages)); ?> "> <?php foreach ($aTopLanguages as $sLang) { $selected = ''; if (!$isSelected && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $aLanguages[$sLang]; ?> </option> <?php } ?> </optgroup> <?php } ?> <optgroup label="<?php echo wfMsg('wikia-language-all'); ?> "> <?php if (!empty($aLanguages) && is_array($aLanguages)) { foreach ($aLanguages as $sLang => $sLangName) { if (empty($isSelected) && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $sLangName; ?> </option> <?php } ?> </optgroup> <?php } ?> </select> </td> </tr> <tr> <td class="mw-input" id="wpBirthDateTD"> <label for='wpBirthYear'><?php $this->msg('yourbirthdate'); ?> </label><a id="wpBirthDateInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span><br/> <select name="wpBirthYear" id="wpBirthYear"> <option value="-1"><?php $this->msg('userlogin-choose-year'); ?> </option> <?php $setYear = $this->data['birthyear']; $maxYear = date('Y'); for ($year = $maxYear; $year >= 1900; $year--) { $selected = $setYear == $year ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$year}\"{$selected}>{$year}</option>"; } ?> </select> <select name="wpBirthMonth" id="wpBirthMonth"> <option value="-1"><?php $this->msg('userlogin-choose-month'); ?> </option> <?php $setMonth = $this->data['birthmonth']; for ($month = 1; $month <= 12; $month++) { $selected = $setMonth == $month ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$month}\"{$selected}>{$month}</option>"; } ?> </select> <select name="wpBirthDay" id="wpBirthDay"> <option value="-1"><?php $this->msg('userlogin-choose-day'); ?> </option> <?php $setDay = $this->data['birthday']; for ($day = 1; $day <= 31; $day++) { $selected = $setDay == $day ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$day}\"{$selected}>{$day}</option>"; } ?> </select> </td> </tr> <?php if ($this->haveData('captcha')) { ?> <tr> <td> <div id="blurryword"><span class="pseudolabel"><?php $this->msg('usercaptcha'); ?> </span><a id="wpUserCaptchaInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a><span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span></div> </td> </tr> <tr> <td class="mw-input"> <?php $this->html('captcha'); ?> </td> </tr> <?php } if ($this->data['canremember']) { ?> <tr> <td class="mw-input"> <input type='checkbox' name="wpRemember" value="1" id="wpRemember" <?php if ($this->data['remember']) { ?> checked="checked"<?php } ?> /> <label for="wpRemember" class="plain"><?php $this->msg('remembermypassword'); ?> </label> </td> </tr> <?php } $tabIndex = 8; if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) { foreach ($this->data['extraInput'] as $inputItem) { ?> <tr> <td class="mw-input"> <?php if (!empty($inputItem['msg']) && $inputItem['type'] != 'checkbox') { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> "><?php $this->msgWiki($inputItem['msg']); ?> </label><?php } ?> <input type="<?php echo htmlspecialchars($inputItem['type']); ?> " name="<?php echo htmlspecialchars($inputItem['name']); ?> " tabindex="<?php echo $tabIndex++; ?> " value="<?php if ($inputItem['type'] != 'checkbox') { echo htmlspecialchars($inputItem['value']); } else { echo '1'; } ?> " id="<?php echo htmlspecialchars($inputItem['name']); ?> " <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['value'])) { echo 'checked="checked"'; } ?> /> <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['msg'])) { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> " class="plain"><?php $this->msg($inputItem['msg']); ?> </label><?php } ?> </td> </tr> <?php } } ?> <?php if ($this->data['useemail']) { ?> <tr> <td class="mw-input" > <div id="termsOfUse"> <?php $this->msgWiki('prefs-help-terms'); ?> </div> </td> </tr> <?php } ?> <tr> <td class="mw-submit"> <div class="modalToolbar"> <a id="wpCreateaccountX" class="wikia_button" href="#" onclick="UserRegistration.submitForm();" ><span><?php echo wfMsg("createaccount"); ?> </span></a> <?php if ($this->data['createemail']) { ?> <a id="wpCreateaccountX" class="wikia_button" href="#" onclick="$('#wpCreateaccountXSteer').value = false; $('#wpCreateaccountYSteer').value = true; UserRegistration.submitForm();" ><span><?php echo wfMsg("createaccountmail"); ?> </span></a> </div> <input type="hidden" id="wpCreateaccountYSteer" name="wpCreateaccountMail" value="false" > <?php } else { ?> </div> <input type="hidden" id="wpCreateaccountXSteer" name="wpCreateaccount" value="true" > <?php } ?> </td> </tr> </table> <script type="text/javascript"> // Ajax Login functionality, added here var AjaxLogin2 = {}; AjaxLogin2.formSubmitHandler = function(ev) { var controlbox = document.getElementById('ControlBox'); var newButton = document.createElement('input'); if(AjaxLogin2.action == 'password') { newButton.name = 'wpMailmypassword'; newButton.value = '1'; newButton.type = 'hidden'; controlbox.appendChild(newButton); } else { newButton.name = 'wpLoginattempt'; newButton.value = '1'; newButton.type = 'hidden'; controlbox.appendChild(newButton); } } AjaxLogin2.handleFailure = function () { AjaxLogin2.form.log('AjaxLogin2: handleFailure was called'); } AjaxLogin2.displayReason = function (reason) { $('#userloginInnerErrorBox2').css('display', '').html(reason); $('#userloginErrorBox2').show(); } AjaxLogin2.blockLoginForm = function (block) { AjaxLogin2.form.find('input').attr('disabled', (block ? true : false)); } AjaxLogin2.ajaxRegisterConfirm = function (ev) { AjaxLogin2.form.log('AjaxLogin2: ajaxRegisterConfirm()'); if($('#wpPreview').length && $('#wpLogin').length) { // todo ??? check if(typeof(ajaxLogin2)!="undefined" && !confirm(ajaxLogin2)) { ev.preventDefault(); } } } <?php $this->executeRegisterJS(); ?> $(UserRegistration.init); </script> <input type="submit" value="Register" style="position: absolute; left: -10000px; width: 0" /> <?php if (@$this->haveData('uselang')) { ?> <input type="hidden" name="uselang" value="<?php $this->text('uselang'); ?> " /><?php } ?> </form> </div> </td> <td width="45%" style="vertical-align: top;"> <div class="loginHeader rightSideElem dark_text_1"><?php $this->msg('log-in-new'); ?> </div> <form action="<?php $this->text('actionlogin'); ?> " method="post" style="margin: 10px;" name="userajaxloginform2" id="userajaxloginform2"> <div id="userloginErrorBox2"> <table> <tr> <td style="vertical-align:top;"> <span style="position: relative; top: -1px;"><img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> </td> <td> <div id="userloginInnerErrorBox2"> </td> </table> </div> <label for="wpName2Ajax" style="display: block; font-weight: bold;"><?php echo wfMsg("yourname"); ?> </label> <table> <tr> <td id="ajaxlogin_username_cell2"> <input type="text" name="wpName" id="wpName2Ajax" tabindex="101" size="20" class="loginText" /> </td> <td></td> </tr> </table> <div style="display: block; margin-top: 8px"> <label for="wpPassword2Ajax" style="font-weight: bold;"><?php echo wfMsg("signup-password"); ?> </label> <a id="wpMailmypassword" href="#" style="font-size: 9pt;" onclick="AjaxLogin2.action='password'; AjaxLogin2.form.submit();"><?php echo wfMsg('mailmypassword'); ?> </a> </div> <table> <tr> <td id="ajaxlogin_password_cell2"> <input type="password" name="wpPassword" id="wpPassword2Ajax" tabindex="102" size="20" class="loginPassword" /> </td> <?php global $wgEnableEmail, $wgAuth; if ($wgEnableEmail && $wgAuth->allowPasswordChange()) { ?> </td> <?php } ?> </tr> </table> <div style="margin: 10px 0;"> <input type="checkbox" name="wpRemember" id="wpRemember1Ajax" tabindex="104" value="1" /> <div id="ControlBox" style="display:none"></div> <label for="wpRemember1" class="plain"><?php echo wfMsg('remembermypassword'); ?> </label> </div> <input type="submit" value="Login" style="position: absolute; left: -10000px; width: 0" /> </form> <div class="modalToolbar"> <a id="wpLoginattempt" class="wikia_button rightSideElem" href="#" onclick="AjaxLogin2.action='login'; AjaxLogin2.form.submit();" ><span><?php echo wfMsg("login"); ?> </span></a> </div> <div id="loginIntro" class="accent rightSideElem"> <div class="announcementHeader dark_text_2"> <?php $this->msg('registerintro-title'); ?> </div> <div class="announcementText"> <table> <tr><td> <?php $this->msg('registerintro-text'); ?> </td> <td> <?php global $wgExtensionsPath; ?> <img src="<?php echo $wgExtensionsPath; ?> /wikia/SpecialSignup/images/signup_login_accent_graphic.png" alt="<?php $this->msg('registerintro-title'); ?> "/> </td> </tr> </table> </div> </div> </td> </tr> </table> <div id="signupWhyProvide"></div> <div id="signupend" style="clear: both;"><?php $this->msgWiki('signupend'); ?> </div> <?php }
function execute() { global $wgOut, $wgUser, $wgStylePath, $wgStyleVersion, $wgBlankImgUrl; if (get_class($wgUser->getSkin()) == 'SkinOasis') { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SignUp.scss")); } else { $wgOut->addScript('<link rel="stylesheet" type="text/css" href="' . $wgStylePath . '/wikia/common/NewUserRegister.css?' . $wgStyleVersion . "\" />\n"); } if (!array_key_exists('message', $this->data)) { $this->data['message'] = ""; } if (!array_key_exists('ajax', $this->data)) { $this->data['ajax'] = ""; } // This didn't work right off the bat in the new signup forms, so the decision was made to just cut the functionality for now. if ($this->data['messagetype'] == 'error' && strlen($this->data['message']) > 0) { ?> <div id="userloginErrorBox3" style="display: block;"> <div id="wpError"> <?php echo $this->html('message'); ?> </div> </div> <?php } ?> <br/> <div id="userloginErrorBox"> <table> <tr> <td style="vertical-align:top;"> <span style="position: relative; top: -1px;"><img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> </td> <td> <div id="userloginInnerErrorBox"></div> </td> </table> </div> <form id="userajaxregisterform" method="post" action="<?php $this->text('actioncreate'); ?> " onsubmit="return UserRegistration.checkForm()"> <table id="userloginSpecial" width="100%"> <tr> <td width="55%" style="border:none; vertical-align: top;"> <div id="userRegisterAjax"> <?php if (@$this->haveData('createToken')) { ?> <input type="hidden" name="wpCreateaccountToken" value="<?php $this->text('createToken'); ?> " /><?php } ?> <?php if ($this->data['message'] && $this->data['ajax']) { ?> <div class="<?php $this->text('messagetype'); ?> box" style="margin:0px"> <?php if ($this->data['messagetype'] == 'error') { ?> <h2><?php $this->msg('loginerror'); ?> :</h2> <?php } ?> <?php $this->html('message'); ?> </div> <div class="visualClear"></div> <?php } ?> <?php $this->html('header'); /* pre-table point for form plugins... */ ?> <?php /* LoginLanguageSelector used to be here, moved downward and modified as part of rt#16889 */ ?> <table class="wpAjaxRegisterTable" > <colgroup> <col width="350" /> <col width="330" /> </colgroup> <tr> <td class="wpAjaxLoginInput" id="wpNameTD"> <label tabindex="0" for='wpName2'><?php $this->msg('yourname'); ?> <span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='text' name="wpName" id="wpName2" value="<?php $this->text('name'); ?> " size='20' tabindex="1" /> </label> </td> <td class="wpAjaxLoginInput" id="wpPasswordTD"> <label tabindex="0" for='wpPassword2'><?php $this->msg('yourpassword'); ?> <span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='password' name="wpPassword" id="wpPassword2" value="" size='20' tabindex="3" /> </label> </td> </tr> <tr class="wpAjaxLoginPreLine" > <td class="wpAjaxLoginInput" id="wpEmailTD"> <?php if ($this->data['useemail']) { ?> <label tabindex="0" for='wpEmail'><?php $this->msg('signup-mail'); ?> <span><a id="wpEmailInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='text' name="wpEmail" id="wpEmail" value="<?php $this->text('email'); ?> " size='20' tabindex="2" /> </label> <?php } ?> </td> <td class="wpAjaxLoginInput" id="wpRetypeTD"> <label for='wpRetype' tabindex="0"><?php $this->msg('yourpasswordagain'); ?> <span> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <input type='password' name="wpRetype" id="wpRetype" tabindex="4" value="" size='20' /> </label> </td> </tr> <tr class="wpAjaxLoginLine"> <td class="wpAjaxLoginInput"> <label for='uselang'><?php $this->msg('yourlanguage'); ?> </label><span> </span> <select style="height:22px;" name="uselang" id="uselang" tabindex="5" > <?php global $wgLanguageCode; $isSelected = false; $aTopLanguages = explode(',', wfMsg('wikia-language-top-list')); $aLanguages = wfGetFixedLanguageNames(); asort($aLanguages); if (!empty($aTopLanguages) && is_array($aTopLanguages)) { ?> <optgroup label="<?php echo wfMsg('wikia-language-top', count($aTopLanguages)); ?> "> <?php foreach ($aTopLanguages as $sLang) { $selected = ''; if (!$isSelected && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $aLanguages[$sLang]; ?> </option> <?php } ?> </optgroup> <?php } ?> <optgroup label="<?php echo wfMsg('wikia-language-all'); ?> "> <?php if (!empty($aLanguages) && is_array($aLanguages)) { foreach ($aLanguages as $sLang => $sLangName) { $selected = ''; if (empty($isSelected) && $wgLanguageCode == $sLang) { $isSelected = true; $selected = ' selected="selected"'; } ?> <option value="<?php echo $sLang; ?> " <?php echo $selected; ?> ><?php echo $sLangName; ?> </option> <?php } ?> </optgroup> <?php } ?> </select> </td> <td rowspan="2" class="wpAjaxLoginInput"> <?php if ($this->haveData('captcha')) { ?> <label for='wpUserCaptchaInfo'><?php $this->msg('usercaptcha'); ?> </label> <span><a id="wpUserCaptchaInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <?php /** * small hack on captcha to add tabindex; * oldcode * $this->html('captcha'); */ $hackedCaptcha = str_replace('id="wpCaptchaWord"', 'id="wpCaptchaWord" tabindex="9"', $this->data['captcha']); echo $hackedCaptcha; } ?> </td> </tr> <tr class="wpAjaxLoginPreLine"> <?php if (!empty($this->data['coppa'])) { ?> <td class="wpAjaxLoginInput wpAjaxLoginData" id="wpBirthDateTD"> <label for='wpBirthYear'><?php $this->msg('yourbirthdate'); ?> </label> <span><a id="wpBirthDateInfo" href="#"><?php $this->msg('signup-moreinfo'); ?> </a> <img alt="status" src="<?php print $wgBlankImgUrl; ?> "/></span> <span class="select-container"> <select name="wpBirthYear" id="wpBirthYear" tabindex="6"> <option value="-1"><?php $this->msg('userlogin-choose-year'); ?> </option> <?php $setYear = $this->data['birthyear']; $maxYear = date('Y'); for ($year = $maxYear; $year >= 1900; $year--) { $selected = $setYear == $year ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$year}\"{$selected}>{$year}</option>"; } ?> </select> <select name="wpBirthMonth" id="wpBirthMonth" tabindex="7"> <option value="-1"><?php $this->msg('userlogin-choose-month'); ?> </option> <?php $setMonth = $this->data['birthmonth']; for ($month = 1; $month <= 12; $month++) { $selected = $setMonth == $month ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$month}\"{$selected}>{$month}</option>"; } ?> </select> <select name="wpBirthDay" id="wpBirthDay" tabindex="8"> <option value="-1"><?php $this->msg('userlogin-choose-day'); ?> </option> <?php $setDay = $this->data['birthday']; for ($day = 1; $day <= 31; $day++) { $selected = $setDay == $day ? ' selected="selected"' : ''; echo "\t\t\t\t\t<option value=\"{$day}\"{$selected}>{$day}</option>"; } ?> </select> </span> </td> <?php } ?> </tr> <tr class="wpAjaxLoginLine" > <?php if ($this->data['canremember']) { ?> <td class="mw-input" style="vertical-align: top;" > <input type='checkbox' name="wpRemember" value="1" id="wpRemember" <?php if ($this->data['remember']) { ?> checked="checked"<?php } ?> tabindex="10"/> <label for="wpRemember" class="plain"><?php $this->msg('remembermypassword'); ?> </label> </td> <?php } ?> <?php if ($this->data['useemail']) { ?> <td class="mw-input" rowspan="3"> <div id="termsOfUse" style="height:45px;width:240px;"> <?php $this->msgWiki('prefs-help-terms'); ?> </div> </td> <?php } ?> <tr> <?php $tabIndex = 12; if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) { foreach ($this->data['extraInput'] as $inputItem) { ?> <tr> <td class="mw-input" > <?php if (!empty($inputItem['msg']) && $inputItem['type'] != 'checkbox') { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> "><?php $this->msgWiki($inputItem['msg']); ?> </label><?php } ?> <input type="<?php echo htmlspecialchars($inputItem['type']); ?> " name="<?php echo htmlspecialchars($inputItem['name']); ?> " tabindex="<?php echo $tabIndex++; ?> " value="<?php if ($inputItem['type'] != 'checkbox') { echo htmlspecialchars($inputItem['value']); } else { echo '1'; } ?> " id="<?php echo htmlspecialchars($inputItem['name']); ?> " <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['value'])) { echo 'checked="checked"'; } ?> /> <?php if ($inputItem['type'] == 'checkbox' && !empty($inputItem['msg'])) { ?> <label for="<?php echo htmlspecialchars($inputItem['name']); ?> "><?php $this->msgHtml($inputItem['msg']); ?> </label><?php } ?> </td> </tr> <?php } } ?> </table> <?php /*commented out, part of fix #135575 if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } */ ?> </div> </td> </tr> </table> <div id="signupWhyProvide"></div> <div id="signupend" style="clear: both;height: 12px;"><?php $this->msgWiki('signupend'); ?> </div> <div class="modalToolbar neutral"> <input name="wpCreateaccount" type="submit" id="wpCreateaccountXSteer" onclick="UserRegistration.submitForm2( 'normal' ); return false;" value="<?php print wfMsg("createaccount"); ?> " tabindex ="<?php echo $tabIndex; $tabIndex++; ?> " /> <?php if ($this->data['createemail']) { ?> <input name="wpCreateaccountMail" type="submit" id="wpCreateaccountX" href="#" onclick="$('#wpCreateaccountXSteer').value = false; $('#wpCreateaccountYSteer').value = true; UserRegistration.submitForm2( 'mail' ); return false;" value="<?php print wfMsg("createaccountmail"); ?> " tabindex ="<?php echo $tabIndex; $tabIndex++; ?> " /> <?php } ?> <input type="submit" name="wpCreateaccountClose" id="wpCreateaccountClose" class="secondary" onclick="AjaxLogin.close(); return false;" value="<?php print wfMsg("Cancel"); ?> " tabindex ="<?php echo $tabIndex; $tabIndex++; ?> " /> </div> </form> <?php }
/** * create wiki form * * @access public * * @param $subpage Mixed: subpage of SpecialPage */ public function createWikiForm() { global $wgOut, $wgUser, $wgExtensionsPath, $wgScriptPath, $wgStylePath; global $wgRequest, $wgDBname, $wgMemc; wfProfileIn(__METHOD__); #- $aTopLanguages = explode(',', wfMsg('autocreatewiki-language-top-list')); $aLanguages = wfGetFixedLanguageNames(); asort($aLanguages); #- $hubs = WikiFactoryHub::getInstance(); $aCategories = $hubs->getCategories(); #-- $params = $this->fixSessionKeys(); if (empty($params) && empty($this->mPosted)) { $ip = $wgRequest->getIP(); $key = wfMemcKey(self::CACHE_LOGIN_KEY, $wgDBname, $ip); $params = $wgMemc->get($key); } $fancyCaptcha = new FancyCaptcha(); $wgOut->addScript("<link rel=\"stylesheet\" type=\"text/css\" href=\"{$wgStylePath}/common/form.css\" />"); $wgOut->addScript("<link rel=\"stylesheet\" type=\"text/css\" href=\"{$wgStylePath}/common/wikia_ui/tabs.css\" />"); // RT #19245 $wgOut->addStyle("common/form.ie7.css", '', 'IE 7'); $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgStylePath}/common/form.js\"></script>"); /** * run template */ $this->mAction = $wgRequest->getVal("action", false); if ($this->mAction == "reload") { $params['wiki-name'] = $wgRequest->getVal('wiki-name', false); $params['wiki-domain'] = $wgRequest->getVal('wiki-domain', false); $params['wiki-category'] = $wgRequest->getVal('wiki-category', false); $params['wiki-language'] = $wgRequest->getVal('wiki-language', $wgUser->getOption('language')); $params['wiki-type'] = $wgRequest->getVal('wiki-type', false); } $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $oTmpl->set_vars(array("subDomain" => $this->mDefSubdomain, "wgUser" => $wgUser, "wgExtensionsPath" => $wgExtensionsPath, "aLanguages" => $aLanguages, "aTopLanguages" => $aTopLanguages, "aCategories" => $aCategories, "wgScriptPath" => $wgScriptPath, "mTitle" => $this->mTitle, "mType" => $this->mType, "mLanguage" => $this->mLang, "mPostedErrors" => $this->mPostedErrors, "wgStylePath" => $wgStylePath, "captchaForm" => $fancyCaptcha->getForm(), "params" => $params, "subName" => $this->mDefSitename, "defaultDomain" => self::DEFAULT_DOMAIN, "mDomains" => $this->mDomains, "mSitenames" => $this->mSitenames)); $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->setArticleRelated(false); $wgOut->addHtml($oTmpl->render("create-wiki-form")); wfProfileOut(__METHOD__); return; }