Version Description
N/A
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Polls |
Version | 2.71 |
Comparing to | |
See all releases |
Code changes from version 2.70 to 2.71
- polls-add.php +2 -2
- polls-logs.php +2 -2
- polls-manager.php +4 -4
- readme.txt +4 -2
- wp-polls.php +19 -20
polls-add.php
CHANGED
@@ -16,7 +16,7 @@ if(!empty($_POST['do'])) {
|
|
16 |
case __('Add Poll', 'wp-polls'):
|
17 |
check_admin_referer('wp-polls_add-poll');
|
18 |
// Poll Question
|
19 |
-
$pollq_question = addslashes(trim($_POST['pollq_question']));
|
20 |
if( ! empty( $pollq_question ) ) {
|
21 |
// Poll Start Date
|
22 |
$timestamp_sql = '';
|
@@ -65,7 +65,7 @@ if(!empty($_POST['do'])) {
|
|
65 |
$polla_answers = $_POST['polla_answers'];
|
66 |
$polla_qid = intval($wpdb->insert_id);
|
67 |
foreach ($polla_answers as $polla_answer) {
|
68 |
-
$polla_answer = addslashes(trim($polla_answer));
|
69 |
if( ! empty( $polla_answer ) ) {
|
70 |
$add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answer', 0)");
|
71 |
if (!$add_poll_answers) {
|
16 |
case __('Add Poll', 'wp-polls'):
|
17 |
check_admin_referer('wp-polls_add-poll');
|
18 |
// Poll Question
|
19 |
+
$pollq_question = addslashes( wp_kses_post( trim( $_POST['pollq_question'] ) ) );
|
20 |
if( ! empty( $pollq_question ) ) {
|
21 |
// Poll Start Date
|
22 |
$timestamp_sql = '';
|
65 |
$polla_answers = $_POST['polla_answers'];
|
66 |
$polla_qid = intval($wpdb->insert_id);
|
67 |
foreach ($polla_answers as $polla_answer) {
|
68 |
+
$polla_answer = addslashes( wp_kses_post( trim( $polla_answer ) ) );
|
69 |
if( ! empty( $polla_answer ) ) {
|
70 |
$add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answer', 0)");
|
71 |
if (!$add_poll_answers) {
|
polls-logs.php
CHANGED
@@ -27,7 +27,7 @@ if(!current_user_can('manage_polls')) {
|
|
27 |
$max_records = 2000;
|
28 |
$pollip_answers = array();
|
29 |
$poll_question_data = $wpdb->get_row("SELECT pollq_multiple, pollq_question, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
|
30 |
-
$poll_question = stripslashes($poll_question_data->pollq_question);
|
31 |
$poll_totalvoters = intval($poll_question_data->pollq_totalvoters);
|
32 |
$poll_multiple = intval($poll_question_data->pollq_multiple);
|
33 |
$poll_registered = $wpdb->get_var("SELECT COUNT(pollip_userid) FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_userid > 0");
|
@@ -381,7 +381,7 @@ if(!empty($_POST['do'])) {
|
|
381 |
<?php if($poll_logs_count) { ?>
|
382 |
<strong><?php _e('Are You Sure You Want To Delete Logs For This Poll Only?', 'wp-polls'); ?></strong><br /><br />
|
383 |
<input type="checkbox" id="delete_logs_yes" name="delete_logs_yes" value="yes" /> <label for="delete_logs_yes"><?php _e('Yes', 'wp-polls'); ?></label><br /><br />
|
384 |
-
<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(esc_js(__('You are about to delete poll logs for this poll \'%s\' ONLY. This action is not reversible.', 'wp-polls')),
|
385 |
<?php
|
386 |
} else {
|
387 |
_e('No poll logs available for this poll.', 'wp-polls');
|
27 |
$max_records = 2000;
|
28 |
$pollip_answers = array();
|
29 |
$poll_question_data = $wpdb->get_row("SELECT pollq_multiple, pollq_question, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
|
30 |
+
$poll_question = wp_kses_post( stripslashes( $poll_question_data->pollq_question ) );
|
31 |
$poll_totalvoters = intval($poll_question_data->pollq_totalvoters);
|
32 |
$poll_multiple = intval($poll_question_data->pollq_multiple);
|
33 |
$poll_registered = $wpdb->get_var("SELECT COUNT(pollip_userid) FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_userid > 0");
|
381 |
<?php if($poll_logs_count) { ?>
|
382 |
<strong><?php _e('Are You Sure You Want To Delete Logs For This Poll Only?', 'wp-polls'); ?></strong><br /><br />
|
383 |
<input type="checkbox" id="delete_logs_yes" name="delete_logs_yes" value="yes" /> <label for="delete_logs_yes"><?php _e('Yes', 'wp-polls'); ?></label><br /><br />
|
384 |
+
<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(esc_js(__('You are about to delete poll logs for this poll \'%s\' ONLY. This action is not reversible.', 'wp-polls')), htmlspecialchars( $poll_question ) ); ?>', '<?php echo wp_create_nonce('wp-polls_delete-poll-logs'); ?>');" />
|
385 |
<?php
|
386 |
} else {
|
387 |
_e('No poll logs available for this poll.', 'wp-polls');
|
polls-manager.php
CHANGED
@@ -42,7 +42,7 @@ if(!empty($_POST['do'])) {
|
|
42 |
// Poll Total Voters
|
43 |
$pollq_totalvoters = intval($_POST['pollq_totalvoters']);
|
44 |
// Poll Question
|
45 |
-
$pollq_question = addslashes(trim($_POST['pollq_question']));
|
46 |
// Poll Active
|
47 |
$pollq_active = intval($_POST['pollq_active']);
|
48 |
// Poll Start Date
|
@@ -103,7 +103,7 @@ if(!empty($_POST['do'])) {
|
|
103 |
$polla_aids[] = intval($get_polla_aid->polla_aid);
|
104 |
}
|
105 |
foreach($polla_aids as $polla_aid) {
|
106 |
-
$polla_answers = addslashes(trim($_POST['polla_aid-'.$polla_aid]));
|
107 |
$polla_votes = intval($_POST['polla_votes-'.$polla_aid]);
|
108 |
$edit_poll_answer = $wpdb->query("UPDATE $wpdb->pollsa SET polla_answers = '$polla_answers', polla_votes = $polla_votes WHERE polla_qid = $pollq_id AND polla_aid = $polla_aid");
|
109 |
if(!$edit_poll_answer) {
|
@@ -121,7 +121,7 @@ if(!empty($_POST['do'])) {
|
|
121 |
$i = 0;
|
122 |
$polla_answers_new_votes = $_POST['polla_answers_new_votes'];
|
123 |
foreach($polla_answers_new as $polla_answer_new) {
|
124 |
-
$polla_answer_new = addslashes(trim($polla_answer_new));
|
125 |
if(!empty($polla_answer_new)) {
|
126 |
$polla_answer_new_vote = intval($polla_answers_new_votes[$i]);
|
127 |
$add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $pollq_id, '$polla_answer_new', $polla_answer_new_vote)");
|
@@ -393,7 +393,7 @@ switch($mode) {
|
|
393 |
} else if(in_array($poll_id, $multiple_polls)) {
|
394 |
echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
|
395 |
}
|
396 |
-
echo
|
397 |
echo '<td>'.number_format_i18n($poll_totalvoters)."</td>\n";
|
398 |
echo "<td>$poll_date</td>\n";
|
399 |
echo "<td>$poll_expiry_text</td>\n";
|
42 |
// Poll Total Voters
|
43 |
$pollq_totalvoters = intval($_POST['pollq_totalvoters']);
|
44 |
// Poll Question
|
45 |
+
$pollq_question = addslashes( wp_kses_post( trim( $_POST['pollq_question'] ) ) );
|
46 |
// Poll Active
|
47 |
$pollq_active = intval($_POST['pollq_active']);
|
48 |
// Poll Start Date
|
103 |
$polla_aids[] = intval($get_polla_aid->polla_aid);
|
104 |
}
|
105 |
foreach($polla_aids as $polla_aid) {
|
106 |
+
$polla_answers = addslashes( wp_kses_post( trim( $_POST['polla_aid-'.$polla_aid] ) ) );
|
107 |
$polla_votes = intval($_POST['polla_votes-'.$polla_aid]);
|
108 |
$edit_poll_answer = $wpdb->query("UPDATE $wpdb->pollsa SET polla_answers = '$polla_answers', polla_votes = $polla_votes WHERE polla_qid = $pollq_id AND polla_aid = $polla_aid");
|
109 |
if(!$edit_poll_answer) {
|
121 |
$i = 0;
|
122 |
$polla_answers_new_votes = $_POST['polla_answers_new_votes'];
|
123 |
foreach($polla_answers_new as $polla_answer_new) {
|
124 |
+
$polla_answer_new = addslashes( wp_kses_post( trim( $polla_answer_new ) ) );
|
125 |
if(!empty($polla_answer_new)) {
|
126 |
$polla_answer_new_vote = intval($polla_answers_new_votes[$i]);
|
127 |
$add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $pollq_id, '$polla_answer_new', $polla_answer_new_vote)");
|
393 |
} else if(in_array($poll_id, $multiple_polls)) {
|
394 |
echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
|
395 |
}
|
396 |
+
echo wp_kses_post( $poll_question )."</td>\n";
|
397 |
echo '<td>'.number_format_i18n($poll_totalvoters)."</td>\n";
|
398 |
echo "<td>$poll_date</td>\n";
|
399 |
echo "<td>$poll_expiry_text</td>\n";
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: GamerZ
|
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
|
10 |
|
@@ -27,6 +27,8 @@ WP-Polls is extremely customizable via templates and css styles and there are to
|
|
27 |
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
|
28 |
|
29 |
== Changelog ==
|
|
|
|
|
30 |
|
31 |
= Version 2.70 =
|
32 |
* NEW: Add wp_polls_vote_poll_success action hook
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 4.4
|
7 |
+
Stable tag: 2.71
|
8 |
|
9 |
Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
|
10 |
|
27 |
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
|
28 |
|
29 |
== Changelog ==
|
30 |
+
= Version 2.71 =
|
31 |
+
* FIXED: Use wp_kses_post() to get filter always bad tags
|
32 |
|
33 |
= Version 2.70 =
|
34 |
* NEW: Add wp_polls_vote_poll_success action hook
|
wp-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Polls
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
|
6 |
-
Version: 2.
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-polls
|
@@ -430,7 +430,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
430 |
$poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
|
431 |
|
432 |
// Poll Question Variables
|
433 |
-
$poll_question_text = stripslashes($poll_question->pollq_question);
|
434 |
$poll_question_id = intval($poll_question->pollq_id);
|
435 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
436 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
@@ -472,7 +472,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
472 |
foreach($poll_answers as $poll_answer) {
|
473 |
// Poll Answer Variables
|
474 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
475 |
-
$poll_answer_text = stripslashes($poll_answer->polla_answers);
|
476 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
477 |
$poll_answer_percentage = $poll_question_totalvoters > 0 ? round((($poll_answer_votes/$poll_question_totalvoters)*100)) : 0;
|
478 |
$template_answer = stripslashes(get_option('poll_template_votebody'));
|
@@ -553,7 +553,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
553 |
return stripslashes(get_option('poll_template_disable'));
|
554 |
}
|
555 |
// Poll Question Variables
|
556 |
-
$poll_question_text = stripslashes($poll_question->pollq_question);
|
557 |
$poll_question_id = intval($poll_question->pollq_id);
|
558 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
559 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
@@ -595,10 +595,8 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
595 |
foreach($poll_answers as $poll_answer) {
|
596 |
// Poll Answer Variables
|
597 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
598 |
-
$poll_answer_text = stripslashes($poll_answer->polla_answers);
|
599 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
600 |
-
$poll_answer_percentage = 0;
|
601 |
-
$poll_answer_imagewidth = 0;
|
602 |
// Calculate Percentage And Image Bar Width
|
603 |
if(!$poll_totalvotes_zero) {
|
604 |
if($poll_answer_votes > 0) {
|
@@ -765,7 +763,7 @@ if(!function_exists('get_poll_question')) {
|
|
765 |
global $wpdb;
|
766 |
$poll_id = intval($poll_id);
|
767 |
$poll_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
|
768 |
-
return stripslashes($poll_question);
|
769 |
}
|
770 |
}
|
771 |
|
@@ -941,7 +939,7 @@ function polls_archive() {
|
|
941 |
$questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE $polls_type_sql ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
|
942 |
if($questions) {
|
943 |
foreach($questions as $question) {
|
944 |
-
$polls_questions[] = array('id' => intval($question->pollq_id), 'question' => stripslashes($question->pollq_question), 'timestamp' => $question->pollq_timestamp, 'totalvotes' => intval($question->pollq_totalvotes), 'start' => $question->pollq_timestamp, 'end' => trim($question->pollq_expiry), 'multiple' => intval($question->pollq_multiple), 'totalvoters' => intval($question->pollq_totalvoters));
|
945 |
$poll_questions_ids .= intval($question->pollq_id).', ';
|
946 |
}
|
947 |
$poll_questions_ids = substr($poll_questions_ids, 0, -2);
|
@@ -951,7 +949,7 @@ function polls_archive() {
|
|
951 |
$answers = $wpdb->get_results("SELECT polla_aid, polla_qid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid IN ($poll_questions_ids) ORDER BY ".get_option('poll_ans_result_sortby').' '.get_option('poll_ans_result_sortorder'));
|
952 |
if($answers) {
|
953 |
foreach($answers as $answer) {
|
954 |
-
$polls_answers[intval($answer->polla_qid)][] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => stripslashes($answer->polla_answers), 'votes' => intval($answer->polla_votes));
|
955 |
}
|
956 |
}
|
957 |
|
@@ -1028,6 +1026,7 @@ function polls_archive() {
|
|
1028 |
}
|
1029 |
}
|
1030 |
}
|
|
|
1031 |
// Let User See What Options They Voted
|
1032 |
if(isset($polls_ips[$polls_question['id']]) && in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1033 |
// Results Body Variables
|
@@ -1414,9 +1413,9 @@ function manage_poll() {
|
|
1414 |
if(trim($_POST['delete_logs_yes']) == 'yes') {
|
1415 |
$delete_logs = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
|
1416 |
if($delete_logs) {
|
1417 |
-
echo '<p style="color: green;">'.sprintf(__('All Logs For \'%s\' Has Been Deleted.', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1418 |
} else {
|
1419 |
-
echo '<p style="color: red;">'.sprintf(__('An Error Has Occurred While Deleting All Logs For \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1420 |
}
|
1421 |
}
|
1422 |
break;
|
@@ -1427,7 +1426,7 @@ function manage_poll() {
|
|
1427 |
$polla_aid = intval($_POST['polla_aid']);
|
1428 |
$poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id");
|
1429 |
$polla_votes = intval($poll_answers->polla_votes);
|
1430 |
-
$polla_answers = stripslashes(trim($poll_answers->polla_answers));
|
1431 |
$delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id");
|
1432 |
$delete_pollip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id AND pollip_aid = $polla_aid");
|
1433 |
$update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id = $pollq_id");
|
@@ -1444,9 +1443,9 @@ function manage_poll() {
|
|
1444 |
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
|
1445 |
$open_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_id = $pollq_id;");
|
1446 |
if($open_poll) {
|
1447 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Opened', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1448 |
} else {
|
1449 |
-
echo '<p style="color: red;">'.sprintf(__('Error Opening Poll \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1450 |
}
|
1451 |
break;
|
1452 |
// Close Poll
|
@@ -1456,9 +1455,9 @@ function manage_poll() {
|
|
1456 |
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
|
1457 |
$close_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_id = $pollq_id;");
|
1458 |
if($close_poll) {
|
1459 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Closed', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1460 |
} else {
|
1461 |
-
echo '<p style="color: red;">'.sprintf(__('Error Closing Poll \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1462 |
}
|
1463 |
break;
|
1464 |
// Delete Poll
|
@@ -1471,10 +1470,10 @@ function manage_poll() {
|
|
1471 |
$delete_poll_ip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
|
1472 |
$poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
|
1473 |
if(!$delete_poll_question) {
|
1474 |
-
echo '<p style="color: red;">'.sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1475 |
}
|
1476 |
if(empty($text)) {
|
1477 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Deleted Successfully', 'wp-polls'), stripslashes($pollq_question)).'</p>';
|
1478 |
}
|
1479 |
// Update Lastest Poll ID To Poll Options
|
1480 |
$latest_pollid = polls_latest_id();
|
@@ -1590,7 +1589,7 @@ function polls_page_general_stats($content) {
|
|
1590 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
1591 |
if($polls) {
|
1592 |
foreach($polls as $poll) {
|
1593 |
-
$pollq_question = stripslashes($poll->pollq_question);
|
1594 |
$pollq_id = intval($poll->pollq_id);
|
1595 |
if($pollq_id == $poll_id) {
|
1596 |
echo "<option value=\"$pollq_id\" selected=\"selected\">$pollq_question</option>\n";
|
3 |
Plugin Name: WP-Polls
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
|
6 |
+
Version: 2.71
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-polls
|
430 |
$poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
|
431 |
|
432 |
// Poll Question Variables
|
433 |
+
$poll_question_text = wp_kses_post( stripslashes( $poll_question->pollq_question ) );
|
434 |
$poll_question_id = intval($poll_question->pollq_id);
|
435 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
436 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
472 |
foreach($poll_answers as $poll_answer) {
|
473 |
// Poll Answer Variables
|
474 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
475 |
+
$poll_answer_text = wp_kses_post( stripslashes( $poll_answer->polla_answers ) );
|
476 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
477 |
$poll_answer_percentage = $poll_question_totalvoters > 0 ? round((($poll_answer_votes/$poll_question_totalvoters)*100)) : 0;
|
478 |
$template_answer = stripslashes(get_option('poll_template_votebody'));
|
553 |
return stripslashes(get_option('poll_template_disable'));
|
554 |
}
|
555 |
// Poll Question Variables
|
556 |
+
$poll_question_text = wp_kses_post( stripslashes( $poll_question->pollq_question ) );
|
557 |
$poll_question_id = intval($poll_question->pollq_id);
|
558 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
559 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
595 |
foreach($poll_answers as $poll_answer) {
|
596 |
// Poll Answer Variables
|
597 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
598 |
+
$poll_answer_text = wp_kses_post( stripslashes($poll_answer->polla_answers) );
|
599 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
|
|
|
|
600 |
// Calculate Percentage And Image Bar Width
|
601 |
if(!$poll_totalvotes_zero) {
|
602 |
if($poll_answer_votes > 0) {
|
763 |
global $wpdb;
|
764 |
$poll_id = intval($poll_id);
|
765 |
$poll_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
|
766 |
+
return wp_kses_post( stripslashes( $poll_question ) );
|
767 |
}
|
768 |
}
|
769 |
|
939 |
$questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE $polls_type_sql ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
|
940 |
if($questions) {
|
941 |
foreach($questions as $question) {
|
942 |
+
$polls_questions[] = array('id' => intval($question->pollq_id), 'question' => wp_kses_post( stripslashes( $question->pollq_question ) ), 'timestamp' => $question->pollq_timestamp, 'totalvotes' => intval($question->pollq_totalvotes), 'start' => $question->pollq_timestamp, 'end' => trim($question->pollq_expiry), 'multiple' => intval($question->pollq_multiple), 'totalvoters' => intval($question->pollq_totalvoters));
|
943 |
$poll_questions_ids .= intval($question->pollq_id).', ';
|
944 |
}
|
945 |
$poll_questions_ids = substr($poll_questions_ids, 0, -2);
|
949 |
$answers = $wpdb->get_results("SELECT polla_aid, polla_qid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid IN ($poll_questions_ids) ORDER BY ".get_option('poll_ans_result_sortby').' '.get_option('poll_ans_result_sortorder'));
|
950 |
if($answers) {
|
951 |
foreach($answers as $answer) {
|
952 |
+
$polls_answers[intval($answer->polla_qid)][] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => wp_kses_post( stripslashes( $answer->polla_answers ) ), 'votes' => intval($answer->polla_votes));
|
953 |
}
|
954 |
}
|
955 |
|
1026 |
}
|
1027 |
}
|
1028 |
}
|
1029 |
+
$polls_answer['answers'] = wp_kses_post( $polls_answer['answers'] );
|
1030 |
// Let User See What Options They Voted
|
1031 |
if(isset($polls_ips[$polls_question['id']]) && in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1032 |
// Results Body Variables
|
1413 |
if(trim($_POST['delete_logs_yes']) == 'yes') {
|
1414 |
$delete_logs = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
|
1415 |
if($delete_logs) {
|
1416 |
+
echo '<p style="color: green;">'.sprintf(__('All Logs For \'%s\' Has Been Deleted.', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1417 |
} else {
|
1418 |
+
echo '<p style="color: red;">'.sprintf(__('An Error Has Occurred While Deleting All Logs For \'%s\'', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1419 |
}
|
1420 |
}
|
1421 |
break;
|
1426 |
$polla_aid = intval($_POST['polla_aid']);
|
1427 |
$poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id");
|
1428 |
$polla_votes = intval($poll_answers->polla_votes);
|
1429 |
+
$polla_answers = wp_kses_post( stripslashes( trim( $poll_answers->polla_answers ) ) );
|
1430 |
$delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $polla_aid AND polla_qid = $pollq_id");
|
1431 |
$delete_pollip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id AND pollip_aid = $polla_aid");
|
1432 |
$update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id = $pollq_id");
|
1443 |
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
|
1444 |
$open_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_id = $pollq_id;");
|
1445 |
if($open_poll) {
|
1446 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Opened', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1447 |
} else {
|
1448 |
+
echo '<p style="color: red;">'.sprintf(__('Error Opening Poll \'%s\'', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1449 |
}
|
1450 |
break;
|
1451 |
// Close Poll
|
1455 |
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
|
1456 |
$close_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_id = $pollq_id;");
|
1457 |
if($close_poll) {
|
1458 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Closed', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1459 |
} else {
|
1460 |
+
echo '<p style="color: red;">'.sprintf(__('Error Closing Poll \'%s\'', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1461 |
}
|
1462 |
break;
|
1463 |
// Delete Poll
|
1470 |
$delete_poll_ip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
|
1471 |
$poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
|
1472 |
if(!$delete_poll_question) {
|
1473 |
+
echo '<p style="color: red;">'.sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1474 |
}
|
1475 |
if(empty($text)) {
|
1476 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Deleted Successfully', 'wp-polls'), wp_kses_post( stripslashes( $pollq_question ) ) ).'</p>';
|
1477 |
}
|
1478 |
// Update Lastest Poll ID To Poll Options
|
1479 |
$latest_pollid = polls_latest_id();
|
1589 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
1590 |
if($polls) {
|
1591 |
foreach($polls as $poll) {
|
1592 |
+
$pollq_question = wp_kses_post( stripslashes( $poll->pollq_question ) );
|
1593 |
$pollq_id = intval($poll->pollq_id);
|
1594 |
if($pollq_id == $poll_id) {
|
1595 |
echo "<option value=\"$pollq_id\" selected=\"selected\">$pollq_question</option>\n";
|