Index: trunk/extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php |
— | — | @@ -1,8 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * A special page for uploading Avatars |
5 | | - * This page is a big hack -- its just the image upload page with some changes to |
6 | | - * upload the actual avatar files. The avatars are not held as MediaWiki images, but |
| 4 | + * A special page for uploading avatars |
| 5 | + * This page is a big hack -- it's just the image upload page with some changes |
| 6 | + * to upload the actual avatar files. |
| 7 | + * The avatars are not held as MediaWiki images, but |
7 | 8 | * rather based on the user_id and in multiple sizes |
8 | 9 | * |
9 | 10 | * Requirements: Need writable directory $wgUploadPath/avatars |
— | — | @@ -60,10 +61,11 @@ |
61 | 62 | |
62 | 63 | /** |
63 | 64 | * Show some text and linkage on successful upload. |
64 | | - * @access private |
| 65 | + * |
| 66 | + * @param $ext String: file extension (gif, jpg or png) |
65 | 67 | */ |
66 | | - function showSuccess( $ext ) { |
67 | | - global $wgUser, $wgOut, $wgContLang, $wgDBname, $wgUploadPath, $wgUploadAvatarInRecentChanges; |
| 68 | + private function showSuccess( $ext ) { |
| 69 | + global $wgUser, $wgOut, $wgDBname, $wgUploadPath, $wgUploadAvatarInRecentChanges; |
68 | 70 | |
69 | 71 | $log = new LogPage( wfMsgForContent( 'user-profile-picture-log' ) ); |
70 | 72 | if ( !$wgUploadAvatarInRecentChanges ) { |
— | — | @@ -121,8 +123,10 @@ |
122 | 124 | * Displays the main upload form, optionally with a highlighted |
123 | 125 | * error message up at the top. |
124 | 126 | * |
125 | | - * @param string $msg as HTML |
126 | | - * @access private |
| 127 | + * @param $msg String: error message as HTML |
| 128 | + * @param $sessionKey String: session key in case this is a stashed upload |
| 129 | + * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box |
| 130 | + * @return HTML output |
127 | 131 | */ |
128 | 132 | protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { |
129 | 133 | global $wgOut, $wgUser, $wgLang, $wgUploadDirectory, $wgRequest, $wgUseCopyrightUpload; |
— | — | @@ -212,6 +216,13 @@ |
213 | 217 | return $output; |
214 | 218 | } |
215 | 219 | |
| 220 | + /** |
| 221 | + * Gets an avatar image with the specified size |
| 222 | + * |
| 223 | + * @param $size String: size of the image ('s' for small, 'm' for medium, |
| 224 | + * 'ml' for medium-large and 'l' for large) |
| 225 | + * @return String: full img HTML tag |
| 226 | + */ |
216 | 227 | function getAvatar( $size ) { |
217 | 228 | global $wgUser, $wgDBname, $wgUploadDirectory, $wgUploadPath; |
218 | 229 | $files = glob( $wgUploadDirectory . '/avatars/' . $wgDBname . '_' . $wgUser->getID() . '_' . $size . "*" ); |