Index: trunk/extensions/SocialProfile/UserProfile/SpecialUpdateProfile.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | // This feature is only available for logged-in users. |
50 | 50 | if( !$wgUser->isLoggedIn() ) { |
51 | | - $wgOut->setPagetitle( wfMsgForContent( 'user-profile-update-notloggedin-title' ) ); |
| 51 | + $wgOut->setPageTitle( wfMsgForContent( 'user-profile-update-notloggedin-title' ) ); |
52 | 52 | $wgOut->addHTML( |
53 | 53 | wfMsgForContent( 'user-profile-update-notloggedin-text', |
54 | 54 | SpecialPage::getTitleFor( 'UserLogin' )->escapeFullURL(), |
— | — | @@ -64,8 +64,8 @@ |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Add CSS & JS |
68 | | - $wgOut->addStyle( '../..' . $wgUserProfileScripts . '/UserProfile.css' ); |
69 | | - $wgOut->addScriptFile( $wgUserProfileScripts.'/UpdateProfile.js' ); |
| 68 | + $wgOut->addExtensionStyle( $wgUserProfileScripts . '/UserProfile.css' ); |
| 69 | + $wgOut->addScriptFile( $wgUserProfileScripts . '/UpdateProfile.js' ); |
70 | 70 | |
71 | 71 | if( $wgRequest->wasPosted() ){ |
72 | 72 | //$section = $wgRequest->getVal('section'); |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | $wgUser->mEmailAuthenticated = null; # but flag as "dirty" = unauthenticated |
133 | 133 | } |
134 | 134 | |
135 | | - if( $wgEmailAuthentication ) { |
| 135 | + if( $wgEmailAuthentication && !$wgUser->isEmailConfirmed() ) { |
136 | 136 | # Mail a temporary password to the dirty address. |
137 | 137 | # User can come back through the confirmation URL to re-enable email. |
138 | 138 | $result = $wgUser->sendConfirmationMail(); |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | |
213 | 213 | $this->initProfile(); |
214 | 214 | $dbw = wfGetDB( DB_MASTER ); |
215 | | - $dbw->update('user_profile', |
| 215 | + $dbw->update('user_profile', |
216 | 216 | array( /* SET */ |
217 | 217 | 'up_location_city' => $wgRequest->getVal( 'location_city' ), |
218 | 218 | 'up_location_state' => $wgRequest->getVal( 'location_state' ), |
— | — | @@ -231,9 +231,9 @@ |
232 | 232 | ), array( /* WHERE */ |
233 | 233 | 'up_user_id' => $wgUser->getID() |
234 | 234 | ), __METHOD__ |
235 | | - ); |
| 235 | + ); |
236 | 236 | // Relevant to Wikia Blackbird. |
237 | | - if( $wgSitename == "Wikia Blackbird" ){ |
| 237 | + if( $wgSitename == 'Wikia Blackbird' ){ |
238 | 238 | $enroll = $wgRequest->getVal( 'enroll' ); |
239 | 239 | if( $enroll == '' ) $enroll = 0; |
240 | 240 | $wgUser->setOption( 'blackbirdenroll', $enroll ); |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | |
249 | 249 | $this->initProfile(); |
250 | 250 | $dbw = wfGetDB( DB_MASTER ); |
251 | | - $dbw->update( 'user_profile', |
| 251 | + $dbw->update( 'user_profile', |
252 | 252 | array( /* SET */ |
253 | 253 | 'up_custom_1' => $wgRequest->getVal( 'custom1' ), |
254 | 254 | 'up_custom_2' => $wgRequest->getVal( 'custom2' ), |
— | — | @@ -256,7 +256,7 @@ |
257 | 257 | ), array( /* WHERE */ |
258 | 258 | 'up_user_id' => $wgUser->getID() |
259 | 259 | ), __METHOD__ |
260 | | - ); |
| 260 | + ); |
261 | 261 | $wgMemc->delete( wfMemcKey( 'user', 'profile', 'info', $wgUser->getID() ) ); |
262 | 262 | } |
263 | 263 | |
— | — | @@ -345,19 +345,19 @@ |
346 | 346 | $form .= '<div class="profile-update"> |
347 | 347 | <p class="profile-update-title">' . wfMsg( 'user-profile-personal-info' ) . '</p> |
348 | 348 | <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-name' ) . '</p> |
349 | | - <p class="profile-update-unit"><input type="text" size="25" name="real_name" id="real_name" value="'. $real_name . '"/></p> |
| 349 | + <p class="profile-update-unit"><input type="text" size="25" name="real_name" id="real_name" value="' . $real_name . '"/></p> |
350 | 350 | <div class="cleared"></div> |
351 | 351 | <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-email' ) . '</p> |
352 | | - <p class="profile-update-unit"><input type="text" size="25" name="email" id="email" value="'. $email . '"/>'; |
| 352 | + <p class="profile-update-unit"><input type="text" size="25" name="email" id="email" value="' . $email . '"/>'; |
353 | 353 | if( !$wgUser->mEmailAuthenticated ){ |
354 | 354 | $confirm = SpecialPage::getTitleFor( 'Confirmemail' ); |
355 | | - $form .= " <a href=\"{$confirm->getFullURL()}\">" . wfMsg( 'user-profile-personal-confirmemail' ) . "</a>"; |
| 355 | + $form .= " <a href=\"{$confirm->getFullURL()}\">" . wfMsg( 'user-profile-personal-confirmemail' ) . '</a>'; |
356 | 356 | } |
357 | 357 | $form .= '</p> |
358 | 358 | <div class="cleared"></div>'; |
359 | 359 | if( !$wgUser->mEmailAuthenticated ){ |
360 | 360 | $form .= '<p class="profile-update-unit-left"></p> |
361 | | - <p class="profile-update-unit-small">'.wfMsg( 'user-profile-personal-email-needs-auth' ).'</p>'; |
| 361 | + <p class="profile-update-unit-small">' . wfMsg( 'user-profile-personal-email-needs-auth' ) . '</p>'; |
362 | 362 | } |
363 | 363 | $form .= '<div class="cleared"></div> |
364 | 364 | </div> |
— | — | @@ -391,7 +391,7 @@ |
392 | 392 | $form .= '<div class="profile-update"> |
393 | 393 | <p class="profile-update-title">' . wfMsg( 'user-profile-personal-hometown' ) . '</p> |
394 | 394 | <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-city' ) . '</p> |
395 | | - <p class="profile-update-unit"><input type="text" size="25" name="hometown_city" id="hometown_city" value="'. $hometown_city . '" /></p> |
| 395 | + <p class="profile-update-unit"><input type="text" size="25" name="hometown_city" id="hometown_city" value="' . $hometown_city . '" /></p> |
396 | 396 | <div class="cleared"></div> |
397 | 397 | <p class="profile-update-unit-left" id="hometown_state_label">' . wfMsg( 'user-profile-personal-country' ) . '</p> |
398 | 398 | <p class="profile-update-unit">'; |
— | — | @@ -400,11 +400,11 @@ |
401 | 401 | <script type=\"text/javascript\"> |
402 | 402 | displaySection(\"hometown_state\",\"" . $hometown_country . "\",\"" . $hometown_state . "\") |
403 | 403 | </script>"; |
404 | | - $form .= "<select name=\"hometown_country\" id=\"hometown_country\" onChange=\"displaySection('hometown_state',this.value,'')\"><option></option>"; |
| 404 | + $form .= "<select name=\"hometown_country\" id=\"hometown_country\" onchange=\"displaySection('hometown_state',this.value,'')\"><option></option>"; |
405 | 405 | |
406 | 406 | foreach( $countries as $country ) { |
407 | 407 | $form .= "<option value=\"{$country}\"" . ( ( $country == $hometown_country ) ? ' selected="selected"' : '' ) . ">"; |
408 | | - $form .= $country . "</option>"; |
| 408 | + $form .= $country . '</option>'; |
409 | 409 | } |
410 | 410 | |
411 | 411 | $form .= '</select>'; |
— | — | @@ -416,63 +416,64 @@ |
417 | 417 | $form .= '<div class="profile-update"> |
418 | 418 | <p class="profile-update-title">' . wfMsg( 'user-profile-personal-birthday' ) . '</p> |
419 | 419 | <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-birthdate' ) . '</p> |
420 | | - <p class="profile-update-unit"><input type="text" size="25" name="birthday" id="birthday" value="'. $birthday . '" /></p> |
| 420 | + <p class="profile-update-unit"><input type="text" size="25" name="birthday" id="birthday" value="' . $birthday . '" /></p> |
421 | 421 | <div class="cleared"></div> |
422 | 422 | </div><div class="cleared"></div>'; |
423 | 423 | |
424 | | - $form .= "<div class=\"profile-update\"> |
425 | | - <p class=\"profile-update-title\">" . wfMsg( 'user-profile-personal-aboutme' ) . "</p> |
426 | | - <p class=\"profile-update-unit-left\">" . wfMsg( 'user-profile-personal-aboutme' ) . "</p> |
427 | | - <p class=\"profile-update-unit\"> |
428 | | - <textarea name=\"about\" id=\"about\" rows=\"3\" cols=\"75\">{$about}</textarea> |
| 424 | + $form .= '<div class="profile-update" id="profile-update-personal-aboutme"> |
| 425 | + <p class="profile-update-title">' . wfMsg( 'user-profile-personal-aboutme' ) . '</p> |
| 426 | + <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-aboutme' ) . '</p> |
| 427 | + <p class="profile-update-unit"> |
| 428 | + <textarea name="about" id="about" rows="3" cols="75">' . $about . '</textarea> |
429 | 429 | </p> |
430 | | - <div class=\"cleared\"></div> |
| 430 | + <div class="cleared"></div> |
431 | 431 | </div> |
432 | | - <div class=\"cleared\"></div> |
| 432 | + <div class="cleared"></div> |
433 | 433 | |
434 | | - <div class=\"profile-update\"> |
435 | | - <p class=\"profile-update-title\">" . wfMsg( 'user-profile-personal-work' ) . "</p> |
436 | | - <p class=\"profile-update-unit-left\">" . wfMsg( 'user-profile-personal-occupation' ) . "</p> |
437 | | - <p class=\"profile-update-unit\"> |
438 | | - <textarea name=\"occupation\" id=\"occupation\" rows=\"2\" cols=\"75\">{$occupation}</textarea> |
| 434 | + <div class="profile-update" id="profile-update-personal-work"> |
| 435 | + <p class="profile-update-title">' . wfMsg( 'user-profile-personal-work' ) . '</p> |
| 436 | + <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-occupation' ) . '</p> |
| 437 | + <p class="profile-update-unit"> |
| 438 | + <textarea name="occupation" id="occupation" rows="2" cols="75">' . $occupation . '</textarea> |
439 | 439 | </p> |
440 | | - <div class=\"cleared\"></div> |
| 440 | + <div class="cleared"></div> |
441 | 441 | </div> |
442 | | - <div class=\"cleared\"></div> |
| 442 | + <div class="cleared"></div> |
443 | 443 | |
444 | | - <div class=\"profile-update\"> |
445 | | - <p class=\"profile-update-title\">" . wfMsg( 'user-profile-personal-education' ) . "</p> |
446 | | - <p class=\"profile-update-unit-left\">" . wfMsg( 'user-profile-personal-schools' ) . "</p> |
447 | | - <p class=\"profile-update-unit\"> |
448 | | - <textarea name=\"schools\" id=\"schools\" rows=\"2\" cols=\"75\">{$schools}</textarea> |
| 444 | + <div class="profile-update" id="profile-update-personal-education"> |
| 445 | + <p class="profile-update-title">' . wfMsg( 'user-profile-personal-education' ) . '</p> |
| 446 | + <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-schools' ) . '</p> |
| 447 | + <p class="profile-update-unit"> |
| 448 | + <textarea name="schools" id="schools" rows="2" cols="75">' . $schools . '</textarea> |
449 | 449 | </p> |
450 | | - <div class=\"cleared\"></div> |
| 450 | + <div class="cleared"></div> |
451 | 451 | </div> |
452 | | - <div class=\"cleared\"></div> |
| 452 | + <div class="cleared"></div> |
453 | 453 | |
454 | | - <div class=\"profile-update\"> |
455 | | - <p class=\"profile-update-title\">" . wfMsg( 'user-profile-personal-places' ) . "</p> |
456 | | - <p class=\"profile-update-unit-left\">" . wfMsg( 'user-profile-personal-placeslived' ) . "</p> |
457 | | - <p class=\"profile-update-unit\"> |
458 | | - <textarea name=\"places\" id=\"places\" rows=\"3\" cols=\"75\">{$places}</textarea> |
| 454 | + <div class="profile-update" id="profile-update-personal-places"> |
| 455 | + <p class="profile-update-title">' . wfMsg( 'user-profile-personal-places' ) . '</p> |
| 456 | + <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-placeslived' ) . '</p> |
| 457 | + <p class="profile-update-unit"> |
| 458 | + <textarea name="places" id="places" rows="3" cols="75">' . $places . '</textarea> |
459 | 459 | </p> |
460 | | - <div class=\"cleared\"></div> |
| 460 | + <div class="cleared"></div> |
461 | 461 | </div> |
462 | | - <div class=\"cleared\"></div> |
| 462 | + <div class="cleared"></div> |
463 | 463 | |
464 | | - <div class=\"profile-update\"> |
465 | | - <p class=\"profile-update-title\">" . wfMsg( 'user-profile-personal-web' ) . "</p> |
466 | | - <p class=\"profile-update-unit-left\">" . wfMsg( 'user-profile-personal-websites' ) . "</p> |
467 | | - <p class=\"profile-update-unit\"> |
468 | | - <textarea name=\"websites\" id=\"websites\" rows=\"2\" cols=\"75\">{$websites}</textarea> |
| 464 | + <div class="profile-update" id="profile-update-personal-web"> |
| 465 | + <p class="profile-update-title">' . wfMsg( 'user-profile-personal-web' ) . '</p> |
| 466 | + <p class="profile-update-unit-left">' . wfMsg( 'user-profile-personal-websites' ) . '</p> |
| 467 | + <p class="profile-update-unit"> |
| 468 | + <textarea name="websites" id="websites" rows="2" cols="75">' . $websites . '</textarea> |
469 | 469 | </p> |
470 | | - <div class=\"cleared\"></div> |
| 470 | + <div class="cleared"></div> |
471 | 471 | </div> |
472 | | - <div class=\"cleared\"></div>"; |
| 472 | + <div class="cleared"></div>'; |
473 | 473 | |
474 | 474 | $form .= ' |
475 | 475 | <input type="button" class="site-button" value="' . wfMsg( 'user-profile-update-button' ) . '" size="20" onclick="document.profile.submit()" /> |
476 | | - </div></form>'; |
| 476 | + </div> |
| 477 | + </form>'; |
477 | 478 | |
478 | 479 | return $form; |
479 | 480 | } |
— | — | @@ -605,17 +606,21 @@ |
606 | 607 | return $form; |
607 | 608 | } |
608 | 609 | |
| 610 | + /** |
| 611 | + * Displays the form for editing custom (site-specific) information |
| 612 | + * @return $form Mixed: HTML output |
| 613 | + */ |
609 | 614 | function displayCustomForm(){ |
610 | 615 | global $wgRequest, $wgUser, $wgOut; |
611 | 616 | |
612 | 617 | $dbr = wfGetDB( DB_MASTER ); |
613 | 618 | $s = $dbr->selectRow( 'user_profile', |
614 | | - array( |
615 | | - 'up_custom_1', 'up_custom_2','up_custom_3', 'up_custom_4','up_custom_5' |
616 | | - ), |
617 | | - array( 'up_user_id' => $wgUser->getID() ), |
618 | | - __METHOD__ |
619 | | - ); |
| 619 | + array( |
| 620 | + 'up_custom_1', 'up_custom_2', 'up_custom_3', 'up_custom_4', 'up_custom_5' |
| 621 | + ), |
| 622 | + array( 'up_user_id' => $wgUser->getID() ), |
| 623 | + __METHOD__ |
| 624 | + ); |
620 | 625 | |
621 | 626 | if ( $s !== false ) { |
622 | 627 | $custom1 = $s->up_custom_1; |
— | — | @@ -629,34 +634,42 @@ |
630 | 635 | $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'user-profile-tidbits-title' ) ) ); |
631 | 636 | $form = '<h1>' . wfMsg( 'user-profile-tidbits-title' ) . '</h1>'; |
632 | 637 | $form .= UserProfile::getEditProfileNav( wfMsg( 'user-profile-section-custom' ) ); |
633 | | - $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"profile\"> |
634 | | - <div class=\"profile-info clearfix\"> |
635 | | - <div class=\"profile-update\"> |
636 | | - <p class=\"profile-update-title\">" . wfMsgForContent( 'user-profile-tidbits-title' ) . "</p> |
637 | | - <p class=\"profile-update-unit-left\">" . wfMsgForContent( 'custom-info-field1' ) . "</p> |
638 | | - <p class=\"profile-update-unit\"> |
639 | | - <textarea name=\"custom1\" id=\"fav_moment\" rows=\"3\" cols=\"75\">{$custom1}</textarea> |
| 638 | + $form .= '<form action="" method="post" enctype="multipart/form-data" name="profile"> |
| 639 | + <div class="profile-info clearfix"> |
| 640 | + <div class="profile-update"> |
| 641 | + <p class="profile-update-title">' . wfMsgForContent( 'user-profile-tidbits-title' ) . '</p> |
| 642 | + <div id="profile-update-custom1"> |
| 643 | + <p class="profile-update-unit-left">' . wfMsgForContent( 'custom-info-field1' ) . '</p> |
| 644 | + <p class="profile-update-unit"> |
| 645 | + <textarea name="custom1" id="fav_moment" rows="3" cols="75">' . $custom1 . '</textarea> |
640 | 646 | </p> |
641 | | - <div class=\"cleared\"></div> |
642 | | - <p class=\"profile-update-unit-left\">" . wfMsgForContent( 'custom-info-field2' ) . "</p> |
643 | | - <p class=\"profile-update-unit\"> |
644 | | - <textarea name=\"custom2\" id=\"least_moment\" rows=\"3\" cols=\"75\">{$custom2}</textarea> |
| 647 | + </div> |
| 648 | + <div class="cleared"></div> |
| 649 | + <div id="profile-update-custom2"> |
| 650 | + <p class="profile-update-unit-left">' . wfMsgForContent( 'custom-info-field2' ) . '</p> |
| 651 | + <p class="profile-update-unit"> |
| 652 | + <textarea name="custom2" id="least_moment" rows="3" cols="75">' . $custom2 . '</textarea> |
645 | 653 | </p> |
646 | | - <div class=\"cleared\"></div> |
647 | | - <p class=\"profile-update-unit-left\">" . wfMsgForContent( 'custom-info-field3' ) . "</p> |
648 | | - <p class=\"profile-update-unit\"> |
649 | | - <textarea name=\"custom3\" id=\"fav_athlete\" rows=\"3\" cols=\"75\">{$custom3}</textarea> |
| 654 | + </div> |
| 655 | + <div class="cleared"></div> |
| 656 | + <div id="profile-update-custom3"> |
| 657 | + <p class="profile-update-unit-left">' . wfMsgForContent( 'custom-info-field3' ) . '</p> |
| 658 | + <p class="profile-update-unit"> |
| 659 | + <textarea name="custom3" id="fav_athlete" rows="3" cols="75">' . $custom3 . '</textarea> |
650 | 660 | </p> |
651 | | - <div class=\"cleared\"></div> |
652 | | - <p class=\"profile-update-unit-left\">" . wfMsgForContent( 'custom-info-field4' ) . "</p> |
653 | | - <p class=\"profile-update-unit\"> |
654 | | - <textarea name=\"custom4\" id=\"least_fav_athlete\" rows=\"3\" cols=\"75\">{$custom4}</textarea> |
| 661 | + </div> |
| 662 | + <div class="cleared"></div> |
| 663 | + <div id="profile-update-custom4"> |
| 664 | + <p class="profile-update-unit-left">' . wfMsgForContent( 'custom-info-field4' ) . '</p> |
| 665 | + <p class="profile-update-unit"> |
| 666 | + <textarea name="custom4" id="least_fav_athlete" rows="3" cols="75">' . $custom4 . '</textarea> |
655 | 667 | </p> |
656 | | - <div class=\"cleared\"></div> |
| 668 | + </div> |
| 669 | + <div class="cleared"></div> |
657 | 670 | </div> |
658 | | - <input type=\"button\" class=\"site-button\" value='" . wfMsgForContent('user-profile-update-button') . "' size=\"20\" onclick=\"document.profile.submit()\" /> |
| 671 | + <input type="button" class="site-button" value="' . wfMsg( 'user-profile-update-button' ) . '" size="20" onclick="document.profile.submit()" /> |
659 | 672 | </div> |
660 | | - </form>"; |
| 673 | + </form>'; |
661 | 674 | |
662 | 675 | return $form; |
663 | 676 | } |