Index: trunk/extensions/Poll/archives/patch-user.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- (c) Jan Luca, 2009, CC by-sa 3.0 or later |
| 3 | +-- Table structure for table `Poll` |
| 4 | +-- Replace /*$wgDBprefix*/ with the proper prefix |
| 5 | + |
| 6 | +ALTER TABLE /*$wgDBprefix*/poll_answer |
| 7 | +ADD `user` VARCHAR( 255 ) NOT NULL ; |
\ No newline at end of file |
Property changes on: trunk/extensions/Poll/archives/patch-user.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 8 | + native |
Index: trunk/extensions/Poll/Poll_body.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | $action = htmlentities( $wgRequest->getText( 'action' ) ); |
26 | 26 | $id = htmlentities( $wgRequest->getText( 'id' ) ); |
27 | 27 | |
28 | | - if ( $action == "" OR $action="list" ) { |
| 28 | + if ( $action == "" OR $action == "list" ) { |
29 | 29 | $this->make_list(); |
30 | 30 | } |
31 | 31 | |
— | — | @@ -72,9 +72,11 @@ |
73 | 73 | $controll_create_blocked = $wgUser->isBlocked(); |
74 | 74 | if ( $controll_create_right != true ) { |
75 | 75 | $wgOut->addWikiMsg( 'poll-create-right-error' ); |
| 76 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
76 | 77 | } |
77 | 78 | elseif ( $controll_create_blocked == true ) { |
78 | 79 | $wgOut->addWikiMsg( 'poll-create-block-error' ); |
| 80 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
79 | 81 | } |
80 | 82 | else { |
81 | 83 | $wgOut->addHtml( Xml::openElement( 'form', array('method'=> 'post', 'action' => $wgTitle->getFullURL('action=submit') ) ) ); |
— | — | @@ -102,9 +104,11 @@ |
103 | 105 | $controll_vote_blocked = $wgUser->isBlocked(); |
104 | 106 | if ( $controll_vote_right != true ) { |
105 | 107 | $wgOut->addWikiMsg( 'poll-vote-right-error' ); |
| 108 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
106 | 109 | } |
107 | 110 | elseif ( $controll_vote_blocked == true ) { |
108 | 111 | $wgOut->addWikiMsg( 'poll-vote-block-error' ); |
| 112 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
109 | 113 | } |
110 | 114 | else { |
111 | 115 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -136,7 +140,7 @@ |
137 | 141 | } |
138 | 142 | |
139 | 143 | public function submit( $pid ) { |
140 | | - global $wgRequest, $wgOut, $wgUser; |
| 144 | + global $wgRequest, $wgOut, $wgUser, $wgTitle; |
141 | 145 | |
142 | 146 | $type = $_POST['type']; |
143 | 147 | |
— | — | @@ -145,9 +149,11 @@ |
146 | 150 | $controll_create_blocked = $wgUser->isBlocked(); |
147 | 151 | if ( $controll_create_right != true ) { |
148 | 152 | $wgOut->addWikiMsg( 'poll-create-right-error' ); |
| 153 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
149 | 154 | } |
150 | 155 | elseif ( $controll_create_blocked == true ) { |
151 | 156 | $wgOut->addWikiMsg( 'poll-create-block-error' ); |
| 157 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
152 | 158 | } |
153 | 159 | |
154 | 160 | else { |
— | — | @@ -172,6 +178,7 @@ |
173 | 179 | } |
174 | 180 | else { |
175 | 181 | $wgOut->addWikiMsg( 'poll-create-fields-error' ); |
| 182 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
176 | 183 | } |
177 | 184 | } |
178 | 185 | } |
— | — | @@ -181,15 +188,18 @@ |
182 | 189 | $controll_vote_blocked = $wgUser->isBlocked(); |
183 | 190 | if ( $controll_vote_right != true ) { |
184 | 191 | $wgOut->addWikiMsg( 'poll-vote-right-error' ); |
| 192 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
185 | 193 | } |
186 | 194 | elseif ( $controll_vote_blocked == true ) { |
187 | 195 | $wgOut->addWikiMsg( 'poll-vote-block-error' ); |
| 196 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
188 | 197 | } |
189 | 198 | |
190 | 199 | else { |
191 | 200 | $dbw = wfGetDB( DB_MASTER ); |
192 | 201 | $dbr = wfGetDB( DB_SLAVE ); |
193 | 202 | $vote = $_POST['vote']; |
| 203 | + $user = $wgUser->getName(); |
194 | 204 | $uid = $wgUser->getId(); |
195 | 205 | |
196 | 206 | $query = $dbr->select( 'poll_answer', 'uid', 'uid = ' . $uid); |
— | — | @@ -202,13 +212,14 @@ |
203 | 213 | } |
204 | 214 | |
205 | 215 | if( $num == 0 ) { |
206 | | - $dbw->insert( 'poll_answer', array( 'pid' => $pid, 'uid' => $uid, 'vote' => $vote ) ); |
| 216 | + $dbw->insert( 'poll_answer', array( 'pid' => $pid, 'uid' => $uid, 'vote' => $vote, 'user' => $user ) ); |
207 | 217 | |
208 | 218 | $wgOut->addWikiMsg( 'poll-vote-pass' ); |
209 | 219 | $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
210 | 220 | } |
211 | 221 | else { |
212 | 222 | $wgOut->addWikiMsg( 'poll-vote-already-error' ); |
| 223 | + $wgOut->addHtml( '<a href="'.$wgTitle->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' ); |
213 | 224 | } |
214 | 225 | } |
215 | 226 | } |
Index: trunk/extensions/Poll/Poll.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | $wgExtNewFields[] = array( 'poll', 'creater', "$base/archives/patch-creater.sql" ); // Add creater |
69 | 69 | $wgExtNewFields[] = array( 'poll', 'dis', "$base/archives/patch-dis.sql" ); // Add dis |
70 | 70 | $wgExtNewTables[] = array( 'poll_answer', "$base/archives/Poll-answer.sql" ); // Initial answer tables |
| 71 | + $wgExtNewFields[] = array( 'poll_answer', 'user', "$base/archives/patch-user.sql" ); // Add dis |
71 | 72 | } |
72 | 73 | return true; |
73 | 74 | } |