Index: trunk/extensions/SocialProfile/UserRelationship/SpecialViewRelationshipRequests.php |
— | — | @@ -32,31 +32,30 @@ |
33 | 33 | * It will automatically return them to the ViewRelationshipRequests page |
34 | 34 | */ |
35 | 35 | if( $wgUser->getID() == 0 ){ |
36 | | - $wgOut->setPagetitle( wfMsg('ur-error-page-title') ); |
37 | | - $login = SpecialPage::getTitleFor( 'UserLogin' ); |
38 | | - $wgOut->redirect( $login->getFullURL('returnto=Special:ViewRelationshipRequests') ); |
| 36 | + $wgOut->setPageTitle( wfMsg( 'ur-error-page-title' ) ); |
| 37 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 38 | + $wgOut->redirect( $login->getFullURL( 'returnto=Special:ViewRelationshipRequests' ) ); |
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
42 | | - $wgOut->addScriptFile( $wgUserRelationshipScripts.'/UserRelationship.js' ); |
43 | | - $wgOut->addStyle( '../..' . $wgUserRelationshipScripts . '/UserRelationship.css' ); |
| 42 | + $wgOut->addScriptFile( $wgUserRelationshipScripts . '/UserRelationship.js' ); |
| 43 | + $wgOut->addExtensionStyle( $wgUserRelationshipScripts . '/UserRelationship.css' ); |
44 | 44 | |
45 | 45 | $rel = new UserRelationship( $wgUser->getName() ); |
46 | | - $friend_request_count = $rel->getOpenRequestCount($wgUser->getID(), 1); |
47 | | - $foe_request_count = $rel->getOpenRequestCount($wgUser->getID(), 2); |
| 46 | + $friend_request_count = $rel->getOpenRequestCount( $wgUser->getID(), 1 ); |
| 47 | + $foe_request_count = $rel->getOpenRequestCount( $wgUser->getID(), 2 ); |
48 | 48 | |
49 | | - if( count($_POST) && $_SESSION['alreadysubmitted'] == false ) { |
| 49 | + if( count( $_POST ) && $_SESSION['alreadysubmitted'] == false ) { |
50 | 50 | $_SESSION['alreadysubmitted'] = true; |
51 | 51 | $rel->addRelationshipRequest( $this->user_name_to, $this->relationship_type, $_POST['message'] ); |
52 | 52 | $out = '<br /><span class="title">' . wfMsg( 'ur-already-submitted' ) . '</span><br /><br />'; |
53 | | - $wgOut->addHTML($out); |
| 53 | + $wgOut->addHTML( $out ); |
54 | 54 | } else { |
55 | 55 | $_SESSION['alreadysubmitted'] = false; |
56 | 56 | $output = ''; |
57 | | - $plural = ''; |
58 | 57 | |
59 | | - $output .= $wgOut->setPagetitle( wfMsg('ur-requests-title') ); |
60 | | - $requests = $rel->getRequestList(0); |
| 58 | + $output .= $wgOut->setPagetitle( wfMsg( 'ur-requests-title' ) ); |
| 59 | + $requests = $rel->getRequestList( 0 ); |
61 | 60 | |
62 | 61 | if( $requests ) { |
63 | 62 | |
— | — | @@ -75,24 +74,22 @@ |
76 | 75 | $message = $wgOut->parse( trim( $request['message'] ), false ); |
77 | 76 | |
78 | 77 | $output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request["id"]}\"> |
79 | | - {$avatar_img} |
80 | | - ".$msg; |
| 78 | + {$avatar_img}" . $msg; |
81 | 79 | if( $request['message'] ) { |
82 | | - $output .= '<div class="relationship-message">'.$message.'</div>'; |
| 80 | + $output .= '<div class="relationship-message">' . $message . '</div>'; |
83 | 81 | } |
84 | | - $output .= "<div class=\"cleared\"></div> |
85 | | - <div class=\"relationship-buttons\"> |
86 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-accept')."\" onclick=\"javascript:requestResponse(1,{$request["id"]})\"> |
87 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-reject')."\" onclick=\"javascript:requestResponse(-1,{$request["id"]})\"> |
| 82 | + $output .= '<div class="cleared"></div> |
| 83 | + <div class="relationship-buttons"> |
| 84 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-accept' ) . '" onclick="javascript:requestResponse(1,' . $request['id'] . ')" /> |
| 85 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-reject' ) . '" onclick="javascript:requestResponse(-1,' . $request['id'] . ')" /> |
88 | 86 | </div> |
89 | | - </div>"; |
| 87 | + </div>'; |
90 | 88 | } |
91 | 89 | } else { |
92 | | - #$invite_link = SpecialPage::getTitleFor( 'InviteContacts' ); |
93 | | - $invite_link = Title::makeTitle( NS_SPECIAL, 'InviteContacts' ); |
| 90 | + $invite_link = SpecialPage::getTitleFor( 'InviteContacts' ); |
94 | 91 | $output = wfMsg( 'ur-no-requests-message', $invite_link->escapeFullURL() ); |
95 | 92 | } |
96 | | - $wgOut->addHTML($output); |
| 93 | + $wgOut->addHTML( $output ); |
97 | 94 | } |
98 | 95 | } |
99 | 96 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * Example URL: index.php?title=Special:AddRelationship&user=Pean&rel_type=2 (for adding as foe) |
8 | 8 | * |
9 | 9 | * @file |
10 | | - * @ingroup Extension |
| 10 | + * @ingroup Extensions |
11 | 11 | * @author David Pean <david.pean@gmail.com> |
12 | 12 | * @copyright Copyright © 2007, Wikia Inc. |
13 | 13 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
— | — | @@ -32,9 +32,9 @@ |
33 | 33 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
34 | 34 | $this->setHeaders(); |
35 | 35 | |
36 | | - $wgOut->addStyle( '../..' . $wgUserRelationshipScripts . '/UserRelationship.css' ); |
| 36 | + $wgOut->addExtensionStyle( $wgUserRelationshipScripts . '/UserRelationship.css' ); |
37 | 37 | |
38 | | - $usertitle = Title::newFromDBkey( $wgRequest->getVal('user') ); |
| 38 | + $usertitle = Title::newFromDBkey( $wgRequest->getVal( 'user' ) ); |
39 | 39 | |
40 | 40 | if( !$usertitle ){ |
41 | 41 | $wgOut->addWikiText( wfMsgNoTrans( 'ur-add-no-user' ) ); |
— | — | @@ -44,69 +44,69 @@ |
45 | 45 | $user = Title::makeTitle( NS_USER, $usertitle->getText() ); |
46 | 46 | |
47 | 47 | $this->user_name_to = $usertitle->getText(); |
48 | | - $this->user_id_to = User::idFromName($this->user_name_to); |
49 | | - $this->relationship_type = $wgRequest->getVal('rel_type'); |
50 | | - if( !$this->relationship_type || !is_numeric($this->relationship_type) ) $this->relationship_type = 1; |
| 48 | + $this->user_id_to = User::idFromName( $this->user_name_to ); |
| 49 | + $this->relationship_type = $wgRequest->getVal( 'rel_type' ); |
| 50 | + if( !$this->relationship_type || !is_numeric( $this->relationship_type ) ) $this->relationship_type = 1; |
51 | 51 | |
52 | | - if( ($wgUser->getID()== $this->user_id_to) && ($wgUser->getID() != 0) ) { |
53 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 52 | + if( ( $wgUser->getID() == $this->user_id_to ) && ( $wgUser->getID() != 0 ) ) { |
| 53 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
54 | 54 | $out .= '<div class="relationship-error-message"> |
55 | | - '.wfMsg('ur-add-error-message-yourself').' |
| 55 | + ' . wfMsg( 'ur-add-error-message-yourself' ) . ' |
56 | 56 | </div> |
57 | 57 | <div> |
58 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 58 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
59 | 59 | if( $wgUser->isLoggedIn() ){ |
60 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'.$wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 60 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="' . $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
61 | 61 | } |
62 | 62 | $out .= '</div>'; |
63 | 63 | |
64 | | - $wgOut->addHTML($out); |
| 64 | + $wgOut->addHTML( $out ); |
65 | 65 | |
66 | 66 | } else if( $wgUser->isBlocked() ) { |
67 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 67 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
68 | 68 | $out .= '<div class="relationship-error-message"> |
69 | | - '.wfMsg('ur-add-error-message-blocked').' |
| 69 | + ' . wfMsg( 'ur-add-error-message-blocked' ) . ' |
70 | 70 | </div> |
71 | 71 | <div> |
72 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 72 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
73 | 73 | if( $wgUser->isLoggedIn() ){ |
74 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'.$wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 74 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="' . $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
75 | 75 | } |
76 | 76 | $out .= '</div>'; |
77 | 77 | |
78 | | - $wgOut->addHTML($out); |
| 78 | + $wgOut->addHTML( $out ); |
79 | 79 | |
80 | 80 | } else if( $this->user_id_to == 0 ) { |
81 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 81 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
82 | 82 | $out .= '<div class="relationship-error-message"> |
83 | | - '.wfMsg('ur-add-error-message-no-user').' |
| 83 | + ' . wfMsg( 'ur-add-error-message-no-user' ) . ' |
84 | 84 | </div> |
85 | 85 | <div> |
86 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 86 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
87 | 87 | if( $wgUser->isLoggedIn() ){ |
88 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'.$wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 88 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="' . $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
89 | 89 | } |
90 | 90 | $out .= '</div>'; |
91 | 91 | |
92 | | - $wgOut->addHTML($out); |
| 92 | + $wgOut->addHTML( $out ); |
93 | 93 | |
94 | 94 | } else if( UserRelationship::getUserRelationshipByID( $this->user_id_to, $wgUser->getID() ) >=1 ){ |
95 | 95 | |
96 | 96 | if( UserRelationship::getUserRelationshipByID( $this->user_id_to, $wgUser->getID() ) == 1 ) { |
97 | | - $error = wfMsg('ur-add-error-message-existing-relationship-friend', $this->user_name_to); |
| 97 | + $error = wfMsg( 'ur-add-error-message-existing-relationship-friend', $this->user_name_to ); |
98 | 98 | } else { |
99 | | - $error = wfMsg('ur-add-error-message-existing-relationship-foe', $this->user_name_to); |
| 99 | + $error = wfMsg( 'ur-add-error-message-existing-relationship-foe', $this->user_name_to ); |
100 | 100 | } |
101 | 101 | |
102 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
103 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 102 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 103 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
104 | 104 | |
105 | 105 | $out = ''; |
106 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 106 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
107 | 107 | |
108 | 108 | $out .= "<div class=\"relationship-action\"> |
109 | 109 | {$avatar_img} |
110 | | - ".$error." |
| 110 | + " . $error . " |
111 | 111 | <div class=\"relationship-buttons\"> |
112 | 112 | <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-main-page')."\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
113 | 113 | <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-your-profile')."\" size=\"20\" onclick=\"window.location='".$wgUser->getUserPage()->escapeFullURL() . "'\"/> |
— | — | @@ -114,86 +114,86 @@ |
115 | 115 | <div class=\"cleared\"></div> |
116 | 116 | </div>"; |
117 | 117 | |
118 | | - $wgOut->addHTML($out); |
| 118 | + $wgOut->addHTML( $out ); |
119 | 119 | |
120 | 120 | } else if( UserRelationship::userHasRequestByID( $this->user_id_to, $wgUser->getID() ) == true ){ |
121 | 121 | |
122 | 122 | if( $this->relationship_type == 1 ) { |
123 | | - $error = wfMsg('ur-add-error-message-pending-friend-request', $this->user_name_to); |
| 123 | + $error = wfMsg( 'ur-add-error-message-pending-friend-request', $this->user_name_to ); |
124 | 124 | } else { |
125 | | - $error = wfMsg('ur-add-error-message-pending-foe-request', $this->user_name_to); |
| 125 | + $error = wfMsg( 'ur-add-error-message-pending-foe-request', $this->user_name_to ); |
126 | 126 | } |
127 | 127 | |
128 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
129 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 128 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 129 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
130 | 130 | |
131 | 131 | $out = ''; |
132 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-add-error-message-pending-request-title') ); |
| 132 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-add-error-message-pending-request-title' ) ); |
133 | 133 | $out .= "<div class=\"relationship-action\"> |
134 | 134 | {$avatar_img} |
135 | | - ".$error." |
| 135 | + " . $error . " |
136 | 136 | <div class=\"relationship-buttons\"> |
137 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-main-page')."\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
138 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-your-profile')."\" size=\"20\" onclick=\"window.location='".$wgUser->getUserPage()->escapeFullURL() . "'\"/> |
| 137 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
| 138 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-your-profile' ) . "\" size=\"20\" onclick=\"window.location='" . $wgUser->getUserPage()->escapeFullURL() . "'\"/> |
139 | 139 | </div> |
140 | 140 | <div class=\"cleared\"></div> |
141 | 141 | </div>"; |
142 | 142 | |
143 | | - $wgOut->addHTML($out); |
| 143 | + $wgOut->addHTML( $out ); |
144 | 144 | } else if( UserRelationship::userHasRequestByID( $wgUser->getID(), $this->user_id_to ) == true ) { |
145 | 145 | $relationship_request = SpecialPage::getTitleFor( 'ViewRelationshipRequests' ); |
146 | 146 | $wgOut->redirect( $relationship_request->getFullURL() ); |
147 | 147 | } else if( $wgUser->getID() == 0 ){ |
148 | | - $login_link = SpecialPage::getTitleFor( 'UserLogin' ); |
| 148 | + $login_link = SpecialPage::getTitleFor( 'Userlogin' ); |
149 | 149 | |
150 | | - if( $this->relationship_type == 1) { |
151 | | - $error = wfMsg('ur-add-error-message-not-loggedin-friend'); |
| 150 | + if( $this->relationship_type == 1 ) { |
| 151 | + $error = wfMsg( 'ur-add-error-message-not-loggedin-friend' ); |
152 | 152 | } else { |
153 | | - $error = wfMsg('ur-add-error-message-not-loggedin-foe'); |
| 153 | + $error = wfMsg( 'ur-add-error-message-not-loggedin-foe' ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | $out = ''; |
157 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 157 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
158 | 158 | $out .= '<div class="relationship-error-message"> |
159 | | - '.$error.' |
| 159 | + ' . $error . ' |
160 | 160 | </div> |
161 | 161 | <div> |
162 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' /> |
163 | | - <input type="button" class="site-button" value="'.wfMsg('ur-login').'" size="20" onclick="window.location="'.$login_link->escapeFullURL() . '""/>'; |
| 162 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' /> |
| 163 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-login' ) . '" size="20" onclick="window.location=\'' . $login_link->escapeFullURL() . '\'" />'; |
164 | 164 | $out .= '</div>'; |
165 | 165 | |
166 | | - $wgOut->addHTML($out); |
| 166 | + $wgOut->addHTML( $out ); |
167 | 167 | } else { |
168 | 168 | $rel = new UserRelationship( $wgUser->getName() ); |
169 | 169 | |
170 | 170 | if( $wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false ) { |
171 | 171 | $_SESSION['alreadysubmitted'] = true; |
172 | | - $rel = $rel->addRelationshipRequest( $this->user_name_to, $this->relationship_type, $wgRequest->getVal('message') ); |
| 172 | + $rel = $rel->addRelationshipRequest( $this->user_name_to, $this->relationship_type, $wgRequest->getVal( 'message' ) ); |
173 | 173 | |
174 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
175 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 174 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 175 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
176 | 176 | |
177 | 177 | $out = ''; |
178 | 178 | |
179 | 179 | if( $this->relationship_type == 1 ){ |
180 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-add-sent-title-friend', $this->user_name_to) ); |
181 | | - $sent = wfMsg('ur-add-sent-message-friend', $this->user_name_to); |
| 180 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-add-sent-title-friend', $this->user_name_to ) ); |
| 181 | + $sent = wfMsg( 'ur-add-sent-message-friend', $this->user_name_to ); |
182 | 182 | } else { |
183 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-add-sent-title-foe', $this->user_name_to) ); |
184 | | - $sent = wfMsg('ur-add-sent-message-foe', $this->user_name_to); |
| 183 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-add-sent-title-foe', $this->user_name_to ) ); |
| 184 | + $sent = wfMsg( 'ur-add-sent-message-foe', $this->user_name_to ); |
185 | 185 | } |
186 | 186 | |
187 | 187 | $out .= "<div class=\"relationship-action\"> |
188 | 188 | {$avatar_img} |
189 | | - ".$sent." |
| 189 | + " . $sent . " |
190 | 190 | <div class=\"relationship-buttons\"> |
191 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-main-page')."\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
192 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-your-profile')."\" size=\"20\" onclick=\"window.location='".$wgUser->getUserPage()->escapeFullURL() . "'\"/> |
| 191 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
| 192 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-your-profile' ) . "\" size=\"20\" onclick=\"window.location='" . $wgUser->getUserPage()->escapeFullURL() . "'\"/> |
193 | 193 | </div> |
194 | 194 | <div class=\"cleared\"></div> |
195 | 195 | </div>"; |
196 | 196 | |
197 | | - $wgOut->addHTML($out); |
| 197 | + $wgOut->addHTML( $out ); |
198 | 198 | } else { |
199 | 199 | $_SESSION['alreadysubmitted'] = false; |
200 | 200 | $wgOut->addHTML( $this->displayForm() ); |
— | — | @@ -201,42 +201,46 @@ |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
| 205 | + /** |
| 206 | + * Displays the form for adding a friend or a foe |
| 207 | + * @return $form Mixed: HTML code for the form |
| 208 | + */ |
205 | 209 | function displayForm() { |
206 | | - global $wgOut, $wgUser, $wgUploadPath; |
| 210 | + global $wgOut, $wgUploadPath; |
207 | 211 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
208 | 212 | |
209 | 213 | $form = ''; |
210 | 214 | |
211 | 215 | if( $this->relationship_type == 1 ) { |
212 | | - $form .= $wgOut->setPagetitle( wfMsg('ur-add-title-friend', $this->user_name_to) ); |
213 | | - $add = wfMsg('ur-add-message-friend', $this->user_name_to); |
214 | | - $button = wfMsg('ur-add-button-friend'); |
| 216 | + $form .= $wgOut->setPageTitle( wfMsg( 'ur-add-title-friend', $this->user_name_to ) ); |
| 217 | + $add = wfMsg( 'ur-add-message-friend', $this->user_name_to ); |
| 218 | + $button = wfMsg( 'ur-add-button-friend' ); |
215 | 219 | } else { |
216 | | - $form .= $wgOut->setPagetitle( wfMsg('ur-add-title-foe', $this->user_name_to) ); |
217 | | - $add = wfMsg('ur-add-message-foe', $this->user_name_to); |
218 | | - $button = wfMsg('ur-add-button-foe'); |
| 220 | + $form .= $wgOut->setPageTitle( wfMsg( 'ur-add-title-foe', $this->user_name_to ) ); |
| 221 | + $add = wfMsg( 'ur-add-message-foe', $this->user_name_to ); |
| 222 | + $button = wfMsg( 'ur-add-button-foe' ); |
219 | 223 | } |
220 | 224 | |
221 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
222 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
| 225 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 226 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" />'; |
223 | 227 | |
224 | 228 | $user_link = Title::makeTitle( NS_USER, $this->user_name_to ); |
225 | 229 | |
226 | 230 | $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> |
227 | 231 | <div class=\"relationship-action\"> |
228 | 232 | {$avatar_img} |
229 | | - ".$add." |
230 | | - <div class=\"cleared\"></div> |
| 233 | + " . $add . ' |
| 234 | + <div class="cleared"></div> |
231 | 235 | </div> |
232 | | - <div class=\"relationship-textbox-title\"> |
233 | | - ".wfMsg('ur-add-personal-message')." |
| 236 | + <div class="relationship-textbox-title"> |
| 237 | + ' . wfMsg( 'ur-add-personal-message' ) . ' |
234 | 238 | </div> |
235 | | - <textarea name=\"message\" id=\"message\" rows=\"3\" cols=\"50\"></textarea> |
236 | | - <div class=\"relationship-buttons\"> |
237 | | - <input type=\"button\" class=\"site-button\" value=\"".$button."\" size=\"20\" onclick=\"document.form1.submit()\" /> |
238 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-cancel')."\" size=\"20\" onclick=\"history.go(-1)\" /> |
| 239 | + <textarea name="message" id="message" rows="3" cols="50"></textarea> |
| 240 | + <div class="relationship-buttons"> |
| 241 | + <input type="button" class="site-button" value="' . $button . '" size="20" onclick="document.form1.submit()" /> |
| 242 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" /> |
239 | 243 | </div> |
240 | | - </form>"; |
| 244 | + </form>'; |
241 | 245 | return $form; |
242 | 246 | } |
243 | 247 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/Relationship_AjaxFunctions.php |
— | — | @@ -5,39 +5,39 @@ |
6 | 6 | |
7 | 7 | $wgAjaxExportList[] = 'wfRelationshipRequestResponse'; |
8 | 8 | function wfRelationshipRequestResponse( $response, $request_id ){ |
9 | | - global $wgUser, $wgOut; |
| 9 | + global $wgUser; |
10 | 10 | $out = ''; |
11 | 11 | |
12 | 12 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
13 | 13 | |
14 | 14 | $rel = new UserRelationship( $wgUser->getName() ); |
15 | | - if( $rel->verifyRelationshipRequest($request_id) == true ){ |
16 | | - $request = $rel->getRequest($request_id); |
| 15 | + if( $rel->verifyRelationshipRequest( $request_id ) == true ){ |
| 16 | + $request = $rel->getRequest( $request_id ); |
17 | 17 | $user_name_from = $request[0]['user_name_from']; |
18 | | - $user_id_from = User::idFromName($user_name_from); |
19 | | - $rel_type = strtolower($request[0]['type']); |
| 18 | + $user_id_from = User::idFromName( $user_name_from ); |
| 19 | + $rel_type = strtolower( $request[0]['type'] ); |
20 | 20 | |
21 | | - // FIXME: Notice: Undefined index: response |
22 | | - $rel->updateRelationshipRequestStatus($request_id, $_POST['response']); |
| 21 | + $response = ( isset( $_POST['response' ] ) ) ? $_POST['response'] : $response; |
| 22 | + $rel->updateRelationshipRequestStatus( $request_id, $response ); |
23 | 23 | |
24 | | - $avatar = new wAvatar($user_id_from, 'l'); |
| 24 | + $avatar = new wAvatar( $user_id_from, 'l' ); |
25 | 25 | $avatar_img = $avatar->getAvatarURL(); |
26 | 26 | |
27 | 27 | if( $response == 1 ){ |
28 | | - $rel->addRelationship($request_id); |
| 28 | + $rel->addRelationship( $request_id ); |
29 | 29 | $out.= "<div class=\"relationship-action red-text\"> |
30 | 30 | {$avatar_img} |
31 | | - ".wfMsg("ur-requests-added-message-{$rel_type}", $user_name_from)." |
32 | | - <div class=\"cleared\"></div> |
33 | | - </div>"; |
| 31 | + " . wfMsg( "ur-requests-added-message-{$rel_type}", $user_name_from ) . ' |
| 32 | + <div class="cleared"></div> |
| 33 | + </div>'; |
34 | 34 | } else { |
35 | 35 | $out.= "<div class=\"relationship-action red-text\"> |
36 | 36 | {$avatar_img} |
37 | | - ".wfMsg("ur-requests-reject-message-{$rel_type}", $user_name_from)." |
38 | | - <div class=\"cleared\"></div> |
39 | | - </div>"; |
| 37 | + " . wfMsg( "ur-requests-reject-message-{$rel_type}", $user_name_from ) . ' |
| 38 | + <div class="cleared"></div> |
| 39 | + </div>'; |
40 | 40 | } |
41 | | - $rel->deleteRequest($request_id); |
| 41 | + $rel->deleteRequest( $request_id ); |
42 | 42 | } |
43 | 43 | return $out; |
44 | 44 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/UserRelationship.i18n.php |
— | — | @@ -1646,7 +1646,7 @@ |
1647 | 1647 | ); |
1648 | 1648 | |
1649 | 1649 | /** Finnish (Suomi) |
1650 | | - * @author Jack Phoenix |
| 1650 | + * @author Jack Phoenix <jack@countervandalism.net> |
1651 | 1651 | */ |
1652 | 1652 | $messages['fi'] = array( |
1653 | 1653 | 'viewrelationships' => 'Ystävä- ja vihollislista', |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php |
— | — | @@ -31,83 +31,83 @@ |
32 | 32 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
33 | 33 | $this->setHeaders(); |
34 | 34 | |
35 | | - $wgOut->addStyle( '../..' . $wgUserRelationshipScripts . '/UserRelationship.css' ); |
| 35 | + $wgOut->addExtensionStyle( $wgUserRelationshipScripts . '/UserRelationship.css' ); |
36 | 36 | |
37 | | - $usertitle = Title::newFromDBkey( $wgRequest->getVal('user') ); |
| 37 | + $usertitle = Title::newFromDBkey( $wgRequest->getVal( 'user' ) ); |
38 | 38 | if( !$usertitle ){ |
39 | 39 | $wgOut->addWikiText( wfMsgNoTrans( 'ur-add-no-user' ) ); |
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $this->user_name_to = $usertitle->getText(); |
44 | | - $this->user_id_to = User::idFromName($this->user_name_to); |
| 44 | + $this->user_id_to = User::idFromName( $this->user_name_to ); |
45 | 45 | $this->relationship_type = UserRelationship::getUserRelationshipByID( $this->user_id_to, $wgUser->getID() ); |
46 | 46 | |
47 | 47 | if( $this->relationship_type == 1 ){ |
48 | | - $confirmtitle = wfMsg('ur-remove-relationship-title-confirm-friend', $this->user_name_to); |
49 | | - $confirmmsg = wfMsg('ur-remove-relationship-message-confirm-friend', $this->user_name_to); |
50 | | - $error = wfMsg('ur-remove-error-not-loggedin-friend'); |
51 | | - $pending = wfMsg('ur-remove-error-message-pending-friend-request', $this->user_name_to); |
| 48 | + $confirmtitle = wfMsg( 'ur-remove-relationship-title-confirm-friend', $this->user_name_to ); |
| 49 | + $confirmmsg = wfMsg( 'ur-remove-relationship-message-confirm-friend', $this->user_name_to ); |
| 50 | + $error = wfMsg( 'ur-remove-error-not-loggedin-friend' ); |
| 51 | + $pending = wfMsg( 'ur-remove-error-message-pending-friend-request', $this->user_name_to ); |
52 | 52 | } else { |
53 | | - $confirmtitle = wfMsg('ur-remove-relationship-title-confirm-foe', $this->user_name_to); |
54 | | - $confirmmsg = wfMsg('ur-remove-relationship-message-confirm-foe', $this->user_name_to); |
55 | | - $error = wfMsg('ur-remove-error-not-loggedin-foe'); |
56 | | - $pending = wfMsg('ur-remove-error-message-pending-foe-request', $this->user_name_to); |
| 53 | + $confirmtitle = wfMsg( 'ur-remove-relationship-title-confirm-foe', $this->user_name_to ); |
| 54 | + $confirmmsg = wfMsg( 'ur-remove-relationship-message-confirm-foe', $this->user_name_to ); |
| 55 | + $error = wfMsg( 'ur-remove-error-not-loggedin-foe' ); |
| 56 | + $pending = wfMsg( 'ur-remove-error-message-pending-foe-request', $this->user_name_to ); |
57 | 57 | } |
58 | 58 | |
59 | | - if( $wgUser->getID()== $this->user_id_to ){ |
60 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 59 | + if( $wgUser->getID() == $this->user_id_to ){ |
| 60 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
61 | 61 | $out .= '<div class="relationship-error-message"> |
62 | | - '.wfMsg('ur-remove-error-message-remove-yourself').' |
| 62 | + ' . wfMsg( 'ur-remove-error-message-remove-yourself' ) . ' |
63 | 63 | </div> |
64 | 64 | <div> |
65 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 65 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
66 | 66 | if( $wgUser->isLoggedIn() ){ |
67 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 67 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
68 | 68 | } |
69 | 69 | $out .= '</div>'; |
70 | 70 | |
71 | | - $wgOut->addHTML($out); |
| 71 | + $wgOut->addHTML( $out ); |
72 | 72 | } else if( $this->relationship_type == false ) { |
73 | 73 | |
74 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 74 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
75 | 75 | $out .= '<div class="relationship-error-message"> |
76 | | - '.wfMsg('ur-remove-error-message-no-relationship', $this->user_name_to).' |
| 76 | + ' . wfMsg( 'ur-remove-error-message-no-relationship', $this->user_name_to ) . ' |
77 | 77 | </div> |
78 | 78 | <div> |
79 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 79 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
80 | 80 | if( $wgUser->isLoggedIn() ){ |
81 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 81 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
82 | 82 | } |
83 | 83 | $out .= '</div>'; |
84 | 84 | |
85 | | - $wgOut->addHTML($out); |
| 85 | + $wgOut->addHTML( $out ); |
86 | 86 | } else if( UserRelationship::userHasRequestByID( $this->user_id_to, $wgUser->getID() ) == true ) { |
87 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 87 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
88 | 88 | $out .= '<div class="relationship-error-message"> |
89 | | - '.$pending.' |
| 89 | + ' . $pending . ' |
90 | 90 | </div> |
91 | 91 | <div> |
92 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 92 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
93 | 93 | if( $wgUser->isLoggedIn() ){ |
94 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 94 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
95 | 95 | } |
96 | 96 | $out .= '</div>'; |
97 | 97 | |
98 | | - $wgOut->addHTML($out); |
| 98 | + $wgOut->addHTML( $out ); |
99 | 99 | } else if( $wgUser->getID() == 0 ) { |
100 | | - $out .= $wgOut->setPagetitle( wfMsg('ur-error-title') ); |
| 100 | + $out .= $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
101 | 101 | $out .= '<div class="relationship-error-message"> |
102 | | - '.$error.' |
| 102 | + ' . $error . ' |
103 | 103 | </div> |
104 | 104 | <div> |
105 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 105 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
106 | 106 | if( $wgUser->isLoggedIn() ){ |
107 | | - $out.= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 107 | + $out.= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" size="20" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
108 | 108 | } |
109 | 109 | $out .= '</div>'; |
110 | 110 | |
111 | | - $wgOut->addHTML($out); |
| 111 | + $wgOut->addHTML( $out ); |
112 | 112 | } else { |
113 | 113 | $rel = new UserRelationship( $wgUser->getName() ); |
114 | 114 | if( $wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false ){ |
— | — | @@ -115,21 +115,21 @@ |
116 | 116 | $_SESSION['alreadysubmitted'] = true; |
117 | 117 | $rel->removeRelationshipByUserID( $this->user_id_to, $wgUser->getID() ); |
118 | 118 | $rel->sendRelationshipRemoveEmail( $this->user_id_to, $wgUser->getName(), $this->relationship_type ); |
119 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
120 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/' . $avatar->getAvatarImage() . '" alt="" border="" />'; |
| 119 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 120 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="" />'; |
121 | 121 | |
122 | 122 | $out .= $wgOut->setPagetitle( $confirmtitle ); |
123 | 123 | $out .= "<div class=\"relationship-action\"> |
124 | 124 | {$avatar_img} |
125 | | - ".$confirmmsg." |
| 125 | + " . $confirmmsg . " |
126 | 126 | <div class=\"relationship-buttons\"> |
127 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-main-page')."\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
128 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-your-profile')."\" size=\"20\" onclick=\"window.location='".$wgUser->getUserPage()->escapeFullURL() . "'\"/> |
| 127 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-main-page' ) . "\" size=\"20\" onclick=\"window.location='index.php?title=" . wfMsgForContent( 'mainpage' ) . "'\"/> |
| 128 | + <input type=\"button\" class=\"site-button\" value=\"" . wfMsg( 'ur-your-profile' ) . "\" size=\"20\" onclick=\"window.location='" . $wgUser->getUserPage()->escapeFullURL() . "'\"/> |
129 | 129 | </div> |
130 | 130 | <div class=\"cleared\"></div> |
131 | 131 | </div>"; |
132 | 132 | |
133 | | - $wgOut->addHTML($out); |
| 133 | + $wgOut->addHTML( $out ); |
134 | 134 | } else { |
135 | 135 | $_SESSION['alreadysubmitted'] = false; |
136 | 136 | $wgOut->addHTML( $this->displayForm() ); |
— | — | @@ -138,35 +138,39 @@ |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
| 142 | + /** |
| 143 | + * Displays the form for removing a friend or a foe |
| 144 | + * @return $form Mixed: HTML code for the form |
| 145 | + */ |
142 | 146 | function displayForm() { |
143 | 147 | global $wgOut, $wgUploadPath; |
144 | 148 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
145 | 149 | |
146 | 150 | $form = ''; |
147 | | - $avatar = new wAvatar($this->user_id_to, 'l'); |
148 | | - $avatar_img = '<img src="'.$wgUploadPath.'/avatars/'. $avatar->getAvatarImage() . '" alt="avatar" />'; |
| 151 | + $avatar = new wAvatar( $this->user_id_to, 'l' ); |
| 152 | + $avatar_img = '<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="avatar" />'; |
149 | 153 | |
150 | 154 | if( $this->relationship_type == 1 ) { |
151 | | - $title = wfMsg('ur-remove-relationship-title-friend', $this->user_name_to); |
152 | | - $remove = wfMsg( 'ur-remove-relationship-message-friend', $this->user_name_to, wfMsg('ur-remove') ); |
| 155 | + $title = wfMsg( 'ur-remove-relationship-title-friend', $this->user_name_to ); |
| 156 | + $remove = wfMsg( 'ur-remove-relationship-message-friend', $this->user_name_to, wfMsg( 'ur-remove' ) ); |
153 | 157 | } else { |
154 | | - $title = wfMsg('ur-remove-relationship-title-foe', $this->user_name_to); |
155 | | - $remove = wfMsg( 'ur-remove-relationship-message-foe', $this->user_name_to, wfMsg('ur-remove') ); |
| 158 | + $title = wfMsg( 'ur-remove-relationship-title-foe', $this->user_name_to ); |
| 159 | + $remove = wfMsg( 'ur-remove-relationship-message-foe', $this->user_name_to, wfMsg( 'ur-remove' ) ); |
156 | 160 | } |
157 | | - $form .= $wgOut->setPagetitle( $title ); |
| 161 | + $form .= $wgOut->setPageTitle( $title ); |
158 | 162 | $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\"> |
159 | 163 | <div class=\"relationship-action\"> |
160 | 164 | {$avatar_img} |
161 | | - ".$remove." |
162 | | - <div class=\"relationship-buttons\"> |
163 | | - <input type=\"hidden\" name=\"user\" value=\"".addslashes($this->user_name_to)."\"> |
164 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-remove')."\" size=\"20\" onclick=\"document.form1.submit()\" /> |
165 | | - <input type=\"button\" class=\"site-button\" value=\"".wfMsg('ur-cancel')."\" size=\"20\" onclick=\"history.go(-1)\" /> |
| 165 | + " . $remove . ' |
| 166 | + <div class="relationship-buttons"> |
| 167 | + <input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" /> |
| 168 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-remove' ) . '" size="20" onclick="document.form1.submit()" /> |
| 169 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" /> |
166 | 170 | </div> |
167 | | - <div class=\"cleared\"></div> |
| 171 | + <div class="cleared"></div> |
168 | 172 | </div> |
169 | 173 | |
170 | | - </form>"; |
| 174 | + </form>'; |
171 | 175 | return $form; |
172 | 176 | } |
173 | 177 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialViewRelationships.php |
— | — | @@ -30,33 +30,33 @@ |
31 | 31 | |
32 | 32 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
33 | 33 | |
34 | | - $wgOut->addStyle( '../..' . $wgUserRelationshipScripts . '/UserRelationship.css' ); |
| 34 | + $wgOut->addExtensionStyle( $wgUserRelationshipScripts . '/UserRelationship.css' ); |
35 | 35 | |
36 | 36 | $output = ''; |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Get querystring variables |
40 | 40 | */ |
41 | | - $user_name = $wgRequest->getVal('user'); |
42 | | - $rel_type = $wgRequest->getVal('rel_type'); |
43 | | - $page = $wgRequest->getVal('page'); |
| 41 | + $user_name = $wgRequest->getVal( 'user' ); |
| 42 | + $rel_type = $wgRequest->getVal( 'rel_type' ); |
| 43 | + $page = $wgRequest->getVal( 'page' ); |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Redirect Non-logged in users to Login Page |
47 | 47 | * It will automatically return them to the ViewRelationships page |
48 | 48 | */ |
49 | 49 | if( $wgUser->getID() == 0 && $user_name == '' ){ |
50 | | - $wgOut->setPageTitle( wfMsg('ur-error-page-title') ); |
51 | | - $login = SpecialPage::getTitleFor( 'UserLogin' ); |
52 | | - $wgOut->redirect( $login->escapeFullURL('returnto=Special:ViewRelationships') ); |
| 50 | + $wgOut->setPageTitle( wfMsg( 'ur-error-page-title' ) ); |
| 51 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 52 | + $wgOut->redirect( $login->escapeFullURL( 'returnto=Special:ViewRelationships' ) ); |
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Set up config for page / default values |
58 | 58 | */ |
59 | | - if(!$page || !is_numeric($page) ) $page = 1; |
60 | | - if(!$rel_type || !is_numeric($rel_type) ) $rel_type = 1; |
| 59 | + if( !$page || !is_numeric( $page ) ) $page = 1; |
| 60 | + if( !$rel_type || !is_numeric( $rel_type ) ) $rel_type = 1; |
61 | 61 | $per_page = 50; |
62 | 62 | $per_row = 2; |
63 | 63 | |
— | — | @@ -64,61 +64,60 @@ |
65 | 65 | * If no user is set in the URL, we assume its the current user |
66 | 66 | */ |
67 | 67 | if( !$user_name ) $user_name = $wgUser->getName(); |
68 | | - $user_id = User::idFromName($user_name); |
| 68 | + $user_id = User::idFromName( $user_name ); |
69 | 69 | $user = Title::makeTitle( NS_USER, $user_name ); |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Error message for username that does not exist (from URL) |
73 | 73 | */ |
74 | 74 | if( $user_id == 0 ){ |
75 | | - $wgOut->setPageTitle( wfMsg('ur-error-title') ); |
| 75 | + $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) ); |
76 | 76 | $out .= '<div class="relationship-error-message"> |
77 | | - '.wfMsg('ur-error-message-no-user').' |
| 77 | + ' . wfMsg( 'ur-error-message-no-user' ) . ' |
78 | 78 | </div> |
79 | 79 | <div class="relationship-request-buttons"> |
80 | | - <input type="button" class="site-button" value="'.wfMsg('ur-main-page').'" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
| 80 | + <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />'; |
81 | 81 | if( $wgUser->isLoggedIn() ){ |
82 | | - $out .= '<input type="button" class="site-button" value="'.wfMsg('ur-your-profile').'" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
| 82 | + $out .= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" onclick=\'window.location="'. $wgUser->getUserPage()->escapeFullURL() . '"\' />'; |
83 | 83 | } |
84 | 84 | $out .= '</div>'; |
85 | | - $wgOut->addHTML($out); |
| 85 | + $wgOut->addHTML( $out ); |
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Get all relationships |
91 | 91 | */ |
92 | | - $rel = new UserRelationship($user_name); |
93 | | - $relationships = $rel->getRelationshipList($rel_type, $per_page, $page); |
| 92 | + $rel = new UserRelationship( $user_name ); |
| 93 | + $relationships = $rel->getRelationshipList( $rel_type, $per_page, $page ); |
94 | 94 | |
95 | | - $stats = new UserStats($rel->user_id, $rel->user_name); |
| 95 | + $stats = new UserStats( $rel->user_id, $rel->user_name ); |
96 | 96 | $stats_data = $stats->getUserStats(); |
97 | 97 | $friend_count = $stats_data['friend_count']; |
98 | 98 | $foe_count = $stats_data['foe_count']; |
99 | 99 | |
100 | 100 | $back_link = Title::makeTitle( NS_USER, $rel->user_name ); |
101 | | - $invite_contacts_link = Title::makeTitle( NS_SPECIAL, 'InviteContacts' ); |
102 | | - #$invite_contacts_link = SpecialPage::getTitleFor( 'InviteContacts' ); |
| 101 | + $invite_contacts_link = SpecialPage::getTitleFor( 'InviteContacts' ); |
103 | 102 | |
104 | 103 | if( $rel_type == 1 ) { |
105 | 104 | $output .= $wgOut->setPageTitle( wfMsg( 'ur-title-friend', $rel->user_name ) ); |
106 | 105 | $total = $friend_count; |
107 | 106 | $rem = wfMsg( 'ur-remove-relationship-friend' ); |
108 | 107 | $output .= '<div class="back-links"> |
109 | | - <a href="'.$back_link->escapeFullURL().'">'.wfMsg( 'ur-backlink', $rel->user_name ).'</a> |
| 108 | + <a href="' . $back_link->escapeFullURL() . '">' . wfMsg( 'ur-backlink', $rel->user_name ) . '</a> |
110 | 109 | </div> |
111 | | - <div class="relationship-count">'. |
112 | | - wfMsgExt( 'ur-relationship-count-friends', 'parsemag', $rel->user_name, $total, $invite_contacts_link->escapeFullURL() ). |
| 110 | + <div class="relationship-count">' |
| 111 | + . wfMsgExt( 'ur-relationship-count-friends', 'parsemag', $rel->user_name, $total, $invite_contacts_link->escapeFullURL() ) . |
113 | 112 | '</div>'; |
114 | 113 | } else { |
115 | 114 | $output .= $wgOut->setPageTitle( wfMsg( 'ur-title-foe', $rel->user_name ) ); |
116 | 115 | $total = $foe_count; |
117 | 116 | $rem = wfMsg( 'ur-remove-relationship-foe' ); |
118 | 117 | $output .= '<div class="back-links"> |
119 | | - <a href="'.$back_link->escapeFullURL().'">'.wfMsg( 'ur-backlink', $rel->user_name ).'</a> |
| 118 | + <a href="' . $back_link->escapeFullURL() . '">' . wfMsg( 'ur-backlink', $rel->user_name ) . '</a> |
120 | 119 | </div> |
121 | | - <div class="relationship-count">'. |
122 | | - wfMsgExt( 'ur-relationship-count-foes', 'parsemag', $rel->user_name, $total, $invite_contacts_link->escapeFullURL() ). |
| 120 | + <div class="relationship-count">' |
| 121 | + . wfMsgExt( 'ur-relationship-count-foes', 'parsemag', $rel->user_name, $total, $invite_contacts_link->escapeFullURL() ) . |
123 | 122 | '</div>'; |
124 | 123 | } |
125 | 124 | |
— | — | @@ -145,8 +144,8 @@ |
146 | 145 | $username_length = strlen( $relationship['user_name'] ); |
147 | 146 | $username_space = stripos( $relationship['user_name'], ' ' ); |
148 | 147 | |
149 | | - if( ($username_space == false || $username_space >= "30") && $username_length > 30 ){ |
150 | | - $user_name_display = substr($relationship['user_name'], 0, 30)." ".substr($relationship['user_name'], 30, 50); |
| 148 | + if( ( $username_space == false || $username_space >= "30" ) && $username_length > 30 ){ |
| 149 | + $user_name_display = substr( $relationship['user_name'], 0, 30 ) . ' ' . substr( $relationship['user_name'], 30, 50 ); |
151 | 150 | } else { |
152 | 151 | $user_name_display = $relationship['user_name']; |
153 | 152 | }; |
— | — | @@ -160,22 +159,22 @@ |
161 | 160 | <div class=\"relationship-actions\">"; |
162 | 161 | if( $indivRelationship == false ) { |
163 | 162 | $output .= $wgLang->pipeList( array( |
164 | | - '<a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=1' ) . '">' . wfMsg( 'ur-add-friend' ) . '</a> ', |
165 | | - ' <a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=2' ) . '">' . wfMsg( 'ur-add-foe' ) . '</a> ', |
| 163 | + '<a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=1' ) . '">' . wfMsg( 'ur-add-friend' ) . '</a>', |
| 164 | + '<a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=2' ) . '">' . wfMsg( 'ur-add-foe' ) . '</a>', |
166 | 165 | '' |
167 | 166 | ) ); |
168 | 167 | } else if( $user_name == $wgUser->getName() ) { |
169 | | - $output .= '<a href="'.$remove_relationship_link->escapeFullURL( 'user=' . $user_safe ) . '">' . $rem . '</a> '; |
| 168 | + $output .= '<a href="' . $remove_relationship_link->escapeFullURL( 'user=' . $user_safe ) . '">' . $rem . '</a>'; |
170 | 169 | $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
171 | 170 | } |
172 | | - $output .= ' <a href="'.$give_gift_link->escapeFullURL( 'user=' . $user_safe ).'">'.wfMsg( 'ur-give-gift' ).'</a>'; |
| 171 | + $output .= '<a href="' . $give_gift_link->escapeFullURL( 'user=' . $user_safe ) . '">' . wfMsg( 'ur-give-gift' ) . '</a>'; |
173 | 172 | |
174 | 173 | $output .= '</div> |
175 | 174 | <div class="cleared"></div> |
176 | 175 | </div>'; |
177 | 176 | |
178 | 177 | $output .= '</div>'; |
179 | | - if( $x == count($relationships) || $x != 1 && $x%$per_row == 0 ) $output .= '<div class="cleared"></div>'; |
| 178 | + if( $x == count( $relationships ) || $x != 1 && $x%$per_row == 0 ) $output .= '<div class="cleared"></div>'; |
180 | 179 | $x++; |
181 | 180 | } |
182 | 181 | } |
— | — | @@ -191,23 +190,23 @@ |
192 | 191 | if( $numofpages > 1 ) { |
193 | 192 | $output .= '<div class="page-nav">'; |
194 | 193 | if( $page > 1 ) { |
195 | | - $output .= "<a href=\"".$page_link->escapeFullURL('user='.$user_name.'&rel_type='.$rel_type.'&page='.($page-1))."\">".wfMsg('ur-previous')."</a> "; |
| 194 | + $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'ur-previous' ) . '</a> '; |
196 | 195 | } |
197 | 196 | |
198 | | - if( ($total % $per_page) != 0 ) $numofpages++; |
| 197 | + if( ( $total % $per_page ) != 0 ) $numofpages++; |
199 | 198 | if( $numofpages >=9 && $page < $total ) $numofpages = 9+$page; |
200 | | - if( $numofpages >= ($total / $per_page) ) $numofpages = ($total / $per_page)+1; |
| 199 | + if( $numofpages >= ( $total / $per_page ) ) $numofpages = ($total / $per_page)+1; |
201 | 200 | |
202 | 201 | for( $i = 1; $i <= $numofpages; $i++ ){ |
203 | 202 | if( $i == $page ) { |
204 | | - $output .= ($i." "); |
| 203 | + $output .= ( $i . ' ' ); |
205 | 204 | } else { |
206 | | - $output .= "<a href=\"".$page_link->escapeFullURL('user='.$user_name.'&rel_type='.$rel_type.'&page='.$i)."\">$i</a> "; |
| 205 | + $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . $i ) . "\">$i</a> "; |
207 | 206 | } |
208 | 207 | } |
209 | 208 | |
210 | | - if( ($total - ($per_page * $page)) > 0 ){ |
211 | | - $output .= " <a href=\"".$page_link->escapeFullURL('user='.$user_name.'&rel_type='.$rel_type.'&page='.($page+1))."\">".wfMsg('ur-next')."</a>"; |
| 209 | + if( ( $total - ( $per_page * $page ) ) > 0 ){ |
| 210 | + $output .= ' <a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . ( $page + 1 ) ) . '">' . wfMsg( 'ur-next' ) . '</a>'; |
212 | 211 | } |
213 | 212 | $output .= '</div>'; |
214 | 213 | } |
— | — | @@ -215,6 +214,6 @@ |
216 | 215 | /** |
217 | 216 | * Build next/prev nav |
218 | 217 | */ |
219 | | - $wgOut->addHTML($output); |
| 218 | + $wgOut->addHTML( $output ); |
220 | 219 | } |
221 | 220 | } |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js |
— | — | @@ -1,13 +1,12 @@ |
2 | | - function requestResponse(response,id){ |
3 | | - var url = "index.php?action=ajax"; |
4 | | - var pars = 'rs=wfRelationshipRequestResponse&rsargs[]=' + response + '&rsargs[]=' + id |
5 | | - YAHOO.widget.Effects.Hide('request_action_'+id); |
6 | | - var callback = { |
7 | | - success: function( oResponse ) { |
8 | | - $('request_action_'+id).innerHTML = oResponse.responseText; |
9 | | - YAHOO.widget.Effects.Appear('request_action_'+id,{duration:2.0} ); |
10 | | - } |
11 | | - }; |
12 | | - var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, pars); |
13 | | - |
14 | | - } |
| 2 | +/** |
| 3 | + * JavaScript for UserRelationship |
| 4 | + * Used on Special:ViewRelationshipRequests |
| 5 | + */ |
| 6 | +function requestResponse( response, id ){ |
| 7 | + YAHOO.widget.Effects.Hide( 'request_action_' + id ); |
| 8 | + sajax_request_type = 'POST'; |
| 9 | + sajax_do_call( 'wfRelationshipRequestResponse', [ response, id ], function( request ){ |
| 10 | + document.getElementById( 'request_action_' + id ).innerHTML = request.responseText; |
| 11 | + YAHOO.widget.Effects.Appear( 'request_action_' + id, { duration:2.0 } ); |
| 12 | + } ); |
| 13 | +} |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserRelationship/UserRelationshipClass.php |
— | — | @@ -13,43 +13,43 @@ |
14 | 14 | * Constructor |
15 | 15 | * @private |
16 | 16 | */ |
17 | | - /* private */ function __construct($username) { |
| 17 | + /* private */ function __construct( $username ) { |
18 | 18 | wfLoadExtensionMessages( 'SocialProfileUserRelationship' ); |
19 | | - $title1 = Title::newFromDBkey($username); |
| 19 | + $title1 = Title::newFromDBkey( $username ); |
20 | 20 | $this->user_name = $title1->getText(); |
21 | | - $this->user_id = User::idFromName($this->user_name); |
| 21 | + $this->user_id = User::idFromName( $this->user_name ); |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function addRelationshipRequest( $user_to, $type, $message, $email = true ){ |
25 | | - $user_id_to = User::idFromName($user_to); |
| 25 | + $user_id_to = User::idFromName( $user_to ); |
26 | 26 | $dbw = wfGetDB( DB_MASTER ); |
27 | 27 | |
28 | 28 | $dbw->insert( 'user_relationship_request', |
29 | | - array( |
30 | | - 'ur_user_id_from' => $this->user_id, |
31 | | - 'ur_user_name_from' => $this->user_name, |
32 | | - 'ur_user_id_to' => $user_id_to, |
33 | | - 'ur_user_name_to' => $user_to, |
34 | | - 'ur_type' => $type, |
35 | | - 'ur_message' => $message, |
36 | | - 'ur_date' => date("Y-m-d H:i:s") |
| 29 | + array( |
| 30 | + 'ur_user_id_from' => $this->user_id, |
| 31 | + 'ur_user_name_from' => $this->user_name, |
| 32 | + 'ur_user_id_to' => $user_id_to, |
| 33 | + 'ur_user_name_to' => $user_to, |
| 34 | + 'ur_type' => $type, |
| 35 | + 'ur_message' => $message, |
| 36 | + 'ur_date' => date("Y-m-d H:i:s") |
37 | 37 | ), __METHOD__ |
38 | 38 | ); |
39 | 39 | $request_id = $dbw->insertId(); |
40 | 40 | |
41 | | - $this->incNewRequestCount($user_id_to, $type); |
| 41 | + $this->incNewRequestCount( $user_id_to, $type ); |
42 | 42 | |
43 | | - if( $email ) $this->sendRelationshipRequestEmail($user_id_to, $this->user_name, $type); |
| 43 | + if( $email ) $this->sendRelationshipRequestEmail( $user_id_to, $this->user_name, $type ); |
44 | 44 | return $request_id; |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function sendRelationshipRequestEmail( $user_id_to, $user_from, $type ){ |
48 | | - $user = User::newFromId($user_id_to); |
| 48 | + $user = User::newFromId( $user_id_to ); |
49 | 49 | $user->loadFromDatabase(); |
50 | 50 | if( $user->getEmail() && $user->getIntOption( 'notifyfriendrequest', 1 ) ){ //if($user->isEmailConfirmed() && $user->getIntOption("notifyfriendrequest",1)){ |
51 | 51 | $request_link = SpecialPage::getTitleFor( 'ViewRelationshipRequests' ); |
52 | 52 | $update_profile_link = SpecialPage::getTitleFor( 'UpdateProfile' ); |
53 | | - if( $type == 1){ |
| 53 | + if( $type == 1 ){ |
54 | 54 | $subject = wfMsgExt( 'friend_request_subject', 'parsemag', |
55 | 55 | $user_from |
56 | 56 | ); |
— | — | @@ -70,12 +70,12 @@ |
71 | 71 | $update_profile_link->getFullURL() |
72 | 72 | ); |
73 | 73 | } |
74 | | - $user->sendMail($subject, $body); |
| 74 | + $user->sendMail( $subject, $body ); |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | 78 | public function sendRelationshipAcceptEmail( $user_id_to, $user_from, $type ){ |
79 | | - $user = User::newFromId($user_id_to); |
| 79 | + $user = User::newFromId( $user_id_to ); |
80 | 80 | $user->loadFromDatabase(); |
81 | 81 | if( $user->getEmail() && $user->getIntOption( 'notifyfriendrequest', 1 ) ){ //if($user->isEmailConfirmed() && $user->getIntOption("notifyfriendrequest",1)){ |
82 | 82 | $user_link = Title::makeTitle( NS_USER, $user_from ); |
— | — | @@ -101,12 +101,12 @@ |
102 | 102 | $update_profile_link->getFullURL() |
103 | 103 | ); |
104 | 104 | } |
105 | | - $user->sendMail($subject, $body); |
| 105 | + $user->sendMail( $subject, $body ); |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function sendRelationshipRemoveEmail( $user_id_to, $user_from, $type ){ |
110 | | - $user = User::newFromId($user_id_to); |
| 110 | + $user = User::newFromId( $user_id_to ); |
111 | 111 | $user->loadFromDatabase(); |
112 | 112 | if( $user->isEmailConfirmed() && $user->getIntOption( 'notifyfriendrequest', 1 ) ){ |
113 | 113 | $user_link = Title::makeTitle( NS_USER, $user_from ); |
— | — | @@ -141,8 +141,9 @@ |
142 | 142 | |
143 | 143 | $dbw = wfGetDB( DB_MASTER ); |
144 | 144 | $s = $dbw->selectRow( 'user_relationship_request', |
145 | | - array( 'ur_user_id_from', 'ur_user_name_from', 'ur_type'), |
146 | | - array( 'ur_id' => $relationship_request_id ), __METHOD__ |
| 145 | + array( 'ur_user_id_from', 'ur_user_name_from', 'ur_type' ), |
| 146 | + array( 'ur_id' => $relationship_request_id ), |
| 147 | + __METHOD__ |
147 | 148 | ); |
148 | 149 | |
149 | 150 | if ( $s == true ) { |
— | — | @@ -150,47 +151,47 @@ |
151 | 152 | $ur_user_name_from = $s->ur_user_name_from; |
152 | 153 | $ur_type = $s->ur_type; |
153 | 154 | |
154 | | - if( self::getUserRelationshipByID($this->user_id, $ur_user_id_from) > 0 ){ |
| 155 | + if( self::getUserRelationshipByID( $this->user_id, $ur_user_id_from ) > 0 ){ |
155 | 156 | return ''; |
156 | 157 | } |
157 | 158 | |
158 | 159 | $dbw->insert( 'user_relationship', |
159 | | - array( |
160 | | - 'r_user_id' => $this->user_id, |
161 | | - 'r_user_name' => $this->user_name, |
162 | | - 'r_user_id_relation' => $ur_user_id_from, |
163 | | - 'r_user_name_relation' => $ur_user_name_from, |
164 | | - 'r_type' => $ur_type, |
165 | | - 'r_date' => date("Y-m-d H:i:s") |
| 160 | + array( |
| 161 | + 'r_user_id' => $this->user_id, |
| 162 | + 'r_user_name' => $this->user_name, |
| 163 | + 'r_user_id_relation' => $ur_user_id_from, |
| 164 | + 'r_user_name_relation' => $ur_user_name_from, |
| 165 | + 'r_type' => $ur_type, |
| 166 | + 'r_date' => date("Y-m-d H:i:s") |
166 | 167 | ), __METHOD__ |
167 | 168 | ); |
168 | 169 | |
169 | 170 | $dbw->insert( 'user_relationship', |
170 | | - array( |
171 | | - 'r_user_id' => $ur_user_id_from, |
172 | | - 'r_user_name' => $ur_user_name_from, |
173 | | - 'r_user_id_relation' => $this->user_id, |
174 | | - 'r_user_name_relation' => $this->user_name, |
175 | | - 'r_type' => $ur_type, |
176 | | - 'r_date' => date("Y-m-d H:i:s") |
| 171 | + array( |
| 172 | + 'r_user_id' => $ur_user_id_from, |
| 173 | + 'r_user_name' => $ur_user_name_from, |
| 174 | + 'r_user_id_relation' => $this->user_id, |
| 175 | + 'r_user_name_relation' => $this->user_name, |
| 176 | + 'r_type' => $ur_type, |
| 177 | + 'r_date' => date("Y-m-d H:i:s") |
177 | 178 | ), __METHOD__ |
178 | 179 | ); |
179 | 180 | |
180 | | - $stats = new UserStatsTrack($this->user_id, $this->user_name); |
| 181 | + $stats = new UserStatsTrack( $this->user_id, $this->user_name ); |
181 | 182 | if( $ur_type == 1 ){ |
182 | | - $stats->incStatField("friend"); |
| 183 | + $stats->incStatField( 'friend' ); |
183 | 184 | } else { |
184 | | - $stats->incStatField("foe"); |
| 185 | + $stats->incStatField( 'foe' ); |
185 | 186 | } |
186 | 187 | |
187 | | - $stats = new UserStatsTrack($ur_user_id_from, $ur_user_name_from); |
| 188 | + $stats = new UserStatsTrack( $ur_user_id_from, $ur_user_name_from ); |
188 | 189 | if( $ur_type == 1 ){ |
189 | | - $stats->incStatField("friend"); |
| 190 | + $stats->incStatField( 'friend' ); |
190 | 191 | } else { |
191 | | - $stats->incStatField("foe"); |
| 192 | + $stats->incStatField( 'foe' ); |
192 | 193 | } |
193 | 194 | |
194 | | - if($email)$this->sendRelationshipAcceptEmail($ur_user_id_from, $this->user_name, $ur_type); |
| 195 | + if( $email ) $this->sendRelationshipAcceptEmail( $ur_user_id_from, $this->user_name, $ur_type ); |
195 | 196 | |
196 | 197 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$this->user_id}-{$ur_type}" ) ); |
197 | 198 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$ur_user_id_from}-{$ur_type}" ) ); |
— | — | @@ -218,20 +219,20 @@ |
219 | 220 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$user1}-2" ) ); |
220 | 221 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$user2}-2" ) ); |
221 | 222 | |
222 | | - $stats = new UserStatsTrack($user1, ''); |
223 | | - $stats->updateRelationshipCount(1); |
224 | | - $stats->updateRelationshipCount(2); |
| 223 | + $stats = new UserStatsTrack( $user1, '' ); |
| 224 | + $stats->updateRelationshipCount( 1 ); |
| 225 | + $stats->updateRelationshipCount( 2 ); |
225 | 226 | $stats->clearCache(); |
226 | 227 | |
227 | | - $stats = new UserStatsTrack($user2, ''); |
228 | | - $stats->updateRelationshipCount(1); |
229 | | - $stats->updateRelationshipCount(2); |
| 228 | + $stats = new UserStatsTrack( $user2, '' ); |
| 229 | + $stats->updateRelationshipCount( 1 ); |
| 230 | + $stats->updateRelationshipCount( 2 ); |
230 | 231 | $stats->clearCache(); |
231 | 232 | } |
232 | 233 | |
233 | 234 | public function deleteRequest( $id ){ |
234 | | - $request = $this->getRequest($id); |
235 | | - $this->decNewRequestCount($this->user_id, $request[0]['rel_type']); |
| 235 | + $request = $this->getRequest( $id ); |
| 236 | + $this->decNewRequestCount( $this->user_id, $request[0]['rel_type'] ); |
236 | 237 | |
237 | 238 | $dbw = wfGetDB( DB_MASTER ); |
238 | 239 | $dbw->delete( 'user_relationship_request', array( 'ur_id' => $id ), __METHOD__ ); |
— | — | @@ -240,11 +241,9 @@ |
241 | 242 | public function updateRelationshipRequestStatus( $relationship_request_id, $status ){ |
242 | 243 | $dbw = wfGetDB( DB_MASTER ); |
243 | 244 | $dbw->update( 'user_relationship_request', |
244 | | - array( /* SET */ |
245 | | - 'ur_status' => $status |
246 | | - ), array( /* WHERE */ |
247 | | - 'ur_id' => $relationship_request_id |
248 | | - ), "" |
| 245 | + /* SET */array( 'ur_status' => $status ), |
| 246 | + /* WHERE */array( 'ur_id' => $relationship_request_id ), |
| 247 | + __METHOD__ |
249 | 248 | ); |
250 | 249 | } |
251 | 250 | |
— | — | @@ -280,12 +279,12 @@ |
281 | 280 | } |
282 | 281 | |
283 | 282 | public function getRequest( $id ){ |
284 | | - global $wgDBprefix; |
285 | 283 | $dbr = wfGetDB( DB_MASTER ); |
286 | | - $sql = "SELECT ur_id, ur_user_id_from, ur_user_name_from, ur_type, ur_message, ur_date |
287 | | - FROM ".$wgDBprefix."user_relationship_request |
288 | | - WHERE ur_id = {$id}"; |
289 | | - $res = $dbr->query($sql); |
| 284 | + $res = $dbr->select( 'user_relationship_request', |
| 285 | + array( 'ur_id', 'ur_user_id_from', 'ur_user_name_from', 'ur_type', 'ur_message', 'ur_date' ), |
| 286 | + array( "ur_id = {$id}" ), |
| 287 | + __METHOD__ |
| 288 | + ); |
290 | 289 | while( $row = $dbr->fetchObject( $res ) ) { |
291 | 290 | if( $row->ur_type == 1 ){ |
292 | 291 | $type_name = 'Friend'; |
— | — | @@ -358,7 +357,7 @@ |
359 | 358 | $s = $dbr->selectRow( 'user_relationship_request', array( 'count(*) AS count' ), array( 'ur_user_id_to' => $user_id, 'ur_status' => 0, 'ur_type' => $rel_type ), __METHOD__ ); |
360 | 359 | if ( $s !== false ) $request_count = $s->count; |
361 | 360 | |
362 | | - $wgMemc->set($key, $request_count); |
| 361 | + $wgMemc->set( $key, $request_count ); |
363 | 362 | |
364 | 363 | return $request_count; |
365 | 364 | } |
— | — | @@ -375,13 +374,13 @@ |
376 | 375 | } |
377 | 376 | |
378 | 377 | static function getOpenRequestCount( $user_id, $rel_type ){ |
379 | | - $data = self::getOpenRequestCountCache($user_id, $rel_type); |
| 378 | + $data = self::getOpenRequestCountCache( $user_id, $rel_type ); |
380 | 379 | |
381 | 380 | if( $data != '' ){ |
382 | | - if( $data == -1 )$data = 0; |
| 381 | + if( $data == -1 ) $data = 0; |
383 | 382 | $count = $data; |
384 | 383 | } else { |
385 | | - $count = self::getOpenRequestCountDB($user_id, $rel_type); |
| 384 | + $count = self::getOpenRequestCountDB( $user_id, $rel_type ); |
386 | 385 | } |
387 | 386 | return $count; |
388 | 387 | } |
— | — | @@ -443,7 +442,7 @@ |
444 | 443 | |
445 | 444 | static function getRelationshipCountByUsername( $user_name ){ |
446 | 445 | $dbr = wfGetDB( DB_SLAVE ); |
447 | | - $user_id = User::idFromName($user_name); |
| 446 | + $user_id = User::idFromName( $user_name ); |
448 | 447 | $sql = "SELECT rs_friend_count, rs_foe_count |
449 | 448 | FROM {$dbr->tableName( 'user_relationship_stats' )} |
450 | 449 | WHERE rs_user_id = {$user_id} |