Changeset 7886
- Timestamp:
- 02/08/07 19:19:41 (1 year ago)
- Files:
-
- wp-polls/trunk/polls/polls-add.php (modified) (2 diffs)
- wp-polls/trunk/polls/polls-admin-ajax.php (modified) (1 diff)
- wp-polls/trunk/polls/polls-admin-js.php (modified) (1 diff)
- wp-polls/trunk/polls/polls-css.css (modified) (1 diff)
- wp-polls/trunk/polls/polls-js.php (modified) (2 diffs)
- wp-polls/trunk/polls/polls-manager.php (modified) (9 diffs)
- wp-polls/trunk/polls/polls-options.php (modified) (13 diffs)
- wp-polls/trunk/polls/polls-uninstall.php (modified) (1 diff)
- wp-polls/trunk/polls/polls-usage.php (modified) (1 diff)
- wp-polls/trunk/polls/polls-widget.php (modified) (1 diff)
- wp-polls/trunk/polls/polls.php (modified) (22 diffs)
- wp-polls/trunk/polls/wp-polls.pot (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wp-polls/trunk/polls/polls-add.php
r7856 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | … … 76 76 } 77 77 // Insert Poll 78 $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsq VALUES (0, '$pollq_question', '$pollq_timestamp', 0, $pollq_active, '$pollq_expiry', $pollq_multiple )");78 $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsq VALUES (0, '$pollq_question', '$pollq_timestamp', 0, $pollq_active, '$pollq_expiry', $pollq_multiple, 0)"); 79 79 if(!$add_poll_question) { 80 80 $text .= '<p style="color: red;">'.sprintf(__('Error In Adding Poll \'%s\'.', 'wp-polls'), stripslashes($pollq_question)).'</p>'; wp-polls/trunk/polls/polls-admin-ajax.php
r7836 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | wp-polls/trunk/polls/polls-admin-js.php
r7856 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | wp-polls/trunk/polls/polls-css.css
r7835 r7886 2 2 +----------------------------------------------------------------+ 3 3 | | 4 | WordPress 2.0 Plugin: WP-Polls 2. 15|5 | Copyright (c) 200 6Lester "GaMerZ" Chan |4 | WordPress 2.0 Plugin: WP-Polls 2.20 | 5 | Copyright (c) 2007 Lester "GaMerZ" Chan | 6 6 | | 7 7 | File Written By: | wp-polls/trunk/polls/polls-js.php
r7856 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | … … 57 57 poll_answer = eval("poll_form.poll_" + poll_id); 58 58 poll_answer_id = ""; 59 poll_multiple_ans = parseInt(document.getElementById('poll_multiple_ans').value); 59 if(document.getElementById('poll_multiple_ans')) { 60 poll_multiple_ans = parseInt(document.getElementById('poll_multiple_ans').value); 61 } else { 62 poll_multiple_ans = 0; 63 } 60 64 poll_multiple_ans_count = 0; 61 65 if(poll_answer.length != null) { wp-polls/trunk/polls/polls-manager.php
r7856 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | … … 83 83 } 84 84 } 85 // Mutilple Poll 86 $pollq_multiple_yes = intval($_POST['pollq_multiple_yes']); 87 $pollq_multiple = 0; 88 if($pollq_multiple_yes == 1) { 89 $pollq_multiple = intval($_POST['pollq_multiple']); 90 } else { 91 $pollq_multiple = 0; 92 } 85 93 // Update Poll's Question 86 $edit_poll_question = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_question = '$pollq_question', pollq_totalvotes = $pollq_totalvotes, pollq_expiry = '$pollq_expiry', pollq_active = $pollq_active $timestamp_sql WHERE pollq_id = $pollq_id");94 $edit_poll_question = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_question = '$pollq_question', pollq_totalvotes = $pollq_totalvotes, pollq_expiry = '$pollq_expiry', pollq_active = $pollq_active, pollq_multiple = $pollq_multiple $timestamp_sql WHERE pollq_id = $pollq_id"); 87 95 if(!$edit_poll_question) { 88 96 $text = '<p style="color: blue">'.sprintf(__('No Changes Had Been Made To Poll\'s Question \'%s\'.', 'wp-polls'), stripslashes($pollq_question)).'</p>'; … … 142 150 // Edit A Poll 143 151 case 'edit': 144 $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry FROM $wpdb->pollsq WHERE pollq_id = $poll_id");152 $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry, pollq_multiple FROM $wpdb->pollsq WHERE pollq_id = $poll_id"); 145 153 $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_id ORDER BY polla_aid ASC"); 146 154 $poll_noquestion = $wpdb->get_var("SELECT COUNT(polla_aid) FROM $wpdb->pollsa WHERE polla_qid = $poll_id"); … … 150 158 $poll_active = intval($poll_question->pollq_active); 151 159 $poll_expiry = trim($poll_question->pollq_expiry); 160 $poll_multiple = intval($poll_question->pollq_multiple); 152 161 ?> 153 162 <script type="text/javascript"> … … 218 227 var poll_votes_count = document.createTextNode("0 "); 219 228 var poll_answer_bold = document.createElement("strong"); 229 var poll_option = document.createElement("option"); 230 var poll_option_text = document.createTextNode((count_poll_answer+1)); 220 231 count_poll_answer++; 221 232 count_poll_answer_new++; … … 229 240 poll_votes.setAttribute('value', "0"); 230 241 poll_votes.setAttribute('onblur', "check_totalvotes_new();"); 242 // Elements - Options 243 poll_option.setAttribute('value', count_poll_answer); 244 poll_option.setAttribute('id', "pollq-multiple-" + (count_poll_answer+1)); 231 245 // Elements - TD/TR 232 246 if(count_poll_answer%2 != 0) { poll_tr.style.background = "#eee"; } … … 245 259 poll_td3.appendChild(poll_votes_count); 246 260 poll_td3.appendChild(poll_votes); 261 poll_option.appendChild(poll_option_text); 247 262 document.getElementById("poll_answers").appendChild(poll_tr); 263 document.getElementById("pollq_multiple").appendChild(poll_option); 248 264 } 249 265 function remove_poll_answer() { … … 252 268 } else { 253 269 document.getElementById("poll_answers").removeChild(document.getElementById("poll-answer-new-" + count_poll_answer_new)); 270 document.getElementById("pollq_multiple").removeChild(document.getElementById("pollq-multiple-" + (count_poll_answer+1))); 271 document.getElementById("pollq_multiple").value = count_poll_answer; 254 272 count_poll_answer--; 255 273 count_poll_answer_new--; 256 274 check_totalvotes_new(); 275 } 276 } 277 function check_pollq_multiple() { 278 if(parseInt(document.getElementById("pollq_multiple_yes").value) == 1) { 279 document.getElementById("pollq_multiple").disabled = false; 280 } else { 281 document.getElementById("pollq_multiple").value = 1; 282 document.getElementById("pollq_multiple").disabled = true; 257 283 } 258 284 } … … 320 346 </tr> 321 347 </tfoot> 348 </table> 349 <!-- Poll Multiple Answers --> 350 <h3><?php _e('Poll Multiple Answers', 'wp-polls') ?></h3> 351 <table width="100%" border="0" cellspacing="3" cellpadding="3"> 352 <tr style="background-color: #eee;"> 353 <td width="40%" valign="top"><strong><?php _e('Allows Users To Select More Than One Answer?', 'wp-polls'); ?></strong></td> 354 <td width="60%"> 355 <select name="pollq_multiple_yes" id="pollq_multiple_yes" size="1" onchange="check_pollq_multiple();"> 356 <option value="0"<?php selected('0', $poll_multiple); ?>><?php _e('No', 'wp-polls'); ?></option> 357 <option value="1"<?php if($poll_multiple > 0) { echo ' selected="selected"'; } ?>><?php _e('Yes', 'wp-polls'); ?></option> 358 </select> 359 </tr> 360 <tr> 361 <td width="40%" valign="top"><strong><?php _e('Maximum Number Of Selected Answers Allowed?', 'wp-polls') ?></strong></td> 362 <td width="60%"> 363 <select name="pollq_multiple" id="pollq_multiple" size="1" <?php if($poll_multiple == 0) { echo 'disabled="true"'; } ?>> 364 <?php 365 for($i = 1; $i <= $poll_noquestion; $i++) { 366 if($poll_multiple > 0 && $poll_multiple == $i) { 367 echo "<option value=\"$i\" selected=\"selected\">$i</option>\n"; 368 } else { 369 echo "<option value=\"$i\">$i</option>\n"; 370 } 371 } 372 ?> 373 </select> 374 </td> 375 </tr> 322 376 </table> 323 377 <!-- Poll Start/End Date --> wp-polls/trunk/polls/polls-options.php
r7835 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | … … 133 133 break; 134 134 case "votebody": 135 default_template = "<li><input type=\" radio\" id=\"poll-answer-%POLL_ANSWER_ID%\" name=\"poll_%POLL_ID%\" value=\"%POLL_ANSWER_ID%\" /> <label for=\"poll-answer-%POLL_ANSWER_ID%\">%POLL_ANSWER%</label></li>";135 default_template = "<li><input type=\"%POLL_CHECKBOX_RADIO%\" id=\"poll-answer-%POLL_ANSWER_ID%\" name=\"poll_%POLL_ID%\" value=\"%POLL_ANSWER_ID%\" /> <label for=\"poll-answer-%POLL_ANSWER_ID%\">%POLL_ANSWER%</label></li>"; 136 136 break; 137 137 case "votefooter": … … 142 142 break; 143 143 case "resultbody": 144 default_template = "<li>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%% )</small><div class=\"pollbar\" style=\"width: %POLL_ANSWER_IMAGEWIDTH%%;\" title=\"%POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% <?php _e('Votes', 'wp-polls'); ?>)\"></div></li>";144 default_template = "<li>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%, %POLL_ANSWER_VOTES% Votes)</small><div class=\"pollbar\" style=\"width: %POLL_ANSWER_IMAGEWIDTH%%;\" title=\"%POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% <?php _e('Votes', 'wp-polls'); ?>)\"></div></li>"; 145 145 break; 146 146 case "resultbody2": 147 default_template = "<li><strong><i>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%% )</small></i></strong><div class=\"pollbar\" style=\"width: %POLL_ANSWER_IMAGEWIDTH%%;\" title=\"<?php _e('You Have Voted For This Choice', 'wp-polls'); ?> - %POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% <?php _e('Votes', 'wp-polls'); ?>)\"></div></li>";147 default_template = "<li><strong><i>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%, %POLL_ANSWER_VOTES% Votes)</small></i></strong><div class=\"pollbar\" style=\"width: %POLL_ANSWER_IMAGEWIDTH%%;\" title=\"<?php _e('You Have Voted For This Choice', 'wp-polls'); ?> - %POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% <?php _e('Votes', 'wp-polls'); ?>)\"></div></li>"; 148 148 break; 149 149 case "resultfooter": 150 default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Vote s', 'wp-polls'); ?>: <strong>%POLL_TOTALVOTES%</strong></p>\n</div>";150 default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Voters', 'wp-polls'); ?>: <strong>%POLL_TOTALVOTERS%</strong></p>\n</div>"; 151 151 break; 152 152 case "resultfooter2": 153 default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Vote s', 'wp-polls'); ?>: <strong>%POLL_TOTALVOTES%</strong></p>\n<p style=\"text-align: center;\"><a href=\"#VotePoll\" onclick=\"poll_booth(%POLL_ID%); return false;\" title=\"<?php _e('Vote For This Poll', 'wp-polls'); ?>\"><?php _e('Vote', 'wp-polls'); ?></a></p>\n</div>";153 default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Voters', 'wp-polls'); ?>: <strong>%POLL_TOTALVOTERS%</strong></p>\n<p style=\"text-align: center;\"><a href=\"#VotePoll\" onclick=\"poll_booth(%POLL_ID%); return false;\" title=\"<?php _e('Vote For This Poll', 'wp-polls'); ?>\"><?php _e('Vote', 'wp-polls'); ?></a></p>\n</div>"; 154 154 break; 155 155 case "disable": … … 447 447 <td> 448 448 <strong>%POLL_TOTALVOTES%</strong><br /> 449 <?php _e('Display the poll\'s total votes ', 'wp-polls'); ?>449 <?php _e('Display the poll\'s total votes NOT the number of people who voted for the poll', 'wp-polls'); ?> 450 450 </td> 451 451 <td> … … 509 509 </td> 510 510 </tr> 511 <tr> 512 <td><strong>%POLL_MULTIPLE_ANS_MAX%</strong><br /> 513 <?php _e('Display the the maximum number of answers the user can choose if the poll supports multiple answers', 'wp-polls'); ?></td> 514 <td> 515 <strong>%POLL_CHECKBOX_RADIO%</strong><br /> 516 <?php _e('Display "checkbox" or "radio" input types depending on the poll type', 'wp-polls'); ?> 517 </td> 518 </tr> 519 <tr> 520 <td><strong>%POLL_TOTALVOTERS%</strong><br /> 521 <?php _e('Display the number of people who voted for the poll NOT the total votes of the poll', 'wp-polls'); ?></td> 522 <td> </td> 523 </tr> 524 <tr> 525 <td colspan="2"><strong><?php _e('Note:', 'wp-polls'); ?></strong><br /> 526 <?php _e('<strong>%POLL_TOTALVOTES%</strong> and <strong>%POLL_TOTALVOTERS%</strong> will be different if your poll supports multiple answers. If your poll allows only single answer, both value will be the same.', 'wp-polls'); ?></td> 527 </tr> 511 528 </table> 512 529 </fieldset> … … 522 539 - %POLL_START_DATE%<br /> 523 540 - %POLL_END_DATE%<br /> 524 - %POLL_TOTALVOTES%<br /><br /> 541 - %POLL_TOTALVOTES%<br /> 542 - %POLL_TOTALVOTERS%<br /> 543 - %POLL_MULTIPLE_ANS_MAX%<br /><br /> 525 544 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('voteheader');" class="button" /> 526 545 </td> … … 534 553 - %POLL_ANSWER_ID%<br /> 535 554 - %POLL_ANSWER%<br /> 536 - %POLL_ANSWER_VOTES%<br /><br /> 555 - %POLL_ANSWER_VOTES%<br /> 556 - %POLL_CHECKBOX_RADIO%<br /><br /> 537 557 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('votebody');" class="button" /> 538 558 </td> … … 544 564 <?php _e('Allowed Variables:', 'wp-polls'); ?><br /> 545 565 - %POLL_ID%<br /> 546 - %POLL_RESULT_URL%<br /><br /> 566 - %POLL_RESULT_URL%<br /> 567 - %POLL_MULTIPLE_ANS_MAX%<br /><br /> 547 568 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('votefooter');" class="button" /> 548 569 </td> … … 562 583 - %POLL_START_DATE%<br /> 563 584 - %POLL_END_DATE%<br /> 564 - %POLL_TOTALVOTES%<br /><br /> 585 - %POLL_TOTALVOTES%<br /> 586 - %POLL_TOTALVOTERS%<br /> 587 - %POLL_MULTIPLE_ANS_MAX%<br /><br /> 565 588 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultheader');" class="button" /> 566 589 </td> … … 603 626 - %POLL_END_DATE%<br /> 604 627 - %POLL_TOTALVOTES%<br /> 628 - %POLL_TOTALVOTERS%<br /> 605 629 - %POLL_MOST_ANSWER%<br /> 606 630 - %POLL_MOST_VOTES%<br /> … … 608 632 - %POLL_LEAST_ANSWER%<br /> 609 633 - %POLL_LEAST_VOTES%<br /> 610 - %POLL_LEAST_PERCENTAGE%<br /><br /> 634 - %POLL_LEAST_PERCENTAGE%<br /> 635 - %POLL_MULTIPLE_ANS_MAX%<br /><br /> 611 636 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultfooter');" class="button" /> 612 637 </td> … … 621 646 - %POLL_END_DATE%<br /> 622 647 - %POLL_TOTALVOTES%<br /> 648 - %POLL_TOTALVOTERS%<br /> 623 649 - %POLL_MOST_ANSWER%<br /> 624 650 - %POLL_MOST_VOTES%<br /> … … 626 652 - %POLL_LEAST_ANSWER%<br /> 627 653 - %POLL_LEAST_VOTES%<br /> 628 - %POLL_LEAST_PERCENTAGE%<br /><br /> 654 - %POLL_LEAST_PERCENTAGE%<br /> 655 - %POLL_MULTIPLE_ANS_MAX%<br /><br /> 629 656 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultfooter2');" class="button" /> 630 657 </td> wp-polls/trunk/polls/polls-uninstall.php
r7835 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | wp-polls/trunk/polls/polls-usage.php
r7835 r7886 3 3 +----------------------------------------------------------------+ 4 4 | | 5 | WordPress 2.1 Plugin: WP-Polls 2. 15|5 | WordPress 2.1 Plugin: WP-Polls 2.20 | 6 6 | Copyright (c) 2007 Lester "GaMerZ" Chan | 7 7 | | wp-polls/trunk/polls/polls-widget.php
r7835 r7886 4 4 Plugin URI: http://www.lesterchan.net/portfolio/programming.php 5 5 Description: Adds a Sidebar Widget To Display Poll From WP-Polls Plugin. You Need To Activate WP-Polls First. 6 Version: 2. 156 Version: 2.20 7 7 Author: GaMerZ 8 8 Author URI: http://www.lesterchan.net wp-polls/trunk/polls/polls.php
r7856 r7886 4 4 Plugin URI: http://www.lesterchan.net/portfolio/programming.php 5 5 Description: Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page. 6 Version: 2. 156 Version: 2.20 7 7 Author: GaMerZ 8 8 Author URI: http://www.lesterchan.net … … 287 287 $temp_pollvote = ''; 288 288 // Get Poll Question Data 289 $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry, pollq_multiple FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");289 $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"); 290 290 // Poll Question Variables 291 291 $poll_question_text = stripslashes($poll_question->pollq_question); 292 292 $poll_question_id = intval($poll_question->pollq_id); 293 293 $poll_question_totalvotes = intval($poll_question->pollq_totalvotes); 294 $poll_question_totalvoters = intval($poll_question->pollq_totalvoters); 294 295 $poll_start_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_question->pollq_timestamp)); 295 296 $poll_expiry = trim($poll_question->pollq_expiry); … … 304 305 $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question); 305 306 $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question); 307 $template_question = str_replace("%POLL_TOTALVOTERS%", $poll_question_totalvoters, $template_question); 306 308 $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question); 307 309 $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question); 310 if($poll_multiple_ans > 0) { 311 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", $poll_multiple_ans, $template_question); 312 } else { 313 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_question); 314 } 308 315 // Get Poll Answers Data 309 316 $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_question_id ORDER BY ".get_option('poll_ans_sortby').' '.get_option('poll_ans_sortorder')); … … 332 339 $template_answer = str_replace("%POLL_ANSWER_VOTES%", number_format($poll_answer_votes), $template_answer); 333 340 if($poll_multiple_ans > 0) { 334 $template_answer = str_replace('type="radio"', 'type="checkbox"', $template_answer); 341 $template_answer = str_replace("%POLL_CHECKBOX_RADIO%", 'checkbox', $template_answer); 342 } else { 343 $template_answer = str_replace("%POLL_CHECKBOX_RADIO%", 'radio', $template_answer); 335 344 } 336 345 // Print Out Voting Form Body Template … … 353 362 $template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer); 354 363 $template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer); 364 if($poll_multiple_ans > 0) { 365 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", $poll_multiple_ans, $template_footer); 366 } else { 367 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_footer); 368 } 355 369 // Print Out Voting Form Footer Template 356 370 $temp_pollvote .= "\t\t$template_footer\n"; … … 388 402 $poll_least_percentage = 0; 389 403 // Get Poll Question Data 390 $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_active, pollq_timestamp, pollq_expiry FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");404 $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_active, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1"); 391 405 // Poll Question Variables 392 406 $poll_question_text = stripslashes($poll_question->pollq_question); 393 407 $poll_question_id = intval($poll_question->pollq_id); 394 408 $poll_question_totalvotes = intval($poll_question->pollq_totalvotes); 409 $poll_question_totalvoters = intval($poll_question->pollq_totalvoters); 395 410 $poll_question_active = intval($poll_question->pollq_active); 396 411 $poll_start_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_question->pollq_timestamp)); … … 401 416 $poll_end_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry)); 402 417 } 418 $poll_multiple_ans = intval($poll_question->pollq_multiple); 403 419 $template_question = stripslashes(get_option('poll_template_resultheader')); 404 420 $template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question); 405 421 $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question); 406 422 $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question); 423 $template_question = str_replace("%POLL_TOTALVOTERS%", $poll_question_totalvoters, $template_question); 407 424 $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question); 408 425 $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question); 426 if($poll_multiple_ans > 0) { 427 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", $poll_multiple_ans, $template_question); 428 } else { 429 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_question); 430 } 409 431 // Get Poll Answers Data 410 432 $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_question_id ORDER BY ".get_option('poll_ans_result_sortby').' '.get_option('poll_ans_result_sortorder')); … … 494 516 $template_footer = str_replace("%POLL_ID%", $poll_question_id, $template_footer); 495 517 $template_footer = str_replace("%POLL_TOTALVOTES%", number_format($poll_question_totalvotes), $template_footer); 518 $template_footer = str_replace("%POLL_TOTALVOTERS%", number_format($poll_question_totalvoters), $template_footer); 496 519 $template_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_footer); 497 520 $template_footer = str_replace("%POLL_MOST_VOTES%", number_format($poll_most_votes), $template_footer); … … 500 523 $template_footer = str_replace("%POLL_LEAST_VOTES%", number_format($poll_least_votes), $template_footer); 501 524 $template_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_footer); 525 if($poll_multiple_ans > 0) { 526 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", $poll_multiple_ans, $template_footer); 527 } else { 528 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_footer); 529 } 502 530 // Print Out Results Footer Template 503 531 $temp_pollresult .= "\t\t$template_footer\n"; … … 548 576 $content = preg_replace( "/\[poll=(\d+)\]/ise", "display_poll('\\1')", $content); 549 577 } else { 550 $content = preg_replace( "/\[poll=(\d+)\]/i", __('Note: There is a poll within this post, please visit the site to participate in this po ll.', 'wp-polls'), $content);578 $content = preg_replace( "/\[poll=(\d+)\]/i", __('Note: There is a poll within this post, please visit the site to participate in this post\'s poll.', 'wp-polls'), $content); 551 579 } 552 580 return $content; … … 605 633 function check_voted_multiple($poll_id) { 606 634 global $polls_ips; 607 $temp_voted_aid = 0;608 if( intval($_COOKIE["voted_$poll_id"]) > 0) {609 $temp_voted_aid = intval($_COOKIE["voted_$poll_id"]);635 $temp_voted_aid = array(); 636 if(!empty($_COOKIE["voted_$poll_id"])) { 637 $temp_voted_aid = explode(',', $_COOKIE["voted_$poll_id"]); 610 638 } else { 611 639 if($polls_ips) { 612 640 foreach($polls_ips as $polls_ip) { 613 641 if($polls_ip['qid'] == $poll_id) { 614 $temp_voted_aid = $polls_ip['aid'];642 $temp_voted_aid[] = $polls_ip['aid']; 615 643 } 616 644 } … … 721 749 if($questions) { 722 750 foreach($questions as $question) { 723 $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) );751 $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)); 724 752 $poll_questions_ids .= intval($question->pollq_id).', '; 725 753 } … … 793 821 $template_question = str_replace("%POLL_ID%", $polls_question['id'], $template_question); 794 822 $template_question = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_question); 823 $template_question = str_replace("%POLL_TOTALVOTERS%", $polls_question['totalvoters'], $template_question); 795 824 $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question); 796 825 $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question); 826 if($polls_question['multiple'] > 0) { 827 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", $polls_question['multiple'], $template_question); 828 } else { 829 $template_question = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_question); 830 } 797 831 // Print Out Result Header Template 798 832 $pollsarchive_output_archive .= $template_question; … … 813 847 } 814 848 // Let User See What Options They Voted 815 if( check_voted_multiple($polls_question['id']) == $polls_answer['aid']) {849 if(in_array($polls_answer['aid'], check_voted_multiple($polls_question['id']))) { 816 850 // Results Body Variables 817 851 $template_answer = stripslashes(get_option('poll_template_resultbody2')); … … 860 894 $template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer); 861 895 $template_footer = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_footer); 896 $template_footer = str_replace("%POLL_TOTALVOTERS%", $polls_question['totalvoters'], $template_footer); 862 897 $template_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_footer); 863 898 $template_footer = str_replace("%POLL_MOST_VOTES%", number_format($poll_most_votes), $template_footer); … … 866 901 $template_footer = str_replace("%POLL_LEAST_VOTES%", number_format($poll_least_votes), $template_footer); 867 902 $template_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_footer); 903 if($polls_question['multiple'] > 0) { 904 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", $polls_question['multiple'], $template_footer); 905 } else { 906 $template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_footer); 907 } 868 908 // Print Out Results Footer Template 869 909 $pollsarchive_output_archive .= $template_footer; … … 1053 1093 $wpdb->query("UPDATE $wpdb->pollsa SET polla_votes = (polla_votes+1) WHERE polla_qid = $poll_id AND polla_aid = $polla_aid"); 1054 1094 } 1055 $vote_q = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes+ 1) WHERE pollq_id = $poll_id");1095 $vote_q = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes+".sizeof($poll_aid_array)."), pollq_totalvoters = (pollq_totalvoters+1) WHERE pollq_id = $poll_id"); 1056 1096 if($vote_q) { 1057 1097 foreach($poll_aid_array as $polla_aid) { … … 1061 1101 exit(); 1062 1102 } else { 1063 printf(__('Unable To Update Poll Total Votes . Poll ID #%s', 'wp-polls'), $poll_id);1103 printf(__('Unable To Update Poll Total Votes And Poll Total Voters. Poll ID #%s', 'wp-polls'), $poll_id); 1064 1104 exit(); 1065 1105 } // End if($vote_a) … … 1099 1139 "pollq_expiry varchar(20) NOT NULL default '',". 1100 1140 "pollq_multiple tinyint(3) NOT NULL default '0',". 1141 "pollq_totalvoters int(10) NOT NULL default '0',". 1101 1142 "PRIMARY KEY (pollq_id))"; 1102 1143 $create_table['pollsa'] = "CREATE TABLE $wpdb->pollsa (". … … 1138 1179 '<div id="polls-%POLL_ID%-ans" class="wp-polls-ans">'. 1139 1180 '<ul class="wp-polls-ul">', 'Template For Poll\'s Question'); 1140 add_option('poll_template_votebody', '<li><input type=" radio" id="poll-answer-%POLL_ANSWER_ID%" name="poll_%POLL_ID%" value="%POLL_ANSWER_ID%" /> <label for="poll-answer-%POLL_ANSWER_ID%">%POLL_ANSWER%</label></li>', 'Template For Poll\'s Answers');1181 add_option('poll_template_votebody', '<li><input type="%POLL_CHECKBOX_RADIO%" id="poll-answer-%POLL_ANSWER_ID%" name="poll_%POLL_ID%" value="%POLL_ANSWER_ID%" /> <label for="poll-answer-%POLL_ANSWER_ID%">%POLL_ANSWER%</label></li>', 'Template For Poll\'s Answers'); 1141 1182 add_option('poll_template_votefooter', '</ul>'. 1142 1183 '<p style="text-align: center;"><input type="button" name="vote" value=" '.__('Vote', 'wp-polls').' " class="Buttons" onclick="poll_vote(%POLL_ID%);" onkeypress="poll_result(%POLL_ID%);" /></p>'. … … 1149 1190 add_option('poll_template_resultbody2', '<li><strong><i>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%, %POLL_ANSWER_VOTES% Votes)</small></i></strong><div class="pollbar" style="width: %POLL_ANSWER_IMAGEWIDTH%%;" title="'.__('You Have Voted For This Choice', 'wp-polls').' - %POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% '.__('Votes', 'wp-polls').')"></div></li>', 'Template For Poll Results (User Voted)'); 1150 1191 add_option('poll_template_resultfooter', '</ul>'. 1151 '<p style="text-align: center;">'.__('Total Vote s', 'wp-polls').': <strong>%POLL_TOTALVOTES%</strong></p>'.1192 '<p style="text-align: center;">'.__('Total Voters', 'wp-polls').': <strong>%POLL_TOTALVOTERS%</strong></p>'. 1152 1193 '</div>', 'Template For Poll Result Footer'); 1153 1194 add_option('poll_template_resultfooter2', '</ul>'. 1154 '<p style="text-align: center;">'.__('Total Vote s', 'wp-polls').': <strong>%POLL_TOTALVOTES
