Changeset 7836
- Timestamp:
- 02/06/07 15:52:12 (18 months ago)
- Location:
- wp-polls/trunk
- Files:
-
- 6 modified
-
polls/polls-admin-ajax.php (modified) (1 diff)
-
polls/polls-admin-js.php (modified) (3 diffs)
-
polls/polls-js.php (modified) (9 diffs)
-
polls/polls-manager.php (modified) (14 diffs)
-
polls/polls.php (modified) (1 diff)
-
readme.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-polls/trunk/polls/polls-admin-ajax.php
r7835 r7836 56 56 } 57 57 break; 58 // Add Poll's Answer 59 case __('Add Answer', 'wp-polls'): 60 $polla_qid = intval($_POST['polla_qid']); 61 $polla_answers = addslashes(trim($_POST['polla_answers'])); 62 $pollq_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $pollq_id"); 63 $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answers', 0)"); 64 if(!$add_poll_question) { 65 echo '<p style="color: red;">'.sprintf(__('Error In Adding Poll Answer \'%s\' To \'%s\'', 'wp-polls'), stripslashes($polla_answers), stripslashes($pollq_question)).'</p>'; 58 // Delete Poll's Answer 59 case __('Delete Poll Answer', 'wp-polls'): 60 $pollq_id = intval($_POST['pollq_id']); 61 $polla_aid = intval($_POST['polla_aid']); 62 $poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id"); 63 $polla_votes = intval($poll_answers->polla_votes); 64 $polla_answers = stripslashes(trim($poll_answers->polla_answers)); 65 $delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id"); 66 $delete_pollip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id AND pollip_aid = $polla_aid"); 67 $update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id = $pollq_id"); 68 if($delete_polla_answers) { 69 echo '<p style="color: green;">'.sprintf(__('Poll Answer \'%s\' Deleted Successfully.', 'wp-polls'), $polla_answers).'</p>'; 66 70 } else { 67 echo '<p style="color: green;">'.sprintf(__('Poll Answer \'%s\' Added Successfully To \'%s\'', 'wp-polls'), stripslashes($polla_answers), stripslashes($pollq_question)).'</p>';71 echo '<p style="color: red;">'.sprintf(__('Error In Deleting Poll Answer \'%s\'.', 'wp-polls'), $polla_answers).'</p>'; 68 72 } 69 73 break; -
wp-polls/trunk/polls/polls-admin-js.php
r7835 r7836 32 32 var polls_admin = new sack(polls_admin_ajax_url); 33 33 var global_poll_id = 0; 34 34 var global_poll_aid = 0; 35 35 36 36 // Function: Delete Poll Message … … 62 62 } 63 63 64 65 64 // Function: Delete Poll Logs Message 66 65 function delete_poll_logs_message() { 67 66 document.getElementById('message').style.display = "block"; 68 67 Fat.fade_element("message", null, 3000, "#FFFF00"); 69 alert("<?php _e('Polls logs processed. Please see the top of this page for the outcome.', 'wp-polls'); ?>");68 document.getElementById("poll_logs").innerHTML = "<?php _e('No poll logs available.', 'wp-polls'); ?>"; 70 69 } 71 70 … … 87 86 } 88 87 } 88 89 // Function: Delete Individual Poll Logs Message 90 function delete_this_poll_logs_message() { 91 document.getElementById('message').style.display = "block"; 92 Fat.fade_element("message", null, 3000, "#FFFF00"); 93 document.getElementById("poll_logs").innerHTML = "<?php _e('No poll logs available for this poll.', 'wp-polls'); ?>"; 94 } 95 96 // Function: Delete Individual Poll Logs 97 function delete_this_poll_logs(poll_id, poll_confirm) { 98 delete_poll_logs_confirm = confirm(poll_confirm); 99 if(delete_poll_logs_confirm) { 100 if(document.getElementById("delete_logs_yes").checked == true) { 101 global_poll_id = poll_id; 102 polls_admin.reset(); 103 polls_admin.setVar("do", "<?php _e('Delete Logs For This Poll Only', 'wp-polls'); ?>"); 104 polls_admin.setVar("delete_logs_yes", "yes"); 105 polls_admin.setVar("pollq_id", poll_id); 106 polls_admin.method = 'POST'; 107 polls_admin.element = 'message'; 108 polls_admin.onCompletion = delete_this_poll_logs_message; 109 polls_admin.runAJAX(); 110 } else { 111 alert("<?php _e('Please check the \'Yes\' checkbox if you want to delete all logs for this poll ONLY.', 'wp-polls'); ?>"); 112 } 113 } 114 } 115 116 // Function: Delete Poll Answer Message 117 function delete_poll_ans_message() { 118 document.getElementById('message').style.display = "block"; 119 Fat.fade_element("message", null, 3000, "#FFFF00"); 120 Fat.fade_element("poll-answer-" + global_poll_aid, null, 1000, "#FF3333"); 121 setTimeout("remove_poll_ans()", 1000); 122 poll_total_votes = parseInt(document.getElementById('pollq_totalvotes').value); 123 poll_answer_vote = parseInt(document.getElementById("polla_votes-" + global_poll_aid).value); 124 poll_total_votes_new = (poll_total_votes - poll_answer_vote); 125 if(poll_total_votes_new < 0) { 126 poll_total_votes_new = 0; 127 } 128 document.getElementById('pollq_totalvotes').value = parseInt(poll_total_votes_new); 129 } 130 131 // Function: Remove Poll From Manage Poll 132 function remove_poll_ans() { 133 document.getElementById("poll_answers").removeChild(document.getElementById("poll-answer-" + global_poll_aid)); 134 } 135 136 // Function: Delete Poll Answer 137 function delete_poll_ans(poll_id, poll_aid, poll_confirm) { 138 delete_poll_ans_confirm = confirm(poll_confirm); 139 if(delete_poll_ans_confirm) { 140 global_poll_id = poll_id; 141 global_poll_aid = poll_aid; 142 polls_admin.reset(); 143 polls_admin.setVar("do", "<?php _e('Delete Poll Answer', 'wp-polls'); ?>"); 144 polls_admin.setVar("pollq_id", poll_id); 145 polls_admin.setVar("polla_aid", poll_aid); 146 polls_admin.method = 'POST'; 147 polls_admin.element = 'message'; 148 polls_admin.onCompletion = delete_poll_ans_message; 149 polls_admin.runAJAX(); 150 } 151 } 152 153 // Function: Open Poll Message 154 function opening_poll_message() { 155 document.getElementById('message').style.display = "block"; 156 Fat.fade_element("message", null, 3000, "#FFFF00"); 157 document.getElementById("open_poll").style.display = "none"; 158 document.getElementById("close_poll").style.display = "inline"; 159 } 160 161 // Function: Open Poll 162 function opening_poll(poll_id, poll_confirm) { 163 open_poll_confirm = confirm(poll_confirm); 164 if(open_poll_confirm) { 165 global_poll_id = poll_id; 166 polls_admin.reset(); 167 polls_admin.setVar("do", "<?php _e('Open Poll', 'wp-polls'); ?>"); 168 polls_admin.setVar("pollq_id", poll_id); 169 polls_admin.method = 'POST'; 170 polls_admin.element = 'message'; 171 polls_admin.onCompletion = opening_poll_message; 172 polls_admin.runAJAX(); 173 } 174 } 175 176 // Function: Close Poll Message 177 function closing_poll_message() { 178 document.getElementById('message').style.display = "block"; 179 Fat.fade_element("message", null, 3000, "#FFFF00"); 180 document.getElementById("open_poll").style.display = "inline"; 181 document.getElementById("close_poll").style.display = "none"; 182 } 183 184 // Function: Close Poll 185 function closing_poll(poll_id, poll_confirm) { 186 close_poll_confirm = confirm(poll_confirm); 187 if(close_poll_confirm) { 188 global_poll_id = poll_id; 189 polls_admin.reset(); 190 polls_admin.setVar("do", "<?php _e('Close Poll', 'wp-polls'); ?>"); 191 polls_admin.setVar("pollq_id", poll_id); 192 polls_admin.method = 'POST'; 193 polls_admin.element = 'message'; 194 polls_admin.onCompletion = closing_poll_message; 195 polls_admin.runAJAX(); 196 } 197 } -
wp-polls/trunk/polls/polls-js.php
r7835 r7836 48 48 var is_being_voted = false; 49 49 50 51 // When User Vote For Poll 50 // Function: When User Vote For Poll 52 51 function poll_vote(current_poll_id) { 53 52 if(!is_being_voted) { … … 78 77 } 79 78 80 81 // When User View Poll's Result 79 // Function: When User View Poll's Result 82 80 function poll_result(current_poll_id) { 83 81 if(!is_being_voted) { … … 91 89 } 92 90 93 94 // When User View Poll's Voting Booth 91 // Function: When User View Poll's Voting Booth 95 92 function poll_booth(current_poll_id) { 96 93 if(!is_being_voted) { … … 104 101 } 105 102 106 107 // Poll Fade In Text 103 // Function: Poll Fade In Text 108 104 function poll_fadein_text() { 109 105 if(poll_fadein_opacity == 90) { … … 137 133 } 138 134 139 140 // Poll Loading Text 135 // Function: Poll Loading Text 141 136 function poll_loading_text() { 142 137 if(poll_show_loading) { … … 145 140 } 146 141 147 148 // Poll Finish Loading Text 142 // Function: Poll Finish Loading Text 149 143 function poll_unloading_text() { 150 144 if(poll_show_loading) { … … 153 147 } 154 148 155 156 // Process The Poll 149 // Function: Process The Poll 157 150 function poll_process() { 158 151 if(poll_fadeout_opacity > 0) { … … 189 182 } 190 183 191 192 // Process Poll's Result 184 // Function: Process Poll's Result 193 185 function poll_process_result() { 194 186 if(poll_fadeout_opacity > 0) { … … 223 215 } 224 216 225 226 // Process Poll's Voting Booth 217 // Function: Process Poll's Voting Booth 227 218 function poll_process_booth() { 228 219 if(poll_fadeout_opacity > 0) { -
wp-polls/trunk/polls/polls-manager.php
r7835 r7836 101 101 if(!$edit_poll_answer) { 102 102 $text .= '<p style="color: blue">'.sprintf(__('No Changes Had Been Made To Poll\'s Answer \'%s\'.', 'wp-polls'), stripslashes($polla_answers)).'</p>'; 103 } else { 104 $text .= '<p style="color: green">'.sprintf(__('Poll\'s Answer \'%s\' Edited Successfully.', 'wp-polls'), stripslashes($polla_answers)).'</p>'; 103 105 } 104 106 } … … 109 111 $polla_answers_new = $_POST['polla_answers_new']; 110 112 if(!empty($polla_answers_new)) { 113 $i = 0; 114 $polla_answers_new_votes = $_POST['polla_answers_new_votes']; 111 115 foreach($polla_answers_new as $polla_answer_new) { 112 116 $polla_answer_new = addslashes(trim($polla_answer_new)); 113 117 if(!empty($polla_answer_new)) { 114 $add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $pollq_id, '$polla_answer_new', 0)"); 118 $polla_answer_new_vote = intval($polla_answers_new_votes[$i]); 119 $add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $pollq_id, '$polla_answer_new', $polla_answer_new_vote)"); 115 120 if(!$add_poll_answers) { 116 121 $text .= '<p style="color: red;">'.sprintf(__('Error In Adding Poll\'s Answer \'%s\'.', 'wp-polls'), stripslashes($polla_answer_new)).'</p>'; … … 119 124 } 120 125 } 126 $i++; 121 127 } 122 128 } … … 147 153 <script type="text/javascript"> 148 154 /* <![CDATA[*/ 155 var total_votes = 0; 156 var total_new_votes = 0; 149 157 function check_totalvotes() { 150 var total_votes = 0;151 158 var temp_vote = 0; 159 total_votes = 0; 152 160 <?php 153 161 foreach($poll_answers as $poll_answer) { 154 162 $polla_aid = intval($poll_answer->polla_aid); 155 echo "\t\t\t\ttemp_vote = parseInt(document.getElementById('polla_votes-$polla_aid').value);\n"; 156 echo "\t\t\t\tif(isNaN(temp_vote)) {\n"; 157 echo "\t\t\t\tdocument.getElementById('polla_votes-$polla_aid').value = 0;\n"; 158 echo "\t\t\t\ttemp_vote = 0;\n"; 163 echo "\t\t\t\tif(document.getElementById('polla_votes-$polla_aid')) {\n"; 164 echo "\t\t\t\t\ttemp_vote = parseInt(document.getElementById('polla_votes-$polla_aid').value);\n"; 165 echo "\t\t\t\t\tif(isNaN(temp_vote)) {\n"; 166 echo "\t\t\t\t\t\tdocument.getElementById('polla_votes-$polla_aid').value = 0;\n"; 167 echo "\t\t\t\t\t\ttemp_vote = 0;\n"; 168 echo "\t\t\t\t\t}\n"; 169 echo "\t\t\t\t\ttotal_votes += temp_vote;\n"; 159 170 echo "\t\t\t\t}\n"; 160 echo "\t\t\t\ttotal_votes += temp_vote;\n";161 171 } 162 172 ?> 163 document.getElementById('pollq_totalvotes').value = parseInt(total_votes); 173 totalvotes(); 174 } 175 function check_totalvotes_new() { 176 var new_votes = document.getElementsByName("polla_answers_new_votes[]"); 177 var temp_new_vote = 0; 178 total_new_votes = 0; 179 for(i = 0; i < new_votes.length; i++) { 180 temp_new_vote = parseInt(new_votes[i].value); 181 if(isNaN(temp_new_vote)) { 182 temp_new_vote = 0; 183 } 184 total_new_votes += temp_new_vote; 185 } 186 totalvotes(); 187 } 188 function totalvotes() { 189 document.getElementById('pollq_totalvotes').value = (parseInt(total_votes) + parseInt(total_new_votes)); 164 190 } 165 191 function check_polltimestamp() { … … 199 225 poll_answer.setAttribute('size', "50"); 200 226 poll_votes.setAttribute('type', "text"); 227 poll_votes.setAttribute('name', "polla_answers_new_votes[]") 201 228 poll_votes.setAttribute('size', "4"); 202 229 poll_votes.setAttribute('value', "0"); 230 poll_votes.setAttribute('onblur', "check_totalvotes_new();"); 203 231 // Elements - TD/TR 204 232 if(count_poll_answer%2 != 0) { poll_tr.style.background = "#eee"; } … … 227 255 count_poll_answer--; 228 256 count_poll_answer_new--; 257 check_totalvotes_new(); 229 258 } 230 259 } 231 260 /* ]]> */ 232 261 </script> 233 <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.stripslashes($text).'</p></div>'; } ?> 262 <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.stripslashes($text).'</p></div>'; } else { echo '<div id="message" class="updated" style="display: none;"></div>'; } ?> 263 234 264 <!-- Edit Poll --> 235 265 <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post"> … … 249 279 <h3><?php _e('Poll Answers', 'wp-polls'); ?></h3> 250 280 <table width="100%" border="0" cellspacing="3" cellpadding="3"> 251 <t body id="poll_answers">281 <thead> 252 282 <tr class="thead"> 253 283 <td width="20%"><strong><?php _e('Answer No.:', 'wp-polls') ?></strong></td> 254 <td width="60%"><strong><?php _e('Answer text:', 'wp-polls') ?></strong></td>284 <td width="60%"><strong><?php _e('Answer Text:', 'wp-polls') ?></strong></td> 255 285 <td width="20%" align="right"><strong><?php _e('No. Of Votes', 'wp-polls') ?></strong></td> 256 286 </tr> 287 </thead> 288 <tbody id="poll_answers"> 257 289 <?php 258 290 $i=1; … … 274 306 echo '<td width="20%"><strong>'.sprintf(__('Answer %s:', 'wp-polls'), $i).'</strong></td>'."\n"; 275 307 echo "<td width=\"60%\"><input type=\"text\" size=\"50\" maxlength=\"200\" name=\"polla_aid-$polla_aid\" value=\"".htmlspecialchars($polla_answers)."\" /> "; 276 echo "< a href=\"$base_page&mode=deleteans&id=$poll_id&aid=$polla_aid\" onclick=\"return confirm('".__('You Are About To Delete This Poll Answer:', 'wp-polls')." \'".addslashes(strip_tags($polla_answers))."\'\\n\\n".__('This Action Is Not Reversible. Are you sure?', 'wp-polls')."')\">".__('Delete')."</a></td>\n";308 echo "<input type=\"button\" value=\"".__('Delete', 'wp-polls')."\" onclick=\"delete_poll_ans($poll_id, $polla_aid, '".sprintf(js_escape(__('You are about to delete this poll\'s answer \'%s\'.', 'wp-polls')), htmlspecialchars($polla_answers))."');\" class=\"button\" /></td>\n"; 277 309 echo "<td width=\"20%\" align=\"right\">$polla_votes <input type=\"text\" size=\"4\" id=\"polla_votes-$polla_aid\" name=\"polla_votes-$polla_aid\" value=\"$polla_votes\" onblur=\"check_totalvotes();\" /></td>\n</tr>\n"; 278 310 $poll_actual_totalvotes += $polla_votes; … … 281 313 } 282 314 ?> 283 </tbody> 284 <tr> 285 <td width="20%"></td> 286 <td width="60%"><input type="button" value="<?php _e('Add Answer', 'wp-polls') ?>" onclick="create_poll_answer();" class="button" /> <input type="button" value="<?php _e('Remove Answer', 'wp-polls') ?>" onclick="remove_poll_answer();" class="button" /></td> 287 <td width="20%" align="right"><strong><?php printf(__('Total Votes: %s', 'wp-polls'), $poll_actual_totalvotes); ?></strong> <input type="text" size="4" readonly="true" id="pollq_totalvotes" name="pollq_totalvotes" value="<?php echo $poll_actual_totalvotes; ?>" onblur="check_totalvotes();" /></td> 288 </tr> 315 </tbody> 316 <tfoot> 317 <tr> 318 <td width="20%"></td> 319 <td width="60%"><input type="button" value="<?php _e('Add Answer', 'wp-polls') ?>" onclick="create_poll_answer();" class="button" /> <input type="button" value="<?php _e('Remove Answer', 'wp-polls') ?>" onclick="remove_poll_answer();" class="button" /></td> 320 <td width="20%" align="right"><strong><?php printf(__('Total Votes: %s', 'wp-polls'), $poll_actual_totalvotes); ?></strong> <input type="text" size="4" readonly="true" id="pollq_totalvotes" name="pollq_totalvotes" value="<?php echo $poll_actual_totalvotes; ?>" onblur="check_totalvotes();" /></td> 321 </tr> 322 </tfoot> 289 323 </table> 290 324 <!-- Poll Start/End Date --> … … 326 360 <p style="text-align: center;"> 327 361 <input type="submit" name="do" value="<?php _e('Edit Poll', 'wp-polls'); ?>" class="button" /> 328 <?php if($poll_active == 1) { ?> 329 <input type="submit" class="button" name="do" value="<?php _e('Close Poll', 'wp-polls'); ?>" alt="test" onclick="return confirm('<?php _e('You Are About To Close This Poll', 'wp-polls'); ?>.')" /> 330 <?php } else { ?> 331 <input type="submit" class="button" name="do" value="<?php _e('Open Poll', 'wp-polls'); ?>" onclick="return confirm('<?php _e('You Are About To Open This Poll', 'wp-polls'); ?>.')" /> 332 <?php } ?> 362 <?php 363 if($poll_active == 1) { 364 $poll_open_display = 'none'; 365 $poll_close_display = 'inline'; 366 } else { 367 $poll_open_display = 'inline'; 368 $poll_close_display = 'none'; 369 } 370 ?> 371 <input type="button" class="button" name="do" id="close_poll" value="<?php _e('Close Poll', 'wp-polls'); ?>" onclick="closing_poll(<?php echo $poll_id; ?>, '<?php printf(js_escape(__('You are about to CLOSE this poll \'%s\'.', 'wp-polls')), htmlspecialchars($poll_question_text)); ?>');" style="display: <?php echo $poll_close_display; ?>;" /> 372 <input type="button" class="button" name="do" id="open_poll" value="<?php _e('Open Poll', 'wp-polls'); ?>" onclick="opening_poll(<?php echo $poll_id; ?>, '<?php printf(js_escape(__('You are about to OPEN this poll \'%s\'.', 'wp-polls')), htmlspecialchars($poll_question_text)); ?>');" style="display: <?php echo $poll_open_display; ?>;" /> 333 373 <input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" /> 334 374 </p> … … 382 422 } 383 423 } else { 384 echo "<tr>\n<td colspan=\"4\" align=\"center\">".__('No IP Has Been Logged Yet.', 'wp-polls')."</td>\n</tr>\n";424 echo "<tr>\n<td colspan=\"4\" align=\"center\">".__('No poll logs available for this poll.', 'wp-polls')."</td>\n</tr>\n"; 385 425 } 386 426 ?> … … 390 430 <div class="wrap"> 391 431 <h2><?php _e('Poll Logs', 'wp-polls'); ?></h2> 392 <div align="center"> 393 <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post"> 394 <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>" /> 432 <div align="center" id="poll_logs"> 433 <?php if($poll_ips) { ?> 395 434 <strong><?php _e('Are You Sure You Want To Delete Logs For This Poll Only?', 'wp-polls'); ?></strong><br /><br /> 396 <input type="checkbox" name="delete_logs_yes" value="yes" /> <?php _e('Yes', 'wp-polls'); ?><br /><br /> 397 <input type="submit" name="do" value="<?php _e('Delete Logs For This Poll Only', 'wp-polls'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Delete Logs For This Poll Only.', 'wp-polls'); ?>\n\n<?php _e('This Action Is Not Reversible. Are you sure?', 'wp-polls'); ?>')" /> 398 </form> 435 <input type="checkbox" id="delete_logs_yes" name="delete_logs_yes" value="yes" /> <?php _e('Yes', 'wp-polls'); ?><br /><br /> 436 <input type="button" name="do" value="<?php _e('Delete Logs For This Poll Only', 'wp-polls'); ?>" class="button" onclick="delete_this_poll_logs(<?php echo $poll_id; ?>, '<?php printf(js_escape(__('You are about to delete poll logs for this poll \'%s\' ONLY. This action is not reversible.', 'wp-polls')), htmlspecialchars($poll_question_text)); ?>');" /> 437 <?php 438 } else { 439 _e('No poll logs available for this poll.', 'wp-polls'); 440 } 441 ?> 399 442 </div> 400 443 <p><?php _e('Note: If your logging method is by IP and Cookie or by Cookie, users may still be unable to vote if they have voted before as the cookie is still stored in their computer.', 'wp-polls'); ?></p> 401 </div>402 <?php403 break;404 // Delete A Poll Answer405 case 'deleteans':406 $poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");407 $polla_votes = intval($poll_answers->polla_votes);408 $polla_answers = stripslashes(trim($poll_answers->polla_answers));409 $delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");410 $delete_pollip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_aid = $poll_aid");411 $update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id=$poll_id");412 ?>413 <!-- Delete Poll's Answer -->414 <div class="wrap">415 <h2><?php _e('Delete Poll\'s Answer', 'wp-polls') ?></h2>416 <?php417 if($delete_polla_answers) {418 echo "<font color=\"green\">".__('Poll Answer', 'wp-polls')." '$polla_answers' ".__('Deleted Successfully', 'wp-polls')."</font>";419 } else {420 echo "<font color=\"red\">".__('Error In Deleting Poll Answer', 'wp-polls')." '$polla_answers'</font>";421 }422 if($update_pollq_totalvotes) {423 echo "<br /><font color=\"green\">".__('Poll Question\'s Total Votes Updated Successfully', 'wp-polls')."</font>";424 } else {425 echo "<br /><font color=\"blue\">".__('No Changes Have Been Made To The Poll\'s Total Votes', 'wp-polls')."</font>";426 }427 if($delete_pollip) {428 echo "<br /><font color=\"green\">".__('Poll IP Logs Updated Successfully', 'wp-polls')."</font>";429 } else {430 echo "<br /><font color=\"blue\">".__('No Changes Have Been Made To The Poll IP Logs', 'wp-polls')."</font>";431 }432 ?>433 <p><strong><a href="<?php echo $base_page; ?>&mode=edit&id=<?php echo $poll_id; ?>"><?php _e('Click here To Go Back To The Poll Edit Page', 'wp-polls'); ?></a>.</strong></p>434 444 </div> 435 445 <?php … … 515 525 echo "</td>\n"; 516 526 echo "<td><a href=\"$base_page&mode=edit&id=$poll_id\" class=\"edit\">".__('Edit')."</a></td>\n"; 517 echo "<td><a href=\"#DeletePoll\" onclick=\"delete_poll($poll_id, '".sprintf(js_escape(__('You are about to delete this poll, %s.', 'wp-polls')), $poll_question)."')\" class=\"delete\">".__('Delete')."</a></td>\n";527 echo "<td><a href=\"#DeletePoll\" onclick=\"delete_poll($poll_id, '".sprintf(js_escape(__('You are about to delete this poll, \'%s\'.', 'wp-polls')), $poll_question)."')\" class=\"delete\">".__('Delete')."</a></td>\n"; 518 528 echo '</tr>'; 519 529 $i++; … … 549 559 <div class="wrap"> 550 560 <h2><?php _e('Polls Logs', 'wp-polls'); ?></h2> 551 <div align="center"> 561 <div align="center" id="poll_logs"> 562 <?php 563 $poll_ips = intval($wpdb->get_var("SELECT COUNT(pollip_id) FROM $wpdb->pollsip")); 564 if($poll_ips > 0) { 565 ?> 552 566 <strong><?php _e('Are You Sure You Want To Delete All Polls Logs?', 'wp-polls'); ?></strong><br /><br /> 553 567 <input type="checkbox" name="delete_logs_yes" id="delete_logs_yes" value="yes" /> <?php _e('Yes', 'wp-polls'); ?><br /><br /> 554 568 <input type="button" value="<?php _e('Delete All Logs', 'wp-polls'); ?>" class="button" onclick="delete_poll_logs('<?php echo js_escape(__('You are about to delete all poll logs. This action is not reversible.', 'wp-polls')); ?>');" /> 569 <?php 570 } else { 571 _e('No poll logs available.', 'wp-polls'); 572 } 573 ?> 555 574 </div> 556 575 <p style="text-align: left;"><?php _e('Note:<br />If your logging method is by IP and Cookie or by Cookie, users may still be unable to vote if they have voted before as the cookie is still stored in their computer.', 'wp-polls'); ?></p> -
wp-polls/trunk/polls/polls.php
r7835 r7836 1029 1029 $pollip_userid = intval($user_ID); 1030 1030 $pollip_ip = get_ipaddress(); 1031 $pollip_host = gethostbyaddr($pollip_ip);1031 $pollip_host = @gethostbyaddr($pollip_ip); 1032 1032 $pollip_timestamp = current_time('timestamp'); 1033 1033 // Only Create Cookie If User Choose Logging Method 1 Or 2
