Index: trunk/extensions/SocialProfile/UserStatus/UserStatus_AjaxFunctions.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | $us_class->setStatus( $u_id, $status ); |
11 | 11 | $user_status_array = $us_class->getStatus( $u_id ); |
12 | 12 | $buf = $user_status_array['us_status']; |
13 | | - $us = $buf; |
| 13 | + $us = str_replace("@q;","'",$buf); |
14 | 14 | $us .= "<br> <a id=\"us-link\" href=\"javascript:UserStatus.toEditMode('$buf','$u_id');\">".wfMsg('userstatus-edit')."</a>"; |
15 | 15 | return $us; |
16 | 16 | } |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | $output .= '<tr><td width="60" id="status-history-time">'.date_format($time, 'j M G:i').' </td>'; |
28 | 28 | $output .= '<td width="360"><a href="javascript:UserStatus.fromHistoryToStatus(\''.$row['ush_status'].'\');">' |
29 | | - .$row['ush_status'].'</a></td>'; |
| 29 | + .str_replace("@q;","'",$row['ush_status']).'</a></td>'; |
30 | 30 | //$output .='<td width="20" id="like-status"> <a href="javascript:UserStatus.likeIt('.$row['ush_id'].')" title="I like it!" >♥</a> '.$row['ush_likes'].'</td></tr>'; |
31 | 31 | } |
32 | 32 | $output.='</table>'; |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.js |
— | — | @@ -2,8 +2,11 @@ |
3 | 3 | maxStatusLength : 70, |
4 | 4 | |
5 | 5 | toShowMode: function( status, id ) { |
6 | | - document.getElementById( 'user-status-block' ).innerHTML = status; |
7 | | - document.getElementById( 'user-status-block' ).innerHTML += '<br> <a id="us-link" href="javascript:UserStatus.toEditMode(\'' + status + '\',' + id + ');">'+_US_EDIT+'</a>'; |
| 6 | + var str = this.returnJS(status); |
| 7 | + document.getElementById( 'user-status-block' ).innerHTML = str; |
| 8 | + document.getElementById( 'user-status-block' ).innerHTML += '<br> \n\ |
| 9 | + <a id="us-link" href="javascript:UserStatus.toEditMode(\'' + |
| 10 | + status + '\',' + id + ');">'+_US_EDIT+'</a>'; |
8 | 11 | }, |
9 | 12 | |
10 | 13 | usLettersLeft: function() { |
— | — | @@ -22,7 +25,7 @@ |
23 | 26 | |
24 | 27 | toEditMode: function( status, id ) { |
25 | 28 | var editbar = '<input id="user-status-input" type="text" size="50" value="' + |
26 | | - status + '" onkeyup="javascript:UserStatus.usLettersLeft();">'; |
| 29 | + this.returnJS(status) + '" onkeyup="javascript:UserStatus.usLettersLeft();">'; |
27 | 30 | editbar += '<br> <div id="status-bar">'; |
28 | 31 | editbar += '<a id="us-link" href="javascript:UserStatus.saveStatus(' + id + ');">'+_US_SAVE+'</a>'; |
29 | 32 | editbar += ' <a id="us-link" href="javascript:UserStatus.useHistory(' + id + ');">'+_US_HISTORY+'</a>'; |
— | — | @@ -30,11 +33,25 @@ |
31 | 34 | editbar += '<span id="status-letter-count"></span></div>'; |
32 | 35 | document.getElementById( 'user-status-block' ).innerHTML = editbar; |
33 | 36 | }, |
34 | | - |
| 37 | + |
| 38 | + parseJS:function ( str ) { |
| 39 | + var patt=/'/g; |
| 40 | + var s = str.replace(patt, "@q;"); |
| 41 | + return s; |
| 42 | + }, |
| 43 | + |
| 44 | + returnJS:function ( str ) { |
| 45 | + |
| 46 | + var pt= /@q;/gi; |
| 47 | + var s = str.replace(pt, "'"); |
| 48 | + return s; |
| 49 | + }, |
| 50 | + |
35 | 51 | saveStatus: function( id ) { |
36 | 52 | var div = document.getElementById( 'user-status-block' ); |
37 | 53 | var ustext = document.getElementById( 'user-status-input' ).value; |
38 | | - sajax_do_call( 'wfSaveStatus', [id, ustext], div ); |
| 54 | + var ust = this.parseJS(ustext); |
| 55 | + sajax_do_call( 'wfSaveStatus', [id, ust], div ); |
39 | 56 | }, |
40 | 57 | |
41 | 58 | useHistory: function( id ){ |
— | — | @@ -55,7 +72,7 @@ |
56 | 73 | }, |
57 | 74 | |
58 | 75 | fromHistoryToStatus: function( str ) { |
59 | | - document.getElementById('user-status-input').value = str; |
| 76 | + document.getElementById('user-status-input').value = this.returnJS(str); |
60 | 77 | }, |
61 | 78 | |
62 | 79 | specialGetHistory: function() { |
— | — | @@ -66,13 +83,13 @@ |
67 | 84 | |
68 | 85 | specialHistoryDelete: function(id) { |
69 | 86 | var block = document.getElementById("us-special"); |
70 | | - sajax_do_call( 'SpecialHistoryDelete', [id], block ); |
71 | | - this.specialGetHistory(); |
| 87 | + sajax_do_call( 'SpecialHistoryDelete', [id], block ); |
| 88 | + this.specialGetHistory(); |
72 | 89 | }, |
73 | 90 | |
74 | 91 | specialStatusDelete: function(id) { |
75 | 92 | var block = document.getElementById("us-special"); |
76 | | - sajax_do_call( 'SpecialStatusDelete', [id], block ); |
77 | | - this.specialGetHistory(); |
| 93 | + sajax_do_call( 'SpecialStatusDelete', [id], block ); |
| 94 | + this.specialGetHistory(); |
78 | 95 | } |
79 | 96 | }; |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserStatus/UserStatusClass.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | global $wgOut, $wgScriptPath; |
12 | 12 | $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.css' ); |
13 | 13 | $wgOut->addScriptFile( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.js' ); |
| 14 | + $wgOut->addHTML("<span id=\"temp_var\" style=\"display: none\"></span>"); |
14 | 15 | } |
15 | 16 | |
16 | 17 | public function getStatus( $u_id ) { |
— | — | @@ -52,7 +53,8 @@ |
53 | 54 | */ |
54 | 55 | public function setStatus( $u_id, $message ) { |
55 | 56 | $message = trim($message); |
56 | | - if (( mb_strlen( $message ) > 70 ) || ( mb_strlen( $message ) < 1 )) { |
| 57 | + if (( mb_strlen( $message ) > 90 ) || ( mb_strlen( $message ) < 1 )) { |
| 58 | + // INFO. Letter limit is 70, but here is 90, for special characters. |
57 | 59 | // ERROR. Message length is too long |
58 | 60 | return; |
59 | 61 | } |
— | — | @@ -131,7 +133,7 @@ |
132 | 134 | |
133 | 135 | if ( $mode == 'insert' ) { |
134 | 136 | $currentStatus = $this->getStatus( $u_id ); |
135 | | - |
| 137 | + |
136 | 138 | if ( $i < 4 ) { |
137 | 139 | $dbw->insert( |
138 | 140 | 'user_status_history', |