Index: trunk/extensions/SocialProfile/UserBoard/UserBoardClass.php |
— | — | @@ -16,9 +16,9 @@ |
17 | 17 | /* private */ function __construct() { |
18 | 18 | } |
19 | 19 | |
20 | | - public function sendBoardMessage($user_id_from,$user_name_from,$user_id_to,$user_name_to, $message, $message_type=0){ |
| 20 | + public function sendBoardMessage($user_id_from, $user_name_from, $user_id_to, $user_name_to, $message, $message_type = 0){ |
21 | 21 | global $IP, $wgDBprefix; |
22 | | - $dbr =& wfGetDB( DB_MASTER ); |
| 22 | + $dbr = wfGetDB( DB_MASTER ); |
23 | 23 | $fname = $wgDBprefix.'user_board::addToDatabase'; |
24 | 24 | |
25 | 25 | $user_name_from = stripslashes($user_name_from); |
— | — | @@ -39,8 +39,8 @@ |
40 | 40 | $ub_gift_id = $dbr->insertId(); |
41 | 41 | |
42 | 42 | //Send Email (if user is not writing on own board) |
43 | | - if($user_id_from!=$user_id_to){ |
44 | | - $this->sendBoardNotificationEmail($user_id_to,$user_name_from); |
| 43 | + if($user_id_from != $user_id_to){ |
| 44 | + $this->sendBoardNotificationEmail($user_id_to, $user_name_from); |
45 | 45 | $this->incNewMessageCount($user_id_to); |
46 | 46 | } |
47 | 47 | |
— | — | @@ -59,18 +59,18 @@ |
60 | 60 | return $ub_gift_id; |
61 | 61 | } |
62 | 62 | |
63 | | - public function sendBoardNotificationEmail($user_id_to,$user_from){ |
| 63 | + public function sendBoardNotificationEmail($user_id_to, $user_from){ |
64 | 64 | wfLoadExtensionMessages( 'SocialProfileUserBoard' ); |
65 | 65 | |
66 | 66 | $user = User::newFromId($user_id_to); |
67 | 67 | $user->loadFromId(); |
68 | 68 | |
69 | | - if($user->isEmailConfirmed() && $user->getIntOption("notifymessage",1) ){ |
70 | | - $board_link = Title::makeTitle( NS_SPECIAL , "UserBoard" ); |
71 | | - $update_profile_link = Title::makeTitle( NS_SPECIAL , "UpdateProfile" ); |
| 69 | + if($user->isEmailConfirmed() && $user->getIntOption("notifymessage", 1) ){ |
| 70 | + $board_link = Title::makeTitle( NS_SPECIAL, "UserBoard" ); |
| 71 | + $update_profile_link = Title::makeTitle( NS_SPECIAL, "UpdateProfile" ); |
72 | 72 | $subject = wfMsgExt( 'message_received_subject', "parsemag", |
73 | 73 | $user_from |
74 | | - ); |
| 74 | + ); |
75 | 75 | $body = wfMsgExt( 'message_received_body', "parsemag", |
76 | 76 | $user->getName(), |
77 | 77 | $user_from, |
— | — | @@ -132,7 +132,7 @@ |
133 | 133 | |
134 | 134 | public function doesUserOwnMessage($user_id, $ub_id){ |
135 | 135 | $dbr = wfGetDB( DB_MASTER ); |
136 | | - $s = $dbr->selectRow( '`user_board`', array( 'ub_user_id' ), array( 'ub_id' => $ub_id ), $fname ); |
| 136 | + $s = $dbr->selectRow( 'user_board', array( 'ub_user_id' ), array( 'ub_id' => $ub_id ), $fname ); |
137 | 137 | if ( $s !== false ) { |
138 | 138 | if($user_id == $s->ub_user_id){ |
139 | 139 | return true; |
— | — | @@ -142,25 +142,26 @@ |
143 | 143 | } |
144 | 144 | |
145 | 145 | public function deleteMessage($ub_id){ |
| 146 | + global $wgDBprefix; |
146 | 147 | if($ub_id){ |
147 | | - $dbr =& wfGetDB( DB_MASTER ); |
148 | | - $s = $dbr->selectRow( '`user_board`', array( 'ub_user_id','ub_user_name','ub_type' ), array( 'ub_id' => $ub_id ), $fname ); |
| 148 | + $dbr = wfGetDB( DB_MASTER ); |
| 149 | + $s = $dbr->selectRow( 'user_board', array( 'ub_user_id','ub_user_name','ub_type' ), array( 'ub_id' => $ub_id ), $fname ); |
149 | 150 | if ( $s !== false ) { |
150 | 151 | |
151 | | - $sql = "DELETE FROM user_board WHERE ub_id={$ub_id}"; |
| 152 | + $sql = "DELETE FROM ".$wgDBprefix."user_board WHERE ub_id={$ub_id}"; |
152 | 153 | $res = $dbr->query($sql); |
153 | 154 | |
154 | 155 | $stats = new UserStatsTrack($s->ub_user_id, $s->ub_user_name); |
155 | 156 | if($s->ub_type==0){ |
156 | 157 | $stats->decStatField("user_board_count"); |
157 | | - }else{ |
| 158 | + } else { |
158 | 159 | $stats->decStatField("user_board_count_priv"); |
159 | 160 | } |
160 | 161 | } |
161 | 162 | } |
162 | 163 | } |
163 | 164 | |
164 | | - public function getUserBoardMessages($user_id,$user_id_2=0,$limit=0,$page=0){ |
| 165 | + public function getUserBoardMessages($user_id, $user_id_2 = 0, $limit = 0, $page = 0){ |
165 | 166 | global $wgUser, $wgOut, $wgTitle, $wgDBprefix; |
166 | 167 | $dbr = wfGetDB( DB_SLAVE ); |
167 | 168 | |
— | — | @@ -202,16 +203,16 @@ |
203 | 204 | $message_text = $message_text->getText(); |
204 | 205 | |
205 | 206 | $messages[] = array( |
206 | | - "id"=>$row->ub_id,"timestamp"=>($row->unix_time ) , |
207 | | - "user_id_from"=>$row->ub_user_id_from,"user_name_from"=>$row->ub_user_name_from, |
208 | | - "user_id"=>$row->ub_user_id,"user_name"=>$row->ub_user_name, |
209 | | - "message_text"=>$message_text,"type"=>$row->ub_type |
210 | | - ); |
| 207 | + "id" => $row->ub_id, "timestamp" => ($row->unix_time), |
| 208 | + "user_id_from" => $row->ub_user_id_from, "user_name_from" => $row->ub_user_name_from, |
| 209 | + "user_id" => $row->ub_user_id, "user_name" => $row->ub_user_name, |
| 210 | + "message_text" => $message_text, "type" => $row->ub_type |
| 211 | + ); |
211 | 212 | } |
212 | 213 | return $messages; |
213 | 214 | } |
214 | 215 | |
215 | | - public function getUserBoardToBoardCount($user_id,$user_id_2){ |
| 216 | + public function getUserBoardToBoardCount($user_id, $user_id_2){ |
216 | 217 | global $wgOut, $wgUser, $wgTitle, $wgDBprefix; |
217 | 218 | $dbr = wfGetDB( DB_SLAVE ); |
218 | 219 | |
— | — | @@ -235,15 +236,15 @@ |
236 | 237 | return $count; |
237 | 238 | } |
238 | 239 | |
239 | | - public function displayMessages($user_id,$user_id_2=0,$count=10,$page=0){ |
| 240 | + public function displayMessages($user_id, $user_id_2 = 0, $count = 10, $page = 0){ |
240 | 241 | global $wgUser,$max_link_text_length, $wgTitle; |
241 | | - $messages = $this->getUserBoardMessages($user_id,$user_id_2,$count,$page); |
| 242 | + $messages = $this->getUserBoardMessages($user_id, $user_id_2, $count, $page); |
242 | 243 | wfLoadExtensionMessages( 'SocialProfileUserBoard' ); |
243 | 244 | if ($messages) { |
244 | 245 | |
245 | 246 | foreach ($messages as $message) { |
246 | 247 | $user = Title::makeTitle( NS_USER, $message["user_name_from"] ); |
247 | | - $avatar = new wAvatar($message["user_id_from"],"m"); |
| 248 | + $avatar = new wAvatar($message["user_id_from"], "m"); |
248 | 249 | |
249 | 250 | $board_to_board = ""; |
250 | 251 | $board_link = ""; |
— | — | @@ -299,20 +300,20 @@ |
300 | 301 | } |
301 | 302 | |
302 | 303 | static function getBoardBlastURL( ){ |
303 | | - $title = Title::makeTitle( NS_SPECIAL , "SendBoardBlast" ); |
| 304 | + $title = Title::makeTitle( NS_SPECIAL, "SendBoardBlast" ); |
304 | 305 | return $title->escapeFullURL(); |
305 | 306 | } |
306 | 307 | |
307 | 308 | static function getUserBoardURL($user_name){ |
308 | | - $title = Title::makeTitle( NS_SPECIAL , "UserBoard" ); |
309 | | - $user_name = str_replace("&","%26",$user_name); |
| 309 | + $title = Title::makeTitle( NS_SPECIAL, "UserBoard" ); |
| 310 | + $user_name = str_replace("&", "%26", $user_name); |
310 | 311 | return $title->escapeFullURL('user='.$user_name); |
311 | 312 | } |
312 | 313 | |
313 | | - static function getUserBoardToBoardURL($user_name_1,$user_name_2){ |
314 | | - $title = Title::makeTitle( NS_SPECIAL , "UserBoard" ); |
315 | | - $user_name_1 = str_replace("&","%26",$user_name_1); |
316 | | - $user_name_2 = str_replace("&","%26",$user_name_2); |
| 314 | + static function getUserBoardToBoardURL($user_name_1, $user_name_2){ |
| 315 | + $title = Title::makeTitle( NS_SPECIAL, "UserBoard" ); |
| 316 | + $user_name_1 = str_replace("&", "%26", $user_name_1); |
| 317 | + $user_name_2 = str_replace("&", "%26", $user_name_2); |
317 | 318 | return $title->escapeFullURL('user='.$user_name_1.'&conv='.$user_name_2); |
318 | 319 | } |
319 | 320 | |
— | — | @@ -334,7 +335,7 @@ |
335 | 336 | return $dif; |
336 | 337 | } |
337 | 338 | |
338 | | - public function getTimeOffset($time,$timeabrv,$timename){ |
| 339 | + public function getTimeOffset($time, $timeabrv, $timename){ |
339 | 340 | if($time[$timeabrv]>0){ |
340 | 341 | $timeStr = $time[$timeabrv] . " " . $timename; |
341 | 342 | if($time[$timeabrv]>1)$timeStr .= "s"; |
— | — | @@ -344,12 +345,12 @@ |
345 | 346 | } |
346 | 347 | |
347 | 348 | public function getTimeAgo($time){ |
348 | | - $timeArray = $this-> dateDiff(time(),$time ); |
| 349 | + $timeArray = $this-> dateDiff( time(), $time ); |
349 | 350 | $timeStr = ""; |
350 | | - $timeStrD = $this->getTimeOffset($timeArray,"d","day"); |
351 | | - $timeStrH = $this->getTimeOffset($timeArray,"h","hour"); |
352 | | - $timeStrM = $this->getTimeOffset($timeArray,"m","minute"); |
353 | | - $timeStrS = $this->getTimeOffset($timeArray,"s","second"); |
| 351 | + $timeStrD = $this->getTimeOffset($timeArray, "d", "day"); |
| 352 | + $timeStrH = $this->getTimeOffset($timeArray, "h", "hour"); |
| 353 | + $timeStrM = $this->getTimeOffset($timeArray, "m", "minute"); |
| 354 | + $timeStrS = $this->getTimeOffset($timeArray, "s", "second"); |
354 | 355 | $timeStr = $timeStrD; |
355 | 356 | if($timeStr<2){ |
356 | 357 | $timeStr.=$timeStrH; |
— | — | @@ -358,4 +359,4 @@ |
359 | 360 | } |
360 | 361 | return $timeStr; |
361 | 362 | } |
362 | | -} |
| 363 | +} |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserBoard/UserBoard_AjaxFunctions.php |
— | — | @@ -1,16 +1,16 @@ |
2 | 2 | <?php |
3 | 3 | $wgAjaxExportList [] = 'wfSendBoardMessage'; |
4 | | -function wfSendBoardMessage($user_name,$message,$message_type,$count){ |
| 4 | +function wfSendBoardMessage($user_name, $message, $message_type, $count){ |
5 | 5 | global $IP, $wgMemc, $wgUser; |
6 | | - //require_once("$IP/extensions/wikia/UserBoard/UserBoardClass.php"); |
| 6 | + //require_once("$IP/extensions/SocialProfile/UserBoard/UserBoardClass.php"); |
7 | 7 | $user_name = stripslashes($user_name); |
8 | 8 | $user_name = urldecode($user_name); |
9 | 9 | $user_id_to = User::idFromName($user_name); |
10 | 10 | $b = new UserBoard(); |
11 | 11 | |
12 | | - $m = $b->sendBoardMessage($wgUser->getID(),$wgUser->getName(),$user_id_to, $user_name, urldecode($message),$message_type); |
| 12 | + $m = $b->sendBoardMessage($wgUser->getID(), $wgUser->getName(), $user_id_to, $user_name, urldecode($message), $message_type); |
13 | 13 | |
14 | | - return $b->displayMessages($user_id_to,0,$count); |
| 14 | + return $b->displayMessages($user_id_to, 0, $count); |
15 | 15 | } |
16 | 16 | |
17 | 17 | $wgAjaxExportList [] = 'wfDeleteBoardMessage'; |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | global $IP, $wgMemc, $wgUser; |
20 | 20 | |
21 | 21 | $b = new UserBoard(); |
22 | | - if( $b->doesUserOwnMessage($wgUser->getID(),$ub_id) ){ |
| 22 | + if( $b->doesUserOwnMessage($wgUser->getID(), $ub_id) ){ |
23 | 23 | $b->deleteMessage($ub_id); |
24 | 24 | } |
25 | 25 | return "ok"; |
Index: trunk/extensions/SocialProfile/UserStats/SpecialUpdateEditCounts.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | } |
19 | 19 | |
20 | 20 | $dbr = wfGetDB( DB_MASTER ); |
21 | | - $sql = "SELECT rev_user_text, rev_user, count(*) AS the_count FROM revision INNER JOIN page ON page_id = rev_page WHERE page_namespace = 0 AND rev_user <> 0 GROUP BY rev_user_text "; |
| 21 | + $sql = "SELECT rev_user_text, rev_user, count(*) AS the_count FROM ".$wgDBprefix."revision INNER JOIN ".$wgDBprefix."page ON page_id = rev_page WHERE page_namespace = 0 AND rev_user <> 0 GROUP BY rev_user_text "; |
22 | 22 | $res = $dbr->query($sql); |
23 | 23 | while ($row = $dbr->fetchObject( $res ) ) { |
24 | 24 | |
— | — | @@ -30,10 +30,10 @@ |
31 | 31 | $edit_count = 0; |
32 | 32 | } |
33 | 33 | |
34 | | - $s = $dbr->selectRow( '`'.$wgDBprefix.'user_stats`', array( 'stats_user_id' ), array('stats_user_id' => $row->rev_user), __METHOD__ ); |
| 34 | + $s = $dbr->selectRow( 'user_stats', array( 'stats_user_id' ), array('stats_user_id' => $row->rev_user), __METHOD__ ); |
35 | 35 | if ( ! $s->stats_user_id ) { |
36 | 36 | |
37 | | - $dbr->insert( '`'.$wgDBprefix.'user_stats`', |
| 37 | + $dbr->insert( 'user_stats', |
38 | 38 | array( |
39 | 39 | 'stats_year_id' => 0, |
40 | 40 | 'stats_user_id' => $row->rev_user, |
— | — | @@ -58,14 +58,14 @@ |
59 | 59 | } |
60 | 60 | |
61 | 61 | function execute(){ |
62 | | - global $wgUser, $wgOut; |
| 62 | + global $wgUser, $wgOut, $wgDBprefix; |
63 | 63 | $dbr = wfGetDB( DB_MASTER ); |
64 | 64 | $this->updateMainEditsCount(); |
65 | 65 | |
66 | 66 | global $wgUserLevels; |
67 | 67 | $wgUserLevels = ""; |
68 | 68 | |
69 | | - $sql = "SELECT stats_user_id,stats_user_name, stats_total_points FROM user_stats ORDER BY stats_user_name"; |
| 69 | + $sql = "SELECT stats_user_id,stats_user_name, stats_total_points FROM ".$wgDBprefix."user_stats ORDER BY stats_user_name"; |
70 | 70 | $res = $dbr->query($sql); |
71 | 71 | $out = ""; |
72 | 72 | while ($row = $dbr->fetchObject( $res ) ) { |