Index: trunk/extensions/SocialProfile/UserBoard/UserBoardClass.php |
— | — | @@ -16,51 +16,70 @@ |
17 | 17 | /* private */ function __construct() { |
18 | 18 | } |
19 | 19 | |
| 20 | + /** |
| 21 | + * Sends a user board message to another user |
| 22 | + * |
| 23 | + * @param $user_id_from Integer: user ID of the sender |
| 24 | + * @param $user_name_from Mixed: user name of the sender |
| 25 | + * @param $user_id_to Integer: user ID of the reciever |
| 26 | + * @param $user_name_to Mixed: user name of the reciever |
| 27 | + * @param $message Mixed: message text |
| 28 | + * @param $message_type Integer: 0 for public message |
| 29 | + * @return Integer: the inserted value of ub_id row |
| 30 | + */ |
20 | 31 | public function sendBoardMessage( $user_id_from, $user_name_from, $user_id_to, $user_name_to, $message, $message_type = 0 ){ |
21 | 32 | $dbw = wfGetDB( DB_MASTER ); |
22 | 33 | |
23 | | - $user_name_from = stripslashes($user_name_from); |
24 | | - $user_name_to = stripslashes($user_name_to); |
| 34 | + $user_name_from = stripslashes( $user_name_from ); |
| 35 | + $user_name_to = stripslashes( $user_name_to ); |
25 | 36 | |
26 | 37 | $dbw->insert( 'user_board', |
27 | | - array( |
28 | | - 'ub_user_id_from' => $user_id_from, |
29 | | - 'ub_user_name_from' => $user_name_from, |
30 | | - 'ub_user_id' => $user_id_to, |
31 | | - 'ub_user_name' => $user_name_to, |
32 | | - 'ub_message' => $message, |
33 | | - 'ub_type' => $message_type, |
34 | | - 'ub_date' => date("Y-m-d H:i:s"), |
35 | | - ), __METHOD__ |
| 38 | + array( |
| 39 | + 'ub_user_id_from' => $user_id_from, |
| 40 | + 'ub_user_name_from' => $user_name_from, |
| 41 | + 'ub_user_id' => $user_id_to, |
| 42 | + 'ub_user_name' => $user_name_to, |
| 43 | + 'ub_message' => $message, |
| 44 | + 'ub_type' => $message_type, |
| 45 | + 'ub_date' => date("Y-m-d H:i:s"), |
| 46 | + ), |
| 47 | + __METHOD__ |
36 | 48 | ); |
37 | 49 | |
38 | 50 | // Send Email (if user is not writing on own board) |
39 | 51 | if( $user_id_from != $user_id_to ){ |
40 | | - $this->sendBoardNotificationEmail($user_id_to, $user_name_from); |
41 | | - $this->incNewMessageCount($user_id_to); |
| 52 | + $this->sendBoardNotificationEmail( $user_id_to, $user_name_from ); |
| 53 | + $this->incNewMessageCount( $user_id_to ); |
42 | 54 | } |
43 | 55 | |
44 | | - $stats = new UserStatsTrack($user_id_to, $user_name_to); |
| 56 | + $stats = new UserStatsTrack( $user_id_to, $user_name_to ); |
45 | 57 | if( $message_type == 0 ){ |
46 | 58 | // public message count |
47 | | - $stats->incStatField('user_board_count'); |
| 59 | + $stats->incStatField( 'user_board_count' ); |
48 | 60 | } else { |
49 | 61 | // private message count |
50 | | - $stats->incStatField('user_board_count_priv'); |
| 62 | + $stats->incStatField( 'user_board_count_priv' ); |
51 | 63 | } |
52 | 64 | |
53 | | - $stats = new UserStatsTrack($user_id_from, $user_name_from); |
54 | | - $stats->incStatField('user_board_sent'); |
| 65 | + $stats = new UserStatsTrack( $user_id_from, $user_name_from ); |
| 66 | + $stats->incStatField( 'user_board_sent' ); |
55 | 67 | |
56 | 68 | return $dbw->insertId(); |
57 | 69 | } |
58 | 70 | |
| 71 | + /** |
| 72 | + * Sends an email to a user if someone wrote on their board |
| 73 | + * |
| 74 | + * @param $user_id_to Integer: user ID of the reciever |
| 75 | + * @param $user_from Mixed: the user name of the person who wrote the board message |
| 76 | + */ |
59 | 77 | public function sendBoardNotificationEmail( $user_id_to, $user_from ){ |
60 | 78 | wfLoadExtensionMessages( 'SocialProfileUserBoard' ); |
61 | 79 | |
62 | | - $user = User::newFromId($user_id_to); |
| 80 | + $user = User::newFromId( $user_id_to ); |
63 | 81 | $user->loadFromId(); |
64 | 82 | |
| 83 | + // Send email if user's email is confirmed and s/he's opted in to recieving social notifications |
65 | 84 | if( $user->isEmailConfirmed() && $user->getIntOption( 'notifymessage', 1 ) ){ |
66 | 85 | $board_link = SpecialPage::getTitleFor( 'UserBoard' ); |
67 | 86 | $update_profile_link = SpecialPage::getTitleFor( 'UpdateProfile' ); |
— | — | @@ -86,7 +105,7 @@ |
87 | 106 | static function clearNewMessageCount( $user_id ){ |
88 | 107 | global $wgMemc; |
89 | 108 | $key = wfMemcKey( 'user', 'newboardmessage', $user_id ); |
90 | | - $wgMemc->set($key, 0); |
| 109 | + $wgMemc->set( $key, 0 ); |
91 | 110 | } |
92 | 111 | |
93 | 112 | static function getNewMessageCountCache( $user_id ){ |
— | — | @@ -109,23 +128,29 @@ |
110 | 129 | //$s = $dbw->selectRow( 'user_board', array( 'count(*) AS count' ), array( 'ug_user_id_to' => $user_id, 'ug_status' => 1 ), __METHOD__ ); |
111 | 130 | //if ( $s !== false )$new_gift_count = $s->count; |
112 | 131 | |
113 | | - $wgMemc->set($key, $new_count); |
| 132 | + $wgMemc->set( $key, $new_count ); |
114 | 133 | |
115 | 134 | return $new_count; |
116 | 135 | } |
117 | 136 | |
118 | 137 | static function getNewMessageCount( $user_id ){ |
119 | 138 | global $wgMemc; |
120 | | - $data = self::getNewMessageCountCache($user_id); |
| 139 | + $data = self::getNewMessageCountCache( $user_id ); |
121 | 140 | |
122 | 141 | if( $data != '' ){ |
123 | 142 | $count = $data; |
124 | 143 | } else { |
125 | | - $count = self::getNewMessageCountDB($user_id); |
| 144 | + $count = self::getNewMessageCountDB( $user_id ); |
126 | 145 | } |
127 | 146 | return $count; |
128 | 147 | } |
129 | 148 | |
| 149 | + /** |
| 150 | + * Checks if the user with ID number $user_id owns the board message with the ID number $ub_id |
| 151 | + * @param $user_id Integer: user ID number |
| 152 | + * @param $ub_id Integer: user board message ID number |
| 153 | + * @return Boolean: true if user owns the message, otherwise false |
| 154 | + */ |
130 | 155 | public function doesUserOwnMessage( $user_id, $ub_id ){ |
131 | 156 | $dbw = wfGetDB( DB_MASTER ); |
132 | 157 | $s = $dbw->selectRow( 'user_board', array( 'ub_user_id' ), array( 'ub_id' => $ub_id ), __METHOD__ ); |
— | — | @@ -137,6 +162,10 @@ |
138 | 163 | return false; |
139 | 164 | } |
140 | 165 | |
| 166 | + /** |
| 167 | + * Deletes a user board message from the database |
| 168 | + * @param $ub_id Integer: ID number of the board message that we want to delete |
| 169 | + */ |
141 | 170 | public function deleteMessage( $ub_id ){ |
142 | 171 | if( $ub_id ){ |
143 | 172 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -145,11 +174,11 @@ |
146 | 175 | |
147 | 176 | $dbw->delete( 'user_board', array( 'ub_id' => $ub_id ), __METHOD__ ); |
148 | 177 | |
149 | | - $stats = new UserStatsTrack($s->ub_user_id, $s->ub_user_name); |
| 178 | + $stats = new UserStatsTrack( $s->ub_user_id, $s->ub_user_name ); |
150 | 179 | if( $s->ub_type == 0 ){ |
151 | | - $stats->decStatField('user_board_count'); |
| 180 | + $stats->decStatField( 'user_board_count' ); |
152 | 181 | } else { |
153 | | - $stats->decStatField('user_board_count_priv'); |
| 182 | + $stats->decStatField( 'user_board_count_priv' ); |
154 | 183 | } |
155 | 184 | } |
156 | 185 | } |
— | — | @@ -221,8 +250,7 @@ |
222 | 251 | } |
223 | 252 | $sql = "SELECT count(*) AS the_count |
224 | 253 | FROM ".$wgDBprefix."user_board |
225 | | - WHERE {$user_sql} |
226 | | - "; |
| 254 | + WHERE {$user_sql}"; |
227 | 255 | |
228 | 256 | $res = $dbr->query($sql); |
229 | 257 | $row = $dbr->fetchObject( $res ); |
— | — | @@ -233,14 +261,15 @@ |
234 | 262 | } |
235 | 263 | |
236 | 264 | public function displayMessages( $user_id, $user_id_2 = 0, $count = 10, $page = 0 ){ |
237 | | - global $wgUser, $max_link_text_length, $wgTitle; |
| 265 | + global $wgUser, $wgTitle; |
| 266 | + |
238 | 267 | $output = ''; // Prevent E_NOTICE |
239 | | - $messages = $this->getUserBoardMessages($user_id, $user_id_2, $count, $page); |
| 268 | + $messages = $this->getUserBoardMessages( $user_id, $user_id_2, $count, $page ); |
240 | 269 | wfLoadExtensionMessages( 'SocialProfileUserBoard' ); |
241 | 270 | if( $messages ) { |
242 | 271 | |
243 | 272 | foreach( $messages as $message ) { |
244 | | - $user = Title::makeTitle( NS_USER, $message['user_name_from'] ); |
| 273 | + $user = Title::makeTitle( NS_USER, $message['user_name_from'] ); |
245 | 274 | $avatar = new wAvatar( $message['user_id_from'], 'm' ); |
246 | 275 | |
247 | 276 | $board_to_board = ''; |
— | — | @@ -249,8 +278,8 @@ |
250 | 279 | $delete_link = ''; |
251 | 280 | |
252 | 281 | if( $wgUser->getName() != $message['user_name_from'] ){ |
253 | | - $board_to_board = "<a href=\"" . UserBoard::getUserBoardToBoardURL($message['user_name'], $message['user_name_from'])."\">" . wfMsgHtml( 'userboard_board-to-board' ) . "</a>"; |
254 | | - $board_link = "<a href=\"" . UserBoard::getUserBoardURL($message['user_name_from'])."\">" . wfMsgHtml( 'userboard_sendmessage', $message["user_name_from"] ) . "</a>"; |
| 282 | + $board_to_board = '<a href="' . UserBoard::getUserBoardToBoardURL( $message['user_name'], $message['user_name_from'] ) . '">' . wfMsgHtml( 'userboard_board-to-board' ) . '</a>'; |
| 283 | + $board_link = '<a href="' . UserBoard::getUserBoardURL( $message['user_name_from'] ) . '">' . wfMsgHtml( 'userboard_sendmessage', $message['user_name_from'] ) . '</a>'; |
255 | 284 | } |
256 | 285 | if( $wgUser->getName() == $message['user_name'] ){ |
257 | 286 | $delete_link = "<span class=\"user-board-red\"> |
— | — | @@ -261,7 +290,7 @@ |
262 | 291 | $message_type_label = '(' . wfMsgHtml( 'userboard_private' ) . ')'; |
263 | 292 | } |
264 | 293 | |
265 | | - $max_link_text_length = 50; |
| 294 | + #$max_link_text_length = 50; |
266 | 295 | $message_text = $message['message_text']; |
267 | 296 | #$message_text = preg_replace_callback( "/(<a[^>]*>)(.*?)(<\/a>)/i",'cut_link_text',$message["message_text"]); |
268 | 297 | |
— | — | @@ -289,9 +318,9 @@ |
290 | 319 | </div>"; |
291 | 320 | } |
292 | 321 | } else if( $wgUser->getName() == $wgTitle->getText() ) { |
293 | | - $output .= '<div class="no-info-container"> |
294 | | - ' . wfMsgHtml( 'userboard_nomessages' ) . ' |
295 | | - </div>'; |
| 322 | + $output .= '<div class="no-info-container">' |
| 323 | + . wfMsgHtml( 'userboard_nomessages' ) . |
| 324 | + '</div>'; |
296 | 325 | |
297 | 326 | } |
298 | 327 | return $output; |
— | — | @@ -304,21 +333,25 @@ |
305 | 334 | |
306 | 335 | static function getUserBoardURL( $user_name ){ |
307 | 336 | $title = SpecialPage::getTitleFor( 'UserBoard' ); |
308 | | - $user_name = str_replace("&", "%26", $user_name); |
309 | | - return $title->escapeFullURL('user='.$user_name); |
| 337 | + $user_name = str_replace( '&', '%26', $user_name ); |
| 338 | + return $title->escapeFullURL( 'user=' . $user_name ); |
310 | 339 | } |
311 | 340 | |
312 | 341 | static function getUserBoardToBoardURL( $user_name_1, $user_name_2 ){ |
313 | 342 | $title = SpecialPage::getTitleFor( 'UserBoard' ); |
314 | | - $user_name_1 = str_replace("&", "%26", $user_name_1); |
315 | | - $user_name_2 = str_replace("&", "%26", $user_name_2); |
316 | | - return $title->escapeFullURL('user='.$user_name_1.'&conv='.$user_name_2); |
| 343 | + $user_name_1 = str_replace( '&', '%26', $user_name_1 ); |
| 344 | + $user_name_2 = str_replace( '&', '%26', $user_name_2 ); |
| 345 | + return $title->escapeFullURL( 'user=' . $user_name_1 . '&conv=' . $user_name_2 ); |
317 | 346 | } |
318 | 347 | |
319 | | - public function dateDiff( $dt1, $dt2 ) { |
320 | | - $date1 = $dt1; //(strtotime($dt1) != -1) ? strtotime($dt1) : $dt1; |
321 | | - $date2 = $dt2; //(strtotime($dt2) != -1) ? strtotime($dt2) : $dt2; |
322 | | - |
| 348 | + /** |
| 349 | + * Gets the difference between two given dates |
| 350 | + * |
| 351 | + * @param $dt1 Mixed: current time, as returned by PHP's time() function |
| 352 | + * @param $dt2 Mixed: date |
| 353 | + * @return Difference between dates |
| 354 | + */ |
| 355 | + public function dateDiff( $date1, $date2 ) { |
323 | 356 | $dtDiff = $date1 - $date2; |
324 | 357 | |
325 | 358 | $totalDays = intval($dtDiff/(24*60*60)); |
— | — | @@ -333,21 +366,27 @@ |
334 | 367 | } |
335 | 368 | |
336 | 369 | public function getTimeOffset( $time, $timeabrv, $timename ){ |
| 370 | + $timeStr = ''; |
337 | 371 | if( $time[$timeabrv] > 0 ){ |
338 | | - $timeStr = $time[$timeabrv] . " " . $timename; |
339 | | - if( $time[$timeabrv] > 1 ) $timeStr .= "s"; |
| 372 | + $timeStr = $time[$timeabrv] . ' ' . $timename; |
| 373 | + if( $time[$timeabrv] > 1 ) $timeStr .= 's'; |
340 | 374 | } |
341 | | - if( $timeStr ) $timeStr .= " "; |
| 375 | + if( $timeStr ) $timeStr .= ' '; |
342 | 376 | return $timeStr; |
343 | 377 | } |
344 | 378 | |
| 379 | + /** |
| 380 | + * Gets the time how long ago the given board message was posted |
| 381 | + * @param $time |
| 382 | + * @return $timeStr Mixed: time, such as "20 days" or "11 hours" |
| 383 | + */ |
345 | 384 | public function getTimeAgo( $time ){ |
346 | 385 | $timeArray = $this->dateDiff( time(), $time ); |
347 | 386 | $timeStr = ''; |
348 | | - $timeStrD = $this->getTimeOffset($timeArray, 'd', 'day'); |
349 | | - $timeStrH = $this->getTimeOffset($timeArray, 'h', 'hour'); |
350 | | - $timeStrM = $this->getTimeOffset($timeArray, 'm', 'minute'); |
351 | | - $timeStrS = $this->getTimeOffset($timeArray, 's', 'second'); |
| 387 | + $timeStrD = $this->getTimeOffset( $timeArray, 'd', 'day' ); |
| 388 | + $timeStrH = $this->getTimeOffset( $timeArray, 'h', 'hour' ); |
| 389 | + $timeStrM = $this->getTimeOffset( $timeArray, 'm', 'minute' ); |
| 390 | + $timeStrS = $this->getTimeOffset( $timeArray, 's', 'second' ); |
352 | 391 | $timeStr = $timeStrD; |
353 | 392 | if( $timeStr < 2 ){ |
354 | 393 | $timeStr.= $timeStrH; |
Index: trunk/extensions/SocialProfile/UserBoard/SpecialUserBoard.php |
— | — | @@ -36,19 +36,18 @@ |
37 | 37 | $wgOut->addStyle( '../..' . $wgUserBoardScripts . '/UserBoard.css' ); |
38 | 38 | |
39 | 39 | $ub_messages_show = 25; |
40 | | - $output = ''; |
41 | | - $user_name = $wgRequest->getVal('user'); |
42 | | - $user_name_2 = $wgRequest->getVal('conv'); |
| 40 | + $user_name = $wgRequest->getVal( 'user' ); |
| 41 | + $user_name_2 = $wgRequest->getVal( 'conv' ); |
43 | 42 | $user_id_2 = ''; // Prevent E_NOTICE |
44 | | - $page = $wgRequest->getVal('page'); |
| 43 | + $page = $wgRequest->getVal( 'page' ); |
45 | 44 | |
46 | 45 | /** |
47 | 46 | * Redirect Non-logged in users to Login Page |
48 | 47 | * It will automatically return them to the UserBoard page |
49 | 48 | */ |
50 | 49 | if( $wgUser->getID() == 0 && $user_name == '' ){ |
51 | | - $login = SpecialPage::getTitleFor( 'UserLogin' ); |
52 | | - $wgOut->redirect( $login->getFullURL() . "&returnto=Special:UserBoard" ); |
| 50 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 51 | + $wgOut->redirect( $login->getFullURL() . '&returnto=Special:UserBoard' ); |
53 | 52 | return false; |
54 | 53 | } |
55 | 54 | |
— | — | @@ -56,21 +55,21 @@ |
57 | 56 | * If no user is set in the URL, we assume its the current user |
58 | 57 | */ |
59 | 58 | if( !$user_name ) $user_name = $wgUser->getName(); |
60 | | - $user_id = User::idFromName($user_name); |
| 59 | + $user_id = User::idFromName( $user_name ); |
61 | 60 | $user = Title::makeTitle( NS_USER, $user_name ); |
62 | | - $user_safe = str_replace("&", "%26", $user_name); |
| 61 | + $user_safe = str_replace( '&', '%26', $user_name ); |
63 | 62 | |
64 | 63 | if( $user_name_2 ){ |
65 | | - $user_id_2 = User::idFromName($user_name_2); |
| 64 | + $user_id_2 = User::idFromName( $user_name_2 ); |
66 | 65 | $user_2 = Title::makeTitle( NS_USER, $user_name ); |
67 | | - $user_safe_2 = urlencode($user_name_2); |
| 66 | + $user_safe_2 = urlencode( $user_name_2 ); |
68 | 67 | } |
69 | 68 | |
70 | 69 | /** |
71 | 70 | * Error message for username that does not exist (from URL) |
72 | 71 | */ |
73 | 72 | if( $user_id == 0 ){ |
74 | | - $wgOut->showErrorPage('error', 'userboard_noexist'); |
| 73 | + $wgOut->showErrorPage( 'error', 'userboard_noexist' ); |
75 | 74 | return false; |
76 | 75 | } |
77 | 76 | |
— | — | @@ -78,40 +77,40 @@ |
79 | 78 | * Config for the page |
80 | 79 | */ |
81 | 80 | $per_page = $ub_messages_show; |
82 | | - if( !$page || !is_numeric($page) ) $page = 1; |
| 81 | + if( !$page || !is_numeric( $page ) ) $page = 1; |
83 | 82 | |
84 | 83 | $b = new UserBoard(); |
85 | | - $ub_messages = $b->getUserBoardMessages($user_id, $user_id_2, $ub_messages_show, $page); |
| 84 | + $ub_messages = $b->getUserBoardMessages( $user_id, $user_id_2, $ub_messages_show, $page ); |
86 | 85 | |
87 | 86 | if( !$user_id_2 ){ |
88 | | - $stats = new UserStats($user_id, $user_name); |
| 87 | + $stats = new UserStats( $user_id, $user_name ); |
89 | 88 | $stats_data = $stats->getUserStats(); |
90 | 89 | $total = $stats_data['user_board']; |
91 | 90 | if( $wgUser->getName() == $user_name ) $total = $total+$stats_data['user_board_priv']; |
92 | 91 | } else { |
93 | | - $total = $b->getUserBoardToBoardCount($user_id, $user_id_2); |
| 92 | + $total = $b->getUserBoardToBoardCount( $user_id, $user_id_2 ); |
94 | 93 | } |
95 | 94 | |
96 | 95 | if( !$user_id_2 ){ |
97 | 96 | if( !( $wgUser->getName() == $user_name ) ) { |
98 | | - $wgOut->setPagetitle( wfMsg('userboard_owner', $user_name) ); |
| 97 | + $wgOut->setPageTitle( wfMsg( 'userboard_owner', $user_name ) ); |
99 | 98 | } else { |
100 | 99 | $b->clearNewMessageCount( $wgUser->getID() ); |
101 | | - $wgOut->setPagetitle( wfMsg('userboard_yourboard') ); |
| 100 | + $wgOut->setPageTitle( wfMsg( 'userboard_yourboard' ) ); |
102 | 101 | } |
103 | 102 | } else { |
104 | 103 | if ( $wgUser->getName() == $user_name ) { |
105 | | - $wgOut->setPagetitle( wfMsg('userboard_yourboardwith', $user_name_2) ); |
| 104 | + $wgOut->setPageTitle( wfMsg( 'userboard_yourboardwith', $user_name_2 ) ); |
106 | 105 | } else { |
107 | | - $wgOut->setPagetitle( wfMsg('userboard_otherboardwith', $user_name, $user_name_2) ); |
| 106 | + $wgOut->setPageTitle( wfMsg( 'userboard_otherboardwith', $user_name, $user_name_2 ) ); |
108 | 107 | } |
109 | 108 | } |
110 | 109 | |
111 | | - $output .= '<div class="user-board-top-links">'; |
112 | | - $output .= "<a href=\"{$user->escapeFullURL()}\">< " . wfMsg('userboard_backprofile', $user_name) . "</a>"; |
113 | | - $output .= "</div>"; |
114 | | - $output .= "<script>/*<![CDATA[*/ |
115 | | - var _DELETE_CONFIRM = \"" . wfMsg('userboard_confirmdelete') . "\" |
| 110 | + $output = '<div class="user-board-top-links">'; |
| 111 | + $output .= '<a href="' . $user->escapeFullURL() . '">< ' . wfMsg( 'userboard_backprofile', $user_name ) . '</a>'; |
| 112 | + $output .= '</div>'; |
| 113 | + $output .= "<script type=\"text/javascript\">/*<![CDATA[*/ |
| 114 | + var _DELETE_CONFIRM = \"" . wfMsg( 'userboard_confirmdelete' ) . "\" |
116 | 115 | var posted = 0; |
117 | 116 | function send_message(){ |
118 | 117 | if(\$(\"message\").value && !posted){ |
— | — | @@ -160,17 +159,17 @@ |
161 | 160 | if( $page == 1 ){ |
162 | 161 | $start = 1; |
163 | 162 | } else { |
164 | | - $start = ($page-1) * $per_page + 1; |
| 163 | + $start = ( $page - 1 ) * $per_page + 1; |
165 | 164 | } |
166 | | - $end = $start + ( count($ub_messages) ) - 1; |
| 165 | + $end = $start + ( count( $ub_messages ) ) - 1; |
167 | 166 | |
168 | 167 | if( $wgUser->getName() != $user_name ){ |
169 | | - $board_to_board = "<a href=\"" . UserBoard::getUserBoardToBoardURL( $wgUser->getName(), $user_name )."\">" .wfMsg( 'userboard_boardtoboard' ) . "</a>"; |
| 168 | + $board_to_board = '<a href="' . UserBoard::getUserBoardToBoardURL( $wgUser->getName(), $user_name ). '">' .wfMsg( 'userboard_boardtoboard' ) . '</a>'; |
170 | 169 | } |
171 | 170 | |
172 | 171 | if( $total ){ |
173 | | - $output .= "<div class=\"user-page-message-top\"> |
174 | | - <span class=\"user-page-message-count\" style=\"font-size:11px;color:#666666;\">" . wfMsg( 'userboard_showingmessages', $total, $start, $end, $end - $start + 1 ) . ".</span> {$board_to_board}</span> |
| 172 | + $output .= '<div class="user-page-message-top"> |
| 173 | + <span class="user-page-message-count" style="font-size:11px;color:#666666;">' . wfMsg( 'userboard_showingmessages', $total, $start, $end, $end - $start + 1 ) . ".</span> {$board_to_board}</span> |
175 | 174 | </div>"; |
176 | 175 | } |
177 | 176 | |
— | — | @@ -183,7 +182,7 @@ |
184 | 183 | if( $numofpages > 1 ){ |
185 | 184 | $output .= '<div class="page-nav">'; |
186 | 185 | if( $page > 1 ){ |
187 | | - $output .= "<a href=\"".$wgScriptPath."/index.php?title=Special:UserBoard&user={$user_safe}&page=" . ($page-1) . "{$qs}\">" . wfMsg('userboard_prevpage') . "</a>"; |
| 186 | + $output .= "<a href=\"".$wgScriptPath."/index.php?title=Special:UserBoard&user={$user_safe}&page=" . ($page-1) . "{$qs}\">" . wfMsg( 'userboard_prevpage' ) . '</a>'; |
188 | 187 | } |
189 | 188 | |
190 | 189 | if( ($total % $per_page) != 0 ) $numofpages++; |
— | — | @@ -194,14 +193,14 @@ |
195 | 194 | |
196 | 195 | for( $i = 1; $i <= $numofpages; $i++ ){ |
197 | 196 | if( $i == $page ){ |
198 | | - $output .= ($i." "); |
| 197 | + $output .= ($i." "); |
199 | 198 | } else { |
200 | | - $output .= "<a href=\"".$wgScriptPath."/index.php?title=Special:UserBoard&user={$user_safe}&page=$i{$qs}\">$i</a> "; |
| 199 | + $output .= '<a href="' . $wgScriptPath . "/index.php?title=Special:UserBoard&user={$user_safe}&page=$i{$qs}\">$i</a> "; |
201 | 200 | } |
202 | 201 | } |
203 | 202 | |
204 | 203 | if( ($total - ($per_page * $page)) > 0 ){ |
205 | | - $output .= " <a href=\"".$wgScriptPath."/index.php?title=Special:UserBoard&user={$user_safe}&page=" . ($page+1) . "{$qs}\">" . wfMsg('userboard_nextpage') . "</a>"; |
| 204 | + $output .= ' <a href="' . $wgScriptPath . "/index.php?title=Special:UserBoard&user={$user_safe}&page=" . ($page+1) . "{$qs}\">" . wfMsg( 'userboard_nextpage' ) . '</a>'; |
206 | 205 | } |
207 | 206 | $output .= '</div><p>'; |
208 | 207 | } |
— | — | @@ -226,7 +225,7 @@ |
227 | 226 | } |
228 | 227 | if( $wgUser->isBlocked() ){ |
229 | 228 | // only let them post to admins |
230 | | - $user_to = User::newFromId($user_id); |
| 229 | + $user_to = User::newFromId( $user_id ); |
231 | 230 | $user_to->loadFromId(); |
232 | 231 | //if( !$user_to->isAllowed('delete') ){ |
233 | 232 | $can_post = false; |
— | — | @@ -270,21 +269,21 @@ |
271 | 270 | $ub_message_type_label = ''; |
272 | 271 | $delete_link = ''; |
273 | 272 | if( $wgUser->getName() != $ub_message['user_name_from'] ){ |
274 | | - $board_to_board = "<a href=\"" . UserBoard::getUserBoardToBoardURL($user_name, $ub_message['user_name_from'])."\">" . wfMsg('userboard_boardtoboard') . "</a>"; |
275 | | - $board_link = "<a href=\"" . UserBoard::getUserBoardURL($ub_message['user_name_from'])."\">" . wfMsg( 'userboard_sendmessage', $ub_message['user_name_from'] ) . "</a>"; |
| 273 | + $board_to_board = '<a href="' . UserBoard::getUserBoardToBoardURL( $user_name, $ub_message['user_name_from'] ) . '">' . wfMsg( 'userboard_boardtoboard' ) . '</a>'; |
| 274 | + $board_link = '<a href="' . UserBoard::getUserBoardURL( $ub_message['user_name_from'] ) . '">' . wfMsg( 'userboard_sendmessage', $ub_message['user_name_from'] ) . '</a>'; |
276 | 275 | } else { |
277 | | - $board_link = "<a href=\"" . UserBoard::getUserBoardURL($ub_message['user_name_from'])."\">" . wfMsg('userboard_myboard') . "</a>"; |
| 276 | + $board_link = '<a href="' . UserBoard::getUserBoardURL( $ub_message['user_name_from'] ) . '">' . wfMsg( 'userboard_myboard' ) . '</a>'; |
278 | 277 | } |
279 | 278 | if( $wgUser->getName() == $ub_message['user_name'] ){ |
280 | 279 | $delete_link = "<span class=\"user-board-red\"> |
281 | | - <a href=\"javascript:void(0);\" onclick=\"javascript:delete_message({$ub_message["id"]})\">" . wfMsg('userboard_delete') . "</a> |
| 280 | + <a href=\"javascript:void(0);\" onclick=\"javascript:delete_message({$ub_message["id"]})\">" . wfMsg( 'userboard_delete' ) . "</a> |
282 | 281 | </span>"; |
283 | 282 | } |
284 | 283 | if( $ub_message['type'] == 1 ){ |
285 | | - $ub_message_type_label = "(" . wfMsg('userboard_private') . ")"; |
| 284 | + $ub_message_type_label = '(' . wfMsg( 'userboard_private' ) . ')'; |
286 | 285 | } |
287 | | - global $max_link_text_length; |
288 | | - $max_link_text_length = 75; |
| 286 | + //global $max_link_text_length; |
| 287 | + //$max_link_text_length = 75; |
289 | 288 | |
290 | 289 | //had global function to cut link text if too long and no breaks |
291 | 290 | //$ub_message_text = preg_replace_callback( "/(<a[^>]*>)(.*?)(<\/a>)/i",'cut_link_text',$ub_message["message_text"]); |
— | — | @@ -321,6 +320,6 @@ |
322 | 321 | } |
323 | 322 | $output .= '</div>'; |
324 | 323 | |
325 | | - $wgOut->addHTML($output); |
| 324 | + $wgOut->addHTML( $output ); |
326 | 325 | } |
327 | 326 | } |
\ No newline at end of file |