Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
— — @@ -11,12 +11,12 @@
12 12
13 13 class UserProfilePage extends Article {
14 14
15 (削除) - var $title = null; (削除ここまで)
15 (追記) + public $title = null; (追記ここまで)
16 16
17 17 /**
18 18 * Constructor
19 19 */
20 (削除) - function __construct( &$title ) { (削除ここまで)
20 (追記) + function __construct( $title ) { (追記ここまで)
21 21 global $wgUser;
22 22 parent::__construct( $title );
23 23 $this->user_name = $title->getText();
— — @@ -219,7 +219,7 @@
220 220 array(
221 221 'page_title', 'UNIX_TIMESTAMP(poll_date) AS poll_date'
222 222 ),
223 (削除) - /*where*/ array( 'poll_user_id' => $this->user_id ), (削除ここまで)
223 (追記) + /* WHERE */array( 'poll_user_id' => $this->user_id ), (追記ここまで)
224 224 __METHOD__,
225 225 array( 'ORDER BY' => 'poll_id DESC', 'LIMIT' => 3 ),
226 226 array( 'page' => array( 'INNER JOIN', 'page_id = poll_page_id' ) )
— — @@ -516,10 +516,7 @@
517 517 $user_level = new UserLevel( $stats_data['points'] );
518 518 $level_link = Title::makeTitle( NS_HELP, wfMsgForContent( 'user-profile-userlevels-link' ) );
519 519
520 (削除) - if ( !$this->profile_data ) { (削除ここまで)
521 (削除) - $profile = new UserProfile( $user_name ); (削除ここまで)
522 (削除) - $this->profile_data = $profile->getProfile(); (削除ここまで)
523 (削除) - } (削除ここまで)
520 (追記) + $this->initializeProfileData( $user_name ); (追記ここまで)
524 521 $profile_data = $this->profile_data;
525 522
526 523 $defaultCountry = wfMsgForContent( 'user-profile-default-country' );
— — @@ -636,10 +633,7 @@
637 634 return '';
638 635 }
639 636
640 (削除) - if ( !$this->profile_data ) { (削除ここまで)
641 (削除) - $profile = new UserProfile( $user_name ); (削除ここまで)
642 (削除) - $this->profile_data = $profile->getProfile(); (削除ここまで)
643 (削除) - } (削除ここまで)
637 (追記) + $this->initializeProfileData( $user_name ); (追記ここまで)
644 638
645 639 $profile_data = $this->profile_data;
646 640
— — @@ -707,10 +701,7 @@
708 702 return '';
709 703 }
710 704
711 (削除) - if ( !$this->profile_data ) { (削除ここまで)
712 (削除) - $profile = new UserProfile( $user_name ); (削除ここまで)
713 (削除) - $this->profile_data = $profile->getProfile(); (削除ここまで)
714 (削除) - } (削除ここまで)
705 (追記) + $this->initializeProfileData( $user_name ); (追記ここまで)
715 706
716 707 $profile_data = $this->profile_data;
717 708 $joined_data = $profile_data['movies'] . $profile_data['tv'] .
— — @@ -747,7 +738,7 @@
748 739 $this->getProfileSection( wfMsg( 'other-info-snacks' ), $profile_data['snacks'], false ) .
749 740 $this->getProfileSection( wfMsg( 'other-info-drinks' ), $profile_data['drinks'], false ) .
750 741 '</div>';
751 (削除) - } elseif ( $wgUser->getName() == $user_name ) { (削除ここまで)
742 (追記) + } elseif ( $this->isOwner() ) { (追記ここまで)
752 743 $output .= '<div class="user-section-heading">
753 744 <div class="user-section-title">' .
754 745 wfMsg( 'other-info-title' ) .
— — @@ -786,10 +777,7 @@
787 778 $user_level = new UserLevel( $stats_data['points'] );
788 779 $level_link = Title::makeTitle( NS_HELP, wfMsgForContent( 'user-profile-userlevels-link' ) );
789 780
790 (削除) - if ( !$this->profile_data ) { (削除ここまで)
791 (削除) - $profile = new UserProfile( $user_name ); (削除ここまで)
792 (削除) - $this->profile_data = $profile->getProfile(); (削除ここまで)
793 (削除) - } (削除ここまで)
781 (追記) + $this->initializeProfileData( $user_name ); (追記ここまで)
794 782 $profile_data = $this->profile_data;
795 783
796 784 // Variables and other crap
— — @@ -942,7 +930,7 @@
943 931 $avatar = new wAvatar( $this->user_id, 'l' );
944 932 $avatarTitle = SpecialPage::getTitleFor( 'UploadAvatar' );
945 933
946 (削除) - $output .= '<div class="profile-image">'; (削除ここまで)
934 (追記) + $output = '<div class="profile-image">'; (追記ここまで)
947 935 if ( $wgUser->getName() == $this->user_name ) {
948 936 if ( strpos( $avatar->getAvatarImage(), 'default_' ) != false ) {
949 937 $caption = 'upload image';
— — @@ -1234,63 +1222,6 @@
1235 1223 $by_type .= $item;
1236 1224 }
1237 1225 $output .= "<div id=\"recent-all\">$by_type</div>";
1238 (削除) - (削除ここまで)
1239 (削除) - $by_type = ''; (削除ここまで)
1240 (削除) - if ( isset( $items_html_type['edit'] ) && is_array( $items_html_type['edit'] ) ) { (削除ここまで)
1241 (削除) - foreach ( $items_html_type['edit'] as $item ) { (削除ここまで)
1242 (削除) - $by_type .= $item; (削除ここまで)
1243 (削除) - } (削除ここまで)
1244 (削除) - } (削除ここまで)
1245 (削除) - (削除ここまで)
1246 (削除) - $by_type = ''; (削除ここまで)
1247 (削除) - if ( isset( $items_html_type['comment'] ) && is_array( $items_html_type['comment'] ) ) { (削除ここまで)
1248 (削除) - foreach ( $items_html_type['comment'] as $item ) { (削除ここまで)
1249 (削除) - $by_type .= $item; (削除ここまで)
1250 (削除) - } (削除ここまで)
1251 (削除) - } (削除ここまで)
1252 (削除) - (削除ここまで)
1253 (削除) - $by_type = ''; (削除ここまで)
1254 (削除) - if ( isset( $items_html_type['gift-sent'] ) && is_array( $items_html_type['gift-sent'] ) ) { (削除ここまで)
1255 (削除) - foreach ( $items_html_type['gift-sent'] as $item ) { (削除ここまで)
1256 (削除) - $by_type .= $item; (削除ここまで)
1257 (削除) - } (削除ここまで)
1258 (削除) - } (削除ここまで)
1259 (削除) - (削除ここまで)
1260 (削除) - $by_type = ''; (削除ここまで)
1261 (削除) - if ( isset( $items_html_type['gift-rec'] ) && is_array( $items_html_type['gift-rec'] ) ) { (削除ここまで)
1262 (削除) - foreach ( $items_html_type['gift-rec'] as $item ) { (削除ここまで)
1263 (削除) - $by_type .= $item; (削除ここまで)
1264 (削除) - } (削除ここまで)
1265 (削除) - } (削除ここまで)
1266 (削除) - (削除ここまで)
1267 (削除) - $by_type = ''; (削除ここまで)
1268 (削除) - if ( isset( $items_html_type['system_gift'] ) && is_array( $items_html_type['system_gift'] ) ) { (削除ここまで)
1269 (削除) - foreach ( $items_html_type['system_gift'] as $item ) { (削除ここまで)
1270 (削除) - $by_type .= $item; (削除ここまで)
1271 (削除) - } (削除ここまで)
1272 (削除) - } (削除ここまで)
1273 (削除) - (削除ここまで)
1274 (削除) - $by_type = ''; (削除ここまで)
1275 (削除) - if ( isset( $items_html_type['friend'] ) && is_array( $items_html_type['friend'] ) ) { (削除ここまで)
1276 (削除) - foreach ( $items_html_type['friend'] as $item ) { (削除ここまで)
1277 (削除) - $by_type .= $item; (削除ここまで)
1278 (削除) - } (削除ここまで)
1279 (削除) - } (削除ここまで)
1280 (削除) - (削除ここまで)
1281 (削除) - $by_type = ''; (削除ここまで)
1282 (削除) - if ( isset( $items_html_type['foe'] ) && is_array( $items_html_type['foe'] ) ) { (削除ここまで)
1283 (削除) - foreach ( $items_html_type['foe'] as $item ) { (削除ここまで)
1284 (削除) - $by_type .= $item; (削除ここまで)
1285 (削除) - } (削除ここまで)
1286 (削除) - } (削除ここまで)
1287 (削除) - (削除ここまで)
1288 (削除) - $by_type = ''; (削除ここまで)
1289 (削除) - if ( isset( $items_html_type['system_message'] ) && is_array( $items_html_type['system_message'] ) ) { (削除ここまで)
1290 (削除) - foreach ( $items_html_type['system_message'] as $item ) { (削除ここまで)
1291 (削除) - $by_type .= $item; (削除ここまで)
1292 (削除) - } (削除ここまで)
1293 (削除) - } (削除ここまで)
1294 (削除) - (削除ここまで)
1295 1226 }
1296 1227
1297 1228 return $output;
— — @@ -1548,7 +1479,7 @@
1549 1480 if ( $wgUser->isLoggedIn() && !$wgUser->isBlocked() ) {
1550 1481 $output .= '<div class="user-page-message-form">
1551 1482 <input type="hidden" id="user_name_to" name="user_name_to" value="' . addslashes( $user_name ) . '" />
1552 (削除) - <span style="color:#797979;">' . (削除ここまで)
1483 (追記) + <span class="profile-board-message-type">' . (追記ここまで)
1553 1484 wfMsgHtml( 'userboard_messagetype' ) .
1554 1485 '</span>
1555 1486 <select id="message_type">
— — @@ -1782,4 +1713,10 @@
1783 1714 return $output;
1784 1715 }
1785 1716
1717 (追記) + private function initializeProfileData( $username ) { (追記ここまで)
1718 (追記) + if ( !$this->profile_data ) { (追記ここまで)
1719 (追記) + $profile = new UserProfile( $username ); (追記ここまで)
1720 (追記) + $this->profile_data = $profile->getProfile(); (追記ここまで)
1721 (追記) + } (追記ここまで)
1722 (追記) + } (追記ここまで)
1786 1723 }
Index: trunk/extensions/SocialProfile/UserProfile/UserProfile.css
— — @@ -652,3 +652,8 @@
653 653 color: #fff;
654 654 font-weight: bold;
655 655 }
656 (追記) + (追記ここまで)
657 (追記) +/* The text "Message type" on the left side of the message type selector on profile page */ (追記ここまで)
658 (追記) +.profile-board-message-type { (追記ここまで)
659 (追記) + color: #797979; (追記ここまで)
660 (追記) +} (追記ここまで)
\ No newline at end of file
Index: trunk/extensions/SocialProfile/UserProfile/AvatarClass.php
— — @@ -12,9 +12,9 @@
13 13 * @ingroup Extensions
14 14 */
15 15 class wAvatar {
16 (削除) - var $user_name = null; (削除ここまで)
17 (削除) - var $user_id; (削除ここまで)
18 (削除) - var $avatar_type = 0; (削除ここまで)
16 (追記) + public $user_name = null; (追記ここまで)
17 (追記) + public $user_id; (追記ここまで)
18 (追記) + public $avatar_type = 0; (追記ここまで)
19 19
20 20 /**
21 21 * Constructor
Index: trunk/extensions/SocialProfile/UserProfile/SpecialUpdateProfile.php
— — @@ -39,7 +39,6 @@
40 40 __METHOD__
41 41 );
42 42 if ( $s === false ) {
43 (削除) - $dbw = wfGetDB( DB_MASTER ); (削除ここまで)
44 43 $dbw->insert(
45 44 'user_profile',
46 45 array( 'up_user_id' => $user->getID() ),
— — @@ -222,7 +221,7 @@
223 222 wfRunHooks( 'SpecialUpdateProfile::saveSettings_pref', array( $this, $wgRequest ) );
224 223 }
225 224
226 (削除) - function formatBirthdayDB( $birthday ) { (削除ここまで)
225 (追記) + public static function formatBirthdayDB( $birthday ) { (追記ここまで)
227 226 $dob = explode( '/', $birthday );
228 227 if ( count( $dob ) == 2 || count( $dob ) == 3 ) {
229 228 $year = isset( $dob[2] ) ? $dob[2] : 2007;
— — @@ -235,7 +234,7 @@
236 235 return ( $birthday_date );
237 236 }
238 237
239 (削除) - function formatBirthday( $birthday, $showYOB = false ) { (削除ここまで)
238 (追記) + public static function formatBirthday( $birthday, $showYOB = false ) { (追記ここまで)
240 239 $dob = explode( '-', $birthday );
241 240 if ( count( $dob ) == 3 ) {
242 241 $month = $dob[1];
— — @@ -275,7 +274,7 @@
276 275 'up_hometown_state' => $wgRequest->getVal( 'hometown_state' ),
277 276 'up_hometown_country' => $wgRequest->getVal( 'hometown_country' ),
278 277
279 (削除) - 'up_birthday' => $this->formatBirthdayDB( $wgRequest->getVal( 'birthday' ) ), (削除ここまで)
278 (追記) + 'up_birthday' => self::formatBirthdayDB( $wgRequest->getVal( 'birthday' ) ), (追記ここまで)
280 279 'up_about' => $wgRequest->getVal( 'about' ),
281 280 'up_occupation' => $wgRequest->getVal( 'occupation' ),
282 281 'up_schools' => $wgRequest->getVal( 'schools' ),
— — @@ -375,7 +374,7 @@
376 375 function displayBasicForm( $user ) {
377 376 global $wgRequest, $wgUser, $wgOut;
378 377
379 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
378 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
380 379 $s = $dbr->selectRow( 'user_profile',
381 380 array(
382 381 'up_location_city', 'up_location_state', 'up_location_country',
— — @@ -398,7 +397,7 @@
399 398 $hometown_state = $s->up_hometown_state;
400 399 $hometown_country = $s->up_hometown_country;
401 400 $showYOB = $wgUser->getIntOption( 'showyearofbirth', !isset( $s->up_birthday ) ) == 1;
402 (削除) - $birthday = $this->formatBirthday( $s->up_birthday, $showYOB ); (削除ここまで)
401 (追記) + $birthday = self::formatBirthday( $s->up_birthday, $showYOB ); (追記ここまで)
403 402 $schools = $s->up_schools;
404 403 $places = $s->up_places_lived;
405 404 $websites = $s->up_websites;
— — @@ -473,7 +472,7 @@
474 473 }
475 474
476 475 $form .= '</select>';
477 (削除) - $form .= '</p> (削除ここまで)
476 (追記) + $form .= '</p> (追記ここまで)
478 477 <div class="cleared"></div>
479 478 </div>
480 479 <div class="cleared"></div>';
— — @@ -582,8 +581,9 @@
583 582 function displayPersonalForm( $user ) {
584 583 global $wgRequest, $wgUser, $wgOut;
585 584
586 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
587 (削除) - $s = $dbr->selectRow( 'user_profile', (削除ここまで)
585 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
586 (追記) + $s = $dbr->selectRow( (追記ここまで)
587 (追記) + 'user_profile', (追記ここまで)
588 588 array(
589 589 'up_about', 'up_places_lived', 'up_websites', 'up_relationship',
590 590 'up_occupation', 'up_companies', 'up_schools', 'up_movies',
— — @@ -676,7 +676,7 @@
677 677 function displayPreferencesForm() {
678 678 global $wgRequest, $wgUser, $wgOut;
679 679
680 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
680 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
681 681 $s = $dbr->selectRow(
682 682 'user_profile',
683 683 array( 'up_birthday' ),
Index: trunk/extensions/SocialProfile/UserProfile/SpecialEditProfile.php
— — @@ -158,7 +158,7 @@
159 159 function displayBasicForm( $tar ) {
160 160 global $wgRequest, $wgUser, $wgOut;
161 161
162 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
162 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
163 163 $s = $dbr->selectRow( 'user_profile',
164 164 array(
165 165 'up_location_city', 'up_location_state', 'up_location_country',
— — @@ -179,7 +179,7 @@
180 180 $hometown_city = $s->up_hometown_city;
181 181 $hometown_state = $s->up_hometown_state;
182 182 $hometown_country = $s->up_hometown_country;
183 (削除) - $birthday = $this->formatBirthday( $s->up_birthday, true ); (削除ここまで)
183 (追記) + $birthday = self::formatBirthday( $s->up_birthday, true ); (追記ここまで)
184 184 $schools = $s->up_schools;
185 185 $places = $s->up_places_lived;
186 186 $websites = $s->up_websites;
— — @@ -254,7 +254,7 @@
255 255 }
256 256
257 257 $form .= '</select>';
258 (削除) - $form .= '</p> (削除ここまで)
258 (追記) + $form .= '</p> (追記ここまで)
259 259 <div class="cleared"></div>
260 260 </div>
261 261 <div class="cleared"></div>';
— — @@ -349,7 +349,7 @@
350 350 function displayPersonalForm( $tar ) {
351 351 global $wgRequest, $wgUser, $wgOut;
352 352
353 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
353 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
354 354 $s = $dbr->selectRow( 'user_profile',
355 355 array(
356 356 'up_about', 'up_places_lived', 'up_websites', 'up_relationship',
— — @@ -438,7 +438,7 @@
439 439 function displayCustomForm( $tar ) {
440 440 global $wgRequest, $wgUser, $wgOut;
441 441
442 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
442 (追記) + $dbr = wfGetDB( DB_SLAVE ); (追記ここまで)
443 443 $s = $dbr->selectRow(
444 444 'user_profile',
445 445 array(
Index: trunk/extensions/SocialProfile/UserProfile/SpecialToggleUserPageType.php
— — @@ -38,19 +38,18 @@
39 39 return;
40 40 }
41 41
42 (削除) - $dbr = wfGetDB( DB_MASTER ); (削除ここまで)
43 (削除) - $s = $dbr->selectRow( (削除ここまで)
42 (追記) + $dbw = wfGetDB( DB_MASTER ); (追記ここまで)
43 (追記) + $s = $dbw->selectRow( (追記ここまで)
44 44 'user_profile',
45 45 array( 'up_user_id' ),
46 46 array( 'up_user_id' => $wgUser->getID() ),
47 47 __METHOD__
48 48 );
49 49 if ( $s === false ) {
50 (削除) - $dbw = wfGetDB( DB_MASTER ); (削除ここまで)
51 (削除) - $dbw->insert( 'user_profile', (削除ここまで)
52 (削除) - array( (削除ここまで)
53 (削除) - 'up_user_id' => $wgUser->getID() (削除ここまで)
54 (削除) - ), __METHOD__ (削除ここまで)
50 (追記) + $dbw->insert( (追記ここまで)
51 (追記) + 'user_profile', (追記ここまで)
52 (追記) + array( 'up_user_id' => $wgUser->getID() ), (追記ここまで)
53 (追記) + __METHOD__ (追記ここまで)
55 54 );
56 55 }
57 56
— — @@ -59,8 +58,8 @@
60 59
61 60 $user_page_type = ( ( $profile_data['user_page_type'] == 1 ) ? 0 : 1 );
62 61
63 (削除) - $dbw = wfGetDB( DB_MASTER ); (削除ここまで)
64 (削除) - $dbw->update( 'user_profile', (削除ここまで)
62 (追記) + $dbw->update( (追記ここまで)
63 (追記) + 'user_profile', (追記ここまで)
65 64 /* SET */array(
66 65 'up_type' => $user_page_type
67 66 ),
Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js
— — @@ -58,7 +58,7 @@
59 59 document.getElementById( 'upload-frame-errors' ).innerHTML = '';
60 60 oldHtml = document.getElementById( 'mini-gallery-' + replaceID ).innerHTML;
61 61
62 (削除) - for( x = 7; x> 0; x-- ) { (削除ここまで)
62 (追記) + for( var x = 7; x> 0; x-- ) { (追記ここまで)
63 63 document.getElementById( 'mini-gallery-' + ( x ) ).innerHTML =
64 64 document.getElementById( 'mini-gallery-' + ( x - 1 ) ).innerHTML.replace( 'slideShowLink(' + ( x - 1 ) + ')','slideShowLink(' + ( x ) + ')' );
65 65 }
Index: trunk/extensions/SocialProfile/UserProfile/UserProfileClass.php
— — @@ -6,25 +6,25 @@
7 7 /**
8 8 * @var Integer: the current user's user ID. Set in the constructor.
9 9 */
10 (削除) - var $user_id; (削除ここまで)
10 (追記) + public $user_id; (追記ここまで)
11 11
12 12 /**
13 13 * @var String: the current user's user name. Set in the constructor.
14 14 */
15 (削除) - var $user_name; (削除ここまで)
15 (追記) + public $user_name; (追記ここまで)
16 16
17 17 /** unused, remove me? */
18 (削除) - var $profile; (削除ここまで)
18 (追記) + public $profile; (追記ここまで)
19 19
20 20 /**
21 21 * @var Integer: used in getProfileComplete()
22 22 */
23 (削除) - var $profile_fields_count; (削除ここまで)
23 (追記) + public $profile_fields_count; (追記ここまで)
24 24
25 25 /**
26 26 * @var Array: array of valid profile fields; used in getProfileComplete()
27 27 */
28 (削除) - var $profile_fields = array( (削除ここまで)
28 (追記) + public $profile_fields = array( (追記ここまで)
29 29 'real_name',
30 30 'location_city',
31 31 'hometown_city',
— — @@ -51,7 +51,7 @@
52 52 /**
53 53 * @var Array: unused, remove me?
54 54 */
55 (削除) - var $profile_missing = array(); (削除ここまで)
55 (追記) + public $profile_missing = array(); (追記ここまで)
56 56
57 57 /**
58 58 * Constructor
— — @@ -118,7 +118,7 @@
119 119 $profile['hometown_city'] = isset( $row->up_hometown_city ) ? $row->up_hometown_city : '';
120 120 $profile['hometown_state'] = isset( $row->up_hometown_state ) ? $row->up_hometown_state : '';
121 121 $profile['hometown_country'] = isset( $row->up_hometown_country ) ? $row->up_hometown_country : '';
122 (削除) - $profile['birthday'] = $this->formatBirthday( $issetUpBirthday, $showYOB); (削除ここまで)
122 (追記) + $profile['birthday'] = $this->formatBirthday( $issetUpBirthday, $showYOB ); (追記ここまで)
123 123
124 124 $profile['about'] = isset( $row->up_about ) ? $row->up_about : '';
125 125 $profile['places_lived'] = isset( $row->up_places_lived ) ? $row->up_places_lived : '';
Index: trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js
— — @@ -22,13 +22,13 @@
23 23
24 24 function displaySection( id, country, section ) {
25 25 country_id = -1;
26 (削除) - for( x = 0; x <= countries.length-1; x++ ) { (削除ここまで)
26 (追記) + for( var x = 0; x <= countries.length-1; x++ ) { (追記ここまで)
27 27 if( country == countries[x].country ) {
28 28 country_id = x;
29 29 }
30 30 }
31 31
32 (削除) - section_select = ''; (削除ここまで)
32 (追記) + var section_select = ''; (追記ここまで)
33 33 if( countries[country_id] ) {
34 34 document.getElementById( id + '_label' ).innerHTML = countries[country_id].name;
35 35 section_select += '<select class="profile-form" name="' + id + '" id="' + id + '"><option></option>';