Index: trunk/extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | * @param $params Mixed: parameter(s) passed to the page or null |
47 | 47 | */ |
48 | 48 | public function execute( $params ) { |
49 | | - global $wgRequest, $wgOut, $wgUser, $wgUserProfileScripts; |
| 49 | + global $wgOut, $wgUser, $wgUserProfileScripts; |
50 | 50 | |
51 | 51 | $wgOut->addExtensionStyle( $wgUserProfileScripts . '/UserProfile.css' ); |
52 | 52 | parent::execute( $params ); |
— | — | @@ -81,30 +81,39 @@ |
82 | 82 | $output = '<h1>' . wfMsg( 'uploadavatar' ) . '</h1>'; |
83 | 83 | $output .= UserProfile::getEditProfileNav( wfMsg( 'user-profile-section-picture' ) ); |
84 | 84 | $output .= '<div class="profile-info">'; |
85 | | - $output .= '<p class="profile-update-title">' . wfMsg( 'user-profile-picture-yourpicture' ) . '</p>'; |
| 85 | + $output .= '<p class="profile-update-title">' . |
| 86 | + wfMsg( 'user-profile-picture-yourpicture' ) . '</p>'; |
86 | 87 | $output .= '<p>' . wfMsg( 'user-profile-picture-yourpicturestext' ) . '</p>'; |
87 | 88 | |
88 | 89 | $output .= '<table cellspacing="0" cellpadding="0" style="margin-top:20px;">'; |
89 | 90 | $output .= '<tr> |
90 | | - <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . wfMsg( 'user-profile-picture-large' ) . '</td> |
| 91 | + <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . |
| 92 | + wfMsg( 'user-profile-picture-large' ) . |
| 93 | + '</td> |
91 | 94 | <td style="padding-bottom:20px;"> |
92 | 95 | <img src="' . $wgUploadPath . '/avatars/' . $wgDBname . '_' . $wgUser->mId . '_l.' . $ext . '?ts=' . rand() . '" alt="" border="0" /> |
93 | 96 | </td> |
94 | 97 | </tr>'; |
95 | 98 | $output .= '<tr> |
96 | | - <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . wfMsg( 'user-profile-picture-medlarge' ) . '</td> |
| 99 | + <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . |
| 100 | + wfMsg( 'user-profile-picture-medlarge' ) . |
| 101 | + '</td> |
97 | 102 | <td style="padding-bottom:20px;"> |
98 | 103 | <img src="' . $wgUploadPath . '/avatars/' . $wgDBname . '_' . $wgUser->mId . '_ml.' . $ext . '?ts=' . rand() . '" alt="" border="0" /> |
99 | 104 | </td> |
100 | 105 | </tr>'; |
101 | 106 | $output .= '<tr> |
102 | | - <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . wfMsg( 'user-profile-picture-medium' ) . '</td> |
| 107 | + <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . |
| 108 | + wfMsg( 'user-profile-picture-medium' ) . |
| 109 | + '</td> |
103 | 110 | <td style="padding-bottom:20px;"> |
104 | 111 | <img src="' . $wgUploadPath . '/avatars/' . $wgDBname . '_' . $wgUser->mId . '_m.' . $ext . '?ts=' . rand() . '" alt="" border="0" /> |
105 | 112 | </td> |
106 | 113 | </tr>'; |
107 | 114 | $output .= '<tr> |
108 | | - <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . wfMsg( 'user-profile-picture-small' ) . '</td> |
| 115 | + <td valign="top" style="color:#797979;font-size:12px;font-weight:bold;padding-bottom:20px;">' . |
| 116 | + wfMsg( 'user-profile-picture-small' ) . |
| 117 | + '</td> |
109 | 118 | <td style="padding-bottom:20px;"> |
110 | 119 | <img src="' . $wgUploadPath . '/avatars/' . $wgDBname . '_' . $wgUser->mId . '_s.' . $ext . '?ts' . rand() . '" alt="" border="0" /> |
111 | 120 | </td> |
— | — | @@ -130,35 +139,17 @@ |
131 | 140 | * @return HTML output |
132 | 141 | */ |
133 | 142 | protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { |
134 | | - global $wgOut, $wgUser, $wgLang, $wgUploadDirectory, $wgRequest, $wgUseCopyrightUpload; |
| 143 | + global $wgOut, $wgUser, $wgUseCopyrightUpload; |
135 | 144 | |
136 | | - $cols = intval( $wgUser->getOption( 'cols' ) ); |
137 | | - $ew = $wgUser->getOption( 'editwidth' ); |
138 | | - if ( $ew ) { |
139 | | - $ew = ' style="width:100%"'; |
140 | | - } else { |
141 | | - $ew = ''; |
142 | | - } |
143 | | - |
144 | | - if ( '' != $message ) { |
| 145 | + if ( $message != '' ) { |
145 | 146 | $sub = wfMsg( 'uploaderror' ); |
146 | 147 | $wgOut->addHTML( "<h2>{$sub}</h2>\n" . |
147 | 148 | "<h4 class='error'>{$message}</h4>\n" ); |
148 | 149 | } |
149 | 150 | $sk = $wgUser->getSkin(); |
150 | 151 | |
151 | | - $sourcefilename = wfMsg( 'sourcefilename' ); |
152 | | - $destfilename = wfMsg( 'destfilename' ); |
153 | | - |
154 | | - $fd = wfMsg( 'filedesc' ); |
155 | 152 | $ulb = wfMsg( 'uploadbtn' ); |
156 | 153 | |
157 | | - $iw = wfMsg( 'ignorewarning' ); |
158 | | - |
159 | | - $titleObj = SpecialPage::getTitleFor( 'Upload' ); |
160 | | - $action = $titleObj->escapeLocalURL(); |
161 | | - |
162 | | - $encDestFile = htmlspecialchars( $this->mDesiredDestName ); |
163 | 154 | $source = null; |
164 | 155 | |
165 | 156 | if ( $wgUseCopyrightUpload ) { |
— | — | @@ -173,10 +164,6 @@ |
174 | 165 | "; |
175 | 166 | } |
176 | 167 | |
177 | | - $watchChecked = $wgUser->getOption( 'watchdefault' ) |
178 | | - ? 'checked="checked"' |
179 | | - : ''; |
180 | | - |
181 | 168 | $output = '<h1>' . wfMsg( 'uploadavatar' ) . '</h1>'; |
182 | 169 | $output .= UserProfile::getEditProfileNav( wfMsg( 'user-profile-section-picture' ) ); |
183 | 170 | $output .= '<div class="profile-info">'; |
— | — | @@ -198,8 +185,12 @@ |
199 | 186 | <table border="0"> |
200 | 187 | <tr> |
201 | 188 | <td> |
202 | | - <p class="profile-update-title">' . wfMsg( 'user-profile-picture-choosepicture' ) . '</p> |
203 | | - <p style="margin-bottom:10px;">' . wfMsg( 'user-profile-picture-picsize' ) . '</p> |
| 189 | + <p class="profile-update-title">' . |
| 190 | + wfMsg( 'user-profile-picture-choosepicture' ) . |
| 191 | + '</p> |
| 192 | + <p style="margin-bottom:10px;">' . |
| 193 | + wfMsg( 'user-profile-picture-picsize' ) . |
| 194 | + '</p> |
204 | 195 | <input tabindex="1" type="file" name="wpUploadFile" id="wpUploadFile" size="36"/> |
205 | 196 | </td> |
206 | 197 | </tr> |
— | — | @@ -226,9 +217,13 @@ |
227 | 218 | */ |
228 | 219 | function getAvatar( $size ) { |
229 | 220 | global $wgUser, $wgDBname, $wgUploadDirectory, $wgUploadPath; |
230 | | - $files = glob( $wgUploadDirectory . '/avatars/' . $wgDBname . '_' . $wgUser->getID() . '_' . $size . "*" ); |
| 221 | + $files = glob( |
| 222 | + $wgUploadDirectory . '/avatars/' . $wgDBname . '_' . |
| 223 | + $wgUser->getID() . '_' . $size . "*" |
| 224 | + ); |
231 | 225 | if ( isset( $files[0] ) && $files[0] ) { |
232 | | - return "<img src=\"{$wgUploadPath}/avatars/" . basename( $files[0] ) . '" alt="" border="0" />'; |
| 226 | + return "<img src=\"{$wgUploadPath}/avatars/" . |
| 227 | + basename( $files[0] ) . '" alt="" border="0" />'; |
233 | 228 | } |
234 | 229 | } |
235 | 230 | |
— | — | @@ -280,7 +275,7 @@ |
281 | 276 | * Create the thumbnails and delete old files |
282 | 277 | */ |
283 | 278 | public function performUpload( $comment, $pageText, $watch, $user ) { |
284 | | - global $wgUploadDirectory, $wgOut, $wgUser, $wgDBname; |
| 279 | + global $wgUploadDirectory, $wgUser, $wgDBname, $wgMemc; |
285 | 280 | |
286 | 281 | $this->avatarUploadDirectory = $wgUploadDirectory . '/avatars'; |
287 | 282 | |
— | — | @@ -354,7 +349,7 @@ |
355 | 350 | unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $wgUser->mId . '_ml.png' ); |
356 | 351 | } |
357 | 352 | } |
358 | | - global $wgMemc; |
| 353 | + |
359 | 354 | $key = wfMemcKey( 'user', 'profile', 'avatar', $wgUser->getID(), 's' ); |
360 | 355 | $data = $wgMemc->delete( $key ); |
361 | 356 | |