WP-Polls - Version 2.14

Version Description

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-Polls
Version 2.14
Comparing to
See all releases

Code changes from version 2.02a to 2.14

pollbar.gif DELETED
Binary file
polls-install.php DELETED
@@ -1,221 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Install WP-Polls 2.02 |
14
- | - wp-admin/polls-install.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Config
21
- require('../wp-config.php');
22
-
23
- ### Variables, Variables, Variables
24
- $current_timestamp = current_time('timestamp');
25
- $create_table = array();
26
- $insert_pollq = array();
27
- $insert_polla = array();
28
- $insert_options = array();
29
- $error = '';
30
-
31
- ### Create Tables (3 Tables)
32
- $create_table[] = "CREATE TABLE $wpdb->pollsq (".
33
- "pollq_id int(10) NOT NULL auto_increment,".
34
- "pollq_question varchar(200) NOT NULL default '',".
35
- "pollq_timestamp varchar(20) NOT NULL default '',".
36
- "pollq_totalvotes int(10) NOT NULL default '0',".
37
- "PRIMARY KEY (pollq_id))";
38
- $create_table[] = "CREATE TABLE $wpdb->pollsa (".
39
- "polla_aid int(10) NOT NULL auto_increment,".
40
- "polla_qid int(10) NOT NULL default '0',".
41
- "polla_answers varchar(200) NOT NULL default '',".
42
- "polla_votes int(10) NOT NULL default '0',".
43
- "PRIMARY KEY (polla_aid))";
44
- $create_table[] = "CREATE TABLE $wpdb->pollsip (".
45
- "pollip_id int(10) NOT NULL auto_increment,".
46
- "pollip_qid varchar(10) NOT NULL default '',".
47
- "pollip_aid varchar(10) NOT NULL default '',".
48
- "pollip_ip varchar(100) NOT NULL default '',".
49
- "pollip_host VARCHAR(200) NOT NULL default '',".
50
- "pollip_timestamp varchar(20) NOT NULL default '0000-00-00 00:00:00',".
51
- "pollip_user tinytext NOT NULL,".
52
- "PRIMARY KEY (pollip_id))";
53
-
54
- ### Insert Poll Question (1 Row)
55
- $insert_pollq[] = "INSERT INTO $wpdb->pollsq VALUES (1, 'How Is My Site?', '$current_timestamp', 0);";
56
-
57
- ### Insert Poll Answers (5 Rows)
58
- $insert_polla[] = "INSERT INTO $wpdb->pollsa VALUES (1, 1, 'Good', 0);";
59
- $insert_polla[] = "INSERT INTO $wpdb->pollsa VALUES (2, 1, 'Excellent', 0);";
60
- $insert_polla[] = "INSERT INTO $wpdb->pollsa VALUES (3, 1, 'Bad', 0);";
61
- $insert_polla[] = "INSERT INTO $wpdb->pollsa VALUES (4, 1, 'Can Be Improved', 0);";
62
- $insert_polla[] = "INSERT INTO $wpdb->pollsa VALUES (5, 1, 'No Comments', 0);";
63
-
64
- ### Insert Options (16 Rows)
65
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_voteheader', 'Y', 3, '<table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"3\\\" cellpadding=\\\"3\\\">\r\n<tr>\r\n<td align=\\\"center\\\"><b>%POLL_QUESTION%</b></td>\r\n</tr>', 20, 8, 'Template For Poll''s Question', 8, 'yes');";
66
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (124, 0, 'poll_template_votebody', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\"><input type=\\\"radio\\\" name=\\\"poll-%POLL_ID%\\\" value=\\\"%POLL_ANSWER_ID%\\\" /> %POLL_ANSWER%</td>\r\n</tr>', 20, 8, 'Template For Poll''s Answers', 8, 'yes');";
67
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (123, 0, 'poll_template_votefooter', 'Y', 3, '<tr>\r\n<td align=\\\"center\\\"><input type=\\\"submit\\\" name=\\\"vote\\\" value=\\\" Vote \\\" class=\\\"Buttons\\\" /><br /><a href=\\\"index.php?pollresult=1\\\">View Results</a></td>\r\n</tr>\r\n</table>', 20, 8, 'Template For Poll''s Voting Footer', 8, 'yes');";
68
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultheader', 'Y', 3, '<table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"3\\\" cellpadding=\\\"3\\\">\r\n<tr>\r\n<td colspan=\\\"2\\\" align=\\\"center\\\"><b>%POLL_QUESTION%</b></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
69
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultbody', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\" width=\\\"70%\\\">%POLL_ANSWER%<br /><img src=\\\"wp-images/pollbar.gif\\\" height=\\\"5\\\" width=\\\"%POLL_ANSWER_IMAGEWIDTH%\\\" alt=\\\"%POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\\\" /></td>\r\n<td align=\\\"right\\\" width=\\\"30%\\\"><b>%POLL_ANSWER_PERCENTAGE%%</b></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
70
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultbody2', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\" width=\\\"70%\\\"><i>%POLL_ANSWER%</i><br /><img src=\\\"wp-images/pollbar.gif\\\" height=\\\"5\\\" width=\\\"%POLL_ANSWER_IMAGEWIDTH%\\\" alt=\\\"You Have Voted For This Choice - %POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\\\" /></td>\r\n<td align=\\\"right\\\" width=\\\"30%\\\"><i><b>%POLL_ANSWER_PERCENTAGE%%</b></i></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
71
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultfooter', 'Y', 3, '<tr>\r\n<td colspan=\\\"2\\\" align=\\\"center\\\">Total Votes: <b>%POLL_TOTALVOTES%</b><td>\r\n</tr>\r\n</table>', 20, 8, '', 8, 'yes');";
72
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_disable', 'Y', 3, 'Sorry, there are no polls available at the moment.', 20, 8, 'Template For Poll When It Is Disabled', 8, 'yes');";
73
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_error', 'Y', '3', 'An error has occurred when processing your poll.', '20', '8', 'Template For Poll When An Error Has Occured', '8', 'yes');";
74
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_currentpoll', 'Y', 3, '0', 20, 8, 'Current Displayed Poll', 8, 'yes');";
75
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_latestpoll', 'Y', 3, '1', 20, 8, 'The Lastest Poll', 8, 'yes');";
76
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_archive_perpage', 'Y', 3, '5', 2, 8, 'Number Of Polls To Display Per Page On The Poll''s Archive', 8, 'no');";
77
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_sortby', 'Y', 1, 'polla_aid', 20, 8, 'Sorting Of Poll''s Answers', 8, 'yes');";
78
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_sortorder', 'Y', 1, 'asc', 20, 8, 'Sort Order Of Poll''s Answers', 8, 'yes');";
79
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_result_sortby', 'Y', 1, 'polla_votes', 20, 8, 'Sorting Of Poll''s Answers Result', 8, 'yes');";
80
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_result_sortorder', 'Y', 1, 'desc', 20, 8, 'Sorting Order Of Poll''s Answers Result', 8, 'yes');";
81
-
82
- ### Check Whether There Is Any Pre Errors
83
- $wpdb->show_errors = false;
84
- $check_install = $wpdb->query("SHOW COLUMNS FROM $wpdb->pollsq");
85
- if($check_install) {
86
- $error = __('You Had Already Installed WP-Polls.');
87
- }
88
- if(empty($wpdb->pollsq) || empty($wpdb->pollsa) || empty($wpdb->pollsip)) {
89
- $error = __('Please Define The pollsq, pollsa and pollsip in wp-settings.php.');
90
- }
91
- ?>
92
-
93
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
94
- <html xmlns="http://www.w3.org/1999/xhtml">
95
- <head>
96
- <title>WordPress &rsaquo; <?php _e('Installing'); ?> &rsaquo; <?php _e('WP-Polls'); ?></title>
97
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
98
- <style type="text/css" media="screen">
99
- @import url( wp-admin.css );
100
- </style>
101
- </head>
102
- <body>
103
- <div class="wrap">
104
- <h2><?php _e('Install WP-Polls'); ?></h2>
105
- <p><?php _e('This install script will install WP-Polls for your Wordpress'); ?>.</p>
106
- <p>
107
- <?php _e('This install script will be doing the following:'); ?><br />
108
- <b>&raquo;</b> <b>3</b> <?php _e('tables will be created namely <b>pollsq</b>, <b>pollsa</b> and <b>pollsip</b>.'); ?><br />
109
- <b>&raquo;</b> <b>1</b> <?php _e('poll question (<b>How Is My Site?</b>) will be inserted into <b>pollsq</b> table.'); ?><br />
110
- <b>&raquo;</b> <b>5</b> <?php _e('poll answers(<b>Good</b>, <b>Excellent</b>, <b>Bad</b>, <b>Can Be Improved</b>, <b>No Comments</b>) will be inserted into <b>pollsa</b> table.'); ?><br />
111
- <b>&raquo;</b> <b>15</b> <?php _e('options will be inserted into the <b>options</b> table.'); ?><br />
112
- <b>&raquo;</b> <b>4</b> <?php _e('tables will be optimized namely <b>pollsq</b>, <b>pollsa</b>, <b>pollsip</b> and <b>options</b>.'); ?><br />
113
- </p>
114
- <?php
115
- if(empty($error)) {
116
- if(!empty($_POST['install'])) {
117
- // Create Tables
118
- $create_table_count = 0;
119
- echo "<p><b>".__('Creating Tables:')."</b>";
120
- foreach($create_table as $createtable) {
121
- $wpdb->query($createtable);
122
- }
123
- $check_pollsq = $wpdb->query("SHOW COLUMNS FROM $wpdb->pollsq");
124
- $check_pollsa = $wpdb->query("SHOW COLUMNS FROM $wpdb->pollsa");
125
- $check_pollsip = $wpdb->query("SHOW COLUMNS FROM $wpdb->pollsip");
126
- if($check_pollsq) {
127
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsq</b>) created.";
128
- $create_table_count++;
129
- } else {
130
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsq</b>) table NOT created.</font>";
131
- }
132
- if($check_pollsa) {
133
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsa</b>) created.";
134
- $create_table_count++;
135
- } else {
136
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsa</b>) table NOT created.</font>";
137
- }
138
- if($check_pollsip) {
139
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsip</b>) created.";
140
- $create_table_count++;
141
- } else {
142
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsip</b>) table NOT created.</font>";
143
- }
144
- echo "<br /><b>&raquo;</b> <b>$create_table_count / 3</b> Tables Created.</p>";
145
- // Insert Poll Questions
146
- $insert_pollq_count = 0;
147
- echo "<p><b>".__('Inserting Poll Questions:')."</b>";
148
- foreach($insert_pollq as $insertpollq) {
149
- $temp_pollq = $wpdb->query($insertpollq);
150
- $temp_poll_question = explode("VALUES ", $insertpollq);
151
- $temp_poll_question = $temp_poll_question[1];
152
- $temp_poll_question = substr($temp_poll_question, 5, -20);
153
- if($temp_pollq) {
154
- echo "<br /><b>&raquo;</b> Poll question (<b>$temp_poll_question</b>) inserted.";
155
- $insert_pollq_count ++;
156
- } else {
157
- echo "<br /><b>&raquo;</b> <font color=\"red\">Poll question (<b>$temp_poll_question</b>) NOT inserted.</font>";
158
- }
159
- }
160
- echo "<br /><b>&raquo;</b> <b>$insert_pollq_count / 1</b> Poll Questions Inserted.</p>";
161
- // Insert Poll Answers
162
- $insert_polla_count = 0;
163
- echo "<p><b>".__('Inserting Poll Answers:')."</b>";
164
- foreach($insert_polla as $insertpolla) {
165
- $temp_polla = $wpdb->query($insertpolla);
166
- $temp_poll_answer = explode("VALUES ", $insertpolla);
167
- $temp_poll_answer = $temp_poll_answer[1];
168
- $temp_poll_answer = substr($temp_poll_answer, 8, -6);
169
- if($temp_polla) {
170
- echo "<br /><b>&raquo;</b> Poll answer (<b>$temp_poll_answer</b>) inserted.";
171
- $insert_polla_count ++;
172
- } else {
173
- echo "<br /><b>&raquo;</b> <font color=\"red\">Poll answer (<b>$temp_poll_answer</b>) NOT inserted.</font>";
174
- }
175
- }
176
- echo "<br /><b>&raquo;</b> <b>$insert_polla_count / 5</b> Poll Answers Inserted.</p>";
177
- // Insert Options
178
- $insert_options_count = 0;
179
- echo "<p><b>".__('Inserting Options:')."</b>";
180
- foreach($insert_options as $insertoptions) {
181
- $temp_options = $wpdb->query($insertoptions);
182
- $temp_option = explode(" ", $insertoptions);
183
- $temp_option = $temp_option[6];
184
- $temp_option = substr($temp_option, 1, -2);
185
- if($temp_options) {
186
- echo "<br /><b>&raquo;</b> Option (<b>$temp_option</b>) inserted.";
187
- $insert_options_count ++;
188
- } else {
189
- echo "<br /><b>&raquo;</b> <font color=\"red\">Option (<b>$temp_option</b>) NOT inserted.</font>";
190
- }
191
- }
192
- echo "<br /><b>&raquo;</b> <b>$insert_options_count / 16</b> Options Inserted.</p>";
193
- // Optimize Tables
194
- $optimize_table_count = 0;
195
- echo "<p><b>".__('Optimizing Tables:')."</b>";
196
- $optimize_tables = $wpdb->query("OPTIMIZE TABLE $wpdb->pollsq, $wpdb->pollsa, $wpdb->pollsip, $wpdb->options");
197
- if($optimize_tables) {
198
- echo "<br /><b>&raquo;</b> Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) optimized.";
199
- $optimize_table_count = 4;
200
- } else {
201
- echo "<br /><b>&raquo;</b> <font color=\"red\">Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) NOT optimized.</font>";
202
- }
203
- echo "<br /><b>&raquo;</b> <b>$optimize_table_count / 4</b> Tables Optimized.</p>";
204
- // Check Whether Install Is Successful
205
- if($create_table_count == 3 && $insert_pollq_count == 1 && $insert_polla_count == 5 && $insert_options_count == 16) {
206
- echo '<p align="center"><b>'.__('WP-Polls Installed Successfully.').'</b><br />'.__('Please remember to delete this file before proceeding on.').'</p>';
207
- }
208
- } else {
209
- ?>
210
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
211
- <div align="center"><input type="submit" name="install" value="<?php _e('Click Here To Install WP-Polls'); ?>" class="button"></div>
212
- </form>
213
- <?php
214
- }
215
- } else {
216
- echo "<p align=\"center\"><font color=\"red\"><b>$error</b></font></p>\n";
217
- }
218
- ?>
219
- </div>
220
- </body>
221
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls-manager.php DELETED
@@ -1,559 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - CManage Your Polls |
14
- | - wp-admin/polls-manager.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Admin
21
- require_once('admin.php');
22
-
23
- ### Variables Variables Variables
24
- $title = __('Manage Polls');
25
- $this_file = $parent_file = 'polls-manager.php';
26
- $mode = trim($_GET['mode']);
27
- $poll_id = intval($_GET['id']);
28
- $poll_aid = intval($_GET['aid']);
29
-
30
- ### Magic Quotes GPC
31
- if (get_magic_quotes_gpc()) {
32
- function traverse(&$arr) {
33
- if(!is_array($arr))
34
- return;
35
- foreach($arr as $key => $val)
36
- is_array($arr[$key]) ? traverse($arr[$key]) : ($arr[$key] = stripslashes($arr[$key]));
37
- }
38
- $gpc = array(&$_GET, &$_POST, &$_COOKIE);
39
- traverse($gpc);
40
- }
41
-
42
- ### Cancel
43
- if(isset($_POST['cancel'])) {
44
- Header('Location: polls-manager.php');
45
- exit();
46
- }
47
-
48
- ### Form Processing
49
- if(!empty($_POST['do'])) {
50
- // Decide What To Do
51
- switch($_POST['do']) {
52
- // Add Poll
53
- case 'Add Poll':
54
- // Add Poll Question
55
- $pollq_question = addslashes(trim($_POST['pollq_question']));
56
- $pollq_timestamp = current_time('timestamp');
57
- $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsq VALUES (0, '$pollq_question', '$pollq_timestamp', 0)");
58
- if(!$add_poll_question) {
59
- $text .= '<font color="red">Error In Adding Poll \''.stripslashes($pollq_question).'\'</font>';
60
- }
61
- // Add Poll Answers
62
- $polla_answers = $_POST['polla_answers'];
63
- $polla_qid = intval($wpdb->insert_id);
64
- foreach($polla_answers as $polla_answer) {
65
- $polla_answer = addslashes(trim($polla_answer));
66
- $add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answer', 0)");
67
- if(!$add_poll_answers) {
68
- $text .= '<font color="red">Error In Adding Poll\'s Answer \''.stripslashes($polla_answer).'\'</font>';
69
- }
70
- }
71
- // Update Lastest Poll ID To Poll Options
72
- $update_latestpoll = $wpdb->query("UPDATE $wpdb->options SET option_value = $polla_qid WHERE option_name = 'poll_latestpoll'");
73
- if(!$update_latestpoll) {
74
- $text .= "<font color=\"red\">There Is An Error Updating The Lastest Poll ID ($polla_qid) To The Poll Option</font>";
75
- }
76
- if(empty($text)) {
77
- $text = '<font color="green">Poll \''.stripslashes($pollq_question).'\' Added Successfully</font>';
78
- }
79
- break;
80
- // Edit Poll
81
- case 'Edit Poll':
82
- // Update Poll's Question
83
- $pollq_id = intval($_POST['pollq_id']);
84
- $pollq_totalvotes = intval($_POST['pollq_totalvotes']);
85
- $pollq_question = addslashes(trim($_POST['pollq_question']));
86
- $edit_poll_question = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_question = '$pollq_question', pollq_totalvotes = $pollq_totalvotes WHERE pollq_id = $pollq_id");
87
- if(!$edit_poll_question) {
88
- $text = '<font color="blue">No Changes Had Been Made To \''.stripslashes($pollq_question).'\'</font>';
89
- }
90
- // Update Polls' Answers
91
- $polla_aids = array();
92
- $get_polla_aids = $wpdb->get_results("SELECT polla_aid FROM $wpdb->pollsa WHERE polla_qid = $pollq_id ORDER BY polla_aid ASC");
93
- if($get_polla_aids) {
94
- foreach($get_polla_aids as $get_polla_aid) {
95
- $polla_aids[] = intval($get_polla_aid->polla_aid);
96
- }
97
- foreach($polla_aids as $polla_aid) {
98
- $polla_answers = addslashes(trim($_POST['polla_aid-'.$polla_aid]));
99
- $edit_poll_answer = $wpdb->query("UPDATE $wpdb->pollsa SET polla_answers = '$polla_answers' WHERE polla_qid = $pollq_id AND polla_aid = $polla_aid");
100
- if(!$edit_poll_answer) {
101
- $text .= '<br /><font color="blue">No Changes Had Been Made To Poll\'s Answer \''.stripslashes($polla_answers).'\'</font>';
102
- }
103
- }
104
- } else {
105
- $text .= '<br /><font color="red">Invalid Poll \''.stripslashes($pollq_question).'\'</font>';
106
- }
107
- if(empty($text)) {
108
- $text = '<font color="green">Poll \''.stripslashes($pollq_question).'\' Edited Successfully</font>';
109
- }
110
- break;
111
- // Delete Poll
112
- case 'Delete Poll':
113
- $pollq_id = intval($_POST['pollq_id']);
114
- $pollq_question = trim($_POST['pollq_question']);
115
- $delete_poll_question = $wpdb->query("DELETE FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
116
- $delete_poll_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_qid = $pollq_id");
117
- $delete_poll_ip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
118
- $poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
119
- if(!$delete_poll_question) {
120
- $text = '<font color="red">Error In Deleting Poll \''.stripslashes($pollq_question).'\' Question</font>';
121
- }
122
- if(!$delete_poll_answers) {
123
- $text .= '<br /><font color="red">Error In Deleting Poll Answers For \''.stripslashes($pollq_question).'\'</font>';
124
- }
125
- if(!$delete_poll_ip) {
126
- $text .= '<br /><font color="red">Error In Deleting Voted IPs For \''.stripslashes($pollq_question).'\'</font>';
127
- }
128
- if(empty($text)) {
129
- if($poll_option_lastestpoll == $pollq_id) {
130
- $poll_lastestpoll = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq ORDER BY pollq_id DESC LIMIT 1");
131
- if($poll_lastestpoll) {
132
- $poll_lastestpoll = intval($poll_lastestpoll);
133
- $update_latestpoll = $wpdb->query("UPDATE $wpdb->options SET option_value = $poll_lastestpoll WHERE option_name = 'poll_latestpoll'");
134
- }
135
- }
136
- $text = '<font color="green">Poll \''.stripslashes($pollq_question).'\' Deleted Successfully</font>';
137
- }
138
- break;
139
- // Add Poll's Answer
140
- case 'Add Answer':
141
- $polla_qid = intval($_POST['polla_qid']);
142
- $polla_answers = addslashes(trim($_POST['polla_answers']));
143
- $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answers', 0)");
144
- if(!$add_poll_question) {
145
- $text = '<font color="red">Error In Adding Poll Answer \''.stripslashes($polla_answers).'\'</font>';
146
- } else {
147
- $text = '<font color="green">Poll Answer \''.stripslashes($polla_answers).'\' Added Successfully</font>';
148
- }
149
- break;
150
- }
151
- }
152
-
153
-
154
- ### Determines Which Mode It Is
155
- switch($mode) {
156
- // Add A Poll
157
- case 'add':
158
- $title = __('Add Poll');
159
- $standalone = 0;
160
- require("./admin-header.php");
161
- if ($user_level < 8) {
162
- die(__('Access Denied: Insufficient Access'));
163
- }
164
- ?>
165
- <ul id="adminmenu2">
166
- <li><a href="polls-manager.php"><?php _e('Manage Polls'); ?></a></li>
167
- <li><a href="polls-manager.php?mode=add" class="current"><?php _e('Add Poll'); ?></a></li>
168
- <li class="last"><a href="polls-options.php"><?php _e('Polls Options'); ?></a></li>
169
- </ul>
170
- <div class="wrap">
171
- <h2>Add Poll</h2>
172
- <?php
173
- if(isset($_POST['addpollquestion'])) {
174
- $poll_noquestion = intval($_POST['poll_noquestion']);
175
- $pollq_question = stripslashes(trim($_POST['pollq_question']));
176
- ?>
177
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
178
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
179
- <tr>
180
- <th align="left" scope="row"><?php _e('Question') ?></th>
181
- <td><input type="text" size="50" maxlength="200" name="pollq_question" value="<?php echo $pollq_question; ?>"></td>
182
- <?php
183
- for($i=1; $i<=$poll_noquestion; $i++) {
184
- echo "<tr>\n";
185
- echo "<th align=\"left\" scope=\"row\">Answers $i:</th>\n";
186
- echo "<td><input type=\"text\" size=\"30\" maxlength=\"200\" name=\"polla_answers[]\"></td>\n";
187
- echo "</tr>\n";
188
- }
189
- ?>
190
- </tr>
191
- <tr>
192
- <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Add Poll'); ?>" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="<?php _e('Cancel'); ?>" class="button"></td>
193
- </tr>
194
- </table>
195
- </form>
196
- <?php } else {?>
197
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>?mode=add" method="post">
198
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
199
- <tr>
200
- <th align="left" scope="row"><?php _e('Question') ?></th>
201
- <td><input type="text" size="50" maxlength="200" name="pollq_question"></td>
202
- </tr>
203
- <th align="left" scope="row"><?php _e('No. Of Answers:') ?></th>
204
- <td>
205
- <select size="1" name="poll_noquestion">
206
- <?php
207
- for($i=2; $i <= 20; $i++) {
208
- echo "<option value=\"$i\">$i</option>";
209
- }
210
- ?>
211
- </select>
212
- </td>
213
- </tr>
214
- <tr>
215
- <td colspan="2" align="center"><input type="submit" name="addpollquestion" value="<?php _e('Add Question'); ?>" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="<?php _e('Cancel'); ?>" class="button"></td>
216
- </tr>
217
- </table>
218
- </form>
219
- <?php } ?>
220
- </div>
221
- <?php
222
- break;
223
- // Edit A Poll
224
- case 'edit':
225
- $title = __('Edit Poll');
226
- $standalone = 0;
227
- require("./admin-header.php");
228
- if ($user_level < 8) {
229
- die(__('Access Denied: Insufficient Access'));
230
- }
231
- $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_totalvotes FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
232
- $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");
233
- $poll_question_text = stripslashes($poll_question->pollq_question);
234
- $poll_totalvotes = intval($poll_question->pollq_totalvote);
235
- ?>
236
- <ul id="adminmenu2">
237
- <li><a href="polls-manager.php" class="current"><?php _e('Manage Polls'); ?></a></li>
238
- <li><a href="polls-manager.php?mode=add"><?php _e('Add Poll'); ?></a></li>
239
- <li class="last"><a href="polls-options.php"><?php _e('Polls Options'); ?></a></li>
240
- </ul>
241
- <!-- Edit Poll -->
242
- <div class="wrap">
243
- <h2><?php _e('Edit Poll'); ?></h2>
244
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
245
- <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>">
246
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
247
- <tr>
248
- <th scope="row" colspan="2"><?php _e('Question') ?></th>
249
- </tr>
250
- <tr>
251
- <td align="center" colspan="2"><input type="text" size="70" maxlength="200" name="pollq_question" value="<?php echo $poll_question_text; ?>" /></td>
252
- </tr>
253
- <tr>
254
- <th align="left" scope="row"><?php _e('Answers:') ?></th>
255
- <th align="right" scope="row"><?php _e('No. Of Votes') ?></th>
256
- </tr>
257
- <?php
258
- $i=1;
259
- $poll_actual_totalvotes = 0;
260
- if($poll_answers) {
261
- $pollip_answers = array();
262
- $pollip_answers[0] = __('Null Votes');
263
- foreach($poll_answers as $poll_answer) {
264
- $polla_aid = intval($poll_answer->polla_aid);
265
- $polla_answers = stripslashes($poll_answer->polla_answers);
266
- $polla_votes = intval($poll_answer->polla_votes);
267
- $pollip_answers[$polla_aid] = $polla_answers;
268
- echo "<tr>\n";
269
- echo "<td align=\"left\">".__('Answer')." $i:&nbsp;&nbsp;&nbsp;<input type=\"text\" size=\"50\" maxlength=\"200\" name=\"polla_aid-$polla_aid\" value=\"$polla_answers\">&nbsp;&nbsp;&nbsp;";
270
- echo "<a href=\"polls-manager.php?mode=deleteans&id=$poll_id&aid=$polla_aid\" onclick=\"return confirm('You Are About To Delete This Poll Answer \'$polla_answers\'\\n \'Cancel\' to stop, \'OK\' to delete.')\">Delete</a></td>\n";
271
- echo "<td align=\"right\">$polla_votes</td>\n</tr>\n";
272
- $poll_actual_totalvotes += $polla_votes;
273
- $i++;
274
- }
275
- }
276
- ?>
277
- </tr>
278
- <tr>
279
- <td align="right" colspan="2"><b><?php _e('Total Votes'); ?>: <?php echo $poll_actual_totalvotes; ?></b>&nbsp;&nbsp;&nbsp;<input type="text" size="4" maxlength="4" name="pollq_totalvotes" value="<?php echo $poll_actual_totalvotes; ?>"></td>
280
- </tr>
281
- <tr>
282
- <td align="center" colspan="2"><input type="submit" name="do" value="<?php _e('Edit Poll'); ?>" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="<?php _e('Cancel'); ?>" class="button"></td>
283
- </tr>
284
- </table>
285
- </form>
286
- </div>
287
- <!-- Add Poll's Answer -->
288
- <div class="wrap">
289
- <h2><?php _e('Add Answer') ?></h2>
290
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>?mode=edit&id=<?php echo $poll_id; ?>" method="post">
291
- <input type="hidden" name="polla_qid" value="<?php echo $poll_id; ?>">
292
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
293
- <tr>
294
- <td><b><?php _e('Add Answer') ?></b></td>
295
- <td><input type="text" size="50" maxlength="200" name="polla_answers"></td>
296
- </tr>
297
- <tr>
298
- <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Add Answer'); ?>" class="button"></td>
299
- </tr>
300
- </table>
301
- </form>
302
- </div>
303
- <!-- Users Voted For This Poll -->
304
- <?php
305
- $poll_ips = $wpdb->get_results("SELECT pollip_aid, pollip_ip, pollip_host, pollip_timestamp, pollip_user FROM $wpdb->pollsip WHERE pollip_qid = $poll_id ORDER BY pollip_aid ASC, pollip_user ASC");
306
- ?>
307
- <div class="wrap">
308
- <h2><?php _e('Users Voted For This Poll') ?></h2>
309
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
310
- <?php
311
- if($poll_ips) {
312
- $k = 1;
313
- $poll_last_aid = -1;
314
- foreach($poll_ips as $poll_ip) {
315
- $pollip_aid = intval($poll_ip->pollip_aid);
316
- $pollip_user = stripslashes($poll_ip->pollip_user);
317
- $pollip_ip = $poll_ip->pollip_ip;
318
- $pollip_host = $poll_ip->pollip_host;
319
- $pollip_date = date("jS F Y @ H:i", $poll_ip->pollip_timestamp);
320
- if($pollip_aid != $poll_last_aid) {
321
- if($pollip_aid == 0) {
322
- echo "<tr style='background-color: #b8d4ff'>\n<td colspan=\"4\"><b>$pollip_answers[$pollip_aid]</b></td>\n</tr>\n";
323
- } else {
324
- echo "<tr style='background-color: #b8d4ff'>\n<td colspan=\"4\"><b>".__('Answer')." $k: $pollip_answers[$pollip_aid]</b></td>\n</tr>\n";
325
- $k++;
326
- }
327
- echo "<tr>\n";
328
- echo "<th scope=\"row\">".__('No.')."</th>\n";
329
- echo "<th scope=\"row\">".__('User')."</th>\n";
330
- echo "<th scope=\"row\">".__('IP/Host')."</th>\n";
331
- echo "<th scope=\"row\">".__('Date')."</th>\n";
332
- echo "</tr>\n";
333
- $i = 1;
334
- }
335
- if($i%2 == 0) {
336
- $style = 'style=\'background-color: none\'';
337
- } else {
338
- $style = 'style=\'background-color: #eee\'';
339
- }
340
- echo "<tr $style>\n";
341
- echo "<td>$i</td>\n";
342
- echo "<td>$pollip_user</td>\n";
343
- echo "<td>$pollip_ip / $pollip_host</td>\n";
344
- echo "<td>$pollip_date</td>\n";
345
- echo "</tr>\n";
346
- $poll_last_aid = $pollip_aid;
347
- $i++;
348
- }
349
- } else {
350
- echo "<tr>\n<td colspan=\"4\" align=\"center\">".__('No IP Has Been Logged Yet.')."</td>\n</tr>\n";
351
- }
352
- ?>
353
- </table>
354
- </div>
355
- <?php
356
- break;
357
- // Delete A Poll
358
- case 'delete':
359
- $title = __('Delete Poll');
360
- $standalone = 0;
361
- require("./admin-header.php");
362
- if ($user_level < 8) {
363
- die(__('Access Denied: Insufficient Access'));
364
- }
365
- $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_totalvotes FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
366
- $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_id ORDER BY polla_answers");
367
- $poll_question_text = stripslashes($poll_question->pollq_question);
368
- $poll_totalvotes = intval($poll_question->pollq_totalvotes);
369
- ?>
370
- <ul id="adminmenu2">
371
- <li><a href="polls-manager.php" class="current"><?php _e('Manage Polls'); ?></a></li>
372
- <li><a href="polls-manager.php?mode=add"><?php _e('Add Poll'); ?></a></li>
373
- <li class="last"><a href="polls-options.php"><?php _e('Polls Options'); ?></a></li>
374
- </ul>
375
- <!-- Delete Poll -->
376
- <div class="wrap">
377
- <h2><?php _e('Delete Poll') ?></h2>
378
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
379
- <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>">
380
- <input type="hidden" name="pollq_question" value="<?php echo $poll_question_text; ?>">
381
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
382
- <tr>
383
- <th colspan="2" scope="row"><?php _e('Question') ?></th>
384
- </tr>
385
- <tr>
386
- <td colspan="2" align="center"><?php echo $poll_question_text; ?></td>
387
- </tr>
388
- <tr>
389
- <th align="left" scope="row"><?php _e('Answers') ?></th>
390
- <th scope="row"><?php _e('No. Of Votes') ?></th>
391
- </tr>
392
- <?php
393
- $i=1;
394
- if($poll_answers) {
395
- foreach($poll_answers as $poll_answer) {
396
- $polla_answers = stripslashes($poll_answer->polla_answers);
397
- $polla_votes = intval($poll_answer->polla_votes);
398
- echo "<tr>\n";
399
- echo "<td>".__('Answer')." $i:&nbsp;&nbsp;&nbsp;$polla_answers</td>\n";
400
- echo "<td align=\"center\">$polla_votes</td>\n</tr>\n";
401
- $i++;
402
- }
403
- }
404
- ?>
405
- </tr>
406
- <tr>
407
- <th colspan="2" scope="row"><?php _e('Total Votes'); ?>: <?php echo $poll_totalvotes; ?></th>
408
- </tr>
409
- <tr>
410
- <td align="center" colspan="2"><br /><p><b><?php _e('You Are About To Delete This Poll'); ?> '<?php echo $poll_question_text; ?>'</b></p><input type="submit" class="button" name="do" value="<?php _e('Delete Poll'); ?>" onclick="return confirm('You Are About To The Delete This Poll \'<?php echo $poll_question_text; ?>\'.\nThis Action Is Not Reversible.\n\n Choose \'Cancel\' to stop, \'OK\' to delete.')">&nbsp;&nbsp;<input type="submit" name="cancel" Value="<?php _e('Cancel'); ?>" class="button"></td>
411
- </tr>
412
- </table>
413
- </form>
414
- </div>
415
- <?php
416
- break;
417
- // Delete A Poll Answer
418
- case 'deleteans':
419
- $title = __('Delete Poll\'s Answer');
420
- $standalone = 0;
421
- require("./admin-header.php");
422
- if ($user_level < 8) {
423
- die(__('Access Denied: Insufficient Access'));
424
- }
425
- $poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");
426
- $polla_votes = intval($poll_answers->polla_votes);
427
- $polla_answers = stripslashes(trim($poll_answers->polla_answers));
428
- $delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");
429
- $update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id=$poll_id");
430
- ?>
431
- <ul id="adminmenu2">
432
- <li><a href="polls-manager.php" class="current"><?php _e('Manage Polls'); ?></a></li>
433
- <li><a href="polls-manager.php?mode=add"><?php _e('Add Poll'); ?></a></li>
434
- <li class="last"><a href="polls-options.php"><?php _e('Polls Options'); ?></a></li>
435
- </ul>
436
- <!-- Delete Poll's Answer -->
437
- <div class="wrap">
438
- <h2><?php _e('Delete Poll\'s Answer') ?></h2>
439
- <?php
440
- if($delete_polla_answers) {
441
- $text = "<font color=\"green\">Poll Answer '$polla_answers' Deleted Successfully</font>";
442
- } else {
443
- $text = "<font color=\"red\">Error In Deleting Poll Answer '$polla_answers'</font>";
444
- }
445
- if($update_pollq_totalvotes) {
446
- $text .= "<br /><font color=\"green\">Poll Question's Total Votes Updated Successfully</font>";
447
- } else {
448
- $text .= "<br /><font color=\"blue\">No Changes Had Been Made To The Poll's Total Votes</font>";
449
- }
450
- _e($text);
451
- ?>
452
- <p><b><a href="polls-manager.php?mode=edit&id=<?php echo $poll_id; ?>"><?php _e('Click here To Go Back To The Poll Edit Page'); ?></a>.</b></p>
453
- </div>
454
- <?php
455
- break;
456
- // Main Page
457
- default:
458
- $title = __('Manage Polls');
459
- $standalone = 0;
460
- require("./admin-header.php");
461
- if ($user_level < 8) {
462
- die(__('Access Denied: Insufficient Access'));
463
- }
464
- $polls = $wpdb->get_results("SELECT * FROM $wpdb->pollsq ORDER BY pollq_id DESC");
465
- $total_ans = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pollsa");
466
- $total_votes = 0;
467
- ?>
468
- <ul id="adminmenu2">
469
- <li><a href="polls-manager.php" class="current"><?php _e('Manage Polls'); ?></a></li>
470
- <li><a href="polls-manager.php?mode=add"><?php _e('Add Poll'); ?></a></li>
471
- <li class="last"><a href="polls-options.php"><?php _e('Polls Options'); ?></a></li>
472
- </ul>
473
- <?php if(!empty($text)) { echo '<!-- Last Action --><div class="wrap"><h2>'.__('Last Action').'</h2>'.__($text).'</div>'; } ?>
474
- <!-- Manage Polls -->
475
- <div class="wrap">
476
- <h2><?php _e('Manage Polls'); ?></h2>
477
- <table width="100%" border="0" cellspacing="3" cellpadding="3">
478
- <tr>
479
- <th scope="col"><?php _e('ID'); ?></b></th>
480
- <th scope="col"><?php _e('Question'); ?></b></th>
481
- <th scope="col"><?php _e('Total Votes'); ?></b></th>
482
- <th scope="col"><?php _e('Date Added'); ?></b></th>
483
- <th scope="col" colspan="2"><?php _e('Action'); ?></th>
484
- </tr>
485
- <?php
486
- if($polls) {
487
- $i = 0;
488
- $current_poll = intval(get_settings('poll_currentpoll'));
489
- foreach($polls as $poll) {
490
- $poll_id = intval($poll->pollq_id);
491
- $poll_question = stripslashes($poll->pollq_question);
492
- $poll_date = date("jS F Y @ H:i", $poll->pollq_timestamp);
493
- $poll_totalvotes = intval($poll->pollq_totalvotes);
494
- if($i%2 == 0) {
495
- $style = 'style=\'background-color: #eee\'';
496
- } else {
497
- $style = 'style=\'background-color: none\'';
498
- }
499
- if($current_poll > 0) {
500
- if($current_poll == $poll_id) {
501
- $style = 'style=\'background-color: #b8d4ff\'';
502
- }
503
- } else {
504
- if($i == 0) {
505
- $style = 'style=\'background-color: #b8d4ff\'';
506
- }
507
- }
508
- echo "<tr $style>\n";
509
- echo "<td><b>$poll_id</b></td>\n";
510
- echo '<td>';
511
- if($current_poll > 0) {
512
- if($current_poll == $poll_id) {
513
- echo '<b>'.__('Displayed:').'</b> ';
514
- }
515
- } elseif($current_poll != -1) {
516
- if($i == 0) {
517
- echo '<b>'.__('Displayed:').'</b> ';
518
- }
519
- }
520
- echo "$poll_question</td>\n";
521
- echo "<td>$poll_totalvotes</td>\n";
522
- echo "<td>$poll_date</td>\n";
523
- echo "<td><a href=\"polls-manager.php?mode=edit&id=$poll_id\" class=\"edit\">".__('Edit')."</a></td>\n";
524
- echo "<td><a href=\"polls-manager.php?mode=delete&id=$poll_id\" class=\"delete\">".__('Delete')."</a></td>\n";
525
- echo '</tr>';
526
- $i++;
527
- $total_votes+= $poll_totalvotes;
528
-
529
- }
530
- } else {
531
- echo '<tr><td colspan="6" align="center"><b>'.__('No Polls Found').'</b></td></tr>';
532
- }
533
- ?>
534
- </table>
535
- </div>
536
- <!-- Polls Stats -->
537
- <div class="wrap">
538
- <h2><?php _e('Polls Stats'); ?></h2>
539
- <table border="0" cellspacing="3" cellpadding="3">
540
- <tr>
541
- <th align="left" scope="row"><?php _e('Total Polls:'); ?></th>
542
- <td align="left"><?php echo $i; ?></td>
543
- </tr>
544
- <tr>
545
- <th align="left" scope="row"><?php _e('Total Polls\' Answers:'); ?></th>
546
- <td align="left"><?php echo number_format($total_ans); ?></td>
547
- </tr>
548
- <tr>
549
- <th align="left" scope="row"><?php _e('Total Votes Casted:'); ?></th>
550
- <td align="left"><?php echo number_format($total_votes); ?></td>
551
- </tr>
552
- </table>
553
- </div>
554
- <?php
555
- } // End switch($mode)
556
-
557
- ### Require Admin Footer
558
- require_once 'admin-footer.php';
559
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls-options.php DELETED
@@ -1,384 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Configure Poll Options |
14
- | - wp-admin/polls-options.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Admin
21
- require_once('admin.php');
22
-
23
- ### Variables Variables Variables
24
- $title = __('Poll Options');
25
- $this_file = $parent_file = 'polls-options.php';
26
- $id = intval($_GET['id']);
27
- $standalone = 0;
28
-
29
- ### Require Admin Header
30
- require("./admin-header.php");
31
-
32
- ### If User Less Than 8, Don't Let Him Pass
33
- if ($user_level < 8) {
34
- die(__('Access Denied: Insufficient Access'));
35
- }
36
-
37
- ### Magic Quotes GPC
38
- if (get_magic_quotes_gpc()) {
39
- function traverse(&$arr) {
40
- if(!is_array($arr))
41
- return;
42
- foreach($arr as $key => $val)
43
- is_array($arr[$key]) ? traverse($arr[$key]) : ($arr[$key] = stripslashes($arr[$key]));
44
- }
45
- $gpc = array(&$_GET, &$_POST, &$_COOKIE);
46
- traverse($gpc);
47
- }
48
-
49
- ### If Form Is Submitted
50
- if($_POST['Submit']) {
51
- $poll_ans_sortby = addslashes(strip_tags(trim($_POST['poll_ans_sortby'])));
52
- $poll_ans_sortorder = addslashes(strip_tags(trim($_POST['poll_ans_sortorder'])));
53
- $poll_ans_result_sortby = addslashes(strip_tags(trim($_POST['poll_ans_result_sortby'])));
54
- $poll_ans_result_sortorder = addslashes(strip_tags(trim($_POST['poll_ans_result_sortorder'])));
55
- $poll_template_voteheader =addslashes(trim($_POST['poll_template_voteheader']));
56
- $poll_template_votebody = addslashes(trim($_POST['poll_template_votebody']));
57
- $poll_template_votefooter = addslashes(trim($_POST['poll_template_votefooter']));
58
- $poll_template_resultheader = addslashes(trim($_POST['poll_template_resultheader']));
59
- $poll_template_resultbody = addslashes(trim($_POST['poll_template_resultbody']));
60
- $poll_template_resultbody2 = addslashes(trim($_POST['poll_template_resultbody2']));
61
- $poll_template_resultfooter = addslashes(trim($_POST['poll_template_resultfooter']));
62
- $poll_template_disable =addslashes( trim($_POST['poll_template_disable']));
63
- $poll_template_error =addslashes( trim($_POST['poll_template_error']));
64
- $poll_archive_perpage = intval($_POST['poll_archive_perpage']);
65
- $poll_currentpoll = intval($_POST['poll_currentpoll']);
66
- $update_poll_queries = array();
67
- $update_poll_text = array();
68
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_ans_sortby' WHERE option_name = 'poll_ans_sortby'";
69
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_ans_sortorder' WHERE option_name = 'poll_ans_sortorder'";
70
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_ans_result_sortby' WHERE option_name = 'poll_ans_result_sortby'";
71
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_ans_result_sortorder' WHERE option_name = 'poll_ans_result_sortorder'";
72
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_voteheader' WHERE option_name = 'poll_template_voteheader'";
73
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_votebody' WHERE option_name = 'poll_template_votebody'";
74
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_votefooter' WHERE option_name = 'poll_template_votefooter'";
75
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_resultheader' WHERE option_name = 'poll_template_resultheader'";
76
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_resultbody' WHERE option_name = 'poll_template_resultbody'";
77
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_resultbody2' WHERE option_name = 'poll_template_resultbody2'";
78
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_resultfooter' WHERE option_name = 'poll_template_resultfooter'";
79
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_disable' WHERE option_name = 'poll_template_disable'";
80
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_template_error' WHERE option_name = 'poll_template_error'";
81
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_archive_perpage' WHERE option_name = 'poll_archive_perpage'";
82
- $update_poll_queries[] = "UPDATE $wpdb->options SET option_value = '$poll_currentpoll' WHERE option_name = 'poll_currentpoll'";
83
- $update_poll_text[] = __('Sort Poll Answers By Option');
84
- $update_poll_text[] = __('Sort Order Of Poll Answers Option');
85
- $update_poll_text[] = __('Sort Poll Results By Option');
86
- $update_poll_text[] = __('Sort Order Of Poll Results Option');
87
- $update_poll_text[] = __('Voting Form Header Template');
88
- $update_poll_text[] = __('Voting Form Body Template');
89
- $update_poll_text[] = __('Voting Form Footer Template');
90
- $update_poll_text[] = __('Result Header Template');
91
- $update_poll_text[] = __('Result Body Template');
92
- $update_poll_text[] = __('Result Body2 Template');
93
- $update_poll_text[] = __('Result Footer Template');
94
- $update_poll_text[] = __('Poll Disabled Template');
95
- $update_poll_text[] = __('Poll Error Template');
96
- $update_poll_text[] = __('Archive Polls Per Page Option');
97
- $update_poll_text[] = __('Current Active Poll Option');
98
- $i=0;
99
- $text = '';
100
- foreach($update_poll_queries as $update_poll_query) {
101
- $updating = $wpdb->query($update_poll_query);
102
- if($updating) {
103
- $text .= '<font color="green">'.$update_poll_text[$i].' '.__('Updated').'</font><br />';
104
- }
105
- $i++;
106
- }
107
- if(empty($text)) {
108
- $text = '<font color="red">'.__('No Poll Option Updated').'</font>';
109
- }
110
- }
111
-
112
- ?>
113
- <script language="JavaScript" type="text/javascript">
114
- function poll_default_templates(template) {
115
- var default_template;
116
- switch(template) {
117
- case "voteheader":
118
- default_template = "<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n<tr>\n<td align=\"center\"><b>%POLL_QUESTION%</b></td>\n</tr>";
119
- break;
120
- case "votebody":
121
- default_template = "<tr>\n<td align=\"left\"><input type=\"radio\" name=\"poll-%POLL_ID%\" value=\"%POLL_ANSWER_ID%\" />&nbsp;%POLL_ANSWER%</td>\n</tr>";
122
- break;
123
- case "votefooter":
124
- default_template = "<tr>\n<td align=\"center\"><input type=\"submit\" name=\"vote\" value=\" Vote \" class=\"Buttons\" /><br /><a href=\"index.php?pollresult=1\">View Results</a></td>\n</tr>\n</table>";
125
- break;
126
- case "resultheader":
127
- default_template = "<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n<tr>\n<td colspan=\"2\" align=\"center\"><b>%POLL_QUESTION%</b></td>\n</tr>";
128
- break;
129
- case "resultbody":
130
- default_template = "<tr>\n<td align=\"left\" width=\"70%\">%POLL_ANSWER%<br /><img src=\"wp-images/pollbar.gif\" height=\"5\" width=\"%POLL_ANSWER_IMAGEWIDTH%\" alt=\"%POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\" /></td>\n<td align=\"right\" width=\"30%\"><b>%POLL_ANSWER_PERCENTAGE%%</b></td>\n</tr>";
131
- break;
132
- case "resultbody2":
133
- default_template = "<tr>\n<td align=\"left\" width=\"70%\"><i>%POLL_ANSWER%</i><br /><img src=\"wp-images/pollbar.gif\" height=\"5\" width=\"%POLL_ANSWER_IMAGEWIDTH%\" alt=\"You Have Voted For This Choice - %POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\" /></td>\n<td align=\"right\" width=\"30%\"><i><b>%POLL_ANSWER_PERCENTAGE%%</b></i></td>\n</tr>";
134
- break;
135
- case "resultfooter":
136
- default_template = "<tr>\n<td colspan=\"2\" align=\"center\">Total Votes: <b>%POLL_TOTALVOTES%</b><td>\n</tr>\n</table>";
137
- break;
138
- case "disable":
139
- default_template = 'Sorry, there are no polls available at the moment.';
140
- break;
141
- case "error":
142
- default_template = 'An error has occurred when processing your poll.';
143
- break;
144
- }
145
- document.getElementById("poll_template_" + template).value = default_template;
146
- }
147
-
148
- </script>
149
- <ul id="adminmenu2">
150
- <li><a href="polls-manager.php"><?php _e('Manage Polls'); ?></a></li>
151
- <li><a href="polls-manager.php?mode=add"><?php _e('Add Poll'); ?></a></li>
152
- <li class="last"><a href="polls-options.php" class="current"><?php _e('Poll Options'); ?></a></li>
153
- </ul>
154
- <?php if(!empty($text)) { echo '<!-- Last Action --><div class="wrap"><h2>'.__('Last Action').'</h2>'.$text.'</div>'; } ?>
155
- <div class="wrap">
156
- <h2><?php echo $title; ?></h2>
157
- <form name="polls_options" method="post" action="polls-options.php">
158
- <fieldset class="options">
159
- <legend><?php _e('Sorting Of Poll Answers'); ?></legend>
160
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
161
- <tr valign="top">
162
- <th scope="row" width="40%"><?php _e('Sort Poll Answers By:'); ?></th>
163
- <td>
164
- <select name="poll_ans_sortby" size="1">
165
- <option value="polla_aid"<?php selected('polla_aid', get_settings('poll_ans_sortby')); ?>><?php _e('Exact Order'); ?></option>
166
- <option value="polla_answers"<?php selected('polla_answers', get_settings('poll_ans_sortby')); ?>><?php _e('Alphabetical Order'); ?></option>
167
- </select>
168
- </td>
169
- </tr>
170
- <tr valign="top">
171
- <th scope="row" width="40%"><?php _e('Sort Order Of Poll Answers:'); ?></th>
172
- <td>
173
- <select name="poll_ans_sortorder" size="1">
174
- <option value="asc"<?php selected('asc', get_settings('poll_ans_sortorder')); ?>><?php _e('Ascending'); ?></option>
175
- <option value="desc"<?php selected('desc', get_settings('poll_ans_sortorder')); ?>><?php _e('Descending'); ?></option>
176
- </select>
177
- </td>
178
- </tr>
179
- </table>
180
- </fieldset>
181
- <fieldset class="options">
182
- <legend><?php _e('Sorting Of Poll Results'); ?></legend>
183
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
184
- <tr valign="top">
185
- <th scope="row" width="40%"><?php _e('Sort Poll Results By:'); ?></th>
186
- <td>
187
- <select name="poll_ans_result_sortby" size="1">
188
- <option value="polla_votes"<?php selected('polla_votes', get_settings('poll_ans_result_sortby')); ?>><?php _e('Votes'); ?></option>
189
- <option value="polla_aid"<?php selected('polla_aid', get_settings('poll_ans_result_sortby')); ?>><?php _e('Exact Order'); ?></option>
190
- <option value="polla_answers"<?php selected('polla_answers', get_settings('poll_ans_result_sortby')); ?>><?php _e('Alphabetical Order'); ?></option>
191
- </select>
192
- </td>
193
- </tr>
194
- <tr valign="top">
195
- <th scope="row" width="40%"><?php _e('Sort Order Of Poll Results:'); ?></th>
196
- <td>
197
- <select name="poll_ans_result_sortorder" size="1">
198
- <option value="asc"<?php selected('asc', get_settings('poll_ans_result_sortorder')); ?>><?php _e('Ascending'); ?></option>
199
- <option value="desc"<?php selected('desc', get_settings('poll_ans_result_sortorder')); ?>><?php _e('Descending'); ?></option>
200
- </select>
201
- </td>
202
- </tr>
203
- </table>
204
- </fieldset>
205
- <fieldset class="options">
206
- <legend><?php _e('Poll Archive'); ?></legend>
207
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
208
- <tr valign="top">
209
- <th scope="row" width="40%"><?php _e('Polls Per Page:'); ?></th>
210
- <td><input type="text" name="poll_archive_perpage" value="<?php form_option('poll_archive_perpage'); ?>" size="2" /></td>
211
- </tr>
212
- </table>
213
- </fieldset>
214
- <fieldset class="options">
215
- <legend><?php _e('Current Active Poll'); ?></legend>
216
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
217
- <tr valign="top">
218
- <th scope="row" width="40%"><?php _e('Current Active Poll:'); ?></th>
219
- <td>
220
- <select name="poll_currentpoll" size="1">
221
- <option value="-1"<?php selected('-1', get_settings('poll_currentpoll')); ?>><?php _e('Do NOT Display Poll (Disable)'); ?></option>
222
- <option value="0"<?php selected('0', get_settings('poll_currentpoll')); ?>><?php _e('Display Latest Poll'); ?></option>
223
- <option value="0"></option>
224
- <?php
225
- $polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
226
- if($polls) {
227
- foreach($polls as $poll) {
228
- $poll_question = stripslashes($poll->pollq_question);
229
- $poll_id = intval($poll->pollq_id);
230
- if($poll_id == intval(get_settings('poll_currentpoll'))) {
231
- echo "<option value=\"$poll_id\" selected=\"selected\">$poll_question</option>\n";
232
- } else {
233
- echo "<option value=\"$poll_id\">$poll_question</option>\n";
234
- }
235
- }
236
- }
237
- ?>
238
- </select>
239
- </td>
240
- </tr>
241
- </table>
242
- </fieldset>
243
- <fieldset class="options">
244
- <legend><?php _e('Template Variables'); ?></legend>
245
- <table width="100%" cellspacing="2" cellpadding="5" align="center">
246
- <tr>
247
- <td><b>%POLL_ID%</b> - <?php _e('Display the poll\'s ID'); ?></td>
248
- <td><b>%POLL_ANSWER_ID%</b> - <?php _e('Display the poll\'s answer ID'); ?></td>
249
- </tr>
250
- <tr>
251
- <td><b>%POLL_QUESTION%</b> - <?php _e('Display the poll\'s question'); ?></td>
252
- <td><b>%POLL_ANSWER%</b> - <?php _e('Display the poll\'s answer'); ?></td>
253
- </tr>
254
- <tr>
255
- <td><b>%POLL_TOTALVOTES%</b> - <?php _e('Display the poll\'s total votes'); ?></td>
256
- <td><b>%POLL_ANSWER_VOTES%</b> - <?php _e('Display the poll\'s answer votes'); ?></td>
257
- </tr>
258
- <tr>
259
- <td>&nbsp;</td>
260
- <td><b>%POLL_ANSWER_PERCENTAGE%</b> - <?php _e('Display the poll\'s answer percentage'); ?></td>
261
- </tr>
262
- <tr>
263
- <td>&nbsp;</td>
264
- <td><b>"%POLL_ANSWER_IMAGEWIDTH%</b> - <?php _e('Display the poll\'s answer image width'); ?></td>
265
- </tr>
266
- </table>
267
- </fieldset>
268
- <fieldset class="options">
269
- <legend><?php _e('Poll Voting Form Templates'); ?></legend>
270
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
271
- <tr valign="top">
272
- <td width="30%" align="left">
273
- <b><?php _e('Voting Form Header:'); ?></b><br /><br /><br />
274
- <?php _e('Allowed Variables:'); ?><br />
275
- - %POLL_ID%<br />
276
- - %POLL_QUESTION%<br />
277
- - %POLL_TOTALVOTES%<br /><br />
278
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('voteheader');" class="button" />
279
- </td>
280
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_voteheader" name="poll_template_voteheader"><?php echo stripslashes(get_settings('poll_template_voteheader')); ?></textarea></td>
281
- </tr>
282
- <tr valign="top">
283
- <td width="30%" align="left">
284
- <b><?php _e('Voting Form Body:'); ?></b><br /><br /><br />
285
- <?php _e('Allowed Variables:'); ?><br />
286
- - %POLL_ID%<br />
287
- - %POLL_ANSWER_ID%<br />
288
- - %POLL_ANSWER%<br />
289
- - %POLL_ANSWER_VOTES%<br /><br />
290
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('votebody');" class="button" />
291
- </td>
292
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_votebody" name="poll_template_votebody"><?php echo stripslashes(get_settings('poll_template_votebody')); ?></textarea></td>
293
- </tr>
294
- <tr valign="top">
295
- <td width="30%" align="left">
296
- <b><?php _e('Voting Form Footer:'); ?></b><br /><br /><br />
297
- <?php _e('Allowed Variables:'); ?><br />
298
- - N/A<br /><br />
299
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('votefooter');" class="button" />
300
- </td>
301
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_votefooter" name="poll_template_votefooter"><?php echo stripslashes(get_settings('poll_template_votefooter')); ?></textarea></td>
302
- </tr>
303
- </table>
304
- </fieldset>
305
- <fieldset class="options">
306
- <legend><?php _e('Poll Result Templates'); ?></legend>
307
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
308
- <tr valign="top">
309
- <td width="30%" align="left">
310
- <b><?php _e('Result Header:'); ?></b><br /><br /><br />
311
- <?php _e('Allowed Variables:'); ?><br />
312
- - %POLL_ID%<br />
313
- - %POLL_QUESTION%<br />
314
- - %POLL_TOTALVOTES%<br /><br />
315
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('resultheader');" class="button" />
316
- </td>
317
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_resultheader" name="poll_template_resultheader"><?php echo stripslashes(get_settings('poll_template_resultheader')); ?></textarea></td>
318
- </tr>
319
- <tr valign="top">
320
- <td width="30%" align="left">
321
- <b><?php _e('Result Body:'); ?></b><br /><?php _e('Normal'); ?><br /><br />
322
- <?php _e('Allowed Variables:'); ?><br />
323
- - %POLL_ANSWER_ID%<br />
324
- - %POLL_ANSWER%<br />
325
- - %POLL_ANSWER_VOTES%<br />
326
- - %POLL_ANSWER_PERCENTAGE%<br />
327
- - %POLL_ANSWER_IMAGEWIDTH%<br /><br />
328
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('resultbody');" class="button" />
329
- </td>
330
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_resultbody" name="poll_template_resultbody"><?php echo stripslashes(get_settings('poll_template_resultbody')); ?></textarea></td>
331
- </tr>
332
- <tr valign="top">
333
- <td width="30%" align="left">
334
- <b><?php _e('Result Body:'); ?></b><br /><?php _e('Displaying Of User\'s Voted Answer'); ?><br /><br />
335
- <?php _e('Allowed Variables:'); ?><br />
336
- - %POLL_ANSWER_ID%<br />
337
- - %POLL_ANSWER%<br />
338
- - %POLL_ANSWER_VOTES%<br />
339
- - %POLL_ANSWER_PERCENTAGE%<br />
340
- - %POLL_ANSWER_IMAGEWIDTH%<br /><br />
341
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('resultbody2');" class="button" />
342
- </td>
343
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_resultbody2" name="poll_template_resultbody2"><?php echo stripslashes(get_settings('poll_template_resultbody2')); ?></textarea></td>
344
- </tr>
345
- <tr valign="top">
346
- <td width="30%" align="left">
347
- <b><?php _e('Result Footer:'); ?></b><br /><br /><br />
348
- <?php _e('Allowed Variables:'); ?><br />
349
- - %POLL_TOTALVOTES%<br /><br />
350
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('resultfooter');" class="button" />
351
- </td>
352
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_resultfooter" name="poll_template_resultfooter"><?php echo stripslashes(get_settings('poll_template_resultfooter')); ?></textarea></td>
353
- </tr>
354
- </table>
355
- </fieldset>
356
- <fieldset class="options">
357
- <legend><?php _e('Poll Misc Templates'); ?></legend>
358
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
359
- <tr valign="top">
360
- <td width="30%" align="left">
361
- <b><?php _e('Poll Disabled'); ?></b><br /><br /><br />
362
- <?php _e('Allowed Variables:'); ?><br />
363
- - N/A<br /><br />
364
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('disable');" class="button" />
365
- </td>
366
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_disable" name="poll_template_disable"><?php echo stripslashes(get_settings('poll_template_disable')); ?></textarea></td>
367
- </tr>
368
- <tr valign="top">
369
- <td width="30%" align="left">
370
- <b><?php _e('Poll Error'); ?></b><br /><br /><br />
371
- <?php _e('Allowed Variables:'); ?><br />
372
- - N/A<br /><br />
373
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template'); ?>" onclick="javascript: poll_default_templates('error');" class="button" />
374
- </td>
375
- <td width="70%" align="right"><textarea cols="100" rows="10" id="poll_template_error" name="poll_template_error"><?php echo stripslashes(get_settings('poll_template_error')); ?></textarea></td>
376
- </tr>
377
- </table>
378
- </fieldset>
379
- <p class="submit">
380
- <input type="submit" name="Submit" value="<?php _e('Update Options'); ?> &raquo;" />
381
- </p>
382
- </form>
383
- </div>
384
- <?php include('./admin-footer.php') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls-upgrade-202.php DELETED
@@ -1,169 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Upgrade WP-Polls From 2.0x To 2.02 |
14
- | - wp-admin/polls-upgrade-202.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Config
21
- require('../wp-config.php');
22
-
23
- ### Variables, Variables, Variables
24
- $alter_table = array();
25
- $insert_options = array();
26
- $update_options = array();
27
- $error = '';
28
-
29
- ### Alter Tables (1 Table)
30
- $alter_table[] = "ALTER TABLE $wpdb->pollsip ADD pollip_host VARCHAR(200) NOT NULL AFTER pollip_ip;";
31
-
32
- ### Insert Options (1 Row)
33
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_error', 'Y', '3', 'An error has occurred when processing your poll.', '20', '8', 'Template For Poll When An Error Has Occured', '8', 'yes');";
34
-
35
- ### Update Options (1 Row)
36
- $update_options[] = "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'poll_archive_perpage'";
37
-
38
- ### Total IPs Needed To Be Resolved
39
- $ip_totalcount = $wpdb->get_var("SELECT COUNT(pollip_id) FROM $wpdb->pollsip WHERE pollip_ip != ''");
40
-
41
- ### Check Whether There Is Any Pre Errors
42
- $wpdb->show_errors = false;
43
- $check_upgrade = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_template_error'");
44
- if($check_upgrade) {
45
- $error = __('You Had Already Installed WP-Polls Version 2.02.');
46
- }
47
- if(empty($wpdb->pollsq) || empty($wpdb->pollsa) || empty($wpdb->pollsip)) {
48
- $error = __('Please Define The pollsq, pollsa and pollsip in wp-settings.php.');
49
- }
50
- ?>
51
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
52
- <html xmlns="http://www.w3.org/1999/xhtml">
53
- <head>
54
- <title>WordPress &rsaquo; <?php _e('Upgrading'); ?> &rsaquo; <?php _e('WP-Polls'); ?> 2.02</title>
55
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56
- <style type="text/css" media="screen">
57
- @import url( wp-admin.css );
58
- </style>
59
- </head>
60
- <body>
61
- <div class="wrap">
62
- <h2><?php _e('Upgrading WP-Polls 2.02'); ?></h2>
63
- <p><?php _e('This upgrade script will upgrade WP-Polls from version 2.00 or 2.01 to version 2.02 for your Wordpress.'); ?></p>
64
- <p>
65
- <?php _e('This upgrade script will be doing the following:'); ?><br />
66
- <b>&raquo;</b> <b>1</b> <?php _e('table will be altered namely <b>pollsip</b>.'); ?><br />
67
- <b>&raquo;</b> <b>1</b> <?php _e('option will be inserted into the <b>options</b> table.'); ?><br />
68
- <b>&raquo;</b> <b>1</b> <?php _e('option will be updated from <b>options</b> table.'); ?><br />
69
- <b>&raquo;</b> <b><?php echo $ip_totalcount; ?></b> <?php _e('IPs will be resolved and updated.'); ?><br />
70
- <b>&raquo;</b> <b>4</b> <?php _e('tables will be optimized namely <b>pollsq</b>, <b>pollsa</b>, <b>pollsip</b> and <b>options</b>.'); ?><br />
71
- </p>
72
- <?php
73
- if(empty($error)) {
74
- if(!empty($_POST['upgrade'])) {
75
- // Alter Table
76
- $alter_table_count = 0;
77
- echo "<p><b>".__('Altering Tables:')."</b>";
78
- foreach($alter_table as $altertable) {
79
- $wpdb->query($altertable);
80
- }
81
- $check_pollsip = $wpdb->get_var("SELECT pollip_id FROM $wpdb->pollsip WHERE pollip_host = '' LIMIT 1");
82
- if($check_pollsip) {
83
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsa</b>) altered.";
84
- $alter_table_count++;
85
- } else {
86
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsip</b>) table NOT altered.</font>";
87
- }
88
- echo "<br /><b>&raquo;</b> <b>$alter_table_count / 1</b> Table Altered.</p>";
89
- // Insert Options
90
- $insert_options_count = 0;
91
- echo "<p><b>".__('Inserting Options:')."</b>";
92
- foreach($insert_options as $insertoptions) {
93
- $temp_options = $wpdb->query($insertoptions);
94
- $temp_option = explode(" ", $insertoptions);
95
- $temp_option = $temp_option[6];
96
- $temp_option = substr($temp_option, 1, -2);
97
- if($temp_options) {
98
- echo "<br /><b>&raquo;</b> Option (<b>$temp_option</b>) inserted.";
99
- $insert_options_count++;
100
- } else {
101
- echo "<br /><b>&raquo;</b> <font color=\"red\">Option (<b>$temp_option</b>) NOT inserted.</font>";
102
- }
103
- }
104
- echo "<br /><b>&raquo;</b> <b>$insert_options_count / 1</b> Option Inserted.</p>";
105
- // Update Options
106
- $update_options_count = 0;
107
- echo "<p><b>".__('Updating Options:')."</b>";
108
- foreach($update_options as $updateoptions) {
109
- $temp_options = $wpdb->query($updateoptions);
110
- $temp_option = explode("=", $updateoptions);
111
- $temp_option = $temp_option[2];
112
- $temp_option = substr($temp_option, 2, -1);
113
- if($temp_options) {
114
- echo "<br /><b>&raquo;</b> Option (<b>$temp_option</b>) updated.";
115
- $update_options_count++;
116
- } else {
117
- echo "<br /><b>&raquo;</b> <font color=\"red\">Option (<b>$temp_option</b>) NOT updated.</font>";
118
- }
119
- }
120
- echo "<br /><b>&raquo;</b> <b>$update_options_count / 1</b> Option Updated.</p>";
121
- // Resolve IPs
122
- $ip_count = 0;
123
- echo "<p><b>".__('Resolving IPs:')."</b>";
124
- $ips_data = $wpdb->get_results("SELECT pollip_id, pollip_ip FROM $wpdb->pollsip WHERE pollip_ip != ''");
125
- if($ips_data) {
126
- foreach($ips_data as $ip_data) {
127
- $pollip_id = intval($ip_data->pollip_id);
128
- $pollip_host = gethostbyaddr($ip_data->pollip_ip);
129
- $update_ip = $wpdb->query("UPDATE $wpdb->pollsip SET pollip_host = '$pollip_host' WHERE pollip_id = $pollip_id");
130
- if($update_ip) {
131
- echo "<br /><b>&raquo;</b> IP (<b>$ip_data->pollip_ip</b>) resolved.";
132
- $ip_count++;
133
- } else {
134
- echo "<br /><b>&raquo;</b> <font color=\"red\">IP (<b>$ip_data->pollip_ip</b>) NOT resolved.</font>";
135
- }
136
- }
137
- } else {
138
- echo "<br /><b>&raquo;</b> There are no IP to be resolved.";
139
- }
140
- echo "<br /><b>&raquo;</b> <b>$ip_count / $ip_totalcount</b> IPs Resolved.</p>";
141
- // Optimize Tables
142
- $optimize_table_count = 0;
143
- echo "<p><b>".__('Optimizing Tables:')."</b>";
144
- $optimize_tables = $wpdb->query("OPTIMIZE TABLE $wpdb->pollsq, $wpdb->pollsa, $wpdb->pollsip, $wpdb->options");
145
- if($optimize_tables) {
146
- echo "<br /><b>&raquo;</b> Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) optimized.";
147
- $optimize_table_count = 4;
148
- } else {
149
- echo "<br /><b>&raquo;</b> <font color=\"red\">Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) NOT optimized.</font>";
150
- }
151
- echo "<br /><b>&raquo;</b> <b>$optimize_table_count / 4</b> Tables Optimized.</p>";
152
- // Check Whether Install Is Successful
153
- if($alter_table_count == 1 && $insert_options_count == 1) {
154
- echo '<p align="center"><b>'.__('WP-Polls Upgraded Successfully To Version 2.02.').'</b><br />'.__('Please remember to delete this file before proceeding on.').'</p>';
155
- }
156
- } else {
157
- ?>
158
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
159
- <div align="center"><?php _e('It may take some time for all the ips to be resolved.'); ?><br /><input type="submit" name="upgrade" value="<?php _e('Click Here To Upgrade WP-Polls 2.02'); ?>" class="button"></div>
160
- </form>
161
- <?php
162
- }
163
- } else {
164
- echo "<p align=\"center\"><font color=\"red\"><b>$error</b></font></p>\n";
165
- }
166
- ?>
167
- </div>
168
- </body>
169
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls-upgrade.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Upgrade WP-Polls From 1.0x To 2.02 |
14
- | - wp-admin/polls-upgrade.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Config
21
- require('../wp-config.php');
22
-
23
- ### Variables, Variables, Variables
24
- $create_table = array();
25
- $alter_table = array();
26
- $insert_options = array();
27
- $error = '';
28
-
29
- ### Create Tables (1 Table)
30
- $create_table[] = "CREATE TABLE $wpdb->pollsip (".
31
- "pollip_id int(10) NOT NULL auto_increment,".
32
- "pollip_qid varchar(10) NOT NULL default '',".
33
- "pollip_aid varchar(10) NOT NULL default '',".
34
- "pollip_ip varchar(100) NOT NULL default '',".
35
- "pollip_host VARCHAR(200) NOT NULL default '',".
36
- "pollip_timestamp varchar(20) NOT NULL default '0000-00-00 00:00:00',".
37
- "pollip_user tinytext NOT NULL,".
38
- "PRIMARY KEY (pollip_id))";
39
-
40
- ### Alter Tables (2 Tables)
41
- $alter_table[] = "ALTER TABLE $wpdb->pollsq CHANGE id pollq_id INT(10) NULL AUTO_INCREMENT ,".
42
- "CHANGE question pollq_question VARCHAR(200) NOT NULL ,".
43
- "CHANGE timestamp pollq_timestamp VARCHAR(20) NOT NULL ,".
44
- "CHANGE total_votes pollq_totalvotes INT(10) DEFAULT '0' NOT NULL";
45
- $alter_table[] = "ALTER TABLE $wpdb->pollsa CHANGE aid polla_aid INT(10) NOT NULL AUTO_INCREMENT ,".
46
- "CHANGE qid polla_qid INT(10) DEFAULT '0' NOT NULL ,".
47
- "CHANGE answers polla_answers VARCHAR( 200 ) NOT NULL ,".
48
- "CHANGE votes polla_votes INT(10) DEFAULT '0' NOT NULL";
49
-
50
- ### Get Lastest Poll ID
51
- $poll_latest_id = $wpdb->get_var("SELECT id FROM $wpdb->pollsq ORDER BY id DESC LIMIT 1");
52
- if(intval($poll_latest_id) < 1) { $poll_latest_id = 1; }
53
-
54
- ### Insert Options (16 Rows)
55
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_voteheader', 'Y', 3, '<table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"3\\\" cellpadding=\\\"3\\\">\r\n<tr>\r\n<td align=\\\"center\\\"><b>%POLL_QUESTION%</b></td>\r\n</tr>', 20, 8, 'Template For Poll''s Question', 8, 'yes');";
56
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (124, 0, 'poll_template_votebody', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\"><input type=\\\"radio\\\" name=\\\"poll-%POLL_ID%\\\" value=\\\"%POLL_ANSWER_ID%\\\" /> %POLL_ANSWER%</td>\r\n</tr>', 20, 8, 'Template For Poll''s Answers', 8, 'yes');";
57
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (123, 0, 'poll_template_votefooter', 'Y', 3, '<tr>\r\n<td align=\\\"center\\\"><input type=\\\"submit\\\" name=\\\"vote\\\" value=\\\" Vote \\\" class=\\\"Buttons\\\" /><br /><a href=\\\"index.php?pollresult=1\\\">View Results</a></td>\r\n</tr>\r\n</table>', 20, 8, 'Template For Poll''s Voting Footer', 8, 'yes');";
58
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultheader', 'Y', 3, '<table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"3\\\" cellpadding=\\\"3\\\">\r\n<tr>\r\n<td colspan=\\\"2\\\" align=\\\"center\\\"><b>%POLL_QUESTION%</b></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
59
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultbody', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\" width=\\\"70%\\\">%POLL_ANSWER%<br /><img src=\\\"wp-images/pollbar.gif\\\" height=\\\"5\\\" width=\\\"%POLL_ANSWER_IMAGEWIDTH%\\\" alt=\\\"%POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\\\" /></td>\r\n<td align=\\\"right\\\" width=\\\"30%\\\"><b>%POLL_ANSWER_PERCENTAGE%%</b></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
60
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultbody2', 'Y', 3, '<tr>\r\n<td align=\\\"left\\\" width=\\\"70%\\\"><i>%POLL_ANSWER%</i><br /><img src=\\\"wp-images/pollbar.gif\\\" height=\\\"5\\\" width=\\\"%POLL_ANSWER_IMAGEWIDTH%\\\" alt=\\\"You Have Voted For This Choice - %POLL_ANSWER% -> %POLL_ANSWER_PERCENTAGE%% (%POLL_ANSWER_VOTES% Votes)\\\" /></td>\r\n<td align=\\\"right\\\" width=\\\"30%\\\"><i><b>%POLL_ANSWER_PERCENTAGE%%</b></i></td>\r\n</tr>', 20, 8, '', 8, 'yes');";
61
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_resultfooter', 'Y', 3, '<tr>\r\n<td colspan=\\\"2\\\" align=\\\"center\\\">Total Votes: <b>%POLL_TOTALVOTES%</b><td>\r\n</tr>\r\n</table>', 20, 8, '', 8, 'yes');";
62
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_disable', 'Y', 3, 'Sorry, there are no polls available at the moment.', 20, 8, 'Template For Poll When It Is Disabled', 8, 'yes');";
63
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_template_error', 'Y', '3', 'An error has occurred when processing your poll.', '20', '8', 'Template For Poll When An Error Has Occured', '8', 'yes');";
64
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_currentpoll', 'Y', 3, '0', 20, 8, 'Current Displayed Poll', 8, 'yes');";
65
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_latestpoll', 'Y', 3, '$poll_latest_id', 20, 8, 'The Lastest Poll', 8, 'yes');";
66
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_archive_perpage', 'Y', 3, '10', 2, 8, 'Number Of Polls To Display Per Page On The Poll''s Archive', 8, 'no');";
67
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_sortby', 'Y', 1, 'polla_aid', 20, 8, 'Sorting Of Poll''s Answers', 8, 'yes');";
68
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_sortorder', 'Y', 1, 'asc', 20, 8, 'Sort Order Of Poll''s Answers', 8, 'yes');";
69
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_result_sortby', 'Y', 1, 'polla_votes', 20, 8, 'Sorting Of Poll''s Answers Result', 8, 'yes');";
70
- $insert_options[] ="INSERT INTO $wpdb->options VALUES (0, 0, 'poll_ans_result_sortorder', 'Y', 1, 'desc', 20, 8, 'Sorting Order Of Poll''s Answers Result', 8, 'yes');";
71
-
72
- ### Check Whether There Is Any Pre Errors
73
- $wpdb->show_errors = false;
74
- $check_upgrade = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
75
- if($check_upgrade) {
76
- $error = __('You Had Already Installed WP-Polls.');
77
- }
78
- if(empty($wpdb->pollsq) || empty($wpdb->pollsa) || empty($wpdb->pollsip)) {
79
- $error = __('Please Define The pollsq, pollsa and pollsip in wp-settings.php.');
80
- }
81
- ?>
82
-
83
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
84
- <html xmlns="http://www.w3.org/1999/xhtml">
85
- <head>
86
- <title>WordPress &rsaquo; <?php _e('Upgrading'); ?> &rsaquo; <?php _e('WP-Polls'); ?></title>
87
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
88
- <style type="text/css" media="screen">
89
- @import url( wp-admin.css );
90
- </style>
91
- </head>
92
- <body>
93
- <div class="wrap">
94
- <h2><?php _e('Upgrading WP-Polls'); ?></h2>
95
- <p><?php _e('This upgrade script will upgrade WP-Polls to version 2.0 for your Wordpress.'); ?></p>
96
- <p>
97
- <?php _e('This upgrade script will be doing the following:'); ?><br />
98
- <b>&raquo;</b> <b>1</b> <?php _e('table will be created namely <b>pollsip</b>.'); ?><br />
99
- <b>&raquo;</b> <b>2</b> <?php _e('tables will be altered namely <b>pollsq</b> and <b>pollsa</b>.'); ?><br />
100
- <b>&raquo;</b> <b>15</b> <?php _e('options will be inserted into the <b>options</b> table.'); ?><br />
101
- <b>&raquo;</b> <b>4</b> <?php _e('tables will be optimized namely <b>pollsq</b>, <b>pollsa</b>, <b>pollsip</b> and <b>options</b>.'); ?><br />
102
- </p>
103
- <?php
104
- if(empty($error)) {
105
- if(!empty($_POST['upgrade'])) {
106
- // Create Tables
107
- $create_table_count = 0;
108
- echo "<p><b>".__('Creating Tables:')."</b>";
109
- foreach($create_table as $createtable) {
110
- $wpdb->query($createtable);
111
- }
112
- $check_pollsip = $wpdb->query("SHOW COLUMNS FROM $wpdb->pollsip");
113
- if($check_pollsip) {
114
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsip</b>) created.";
115
- $create_table_count++;
116
- } else {
117
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsip</b>) table NOT created.</font>";
118
- }
119
- echo "<br /><b>&raquo;</b> <b>$create_table_count / 1</b> Table Created.</p>";
120
- // Alter Table
121
- $alter_table_count = 0;
122
- echo "<p><b>".__('Altering Tables:')."</b>";
123
- foreach($alter_table as $altertable) {
124
- $wpdb->query($altertable);
125
- }
126
- $check_pollsq = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq LIMIT 1");
127
- $check_pollsa = $wpdb->get_var("SELECT polla_aid FROM $wpdb->pollsa LIMIT 1");
128
- if($check_pollsq) {
129
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsq</b>) altered.";
130
- $alter_table_count++;
131
- } else {
132
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsip</b>) table NOT altered.</font>";
133
- }
134
- if($check_pollsa) {
135
- echo "<br /><b>&raquo;</b> Table (<b>$wpdb->pollsa</b>) altered.";
136
- $alter_table_count++;
137
- } else {
138
- echo "<br /><b>&raquo;</b> <font color=\"red\">Table (<b>$wpdb->pollsip</b>) table NOT altered.</font>";
139
- }
140
- echo "<br /><b>&raquo;</b> <b>$alter_table_count / 2</b> Tables Altered.</p>";
141
- // Insert Options
142
- $insert_options_count = 0;
143
- echo "<p><b>".__('Inserting Options:')."</b>";
144
- foreach($insert_options as $insertoptions) {
145
- $temp_options = $wpdb->query($insertoptions);
146
- $temp_option = explode(" ", $insertoptions);
147
- $temp_option = $temp_option[6];
148
- $temp_option = substr($temp_option, 1, -2);
149
- if($temp_options) {
150
- echo "<br /><b>&raquo;</b> Option (<b>$temp_option</b>) inserted.";
151
- $insert_options_count ++;
152
- } else {
153
- echo "<br /><b>&raquo;</b> <font color=\"red\">Option (<b>$temp_option</b>) NOT inserted.</font>";
154
- }
155
- }
156
- echo "<br /><b>&raquo;</b> <b>$insert_options_count / 16</b> Options Inserted.</p>";
157
- // Optimize Tables
158
- $optimize_table_count = 0;
159
- echo "<p><b>".__('Optimizing Tables:')."</b>";
160
- $optimize_tables = $wpdb->query("OPTIMIZE TABLE $wpdb->pollsq, $wpdb->pollsa, $wpdb->pollsip, $wpdb->options");
161
- if($optimize_tables) {
162
- echo "<br /><b>&raquo;</b> Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) optimized.";
163
- $optimize_table_count = 4;
164
- } else {
165
- echo "<br /><b>&raquo;</b> <font color=\"red\">Tables (<b>$wpdb->pollsq</b>, <b>$wpdb->pollsa</b>, <b>$wpdb->pollsip</b>, <b>$wpdb->options</b>) NOT optimized.</font>";
166
- }
167
- echo "<br /><b>&raquo;</b> <b>$optimize_table_count / 4</b> Tables Optimized.</p>";
168
- // Check Whether Install Is Successful
169
- if($create_table_count == 1 && $alter_table_count == 2 && $insert_options_count == 16) {
170
- echo '<p align="center"><b>'.__('WP-Polls Upgraded Successfully.').'</b><br />'.__('Please remember to delete this file before proceeding on.').'</p>';
171
- }
172
- } else {
173
- ?>
174
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
175
- <div align="center"><input type="submit" name="upgrade" value="<?php _e('Click Here To Upgrade WP-Polls'); ?>" class="button"></div>
176
- </form>
177
- <?php
178
- }
179
- } else {
180
- echo "<p align=\"center\"><font color=\"red\"><b>$error</b></font></p>\n";
181
- }
182
- ?>
183
- </div>
184
- </body>
185
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls.php DELETED
@@ -1,251 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-Polls
4
- Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
- Description: Adds A Poll Feature To WordPress
6
- Version: 2.02
7
- Author: GaMerZ
8
- Author URI: http://www.lesterchan.net
9
- */
10
-
11
-
12
- ### Function: Get Poll
13
- function get_poll($temp_poll_id = 0) {
14
- global $wpdb;
15
- // Check Whether Poll Is Disabled
16
- if(intval(get_settings('poll_currentpoll')) == -1) {
17
- echo stripslashes(get_settings('poll_template_disable'));
18
- return;
19
- // Poll Is Enabled
20
- } else {
21
- // Hardcoded Poll ID Is Not Specified
22
- if(intval($temp_poll_id) == 0) {
23
- // Current Poll ID Is Not Specified
24
- if(intval(get_settings('poll_currentpoll')) == 0) {
25
- // Get Lastest Poll ID
26
- $poll_id = intval(get_settings('poll_latestpoll'));
27
- } else {
28
- // Get Current Poll ID
29
- $poll_id = intval(get_settings('poll_currentpoll'));
30
- }
31
- // Get Hardcoded Poll ID
32
- } else {
33
- $poll_id = intval($temp_poll_id);
34
- }
35
- }
36
-
37
- // User Click on View Results Link
38
- if(intval($_GET['pollresult']) == 1) {
39
- display_pollresult($poll_id);
40
- // Check Whether User Has Voted
41
- } else {
42
- // Check Cookie First
43
- $voted_cookie = check_voted_cookie($poll_id);
44
- if($voted_cookie > 0) {
45
- display_pollresult($poll_id, $voted_cookie);
46
- // Check IP If Cookie Cannot Be Found
47
- } else {
48
- $voted_ip = check_voted_ip($poll_id);
49
- if($voted_ip > 0) {
50
- display_pollresult($poll_id, $voted_ip);
51
- // User Never Vote. Display Poll Voting Form
52
- } else {
53
- display_pollvote($poll_id);
54
- }
55
- }
56
- }
57
- }
58
-
59
-
60
- ### Function: Check Voted By Cookie
61
- function check_voted_cookie($poll_id) {
62
- // 0: False | > 0: True
63
- return intval($_COOKIE["voted_$poll_id"]);
64
- }
65
-
66
-
67
- ### Function: Check Voted By IP
68
- function check_voted_ip($poll_id) {
69
- global $wpdb;
70
- // Check IP From IP Logging Database
71
- $get_voted_aid = $wpdb->get_var("SELECT pollip_aid FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_ip = '".get_ipaddress()."'");
72
- // 0: False | > 0: True
73
- return intval($get_voted_aid);
74
- }
75
-
76
-
77
- ### Function: Display Voting Form
78
- function display_pollvote($poll_id) {
79
- global $wpdb;
80
- // Get Poll Question Data
81
- $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
82
- // Poll Question Variables
83
- $poll_question_text = stripslashes($poll_question->pollq_question);
84
- $poll_question_id = intval($poll_question->pollq_id);
85
- $poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
86
- $template_question = stripslashes(get_settings('poll_template_voteheader'));
87
- $template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
88
- $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
89
- $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
90
- // Get Poll Answers Data
91
- $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_question_id ORDER BY ".get_settings('poll_ans_sortby').' '.get_settings('poll_ans_sortorder'));
92
- // If There Is Poll Question With Answers
93
- if($poll_question && $poll_answers) {
94
- // Display Poll Voting Form
95
- echo '<form action="'.$_SERVER['REQUEST_URI'].'" name="polls" method="post">'."\n";
96
- echo "<input type=\"hidden\" name=\"poll_id\" value=\"$poll_question_id\" />\n";
97
- // Print Out Voting Form Header Template
98
- echo $template_question;
99
- foreach($poll_answers as $poll_answer) {
100
- // Poll Answer Variables
101
- $poll_answer_id = intval($poll_answer->polla_aid);
102
- $poll_answer_text = stripslashes($poll_answer->polla_answers);
103
- $poll_answer_votes = intval($poll_answer->polla_votes);
104
- $template_answer = stripslashes(get_settings('poll_template_votebody'));
105
- $template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
106
- $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
107
- $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
108
- $template_answer = str_replace("%POLL_ANSWER_VOTES%", $poll_answer_votes, $template_answer);
109
- // Print Out Voting Form Body Template
110
- echo $template_answer;
111
- }
112
- // Voting Form Footer Variables
113
- $template_footer = stripslashes(get_settings('poll_template_votefooter'));
114
- // Print Out Voting Form Footer Template
115
- echo $template_footer;
116
- echo "</form>\n";
117
- } else {
118
- echo stripslashes(get_settings('poll_template_disable'));
119
- }
120
- }
121
-
122
-
123
- ### Function: Display Results Form
124
- function display_pollresult($poll_id, $user_voted = 0) {
125
- global $wpdb;
126
- // Get Poll Question Data
127
- $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
128
- // Poll Question Variables
129
- $poll_question_text = stripslashes($poll_question->pollq_question);
130
- $poll_question_id = intval($poll_question->pollq_id);
131
- $poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
132
- $template_question = stripslashes(get_settings('poll_template_resultheader'));
133
- $template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
134
- $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
135
- $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
136
- // Get Poll Answers Data
137
- $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_question_id ORDER BY ".get_settings('poll_ans_result_sortby').' '.get_settings('poll_ans_result_sortorder'));
138
- // If There Is Poll Question With Answers
139
- if($poll_question && $poll_answers) {
140
- // Is The Poll Total Votes 0?
141
- $poll_totalvotes_zero = true;
142
- if($poll_question_totalvotes > 0) {
143
- $poll_totalvotes_zero = false;
144
- }
145
- // Print Out Result Header Template
146
- echo $template_question;
147
- foreach($poll_answers as $poll_answer) {
148
- // Poll Answer Variables
149
- $poll_answer_id = intval($poll_answer->polla_aid);
150
- $poll_answer_text = stripslashes($poll_answer->polla_answers);
151
- $poll_answer_votes = intval($poll_answer->polla_votes);
152
- $poll_answer_text = stripslashes($poll_answer->polla_answers);
153
- $poll_answer_percentage = 0;
154
- $poll_answer_imagewidth = 0;
155
- // Calculate Percentage And Image Bar Width
156
- if(!$poll_totalvotes_zero) {
157
- if($poll_answer_votes > 0) {
158
- $poll_answer_percentage = round((($poll_answer_votes/$poll_question_totalvotes)*100));
159
- $poll_answer_imagewidth = round($poll_answer_percentage*0.9);
160
- } else {
161
- $poll_answer_percentage = 0;
162
- $poll_answer_imagewidth = 1;
163
- }
164
- } else {
165
- $poll_answer_percentage = 0;
166
- $poll_answer_imagewidth = 1;
167
- }
168
- // Let User See What Options They Voted
169
- if($user_voted == $poll_answer_id) {
170
- // Results Body Variables
171
- $template_answer = stripslashes(get_settings('poll_template_resultbody2'));
172
- $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
173
- $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
174
- $template_answer = str_replace("%POLL_ANSWER_VOTES%", $poll_answer_votes, $template_answer);
175
- $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
176
- $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
177
- // Print Out Results Body Template
178
- echo $template_answer;
179
- } else {
180
- // Results Body Variables
181
- $template_answer = stripslashes(get_settings('poll_template_resultbody'));
182
- $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
183
- $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
184
- $template_answer = str_replace("%POLL_ANSWER_VOTES%", $poll_answer_votes, $template_answer);
185
- $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
186
- $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
187
- // Print Out Results Body Template
188
- echo $template_answer;
189
- }
190
- }
191
- // Results Footer Variables
192
- $template_footer = stripslashes(get_settings('poll_template_resultfooter'));
193
- $template_footer = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_footer);
194
- // Print Out Results Footer Template
195
- echo $template_footer;
196
- } else {
197
- echo stripslashes(get_settings('poll_template_disable'));
198
- }
199
- }
200
-
201
-
202
- ### Function: Vote Poll
203
- function vote_poll() {
204
- global $wpdb, $user_identity;
205
- if(!empty($_POST['vote'])) {
206
- $poll_id = intval($_POST['poll_id']);
207
- $poll_aid = intval($_POST["poll-$poll_id"]);
208
- if($poll_id > 0 && $poll_aid > 0) {
209
- $voted_ip = check_voted_ip($poll_id);
210
- $voted_cookie = check_voted_cookie($poll_ip);
211
- if($voted_ip == 0 && $voted_cookie == 0) {
212
- if(!empty($user_identity)) {
213
- $pollip_user = addslashes($user_identity);
214
- } elseif(!empty($_COOKIE['comment_author_'.COOKIEHASH])) {
215
- $pollip_user = addslashes($_COOKIE['comment_author_'.COOKIEHASH]);
216
- } else {
217
- $pollip_user = 'Guest';
218
- }
219
- $vote_cookie = setcookie("voted_".$poll_id, $poll_aid, time() + 30000000, COOKIEPATH);
220
- if($vote_cookie) {
221
- $pollip_ip = get_ipaddress();
222
- $pollip_host = gethostbyaddr($pollip_ip);
223
- $pollip_timestamp = current_time('timestamp');
224
- $vote_ip = $wpdb->query("INSERT INTO $wpdb->pollsip VALUES(0,$poll_id,$poll_aid,'$pollip_ip','$pollip_host','$pollip_timestamp','$pollip_user')");
225
- if($vote_ip) {
226
- $vote_a = $wpdb->query("UPDATE $wpdb->pollsa SET polla_votes = (polla_votes+1) WHERE polla_qid = $poll_id AND polla_aid = $poll_aid");
227
- if($vote_a) {
228
- $vote_q = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes+1) WHERE pollq_id = $poll_id");
229
- } // End if($vote_a)
230
- } // End if($vote_ip)
231
- } // End if($vote_cookie)
232
- }// End if($voted_ip == 0 && $voted_cookie == 0)
233
- } // End if(!empty($_POST['vote']))
234
- } // End if($poll_id > 0 && $poll_aid > 0)
235
- }
236
-
237
-
238
- ### Function: Get IP Address
239
- function get_ipaddress() {
240
- if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
241
- $ip_address = $_SERVER["REMOTE_ADDR"];
242
- } else {
243
- $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
244
- }
245
- if(strpos($ip_address, ',') !== false) {
246
- $ip_address = explode(',', $ip_address);
247
- $ip_address = $ip_address[0];
248
- }
249
- return $ip_address;
250
- }
251
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polls/images/default/pollbg.gif ADDED
Binary file
polls/images/default_gradient/pollbg.gif ADDED
Binary file
polls/images/loading.gif ADDED
Binary file
polls/polls-css.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ +----------------------------------------------------------------+
3
+ | |
4
+ | WordPress 2.0 Plugin: WP-Polls 2.14 |
5
+ | Copyright (c) 2006 Lester "GaMerZ" Chan |
6
+ | |
7
+ | File Written By: |
8
+ | - Lester "GaMerZ" Chan |
9
+ | - http://www.lesterchan.net |
10
+ | |
11
+ | File Information: |
12
+ | - Polls CSS File |
13
+ | - wp-content/plugins/polls/polls-css.css |
14
+ | |
15
+ +----------------------------------------------------------------+
16
+ */
17
+
18
+
19
+ .wp-polls ul li, wp-polls-ul li, .wp-polls-ans ul li {
20
+ text-align: left;
21
+ background-image: none;
22
+ }
23
+ .wp-polls ul, .wp-polls-ul, .wp-polls-ans ul {
24
+ text-align: left;
25
+ list-style: none;
26
+ }
27
+ .wp-polls ul li:before, wp-polls-ul li, .wp-polls-ans ul li:before, #sidebar ul ul li:before {
28
+ content: '';
29
+ }
30
+ .wp-polls IMG, .wp-polls LABEL , .wp-polls INPUT, .wp-polls-loading IMG, .wp-polls-image IMG {
31
+ display: inline;
32
+ border: 0px;
33
+ padding: 0px;
34
+ margin: 0px;
35
+ }
36
+ .wp-polls-ul {
37
+ padding: 0px;
38
+ margin: 0px 0px 10px 10px;
39
+ }
40
+ .wp-polls-ans {
41
+ width:100%;
42
+ filter: alpha(opacity=100);
43
+ -moz-opacity: 1;
44
+ opacity: 1;
45
+ /* background-color: #ffffff; */
46
+ }
47
+ .wp-polls-loading {
48
+ display: none;
49
+ text-align: center;
50
+ height: 16px;
51
+ }
52
+ .wp-polls-image {
53
+ border: 0px;
54
+ }
55
+ .wp-polls .Buttons {
56
+ border:1px solid #c8c8c8;
57
+ background-color: #f3f6f8;
58
+ }
59
+ /* Styles Used In WP-Admin */
60
+ .wp-polls-usage-pre {
61
+ margin: 20px;
62
+ padding: 10px;
63
+ border: 1px solid #c8c8c8;
64
+ background-color: #f0f0f0;
65
+ overflow: auto;
66
+ }
67
+ #wp-polls-pollbar-bg {
68
+ width: 25px;
69
+ height: 25px;
70
+ border: 1px solid #000000;
71
+ }
72
+ #wp-polls-pollbar-border {
73
+ width: 25px;
74
+ height: 25px;
75
+ border: 1px solid #000000;
76
+ }
polls/polls-js.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-Polls 2.14 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Polls Javascript File |
14
+ | - wp-content/plugins/polls/polls-js.js |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Include wp-config.php
21
+ @require('../../../wp-config.php');
22
+ cache_javascript_headers();
23
+
24
+ ### Determine polls.php Path
25
+ $polls_ajax_url = dirname($_SERVER['PHP_SELF']);
26
+ if(substr($polls_ajax_url, -1) == '/') {
27
+ $polls_ajax_url = substr($polls_ajax_url, 0, -1);
28
+ }
29
+ ?>
30
+
31
+ // Variables
32
+ var polls_ajax_url = "<?php echo $polls_ajax_url; ?>/polls.php";
33
+ var polls_text_wait = "<?php _e('Your last request is still being processed. Please wait a while ...', 'wp-polls'); ?>";
34
+ var polls_text_valid = "<?php _e('Please choose a valid poll answer.', 'wp-polls'); ?>";
35
+ var polls = new sack(polls_ajax_url);
36
+ var poll_id = 0;
37
+ var poll_answer_id = 0;
38
+ var poll_fadein_opacity = 0;
39
+ var poll_fadeout_opacity = 100;
40
+ var is_ie = (document.all && document.getElementById);
41
+ var is_moz = (!document.all && document.getElementById);
42
+ var is_opera = (navigator.userAgent.indexOf("Opera") > -1);
43
+ var is_being_voted = false;
44
+
45
+
46
+ // When User Vote For Poll
47
+ function poll_vote(current_poll_id) {
48
+ if(!is_being_voted) {
49
+ is_being_voted = true;
50
+ poll_id = current_poll_id;
51
+ poll_form = document.getElementById('polls_form_' + poll_id);
52
+ poll_answer = eval("poll_form.poll_" + poll_id);
53
+ poll_answer_id = 0;
54
+ if(poll_answer.length != null) {
55
+ for(i = 0; i < poll_answer.length; i++) {
56
+ if (poll_answer[i].checked) {
57
+ poll_answer_id = poll_answer[i].value;
58
+ }
59
+ }
60
+ } else {
61
+ poll_answer_id = poll_answer.value;
62
+ }
63
+ if(poll_answer_id > 0) {
64
+ poll_loading_text();
65
+ poll_process();
66
+ } else {
67
+ is_being_voted = false;
68
+ alert(polls_text_valid);
69
+ }
70
+ } else {
71
+ alert(polls_text_wait);
72
+ }
73
+ }
74
+
75
+
76
+ // When User View Poll's Result
77
+ function poll_result(current_poll_id) {
78
+ if(!is_being_voted) {
79
+ is_being_voted = true;
80
+ poll_id = current_poll_id;
81
+ poll_loading_text();
82
+ poll_process_result();
83
+ } else {
84
+ alert(polls_text_wait);
85
+ }
86
+ }
87
+
88
+
89
+ // When User View Poll's Voting Booth
90
+ function poll_booth(current_poll_id) {
91
+ if(!is_being_voted) {
92
+ is_being_voted = true;
93
+ poll_id = current_poll_id;
94
+ poll_loading_text();
95
+ poll_process_booth();
96
+ } else {
97
+ alert(polls_text_wait);
98
+ }
99
+ }
100
+
101
+
102
+ // Poll Fade In Text
103
+ function poll_fadein_text() {
104
+ if(poll_fadein_opacity == 90) {
105
+ poll_unloading_text();
106
+ }
107
+ if(poll_fadein_opacity < 100) {
108
+ poll_fadein_opacity += 10;
109
+ if(is_opera) {
110
+ poll_fadein_opacity = 100;
111
+ poll_unloading_text();
112
+ } else if(is_ie) {
113
+ document.getElementById('polls-' + poll_id + '-ans').filters.alpha.opacity = poll_fadein_opacity;
114
+ } else if(is_moz) {
115
+ document.getElementById('polls-' + poll_id + '-ans').style.MozOpacity = (poll_fadein_opacity/100);
116
+ }
117
+ setTimeout("poll_fadein_text()", 100);
118
+ } else {
119
+ poll_fadein_opacity = 100;
120
+ is_being_voted = false;
121
+ }
122
+ }
123
+
124
+
125
+ // Poll Loading Text
126
+ function poll_loading_text() {
127
+ document.getElementById('polls-' + poll_id + '-loading').style.display = 'block';
128
+ }
129
+
130
+
131
+ // Poll Finish Loading Text
132
+ function poll_unloading_text() {
133
+ document.getElementById('polls-' + poll_id + '-loading').style.display = 'none';
134
+ }
135
+
136
+
137
+ // Process The Poll
138
+ function poll_process() {
139
+ if(poll_fadeout_opacity > 0) {
140
+ poll_fadeout_opacity -= 10;
141
+ if(is_opera) {
142
+ poll_fadeout_opacity = 0;
143
+ } else if(is_ie) {
144
+ document.getElementById('polls-' + poll_id + '-ans').filters.alpha.opacity = poll_fadeout_opacity;
145
+ } else if(is_moz) {
146
+ document.getElementById('polls-' + poll_id + '-ans').style.MozOpacity = (poll_fadeout_opacity/100);
147
+ }
148
+ setTimeout("poll_process()", 100);
149
+ } else {
150
+ poll_fadeout_opacity = 0;
151
+ polls.reset();
152
+ polls.setVar("vote", true);
153
+ polls.setVar("poll_id", poll_id);
154
+ polls.setVar("poll_" + poll_id, poll_answer_id);
155
+ polls.method = 'POST';
156
+ polls.element = 'polls-' + poll_id + '-ans';
157
+ polls.onCompletion = poll_fadein_text;
158
+ polls.runAJAX();
159
+ poll_fadein_opacity = 0;
160
+ poll_fadeout_opacity = 100;
161
+ }
162
+ }
163
+
164
+
165
+ // Process Poll's Result
166
+ function poll_process_result() {
167
+ if(poll_fadeout_opacity > 0) {
168
+ poll_fadeout_opacity -= 10;
169
+ if(is_opera) {
170
+ poll_fadeout_opacity = 0;
171
+ } else if(is_ie) {
172
+ document.getElementById('polls-' + poll_id + '-ans').filters.alpha.opacity = poll_fadeout_opacity;
173
+ } else if(is_moz) {
174
+ document.getElementById('polls-' + poll_id + '-ans').style.MozOpacity = (poll_fadeout_opacity/100);
175
+ }
176
+ setTimeout("poll_process_result()", 100);
177
+ } else {
178
+ poll_fadeout_opacity = 0;
179
+ polls.reset();
180
+ polls.setVar("pollresult", poll_id);
181
+ polls.method = 'GET';
182
+ polls.element = 'polls-' + poll_id + '-ans';
183
+ polls.onCompletion = poll_fadein_text;
184
+ polls.runAJAX();
185
+ poll_fadein_opacity = 0;
186
+ poll_fadeout_opacity = 100;
187
+ }
188
+ }
189
+
190
+
191
+ // Process Poll's Voting Booth
192
+ function poll_process_booth() {
193
+ if(poll_fadeout_opacity > 0) {
194
+ poll_fadeout_opacity -= 10;
195
+ if(is_opera) {
196
+ poll_fadeout_opacity = 0;
197
+ } else if(is_ie) {
198
+ document.getElementById('polls-' + poll_id + '-ans').filters.alpha.opacity = poll_fadeout_opacity;
199
+ } else if(is_moz) {
200
+ document.getElementById('polls-' + poll_id + '-ans').style.MozOpacity = (poll_fadeout_opacity/100);
201
+ }
202
+ setTimeout("poll_process_booth()", 100);
203
+ } else {
204
+ poll_fadeout_opacity = 0;
205
+ polls.reset();
206
+ polls.setVar("pollbooth", poll_id);
207
+ polls.method = 'GET';
208
+ polls.element = 'polls-' + poll_id + '-ans';
209
+ polls.onCompletion = poll_fadein_text;
210
+ polls.runAJAX();
211
+ poll_fadein_opacity = 0;
212
+ poll_fadeout_opacity = 100;
213
+ }
214
+ }
polls/polls-manager.php ADDED
@@ -0,0 +1,871 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-Polls 2.14 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Manage Your Polls |
14
+ | - wp-content/plugins/polls/polls-manager.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Polls
21
+ if(!current_user_can('manage_polls')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('polls/polls-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $mode = trim($_GET['mode']);
30
+ $poll_id = intval($_GET['id']);
31
+ $poll_aid = intval($_GET['aid']);
32
+
33
+
34
+ ### Form Processing
35
+ if(!empty($_POST['do'])) {
36
+ // Decide What To Do
37
+ switch($_POST['do']) {
38
+ // Add Poll
39
+ case __('Add Poll', 'wp-polls'):
40
+ // Add Poll Question
41
+ $pollq_question = addslashes(trim($_POST['pollq_question']));
42
+ $timestamp_sql = '';
43
+ $pollq_timestamp_day = intval($_POST['pollq_timestamp_day']);
44
+ $pollq_timestamp_month = intval($_POST['pollq_timestamp_month']);
45
+ $pollq_timestamp_year = intval($_POST['pollq_timestamp_year']);
46
+ $pollq_timestamp_hour = intval($_POST['pollq_timestamp_hour']);
47
+ $pollq_timestamp_minute = intval($_POST['pollq_timestamp_minute']);
48
+ $pollq_timestamp_second = intval($_POST['pollq_timestamp_second']);
49
+ $pollq_timestamp = gmmktime($pollq_timestamp_hour, $pollq_timestamp_minute, $pollq_timestamp_second, $pollq_timestamp_month, $pollq_timestamp_day, $pollq_timestamp_year);
50
+ if($pollq_timestamp > current_time('timestamp')) {
51
+ $pollq_active = -1;
52
+ } else {
53
+ $pollq_active = 1;
54
+ }
55
+ $pollq_expiry_no = intval($_POST['pollq_expiry_no']);
56
+ if($pollq_expiry_no == 1) {
57
+ $pollq_expiry = '';
58
+ } else {
59
+ $pollq_expiry_day = intval($_POST['pollq_expiry_day']);
60
+ $pollq_expiry_month = intval($_POST['pollq_expiry_month']);
61
+ $pollq_expiry_year = intval($_POST['pollq_expiry_year']);
62
+ $pollq_expiry_hour = intval($_POST['pollq_expiry_hour']);
63
+ $pollq_expiry_minute = intval($_POST['pollq_expiry_minute']);
64
+ $pollq_expiry_second = intval($_POST['pollq_expiry_second']);
65
+ $pollq_expiry = gmmktime($pollq_expiry_hour, $pollq_expiry_minute, $pollq_expiry_second, $pollq_expiry_month, $pollq_expiry_day, $pollq_expiry_year);
66
+ if($pollq_expiry <= current_time('timestamp')) {
67
+ $pollq_active = 0;
68
+ }
69
+ }
70
+ $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsq VALUES (0, '$pollq_question', '$pollq_timestamp', 0, $pollq_active, '$pollq_expiry')");
71
+ if(!$add_poll_question) {
72
+ $text .= '<font color="red">'.sprintf(__('Error In Adding Poll \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</font>';
73
+ }
74
+ // Add Poll Answers
75
+ $polla_answers = $_POST['polla_answers'];
76
+ $polla_qid = intval($wpdb->insert_id);
77
+ foreach($polla_answers as $polla_answer) {
78
+ $polla_answer = addslashes(trim($polla_answer));
79
+ $add_poll_answers = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answer', 0)");
80
+ if(!$add_poll_answers) {
81
+ $text .= '<font color="red">'.sprintf(__('Error In Adding Poll\'s Answer \'%s\'', 'wp-polls'), stripslashes($polla_answer)).'</font>';
82
+ }
83
+ }
84
+ // Update Lastest Poll ID To Poll Options
85
+ $latest_pollid = polls_latest_id();
86
+ $update_latestpoll = update_option('poll_latestpoll', $latest_pollid);
87
+ if(empty($text)) {
88
+ $text = '<font color="green">'.__('Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\' '.__('Added Successfully', 'wp-polls').'</font>';
89
+ }
90
+ break;
91
+ // Edit Poll
92
+ case __('Edit Poll', 'wp-polls'):
93
+ // Update Poll's Question
94
+ $pollq_id = intval($_POST['pollq_id']);
95
+ $pollq_totalvotes = intval($_POST['pollq_totalvotes']);
96
+ $pollq_question = addslashes(trim($_POST['pollq_question']));
97
+ $edit_polltimestamp = intval($_POST['edit_polltimestamp']);
98
+ $timestamp_sql = '';
99
+ $pollq_active = 1;
100
+ if($edit_polltimestamp == 1) {
101
+ $pollq_timestamp_day = intval($_POST['pollq_timestamp_day']);
102
+ $pollq_timestamp_month = intval($_POST['pollq_timestamp_month']);
103
+ $pollq_timestamp_year = intval($_POST['pollq_timestamp_year']);
104
+ $pollq_timestamp_hour = intval($_POST['pollq_timestamp_hour']);
105
+ $pollq_timestamp_minute = intval($_POST['pollq_timestamp_minute']);
106
+ $pollq_timestamp_second = intval($_POST['pollq_timestamp_second']);
107
+ $pollq_timestamp = gmmktime($pollq_timestamp_hour, $pollq_timestamp_minute, $pollq_timestamp_second, $pollq_timestamp_month, $pollq_timestamp_day, $pollq_timestamp_year);
108
+ $timestamp_sql = ", pollq_timestamp = '$pollq_timestamp'";
109
+ if($pollq_timestamp > current_time('timestamp')) {
110
+ $pollq_active = -1;
111
+ }
112
+ }
113
+ $pollq_expiry_no = intval($_POST['pollq_expiry_no']);
114
+ if($pollq_expiry_no == 1) {
115
+ $pollq_expiry = '';
116
+ } else {
117
+ $pollq_expiry_day = intval($_POST['pollq_expiry_day']);
118
+ $pollq_expiry_month = intval($_POST['pollq_expiry_month']);
119
+ $pollq_expiry_year = intval($_POST['pollq_expiry_year']);
120
+ $pollq_expiry_hour = intval($_POST['pollq_expiry_hour']);
121
+ $pollq_expiry_minute = intval($_POST['pollq_expiry_minute']);
122
+ $pollq_expiry_second = intval($_POST['pollq_expiry_second']);
123
+ $pollq_expiry = gmmktime($pollq_expiry_hour, $pollq_expiry_minute, $pollq_expiry_second, $pollq_expiry_month, $pollq_expiry_day, $pollq_expiry_year);
124
+ if($pollq_expiry <= current_time('timestamp')) {
125
+ $pollq_active = 0;
126
+ }
127
+ if($edit_polltimestamp == 1) {
128
+ if($pollq_expiry < $pollq_timestamp) {
129
+ $pollq_active = 0;
130
+ }
131
+ }
132
+ }
133
+ $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");
134
+ if(!$edit_poll_question) {
135
+ $text = '<font color="blue">'.__('No Changes Had Been Made To Poll\'s Title', 'wp-polls').' \''.stripslashes($pollq_question).'\'</font>';
136
+ }
137
+ // Update Polls' Answers
138
+ $polla_aids = array();
139
+ $get_polla_aids = $wpdb->get_results("SELECT polla_aid FROM $wpdb->pollsa WHERE polla_qid = $pollq_id ORDER BY polla_aid ASC");
140
+ if($get_polla_aids) {
141
+ foreach($get_polla_aids as $get_polla_aid) {
142
+ $polla_aids[] = intval($get_polla_aid->polla_aid);
143
+ }
144
+ foreach($polla_aids as $polla_aid) {
145
+ $polla_answers = addslashes(trim($_POST['polla_aid-'.$polla_aid]));
146
+ $polla_votes = intval($_POST['polla_votes-'.$polla_aid]);
147
+ $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");
148
+ if(!$edit_poll_answer) {
149
+ $text .= '<br /><font color="blue">'.__('No Changes Had Been Made To Poll\'s Answer', 'wp-polls').' \''.stripslashes($polla_answers).'\'</font>';
150
+ }
151
+ }
152
+ } else {
153
+ $text .= '<br /><font color="red">'.__('Invalid Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\'</font>';
154
+ }
155
+ if(empty($text)) {
156
+ $text = '<font color="green">'.__('Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\' '.__('Edited Successfully', 'wp-polls').'</font>';
157
+ }
158
+ // Update Lastest Poll ID To Poll Options
159
+ $latest_pollid = polls_latest_id();
160
+ $update_latestpoll = update_option('poll_latestpoll', $latest_pollid);
161
+ break;
162
+ // Open Poll
163
+ case __('Open Poll', 'wp-polls'):
164
+ $pollq_id = intval($_POST['pollq_id']);
165
+ $pollq_question = addslashes(trim($_POST['pollq_question']));
166
+ $close_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_id = $pollq_id;");
167
+ if($close_poll) {
168
+ $text = '<font color="green">'.__('Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\' '.__('Is Now Opened', 'wp-polls').'</font>';
169
+ } else {
170
+ $text = '<font color="red">'.__('Error Opening Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\'</font>';
171
+ }
172
+ break;
173
+ // Close Poll
174
+ case __('Close Poll', 'wp-polls'):
175
+ $pollq_id = intval($_POST['pollq_id']);
176
+ $pollq_question = addslashes(trim($_POST['pollq_question']));
177
+ $close_poll = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_id = $pollq_id;");
178
+ if($close_poll) {
179
+ $text = '<font color="green">'.__('Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\' '.__('Is Now Closed', 'wp-polls').'</font>';
180
+ } else {
181
+ $text = '<font color="red">'.__('Error Closing Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\'</font>';
182
+ }
183
+ break;
184
+ // Delete Poll
185
+ case __('Delete Poll', 'wp-polls'):
186
+ $pollq_id = intval($_POST['pollq_id']);
187
+ $pollq_question = trim($_POST['pollq_question']);
188
+ $delete_poll_question = $wpdb->query("DELETE FROM $wpdb->pollsq WHERE pollq_id = $pollq_id");
189
+ $delete_poll_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_qid = $pollq_id");
190
+ $delete_poll_ip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
191
+ $poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
192
+ if(!$delete_poll_question) {
193
+ $text = '<font color="red">'.sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), stripslashes($pollq_question)).'</font>';
194
+ }
195
+ if(!$delete_poll_answers) {
196
+ $text .= '<br /><font color="blue">'.sprintf(__('No Poll Answers For \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</font>';
197
+ }
198
+ if(!$delete_poll_ip) {
199
+ $text .= '<br /><font color="blue">'.sprintf(__('No Voted IPs For \'%s\'', 'wp-polls'), stripslashes($pollq_question)).'</font>';
200
+ }
201
+ if(empty($text)) {
202
+ $text = '<font color="green">'.__('Poll', 'wp-polls').' \''.stripslashes($pollq_question).'\' '.__('Deleted Successfully', 'wp-polls').'</font>';
203
+ }
204
+ // Update Lastest Poll ID To Poll Options
205
+ $latest_pollid = polls_latest_id();
206
+ $update_latestpoll = update_option('poll_latestpoll', $latest_pollid);
207
+ break;
208
+ // Add Poll's Answer
209
+ case __('Add Answer', 'wp-polls'):
210
+ $polla_qid = intval($_POST['polla_qid']);
211
+ $polla_answers = addslashes(trim($_POST['polla_answers']));
212
+ $add_poll_question = $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (0, $polla_qid, '$polla_answers', 0)");
213
+ if(!$add_poll_question) {
214
+ $text = '<font color="red">'.sprintf(__('Error In Adding Poll Answer \'%s\'', 'wp-polls'), stripslashes($polla_answers)).'</font>';
215
+ } else {
216
+ $text = '<font color="green">'.__('Poll Answer', 'wp-polls').' \''.stripslashes($polla_answers).'\' '.__('Added Successfully', 'wp-polls').'</font>';
217
+ }
218
+ break;
219
+ // Delete Polls Logs
220
+ case __('Delete All Logs', 'wp-polls'):
221
+ if(trim($_POST['delete_logs_yes']) == 'yes') {
222
+ $delete_logs = $wpdb->query("DELETE FROM $wpdb->pollsip");
223
+ if($delete_logs) {
224
+ $text = '<font color="green">'.__('All Polls Logs Have Been Deleted.', 'wp-polls').'</font>';
225
+ } else {
226
+ $text = '<font color="red">'.__('An Error Has Occured While Deleting All Polls Logs.', 'wp-polls').'</font>';
227
+ }
228
+ }
229
+ break;
230
+ // Delete Poll Logs For Individual Poll
231
+ case __('Delete Logs For This Poll Only', 'wp-polls'):
232
+ $pollq_id = intval($_POST['pollq_id']);
233
+ if(trim($_POST['delete_logs_yes']) == 'yes') {
234
+ $delete_logs = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $pollq_id");
235
+ if($delete_logs) {
236
+ $text = '<font color="green">'.__('All Logs For This Poll Have Been Deleted.', 'wp-polls').'</font>';
237
+ } else {
238
+ $text = '<font color="red">'.__('An Error Has Occured While Deleting All Logs For This Poll.', 'wp-polls').'</font>';
239
+ }
240
+ }
241
+ break;
242
+ // Uninstall WP-Polls (By: Philippe Corbes)
243
+ case __('UNINSTALL Polls', 'wp-polls') :
244
+ if(trim($_POST['uninstall_poll_yes']) == 'yes') {
245
+ echo '<div id="message" class="updated fade"><p>';
246
+ $polls_tables = array($wpdb->pollsq, $wpdb->pollsa, $wpdb->pollsip);
247
+ foreach($polls_tables as $table) {
248
+ $wpdb->query("DROP TABLE {$table}");
249
+ echo '<font color="green">';
250
+ printf(__('Table "%s" Has Been Dropped.', 'wp-polls'), "<strong><em>{$table}</em></strong>");
251
+ echo '</font><br />';
252
+ }
253
+ $polls_settings = array('poll_template_voteheader', 'poll_template_votebody', 'poll_template_votefooter', 'poll_template_resultheader',
254
+ 'poll_template_resultbody', 'poll_template_resultbody2', 'poll_template_resultfooter', 'poll_template_resultfooter2',
255
+ 'poll_template_disable', 'poll_template_error', 'poll_currentpoll', 'poll_latestpoll',
256
+ 'poll_archive_perpage', 'poll_ans_sortby', 'poll_ans_sortorder', 'poll_ans_result_sortby',
257
+ 'poll_ans_result_sortorder', 'poll_logging_method', 'poll_allowtovote', 'poll_archive_show',
258
+ 'poll_archive_url', 'poll_bar', 'poll_close');
259
+ foreach($polls_settings as $setting) {
260
+ $delete_setting = delete_option($setting);
261
+ if($delete_setting) {
262
+ echo '<font color="green">';
263
+ printf(__('Setting Key \'%s\' Has been Errased.', 'wp-polls'), "<strong><em>{$setting}</em></strong>");
264
+ } else {
265
+ echo '<font color="red">';
266
+ printf(__('Error Deleting Setting Key \'%s\'.', 'wp-polls'), "<strong><em>{$setting}</em></strong>");
267
+ }
268
+ echo '</font><br />';
269
+ }
270
+ echo '</p></div>';
271
+ $mode = 'end-UNINSTALL';
272
+ }
273
+ break;
274
+ }
275
+ }
276
+
277
+
278
+ ### Determines Which Mode It Is
279
+ switch($mode) {
280
+ // Add A Poll
281
+ case 'add':
282
+ ?>
283
+ <script type="text/javascript">
284
+ /* <![CDATA[*/
285
+ function check_pollexpiry() {
286
+ poll_expiry = document.getElementById("pollq_expiry_no").checked;
287
+ if(poll_expiry) {
288
+ document.getElementById("pollq_expiry").style.display = 'none';
289
+ } else {
290
+ document.getElementById("pollq_expiry").style.display = 'block';
291
+ }
292
+ }
293
+ /* ]]> */
294
+ </script>
295
+ <div class="wrap">
296
+ <h2><?php _e('Add Poll', 'wp-polls'); ?></h2>
297
+ <?php
298
+ if(isset($_POST['addpollquestion'])) {
299
+ $poll_noquestion = intval($_POST['poll_noquestion']);
300
+ $pollq_question = stripslashes(trim($_POST['pollq_question']));
301
+ ?>
302
+ <form action="<?php echo $base_page; ?>" method="post">
303
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
304
+ <tr class="thead">
305
+ <th align="left"><?php _e('Question', 'wp-polls') ?></th>
306
+ <td><input type="text" size="50" maxlength="200" name="pollq_question" value="<?php echo htmlspecialchars($pollq_question); ?>" /></td>
307
+ </tr>
308
+ <?php
309
+ $count = 0;
310
+ for($i=1; $i<=$poll_noquestion; $i++) {
311
+ if($i%2 == 0) {
312
+ $style = 'style=\'background-color: #eee;\'';
313
+ } else {
314
+ $style = 'style=\'background: none;\'';
315
+ }
316
+ echo "<tr $style>\n";
317
+ echo "<th align=\"left\" scope=\"row\">Answers $i:</th>\n";
318
+ echo "<td><input type=\"text\" size=\"30\" maxlength=\"200\" name=\"polla_answers[]\" /></td>\n";
319
+ echo "</tr>\n";
320
+ $count++;
321
+ }
322
+ ?>
323
+ <tr style="<?php if($count%2 == 0) { echo 'background: none;'; } else { echo 'background-color: #eee;' ;} $count++; ?>">
324
+ <th align="left"><?php _e('Start Date/Time:', 'wp-polls') ?></th>
325
+ <td>
326
+ <?php
327
+ poll_timestamp(current_time('timestamp'));
328
+ ?>
329
+ </td>
330
+ </tr>
331
+ <tr style="<?php if($count%2 == 0) { echo 'background: none;'; } else { echo 'background-color: #eee;' ;} ?>">
332
+ <th valign="top" align="left"><?php _e('End Date/Time:', 'wp-polls') ?></th>
333
+ <td>
334
+ <input type="checkbox" name="pollq_expiry_no" id="pollq_expiry_no" value="1" checked="checked" onclick="check_pollexpiry();" />&nbsp;&nbsp;<label for="pollq_expiry_no"><?php _e('Do NOT Expire This Poll', 'wp-polls'); ?></label>
335
+ <?php
336
+ poll_timestamp(current_time('timestamp'), 'pollq_expiry', 'none');
337
+ ?>
338
+ </td>
339
+ </tr>
340
+ <tr>
341
+ <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Add Poll', 'wp-polls'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
342
+ </tr>
343
+ </table>
344
+ </form>
345
+ <?php } else {?>
346
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>&amp;mode=add" method="post">
347
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
348
+ <tr>
349
+ <th align="left"><?php _e('Question', 'wp-polls') ?></th>
350
+ <td><input type="text" size="50" maxlength="200" name="pollq_question" /></td>
351
+ </tr>
352
+ <tr>
353
+ <th align="left"><?php _e('No. Of Answers:', 'wp-polls') ?></th>
354
+ <td>
355
+ <select size="1" name="poll_noquestion">
356
+ <?php
357
+ for($i=2; $i <= 20; $i++) {
358
+ echo "<option value=\"$i\">$i</option>";
359
+ }
360
+ ?>
361
+ </select>
362
+ </td>
363
+ </tr>
364
+ <tr>
365
+ <td colspan="2" align="center"><input type="submit" name="addpollquestion" value="<?php _e('Add Question', 'wp-polls'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
366
+ </tr>
367
+ </table>
368
+ </form>
369
+ <?php } ?>
370
+ </div>
371
+ <?php
372
+ break;
373
+ // Edit A Poll
374
+ case 'edit':
375
+ $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
376
+ $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");
377
+ $poll_question_text = stripslashes($poll_question->pollq_question);
378
+ $poll_totalvotes = intval($poll_question->pollq_totalvote);
379
+ $poll_timestamp = $poll_question->pollq_timestamp;
380
+ $poll_active = intval($poll_question->pollq_active);
381
+ $poll_expiry = trim($poll_question->pollq_expiry);
382
+ ?>
383
+ <script type="text/javascript">
384
+ /* <![CDATA[*/
385
+ function check_totalvotes() {
386
+ var total_votes = 0;
387
+ var temp_vote = 0;
388
+ <?php
389
+ foreach($poll_answers as $poll_answer) {
390
+ $polla_aid = intval($poll_answer->polla_aid);
391
+ echo "\t\t\t\ttemp_vote = parseInt(document.getElementById('polla_votes-$polla_aid').value);\n";
392
+ echo "\t\t\t\tif(isNaN(temp_vote)) {\n";
393
+ echo "\t\t\t\tdocument.getElementById('polla_votes-$polla_aid').value = 0;\n";
394
+ echo "\t\t\t\ttemp_vote = 0;\n";
395
+ echo "\t\t\t\t}\n";
396
+ echo "\t\t\t\ttotal_votes += temp_vote;\n";
397
+ }
398
+ ?>
399
+ document.getElementById('pollq_totalvotes').value = parseInt(total_votes);
400
+ }
401
+ function check_polltimestamp() {
402
+ poll_edit_polltimestamp = document.getElementById("edit_polltimestamp").checked;
403
+ if(poll_edit_polltimestamp) {
404
+ document.getElementById("pollq_timestamp").style.display = 'block';
405
+ } else {
406
+ document.getElementById("pollq_timestamp").style.display = 'none';
407
+ }
408
+ }
409
+ /* ]]> */
410
+ </script>
411
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.stripslashes($text).'</p></div>'; } ?>
412
+ <!-- Edit Poll -->
413
+ <div class="wrap">
414
+ <h2><?php _e('Edit Poll', 'wp-polls'); ?></h2>
415
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
416
+ <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>" />
417
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
418
+ <tr>
419
+ <th colspan="2"><?php _e('Question', 'wp-polls') ?></th>
420
+ </tr>
421
+ <tr>
422
+ <td align="center" colspan="2"><input type="text" size="70" maxlength="200" name="pollq_question" value="<?php echo htmlspecialchars($poll_question_text); ?>" /></td>
423
+ </tr>
424
+ <tr>
425
+ <th align="left"><?php _e('Answers:', 'wp-polls') ?></th>
426
+ <th align="right"><?php _e('No. Of Votes', 'wp-polls') ?></th>
427
+ </tr>
428
+ <?php
429
+ $i=1;
430
+ $poll_actual_totalvotes = 0;
431
+ if($poll_answers) {
432
+ $pollip_answers = array();
433
+ $pollip_answers[0] = __('Null Votes', 'wp-polls');
434
+ foreach($poll_answers as $poll_answer) {
435
+ $polla_aid = intval($poll_answer->polla_aid);
436
+ $polla_answers = stripslashes($poll_answer->polla_answers);
437
+ $polla_votes = intval($poll_answer->polla_votes);
438
+ $pollip_answers[$polla_aid] = $polla_answers;
439
+ echo "<tr>\n";
440
+ echo "<td align=\"left\">".__('Answer', 'wp-polls')." $i:&nbsp;&nbsp;&nbsp;<input type=\"text\" size=\"50\" maxlength=\"200\" name=\"polla_aid-$polla_aid\" value=\"".htmlspecialchars($polla_answers)."\" />&nbsp;&nbsp;&nbsp;";
441
+ echo "<a href=\"$base_page&amp;mode=deleteans&amp;id=$poll_id&amp;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";
442
+ echo "<td align=\"right\">$polla_votes&nbsp;&nbsp;&nbsp;<input type=\"text\" size=\"4\" maxlength=\"6\" id=\"polla_votes-$polla_aid\" name=\"polla_votes-$polla_aid\" value=\"$polla_votes\" onblur=\"check_totalvotes();\" /></td>\n</tr>\n";
443
+ $poll_actual_totalvotes += $polla_votes;
444
+ $i++;
445
+ }
446
+ }
447
+ ?>
448
+ <tr>
449
+ <td align="right" colspan="2"><strong><?php _e('Total Votes', 'wp-polls'); ?>: <?php echo $poll_actual_totalvotes; ?></strong>&nbsp;&nbsp;&nbsp;<input type="text" size="4" maxlength="4" id="pollq_totalvotes" name="pollq_totalvotes" value="<?php echo $poll_actual_totalvotes; ?>" onblur="check_totalvotes();" /></td>
450
+ </tr>
451
+ <tr>
452
+ <td><strong><?php _e('Start Date/Time', 'wp-polls'); ?></strong>: <?php echo mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_timestamp)); ?></td>
453
+ </tr>
454
+ <tr>
455
+ <td colspan="2"><input type="checkbox" name="edit_polltimestamp" id="edit_polltimestamp" value="1" onclick="check_polltimestamp()" />&nbsp;<label for="edit_polltimestamp"><?php _e('Edit Start Date/Time', 'wp-polls'); ?></label><br /><?php poll_timestamp($poll_timestamp, 'pollq_timestamp', 'none'); ?><br /></td>
456
+ </tr>
457
+ <tr>
458
+ <td colspan="2">
459
+ <strong><?php _e('End Date/Time', 'wp-polls'); ?></strong>:
460
+ <?php
461
+ if(empty($poll_expiry)) {
462
+ _e('This Poll Will Not Expire', 'wp-polls');
463
+ } else {
464
+ echo mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry));
465
+ }
466
+ ?>
467
+ </td>
468
+ </tr>
469
+ <tr>
470
+ <td colspan="2">
471
+ <input type="checkbox" name="pollq_expiry_no" id="pollq_expiry_no" value="1" <?php if(empty($poll_expiry)) { echo 'checked="checked"'; } ?> />
472
+ <label for="pollq_expiry_no"><?php _e('Do NOT Expire This Poll', 'wp-polls'); ?></label><br />
473
+ <?php
474
+ if(empty($poll_expiry)) {
475
+ poll_timestamp(current_time('timestamp'), 'pollq_expiry');
476
+ } else {
477
+ poll_timestamp($poll_expiry, 'pollq_expiry');
478
+ }
479
+ ?>
480
+ <br />
481
+ </td>
482
+ </tr>
483
+ <tr>
484
+ <td align="center" colspan="2"><input type="submit" name="do" value="<?php _e('Edit Poll', 'wp-polls'); ?>" class="button" />&nbsp;&nbsp;
485
+ <?php if($poll_active == 1) { ?>
486
+ <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'); ?>.')" />
487
+ <?php } else { ?>
488
+ <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'); ?>.')" />
489
+ <?php } ?>
490
+ &nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
491
+ </tr>
492
+ </table>
493
+ </form>
494
+ </div>
495
+ <!-- Add Poll's Answer -->
496
+ <div class="wrap">
497
+ <h2><?php _e('Add Answer', 'wp-polls') ?></h2>
498
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>&amp;mode=edit&amp;id=<?php echo $poll_id; ?>" method="post">
499
+ <input type="hidden" name="polla_qid" value="<?php echo $poll_id; ?>" />
500
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
501
+ <tr>
502
+ <td><strong><?php _e('Add Answer', 'wp-polls') ?></strong></td>
503
+ <td><input type="text" size="50" maxlength="200" name="polla_answers" /></td>
504
+ </tr>
505
+ <tr>
506
+ <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Add Answer', 'wp-polls'); ?>" class="button" /></td>
507
+ </tr>
508
+ </table>
509
+ </form>
510
+ </div>
511
+ <!-- Users Voted For This Poll -->
512
+ <?php
513
+ $poll_ips = $wpdb->get_results("SELECT pollip_aid, pollip_ip, pollip_host, pollip_timestamp, pollip_user FROM $wpdb->pollsip WHERE pollip_qid = $poll_id ORDER BY pollip_aid ASC, pollip_user ASC");
514
+ ?>
515
+ <div class="wrap">
516
+ <h2><?php _e('Users Voted For This Poll', 'wp-polls') ?></h2>
517
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
518
+ <?php
519
+ if($poll_ips) {
520
+ $k = 1;
521
+ $poll_last_aid = -1;
522
+ foreach($poll_ips as $poll_ip) {
523
+ $pollip_aid = intval($poll_ip->pollip_aid);
524
+ $pollip_user = stripslashes($poll_ip->pollip_user);
525
+ $pollip_ip = $poll_ip->pollip_ip;
526
+ $pollip_host = $poll_ip->pollip_host;
527
+ $pollip_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_ip->pollip_timestamp));
528
+ if($pollip_aid != $poll_last_aid) {
529
+ if($pollip_aid == 0) {
530
+ echo "<tr style='background-color: #b8d4ff'>\n<td colspan=\"4\"><strong>$pollip_answers[$pollip_aid]</strong></td>\n</tr>\n";
531
+ } else {
532
+ echo "<tr style='background-color: #b8d4ff'>\n<td colspan=\"4\"><strong>".__('Answer', 'wp-polls')." $k: $pollip_answers[$pollip_aid]</strong></td>\n</tr>\n";
533
+ $k++;
534
+ }
535
+ echo "<tr>\n";
536
+ echo "<th scope=\"row\">".__('No.', 'wp-polls')."</th>\n";
537
+ echo "<th scope=\"row\">".__('User', 'wp-polls')."</th>\n";
538
+ echo "<th scope=\"row\">".__('IP/Host', 'wp-polls')."</th>\n";
539
+ echo "<th scope=\"row\">".__('Date', 'wp-polls')."</th>\n";
540
+ echo "</tr>\n";
541
+ $i = 1;
542
+ }
543
+ if($i%2 == 0) {
544
+ $style = 'style=\'background-color: none\'';
545
+ } else {
546
+ $style = 'style=\'background-color: #eee\'';
547
+ }
548
+ echo "<tr $style>\n";
549
+ echo "<td>$i</td>\n";
550
+ echo "<td>$pollip_user</td>\n";
551
+ echo "<td>$pollip_ip / $pollip_host</td>\n";
552
+ echo "<td>$pollip_date</td>\n";
553
+ echo "</tr>\n";
554
+ $poll_last_aid = $pollip_aid;
555
+ $i++;
556
+ }
557
+ } else {
558
+ echo "<tr>\n<td colspan=\"4\" align=\"center\">".__('No IP Has Been Logged Yet.', 'wp-polls')."</td>\n</tr>\n";
559
+ }
560
+ ?>
561
+ </table>
562
+ </div>
563
+ <!-- Delete Poll Logs -->
564
+ <div class="wrap">
565
+ <h2><?php _e('Poll Logs', 'wp-polls'); ?></h2>
566
+ <div align="center">
567
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
568
+ <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>" />
569
+ <strong><?php _e('Are You Sure You Want To Delete Logs For This Poll Only?', 'wp-polls'); ?></strong><br /><br />
570
+ <input type="checkbox" name="delete_logs_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-polls'); ?><br /><br />
571
+ <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'); ?>')" />
572
+ </form>
573
+ </div>
574
+ <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>
575
+ </div>
576
+ <?php
577
+ break;
578
+ // Delete A Poll
579
+ case 'delete':
580
+ $poll_question = $wpdb->get_row("SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
581
+ $poll_answers = $wpdb->get_results("SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = $poll_id ORDER BY polla_answers");
582
+ $poll_question_text = stripslashes($poll_question->pollq_question);
583
+ $poll_totalvotes = intval($poll_question->pollq_totalvotes);
584
+ $poll_active = intval($poll_question->pollq_active);
585
+ $poll_timestamp = $poll_question->pollq_timestamp;
586
+ $poll_expiry = trim($poll_question->pollq_expiry);
587
+ ?>
588
+ <!-- Delete Poll -->
589
+ <div class="wrap">
590
+ <h2><?php _e('Delete Poll', 'wp-polls') ?></h2>
591
+ <form action="<?php echo $base_page; ?>" method="post">
592
+ <input type="hidden" name="pollq_id" value="<?php echo $poll_id; ?>" />
593
+ <input type="hidden" name="pollq_question" value="<?php echo htmlspecialchars($poll_question_text); ?>" />
594
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
595
+ <tr>
596
+ <th colspan="2"><?php _e('Question', 'wp-polls') ?></th>
597
+ </tr>
598
+ <tr>
599
+ <td colspan="2" align="center"><?php echo $poll_question_text; ?></td>
600
+ </tr>
601
+ <tr>
602
+ <th align="left"><?php _e('Answers', 'wp-polls') ?></th>
603
+ <th><?php _e('No. Of Votes', 'wp-polls') ?></th>
604
+ </tr>
605
+ <?php
606
+ $i=1;
607
+ if($poll_answers) {
608
+ foreach($poll_answers as $poll_answer) {
609
+ $polla_answers = stripslashes($poll_answer->polla_answers);
610
+ $polla_votes = intval($poll_answer->polla_votes);
611
+ echo "<tr>\n";
612
+ echo "<td>".__('Answer', 'wp-polls')." $i:&nbsp;&nbsp;&nbsp;$polla_answers</td>\n";
613
+ echo "<td align=\"center\">$polla_votes</td>\n</tr>\n";
614
+ $i++;
615
+ }
616
+ }
617
+ ?>
618
+ <tr>
619
+ <td align="center" colspan="2"><strong><?php _e('Total Votes', 'wp-polls'); ?></strong>: <?php echo $poll_totalvotes; ?></td>
620
+ </tr>
621
+ <tr>
622
+ <td colspan="2">
623
+ <strong><?php _e('Status', 'wp-polls'); ?></strong>:
624
+ <?php
625
+ if($poll_active == 1) {
626
+ _e('Open', 'wp-polls');
627
+ } elseif($poll_active == -1) {
628
+ _e('Future', 'wp-polls');
629
+ } else {
630
+ _e('Closed', 'wp-polls');
631
+ }
632
+ ?>
633
+ </td>
634
+ </tr>
635
+ <tr>
636
+ <td colspan="2"><strong><?php _e('Start Date/Time', 'wp-polls'); ?></strong>: <?php echo mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_timestamp)); ?></td>
637
+ </tr>
638
+ <tr>
639
+ <td colspan="2"><strong><?php _e('End Date/Time', 'wp-polls'); ?></strong>:
640
+ <?php
641
+ if(empty($poll_expiry)) {
642
+ _e('This Poll Will Not Expire', 'wp-polls');
643
+ } else {
644
+ echo mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry));
645
+ }
646
+ ?>
647
+ </td>
648
+ </tr>
649
+ <tr>
650
+ <td align="center" colspan="2"><br /><p><strong><?php _e('You Are About To Delete This Poll', 'wp-polls'); ?> '<?php echo $poll_question_text; ?>'</strong></p>
651
+ <input type="submit" class="button" name="do" value="<?php _e('Delete Poll', 'wp-polls'); ?>" onclick="return confirm('<?php _e('You Are About To Delete This Poll', 'wp-polls'); ?>.\n\n<?php _e('This Action Is Not Reversible. Are you sure?', 'wp-polls'); ?>')" />&nbsp;&nbsp;
652
+ <input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
653
+ </tr>
654
+ </table>
655
+ </form>
656
+ </div>
657
+ <?php
658
+ break;
659
+ // Delete A Poll Answer
660
+ case 'deleteans':
661
+ $poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");
662
+ $polla_votes = intval($poll_answers->polla_votes);
663
+ $polla_answers = stripslashes(trim($poll_answers->polla_answers));
664
+ $delete_polla_answers = $wpdb->query("DELETE FROM $wpdb->pollsa WHERE polla_aid = $poll_aid AND polla_qid = $poll_id");
665
+ $delete_pollip = $wpdb->query("DELETE FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_aid = $poll_aid");
666
+ $update_pollq_totalvotes = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes-$polla_votes) WHERE pollq_id=$poll_id");
667
+ ?>
668
+ <!-- Delete Poll's Answer -->
669
+ <div class="wrap">
670
+ <h2><?php _e('Delete Poll\'s Answer', 'wp-polls') ?></h2>
671
+ <?php
672
+ if($delete_polla_answers) {
673
+ echo "<font color=\"green\">".__('Poll Answer', 'wp-polls')." '$polla_answers' ".__('Deleted Successfully', 'wp-polls')."</font>";
674
+ } else {
675
+ echo "<font color=\"red\">".__('Error In Deleting Poll Answer', 'wp-polls')." '$polla_answers'</font>";
676
+ }
677
+ if($update_pollq_totalvotes) {
678
+ echo "<br /><font color=\"green\">".__('Poll Question\'s Total Votes Updated Successfully', 'wp-polls')."</font>";
679
+ } else {
680
+ echo "<br /><font color=\"blue\">".__('No Changes Have Been Made To The Poll\'s Total Votes', 'wp-polls')."</font>";
681
+ }
682
+ if($delete_pollip) {
683
+ echo "<br /><font color=\"green\">".__('Poll IP Logs Updated Successfully', 'wp-polls')."</font>";
684
+ } else {
685
+ echo "<br /><font color=\"blue\">".__('No Changes Have Been Made To The Poll IP Logs', 'wp-polls')."</font>";
686
+ }
687
+ ?>
688
+ <p><strong><a href="<?php echo $base_page; ?>&amp;mode=edit&amp;id=<?php echo $poll_id; ?>"><?php _e('Click here To Go Back To The Poll Edit Page', 'wp-polls'); ?></a>.</strong></p>
689
+ </div>
690
+ <?php
691
+ break;
692
+ // Deactivating WP-Polls (By: Philippe Corbes)
693
+ case 'end-UNINSTALL':
694
+ echo '<div class="wrap">';
695
+ echo '<h2>'; _e('Uninstall Polls', 'wp-polls'); echo'</h2>';
696
+ echo '<p><strong>';
697
+ $deactivate_url = "plugins.php?action=deactivate&amp;plugin=polls/polls.php";
698
+ if(function_exists('wp_nonce_url')) {
699
+ $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_polls/polls.php');
700
+ }
701
+ printf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-Polls Will Be Deactivated Automatically.', 'wp-polls'), $deactivate_url);
702
+ echo '</a>';
703
+ echo '</strong></p>';
704
+ echo '</div>';
705
+ break;
706
+ // Main Page
707
+ default:
708
+ $polls = $wpdb->get_results("SELECT * FROM $wpdb->pollsq ORDER BY pollq_timestamp DESC");
709
+ $total_ans = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pollsa");
710
+ $total_votes = 0;
711
+ ?>
712
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.stripslashes($text).'</p></div>'; } ?>
713
+ <!-- Manage Polls -->
714
+ <div class="wrap">
715
+ <h2><?php _e('Manage Polls', 'wp-polls'); ?></h2>
716
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
717
+ <tr class="thead">
718
+ <th><?php _e('ID', 'wp-polls'); ?></th>
719
+ <th><?php _e('Question', 'wp-polls'); ?></th>
720
+ <th><?php _e('Total Votes', 'wp-polls'); ?></th>
721
+ <th><?php _e('Start Date/Time', 'wp-polls'); ?></th>
722
+ <th><?php _e('End Date/Time', 'wp-polls'); ?></th>
723
+ <th><?php _e('Status', 'wp-polls'); ?></th>
724
+ <th colspan="2"><?php _e('Action', 'wp-polls'); ?></th>
725
+ </tr>
726
+ <?php
727
+ if($polls) {
728
+ $i = 0;
729
+ $current_poll = intval(get_option('poll_currentpoll'));
730
+ $latest_poll = intval(get_option('poll_latestpoll'));
731
+ foreach($polls as $poll) {
732
+ $poll_id = intval($poll->pollq_id);
733
+ $poll_question = stripslashes($poll->pollq_question);
734
+ $poll_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll->pollq_timestamp));
735
+ $poll_totalvotes = intval($poll->pollq_totalvotes);
736
+ $poll_active = intval($poll->pollq_active);
737
+ $poll_expiry = trim($poll->pollq_expiry);
738
+ if(empty($poll_expiry)) {
739
+ $poll_expiry_text = __('No Expiry', 'wp-polls');
740
+ } else {
741
+ $poll_expiry_text = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry));
742
+ }
743
+ if($i%2 == 0) {
744
+ $style = 'style=\'background-color: #eee;\'';
745
+ } else {
746
+ $style = 'style=\'background: none;\'';
747
+ }
748
+ if($current_poll > 0) {
749
+ if($current_poll == $poll_id) {
750
+ $style = 'style=\'background-color: #b8d4ff;\'';
751
+ }
752
+ } elseif($current_poll == 0) {
753
+ if($poll_id == $latest_poll) {
754
+ $style = 'style=\'background-color: #b8d4ff;\'';
755
+ }
756
+ }
757
+ echo "<tr $style>\n";
758
+ echo "<td><strong>$poll_id</strong></td>\n";
759
+ echo '<td>';
760
+ if($current_poll > 0) {
761
+ if($current_poll == $poll_id) {
762
+ echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
763
+ }
764
+ } elseif($current_poll == 0) {
765
+ if($poll_id == $latest_poll) {
766
+ echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
767
+ }
768
+ }
769
+ echo "$poll_question</td>\n";
770
+ echo "<td>$poll_totalvotes</td>\n";
771
+ echo "<td>$poll_date</td>\n";
772
+ echo "<td>$poll_expiry_text</td>\n";
773
+ echo '<td>';
774
+ if($poll_active == 1) {
775
+ _e('Open', 'wp-polls');
776
+ } elseif($poll_active == -1) {
777
+ _e('Future', 'wp-polls');
778
+ } else {
779
+ _e('Closed', 'wp-polls');
780
+ }
781
+ echo "</td>\n";
782
+ echo "<td><a href=\"$base_page&amp;mode=edit&amp;id=$poll_id\" class=\"edit\">".__('Edit')."</a></td>\n";
783
+ echo "<td><a href=\"$base_page&amp;mode=delete&amp;id=$poll_id\" class=\"delete\">".__('Delete')."</a></td>\n";
784
+ echo '</tr>';
785
+ $i++;
786
+ $total_votes+= $poll_totalvotes;
787
+
788
+ }
789
+ } else {
790
+ echo '<tr><td colspan="7" align="center"><strong>'.__('No Polls Found', 'wp-polls').'</strong></td></tr>';
791
+ }
792
+ ?>
793
+ </table>
794
+ </div>
795
+ <!-- Add A Poll -->
796
+ <div class="wrap">
797
+ <h2><?php _e('Add A Poll', 'wp-polls'); ?></h2>
798
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>&amp;mode=add" method="post">
799
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
800
+ <tr>
801
+ <th align="left"><?php _e('Question', 'wp-polls') ?></th>
802
+ <td><input type="text" size="50" maxlength="200" name="pollq_question" /></td>
803
+ </tr>
804
+ <tr>
805
+ <th align="left"><?php _e('No. Of Answers:', 'wp-polls') ?></th>
806
+ <td>
807
+ <select size="1" name="poll_noquestion">
808
+ <?php
809
+ for($k=2; $k <= 20; $k++) {
810
+ echo "<option value=\"$k\">$k</option>";
811
+ }
812
+ ?>
813
+ </select>
814
+ </td>
815
+ </tr>
816
+ <tr>
817
+ <td colspan="2" align="center"><input type="submit" name="addpollquestion" value="<?php _e('Add Question', 'wp-polls'); ?>" class="button" /></td>
818
+ </tr>
819
+ </table>
820
+ </form>
821
+ </div>
822
+ <!-- Polls Stats -->
823
+ <div class="wrap">
824
+ <h2><?php _e('Polls Stats', 'wp-polls'); ?></h2>
825
+ <table border="0" cellspacing="3" cellpadding="3">
826
+ <tr>
827
+ <th align="left"><?php _e('Total Polls:', 'wp-polls'); ?></th>
828
+ <td align="left"><?php echo $i; ?></td>
829
+ </tr>
830
+ <tr>
831
+ <th align="left"><?php _e('Total Polls\' Answers:', 'wp-polls'); ?></th>
832
+ <td align="left"><?php echo number_format($total_ans); ?></td>
833
+ </tr>
834
+ <tr>
835
+ <th align="left"><?php _e('Total Votes Casted:', 'wp-polls'); ?></th>
836
+ <td align="left"><?php echo number_format($total_votes); ?></td>
837
+ </tr>
838
+ </table>
839
+ </div>
840
+ <!-- Delete Polls Logs -->
841
+ <div class="wrap">
842
+ <h2><?php _e('Polls Logs', 'wp-polls'); ?></h2>
843
+ <div align="center">
844
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
845
+ <strong><?php _e('Are You Sure You Want To Delete All Polls Logs?', 'wp-polls'); ?></strong><br /><br />
846
+ <input type="checkbox" name="delete_logs_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-polls'); ?><br /><br />
847
+ <input type="submit" name="do" value="<?php _e('Delete All Logs', 'wp-polls'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Delete All Poll Logs.', 'wp-polls'); ?>\n\n<?php _e('This Action Is Not Reversible. Are you sure?', 'wp-polls'); ?>')" />
848
+ </form>
849
+ </div>
850
+ <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>
851
+ </div>
852
+ <!-- Uninstall WP-Polls (By: Philippe Corbes) -->
853
+ <div class="wrap">
854
+ <h2><?php _e('Uninstall Polls', 'wp-polls'); ?></h2>
855
+ <div align="center">
856
+ <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
857
+ <p style="text-align: left;">
858
+ <?php _e('Deactivating WP-Polls plugin does not remove any data that may have been created, such as the poll data and the poll\'s voting logs. To completely remove this plugin, you can uninstall it here.', 'wp-polls'); ?>
859
+ </p>
860
+ <p style="text-align: left; color: red">
861
+ <?php
862
+ vprintf(__('<strong>WARNING:</strong><br />Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first. Your data is stored in the %1$s, %2$s, %3$s and %4$s tables.', 'wp-polls'), array("<strong><em>{$wpdb->pollsq}</em></strong>", "<strong><em>{$wpdb->pollsa}</em></strong>", "<strong><em>{$wpdb->pollsip}</em></strong>", "<strong><em>{$wpdb->options}</em></strong>")); ?>
863
+ </p>
864
+ <input type="checkbox" name="uninstall_poll_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-polls'); ?><br /><br />
865
+ <input type="submit" name="do" value="<?php _e('UNINSTALL Polls', 'wp-polls'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-Polls From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-polls'); ?>')" />
866
+ </form>
867
+ </div>
868
+ </div>
869
+ <?php
870
+ } // End switch($mode)
871
+ ?>
polls/polls-options.php ADDED
@@ -0,0 +1,635 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-Polls 2.14 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Configure Poll Options |
14
+ | - wp-content/plugins/polls/polls-options.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Polls
21
+ if(!current_user_can('manage_polls')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('polls/polls-options.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $id = intval($_GET['id']);
30
+
31
+
32
+ ### If Form Is Submitted
33
+ if($_POST['Submit']) {
34
+ $poll_bar_style = strip_tags(trim($_POST['poll_bar_style']));
35
+ $poll_bar_background = strip_tags(trim($_POST['poll_bar_bg']));
36
+ $poll_bar_border = strip_tags(trim($_POST['poll_bar_border']));
37
+ $poll_bar_height = intval($_POST['poll_bar_height']);
38
+ $poll_bar = array('style' => $poll_bar_style, 'background' => $poll_bar_background, 'border' => $poll_bar_border, 'height' => $poll_bar_height);
39
+ $poll_ans_sortby = strip_tags(trim($_POST['poll_ans_sortby']));
40
+ $poll_ans_sortorder = strip_tags(trim($_POST['poll_ans_sortorder']));
41
+ $poll_ans_result_sortby = strip_tags(trim($_POST['poll_ans_result_sortby']));
42
+ $poll_ans_result_sortorder = strip_tags(trim($_POST['poll_ans_result_sortorder']));
43
+ $poll_template_voteheader =trim($_POST['poll_template_voteheader']);
44
+ $poll_template_votebody = trim($_POST['poll_template_votebody']);
45
+ $poll_template_votefooter = trim($_POST['poll_template_votefooter']);
46
+ $poll_template_resultheader = trim($_POST['poll_template_resultheader']);
47
+ $poll_template_resultbody = trim($_POST['poll_template_resultbody']);
48
+ $poll_template_resultbody2 = trim($_POST['poll_template_resultbody2']);
49
+ $poll_template_resultfooter = trim($_POST['poll_template_resultfooter']);
50
+ $poll_template_resultfooter2 = trim($_POST['poll_template_resultfooter2']);
51
+ $poll_template_disable = trim($_POST['poll_template_disable']);
52
+ $poll_template_error = trim($_POST['poll_template_error']);
53
+ $poll_archive_perpage = intval($_POST['poll_archive_perpage']);
54
+ $poll_archive_url = strip_tags(trim($_POST['poll_archive_url']));
55
+ $poll_archive_show = intval($_POST['poll_archive_show']);
56
+ $poll_currentpoll = intval($_POST['poll_currentpoll']);
57
+ $poll_close = intval($_POST['poll_close']);
58
+ $poll_logging_method = intval($_POST['poll_logging_method']);
59
+ $poll_allowtovote = intval($_POST['poll_allowtovote']);
60
+ $update_poll_queries = array();
61
+ $update_poll_text = array();
62
+ $update_poll_queries[] = update_option('poll_bar', $poll_bar);
63
+ $update_poll_queries[] = update_option('poll_ans_sortby', $poll_ans_sortby);
64
+ $update_poll_queries[] = update_option('poll_ans_sortorder', $poll_ans_sortorder);
65
+ $update_poll_queries[] = update_option('poll_ans_result_sortby', $poll_ans_result_sortby);
66
+ $update_poll_queries[] = update_option('poll_ans_result_sortorder', $poll_ans_result_sortorder);
67
+ $update_poll_queries[] = update_option('poll_template_voteheader', $poll_template_voteheader);
68
+ $update_poll_queries[] = update_option('poll_template_votebody', $poll_template_votebody);
69
+ $update_poll_queries[] = update_option('poll_template_votefooter', $poll_template_votefooter);
70
+ $update_poll_queries[] = update_option('poll_template_resultheader', $poll_template_resultheader);
71
+ $update_poll_queries[] = update_option('poll_template_resultbody', $poll_template_resultbody);
72
+ $update_poll_queries[] = update_option('poll_template_resultbody2', $poll_template_resultbody2);
73
+ $update_poll_queries[] = update_option('poll_template_resultfooter', $poll_template_resultfooter);
74
+ $update_poll_queries[] = update_option('poll_template_resultfooter2', $poll_template_resultfooter2);
75
+ $update_poll_queries[] = update_option('poll_template_disable', $poll_template_disable);
76
+ $update_poll_queries[] = update_option('poll_template_error', $poll_template_error);
77
+ $update_poll_queries[] = update_option('poll_archive_perpage', $poll_archive_perpage);
78
+ $update_poll_queries[] = update_option('poll_archive_url', $poll_archive_url);
79
+ $update_poll_queries[] = update_option('poll_archive_show', $poll_archive_show);
80
+ $update_poll_queries[] = update_option('poll_currentpoll', $poll_currentpoll);
81
+ $update_poll_queries[] = update_option('poll_close', $poll_close);
82
+ $update_poll_queries[] = update_option('poll_logging_method', $poll_logging_method);
83
+ $update_poll_queries[] = update_option('poll_allowtovote', $poll_allowtovote);
84
+ $update_poll_text[] = __('Poll Bar Style', 'wp-polls');
85
+ $update_poll_text[] = __('Sort Poll Answers By Option', 'wp-polls');
86
+ $update_poll_text[] = __('Sort Order Of Poll Answers Option', 'wp-polls');
87
+ $update_poll_text[] = __('Sort Poll Results By Option', 'wp-polls');
88
+ $update_poll_text[] = __('Sort Order Of Poll Results Option', 'wp-polls');
89
+ $update_poll_text[] = __('Voting Form Header Template', 'wp-polls');
90
+ $update_poll_text[] = __('Voting Form Body Template', 'wp-polls');
91
+ $update_poll_text[] = __('Voting Form Footer Template', 'wp-polls');
92
+ $update_poll_text[] = __('Result Header Template', 'wp-polls');
93
+ $update_poll_text[] = __('Result Body Template', 'wp-polls');
94
+ $update_poll_text[] = __('Result Body2 Template', 'wp-polls');
95
+ $update_poll_text[] = __('Result Footer Template', 'wp-polls');
96
+ $update_poll_text[] = __('Result Footer2 Template', 'wp-polls');
97
+ $update_poll_text[] = __('Poll Disabled Template', 'wp-polls');
98
+ $update_poll_text[] = __('Poll Error Template', 'wp-polls');
99
+ $update_poll_text[] = __('Archive Polls Per Page Option', 'wp-polls');
100
+ $update_poll_text[] = __('Polls Archive URL Option', 'wp-polls');
101
+ $update_poll_text[] = __('Show Polls Achive Link Option', 'wp-polls');
102
+ $update_poll_text[] = __('Current Active Poll Option', 'wp-polls');
103
+ $update_poll_text[] = __('Poll Close Option', 'wp-polls');
104
+ $update_poll_text[] = __('Logging Method', 'wp-polls');
105
+ $update_poll_text[] = __('Allow To Vote Option', 'wp-polls');
106
+ $i=0;
107
+ $text = '';
108
+ foreach($update_poll_queries as $update_poll_query) {
109
+ if($update_poll_query) {
110
+ $text .= '<font color="green">'.$update_poll_text[$i].' '.__('Updated', 'wp-polls').'</font><br />';
111
+ }
112
+ $i++;
113
+ }
114
+ if(empty($text)) {
115
+ $text = '<font color="red">'.__('No Poll Option Updated', 'wp-polls').'</font>';
116
+ }
117
+ wp_clear_scheduled_hook('polls_cron');
118
+ if (!wp_next_scheduled('polls_cron')) {
119
+ wp_schedule_event(time(), 'daily', 'polls_cron');
120
+ }
121
+ }
122
+ ?>
123
+ <script type="text/javascript">
124
+ /* <![CDATA[*/
125
+ function poll_default_templates(template) {
126
+ var default_template;
127
+ switch(template) {
128
+ case "voteheader":
129
+ default_template = "<p style=\"text-align: center;\"><strong>%POLL_QUESTION%</strong></p>\n<div id=\"polls-%POLL_ID%-ans\" class=\"wp-polls-ans\">\n<ul class=\"wp-polls-ul\">";
130
+ break;
131
+ case "votebody":
132
+ 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>";
133
+ break;
134
+ case "votefooter":
135
+ default_template = "</ul>\n<p style=\"text-align: center;\"><input type=\"button\" name=\"vote\" value=\" <?php _e('Vote', 'wp-polls'); ?> \" class=\"Buttons\" onclick=\"poll_vote(%POLL_ID%);\" /></p>\n<p style=\"text-align: center;\"><a href=\"#ViewPollResults\" onclick=\"poll_result(%POLL_ID%); return false;\" title=\"<?php _e('View Results Of This Poll', 'wp-polls'); ?>\"><?php _e('View Results', 'wp-polls'); ?></a></p>\n</div>";
136
+ break;
137
+ case "resultheader":
138
+ default_template = "<p style=\"text-align: center;\"><strong>%POLL_QUESTION%</strong></p>\n<div id=\"polls-%POLL_ID%-ans\" class=\"wp-polls-ans\">\n<ul class=\"wp-polls-ul\">";
139
+ break;
140
+ case "resultbody":
141
+ 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>";
142
+ break;
143
+ case "resultbody2":
144
+ 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>";
145
+ break;
146
+ case "resultfooter":
147
+ default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Votes', 'wp-polls'); ?>: <strong>%POLL_TOTALVOTES%</strong></p>\n</div>";
148
+ break;
149
+ case "resultfooter2":
150
+ default_template = "</ul>\n<p style=\"text-align: center;\"><?php _e('Total Votes', '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>";
151
+ break;
152
+ case "disable":
153
+ default_template = "<?php _e('Sorry, there are no polls available at the moment.', 'wp-polls'); ?>";
154
+ break;
155
+ case "error":
156
+ default_template = "<?php _e('An error has occurred when processing your poll.', 'wp-polls'); ?>";
157
+ break;
158
+ }
159
+ document.getElementById("poll_template_" + template).value = default_template;
160
+ }
161
+ function set_pollbar_height(height) {
162
+ document.getElementById('poll_bar_height').value = height;
163
+ }
164
+ function update_pollbar(where) {
165
+ pollbar_background = '#' + document.getElementById('poll_bar_bg').value;
166
+ pollbar_border = '#' + document.getElementById('poll_bar_border').value;
167
+ pollbar_height = document.getElementById('poll_bar_height').value + 'px';
168
+ if(where == 'background') {
169
+ document.getElementById('wp-polls-pollbar-bg').style.backgroundColor = pollbar_background;
170
+ } else if(where == 'border') {
171
+ document.getElementById('wp-polls-pollbar-border').style.backgroundColor = pollbar_border;
172
+ } else if(where == 'style') {
173
+ pollbar_style_options = document.getElementById('poll_options_form').poll_bar_style;
174
+ for(i = 0; i < pollbar_style_options.length; i++) {
175
+ if(pollbar_style_options[i].checked) {
176
+ pollbar_style = pollbar_style_options[i].value;
177
+ }
178
+ }
179
+ if(pollbar_style == 'use_css') {
180
+ document.getElementById('wp-polls-pollbar').style.backgroundImage = "";
181
+ } else {
182
+ document.getElementById('wp-polls-pollbar').style.backgroundImage = "url('<?php echo get_option('siteurl'); ?>/wp-content/plugins/polls/images/" + pollbar_style + "/pollbg.gif')";
183
+ }
184
+ }
185
+ document.getElementById('wp-polls-pollbar').style.backgroundColor = pollbar_background;
186
+ document.getElementById('wp-polls-pollbar').style.border = '1px solid ' + pollbar_border;
187
+ document.getElementById('wp-polls-pollbar').style.height = pollbar_height;
188
+ }
189
+ /* ]]> */
190
+ </script>
191
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
192
+ <div class="wrap">
193
+ <h2><?php _e('Poll Options', 'wp-polls'); ?></h2>
194
+ <form id="poll_options_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
195
+ <fieldset class="options">
196
+ <legend><?php _e('Poll Bar Style', 'wp-polls'); ?></legend>
197
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
198
+ <tr valign="top">
199
+ <th align="left" width="20%"><?php _e('Poll Bar Style', 'wp-polls'); ?></th>
200
+ <td align="left" colspan="2">
201
+ <?php
202
+ $pollbar = get_option('poll_bar');
203
+ $pollbar_url = get_option('siteurl').'/wp-content/plugins/polls/images';
204
+ $pollbar_path = ABSPATH.'/wp-content/plugins/polls/images';
205
+ if($handle = @opendir($pollbar_path)) {
206
+ while (false !== ($filename = readdir($handle))) {
207
+ if ($filename != '.' && $filename != '..') {
208
+ if(is_dir($pollbar_path.'/'.$filename)) {
209
+ $pollbar_info = getimagesize($pollbar_path.'/'.$filename.'/pollbg.gif');
210
+ if($pollbar['style'] == $filename) {
211
+ echo '<input type="radio" name="poll_bar_style" value="'.$filename.'" checked="checked" onblur="set_pollbar_height('.$pollbar_info[1].'); update_pollbar(\'style\');" />';
212
+ } else {
213
+ echo '<input type="radio" name="poll_bar_style" value="'.$filename.'" onblur="set_pollbar_height('.$pollbar_info[1].'); update_pollbar(\'style\');" />';
214
+ }
215
+ echo '&nbsp;&nbsp;&nbsp;';
216
+ echo '<img src="'.$pollbar_url.'/'.$filename.'/pollbg.gif" height="'.$pollbar_info[1].'" width="100" alt="pollbg.gif" />';
217
+ echo '&nbsp;&nbsp;&nbsp;('.$filename.')';
218
+ echo '<br /><br />'."\n";
219
+ }
220
+ }
221
+ }
222
+ closedir($handle);
223
+ }
224
+ ?>
225
+ <input type="radio" name="poll_bar_style" value="use_css"<?php checked('use_css', $pollbar['style']); ?> onblur="update_pollbar('style');" /> <?php _e('Use CSS Style', 'wp-polls'); ?>
226
+ </td>
227
+ </tr>
228
+ <tr valign="top">
229
+ <th align="left" width="20%"><?php _e('Poll Bar Background', 'wp-polls'); ?></th>
230
+ <td align="left" width="10%">#<input type="text" id="poll_bar_bg" name="poll_bar_bg" value="<?php echo $pollbar['background']; ?>" size="6" maxlength="6" onblur="update_pollbar('background');" /></td>
231
+ <td align="left"><div id="wp-polls-pollbar-bg" style="background-color: #<?php echo $pollbar['background']; ?>;"></div></td>
232
+ </tr>
233
+ <tr valign="top">
234
+ <th align="left" width="20%"><?php _e('Poll Bar Border', 'wp-polls'); ?></th>
235
+ <td align="left" width="10%">#<input type="text" id="poll_bar_border" name="poll_bar_border" value="<?php echo $pollbar['border']; ?>" size="6" maxlength="6" onblur="update_pollbar('border');" /></td>
236
+ <td align="left"><div id="wp-polls-pollbar-border" style="background-color: #<?php echo $pollbar['border']; ?>;"></div></td>
237
+ </tr>
238
+ <tr valign="top">
239
+ <th align="left" width="20%"><?php _e('Poll Bar Height', 'wp-polls'); ?></th>
240
+ <td align="left" colspan="2"><input type="text" id="poll_bar_height" name="poll_bar_height" value="<?php echo $pollbar['height']; ?>" size="2" maxlength="2" onblur="update_pollbar('height');" />px</td>
241
+ </tr>
242
+ <tr valign="top">
243
+ <th align="left" width="20%"><?php _e('Your poll bar will look like this', 'wp-polls'); ?></th>
244
+ <td align="left" >
245
+ <?php
246
+ if($pollbar['style'] == 'use_css') {
247
+ echo '<div id="wp-polls-pollbar" style="width: 100px; height: '.$pollbar['height'].'px; background-color: #'.$pollbar['background'].'; border: 1px solid #'.$pollbar['border'].'"></div>'."\n";
248
+ } else {
249
+ echo '<div id="wp-polls-pollbar" style="width: 100px; height: '.$pollbar['height'].'px; background-color: #'.$pollbar['background'].'; border: 1px solid #'.$pollbar['border'].'; background-image: url(\''.get_option('siteurl').'/wp-content/plugins/polls/images/'.$pollbar['style'].'/pollbg.gif\');"></div>'."\n";
250
+ }
251
+ ?>
252
+ </td>
253
+ </tr>
254
+ </table>
255
+ </fieldset>
256
+ <fieldset class="options">
257
+ <legend><?php _e('Sorting Of Poll Answers', 'wp-polls'); ?></legend>
258
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
259
+ <tr valign="top">
260
+ <th align="left" width="30%"><?php _e('Sort Poll Answers By:', 'wp-polls'); ?></th>
261
+ <td align="left">
262
+ <select name="poll_ans_sortby" size="1">
263
+ <option value="polla_aid"<?php selected('polla_aid', get_option('poll_ans_sortby')); ?>><?php _e('Exact Order', 'wp-polls'); ?></option>
264
+ <option value="polla_answers"<?php selected('polla_answers', get_option('poll_ans_sortby')); ?>><?php _e('Alphabetical Order', 'wp-polls'); ?></option>
265
+ </select>
266
+ </td>
267
+ </tr>
268
+ <tr valign="top">
269
+ <th align="left" width="30%"><?php _e('Sort Order Of Poll Answers:', 'wp-polls'); ?></th>
270
+ <td align="left">
271
+ <select name="poll_ans_sortorder" size="1">
272
+ <option value="asc"<?php selected('asc', get_option('poll_ans_sortorder')); ?>><?php _e('Ascending', 'wp-polls'); ?></option>
273
+ <option value="desc"<?php selected('desc', get_option('poll_ans_sortorder')); ?>><?php _e('Descending', 'wp-polls'); ?></option>
274
+ </select>
275
+ </td>
276
+ </tr>
277
+ </table>
278
+ </fieldset>
279
+ <fieldset class="options">
280
+ <legend><?php _e('Sorting Of Poll Results', 'wp-polls'); ?></legend>
281
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
282
+ <tr valign="top">
283
+ <th align="left" width="30%"><?php _e('Sort Poll Results By:', 'wp-polls'); ?></th>
284
+ <td align="left">
285
+ <select name="poll_ans_result_sortby" size="1">
286
+ <option value="polla_votes"<?php selected('polla_votes', get_option('poll_ans_result_sortby')); ?>><?php _e('Votes', 'wp-polls'); ?></option>
287
+ <option value="polla_aid"<?php selected('polla_aid', get_option('poll_ans_result_sortby')); ?>><?php _e('Exact Order', 'wp-polls'); ?></option>
288
+ <option value="polla_answers"<?php selected('polla_answers', get_option('poll_ans_result_sortby')); ?>><?php _e('Alphabetical Order', 'wp-polls'); ?></option>
289
+ </select>
290
+ </td>
291
+ </tr>
292
+ <tr valign="top">
293
+ <th align="left" width="30%"><?php _e('Sort Order Of Poll Results:', 'wp-polls'); ?></th>
294
+ <td align="left">
295
+ <select name="poll_ans_result_sortorder" size="1">
296
+ <option value="asc"<?php selected('asc', get_option('poll_ans_result_sortorder')); ?>><?php _e('Ascending', 'wp-polls'); ?></option>
297
+ <option value="desc"<?php selected('desc', get_option('poll_ans_result_sortorder')); ?>><?php _e('Descending', 'wp-polls'); ?></option>
298
+ </select>
299
+ </td>
300
+ </tr>
301
+ </table>
302
+ </fieldset>
303
+ <fieldset class="options">
304
+ <legend><?php _e('Allow To Vote', 'wp-polls'); ?></legend>
305
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
306
+ <tr valign="top">
307
+ <th align="left" width="30%"><?php _e('Who Is Allowed To Vote?', 'wp-polls'); ?></th>
308
+ <td align="left">
309
+ <select name="poll_allowtovote" size="1">
310
+ <option value="0"<?php selected('0', get_option('poll_allowtovote')); ?>><?php _e('Guests Only', 'wp-polls'); ?></option>
311
+ <option value="1"<?php selected('1', get_option('poll_allowtovote')); ?>><?php _e('Registered Users Only', 'wp-polls'); ?></option>
312
+ <option value="2"<?php selected('2', get_option('poll_allowtovote')); ?>><?php _e('Registered Users And Guests', 'wp-polls'); ?></option>
313
+ </select>
314
+ </td>
315
+ </tr>
316
+ </table>
317
+ </fieldset>
318
+ <fieldset class="options">
319
+ <legend><?php _e('Logging Method', 'wp-polls'); ?></legend>
320
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
321
+ <tr valign="top">
322
+ <th align="left" width="30%"><?php _e('Poll Logging Method:', 'wp-polls'); ?></th>
323
+ <td align="left">
324
+ <select name="poll_logging_method" size="1">
325
+ <option value="0"<?php selected('0', get_option('poll_logging_method')); ?>><?php _e('Do Not Log', 'wp-polls'); ?></option>
326
+ <option value="1"<?php selected('1', get_option('poll_logging_method')); ?>><?php _e('Logged By Cookie', 'wp-polls'); ?></option>
327
+ <option value="2"<?php selected('2', get_option('poll_logging_method')); ?>><?php _e('Logged By IP', 'wp-polls'); ?></option>
328
+ <option value="3"<?php selected('3', get_option('poll_logging_method')); ?>><?php _e('Logged By Cookie And IP', 'wp-polls'); ?></option>
329
+ <option value="4"<?php selected('4', get_option('poll_logging_method')); ?>><?php _e('Logged By Username', 'wp-polls'); ?></option>
330
+ </select>
331
+ </td>
332
+ </tr>
333
+ </table>
334
+ </fieldset>
335
+ <fieldset class="options">
336
+ <legend><?php _e('Poll Archive', 'wp-polls'); ?></legend>
337
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
338
+ <tr valign="top">
339
+ <th align="left" width="30%"><?php _e('Polls Per Page:', 'wp-polls'); ?></th>
340
+ <td align="left"><input type="text" name="poll_archive_perpage" value="<?php echo intval(get_option('poll_archive_perpage')); ?>" size="2" /></td>
341
+ </tr>
342
+ <tr valign="top">
343
+ <th align="left" width="30%"><?php _e('Polls Archive URL:', 'wp-polls'); ?></th>
344
+ <td align="left"><input type="text" name="poll_archive_url" value="<?php echo get_option('poll_archive_url'); ?>" size="50" /></td>
345
+ </tr>
346
+ <tr valign="top">
347
+ <th align="left" width="30%"><?php _e('Display Polls Archive Link Below Poll?', 'wp-polls'); ?></th>
348
+ <td align="left">
349
+ <select name="poll_archive_show" size="1">
350
+ <option value="0"<?php selected('0', get_option('poll_archive_show')); ?>><?php _e('No', 'wp-polls'); ?></option>
351
+ <option value="1"<?php selected('1', get_option('poll_archive_show')); ?>><?php _e('Yes', 'wp-polls'); ?></option>
352
+ </select>
353
+ </td>
354
+ </tr>
355
+ </table>
356
+ </fieldset>
357
+ <fieldset class="options">
358
+ <legend><?php _e('Current Active Poll', 'wp-polls'); ?></legend>
359
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
360
+ <tr valign="top">
361
+ <th align="left" width="30%"><?php _e('Current Active Poll', 'wp-polls'); ?>:</th>
362
+ <td align="left">
363
+ <select name="poll_currentpoll" size="1">
364
+ <option value="-1"<?php selected(-1, get_option('poll_currentpoll')); ?>><?php _e('Do NOT Display Poll (Disable)', 'wp-polls'); ?></option>
365
+ <option value="-2"<?php selected(-2, get_option('poll_currentpoll')); ?>><?php _e('Display Random Poll', 'wp-polls'); ?></option>
366
+ <option value="0"<?php selected(0, get_option('poll_currentpoll')); ?>><?php _e('Display Latest Poll', 'wp-polls'); ?></option>
367
+ <option value="0">&nbsp;</option>
368
+ <?php
369
+ $polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
370
+ if($polls) {
371
+ foreach($polls as $poll) {
372
+ $poll_question = stripslashes($poll->pollq_question);
373
+ $poll_id = intval($poll->pollq_id);
374
+ if($poll_id == intval(get_option('poll_currentpoll'))) {
375
+ echo "<option value=\"$poll_id\" selected=\"selected\">$poll_question</option>\n";
376
+ } else {
377
+ echo "<option value=\"$poll_id\">$poll_question</option>\n";
378
+ }
379
+ }
380
+ }
381
+ ?>
382
+ </select>
383
+ </td>
384
+ </tr>
385
+ <tr valign="top">
386
+ <th align="left" width="30%"><?php _e('When Poll Is Closed', 'wp-polls'); ?>:</th>
387
+ <td align="left">
388
+ <select name="poll_close" size="1">
389
+ <option value="1"<?php selected(1, get_option('poll_close')); ?>><?php _e('Display Poll\'s Results', 'wp-polls'); ?></option>
390
+ <option value="2"<?php selected(2, get_option('poll_close')); ?>><?php _e('Do Not Display Poll In Post/Sidebar', 'wp-polls'); ?></option>
391
+ </select>
392
+ </td>
393
+ </tr>
394
+ </table>
395
+ </fieldset>
396
+ <fieldset class="options">
397
+ <legend><?php _e('Template Variables', 'wp-polls'); ?></legend>
398
+ <table width="100%" border="0" cellspacing="0" cellpadding="5">
399
+ <tr>
400
+ <td>
401
+ <strong>%POLL_ID%</strong><br />
402
+ <?php _e('Display the poll\'s ID', 'wp-polls'); ?>
403
+ </td>
404
+ <td>
405
+ <strong>%POLL_ANSWER_ID%</strong><br />
406
+ <?php _e('Display the poll\'s answer ID', 'wp-polls'); ?>
407
+ </td>
408
+ </tr>
409
+ <tr>
410
+ <td>
411
+ <strong>%POLL_QUESTION%</strong><br />
412
+ <?php _e('Display the poll\'s question', 'wp-polls'); ?>
413
+ </td>
414
+ <td>
415
+ <strong>%POLL_ANSWER%</strong><br />
416
+ <?php _e('Display the poll\'s answer', 'wp-polls'); ?>
417
+ </td>
418
+ </tr>
419
+ <tr>
420
+ <td>
421
+ <strong>%POLL_TOTALVOTES%</strong><br />
422
+ <?php _e('Display the poll\'s total votes', 'wp-polls'); ?>
423
+ </td>
424
+ <td>
425
+ <strong>%POLL_ANSWER_TEXT%</strong><br />
426
+ <?php _e('Display the poll\'s answer without HTML formatting.', 'wp-polls'); ?>
427
+ </td>
428
+ </tr>
429
+ <tr>
430
+ <td>
431
+ <strong>%POLL_RESULT_URL%</strong><br />
432
+ <?php _e('Displays URL to poll\'s result', 'wp-polls'); ?>
433
+ </td>
434
+ <td>
435
+ <strong>%POLL_ANSWER_VOTES%</strong><br />
436
+ <?php _e('Display the poll\'s answer votes', 'wp-polls'); ?>
437
+ </td>
438
+ </tr>
439
+ <tr>
440
+ <td>
441
+ <strong>%POLL_MOST_ANSWER%</strong><br />
442
+ <?php _e('Display the poll\'s most voted answer', 'wp-polls'); ?>
443
+ </td>
444
+ <td>
445
+ <strong>%POLL_ANSWER_PERCENTAGE%</strong><br />
446
+ <?php _e('Display the poll\'s answer percentage', 'wp-polls'); ?>
447
+ </td>
448
+ </tr>
449
+ <tr>
450
+ <td>
451
+ <strong>%POLL_MOST_VOTES%</strong><br />
452
+ <?php _e('Display the poll\'s answer votes for the most voted answer', 'wp-polls'); ?>
453
+ </td>
454
+ <td>
455
+ <strong>%POLL_ANSWER_IMAGEWIDTH%</strong><br />
456
+ <?php _e('Display the poll\'s answer image width', 'wp-polls'); ?>
457
+ </td>
458
+ </tr>
459
+ <tr>
460
+ <td>
461
+ <strong>%POLL_MOST_PERCENTAGE%</strong><br />
462
+ <?php _e('Display the poll\'s answer percentage for the most voted answer', 'wp-polls'); ?>
463
+ </td>
464
+ <td>
465
+ <strong>%POLL_LEAST_ANSWER%</strong><br />
466
+ <?php _e('Display the poll\'s least voted answer', 'wp-polls'); ?>
467
+ </td>
468
+ </tr>
469
+ <tr>
470
+ <td><strong>%POLL_START_DATE%</strong><br />
471
+ <?php _e('Display the poll\'s start date/time', 'wp-polls'); ?></td>
472
+ <td><strong>%POLL_LEAST_VOTES%</strong><br />
473
+ <?php _e('Display the poll\'s answer votes for the least voted answer', 'wp-polls'); ?>
474
+ </td>
475
+ </tr>
476
+ <tr>
477
+ <td><strong>%POLL_END_DATE%</strong><br />
478
+ <?php _e('Display the poll\'s end date/time', 'wp-polls'); ?></td>
479
+ <td>
480
+ <strong>%POLL_LEAST_PERCENTAGE%</strong><br />
481
+ <?php _e('Display the poll\'s answer percentage for the least voted answer', 'wp-polls'); ?>
482
+ </td>
483
+ </tr>
484
+ </table>
485
+ </fieldset>
486
+ <fieldset class="options">
487
+ <legend><?php _e('Poll Voting Form Templates', 'wp-polls'); ?></legend>
488
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
489
+ <tr valign="top">
490
+ <td width="30%" align="left">
491
+ <strong><?php _e('Voting Form Header:', 'wp-polls'); ?></strong><br /><br /><br />
492
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
493
+ - %POLL_ID%<br />
494
+ - %POLL_QUESTION%<br />
495
+ - %POLL_START_DATE%<br />
496
+ - %POLL_END_DATE%<br />
497
+ - %POLL_TOTALVOTES%<br /><br />
498
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('voteheader');" class="button" />
499
+ </td>
500
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_voteheader" name="poll_template_voteheader"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_voteheader'))); ?></textarea></td>
501
+ </tr>
502
+ <tr valign="top">
503
+ <td width="30%" align="left">
504
+ <strong><?php _e('Voting Form Body:', 'wp-polls'); ?></strong><br /><br /><br />
505
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
506
+ - %POLL_ID%<br />
507
+ - %POLL_ANSWER_ID%<br />
508
+ - %POLL_ANSWER%<br />
509
+ - %POLL_ANSWER_VOTES%<br /><br />
510
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('votebody');" class="button" />
511
+ </td>
512
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_votebody" name="poll_template_votebody"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_votebody'))); ?></textarea></td>
513
+ </tr>
514
+ <tr valign="top">
515
+ <td width="30%" align="left">
516
+ <strong><?php _e('Voting Form Footer:', 'wp-polls'); ?></strong><br /><br /><br />
517
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
518
+ - %POLL_ID%<br />
519
+ - %POLL_RESULT_URL%<br /><br />
520
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('votefooter');" class="button" />
521
+ </td>
522
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_votefooter" name="poll_template_votefooter"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_votefooter'))); ?></textarea></td>
523
+ </tr>
524
+ </table>
525
+ </fieldset>
526
+ <fieldset class="options">
527
+ <legend><?php _e('Poll Result Templates', 'wp-polls'); ?></legend>
528
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
529
+ <tr valign="top">
530
+ <td width="30%" align="left">
531
+ <strong><?php _e('Result Header:', 'wp-polls'); ?></strong><br /><br /><br />
532
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
533
+ - %POLL_ID%<br />
534
+ - %POLL_QUESTION%<br />
535
+ - %POLL_START_DATE%<br />
536
+ - %POLL_END_DATE%<br />
537
+ - %POLL_TOTALVOTES%<br /><br />
538
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultheader');" class="button" />
539
+ </td>
540
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_resultheader" name="poll_template_resultheader"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_resultheader'))); ?></textarea></td>
541
+ </tr>
542
+ <tr valign="top">
543
+ <td width="30%" align="left">
544
+ <strong><?php _e('Result Body:', 'wp-polls'); ?></strong><br /><?php _e('Normal', 'wp-polls'); ?><br /><br />
545
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
546
+ - %POLL_ANSWER_ID%<br />
547
+ - %POLL_ANSWER%<br />
548
+ - %POLL_ANSWER_TEXT%<br />
549
+ - %POLL_ANSWER_VOTES%<br />
550
+ - %POLL_ANSWER_PERCENTAGE%<br />
551
+ - %POLL_ANSWER_IMAGEWIDTH%<br /><br />
552
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultbody');" class="button" />
553
+ </td>
554
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_resultbody" name="poll_template_resultbody"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_resultbody'))); ?></textarea></td>
555
+ </tr>
556
+ <tr valign="top">
557
+ <td width="30%" align="left">
558
+ <strong><?php _e('Result Body:', 'wp-polls'); ?></strong><br /><?php _e('Displaying Of User\'s Voted Answer', 'wp-polls'); ?><br /><br />
559
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
560
+ - %POLL_ANSWER_ID%<br />
561
+ - %POLL_ANSWER%<br />
562
+ - %POLL_ANSWER_TEXT%<br />
563
+ - %POLL_ANSWER_VOTES%<br />
564
+ - %POLL_ANSWER_PERCENTAGE%<br />
565
+ - %POLL_ANSWER_IMAGEWIDTH%<br /><br />
566
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultbody2');" class="button" />
567
+ </td>
568
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_resultbody2" name="poll_template_resultbody2"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_resultbody2'))); ?></textarea></td>
569
+ </tr>
570
+ <tr valign="top">
571
+ <td width="30%" align="left">
572
+ <strong><?php _e('Result Footer:', 'wp-polls'); ?></strong><br /><?php _e('Normal', 'wp-polls'); ?><br /><br />
573
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
574
+ - %POLL_ID%<br />
575
+ - %POLL_START_DATE%<br />
576
+ - %POLL_END_DATE%<br />
577
+ - %POLL_TOTALVOTES%<br />
578
+ - %POLL_MOST_ANSWER%<br />
579
+ - %POLL_MOST_VOTES%<br />
580
+ - %POLL_MOST_PERCENTAGE%<br />
581
+ - %POLL_LEAST_ANSWER%<br />
582
+ - %POLL_LEAST_VOTES%<br />
583
+ - %POLL_LEAST_PERCENTAGE%<br /><br />
584
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultfooter');" class="button" />
585
+ </td>
586
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_resultfooter" name="poll_template_resultfooter"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_resultfooter'))); ?></textarea></td>
587
+ </tr>
588
+ <tr valign="top">
589
+ <td width="30%" align="left">
590
+ <strong><?php _e('Result Footer:', 'wp-polls'); ?></strong><br /><?php _e('Displaying Of Vote Poll Link If User Has Not Voted', 'wp-polls'); ?><br /><br />
591
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
592
+ - %POLL_ID%<br />
593
+ - %POLL_START_DATE%<br />
594
+ - %POLL_END_DATE%<br />
595
+ - %POLL_TOTALVOTES%<br />
596
+ - %POLL_MOST_ANSWER%<br />
597
+ - %POLL_MOST_VOTES%<br />
598
+ - %POLL_MOST_PERCENTAGE%<br />
599
+ - %POLL_LEAST_ANSWER%<br />
600
+ - %POLL_LEAST_VOTES%<br />
601
+ - %POLL_LEAST_PERCENTAGE%<br /><br />
602
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('resultfooter2');" class="button" />
603
+ </td>
604
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_resultfooter2" name="poll_template_resultfooter2"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_resultfooter2'))); ?></textarea></td>
605
+ </tr>
606
+ </table>
607
+ </fieldset>
608
+ <fieldset class="options">
609
+ <legend><?php _e('Poll Misc Templates', 'wp-polls'); ?></legend>
610
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
611
+ <tr valign="top">
612
+ <td width="30%" align="left">
613
+ <strong><?php _e('Poll Disabled', 'wp-polls'); ?></strong><br /><br /><br />
614
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
615
+ - <?php _e('N/A', 'wp-polls'); ?><br /><br />
616
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('disable');" class="button" />
617
+ </td>
618
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_disable" name="poll_template_disable"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_disable'))); ?></textarea></td>
619
+ </tr>
620
+ <tr valign="top">
621
+ <td width="30%" align="left">
622
+ <strong><?php _e('Poll Error', 'wp-polls'); ?></strong><br /><br /><br />
623
+ <?php _e('Allowed Variables:', 'wp-polls'); ?><br />
624
+ - <?php _e('N/A', 'wp-polls'); ?><br /><br />
625
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="javascript: poll_default_templates('error');" class="button" />
626
+ </td>
627
+ <td align="left"><textarea cols="80" rows="10" id="poll_template_error" name="poll_template_error"><?php echo htmlspecialchars(stripslashes(get_option('poll_template_error'))); ?></textarea></td>
628
+ </tr>
629
+ </table>
630
+ </fieldset>
631
+ <div align="center">
632
+ <input type="submit" name="Submit" class="button" value="<?php _e('Update Options', 'wp-polls'); ?>" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-polls'); ?>" class="button" onclick="javascript:history.go(-1)" />
633
+ </div>
634
+ </form>
635
+ </div>
polls/polls-usage.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-Polls 2.14 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - How To Use WP-Polls |
14
+ | - wp-content/plugins/polls/polls-usage.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Polls
21
+ if(!current_user_can('manage_polls')) {
22
+ die('Access Denied');
23
+ }
24
+ ?>
25
+ <div class="wrap">
26
+ <h2><?php _e("General Usage (Without Widget)", 'wp-polls'); ?></h2>
27
+ <ol>
28
+ <li>
29
+ <?php _e("Open ", 'wp-polls'); ?><b>wp-content/themes/&lt;<?php _e("YOUR THEME NAME", 'wp-polls'); ?>&gt;/sidebar.php</b>
30
+ </li>
31
+ <li>
32
+ <?php _e("Add:", 'wp-polls'); ?>
33
+ <blockquote>
34
+ <pre class="wp-polls-usage-pre">&lt;?php if (function_exists('vote_poll') &amp;&amp; !$in_pollsarchive): ?&gt;
35
+ &lt;li&gt;
36
+ &nbsp;&nbsp;&nbsp;&lt;h2&gt;Polls&lt;/h2&gt;
37
+ &nbsp;&nbsp;&nbsp;&lt;ul&gt;
38
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;?php get_poll();?&gt;&lt;/li&gt;
39
+ &nbsp;&nbsp;&nbsp;&lt;/ul&gt;
40
+ &nbsp;&nbsp;&nbsp;&lt;?php display_polls_archive_link(); ?&gt;
41
+ &lt;/li&gt;
42
+ &lt;?php endif; ?&gt; </pre>
43
+ </blockquote>
44
+ <?php _e("To show specific poll, use :", 'wp-polls'); ?>
45
+ <blockquote><pre class="wp-polls-usage-pre">&lt;?php get_poll(<b>2</b>);?&gt;</pre></blockquote>
46
+ <?php _e("where <b>2</b> is your poll id.", 'wp-polls'); ?>
47
+ <?php _e("To embed a specific poll in your post, use :", 'wp-polls'); ?>
48
+ <blockquote><pre class="wp-polls-usage-pre">[poll=<b>2</b>]</pre></blockquote>
49
+ <?php _e("where <b>2</b> is your poll id.", 'wp-polls'); ?>
50
+ </li>
51
+ <li>
52
+ <?php _e("Scroll down for instructions on how to create <b>Polls Archive</b>.", 'wp-polls'); ?>
53
+ </li>
54
+ </ol>
55
+ </div>
56
+ <div class="wrap">
57
+ <h2><?php _e("General Usage (With Widget)", 'wp-polls'); ?></h2>
58
+ <ol>
59
+ <li>
60
+ <?php _e("<b>Activate</b> WP-Polls Widget Plugin", 'wp-polls'); ?>
61
+ </li>
62
+ <li>
63
+ <?php _e("Go to 'WP-Admin -> Presentation -> Sidebar Widgets'", 'wp-polls'); ?>
64
+ </li>
65
+ <li>
66
+ <?php _e("<b>Drag</b> the Polls Widget to your sidebar", 'wp-polls'); ?>
67
+ </li>
68
+ <li>
69
+ <?php _e("You can <b>configure</b> the Polls Widget by clicking on the configure icon", 'wp-polls'); ?>
70
+ </li>
71
+ <li>
72
+ <?php _e("Click 'Save changes'", 'wp-polls'); ?>
73
+ </li>
74
+ <li>
75
+ <?php _e(" down for instructions on how to create a <b>Polls Archive</b>.", 'wp-polls'); ?>
76
+ </li>
77
+ </ol>
78
+ </div>
79
+ <div class="wrap">
80
+ <h2><?php _e("Polls Archive", 'wp-polls'); ?></h2>
81
+ <ol>
82
+ <li>
83
+ <?php _e("Go to 'WP-Admin -> Write -> Write Page'", 'wp-polls'); ?>
84
+ </li>
85
+ <li>
86
+ <?php _e("Type any title you like in the post's title area", 'wp-polls'); ?>
87
+ </li>
88
+ <li>
89
+ <?php _e("Type '<b>[page_polls]</b>' in the post's content area (without the quotes)", 'wp-polls'); ?>
90
+ </li>
91
+ <li>
92
+ <?php _e("Type '<b>pollsarchive</b>' in the post's slug area (without the quotes)", 'wp-polls'); ?>
93
+ </li>
94
+ <li>
95
+ <?php _e("Click 'Publish'", 'wp-polls'); ?>
96
+ </li>
97
+ <li>
98
+ <?php _e("If you <b>ARE NOT</b> using nice permalinks, you need to go to 'WP-Admin -> Polls -> Poll Option' and under '<b>Poll Archive -> Polls Archive URL</b>', you need to fill in the URL to the Polls Archive Page you created above.", 'wp-polls'); ?>
99
+ </li>
100
+ </ol>
101
+ </div>
102
+ <div class="wrap">
103
+ <h2><?php _e('Polls Stats', 'wp-polls'); ?></h2>
104
+ <h3><?php _e("To Display Total Polls", 'wp-polls'); ?></h3>
105
+ <blockquote>
106
+ <pre class="wp-polls-usage-pre">&lt;?php if (function_exists('get_pollquestions')): ?&gt;
107
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollquestions(); ?&gt;
108
+ &lt;?php endif; ?&gt; </pre>
109
+ </blockquote>
110
+ <h3><?php _e("To Display Total Poll Answers", 'wp-polls'); ?></h3>
111
+ <blockquote>
112
+ <pre class="wp-polls-usage-pre">&lt;?php if (function_exists('get_pollanswers')): ?&gt;
113
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollanswers(); ?&gt;
114
+ &lt;?php endif; ?&gt; </pre>
115
+ </blockquote>
116
+ <h3><?php _e("To Display Total Poll Votes", 'wp-polls'); ?></h3>
117
+ <blockquote>
118
+ <pre class="wp-polls-usage-pre">&lt;?php if (function_exists('get_pollvotes')): ?&gt;
119
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollvotes(); ?&gt;
120
+ &lt;?php endif; ?&gt; </pre>
121
+ </blockquote>
122
+ </div>
123
+ <div class="wrap">
124
+ <h2><?php _e("Note", 'wp-polls'); ?></h2>
125
+ <ul>
126
+ <li>
127
+ <?php _e("In IE, some of the poll's text may appear jagged (this is normal in IE). To solve this issue,", 'wp-polls'); ?>
128
+ <ol>
129
+ <li>
130
+ <?php _e("Open <b>poll-css.css</b>", 'wp-polls'); ?>
131
+ </li>
132
+ <li>
133
+ <?php _e("Find:", 'wp-polls'); ?>
134
+ <blockquote><pre class="wp-polls-usage-pre">/* background-color: #ffffff; */</pre></blockquote>
135
+ </li>
136
+ <li>
137
+ <?php _e("Replace:", 'wp-polls'); ?>
138
+ <blockquote><pre class="wp-polls-usage-pre">background-color: #ffffff;</pre></blockquote>
139
+ <?php _e("Where <b>#ffffff</b> should be your background color for the poll.", 'wp-polls'); ?>
140
+ </li>
141
+ </ol>
142
+ </li>
143
+ </ul>
144
+ </div>
polls/polls-widget.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-Polls Widget
4
+ Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
+ Description: Adds a Sidebar Widget To Display Poll From WP-Polls Plugin. You Need To Activate WP-Polls First.
6
+ Version: 2.14
7
+ Author: GaMerZ
8
+ Author URI: http://www.lesterchan.net
9
+ */
10
+
11
+
12
+ /*
13
+ Copyright 2007 Lester Chan (email : gamerz84@hotmail.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+
31
+ ### Function: Init WP-Polls Widget
32
+ function widget_polls_init() {
33
+ if (!function_exists('register_sidebar_widget')) {
34
+ return;
35
+ }
36
+
37
+ ### Function: WP-Polls Widget
38
+ function widget_polls($args) {
39
+ global $in_pollsarchive;
40
+ extract($args);
41
+ $options = get_option('widget_polls');
42
+ $title = htmlspecialchars($options['title']);
43
+ if (function_exists('vote_poll') && !$in_pollsarchive) {
44
+ echo $before_widget.$before_title.$title.$after_title;
45
+ get_poll();
46
+ display_polls_archive_link();
47
+ echo $after_widget;
48
+ }
49
+ }
50
+
51
+ ### Function: WP-Polls Widget Options
52
+ function widget_polls_options() {
53
+ global $wpdb;
54
+ $options = get_option('widget_polls');
55
+ $current_poll = get_option('poll_currentpoll');
56
+ if (!is_array($options)) {
57
+ $options = array('title' => __('Polls', 'wp-polls'));
58
+ }
59
+ if ($_POST['polls-submit']) {
60
+ $poll_currentpoll = intval($_POST['poll_currentpoll']);
61
+ $poll_archive_show = intval($_POST['poll_archive_show']);
62
+ $options['title'] = strip_tags(stripslashes($_POST['polls-title']));
63
+ update_option('widget_polls', $options);
64
+ update_option('poll_currentpoll', $poll_currentpoll);
65
+ update_option('poll_archive_show', $poll_archive_show);
66
+ }
67
+ echo '<p style="text-align: left;"><label for="polls-title">';
68
+ _e('Title');
69
+ echo ': </label><input type="text" id="polls-title" name="polls-title" value="'.htmlspecialchars($options['title']).'" />'."\n";
70
+ echo '<p style="text-align: left;"><label for="polls-displayarchive">';
71
+ _e('Display Polls Archive Link Below Poll?', 'wp-polls');
72
+ echo ' </label>'."\n";
73
+ echo '<select id="polls-displayarchive" name="poll_archive_show" size="1">'."\n";
74
+ echo '<option value="0"';
75
+ selected('0', get_option('poll_archive_show'));
76
+ echo '>';
77
+ _e('No');
78
+ echo '</option>'."\n";
79
+ echo '<option value="1"';
80
+ selected('1', get_option('poll_archive_show'));
81
+ echo '>';
82
+ _e('Yes');
83
+ echo '</option>'."\n";
84
+ echo '</select></p>'."\n";
85
+ echo '<p style="text-align: left;"><label for="poll_currentpoll">';
86
+ _e('Current Active Poll', 'wp-polls');
87
+ echo ': </label>'."\n";
88
+ echo '<select id="poll_currentpoll" name="poll_currentpoll" size="1">'."\n";
89
+ echo '<option value="-1"';
90
+ selected(-1, $current_poll);
91
+ echo '>';
92
+ _e('Do NOT Display Poll (Disable)', 'wp-polls');
93
+ echo '</option>'."\n";
94
+ echo '<option value="-2"';
95
+ selected(-2, $current_poll);
96
+ echo '>';
97
+ _e('Display Random Poll', 'wp-polls');
98
+ echo '</option>'."\n";
99
+ echo '<option value="0"';
100
+ selected(0, $current_poll);
101
+ echo '>';
102
+ _e('Display Latest Poll', 'wp-polls');
103
+ echo '</option>'."\n";
104
+ echo '<option value="0">&nbsp;</option>'."\n";
105
+ $polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
106
+ if($polls) {
107
+ foreach($polls as $poll) {
108
+ $poll_question = stripslashes($poll->pollq_question);
109
+ $poll_id = intval($poll->pollq_id);
110
+ if($poll_id == intval($current_poll)) {
111
+ echo "<option value=\"$poll_id\" selected=\"selected\">$poll_question</option>\n";
112
+ } else {
113
+ echo "<option value=\"$poll_id\">$poll_question</option>\n";
114
+ }
115
+ }
116
+ }
117
+ echo '</select>'."\n";
118
+ echo '</p>'."\n";
119
+ echo '<input type="hidden" id="polls-submit" name="polls-submit" value="1" />'."\n";
120
+ }
121
+
122
+ // Register Widgets
123
+ register_sidebar_widget(array('Polls', 'wp-polls'), 'widget_polls');
124
+ register_widget_control(array('Polls', 'wp-polls'), 'widget_polls_options', 400, 150);
125
+ }
126
+
127
+
128
+ ### Function: Load The WP-Polls Widget
129
+ add_action('plugins_loaded', 'widget_polls_init');
130
+ ?>
polls/polls.php ADDED
@@ -0,0 +1,1158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-Polls
4
+ Plugin URI: http://www.lesterchan.net/portfolio/programming.php
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.14
7
+ Author: GaMerZ
8
+ Author URI: http://www.lesterchan.net
9
+ */
10
+
11
+
12
+ /*
13
+ Copyright 2007 Lester Chan (email : gamerz84@hotmail.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+
31
+ ### Load WP-Config File If This File Is Called Directly
32
+ if (!function_exists('add_action')) {
33
+ require_once('../../../wp-config.php');
34
+ }
35
+
36
+
37
+ ### Create Text Domain For Translations
38
+ load_plugin_textdomain('wp-polls', 'wp-content/plugins/polls');
39
+
40
+
41
+ ### Polls Table Name
42
+ $wpdb->pollsq = $table_prefix.'pollsq';
43
+ $wpdb->pollsa = $table_prefix.'pollsa';
44
+ $wpdb->pollsip = $table_prefix.'pollsip';
45
+
46
+
47
+ ### Function: Poll Administration Menu
48
+ add_action('admin_menu', 'poll_menu');
49
+ function poll_menu() {
50
+ if (function_exists('add_menu_page')) {
51
+ add_menu_page(__('Polls', 'wp-polls'), __('Polls', 'wp-polls'), 'manage_polls', 'polls/polls-manager.php');
52
+ }
53
+ if (function_exists('add_submenu_page')) {
54
+ add_submenu_page('polls/polls-manager.php', __('Manage Polls', 'wp-polls'), __('Manage Polls', 'wp-polls'), 'manage_polls', 'polls/polls-manager.php');
55
+ add_submenu_page('polls/polls-manager.php', __('Poll Options', 'wp-polls'), __('Poll Options', 'wp-polls'), 'manage_polls', 'polls/polls-options.php');
56
+ add_submenu_page('polls/polls-manager.php', __('Poll Usage', 'wp-polls'), __('Poll Usage', 'wp-polls'), 'manage_polls', 'polls/polls-usage.php');
57
+ }
58
+ }
59
+
60
+
61
+ ### Function: Get Poll
62
+ function get_poll($temp_poll_id = 0, $display = true) {
63
+ global $wpdb, $polls_loaded;
64
+ // Poll Result Link
65
+ $pollresult_id = intval($_GET['pollresult']);
66
+ // Check Whether Poll Is Disabled
67
+ if(intval(get_option('poll_currentpoll')) == -1) {
68
+ if($display) {
69
+ echo stripslashes(get_option('poll_template_disable'));
70
+ return;
71
+ } else {
72
+ return stripslashes(get_option('poll_template_disable'));
73
+ }
74
+ // Poll Is Enabled
75
+ } else {
76
+ // Hardcoded Poll ID Is Not Specified
77
+ if(intval($temp_poll_id) == 0) {
78
+ // Random Poll
79
+ if(intval(get_option('poll_currentpoll')) == -2) {
80
+ $random_poll_id = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq WHERE pollq_active = 1 ORDER BY RAND() LIMIT 1");
81
+ $poll_id = intval($random_poll_id);
82
+ if($pollresult_id > 0) {
83
+ $poll_id = $pollresult_id;
84
+ } elseif(intval($_POST['poll_id']) > 0) {
85
+ $poll_id = intval($_POST['poll_id']);
86
+ }
87
+ // Current Poll ID Is Not Specified
88
+ } elseif(intval(get_option('poll_currentpoll')) == 0) {
89
+ // Get Lastest Poll ID
90
+ $poll_id = intval(get_option('poll_latestpoll'));
91
+ } else {
92
+ // Get Current Poll ID
93
+ $poll_id = intval(get_option('poll_currentpoll'));
94
+ }
95
+ // Get Hardcoded Poll ID
96
+ } else {
97
+ $poll_id = intval($temp_poll_id);
98
+ }
99
+ }
100
+
101
+ // Assign All Loaded Poll To $polls_loaded
102
+ if(empty($polls_loaded)) {
103
+ $polls_loaded = array();
104
+ }
105
+ if(!in_array($poll_id, $polls_loaded)) {
106
+ $polls_loaded[] = $poll_id;
107
+ }
108
+
109
+ // User Click on View Results Link
110
+ if($pollresult_id == $poll_id) {
111
+ if($display) {
112
+ echo display_pollresult($poll_id);
113
+ return;
114
+ } else {
115
+ return display_pollresult($poll_id);
116
+ }
117
+ // Check Whether User Has Voted
118
+ } else {
119
+ $poll_active = $wpdb->get_var("SELECT pollq_active FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
120
+ $poll_active = intval($poll_active);
121
+ $check_voted = check_voted($poll_id);
122
+ if($poll_active == 0) {
123
+ $poll_close = intval(get_option('poll_close'));
124
+ }
125
+ if($check_voted > 0 || ($poll_active == 0 && $poll_close == 1) || !check_allowtovote()) {
126
+ if($display) {
127
+ echo display_pollresult($poll_id, $check_voted);
128
+ return;
129
+ } else {
130
+ return display_pollresult($poll_id, $check_voted);
131
+ }
132
+ } elseif($poll_active == 1) {
133
+ if($display) {
134
+ echo display_pollvote($poll_id);
135
+ return;
136
+ } else {
137
+ return display_pollvote($poll_id);
138
+ }
139
+ }
140
+ }
141
+ }
142
+
143
+
144
+ ### Function: Displays Polls Header
145
+ add_action('wp_head', 'poll_header');
146
+ function poll_header() {
147
+ echo "\n".'<!-- Start Of Script Generated By WP-Polls 2.14 -->'."\n";
148
+ wp_register_script('wp-polls', '/wp-content/plugins/polls/polls-js.php', false, '2.14');
149
+ wp_print_scripts(array('sack', 'wp-polls'));
150
+ echo '<link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/polls/polls-css.css" type="text/css" media="screen" />'."\n";
151
+ echo '<style type="text/css">'."\n";
152
+ $pollbar = get_option('poll_bar');
153
+ if($pollbar['style'] == 'use_css') {
154
+ echo '.wp-polls .pollbar {'."\n";
155
+ echo "\t".'margin: 1px;'."\n";
156
+ echo "\t".'font-size: '.($pollbar['height']-2).'px;'."\n";
157
+ echo "\t".'line-height: '.$pollbar['height'].'px;'."\n";
158
+ echo "\t".'height: '.$pollbar['height'].'px;'."\n";
159
+ echo "\t".'background: #'.$pollbar['background'].';'."\n";
160
+ echo "\t".'border: 1px solid #'.$pollbar['border'].';'."\n";
161
+ echo '}'."\n";
162
+ } else {
163
+ echo '.wp-polls .pollbar {'."\n";
164
+ echo "\t".'margin: 1px;'."\n";
165
+ echo "\t".'font-size: '.($pollbar['height']-2).'px;'."\n";
166
+ echo "\t".'line-height: '.$pollbar['height'].'px;'."\n";
167
+ echo "\t".'height: '.$pollbar['height'].'px;'."\n";
168
+ echo "\t".'background-image: url(\''.get_option('siteurl').'/wp-content/plugins/polls/images/'.$pollbar['style'].'/pollbg.gif\');'."\n";
169
+ echo "\t".'border: 1px solid #'.$pollbar['border'].';'."\n";
170
+ echo '}'."\n";
171
+ }
172
+ echo '</style>'."\n";
173
+ echo '<!-- End Of Script Generated By WP-Polls 2.14 -->'."\n";
174
+ }
175
+
176
+
177
+ ### Function: Displays Polls Header In WP-Admin
178
+ add_action('admin_head', 'poll_header_admin');
179
+ function poll_header_admin() {
180
+ echo '<link rel="stylesheet" href="'.get_option('siteurl').'/wp-content/plugins/polls/polls-css.css" type="text/css" media="screen" />'."\n";
181
+ }
182
+
183
+
184
+ ### Function: Check Who Is Allow To Vote
185
+ function check_allowtovote() {
186
+ global $user_ID;
187
+ $user_ID = intval($user_ID);
188
+ $allow_to_vote = intval(get_option('poll_allowtovote'));
189
+ switch($allow_to_vote) {
190
+ // Guests Only
191
+ case 0:
192
+ if($user_ID > 0) {
193
+ return false;
194
+ }
195
+ return true;
196
+ break;
197
+ // Registered Users Only
198
+ case 1:
199
+ if($user_ID == 0) {
200
+ return false;
201
+ }
202
+ return true;
203
+ break;
204
+ // Registered Users And Guests
205
+ case 2:
206
+ default:
207
+ return true;
208
+ }
209
+ }
210
+
211
+
212
+ ### Funcrion: Check Voted By Cookie Or IP
213
+ function check_voted($poll_id) {
214
+ $poll_logging_method = intval(get_option('poll_logging_method'));
215
+ switch($poll_logging_method) {
216
+ // Do Not Log
217
+ case 0:
218
+ return 0;
219
+ break;
220
+ // Logged By Cookie
221
+ case 1:
222
+ return check_voted_cookie($poll_id);
223
+ break;
224
+ // Logged By IP
225
+ case 2:
226
+ return check_voted_ip($poll_id);
227
+ break;
228
+ // Logged By Cookie And IP
229
+ case 3:
230
+ $check_voted_cookie = check_voted_cookie($poll_id);
231
+ if($check_voted_cookie > 0) {
232
+ return $check_voted_cookie;
233
+ } else {
234
+ return check_voted_ip($poll_id);
235
+ }
236
+ break;
237
+ // Logged By Username
238
+ case 4:
239
+ return check_voted_username($poll_id);
240
+ break;
241
+ }
242
+ }
243
+
244
+
245
+ ### Function: Check Voted By Cookie
246
+ function check_voted_cookie($poll_id) {
247
+ // 0: False | > 0: True
248
+ return intval($_COOKIE["voted_$poll_id"]);
249
+ }
250
+
251
+
252
+ ### Function: Check Voted By IP
253
+ function check_voted_ip($poll_id) {
254
+ global $wpdb;
255
+ // Check IP From IP Logging Database
256
+ $get_voted_aid = $wpdb->get_var("SELECT pollip_aid FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_ip = '".get_ipaddress()."'");
257
+ // 0: False | > 0: True
258
+ return intval($get_voted_aid);
259
+ }
260
+
261
+
262
+ ### Function: Check Voted By Username
263
+ function check_voted_username($poll_id) {
264
+ global $wpdb, $user_ID;
265
+ // Check IP If User Is Guest
266
+ if ($user_ID == 0) {
267
+ return check_voted_ip($poll_id);
268
+ }
269
+ $pollsip_userid = intval($user_ID);
270
+ // Check User ID From IP Logging Database
271
+ $get_voted_aid = $wpdb->get_var("SELECT pollip_aid FROM $wpdb->pollsip WHERE pollip_qid = $poll_id AND pollip_userid = $pollsip_userid");
272
+ // 0: False | > 0: True
273
+ return intval($get_voted_aid);
274
+ }
275
+
276
+
277
+ ### Function: Display Voting Form
278
+ function display_pollvote($poll_id, $without_poll_title = false) {
279
+ global $wpdb;
280
+ // Temp Poll Result
281
+ $temp_pollvote = '';
282
+ // Get Poll Question Data
283
+ $poll_question = $wpdb->get_row("SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry FROM $wpdb->pollsq WHERE pollq_id = $poll_id LIMIT 1");
284
+ // Poll Question Variables
285
+ $poll_question_text = stripslashes($poll_question->pollq_question);
286
+ $poll_question_id = intval($poll_question->pollq_id);
287
+ $poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
288
+ $poll_start_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_question->pollq_timestamp));
289
+ $poll_expiry = trim($poll_question->pollq_expiry);
290
+ if(empty($poll_expiry)) {
291
+ $poll_end_date = __('No Expiry', 'wp-polls');
292
+ } else {
293
+ $poll_end_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry));
294
+ }
295
+ $template_question = stripslashes(get_option('poll_template_voteheader'));
296
+ $template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
297
+ $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
298
+ $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
299
+ $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question);
300
+ $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question);
301
+ // Get Poll Answers Data
302
+ $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'));
303
+ // If There Is Poll Question With Answers
304
+ if($poll_question && $poll_answers) {
305
+ // Display Poll Voting Form
306
+ if(!$without_poll_title) {
307
+ $temp_pollvote .= "<div id=\"polls-$poll_question_id\" class=\"wp-polls\">\n";
308
+ $temp_pollvote .= "\t<form id=\"polls_form_$poll_question_id\" action=\"".htmlspecialchars($_SERVER['REQUEST_URI'])."\" method=\"post\">\n";
309
+ $temp_pollvote .= "\t\t<p><input type=\"hidden\" name=\"poll_id\" value=\"$poll_question_id\" /></p>\n";
310
+ // Print Out Voting Form Header Template
311
+ $temp_pollvote .= "\t\t$template_question\n";
312
+ }
313
+ foreach($poll_answers as $poll_answer) {
314
+ // Poll Answer Variables
315
+ $poll_answer_id = intval($poll_answer->polla_aid);
316
+ $poll_answer_text = stripslashes($poll_answer->polla_answers);
317
+ $poll_answer_votes = intval($poll_answer->polla_votes);
318
+ $template_answer = stripslashes(get_option('poll_template_votebody'));
319
+ $template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
320
+ $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
321
+ $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
322
+ $template_answer = str_replace("%POLL_ANSWER_VOTES%", number_format($poll_answer_votes), $template_answer);
323
+ // Print Out Voting Form Body Template
324
+ $temp_pollvote .= "\t\t$template_answer\n";
325
+ }
326
+ // Determine Poll Result URL
327
+ $poll_result_url = $_SERVER['REQUEST_URI'];
328
+ $poll_result_url = preg_replace('/pollresult=(\d+)/i', 'pollresult='.$poll_question_id, $poll_result_url);
329
+ if(intval($_GET['pollresult']) == 0) {
330
+ if(strpos($poll_result_url, '?') !== false) {
331
+ $poll_result_url = "$poll_result_url&amp;pollresult=$poll_question_id";
332
+ } else {
333
+ $poll_result_url = "$poll_result_url?pollresult=$poll_question_id";
334
+ }
335
+ }
336
+ // Voting Form Footer Variables
337
+ $template_footer = stripslashes(get_option('poll_template_votefooter'));
338
+ $template_footer = str_replace("%POLL_ID%", $poll_question_id, $template_footer);
339
+ $template_footer = str_replace("%POLL_RESULT_URL%", $poll_result_url, $template_footer);
340
+ $template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
341
+ $template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
342
+ // Print Out Voting Form Footer Template
343
+ $temp_pollvote .= "\t\t$template_footer\n";
344
+ if(!$without_poll_title) {
345
+ $temp_pollvote .= "\t</form>\n";
346
+ $temp_pollvote .= "</div>\n";
347
+ $temp_pollvote .= "<div id=\"polls-$poll_question_id-loading\" class=\"wp-polls-loading\"><img src=\"".get_option('siteurl')."/wp-content/plugins/polls/images/loading.gif\" width=\"16\" height=\"16\" alt=\"".__('Loading', 'wp-polls')." ...\" title=\"".__('Loading', 'wp-polls')." ...\" class=\"wp-polls-image\" />&nbsp;".__('Loading', 'wp-polls')." ...</div>\n";
348
+ }
349
+ } else {
350
+ $temp_pollvote .= stripslashes(get_option('poll_template_disable'));
351
+ }
352
+ // Return Poll Vote Template
353
+ return $temp_pollvote;
354
+ }
355
+
356
+
357
+ ### Function: Display Results Form
358
+ function display_pollresult($poll_id, $user_voted = 0, $without_poll_title = false) {
359
+ global $wpdb;
360
+ // Temp Poll Result
361
+ $temp_pollresult = '';
362
+ // Most/Least Variables
363
+ $poll_most_answer = '';
364
+ $poll_most_votes = 0;
365
+ $poll_most_percentage = 0;
366
+ $poll_least_answer = '';
367
+ $poll_least_votes = 0;
368
+ $poll_least_percentage = 0;
369
+ // Get Poll Question Data
370
+ $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");
371
+ // Poll Question Variables
372
+ $poll_question_text = stripslashes($poll_question->pollq_question);
373
+ $poll_question_id = intval($poll_question->pollq_id);
374
+ $poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
375
+ $poll_question_active = intval($poll_question->pollq_active);
376
+ $poll_start_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_question->pollq_timestamp));
377
+ $poll_expiry = trim($poll_question->pollq_expiry);
378
+ if(empty($poll_expiry)) {
379
+ $poll_end_date = __('No Expiry', 'wp-polls');
380
+ } else {
381
+ $poll_end_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $poll_expiry));
382
+ }
383
+ $template_question = stripslashes(get_option('poll_template_resultheader'));
384
+ $template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
385
+ $template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
386
+ $template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
387
+ $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question);
388
+ $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question);
389
+ // Get Poll Answers Data
390
+ $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'));
391
+ // If There Is Poll Question With Answers
392
+ if($poll_question && $poll_answers) {
393
+ // Is The Poll Total Votes 0?
394
+ $poll_totalvotes_zero = true;
395
+ if($poll_question_totalvotes > 0) {
396
+ $poll_totalvotes_zero = false;
397
+ }
398
+ // Print Out Result Header Template
399
+ if(!$without_poll_title) {
400
+ $temp_pollresult .= "<div id=\"polls-$poll_question_id\" class=\"wp-polls\">\n";
401
+ $temp_pollresult .= "\t\t$template_question\n";
402
+ }
403
+ foreach($poll_answers as $poll_answer) {
404
+ // Poll Answer Variables
405
+ $poll_answer_id = intval($poll_answer->polla_aid);
406
+ $poll_answer_text = stripslashes($poll_answer->polla_answers);
407
+ $poll_answer_votes = intval($poll_answer->polla_votes);
408
+ $poll_answer_percentage = 0;
409
+ $poll_answer_imagewidth = 0;
410
+ // Calculate Percentage And Image Bar Width
411
+ if(!$poll_totalvotes_zero) {
412
+ if($poll_answer_votes > 0) {
413
+ $poll_answer_percentage = round((($poll_answer_votes/$poll_question_totalvotes)*100));
414
+ $poll_answer_imagewidth = round($poll_answer_percentage);
415
+ if($poll_answer_imagewidth == 100) {
416
+ $poll_answer_imagewidth = 99;
417
+ }
418
+ } else {
419
+ $poll_answer_percentage = 0;
420
+ $poll_answer_imagewidth = 1;
421
+ }
422
+ } else {
423
+ $poll_answer_percentage = 0;
424
+ $poll_answer_imagewidth = 1;
425
+ }
426
+ // Let User See What Options They Voted
427
+ if($user_voted == $poll_answer_id) {
428
+ // Results Body Variables
429
+ $template_answer = stripslashes(get_option('poll_template_resultbody2'));
430
+ $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
431
+ $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
432
+ $template_answer = str_replace("%POLL_ANSWER_TEXT%", htmlspecialchars(strip_tags($poll_answer_text)), $template_answer);
433
+ $template_answer = str_replace("%POLL_ANSWER_VOTES%", number_format($poll_answer_votes), $template_answer);
434
+ $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
435
+ $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
436
+ // Print Out Results Body Template
437
+ $temp_pollresult .= "\t\t$template_answer\n";
438
+ } else {
439
+ // Results Body Variables
440
+ $template_answer = stripslashes(get_option('poll_template_resultbody'));
441
+ $template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
442
+ $template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
443
+ $template_answer = str_replace("%POLL_ANSWER_TEXT%", htmlspecialchars(strip_tags($poll_answer_text)), $template_answer);
444
+ $template_answer = str_replace("%POLL_ANSWER_VOTES%", number_format($poll_answer_votes), $template_answer);
445
+ $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
446
+ $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
447
+ // Print Out Results Body Template
448
+ $temp_pollresult .= "\t\t$template_answer\n";
449
+ }
450
+ // Get Most Voted Data
451
+ if($poll_answer_votes > $poll_most_votes) {
452
+ $poll_most_answer = $poll_answer_text;
453
+ $poll_most_votes = $poll_answer_votes;
454
+ $poll_most_percentage = $poll_answer_percentage;
455
+ }
456
+ // Get Least Voted Data
457
+ if($poll_least_votes == 0) {
458
+ $poll_least_votes = $poll_answer_votes;
459
+ }
460
+ if($poll_answer_votes <= $poll_least_votes) {
461
+ $poll_least_answer = $poll_answer_text;
462
+ $poll_least_votes = $poll_answer_votes;
463
+ $poll_least_percentage = $poll_answer_percentage;
464
+ }
465
+ }
466
+ // Results Footer Variables
467
+ if($user_voted > 0 || $poll_question_active == 0 || !check_allowtovote()) {
468
+ $template_footer = stripslashes(get_option('poll_template_resultfooter'));
469
+ } else {
470
+ $template_footer = stripslashes(get_option('poll_template_resultfooter2'));
471
+ }
472
+ $template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
473
+ $template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
474
+ $template_footer = str_replace("%POLL_ID%", $poll_question_id, $template_footer);
475
+ $template_footer = str_replace("%POLL_TOTALVOTES%", number_format($poll_question_totalvotes), $template_footer);
476
+ $template_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_footer);
477
+ $template_footer = str_replace("%POLL_MOST_VOTES%", number_format($poll_most_votes), $template_footer);
478
+ $template_footer = str_replace("%POLL_MOST_PERCENTAGE%", $poll_most_percentage, $template_footer);
479
+ $template_footer = str_replace("%POLL_LEAST_ANSWER%", $poll_least_answer, $template_footer);
480
+ $template_footer = str_replace("%POLL_LEAST_VOTES%", number_format($poll_least_votes), $template_footer);
481
+ $template_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_footer);
482
+ // Print Out Results Footer Template
483
+ $temp_pollresult .= "\t\t$template_footer\n";
484
+ if(!$without_poll_title) {
485
+ $temp_pollresult .= "</div>\n";
486
+ $temp_pollresult .= "<div id=\"polls-$poll_question_id-loading\" class=\"wp-polls-loading\"><img src=\"".get_option('siteurl')."/wp-content/plugins/polls/images/loading.gif\" width=\"16\" height=\"16\" alt=\"".__('Loading', 'wp-polls')." ...\" title=\"".__('Loading', 'wp-polls')." ...\" class=\"wp-polls-image\" />&nbsp;".__('Loading', 'wp-polls')." ...</div>\n";
487
+ }
488
+ } else {
489
+ $temp_pollresult .= stripslashes(get_option('poll_template_disable'));
490
+ }
491
+ // Return Poll Result
492
+ return $temp_pollresult;
493
+ }
494
+
495
+
496
+ ### Function: Get IP Address
497
+ if(!function_exists('get_ipaddress')) {
498
+ function get_ipaddress() {
499
+ if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
500
+ $ip_address = $_SERVER["REMOTE_ADDR"];
501
+ } else {
502
+ $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
503
+ }
504
+ if(strpos($ip_address, ',') !== false) {
505
+ $ip_address = explode(',', $ip_address);
506
+ $ip_address = $ip_address[0];
507
+ }
508
+ return $ip_address;
509
+ }
510
+ }
511
+
512
+
513
+ ### Function: Place Polls Archive In Content
514
+ add_filter('the_content', 'place_pollsarchive', '7');
515
+ function place_pollsarchive($content){
516
+ $content = preg_replace( "/\[page_polls\]/ise", "polls_archive()", $content);
517
+ return $content;
518
+ }
519
+
520
+
521
+ ### Function: Place Poll In Content (By: Robert Accettura Of http://robert.accettura.com/)
522
+ add_filter('the_content', 'place_poll', '7');
523
+ function place_poll($content){
524
+ $content = preg_replace( "/\[poll=(\d+)\]/ise", "display_poll('\\1')", $content);
525
+ return $content;
526
+ }
527
+
528
+
529
+ ### Function: Display The Poll In Content (By: Robert Accettura Of http://robert.accettura.com/)
530
+ function display_poll($poll_id){
531
+ return get_poll($poll_id, false);
532
+ }
533
+
534
+
535
+ ### Function: Get Poll Total Questions
536
+ if(!function_exists('get_pollquestions')) {
537
+ function get_pollquestions($display = true) {
538
+ global $wpdb;
539
+ $totalpollq = $wpdb->get_var("SELECT COUNT(pollq_id) FROM $wpdb->pollsq");
540
+ if($display) {
541
+ echo number_format($totalpollq);
542
+ } else {
543
+ return number_format($totalpollq);
544
+ }
545
+ }
546
+ }
547
+
548
+
549
+ ### Function: Get Poll Total Answers
550
+ if(!function_exists('get_pollanswers')) {
551
+ function get_pollanswers($display = true) {
552
+ global $wpdb;
553
+ $totalpolla = $wpdb->get_var("SELECT COUNT(polla_aid) FROM $wpdb->pollsa");
554
+ if($display) {
555
+ echo number_format($totalpolla);
556
+ } else {
557
+ return number_format($totalpolla);
558
+ }
559
+ }
560
+ }
561
+
562
+
563
+ ### Function: Get Poll Total Votes
564
+ if(!function_exists('get_pollvotes')) {
565
+ function get_pollvotes($display = true) {
566
+ global $wpdb;
567
+ $totalpollip = $wpdb->get_var("SELECT COUNT(pollip_id) FROM $wpdb->pollsip");
568
+ if($display) {
569
+ echo number_format($totalpollip);
570
+ } else {
571
+ return number_format($totalpollip);
572
+ }
573
+ }
574
+ }
575
+
576
+
577
+ ### Function: Check Voted To Get Voted Answer
578
+ function check_voted_multiple($poll_id) {
579
+ global $polls_ips;
580
+ $temp_voted_aid = 0;
581
+ if(intval($_COOKIE["voted_$poll_id"]) > 0) {
582
+ $temp_voted_aid = intval($_COOKIE["voted_$poll_id"]);
583
+ } else {
584
+ if($polls_ips) {
585
+ foreach($polls_ips as $polls_ip) {
586
+ if($polls_ip['qid'] == $poll_id) {
587
+ $temp_voted_aid = $polls_ip['aid'];
588
+ }
589
+ }
590
+ }
591
+ }
592
+ return $temp_voted_aid;
593
+ }
594
+
595
+
596
+ ### Function: Polls Archive Link
597
+ function polls_archive_link($page) {
598
+ $current_url = $_SERVER['REQUEST_URI'];
599
+ $curren_pollpage = intval($_GET['poll_page']);
600
+ $polls_archive_url = preg_replace('/poll_page=(\d+)/i', 'poll_page='.$page, $current_url);
601
+ if($curren_pollpage == 0) {
602
+ if(strpos($current_url, '?') !== false) {
603
+ $polls_archive_url = "$polls_archive_url&amp;poll_page=$page";
604
+ } else {
605
+ $polls_archive_url = "$polls_archive_url?poll_page=$page";
606
+ }
607
+ }
608
+ return $polls_archive_url;
609
+ }
610
+
611
+
612
+ ### Function: Displays Polls Archive Link
613
+ function display_polls_archive_link($display = true) {
614
+ if(intval(get_option('poll_archive_show')) == 1) {
615
+ if($display) {
616
+ echo "<ul>\n<li><a href=\"".get_option('poll_archive_url')."\">".__('Polls Archive', 'wp-polls')."</a></li></ul>\n";
617
+ } else{
618
+ return "<ul>\n<li><a href=\"".get_option('poll_archive_url')."\">".__('Polls Archive', 'wp-polls')."</a></li></ul>\n";
619
+ }
620
+ }
621
+ }
622
+
623
+
624
+ ### Function: Display Polls Archive
625
+ function polls_archive($output = 'both') {
626
+ global $wpdb, $polls_ips, $in_pollsarchive;
627
+ // Polls Variables
628
+ $in_pollsarchive = true;
629
+ $page = intval($_GET['poll_page']);
630
+ $polls_questions = array();
631
+ $polls_answers = array();
632
+ $polls_ip = array();
633
+ $polls_perpage = intval(get_option('poll_archive_perpage'));
634
+ $poll_questions_ids = '0';
635
+ $poll_voted = false;
636
+ $poll_voted_aid = 0;
637
+ $poll_id = 0;
638
+ $pollsarchive_output_current_title = '';
639
+ $pollsarchive_output_current = '';
640
+ $pollsarchive_output_archive_title = '';
641
+ $pollsarchive_output_archive = '';
642
+
643
+ // Get Total Polls
644
+ $total_polls = $wpdb->get_var("SELECT COUNT(pollq_id) FROM $wpdb->pollsq WHERE pollq_timestamp <= '".current_time('timestamp')."'");
645
+
646
+ // Checking $page and $offset
647
+ if (empty($page) || $page == 0) { $page = 1; }
648
+ if (empty($offset)) { $offset = 0; }
649
+
650
+ // Determin $offset
651
+ $offset = ($page-1) * $polls_perpage;
652
+
653
+ // Determine Max Number Of Polls To Display On Page
654
+ if(($offset + $polls_perpage) > $total_polls) {
655
+ $max_on_page = $total_polls;
656
+ } else {
657
+ $max_on_page = ($offset + $polls_perpage);
658
+ }
659
+
660
+ // Determine Number Of Polls To Display On Page
661
+ if (($offset + 1) > ($total_polls)) {
662
+ $display_on_page = $total_polls;
663
+ } else {
664
+ $display_on_page = ($offset + 1);
665
+ }
666
+
667
+ // Determing Total Amount Of Pages
668
+ $total_pages = ceil($total_polls / $polls_perpage);
669
+
670
+ // Make Sure Poll Is Not Disabled
671
+ if(intval(get_option('poll_currentpoll')) != -1 && $page < 2) {
672
+ // Hardcoded Poll ID Is Not Specified
673
+ if(intval($temp_poll_id) == 0) {
674
+ // Random Poll
675
+ if(intval(get_option('poll_currentpoll')) == -2) {
676
+ $random_poll_id = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq WHERE pollq_active = 1 ORDER BY RAND() LIMIT 1");
677
+ $poll_id = intval($random_poll_id);
678
+ // Current Poll ID Is Not Specified
679
+ } else if(intval(get_option('poll_currentpoll')) == 0) {
680
+ // Get Lastest Poll ID
681
+ $poll_id = intval(get_option('poll_latestpoll'));
682
+ } else {
683
+ // Get Current Poll ID
684
+ $poll_id = intval(get_option('poll_currentpoll'));
685
+ }
686
+ // Get Hardcoded Poll ID
687
+ } else {
688
+ $poll_id = intval($temp_poll_id);
689
+ }
690
+ }
691
+
692
+ // Get Poll Questions
693
+ $questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE pollq_id != $poll_id AND pollq_active != -1 ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
694
+ if($questions) {
695
+ foreach($questions as $question) {
696
+ $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));
697
+ $poll_questions_ids .= intval($question->pollq_id).', ';
698
+ }
699
+ $poll_questions_ids = substr($poll_questions_ids, 0, -2);
700
+ }
701
+
702
+ // Get Poll Answers
703
+ $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'));
704
+ if($answers) {
705
+ foreach($answers as $answer) {
706
+ $polls_answers[] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => stripslashes($answer->polla_answers), 'votes' => intval($answer->polla_votes));
707
+ }
708
+ }
709
+
710
+ // Get Poll IPs
711
+ $ips = $wpdb->get_results("SELECT pollip_qid, pollip_aid FROM $wpdb->pollsip WHERE pollip_qid IN ($poll_questions_ids) AND pollip_ip = '".get_ipaddress()."'");
712
+ if($ips) {
713
+ foreach($ips as $ip) {
714
+ $polls_ips[] = array('qid' => intval($ip->pollip_qid), 'aid' => intval($ip->pollip_aid));
715
+ }
716
+ }
717
+
718
+ // Current Poll
719
+ if($page < 2) {
720
+ $pollsarchive_output_current_title = '<h2>'.__('Current Poll', 'wp-polls').'</h2>'."\n";
721
+ // Current Poll
722
+ if(intval(get_option('poll_currentpoll')) == -1) {
723
+ $pollsarchive_output_current .= get_option('poll_template_disable');
724
+ } else {
725
+ // User Click on View Results Link
726
+ if(intval($_GET['pollresult']) == $poll_id) {
727
+ $pollsarchive_output_current .= display_pollresult($poll_id);
728
+ // Check Whether User Has Voted
729
+ } else {
730
+ $poll_active = $wpdb->get_var("SELECT pollq_active FROM $wpdb->pollsq WHERE pollq_id = $poll_id");
731
+ $poll_active = intval($poll_active);
732
+ $check_voted = check_voted($poll_id);
733
+ if($check_voted > 0 || $poll_active == 0) {
734
+ $pollsarchive_output_current .= display_pollresult($poll_id, $check_voted);
735
+ } else {
736
+ $pollsarchive_output_current .= display_pollvote($poll_id);
737
+ }
738
+ }
739
+ }
740
+ }
741
+ // Poll Archives
742
+ $pollsarchive_output_archive_title = "<h2>".__('Polls Archive', 'wp-polls')."</h2>\n";
743
+ $pollsarchive_output_archive .= "<div class=\"wp-polls\">\n";
744
+ foreach($polls_questions as $polls_question) {
745
+ // Most/Least Variables
746
+ $poll_most_answer = '';
747
+ $poll_most_votes = 0;
748
+ $poll_most_percentage = 0;
749
+ $poll_least_answer = '';
750
+ $poll_least_votes = 0;
751
+ $poll_least_percentage = 0;
752
+ // Is The Poll Total Votes 0?
753
+ $poll_totalvotes_zero = true;
754
+ if($polls_question['totalvotes'] > 0) {
755
+ $poll_totalvotes_zero = false;
756
+ }
757
+ $poll_start_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $polls_question['start']));
758
+ if(empty($polls_question['end'])) {
759
+ $poll_end_date = __('No Expiry', 'wp-polls');
760
+ } else {
761
+ $poll_end_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), gmdate('Y-m-d H:i:s', $polls_question['end']));
762
+ }
763
+ // Poll Question Variables
764
+ $template_question = stripslashes(get_option('poll_template_resultheader'));
765
+ $template_question = str_replace("%POLL_QUESTION%", $polls_question['question'], $template_question);
766
+ $template_question = str_replace("%POLL_ID%", $polls_question['id'], $template_question);
767
+ $template_question = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_question);
768
+ $template_question = str_replace("%POLL_START_DATE%", $poll_start_date, $template_question);
769
+ $template_question = str_replace("%POLL_END_DATE%", $poll_end_date, $template_question);
770
+ // Print Out Result Header Template
771
+ $pollsarchive_output_archive .= $template_question;
772
+ foreach($polls_answers as $polls_answer) {
773
+ if($polls_question['id'] == $polls_answer['qid']) {
774
+ // Calculate Percentage And Image Bar Width
775
+ if(!$poll_totalvotes_zero) {
776
+ if($polls_answer['votes'] > 0) {
777
+ $poll_answer_percentage = round((($polls_answer['votes']/$polls_question['totalvotes'])*100));
778
+ $poll_answer_imagewidth = round($poll_answer_percentage*0.9);
779
+ } else {
780
+ $poll_answer_percentage = 0;
781
+ $poll_answer_imagewidth = 1;
782
+ }
783
+ } else {
784
+ $poll_answer_percentage = 0;
785
+ $poll_answer_imagewidth = 1;
786
+ }
787
+ // Let User See What Options They Voted
788
+ if(check_voted_multiple($polls_question['id']) == $polls_answer['aid']) {
789
+ // Results Body Variables
790
+ $template_answer = stripslashes(get_option('poll_template_resultbody2'));
791
+ $template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
792
+ $template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
793
+ $template_answer = str_replace("%POLL_ANSWER_TEXT%", htmlspecialchars(strip_tags($polls_answer['answers'])), $template_answer);
794
+ $template_answer = str_replace("%POLL_ANSWER_VOTES%", $polls_answer['votes'], $template_answer);
795
+ $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
796
+ $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
797
+ // Print Out Results Body Template
798
+ $pollsarchive_output_archive .= $template_answer;
799
+ } else {
800
+ // Results Body Variables
801
+ $template_answer = stripslashes(get_option('poll_template_resultbody'));
802
+ $template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
803
+ $template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
804
+ $template_answer = str_replace("%POLL_ANSWER_TEXT%", htmlspecialchars(strip_tags($polls_answer['answers'])), $template_answer);
805
+ $template_answer = str_replace("%POLL_ANSWER_VOTES%", $polls_answer['votes'], $template_answer);
806
+ $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
807
+ $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
808
+ // Print Out Results Body Template
809
+ $pollsarchive_output_archive .= $template_answer;
810
+ }
811
+ // Get Most Voted Data
812
+ if($polls_answer['votes'] > $poll_most_votes) {
813
+ $poll_most_answer = $polls_answer['answers'];
814
+ $poll_most_votes = $polls_answer['votes'];
815
+ $poll_most_percentage = $poll_answer_percentage;
816
+ }
817
+ // Get Least Voted Data
818
+ if($poll_least_votes == 0) {
819
+ $poll_least_votes = $polls_answer['votes'];
820
+ }
821
+ if($polls_answer['votes'] <= $poll_least_votes) {
822
+ $poll_least_answer = $polls_answer['answers'];
823
+ $poll_least_votes = $polls_answer['votes'];
824
+ $poll_least_percentage = $poll_answer_percentage;
825
+ }
826
+ // Delete Away From Array
827
+ unset($polls_answer['answers']);
828
+ }
829
+ }
830
+ // Results Footer Variables
831
+ $template_footer = stripslashes(get_option('poll_template_resultfooter'));
832
+ $template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
833
+ $template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
834
+ $template_footer = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_footer);
835
+ $template_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_footer);
836
+ $template_footer = str_replace("%POLL_MOST_VOTES%", number_format($poll_most_votes), $template_footer);
837
+ $template_footer = str_replace("%POLL_MOST_PERCENTAGE%", $poll_most_percentage, $template_footer);
838
+ $template_footer = str_replace("%POLL_LEAST_ANSWER%", $poll_least_answer, $template_footer);
839
+ $template_footer = str_replace("%POLL_LEAST_VOTES%", number_format($poll_least_votes), $template_footer);
840
+ $template_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_footer);
841
+ // Print Out Results Footer Template
842
+ $pollsarchive_output_archive .= $template_footer;
843
+ }
844
+ $pollsarchive_output_archive .= "</div>\n";
845
+
846
+ // Polls Archive Paging
847
+ if($total_pages > 1) {
848
+ // Output Previous Page
849
+ $pollsarchive_output_archive .= "<p>\n";
850
+ $pollsarchive_output_archive .= "<span style=\"float: left;\">\n";
851
+ if($page > 1 && ((($page*$polls_perpage)-($polls_perpage-1)) <= $total_polls)) {
852
+ $pollsarchive_output_archive .= '<strong>&laquo;</strong> <a href="'.polls_archive_link($page-1).'" title="&laquo; '.__('Previous Page', 'wp-polls').'">'.__('Previous Page', 'wp-polls').'</a>';
853
+ } else {
854
+ $pollsarchive_output_archive .= '&nbsp;';
855
+ }
856
+ $pollsarchive_output_archive .= "</span>\n";
857
+ // Output Next Page
858
+ $pollsarchive_output_archive .= "<span style=\"float: right;\">\n";
859
+ if($page >= 1 && ((($page*$polls_perpage)+1) <= $total_polls)) {
860
+ $pollsarchive_output_archive .= '<a href="'.polls_archive_link($page+1).'" title="'.__('Next Page', 'wp-polls').' &raquo;">'.__('Next Page', 'wp-polls').'</a> <strong>&raquo;</strong>';
861
+ } else {
862
+ $pollsarchive_output_archive .= '&nbsp;';
863
+ }
864
+ $pollsarchive_output_archive .= "</span>\n";
865
+ // Output Pages
866
+ $pollsarchive_output_archive .= "</p>\n";
867
+ $pollsarchive_output_archive .= "<br style=\"clear: both;\" />\n";
868
+ $pollsarchive_output_archive .= "<p style=\"text-align: center;\">\n";
869
+ $pollsarchive_output_archive .= __('Pages', 'wp-polls')." ($total_pages): ";
870
+ if ($page >= 4) {
871
+ $pollsarchive_output_archive .= '<strong><a href="'.polls_archive_link(1).'" title="'.__('Go to First Page', 'wp-polls').'">&laquo; '.__('First', 'wp-polls').'</a></strong> ... ';
872
+ }
873
+ if($page > 1) {
874
+ $pollsarchive_output_archive .= ' <strong><a href="'.polls_archive_link($page-1).'" title="&laquo; '.__('Go to Page', 'wp-polls').' '.($page-1).'">&laquo;</a></strong> ';
875
+ }
876
+ for($i = $page - 2 ; $i <= $page +2; $i++) {
877
+ if ($i >= 1 && $i <= $total_pages) {
878
+ if($i == $page) {
879
+ $pollsarchive_output_archive .= "<strong>[$i]</strong> ";
880
+ } else {
881
+ $pollsarchive_output_archive .= '<a href="'.polls_archive_link($i).'" title="'.__('Page', 'wp-polls').' '.$i.'">'.$i.'</a> ';
882
+ }
883
+ }
884
+ }
885
+ if($page < $total_pages) {
886
+ $pollsarchive_output_archive .= ' <strong><a href="'.polls_archive_link($page+1).'" title="'.__('Go to Page', 'wp-polls').' '.($page+1).' &raquo;">&raquo;</a></strong> ';
887
+ }
888
+ if (($page+2) < $total_pages) {
889
+ $pollsarchive_output_archive .= ' ... <strong><a href="'.polls_archive_link($total_pages).'" title="'.__('Go to Last Page', 'wp-polls').'">'.__('Last', 'wp-polls').' &raquo;</a></strong>';
890
+ }
891
+ $pollsarchive_output_archive .= "</p>\n";
892
+ }
893
+
894
+ // Output Polls Archive Page
895
+ return $pollsarchive_output_current_title.$pollsarchive_output_current.$pollsarchive_output_archive_title.$pollsarchive_output_archive;
896
+ }
897
+
898
+
899
+ // Edit Timestamp Options
900
+ function poll_timestamp($poll_timestamp, $fieldname = 'pollq_timestamp', $display = 'block') {
901
+ global $month;
902
+ echo '<div id="'.$fieldname.'" style="display: '.$display.'">'."\n";
903
+ $day = gmdate('j', $poll_timestamp);
904
+ echo '<select name="'.$fieldname.'_day" size="1">'."\n";
905
+ for($i = 1; $i <=31; $i++) {
906
+ if($day == $i) {
907
+ echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
908
+ } else {
909
+ echo "<option value=\"$i\">$i</option>\n";
910
+ }
911
+ }
912
+ echo '</select>&nbsp;&nbsp;'."\n";
913
+ $month2 = gmdate('n', $poll_timestamp);
914
+ echo '<select name="'.$fieldname.'_month" size="1">'."\n";
915
+ for($i = 1; $i <= 12; $i++) {
916
+ if ($i < 10) {
917
+ $ii = '0'.$i;
918
+ } else {
919
+ $ii = $i;
920
+ }
921
+ if($month2 == $i) {
922
+ echo "<option value=\"$i\" selected=\"selected\">$month[$ii]</option>\n";
923
+ } else {
924
+ echo "<option value=\"$i\">$month[$ii]</option>\n";
925
+ }
926
+ }
927
+ echo '</select>&nbsp;&nbsp;'."\n";
928
+ $year = gmdate('Y', $poll_timestamp);
929
+ echo '<select name="'.$fieldname.'_year" size="1">'."\n";
930
+ for($i = 2000; $i <= $year; $i++) {
931
+ if($year == $i) {
932
+ echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
933
+ } else {
934
+ echo "<option value=\"$i\">$i</option>\n";
935
+ }
936
+ }
937
+ echo '</select>&nbsp;@'."\n";
938
+ $hour = gmdate('H', $poll_timestamp);
939
+ echo '<select name="'.$fieldname.'_hour" size="1">'."\n";
940
+ for($i = 0; $i < 24; $i++) {
941
+ if($hour == $i) {
942
+ echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
943
+ } else {
944
+ echo "<option value=\"$i\">$i</option>\n";
945
+ }
946
+ }
947
+ echo '</select>&nbsp;:'."\n";
948
+ $minute = gmdate('i', $poll_timestamp);
949
+ echo '<select name="'.$fieldname.'_minute" size="1">'."\n";
950
+ for($i = 0; $i < 60; $i++) {
951
+ if($minute == $i) {
952
+ echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
953
+ } else {
954
+ echo "<option value=\"$i\">$i</option>\n";
955
+ }
956
+ }
957
+
958
+ echo '</select>&nbsp;:'."\n";
959
+ $second = gmdate('s', $poll_timestamp);
960
+ echo '<select name="'.$fieldname.'_second" size="1">'."\n";
961
+ for($i = 0; $i <= 60; $i++) {
962
+ if($second == $i) {
963
+ echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
964
+ } else {
965
+ echo "<option value=\"$i\">$i</option>\n";
966
+ }
967
+ }
968
+ echo '</select>'."\n";
969
+ echo '</div>'."\n";
970
+ }
971
+
972
+
973
+ ### Funcion: Check All Polls Status To Check If It Expires
974
+ add_action('polls_cron', 'cron_polls_status');
975
+ function cron_polls_status() {
976
+ global $wpdb;
977
+ // Close Poll
978
+ $close_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_expiry < '".current_time('timestamp')."' AND pollq_expiry != '' AND pollq_active != 0");
979
+ // Open Future Polls
980
+ $active_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_timestamp <= '".current_time('timestamp')."' AND pollq_active = -1");
981
+ // Update Latest Poll If Future Poll Is Opened
982
+ if($active_polls) {
983
+ $update_latestpoll = update_option('poll_latestpoll', polls_latest_id());
984
+ }
985
+ return;
986
+ }
987
+
988
+
989
+ ### Funcion: Get Latest Poll ID
990
+ function polls_latest_id() {
991
+ global $wpdb;
992
+ $poll_id = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq WHERE pollq_active = 1 ORDER BY pollq_timestamp DESC LIMIT 1");
993
+ return intval($poll_id);
994
+ }
995
+
996
+
997
+ ### Function: Vote Poll
998
+ vote_poll();
999
+ function vote_poll() {
1000
+ global $wpdb, $user_identity, $user_ID;
1001
+ if(!empty($_POST['vote'])) {
1002
+ header('Content-Type: text/html; charset='.get_option('blog_charset'));
1003
+ $poll_id = intval($_POST['poll_id']);
1004
+ $poll_aid = intval($_POST["poll_$poll_id"]);
1005
+ if($poll_id > 0 && $poll_aid > 0 && check_allowtovote()) {
1006
+ $check_voted = check_voted($poll_id);
1007
+ if($check_voted == 0) {
1008
+ if(!empty($user_identity)) {
1009
+ $pollip_user = addslashes($user_identity);
1010
+ } elseif(!empty($_COOKIE['comment_author_'.COOKIEHASH])) {
1011
+ $pollip_user = addslashes($_COOKIE['comment_author_'.COOKIEHASH]);
1012
+ } else {
1013
+ $pollip_user = 'Guest';
1014
+ }
1015
+ $pollip_userid = intval($user_ID);
1016
+ $pollip_ip = get_ipaddress();
1017
+ $pollip_host = gethostbyaddr($pollip_ip);
1018
+ $pollip_timestamp = current_time('timestamp');
1019
+ // Only Create Cookie If User Choose Logging Method 1 Or 2
1020
+ $poll_logging_method = intval(get_option('poll_logging_method'));
1021
+ if($poll_logging_method == 1 || $poll_logging_method == 3) {
1022
+ $vote_cookie = setcookie("voted_".$poll_id, $poll_aid, time() + 30000000, COOKIEPATH);
1023
+ }
1024
+ $vote_a = $wpdb->query("UPDATE $wpdb->pollsa SET polla_votes = (polla_votes+1) WHERE polla_qid = $poll_id AND polla_aid = $poll_aid");
1025
+ if($vote_a) {
1026
+ $vote_q = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes+1) WHERE pollq_id = $poll_id");
1027
+ if($vote_q) {
1028
+ // Log Ratings When Success
1029
+ $vote_ip = $wpdb->query("INSERT INTO $wpdb->pollsip VALUES (0, $poll_id, $poll_aid, '$pollip_ip', '$pollip_host', '$pollip_timestamp', '$pollip_user', $pollip_userid)");
1030
+ echo "<ul class=\"wp-polls-ul\">\n".display_pollresult($poll_id,$poll_aid, 1);
1031
+ exit();
1032
+ } else {
1033
+ echo __('Unable To Update Poll Total Votes.', 'wp-polls')." ".__('Poll ID', 'wp-polls')." #".$poll_id.".";
1034
+ exit();
1035
+ } // End if($vote_q)
1036
+ } else {
1037
+ echo __('Unable To Update Poll Answer Votes.', 'wp-polls')." ".__('Poll ID', 'wp-polls')." #".$poll_id.", ".__('Poll Answer ID', 'wp-polls')." #".$poll_aid.".";
1038
+ exit();
1039
+ } // End if($vote_a)
1040
+ } else {
1041
+ echo __('You Had Already Voted For This Poll.', 'wp-polls')." ".__('Poll ID', 'wp-polls')." #".$poll_id.".";
1042
+ exit();
1043
+ }// End if($check_voted)
1044
+ } else {
1045
+ echo __('Invalid Poll ID Or Poll Answer ID.', 'wp-polls')." ".__('Poll ID', 'wp-polls')." #".$poll_id.", ".__('Poll Answer ID', 'wp-polls')." #".$poll_aid.".";
1046
+ exit();
1047
+ } // End if($poll_id > 0 && $poll_aid > 0)
1048
+ } elseif (intval($_GET['pollresult']) > 0) {
1049
+ $poll_id = intval($_GET['pollresult']);
1050
+ echo "<ul class=\"wp-polls-ul\">\n".display_pollresult($poll_id, 0, true);
1051
+ exit();
1052
+ } elseif (intval($_GET['pollbooth']) > 0) {
1053
+ $poll_id = intval($_GET['pollbooth']);
1054
+ echo "<ul class=\"wp-polls-ul\">\n".display_pollvote($poll_id, true);
1055
+ exit();
1056
+ } // End if(!empty($_POST['vote']))
1057
+ }
1058
+
1059
+
1060
+ ### Function: Create Poll Tables
1061
+ add_action('activate_polls/polls.php', 'create_poll_table');
1062
+ function create_poll_table() {
1063
+ global $wpdb;
1064
+ include_once(ABSPATH.'/wp-admin/upgrade-functions.php');
1065
+ // Create Poll Tables (3 Tables)
1066
+ $create_table = array();
1067
+ $create_table['pollsq'] = "CREATE TABLE $wpdb->pollsq (".
1068
+ "pollq_id int(10) NOT NULL auto_increment,".
1069
+ "pollq_question varchar(200) NOT NULL default '',".
1070
+ "pollq_timestamp varchar(20) NOT NULL default '',".
1071
+ "pollq_totalvotes int(10) NOT NULL default '0',".
1072
+ "pollq_active tinyint(1) NOT NULL default '1',".
1073
+ "pollq_expiry varchar(20) NOT NULL default '',".
1074
+ "PRIMARY KEY (pollq_id))";
1075
+ $create_table['pollsa'] = "CREATE TABLE $wpdb->pollsa (".
1076
+ "polla_aid int(10) NOT NULL auto_increment,".
1077
+ "polla_qid int(10) NOT NULL default '0',".
1078
+ "polla_answers varchar(200) NOT NULL default '',".
1079
+ "polla_votes int(10) NOT NULL default '0',".
1080
+ "PRIMARY KEY (polla_aid))";
1081
+ $create_table['pollsip'] = "CREATE TABLE $wpdb->pollsip (".
1082
+ "pollip_id int(10) NOT NULL auto_increment,".
1083
+ "pollip_qid varchar(10) NOT NULL default '',".
1084
+ "pollip_aid varchar(10) NOT NULL default '',".
1085
+ "pollip_ip varchar(100) NOT NULL default '',".
1086
+ "pollip_host VARCHAR(200) NOT NULL default '',".
1087
+ "pollip_timestamp varchar(20) NOT NULL default '0000-00-00 00:00:00',".
1088
+ "pollip_user tinytext NOT NULL,".
1089
+ "pollip_userid int(10) NOT NULL default '0',".
1090
+ "PRIMARY KEY (pollip_id))";
1091
+ maybe_create_table($wpdb->pollsq, $create_table['pollsq']);
1092
+ maybe_create_table($wpdb->pollsa, $create_table['pollsa']);
1093
+ maybe_create_table($wpdb->pollsip, $create_table['pollsip']);
1094
+ // Check Whether It is Install Or Upgrade
1095
+ $first_poll = $wpdb->get_var("SELECT pollq_id FROM $wpdb->pollsq LIMIT 1");
1096
+ // If Install, Insert 1st Poll Question With 5 Poll Answers
1097
+ if(empty($first_poll)) {
1098
+ // Insert Poll Question (1 Record)
1099
+ $insert_pollq = $wpdb->query("INSERT INTO $wpdb->pollsq VALUES (1, '".__('How Is My Site?', 'wp-polls')."', '".current_time('timestamp')."', 0, 1, '');");
1100
+ if($insert_pollq) {
1101
+ // Insert Poll Answers (5 Records)
1102
+ $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (1, 1, '".__('Good', 'wp-polls')."', 0);");
1103
+ $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (2, 1, '".__('Excellent', 'wp-polls')."', 0);");
1104
+ $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (3, 1, '".__('Bad', 'wp-polls')."', 0);");
1105
+ $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (4, 1, '".__('Can Be Improved', 'wp-polls')."', 0);");
1106
+ $wpdb->query("INSERT INTO $wpdb->pollsa VALUES (5, 1, '".__('No Comments', 'wp-polls')."', 0);");
1107
+ }
1108
+ }
1109
+ // Add In Options (16 Records)
1110
+ add_option('poll_template_voteheader', '<p style="text-align: center;"><strong>%POLL_QUESTION%</strong></p>'.
1111
+ '<div id="polls-%POLL_ID%-ans" class="wp-polls-ans">'.
1112
+ '<ul class="wp-polls-ul">', 'Template For Poll\'s Question');
1113
+ 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');
1114
+ add_option('poll_template_votefooter', '</ul>'.
1115
+ '<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>'.
1116
+ '<p style="text-align: center;"><a href="#ViewPollResults" onclick="poll_result(%POLL_ID%); return false;" onkeypress="poll_result(%POLL_ID%); return false;" title="'.__('View Results Of This Poll', 'wp-polls').'">'.__('View Results', 'wp-polls').'</a></p>'.
1117
+ '</div>', 'Template For Poll\'s Voting Footer');
1118
+ add_option('poll_template_resultheader', '<p style="text-align: center;"><strong>%POLL_QUESTION%</strong></p>'.
1119
+ '<div id="polls-%POLL_ID%-ans" class="wp-polls-ans">'.
1120
+ '<ul class="wp-polls-ul">', 'Template For Poll Header');
1121
+ add_option('poll_template_resultbody', '<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% '.__('Votes', 'wp-polls').')"></div></li>', 'Template For Poll Results');
1122
+ add_option('poll_template_resultbody2', '<li><strong><i>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%)</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)');
1123
+ add_option('poll_template_resultfooter', '</ul>'.
1124
+ '<p style="text-align: center;">'.__('Total Votes', 'wp-polls').': <strong>%POLL_TOTALVOTES%</strong></p>'.
1125
+ '</div>', 'Template For Poll Result Footer');
1126
+ add_option('poll_template_resultfooter2', '</ul>'.
1127
+ '<p style="text-align: center;">'.__('Total Votes', 'wp-polls').': <strong>%POLL_TOTALVOTES%</strong></p>'.
1128
+ '<p style="text-align: center;"><a href="#VotePoll" onclick="poll_booth(%POLL_ID%); return false;" onkeypress="poll_booth(%POLL_ID%); return false;" title="'.__('Vote For This Poll', 'wp-polls').'">'.__('Vote', 'wp-polls').'</a></p>'.
1129
+ '</div>', 'Template For Poll Result Footer');
1130
+ add_option('poll_template_disable', __('Sorry, there are no polls available at the moment.', 'wp-polls'), 'Template For Poll When It Is Disabled');
1131
+ add_option('poll_template_error', __('An error has occurred when processing your poll.', 'wp-polls'), 'Template For Poll When An Error Has Occured');
1132
+ add_option('poll_currentpoll', 0, 'Current Displayed Poll');
1133
+ add_option('poll_latestpoll', 1, 'The Latest Poll');
1134
+ add_option('poll_archive_perpage', 5, 'Number Of Polls To Display Per Page On The Poll\'s Archive', 'no');
1135
+ add_option('poll_ans_sortby', 'polla_aid', 'Sorting Of Poll\'s Answers');
1136
+ add_option('poll_ans_sortorder', 'asc', 'Sort Order Of Poll\'s Answers');
1137
+ add_option('poll_ans_result_sortby', 'polla_votes', 'Sorting Of Poll\'s Answers Result');
1138
+ add_option('poll_ans_result_sortorder', 'desc', 'Sorting Order Of Poll\'s Answers Result');
1139
+ // Database Upgrade For WP-Polls 2.1
1140
+ add_option('poll_logging_method', '3', 'Logging Method Of User Poll\'s Answer');
1141
+ add_option('poll_allowtovote', '2', 'Who Is Allowed To Vote');
1142
+ maybe_add_column($wpdb->pollsq, 'pollq_active', "ALTER TABLE $wpdb->pollsq ADD pollq_active TINYINT( 1 ) NOT NULL DEFAULT '1';");
1143
+ // Database Upgrade For WP-Polls 2.12
1144
+ maybe_add_column($wpdb->pollsip, 'pollip_userid', "ALTER TABLE $wpdb->pollsip ADD pollip_userid INT( 10 ) NOT NULL DEFAULT '0';");
1145
+ add_option('poll_archive_url', get_option('siteurl').'/pollsarchive/', 'Polls Archive URL');
1146
+ add_option('poll_archive_show', 1, 'Show Polls Archive?');
1147
+ // Database Upgrade For WP-Polls 2.13
1148
+ add_option('poll_bar', array('style' => 'default', 'background' => 'd8e1eb', 'border' => 'c8c8c8', 'height' => 8), 'Poll Bar Style');
1149
+ // Database Upgrade For WP-Polls 2.14
1150
+ maybe_add_column($wpdb->pollsq, 'pollq_expiry', "ALTER TABLE $wpdb->pollsq ADD pollq_expiry varchar(20) NOT NULL default '';");
1151
+ add_option('poll_close', 1, 'Poll Close');
1152
+ // Set 'manage_polls' Capabilities To Administrator
1153
+ $role = get_role('administrator');
1154
+ if(!$role->has_cap('manage_polls')) {
1155
+ $role->add_cap('manage_polls');
1156
+ }
1157
+ }
1158
+ ?>
polls/wp-polls.pot ADDED
@@ -0,0 +1,1227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP-Polls 2.14\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: 2007-01-27 15:03+0800\n"
6
+ "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n"
7
+ "Language-Team: Ravan <ravanhagen@gmail.com>\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-Country: SINGAPORE\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-SearchPath-0: .\n"
16
+
17
+ #: polls-js.php:33
18
+ msgid "Your last request is still being processed. Please wait a while ..."
19
+ msgstr ""
20
+
21
+ #: polls-js.php:34
22
+ msgid "Please choose a valid poll answer."
23
+ msgstr ""
24
+
25
+ #: polls-manager.php:39
26
+ #: polls-manager.php:296
27
+ #: polls-manager.php:341
28
+ msgid "Add Poll"
29
+ msgstr ""
30
+
31
+ #: polls-manager.php:72
32
+ #, php-format
33
+ msgid "Error In Adding Poll '%s'"
34
+ msgstr ""
35
+
36
+ #: polls-manager.php:81
37
+ #, php-format
38
+ msgid "Error In Adding Poll's Answer '%s'"
39
+ msgstr ""
40
+
41
+ #: polls-manager.php:88
42
+ #: polls-manager.php:156
43
+ #: polls-manager.php:168
44
+ #: polls-manager.php:179
45
+ #: polls-manager.php:202
46
+ msgid "Poll"
47
+ msgstr ""
48
+
49
+ #: polls-manager.php:88
50
+ #: polls-manager.php:216
51
+ msgid "Added Successfully"
52
+ msgstr ""
53
+
54
+ #: polls-manager.php:92
55
+ #: polls-manager.php:414
56
+ #: polls-manager.php:484
57
+ msgid "Edit Poll"
58
+ msgstr ""
59
+
60
+ #: polls-manager.php:135
61
+ msgid "No Changes Had Been Made To Poll's Title"
62
+ msgstr ""
63
+
64
+ #: polls-manager.php:149
65
+ msgid "No Changes Had Been Made To Poll's Answer"
66
+ msgstr ""
67
+
68
+ #: polls-manager.php:153
69
+ msgid "Invalid Poll"
70
+ msgstr ""
71
+
72
+ #: polls-manager.php:156
73
+ msgid "Edited Successfully"
74
+ msgstr ""
75
+
76
+ #: polls-manager.php:163
77
+ #: polls-manager.php:488
78
+ msgid "Open Poll"
79
+ msgstr ""
80
+
81
+ #: polls-manager.php:168
82
+ msgid "Is Now Opened"
83
+ msgstr ""
84
+
85
+ #: polls-manager.php:170
86
+ msgid "Error Opening Poll"
87
+ msgstr ""
88
+
89
+ #: polls-manager.php:174
90
+ #: polls-manager.php:486
91
+ msgid "Close Poll"
92
+ msgstr ""
93
+
94
+ #: polls-manager.php:179
95
+ msgid "Is Now Closed"
96
+ msgstr ""
97
+
98
+ #: polls-manager.php:181
99
+ msgid "Error Closing Poll"
100
+ msgstr ""
101
+
102
+ #: polls-manager.php:185
103
+ #: polls-manager.php:590
104
+ #: polls-manager.php:651
105
+ msgid "Delete Poll"
106
+ msgstr ""
107
+
108
+ #: polls-manager.php:193
109
+ #, php-format
110
+ msgid "Error In Deleting Poll '%s' Question"
111
+ msgstr ""
112
+
113
+ #: polls-manager.php:196
114
+ #, php-format
115
+ msgid "No Poll Answers For '%s'"
116
+ msgstr ""
117
+
118
+ #: polls-manager.php:199
119
+ #, php-format
120
+ msgid "No Voted IPs For '%s'"
121
+ msgstr ""
122
+
123
+ #: polls-manager.php:202
124
+ #: polls-manager.php:673
125
+ msgid "Deleted Successfully"
126
+ msgstr ""
127
+
128
+ #: polls-manager.php:209
129
+ #: polls-manager.php:497
130
+ #: polls-manager.php:502
131
+ #: polls-manager.php:506
132
+ msgid "Add Answer"
133
+ msgstr ""
134
+
135
+ #: polls-manager.php:214
136
+ #, php-format
137
+ msgid "Error In Adding Poll Answer '%s'"
138
+ msgstr ""
139
+
140
+ #: polls-manager.php:216
141
+ #: polls-manager.php:673
142
+ msgid "Poll Answer"
143
+ msgstr ""
144
+
145
+ #: polls-manager.php:220
146
+ #: polls-manager.php:847
147
+ msgid "Delete All Logs"
148
+ msgstr ""
149
+
150
+ #: polls-manager.php:224
151
+ msgid "All Polls Logs Have Been Deleted."
152
+ msgstr ""
153
+
154
+ #: polls-manager.php:226
155
+ msgid "An Error Has Occured While Deleting All Polls Logs."
156
+ msgstr ""
157
+
158
+ #: polls-manager.php:231
159
+ #: polls-manager.php:571
160
+ msgid "Delete Logs For This Poll Only"
161
+ msgstr ""
162
+
163
+ #: polls-manager.php:236
164
+ msgid "All Logs For This Poll Have Been Deleted."
165
+ msgstr ""
166
+
167
+ #: polls-manager.php:238
168
+ msgid "An Error Has Occured While Deleting All Logs For This Poll."
169
+ msgstr ""
170
+
171
+ #: polls-manager.php:243
172
+ #: polls-manager.php:865
173
+ msgid "UNINSTALL Polls"
174
+ msgstr ""
175
+
176
+ #: polls-manager.php:250
177
+ #, php-format
178
+ msgid "Table \"%s\" Has Been Dropped."
179
+ msgstr ""
180
+
181
+ #: polls-manager.php:263
182
+ #, php-format
183
+ msgid "Setting Key '%s' Has been Errased."
184
+ msgstr ""
185
+
186
+ #: polls-manager.php:266
187
+ #, php-format
188
+ msgid "Error Deleting Setting Key '%s'."
189
+ msgstr ""
190
+
191
+ #: polls-manager.php:305
192
+ #: polls-manager.php:349
193
+ #: polls-manager.php:419
194
+ #: polls-manager.php:596
195
+ #: polls-manager.php:719
196
+ #: polls-manager.php:801
197
+ msgid "Question"
198
+ msgstr ""
199
+
200
+ #: polls-manager.php:324
201
+ msgid "Start Date/Time:"
202
+ msgstr ""
203
+
204
+ #: polls-manager.php:332
205
+ msgid "End Date/Time:"
206
+ msgstr ""
207
+
208
+ #: polls-manager.php:334
209
+ #: polls-manager.php:472
210
+ msgid "Do NOT Expire This Poll"
211
+ msgstr ""
212
+
213
+ #: polls-manager.php:341
214
+ #: polls-manager.php:365
215
+ #: polls-manager.php:490
216
+ #: polls-manager.php:652
217
+ #: polls-options.php:632
218
+ msgid "Cancel"
219
+ msgstr ""
220
+
221
+ #: polls-manager.php:353
222
+ #: polls-manager.php:805
223
+ msgid "No. Of Answers:"
224
+ msgstr ""
225
+
226
+ #: polls-manager.php:365
227
+ #: polls-manager.php:817
228
+ msgid "Add Question"
229
+ msgstr ""
230
+
231
+ #: polls-manager.php:425
232
+ msgid "Answers:"
233
+ msgstr ""
234
+
235
+ #: polls-manager.php:426
236
+ #: polls-manager.php:603
237
+ msgid "No. Of Votes"
238
+ msgstr ""
239
+
240
+ #: polls-manager.php:433
241
+ msgid "Null Votes"
242
+ msgstr ""
243
+
244
+ #: polls-manager.php:440
245
+ #: polls-manager.php:532
246
+ #: polls-manager.php:612
247
+ msgid "Answer"
248
+ msgstr ""
249
+
250
+ #: polls-manager.php:441
251
+ msgid "You Are About To Delete This Poll Answer:"
252
+ msgstr ""
253
+
254
+ #: polls-manager.php:441
255
+ #: polls-manager.php:571
256
+ #: polls-manager.php:651
257
+ #: polls-manager.php:847
258
+ msgid "This Action Is Not Reversible. Are you sure?"
259
+ msgstr ""
260
+
261
+ #: polls-manager.php:441
262
+ #: polls-manager.php:783
263
+ msgid "Delete"
264
+ msgstr ""
265
+
266
+ #: polls-manager.php:449
267
+ #: polls-manager.php:619
268
+ #: polls-manager.php:720
269
+ #: polls-options.php:147
270
+ #: polls-options.php:150
271
+ #: polls.php:1124
272
+ #: polls.php:1127
273
+ msgid "Total Votes"
274
+ msgstr ""
275
+
276
+ #: polls-manager.php:452
277
+ #: polls-manager.php:636
278
+ #: polls-manager.php:721
279
+ msgid "Start Date/Time"
280
+ msgstr ""
281
+
282
+ #: polls-manager.php:455
283
+ msgid "Edit Start Date/Time"
284
+ msgstr ""
285
+
286
+ #: polls-manager.php:459
287
+ #: polls-manager.php:639
288
+ #: polls-manager.php:722
289
+ msgid "End Date/Time"
290
+ msgstr ""
291
+
292
+ #: polls-manager.php:462
293
+ #: polls-manager.php:642
294
+ msgid "This Poll Will Not Expire"
295
+ msgstr ""
296
+
297
+ #: polls-manager.php:486
298
+ msgid "You Are About To Close This Poll"
299
+ msgstr ""
300
+
301
+ #: polls-manager.php:488
302
+ msgid "You Are About To Open This Poll"
303
+ msgstr ""
304
+
305
+ #: polls-manager.php:516
306
+ msgid "Users Voted For This Poll"
307
+ msgstr ""
308
+
309
+ #: polls-manager.php:536
310
+ msgid "No."
311
+ msgstr ""
312
+
313
+ #: polls-manager.php:537
314
+ msgid "User"
315
+ msgstr ""
316
+
317
+ #: polls-manager.php:538
318
+ msgid "IP/Host"
319
+ msgstr ""
320
+
321
+ #: polls-manager.php:539
322
+ msgid "Date"
323
+ msgstr ""
324
+
325
+ #: polls-manager.php:558
326
+ msgid "No IP Has Been Logged Yet."
327
+ msgstr ""
328
+
329
+ #: polls-manager.php:565
330
+ msgid "Poll Logs"
331
+ msgstr ""
332
+
333
+ #: polls-manager.php:569
334
+ msgid "Are You Sure You Want To Delete Logs For This Poll Only?"
335
+ msgstr ""
336
+
337
+ #: polls-manager.php:570
338
+ #: polls-manager.php:846
339
+ #: polls-manager.php:864
340
+ #: polls-options.php:351
341
+ #: polls-widget.php:82
342
+ msgid "Yes"
343
+ msgstr ""
344
+
345
+ #: polls-manager.php:571
346
+ msgid "You Are About To Delete Logs For This Poll Only."
347
+ msgstr ""
348
+
349
+ #: polls-manager.php:574
350
+ msgid "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."
351
+ msgstr ""
352
+
353
+ #: polls-manager.php:602
354
+ msgid "Answers"
355
+ msgstr ""
356
+
357
+ #: polls-manager.php:623
358
+ #: polls-manager.php:723
359
+ msgid "Status"
360
+ msgstr ""
361
+
362
+ #: polls-manager.php:626
363
+ #: polls-manager.php:775
364
+ msgid "Open"
365
+ msgstr ""
366
+
367
+ #: polls-manager.php:628
368
+ #: polls-manager.php:777
369
+ msgid "Future"
370
+ msgstr ""
371
+
372
+ #: polls-manager.php:630
373
+ #: polls-manager.php:779
374
+ msgid "Closed"
375
+ msgstr ""
376
+
377
+ #: polls-manager.php:650
378
+ #: polls-manager.php:651
379
+ msgid "You Are About To Delete This Poll"
380
+ msgstr ""
381
+
382
+ #: polls-manager.php:670
383
+ msgid "Delete Poll's Answer"
384
+ msgstr ""
385
+
386
+ #: polls-manager.php:675
387
+ msgid "Error In Deleting Poll Answer"
388
+ msgstr ""
389
+
390
+ #: polls-manager.php:678
391
+ msgid "Poll Question's Total Votes Updated Successfully"
392
+ msgstr ""
393
+
394
+ #: polls-manager.php:680
395
+ msgid "No Changes Have Been Made To The Poll's Total Votes"
396
+ msgstr ""
397
+
398
+ #: polls-manager.php:683
399
+ msgid "Poll IP Logs Updated Successfully"
400
+ msgstr ""
401
+
402
+ #: polls-manager.php:685
403
+ msgid "No Changes Have Been Made To The Poll IP Logs"
404
+ msgstr ""
405
+
406
+ #: polls-manager.php:688
407
+ msgid "Click here To Go Back To The Poll Edit Page"
408
+ msgstr ""
409
+
410
+ #: polls-manager.php:695
411
+ #: polls-manager.php:854
412
+ msgid "Uninstall Polls"
413
+ msgstr ""
414
+
415
+ #: polls-manager.php:701
416
+ #, php-format
417
+ msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-Polls Will Be Deactivated Automatically."
418
+ msgstr ""
419
+
420
+ #: polls-manager.php:715
421
+ #: polls.php:54
422
+ msgid "Manage Polls"
423
+ msgstr ""
424
+
425
+ #: polls-manager.php:718
426
+ msgid "ID"
427
+ msgstr ""
428
+
429
+ #: polls-manager.php:724
430
+ msgid "Action"
431
+ msgstr ""
432
+
433
+ #: polls-manager.php:739
434
+ #: polls.php:291
435
+ #: polls.php:379
436
+ #: polls.php:759
437
+ msgid "No Expiry"
438
+ msgstr ""
439
+
440
+ #: polls-manager.php:762
441
+ #: polls-manager.php:766
442
+ msgid "Displayed:"
443
+ msgstr ""
444
+
445
+ #: polls-manager.php:782
446
+ msgid "Edit"
447
+ msgstr ""
448
+
449
+ #: polls-manager.php:790
450
+ msgid "No Polls Found"
451
+ msgstr ""
452
+
453
+ #: polls-manager.php:797
454
+ msgid "Add A Poll"
455
+ msgstr ""
456
+
457
+ #: polls-manager.php:824
458
+ #: polls-usage.php:103
459
+ msgid "Polls Stats"
460
+ msgstr ""
461
+
462
+ #: polls-manager.php:827
463
+ msgid "Total Polls:"
464
+ msgstr ""
465
+
466
+ #: polls-manager.php:831
467
+ msgid "Total Polls' Answers:"
468
+ msgstr ""
469
+
470
+ #: polls-manager.php:835
471
+ msgid "Total Votes Casted:"
472
+ msgstr ""
473
+
474
+ #: polls-manager.php:842
475
+ msgid "Polls Logs"
476
+ msgstr ""
477
+
478
+ #: polls-manager.php:845
479
+ msgid "Are You Sure You Want To Delete All Polls Logs?"
480
+ msgstr ""
481
+
482
+ #: polls-manager.php:847
483
+ msgid "You Are About To Delete All Poll Logs."
484
+ msgstr ""
485
+
486
+ #: polls-manager.php:850
487
+ msgid "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."
488
+ msgstr ""
489
+
490
+ #: polls-manager.php:858
491
+ msgid "Deactivating WP-Polls plugin does not remove any data that may have been created, such as the poll data and the poll's voting logs. To completely remove this plugin, you can uninstall it here."
492
+ msgstr ""
493
+
494
+ #: polls-manager.php:862
495
+ #, php-format
496
+ msgid "<strong>WARNING:</strong><br />Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first. Your data is stored in the %1$s, %2$s, %3$s and %4$s tables."
497
+ msgstr ""
498
+
499
+ #: polls-manager.php:865
500
+ msgid ""
501
+ "You Are About To Uninstall WP-Polls From WordPress.\\n"
502
+ "This Action Is Not Reversible.\\n"
503
+ "\\n"
504
+ " Choose [Cancel] To Stop, [OK] To Uninstall."
505
+ msgstr ""
506
+
507
+ #: polls-options.php:84
508
+ #: polls-options.php:196
509
+ #: polls-options.php:199
510
+ msgid "Poll Bar Style"
511
+ msgstr ""
512
+
513
+ #: polls-options.php:85
514
+ msgid "Sort Poll Answers By Option"
515
+ msgstr ""
516
+
517
+ #: polls-options.php:86
518
+ msgid "Sort Order Of Poll Answers Option"
519
+ msgstr ""
520
+
521
+ #: polls-options.php:87
522
+ msgid "Sort Poll Results By Option"
523
+ msgstr ""
524
+
525
+ #: polls-options.php:88
526
+ msgid "Sort Order Of Poll Results Option"
527
+ msgstr ""
528
+
529
+ #: polls-options.php:89
530
+ msgid "Voting Form Header Template"
531
+ msgstr ""
532
+
533
+ #: polls-options.php:90
534
+ msgid "Voting Form Body Template"
535
+ msgstr ""
536
+
537
+ #: polls-options.php:91
538
+ msgid "Voting Form Footer Template"
539
+ msgstr ""
540
+
541
+ #: polls-options.php:92
542
+ msgid "Result Header Template"
543
+ msgstr ""
544
+
545
+ #: polls-options.php:93
546
+ msgid "Result Body Template"
547
+ msgstr ""
548
+
549
+ #: polls-options.php:94
550
+ msgid "Result Body2 Template"
551
+ msgstr ""
552
+
553
+ #: polls-options.php:95
554
+ msgid "Result Footer Template"
555
+ msgstr ""
556
+
557
+ #: polls-options.php:96
558
+ msgid "Result Footer2 Template"
559
+ msgstr ""
560
+
561
+ #: polls-options.php:97
562
+ msgid "Poll Disabled Template"
563
+ msgstr ""
564
+
565
+ #: polls-options.php:98
566
+ msgid "Poll Error Template"
567
+ msgstr ""
568
+
569
+ #: polls-options.php:99
570
+ msgid "Archive Polls Per Page Option"
571
+ msgstr ""
572
+
573
+ #: polls-options.php:100
574
+ msgid "Polls Archive URL Option"
575
+ msgstr ""
576
+
577
+ #: polls-options.php:101
578
+ msgid "Show Polls Achive Link Option"
579
+ msgstr ""
580
+
581
+ #: polls-options.php:102
582
+ msgid "Current Active Poll Option"
583
+ msgstr ""
584
+
585
+ #: polls-options.php:103
586
+ msgid "Poll Close Option"
587
+ msgstr ""
588
+
589
+ #: polls-options.php:104
590
+ #: polls-options.php:319
591
+ msgid "Logging Method"
592
+ msgstr ""
593
+
594
+ #: polls-options.php:105
595
+ msgid "Allow To Vote Option"
596
+ msgstr ""
597
+
598
+ #: polls-options.php:110
599
+ msgid "Updated"
600
+ msgstr ""
601
+
602
+ #: polls-options.php:115
603
+ msgid "No Poll Option Updated"
604
+ msgstr ""
605
+
606
+ #: polls-options.php:135
607
+ #: polls-options.php:150
608
+ #: polls.php:1115
609
+ #: polls.php:1128
610
+ msgid "Vote"
611
+ msgstr ""
612
+
613
+ #: polls-options.php:135
614
+ #: polls.php:1116
615
+ msgid "View Results Of This Poll"
616
+ msgstr ""
617
+
618
+ #: polls-options.php:135
619
+ #: polls.php:1116
620
+ msgid "View Results"
621
+ msgstr ""
622
+
623
+ #: polls-options.php:141
624
+ #: polls-options.php:144
625
+ #: polls-options.php:286
626
+ #: polls.php:1121
627
+ #: polls.php:1122
628
+ msgid "Votes"
629
+ msgstr ""
630
+
631
+ #: polls-options.php:144
632
+ #: polls.php:1122
633
+ msgid "You Have Voted For This Choice"
634
+ msgstr ""
635
+
636
+ #: polls-options.php:150
637
+ #: polls.php:1128
638
+ msgid "Vote For This Poll"
639
+ msgstr ""
640
+
641
+ #: polls-options.php:153
642
+ #: polls.php:1130
643
+ msgid "Sorry, there are no polls available at the moment."
644
+ msgstr ""
645
+
646
+ #: polls-options.php:156
647
+ #: polls.php:1131
648
+ msgid "An error has occurred when processing your poll."
649
+ msgstr ""
650
+
651
+ #: polls-options.php:193
652
+ #: polls.php:55
653
+ msgid "Poll Options"
654
+ msgstr ""
655
+
656
+ #: polls-options.php:225
657
+ msgid "Use CSS Style"
658
+ msgstr ""
659
+
660
+ #: polls-options.php:229
661
+ msgid "Poll Bar Background"
662
+ msgstr ""
663
+
664
+ #: polls-options.php:234
665
+ msgid "Poll Bar Border"
666
+ msgstr ""
667
+
668
+ #: polls-options.php:239
669
+ msgid "Poll Bar Height"
670
+ msgstr ""
671
+
672
+ #: polls-options.php:243
673
+ msgid "Your poll bar will look like this"
674
+ msgstr ""
675
+
676
+ #: polls-options.php:257
677
+ msgid "Sorting Of Poll Answers"
678
+ msgstr ""
679
+
680
+ #: polls-options.php:260
681
+ msgid "Sort Poll Answers By:"
682
+ msgstr ""
683
+
684
+ #: polls-options.php:263
685
+ #: polls-options.php:287
686
+ msgid "Exact Order"
687
+ msgstr ""
688
+
689
+ #: polls-options.php:264
690
+ #: polls-options.php:288
691
+ msgid "Alphabetical Order"
692
+ msgstr ""
693
+
694
+ #: polls-options.php:269
695
+ msgid "Sort Order Of Poll Answers:"
696
+ msgstr ""
697
+
698
+ #: polls-options.php:272
699
+ #: polls-options.php:296
700
+ msgid "Ascending"
701
+ msgstr ""
702
+
703
+ #: polls-options.php:273
704
+ #: polls-options.php:297
705
+ msgid "Descending"
706
+ msgstr ""
707
+
708
+ #: polls-options.php:280
709
+ msgid "Sorting Of Poll Results"
710
+ msgstr ""
711
+
712
+ #: polls-options.php:283
713
+ msgid "Sort Poll Results By:"
714
+ msgstr ""
715
+
716
+ #: polls-options.php:293
717
+ msgid "Sort Order Of Poll Results:"
718
+ msgstr ""
719
+
720
+ #: polls-options.php:304
721
+ msgid "Allow To Vote"
722
+ msgstr ""
723
+
724
+ #: polls-options.php:307
725
+ msgid "Who Is Allowed To Vote?"
726
+ msgstr ""
727
+
728
+ #: polls-options.php:310
729
+ msgid "Guests Only"
730
+ msgstr ""
731
+
732
+ #: polls-options.php:311
733
+ msgid "Registered Users Only"
734
+ msgstr ""
735
+
736
+ #: polls-options.php:312
737
+ msgid "Registered Users And Guests"
738
+ msgstr ""
739
+
740
+ #: polls-options.php:322
741
+ msgid "Poll Logging Method:"
742
+ msgstr ""
743
+
744
+ #: polls-options.php:325
745
+ msgid "Do Not Log"
746
+ msgstr ""
747
+
748
+ #: polls-options.php:326
749
+ msgid "Logged By Cookie"
750
+ msgstr ""
751
+
752
+ #: polls-options.php:327
753
+ msgid "Logged By IP"
754
+ msgstr ""
755
+
756
+ #: polls-options.php:328
757
+ msgid "Logged By Cookie And IP"
758
+ msgstr ""
759
+
760
+ #: polls-options.php:329
761
+ msgid "Logged By Username"
762
+ msgstr ""
763
+
764
+ #: polls-options.php:336
765
+ msgid "Poll Archive"
766
+ msgstr ""
767
+
768
+ #: polls-options.php:339
769
+ msgid "Polls Per Page:"
770
+ msgstr ""
771
+
772
+ #: polls-options.php:343
773
+ msgid "Polls Archive URL:"
774
+ msgstr ""
775
+
776
+ #: polls-options.php:347
777
+ #: polls-widget.php:71
778
+ msgid "Display Polls Archive Link Below Poll?"
779
+ msgstr ""
780
+
781
+ #: polls-options.php:350
782
+ #: polls-widget.php:77
783
+ msgid "No"
784
+ msgstr ""
785
+
786
+ #: polls-options.php:358
787
+ #: polls-options.php:361
788
+ #: polls-widget.php:86
789
+ msgid "Current Active Poll"
790
+ msgstr ""
791
+
792
+ #: polls-options.php:364
793
+ #: polls-widget.php:92
794
+ msgid "Do NOT Display Poll (Disable)"
795
+ msgstr ""
796
+
797
+ #: polls-options.php:365
798
+ #: polls-widget.php:97
799
+ msgid "Display Random Poll"
800
+ msgstr ""
801
+
802
+ #: polls-options.php:366
803
+ #: polls-widget.php:102
804
+ msgid "Display Latest Poll"
805
+ msgstr ""
806
+
807
+ #: polls-options.php:386
808
+ msgid "When Poll Is Closed"
809
+ msgstr ""
810
+
811
+ #: polls-options.php:389
812
+ msgid "Display Poll's Results"
813
+ msgstr ""
814
+
815
+ #: polls-options.php:390
816
+ msgid "Do Not Display Poll In Post/Sidebar"
817
+ msgstr ""
818
+
819
+ #: polls-options.php:397
820
+ msgid "Template Variables"
821
+ msgstr ""
822
+
823
+ #: polls-options.php:402
824
+ msgid "Display the poll's ID"
825
+ msgstr ""
826
+
827
+ #: polls-options.php:406
828
+ msgid "Display the poll's answer ID"
829
+ msgstr ""
830
+
831
+ #: polls-options.php:412
832
+ msgid "Display the poll's question"
833
+ msgstr ""
834
+
835
+ #: polls-options.php:416
836
+ msgid "Display the poll's answer"
837
+ msgstr ""
838
+
839
+ #: polls-options.php:422
840
+ msgid "Display the poll's total votes"
841
+ msgstr ""
842
+
843
+ #: polls-options.php:426
844
+ msgid "Display the poll's answer without HTML formatting."
845
+ msgstr ""
846
+
847
+ #: polls-options.php:432
848
+ msgid "Displays URL to poll's result"
849
+ msgstr ""
850
+
851
+ #: polls-options.php:436
852
+ msgid "Display the poll's answer votes"
853
+ msgstr ""
854
+
855
+ #: polls-options.php:442
856
+ msgid "Display the poll's most voted answer"
857
+ msgstr ""
858
+
859
+ #: polls-options.php:446
860
+ msgid "Display the poll's answer percentage"
861
+ msgstr ""
862
+
863
+ #: polls-options.php:452
864
+ msgid "Display the poll's answer votes for the most voted answer"
865
+ msgstr ""
866
+
867
+ #: polls-options.php:456
868
+ msgid "Display the poll's answer image width"
869
+ msgstr ""
870
+
871
+ #: polls-options.php:462
872
+ msgid "Display the poll's answer percentage for the most voted answer"
873
+ msgstr ""
874
+
875
+ #: polls-options.php:466
876
+ msgid "Display the poll's least voted answer"
877
+ msgstr ""
878
+
879
+ #: polls-options.php:471
880
+ msgid "Display the poll's start date/time"
881
+ msgstr ""
882
+
883
+ #: polls-options.php:473
884
+ msgid "Display the poll's answer votes for the least voted answer"
885
+ msgstr ""
886
+
887
+ #: polls-options.php:478
888
+ msgid "Display the poll's end date/time"
889
+ msgstr ""
890
+
891
+ #: polls-options.php:481
892
+ msgid "Display the poll's answer percentage for the least voted answer"
893
+ msgstr ""
894
+
895
+ #: polls-options.php:487
896
+ msgid "Poll Voting Form Templates"
897
+ msgstr ""
898
+
899
+ #: polls-options.php:491
900
+ msgid "Voting Form Header:"
901
+ msgstr ""
902
+
903
+ #: polls-options.php:492
904
+ #: polls-options.php:505
905
+ #: polls-options.php:517
906
+ #: polls-options.php:532
907
+ #: polls-options.php:545
908
+ #: polls-options.php:559
909
+ #: polls-options.php:573
910
+ #: polls-options.php:591
911
+ #: polls-options.php:614
912
+ #: polls-options.php:623
913
+ msgid "Allowed Variables:"
914
+ msgstr ""
915
+
916
+ #: polls-options.php:498
917
+ #: polls-options.php:510
918
+ #: polls-options.php:520
919
+ #: polls-options.php:538
920
+ #: polls-options.php:552
921
+ #: polls-options.php:566
922
+ #: polls-options.php:584
923
+ #: polls-options.php:602
924
+ #: polls-options.php:616
925
+ #: polls-options.php:625
926
+ msgid "Restore Default Template"
927
+ msgstr ""
928
+
929
+ #: polls-options.php:504
930
+ msgid "Voting Form Body:"
931
+ msgstr ""
932
+
933
+ #: polls-options.php:516
934
+ msgid "Voting Form Footer:"
935
+ msgstr ""
936
+
937
+ #: polls-options.php:527
938
+ msgid "Poll Result Templates"
939
+ msgstr ""
940
+
941
+ #: polls-options.php:531
942
+ msgid "Result Header:"
943
+ msgstr ""
944
+
945
+ #: polls-options.php:544
946
+ #: polls-options.php:558
947
+ msgid "Result Body:"
948
+ msgstr ""
949
+
950
+ #: polls-options.php:544
951
+ #: polls-options.php:572
952
+ msgid "Normal"
953
+ msgstr ""
954
+
955
+ #: polls-options.php:558
956
+ msgid "Displaying Of User's Voted Answer"
957
+ msgstr ""
958
+
959
+ #: polls-options.php:572
960
+ #: polls-options.php:590
961
+ msgid "Result Footer:"
962
+ msgstr ""
963
+
964
+ #: polls-options.php:590
965
+ msgid "Displaying Of Vote Poll Link If User Has Not Voted"
966
+ msgstr ""
967
+
968
+ #: polls-options.php:609
969
+ msgid "Poll Misc Templates"
970
+ msgstr ""
971
+
972
+ #: polls-options.php:613
973
+ msgid "Poll Disabled"
974
+ msgstr ""
975
+
976
+ #: polls-options.php:615
977
+ #: polls-options.php:624
978
+ msgid "N/A"
979
+ msgstr ""
980
+
981
+ #: polls-options.php:622
982
+ msgid "Poll Error"
983
+ msgstr ""
984
+
985
+ #: polls-options.php:632
986
+ msgid "Update Options"
987
+ msgstr ""
988
+
989
+ #: polls-usage.php:26
990
+ msgid "General Usage (Without Widget)"
991
+ msgstr ""
992
+
993
+ #: polls-usage.php:29
994
+ msgid "Open "
995
+ msgstr ""
996
+
997
+ #: polls-usage.php:29
998
+ msgid "YOUR THEME NAME"
999
+ msgstr ""
1000
+
1001
+ #: polls-usage.php:32
1002
+ msgid "Add:"
1003
+ msgstr ""
1004
+
1005
+ #: polls-usage.php:44
1006
+ msgid "To show specific poll, use :"
1007
+ msgstr ""
1008
+
1009
+ #: polls-usage.php:46
1010
+ #: polls-usage.php:49
1011
+ msgid "where <b>2</b> is your poll id."
1012
+ msgstr ""
1013
+
1014
+ #: polls-usage.php:47
1015
+ msgid "To embed a specific poll in your post, use :"
1016
+ msgstr ""
1017
+
1018
+ #: polls-usage.php:52
1019
+ msgid "Scroll down for instructions on how to create <b>Polls Archive</b>."
1020
+ msgstr ""
1021
+
1022
+ #: polls-usage.php:57
1023
+ msgid "General Usage (With Widget)"
1024
+ msgstr ""
1025
+
1026
+ #: polls-usage.php:60
1027
+ msgid "<b>Activate</b> WP-Polls Widget Plugin"
1028
+ msgstr ""
1029
+
1030
+ #: polls-usage.php:63
1031
+ msgid "Go to 'WP-Admin -> Presentation -> Sidebar Widgets'"
1032
+ msgstr ""
1033
+
1034
+ #: polls-usage.php:66
1035
+ msgid "<b>Drag</b> the Polls Widget to your sidebar"
1036
+ msgstr ""
1037
+
1038
+ #: polls-usage.php:69
1039
+ msgid "You can <b>configure</b> the Polls Widget by clicking on the configure icon"
1040
+ msgstr ""
1041
+
1042
+ #: polls-usage.php:72
1043
+ msgid "Click 'Save changes'"
1044
+ msgstr ""
1045
+
1046
+ #: polls-usage.php:75
1047
+ msgid " down for instructions on how to create a <b>Polls Archive</b>."
1048
+ msgstr ""
1049
+
1050
+ #: polls-usage.php:80
1051
+ #: polls.php:616
1052
+ #: polls.php:618
1053
+ #: polls.php:742
1054
+ msgid "Polls Archive"
1055
+ msgstr ""
1056
+
1057
+ #: polls-usage.php:83
1058
+ msgid "Go to 'WP-Admin -> Write -> Write Page'"
1059
+ msgstr ""
1060
+
1061
+ #: polls-usage.php:86
1062
+ msgid "Type any title you like in the post's title area"
1063
+ msgstr ""
1064
+
1065
+ #: polls-usage.php:89
1066
+ msgid "Type '<b>[page_polls]</b>' in the post's content area (without the quotes)"
1067
+ msgstr ""
1068
+
1069
+ #: polls-usage.php:92
1070
+ msgid "Type '<b>pollsarchive</b>' in the post's slug area (without the quotes)"
1071
+ msgstr ""
1072
+
1073
+ #: polls-usage.php:95
1074
+ msgid "Click 'Publish'"
1075
+ msgstr ""
1076
+
1077
+ #: polls-usage.php:98
1078
+ msgid "If you <b>ARE NOT</b> using nice permalinks, you need to go to 'WP-Admin -> Polls -> Poll Option' and under '<b>Poll Archive -> Polls Archive URL</b>', you need to fill in the URL to the Polls Archive Page you created above."
1079
+ msgstr ""
1080
+
1081
+ #: polls-usage.php:104
1082
+ msgid "To Display Total Polls"
1083
+ msgstr ""
1084
+
1085
+ #: polls-usage.php:110
1086
+ msgid "To Display Total Poll Answers"
1087
+ msgstr ""
1088
+
1089
+ #: polls-usage.php:116
1090
+ msgid "To Display Total Poll Votes"
1091
+ msgstr ""
1092
+
1093
+ #: polls-usage.php:124
1094
+ msgid "Note"
1095
+ msgstr ""
1096
+
1097
+ #: polls-usage.php:127
1098
+ msgid "In IE, some of the poll's text may appear jagged (this is normal in IE). To solve this issue,"
1099
+ msgstr ""
1100
+
1101
+ #: polls-usage.php:130
1102
+ msgid "Open <b>poll-css.css</b>"
1103
+ msgstr ""
1104
+
1105
+ #: polls-usage.php:133
1106
+ msgid "Find:"
1107
+ msgstr ""
1108
+
1109
+ #: polls-usage.php:137
1110
+ msgid "Replace:"
1111
+ msgstr ""
1112
+
1113
+ #: polls-usage.php:139
1114
+ msgid "Where <b>#ffffff</b> should be your background color for the poll."
1115
+ msgstr ""
1116
+
1117
+ #: polls-widget.php:57
1118
+ #: polls.php:51
1119
+ msgid "Polls"
1120
+ msgstr ""
1121
+
1122
+ #: polls-widget.php:68
1123
+ msgid "Title"
1124
+ msgstr ""
1125
+
1126
+ #: polls.php:56
1127
+ msgid "Poll Usage"
1128
+ msgstr ""
1129
+
1130
+ #: polls.php:347
1131
+ #: polls.php:486
1132
+ msgid "Loading"
1133
+ msgstr ""
1134
+
1135
+ #: polls.php:720
1136
+ msgid "Current Poll"
1137
+ msgstr ""
1138
+
1139
+ #: polls.php:852
1140
+ msgid "Previous Page"
1141
+ msgstr ""
1142
+
1143
+ #: polls.php:860
1144
+ msgid "Next Page"
1145
+ msgstr ""
1146
+
1147
+ #: polls.php:869
1148
+ msgid "Pages"
1149
+ msgstr ""
1150
+
1151
+ #: polls.php:871
1152
+ msgid "Go to First Page"
1153
+ msgstr ""
1154
+
1155
+ #: polls.php:871
1156
+ msgid "First"
1157
+ msgstr ""
1158
+
1159
+ #: polls.php:874
1160
+ #: polls.php:886
1161
+ msgid "Go to Page"
1162
+ msgstr ""
1163
+
1164
+ #: polls.php:881
1165
+ msgid "Page"
1166
+ msgstr ""
1167
+
1168
+ #: polls.php:889
1169
+ msgid "Go to Last Page"
1170
+ msgstr ""
1171
+
1172
+ #: polls.php:889
1173
+ msgid "Last"
1174
+ msgstr ""
1175
+
1176
+ #: polls.php:1033
1177
+ msgid "Unable To Update Poll Total Votes."
1178
+ msgstr ""
1179
+
1180
+ #: polls.php:1033
1181
+ #: polls.php:1037
1182
+ #: polls.php:1041
1183
+ #: polls.php:1045
1184
+ msgid "Poll ID"
1185
+ msgstr ""
1186
+
1187
+ #: polls.php:1037
1188
+ msgid "Unable To Update Poll Answer Votes."
1189
+ msgstr ""
1190
+
1191
+ #: polls.php:1037
1192
+ #: polls.php:1045
1193
+ msgid "Poll Answer ID"
1194
+ msgstr ""
1195
+
1196
+ #: polls.php:1041
1197
+ msgid "You Had Already Voted For This Poll."
1198
+ msgstr ""
1199
+
1200
+ #: polls.php:1045
1201
+ msgid "Invalid Poll ID Or Poll Answer ID."
1202
+ msgstr ""
1203
+
1204
+ #: polls.php:1099
1205
+ msgid "How Is My Site?"
1206
+ msgstr ""
1207
+
1208
+ #: polls.php:1102
1209
+ msgid "Good"
1210
+ msgstr ""
1211
+
1212
+ #: polls.php:1103
1213
+ msgid "Excellent"
1214
+ msgstr ""
1215
+
1216
+ #: polls.php:1104
1217
+ msgid "Bad"
1218
+ msgstr ""
1219
+
1220
+ #: polls.php:1105
1221
+ msgid "Can Be Improved"
1222
+ msgstr ""
1223
+
1224
+ #: polls.php:1106
1225
+ msgid "No Comments"
1226
+ msgstr ""
1227
+
readme-install.txt DELETED
@@ -1,101 +0,0 @@
1
- -> Installation Instructions
2
- ------------------------------------------------------------------
3
- // Open wp-settings.php
4
-
5
- Find:
6
- ------------------------------------------------------------------
7
- $wpdb->postmeta = $table_prefix . 'postmeta';
8
- ------------------------------------------------------------------
9
- Add Below It:
10
- ------------------------------------------------------------------
11
- $wpdb->pollsq = $table_prefix . 'pollsq';
12
- $wpdb->pollsa = $table_prefix . 'pollsa';
13
- $wpdb->pollsip = $table_prefix . 'pollsip';
14
- ------------------------------------------------------------------
15
-
16
-
17
- // Open wp-admin/menu.php
18
-
19
- Find:
20
- ------------------------------------------------------------------
21
- $menu[20] = array(__('Links'), 5, 'link-manager.php');
22
- ------------------------------------------------------------------
23
- Add Below It:
24
- ------------------------------------------------------------------
25
- $menu[21] = array(__('Polls'), 5, 'polls-manager.php');
26
- ------------------------------------------------------------------
27
-
28
- // Open wp-admin folder
29
-
30
- Put:
31
- ------------------------------------------------------------------
32
- polls-install.php
33
- polls-manager.php
34
- polls-options.php
35
- ------------------------------------------------------------------
36
-
37
-
38
- // Open wp-content/plugins folder
39
-
40
- Put:
41
- ------------------------------------------------------------------
42
- polls.php
43
- ------------------------------------------------------------------
44
-
45
- // Open Wordpress root folder
46
-
47
- Put:
48
- ------------------------------------------------------------------
49
- wp-polls.php
50
- ------------------------------------------------------------------
51
-
52
-
53
- // Open wp-images folder
54
-
55
- Put:
56
- ------------------------------------------------------------------
57
- pollbar.gif
58
- ------------------------------------------------------------------
59
-
60
-
61
- // Activate the polls plugin
62
-
63
-
64
- // Run wp-admin/polls-install.php
65
-
66
- Note:
67
- ------------------------------------------------------------------
68
- Please remember to remove polls-install.php after installation.
69
- ------------------------------------------------------------------
70
-
71
-
72
- // Open wp-content/themes/<YOUR THEME NAME>/header.php
73
-
74
- Add on the first line:
75
- ------------------------------------------------------------------
76
- <?php vote_poll(); ?>
77
- ------------------------------------------------------------------
78
-
79
- Note:
80
- ------------------------------------------------------------------
81
- If you are having problem with the above, try putting it in the
82
- wp-content/themes/<YOUR THEME NAME>/index.php instead.
83
- ------------------------------------------------------------------
84
-
85
-
86
- // Open wp-content/themes/<YOUR THEME NAME>/sidebar.php
87
-
88
- Add:
89
- ------------------------------------------------------------------
90
- <li>
91
- <h2>Polls</h2>
92
- <ul><?php get_poll();?></ul>
93
- <p><a href="wp-polls.php">Polls Archive</a></p>
94
- </li>
95
- ------------------------------------------------------------------
96
-
97
- Note:
98
- ------------------------------------------------------------------
99
- To show specific poll, use <?php get_poll(<ID>);?> where <ID> is your
100
- poll id.
101
- ------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme-upgrade.txt DELETED
@@ -1,71 +0,0 @@
1
- -> Upgrade Instructions FOr Version 2.0x To Version 2.02
2
- ------------------------------------------------------------------
3
- // Open wp-admin folder
4
-
5
- Put:
6
- ------------------------------------------------------------------
7
- polls-upgrade-202.php
8
- ------------------------------------------------------------------
9
-
10
- // Run wp-admin/polls-upgrade-202.php
11
-
12
- Note:
13
- ------------------------------------------------------------------
14
- Please remember to remove polls-upgrade-202.php after installation.
15
- ------------------------------------------------------------------
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
- -> Upgrade Instructions For Version 1.0x To Version 2.02
27
- ------------------------------------------------------------------
28
- // Open wp-settings.php
29
-
30
- Find:
31
- ------------------------------------------------------------------
32
- $wpdb->pollsq = $table_prefix . 'pollsq';
33
- ------------------------------------------------------------------
34
- Add Below It:
35
- ------------------------------------------------------------------
36
- $wpdb->pollsip = $table_prefix . 'pollsip';
37
- ------------------------------------------------------------------
38
-
39
-
40
- // Open wp-admin folder
41
-
42
- Put/Overwrite:
43
- ------------------------------------------------------------------
44
- polls-upgrade.php
45
- polls-manager.php
46
- polls-options.php
47
- ------------------------------------------------------------------
48
-
49
-
50
- // Open wp-content/plugins folder
51
-
52
- Put/Overwrite:
53
- ------------------------------------------------------------------
54
- polls.php
55
- ------------------------------------------------------------------
56
-
57
-
58
- // Open Wordpress root folder
59
-
60
- Put/Overwrite:
61
- ------------------------------------------------------------------
62
- wp-polls.php
63
- ------------------------------------------------------------------
64
-
65
-
66
- // Run wp-admin/polls-upgrade.php
67
-
68
- Note:
69
- ------------------------------------------------------------------
70
- Please remember to remove polls-upgrade.php after installation.
71
- ------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.html ADDED
@@ -0,0 +1,643 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
+ <title>WP-Polls 2.14 Readme</title>
6
+ <style type="text/css" media="screen">
7
+ /* Default Style */
8
+ BODY {
9
+ font-family: Verdana, Arial;
10
+ font-size: 12px;
11
+ color: #000000;
12
+ background: #FFFFFF;
13
+ }
14
+ P {
15
+ padding-left: 10px;
16
+ }
17
+ BLOCKQUOTE {
18
+ margin: 10px 20px 0px 20px;
19
+ padding: 10px;
20
+ border: 1px solid #8d8d8d;
21
+ background-color: #f5f5f5;
22
+ overflow: auto;
23
+ }
24
+ LI {
25
+ margin-top: 20px;
26
+ }
27
+ UL LI UL LI {
28
+ margin-top: 10px;
29
+ }
30
+ A, A:active, A:link, A:visited {
31
+ color: #2d3a4c;
32
+ text-decoration: none;
33
+ }
34
+ A:hover {
35
+ color: #5577a5;
36
+ text-decoration: underline;
37
+ }
38
+ /* Place Holder Style */
39
+ #Container {
40
+ width: 780px;
41
+ margin-left: auto;
42
+ margin-right: auto;
43
+ }
44
+ #Content {
45
+ background-color: #fafafa;
46
+ border: 1px solid #a2b6cb;
47
+ padding: 10px;
48
+ margin-top: -13px;
49
+ }
50
+ /* Title Style */
51
+ #Title {
52
+ font-family: Verdana, Arial;
53
+ font-size: 22px;
54
+ font-weight: bold;
55
+ color: #389aff;
56
+ border-bottom: 1px solid #389aff;
57
+ margin-bottom: 10px;
58
+ }
59
+ .SubTitle {
60
+ font-family: Verdana, Arial;
61
+ font-size: 18px;
62
+ font-weight: bold;
63
+ color: #5b87b4;
64
+ }
65
+ .SubSubTitle {
66
+ font-family: Verdana, Arial;
67
+ font-size: 14px;
68
+ font-weight: bold;
69
+ color: #73a4d6;
70
+ }
71
+ /* Tabs */
72
+ UL#Tabs {
73
+ font-family: Verdana, Arial;
74
+ font-size: 12px;
75
+ font-weight: bold;
76
+ list-style-type: none;
77
+ padding-bottom: 28px;
78
+ border-bottom: 1px solid #a2b6cb;
79
+ margin-bottom: 12px;
80
+ z-index: 1;
81
+ }
82
+ #Tabs LI.Tab {
83
+ float: right;
84
+ height: 25px;
85
+ background-color: #deedfb;
86
+ margin: 2px 0px 0px 5px;
87
+ border: 1px solid #a2b6cb;
88
+ }
89
+ #Tabs LI.Tab A {
90
+ float: left;
91
+ display: block;
92
+ color: #666666;
93
+ text-decoration: none;
94
+ padding: 5px;
95
+ }
96
+ #Tabs LI.Tab A:hover {
97
+ background-color: #bfe0fe;
98
+ border-bottom: 1px solid #bfe0fe;
99
+ }
100
+ /* Selected Tab */
101
+ #Tabs LI.SelectedTab {
102
+ float: right;
103
+ height: 25px;
104
+ background-color: #fafafa;
105
+ margin: 2px 0px 0px 5px;
106
+ border-top: 1px solid #a2b6cb;
107
+ border-right: 1px solid #a2b6cb;
108
+ border-bottom: 1px solid #fafafa;
109
+ border-left: 1px solid #a2b6cb;
110
+ }
111
+ #Tabs LI.SelectedTab A {
112
+ float: left;
113
+ display: block;
114
+ color: #666666;
115
+ text-decoration: none;
116
+ padding: 5px;
117
+ cursor: default;
118
+ }
119
+ /* Copyright */
120
+ #Copyright {
121
+ text-align: center;
122
+ }
123
+ </style>
124
+ <script type="text/javascript">
125
+ /* <![CDATA[*/
126
+ // Index Page
127
+ function index() {
128
+ // Tab
129
+ document.getElementById('IndexTab').className = 'SelectedTab';
130
+ document.getElementById('ChangelogTab').className = 'Tab';
131
+ document.getElementById('InstallTab').className = 'Tab';
132
+ document.getElementById('UpgradeTab').className = 'Tab';
133
+ document.getElementById('UsageTab').className = 'Tab';
134
+ // Page
135
+ document.getElementById('Index').style.display= 'block';
136
+ document.getElementById('Changelog').style.display = 'none';
137
+ document.getElementById('Install').style.display = 'none';
138
+ document.getElementById('Upgrade').style.display = 'none';
139
+ document.getElementById('Usage').style.display = 'none';
140
+ }
141
+ // Changelog Page
142
+ function changelog() {
143
+ // Tab
144
+ document.getElementById('IndexTab').className = 'Tab';
145
+ document.getElementById('ChangelogTab').className = 'SelectedTab';
146
+ document.getElementById('InstallTab').className = 'Tab';
147
+ document.getElementById('UpgradeTab').className = 'Tab';
148
+ document.getElementById('UsageTab').className = 'Tab';
149
+ // Page
150
+ document.getElementById('Index').style.display = 'none';
151
+ document.getElementById('Changelog').style.display = 'block';
152
+ document.getElementById('Install').style.display = 'none';
153
+ document.getElementById('Upgrade').style.display = 'none';
154
+ document.getElementById('Usage').style.display = 'none';
155
+ }
156
+ // Installation Page
157
+ function install() {
158
+ // Tab
159
+ document.getElementById('IndexTab').className = 'Tab';
160
+ document.getElementById('ChangelogTab').className = 'Tab';
161
+ document.getElementById('InstallTab').className = 'SelectedTab';
162
+ document.getElementById('UpgradeTab').className = 'Tab';
163
+ document.getElementById('UsageTab').className = 'Tab';
164
+ // Page
165
+ document.getElementById('Index').style.display= 'none';
166
+ document.getElementById('Changelog').style.display = 'none';
167
+ document.getElementById('Install').style.display = 'block';
168
+ document.getElementById('Upgrade').style.display = 'none';
169
+ document.getElementById('Usage').style.display = 'none';
170
+ }
171
+ // Upgrade Page
172
+ function upgrade() {
173
+ // Tab
174
+ document.getElementById('IndexTab').className = 'Tab';
175
+ document.getElementById('ChangelogTab').className = 'Tab';
176
+ document.getElementById('InstallTab').className = 'Tab';
177
+ document.getElementById('UpgradeTab').className = 'SelectedTab';
178
+ document.getElementById('UsageTab').className = 'Tab';
179
+ // Page
180
+ document.getElementById('Index').style.display= 'none';
181
+ document.getElementById('Changelog').style.display = 'none';
182
+ document.getElementById('Install').style.display = 'none';
183
+ document.getElementById('Upgrade').style.display = 'block';
184
+ document.getElementById('Usage').style.display = 'none';
185
+ }
186
+ // Usage Page
187
+ function usage() {
188
+ // Tab
189
+ document.getElementById('IndexTab').className = 'Tab';
190
+ document.getElementById('ChangelogTab').className = 'Tab';
191
+ document.getElementById('InstallTab').className = 'Tab';
192
+ document.getElementById('UpgradeTab').className = 'Tab';
193
+ document.getElementById('UsageTab').className = 'SelectedTab';
194
+ // Page
195
+ document.getElementById('Index').style.display= 'none';
196
+ document.getElementById('Changelog').style.display = 'none';
197
+ document.getElementById('Install').style.display = 'none';
198
+ document.getElementById('Upgrade').style.display = 'none';
199
+ document.getElementById('Usage').style.display = 'block';
200
+ }
201
+ /* ]]> */
202
+ </script>
203
+ </head>
204
+ <body>
205
+ <div id="Container">
206
+ <!-- Title -->
207
+ <div id="Title">WP-Polls 2.14&nbsp;&nbsp;&nbsp;<span style="color: #aaaaaa;">Readme</span></div>
208
+
209
+ <!-- Tabs -->
210
+ <ul id="Tabs">
211
+ <li id="UsageTab" class="Tab"><a href="#Usage" onclick="usage(); return false;" title="Usage Instructions">Usage</a></li>
212
+ <li id="UpgradeTab" class="Tab"><a href="#Upgrade" onclick="upgrade(); return false;" title="Upgrade Instructions">Upgrade</a></li>
213
+ <li id="InstallTab" class="Tab"><a href="#Installation" onclick="install(); return false;" title="Installation Instructions">Installation</a></li>
214
+ <li id="ChangelogTab" class="Tab"><a href="#Changelog" onclick="changelog(); return false;" title="Changelog">Changelog</a></li>
215
+ <li id="IndexTab" class="SelectedTab"><a href="#Index" onclick="index(); return false;" title="Index Instructions">Index</a></li>
216
+ </ul>
217
+
218
+ <!-- Content -->
219
+ <div id="Content">
220
+ <!-- Index -->
221
+ <div id="Index">
222
+ <div class="SubTitle">&raquo; Index</div>
223
+ <div class="SubSubTitle">Plugin Information</div>
224
+ <p>
225
+ <b>Author:</b><br /><b>&raquo;</b> Lester 'GaMerZ' Chan</p>
226
+ <p>
227
+ <b>EMail:</b><br /><b>&raquo;</b>
228
+ <script type="text/javascript">
229
+ /* <![CDATA[*/
230
+ document.write(' <a href="mailto:gamerz84@hotmail.com?Subject=WP-Polls%202.14%20Support" title="EMail To gamerz84@hotmail.com">gamerz84@hotmail.com</a>');
231
+ /* ]]> */
232
+ </script>
233
+ </p>
234
+ <p>
235
+ <b>Website:</b><br />
236
+ <b>&raquo;</b> <a href="http://www.lesterchan.net/" title="http://www.lesterchan.net/">http://www.lesterchan.net/</a>
237
+ </p>
238
+ <p>
239
+ <b>Features:</b><br />
240
+ <b>&raquo;</b> Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
241
+ </p>
242
+ <p>
243
+ <b>Download:</b><br />
244
+ <b>&raquo;</b> <a href="http://www.lesterchan.net/others/downloads.php?id=10" title="http://www.lesterchan.net/others/downloads.php?id=10">WP-Polls 2.14 For WordPress 2.1.x</a><br />
245
+ <b>&raquo;</b> <a href="http://www.lesterchan.net/others/downloads/wp-polls213.zip" title="http://www.lesterchan.net/others/downloads/wp-polls213.zip">WP-Polls 2.13 For WordPress 2.0.x</a><br />
246
+ <b>&raquo;</b> <a href="http://www.lesterchan.net/others/downloads/wp-polls202a.zip" title="http://www.lesterchan.net/others/downloads/wp-polls202a.zip">WP-Polls 2.02a For WordPress 1.5.2</a>
247
+ </p>
248
+ <p>
249
+ <b>Demo:</b><br />
250
+ <b>&raquo;</b> <a href="http://www.lesterchan.net/wordpress/" title="http://www.lesterchan.net/wordpress/">http://www.lesterchan.net/wordpress/</a>
251
+ </p>
252
+ <p>
253
+ <b>Development:</b><br />
254
+ <b>&raquo;</b> <a href="http://dev.wp-plugins.org/browser/wp-polls/" title="http://dev.wp-plugins.org/browser/wp-polls/">http://dev.wp-plugins.org/browser/wp-polls/</a>
255
+ </p>
256
+ <p>
257
+ <b>Translations:</b><br />
258
+ <b>&raquo;</b> <a href="http://dev.wp-plugins.org/browser/wp-polls/i18n/" title="http://dev.wp-plugins.org/browser/wp-polls/i18n/">http://dev.wp-plugins.org/browser/wp-polls/i18n/</a>
259
+ </p>
260
+ <p>
261
+ <b>Support Forums:</b><br />
262
+ <b>&raquo;</b> <a href="http://forums.lesterchan.net/index.php?board=15.0" title="http://forums.lesterchan.net/index.php?board=15.0">http://forums.lesterchan.net/index.php?board=15.0</a>
263
+ </p>
264
+ <p>
265
+ <b>Credits:</b><br />
266
+ <b>&raquo;</b> Localization By <a href="http://4visions.nl/" title="http://4visions.nl/">Ravan</a><br />
267
+ <b>&raquo;</b> Uninstaller By Philippe Corbes</a>
268
+ </p>
269
+ <p>
270
+ <b>Updated:</b><br />
271
+ <b>&raquo;</b> 1st February 2007
272
+ </p>
273
+ <p>
274
+ <b>Note:</b><br />
275
+ <b>&raquo;</b> The <b>Changelog</b>, <b>Installation</b>, <b>Upgrade</b>, <b>Usage</b> Tab at the top of the page.<br />
276
+ <b>&raquo;</b> I have once again change some of the core code to make it work with the future/expired poll. Please post in the support forums if you encounter any bugs.
277
+ </p>
278
+ <p>
279
+ <b>Donations:</b><br />
280
+ <b>&raquo;</b> 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 as my school allowance, I will really appericiate it. If not feel free to use it without any obligations. Thank You. My Paypal account is
281
+ <script type="text/javascript">
282
+ /* <![CDATA[*/
283
+ document.write(' <b>gamerz84@hotmail.com</b>.');
284
+ /* ]]> */
285
+ </script>
286
+ </p>
287
+ </div>
288
+
289
+ <!-- Changelog -->
290
+ <div id="Changelog" style="display: none;">
291
+ <div class="SubTitle">&raquo; Changelog</div>
292
+ <ul>
293
+ <li>
294
+ <b>Version 2.14 (01-02-2007)</b>
295
+ <ul>
296
+ <li>NEW: Works For WordPress 2.1 Only</li>
297
+ <li>NEW: Renamed polls-js.js to polls-js.php To Enable PHP Parsing</li>
298
+ <li>NEW: Ability To Make A Poll Expire</li>
299
+ <li>NEW: Ability To Make A Future Poll</li>
300
+ <li>NEW: Future Poll Will Automatically Open When The Poll's Date Is Reached</li>
301
+ <li>NEW: Expired Poll Will Automatically Closed When The Poll's Date Is Reached</li>
302
+ <li>NEW: Ablity To Choose What To Do When The Poll Is Closed (Display Result, Remove Poll From Sidebar)</li>
303
+ <li>FIXED: Future Dated Polls Will Not Appear In The Post/Sidebar/Polls Archive</li>
304
+ </ul>
305
+ </li>
306
+ <li>
307
+ <b>Version 2.13 (02-01-2007)</b>
308
+ <ul>
309
+ <li>NEW: polls.php Now Handles The AJAX Processing Instead Of index.php</li>
310
+ <li>NEW: Able To Modify The Style Of Poll Results Bar in 'Polls -> Poll Option'</li>
311
+ <li>NEW: Usage Instructions Is Also Included Within The Plugin Itself</li>
312
+ <li>NEW: Uninstaller Done By Philippe Corbes</li>
313
+ <li>NEW: Localization Done By <a href="http://4visions.nl/" title="http://4visions.nl/">Ravan</a></li>
314
+ <li>NEW: Ability To Add HTML Into Poll Question and Answers</li>
315
+ <li>FIXED: AJAX Not Working On Servers Running On PHP CGI</li>
316
+ <li>FIXED: Added Some Default Styles To polls-css.css To Ensure That WP-Polls Does Not Break</li>
317
+ <li>FIXED: Other Languages Not Appearing Properly</li>
318
+ <li>FIXED: Poll IP Logs Of Deleted Poll's Answer Did Not Get Deleted</li>
319
+ <li>FIXED: There Is An Error In Voting If There Is Only 1 Poll's Answer</li>
320
+ </ul>
321
+ </li>
322
+ <li>
323
+ <b>Version 2.12 (01-10-2006)</b>
324
+ <ul>
325
+
326
+ <li>NEW: Polls Archive Is Now Embedded Into A Page, And Hence No More Integrating Of Polls Archive</li>
327
+ <li>NEW: WP-Polls Is Now Using DIV To Display The Poll's Results Instead Of The Image Bar</li>
328
+ <li>NEW: Added Widget Title Option To WP-Polls Widget</li>
329
+ <li>NEW: Ability To Logged By UserName</li>
330
+ <li>NEW: Added CSS Class 'wp-polls-image' To All IMG Tags</li>
331
+ <li>FIXED: If Site URL Doesn't Match WP Option's Site URL, WP-Polls Will Not Work</li>
332
+ </ul>
333
+ </li>
334
+ <li>
335
+ <b>Version 2.11 (08-06-2006)</b>
336
+ <ul>
337
+ <li>NEW: You Can Now Place The Poll On The Sidebar As A Widget</li>
338
+ <li>NEW: Moved wp-polls.php To wp-content/plugins/polls/ Folder</li>
339
+ <li>FIXED: AJAX Not Working In Opera Browser</li>
340
+ <li>FIXED: Poll Not Working On Physical Pages That Is Integrated Into WordPress</li>
341
+ </ul>
342
+ </li>
343
+ <li>
344
+ <b>Version 2.1 (01-06-2006)</b>
345
+ <ul>
346
+ <li>NEW: Poll Is Now Using AJAX</li>
347
+ <li>NEW: Ability To Close/Open Poll</li>
348
+ <li>NEW: Added Poll Option For Logging Method</li>
349
+ <li>NEW: Added Poll Option For Who Can Vote</li>
350
+ <li>NEW: Added Poll Results Footer Template Variable (Used When User Click "View Results")</li>
351
+ <li>NEW: Added The Ability To Delete All Poll Logs Or Logs From A Specific Poll</li>
352
+ <li>NEW: Poll Administration Panel And The Code That WP-Polls Generated Is XHTML 1.0 Transitional</li>
353
+ </ul>
354
+ </li>
355
+ <li>
356
+ <b>Version 2.06b (26-04-2006)</b>
357
+ <ul>
358
+ <li>FIXED: Bug In vote_poll();</li>
359
+ </ul>
360
+ </li>
361
+ <li>
362
+ <b>Version 2.06a (02-04-2006)</b>
363
+ <ul>
364
+ <li>FIXED: Random Poll Not Working Correctly</li>
365
+ </ul>
366
+ </li>
367
+ <li>
368
+ <b>Version 2.06 (01-04-2006)</b>
369
+ <ul>
370
+ <li>NEW: Poll Bar Is Slightly Nicer</li>
371
+ <li>NEW: Got Rid Of Tables, Now Using List</li>
372
+ <li>NEW: Added In Most Voted And Least Voted Answer/Votes/Percentage For Individual Poll As Template Variables</li>
373
+ <li>NEW: Display Random Poll Option Under Poll -> Poll Options -> Current Poll</li>
374
+ <li>FIXED: Totally Removed Tables In wp-polls.php</li>
375
+ </ul>
376
+ </li>
377
+ <li>
378
+ <b>Version 2.05 (01-03-2006)</b>
379
+ <ul>
380
+ <li>NEW: Improved On 'manage_polls' Capabilities</li>
381
+ <li>NEW: Neater Structure</li>
382
+ <li>NEW: No More Install/Upgrade File, It Will Install/Upgrade When You Activate The Plugin</li>
383
+ <li>NEW: Added Poll Stats Function</li>
384
+ </ul>
385
+ </li>
386
+ <li>
387
+ <b>Version 2.04 (01-02-2006)</b>
388
+ <ul>
389
+ <li>NEW: Added 'manage_polls' Capabilities To Administrator Role</li>
390
+ <li>NEW: [poll=POLL_ID] Tag To Insert Poll Into A Post</li>
391
+ <li>NEW: Ability To Edit Poll's Timestamp</li>
392
+ <li>NEW: Ability To Edit Individual Poll's Answer Votes</li>
393
+ <li>NEW: %POLL_RESULT_URL% To Display Poll's Result URL</li>
394
+ <li>FIXED: Cannot Sent Header Error</li>
395
+ </ul>
396
+ </li>
397
+ <li>
398
+ <b>Version 2.03 (01-01-2006)</b>
399
+ <ul>
400
+ <li>NEW: Compatible With WordPress 2.0 Only</li>
401
+ <li>NEW: Poll Administration Menu Added Automatically Upon Activating The Plugin</li>
402
+ <li>NEW: Removed Add Poll Link From The Administration Menu</li>
403
+ <li>NEW: GPL License Added</li>
404
+ <li>NEW: Page Title Added To wp-polls.php</li>
405
+ </ul>
406
+ </li>
407
+ <li>
408
+ <b>Version 2.02a (17-11-2005)</b>
409
+ <ul>
410
+ <li>FIXED: poll-install.php And poll-upgrade.php will Now Be Installed/Upgraded To 2.02 Instead Of 2.01</li>
411
+ </ul>
412
+ </li>
413
+ <li>
414
+ <b>Version 2.02 (05-11-2005)</b>
415
+ <ul>
416
+ <li>FIXED: Showing 0 Vote On Poll Edit Page</li>
417
+ <li>FIXED: Null Vote Being Counted As A Vote</li>
418
+ <li>FIXED: Auto Loading Of Poll Option: Polls Per Page In Poll Archive Page Is Now "No"</li>
419
+ <li>NEW: Host Column In Poll IP Table To Prevent Network Lagging When Resolving IP</li>
420
+ <li>NEW: New Poll Error Template</li>
421
+ </ul>
422
+ </li>
423
+ <li>
424
+ <b>Version 2.01 (25-10-2005)</b>
425
+ <ul>
426
+ <li>FIXED: Upgrade Script To Insert Lastest Poll ID Of User's Current Polls, Instead Of Poll ID 1</li>
427
+ <li>FIXED: Replace All &lt;?= With &lt;?php</li>
428
+ <li>FIXED: Added addalshes() To $pollip_user</li>
429
+ <li>FIXED: Better Localization Support (80% Done, Will Leave It In The Mean Time)</li>
430
+ </ul>
431
+ </li>
432
+ <li>
433
+ <b>Version 2.0 (20-10-2005)</b>
434
+ <ul>
435
+ <li>NEW: IP Logging</li>
436
+ <li>NEW: Poll Options: Sorting Of Answers In Voting Form</li>
437
+ <li>NEW: Poll Options: Sorting Of Answers In Results View</li>
438
+ <li>NEW: Poll Options: Number Of Polls Per Page In Poll Archive</li>
439
+ <li>NEW: Poll Options: Choose Poll To Display On Index Page</li>
440
+ <li>NEW: Poll Options: Able To Disable Poll With Custom Message</li>
441
+ <li>NEW: Poll Options: Poll Templates</li>
442
+ <li>NEW: Display User's Voted Choice</li>
443
+ <li>FIXED: Better Install/Upgrade Script</li>
444
+ </ul>
445
+ </li>
446
+ </ul>
447
+ </div>
448
+
449
+ <!-- Installation Instructions -->
450
+ <div id="Install" style="display: none;">
451
+ <div class="SubTitle">&raquo; Installation Instructions</div>
452
+ <ol>
453
+ <li>
454
+ Open <b>wp-content/plugins</b> Folder
455
+ </li>
456
+ <li>
457
+ Put:
458
+ <blockquote>Folder: polls</blockquote>
459
+ </li>
460
+ <li>
461
+ <b>Activate</b> WP-Polls Plugin
462
+ </li>
463
+ <li>
464
+ Refer To <b>Usage</b> For Further Instructions
465
+ </li>
466
+ </ol>
467
+ </div>
468
+
469
+ <!-- Upgrade Instructions -->
470
+ <div id="Upgrade" style="display: none;">
471
+ <div class="SubTitle">&raquo; Upgrade Instructions</div>
472
+ <div class="SubSubTitle">From v2.xx To v2.14</div>
473
+ <ol>
474
+ <li>
475
+ <b>Deactivate</b> WP-Polls Plugin
476
+ </li>
477
+ <li>
478
+ Open <b>wp-content/plugins</b> Folder
479
+ </li>
480
+ <li>
481
+ Put/Overwrite:
482
+ <blockquote>Folder: polls</blockquote>
483
+ </li>
484
+ <li>
485
+ Delete these file if exists:
486
+ <blockquote>
487
+ File: wp-polls.php<br />
488
+ File: wp-content/plugins/polls/wp-polls.php<br />
489
+ File: wp-content/plugins/polls/polls-js.js<br />
490
+ File: wp-content/plugins/polls/images/pollbar.gif<br />
491
+ File: wp-content/plugins/polls/images/pollend.gif<br />
492
+ File: wp-content/plugins/polls/images/pollstart.gif<br />
493
+ File: wp-content/plugins/polls/images/pollbar.gif
494
+ </blockquote>
495
+ </li>
496
+ <li>
497
+ <b>Activate</b> WP-Polls Plugin
498
+ </li>
499
+ <li>
500
+ Go to 'WP-Admin -> Polls -> Polls Options' and restore all the template variables to <b>Default</b>
501
+ </li>
502
+ <li>
503
+ Refer To <b>Usage</b> For Further Instructions
504
+ </li>
505
+ </ol>
506
+ </div>
507
+
508
+ <!-- Usage Instructions -->
509
+ <div id="Usage" style="display: none;">
510
+ <div class="SubTitle">&raquo; Usage Instructions</div>
511
+ <div class="SubSubTitle">General Usage (Without Widget)</div>
512
+ <ol>
513
+ <li>
514
+ Open <b>wp-content/themes/&lt;YOUR THEME NAME&gt;/sidebar.php</b>
515
+ </li>
516
+ <li>
517
+ Add:
518
+ <blockquote>
519
+ &lt;?php if (function_exists('vote_poll') &amp;&amp; !$in_pollsarchive): ?&gt;<br />
520
+ &lt;li&gt;<br />
521
+ &nbsp;&nbsp;&nbsp;&lt;h2&gt;Polls&lt;/h2&gt;<br />
522
+ &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
523
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;?php get_poll();?&gt;&lt;/li&gt;<br />
524
+ &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
525
+ &nbsp;&nbsp;&nbsp;&lt;?php display_polls_archive_link(); ?&gt;<br />
526
+ &lt;/li&gt;<br />
527
+ &lt;?php endif; ?&gt;
528
+ </blockquote>
529
+ <p>To show specific poll, use &lt;?php get_poll(<b>2</b>);?&gt; where <b>2</b> is your poll id.</p>
530
+ <p>To embed a specific poll in your post, use [poll=<b>2</b>] where <b>2</b> is your poll id.</p>
531
+ </li>
532
+ <li>
533
+ Scroll down for instructions on how to create a <b>Polls Archive</b>.
534
+ </li>
535
+ </ol>
536
+ <div class="SubSubTitle">General Usage (With Widget)</div>
537
+ <ol>
538
+ <li>
539
+ <b>Activate</b> WP-Polls Widget Plugin
540
+ </li>
541
+ <li>
542
+ Go to 'WP-Admin -> Presentation -> Sidebar Widgets'
543
+ </li>
544
+ <li>
545
+ <b>Drag</b> the Polls Widget to your sidebar
546
+ </li>
547
+ <li>
548
+ You can <b>configure</b> the Polls Widget by clicking on the configure icon
549
+ </li>
550
+ <li>
551
+ Click 'Save changes'
552
+ </li>
553
+ <li>
554
+ Scroll down for instructions on how to create a <b>Polls Archive</b>.
555
+ </li>
556
+ </ol>
557
+ <div class="SubSubTitle">Polls Archive</div>
558
+ <ol>
559
+ <li>
560
+ Go to 'WP-Admin -> Write -> Write Page'
561
+ </li>
562
+ <li>
563
+ Type any title you like in the post's title area
564
+ </li>
565
+ <li>
566
+ Type '<b>[page_polls]</b>' in the post's content area (without the quotes)
567
+ </li>
568
+ <li>
569
+ Type '<b>pollsarchive</b>' in the post's slug area (without the quotes)
570
+ </li>
571
+ <li>
572
+ Click 'Publish'
573
+ </li>
574
+ <li>
575
+ If you <b>ARE NOT</b> using nice permalinks, you need to go to 'WP-Admin -> Polls -> Poll Option' and under '<b>Poll Archive -> Polls Archive URL</b>', you need to fill in the URL to the Polls Archive Page you created above.
576
+ </li>
577
+ </ol>
578
+ <div class="SubSubTitle">Note</div>
579
+ <ul>
580
+ <li>
581
+ In IE, some of the poll's text may appear jagged (this is normal in IE). To solve this issue,
582
+ <ol>
583
+ <li>
584
+ Open <b>poll-css.css</b>
585
+ </li>
586
+ <li>
587
+ Find:
588
+ <blockquote>
589
+ /* background-color: #ffffff; */
590
+ </blockquote>
591
+ </li>
592
+ <li>
593
+ Replace:
594
+ <blockquote>
595
+ background-color: #ffffff;
596
+ </blockquote>
597
+ <p>Where <b>#ffffff</b> should be your background color for the poll.</p>
598
+ </li>
599
+ </ol>
600
+ </li>
601
+ </ul>
602
+ <div class="SubSubTitle">Polls Stats (Outside WP Loop)</div>
603
+ <ul>
604
+ <li>
605
+ To Display <b>Total Polls</b>
606
+ </li>
607
+ <li>
608
+ Use:
609
+ <blockquote>
610
+ &lt;?php if (function_exists('get_pollquestions')): ?&gt;<br />
611
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollquestions(); ?&gt;<br />
612
+ &lt;?php endif; ?&gt;
613
+ </blockquote>
614
+ </li>
615
+ <li>
616
+ To Display <b>Total Poll Answers</b>
617
+ </li>
618
+ <li>
619
+ Use:
620
+ <blockquote>
621
+ &lt;?php if (function_exists('get_pollanswers')): ?&gt;<br />
622
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollanswers(); ?&gt;<br />
623
+ &lt;?php endif; ?&gt;
624
+ </blockquote>
625
+ </li>
626
+ <li>
627
+ To Display <b>Total Poll Votes</b>
628
+ </li>
629
+ <li>
630
+ Use:
631
+ <blockquote>
632
+ &lt;?php if (function_exists('get_pollvotes')): ?&gt;<br />
633
+ &nbsp;&nbsp;&nbsp;&lt;?php get_pollvotes(); ?&gt;<br />
634
+ &lt;?php endif; ?&gt;
635
+ </blockquote>
636
+ </li>
637
+ </ul>
638
+ </div>
639
+ </div>
640
+ </div>
641
+ <p id="Copyright">WP-Polls 2.14<br />Copyright &copy; 2007 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
642
+ </body>
643
+ </html>
readme.txt CHANGED
@@ -1,39 +1,29 @@
1
- -> Polls Plugin For WordPress
2
- --------------------------------------------------
3
- Author -> Lester 'GaMerZ' Chan
4
- Email -> lesterch@singnet.com.sg
5
- Website -> http://www.lesterchan.net/
6
- Demo -> http://www.lesterchan.net/blogs
7
- Updated -> 17th November 2005
8
- --------------------------------------------------
9
- Notes -> Minium level required to add/edit/delete polls is 8
10
- -> Please backup your database before trying to install this plugin
11
- --------------------------------------------------
12
-
13
-
14
- // Version 2.02a (17-11-2005)
15
- - FIXED: poll-install.php And poll-upgrade.php will Now Be Installed/Upgraded To 2.02 Instead Of 2.01
16
-
17
- // Version 2.02 (05-11-2005)
18
- - FIXED: Showing 0 Vote On Poll Edit Page
19
- - FIXED: Null Vote Being Counted As A Vote
20
- - FIXED: Auto Loading Of Poll Option: Polls Per Page In Poll Archive Page Is Now "No"
21
- - ADDED: Host Column In Poll IP Table To Prevent Network Lagging When Resolving IP
22
- - ADDED: New Poll Error Template
23
-
24
- // Version 2.01 (25-10-2005)
25
- - FIXED: Upgrade Script To Insert Lastest Poll ID Of User's Current Polls, Instead Of Poll ID 1
26
- - FIXED: Replace All <?= With <?php
27
- - FIXED: Added addalshes() To $pollip_user
28
- - FIXED: Better Localization Support (80% Done, Will Leave It In The Mean Time)
29
-
30
- // Version 2.0 (20-10-2005)
31
- - ADDED: IP Logging
32
- - ADDED: Poll Options: Sorting Of Answers In Voting Form
33
- - ADDED: Poll Options: Sorting Of Answers In Results View
34
- - ADDED: Poll Options: Number Of Polls Per Page In Poll Archive
35
- - ADDED: Poll Options: Choose Poll To Display On Index Page
36
- - ADDED: Poll Options: Able To Disable Poll With Custom Message
37
- - ADDED: Poll Options: Poll Templates
38
- - ADDED: Display User's Voted Choice
39
- - FIXED: Better Install/Upgrade Script
1
+ === WP-Polls ===
2
+ Contributors: GamerZ
3
+ Donate link: http://www.lesterchan.net/wordpress
4
+ Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
5
+ Requires at least: 2.1.0
6
+ Stable tag: 2.14
7
+
8
+ Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
9
+
10
+ == Description ==
11
+
12
+ All the information (general, changelog, installation, upgrade, usage) you need about this plugin can be found here: [WP-Polls Readme](http://www.lesterchan.net/wordpress/readme/wp-polls.html "WP-Polls Readme").
13
+ It is the exact same readme.html is included in the zip package.
14
+
15
+ == Development Blog ==
16
+
17
+ [GaMerZ WordPress Plugins Development Blog](http://www.lesterchan.net/wordpress/ "GaMerZ WordPress Plugins Development Blog")
18
+
19
+ == Installation ==
20
+
21
+ [WP-Polls Readme](http://www.lesterchan.net/wordpress/readme/wp-polls.html "WP-Polls Readme") (Installation Tab)
22
+
23
+ == Screenshots ==
24
+
25
+ [GaMerZ WordPress Plugins Screenshots](http://www.lesterchan.net/wordpress/screenshots/ "GaMerZ WordPress Plugins Screenshots")
26
+
27
+ == Frequently Asked Questions ==
28
+
29
+ You will need [GaMerZ WordPress Plugins Support Forums](http://forums.lesterchan.net/ "GaMerZ WordPress Plugins Support Forums")
 
 
 
 
 
 
 
 
 
 
wp-polls.php DELETED
@@ -1,289 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 1.5 Plugin: WP-Polls 2.02 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Poll Archive |
14
- | - wp-polls.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Wordpress Header
21
- require('wp-blog-header.php');
22
-
23
- ### Process Votes
24
- vote_poll();
25
-
26
- ### Polls Variables
27
- $page = intval($_GET['page']);
28
- $polls_questions = array();
29
- $polls_answers = array();
30
- $polls_ip = array();
31
- $polls_perpage = intval(get_settings('poll_archive_perpage'));
32
- $poll_questions_ids = '0';
33
- $poll_voted = false;
34
- $poll_voted_aid = 0;
35
- $poll_id = 0;
36
-
37
- ### Get Total Polls
38
- $total_polls = $wpdb->get_var("SELECT COUNT(pollq_id) FROM $wpdb->pollsq");
39
-
40
- ### Checking $page and $offset
41
- if (empty($page) || $page == 0) { $page = 1; }
42
- if (empty($offset)) { $offset = 0; }
43
-
44
- ### Determin $offset
45
- $offset = ($page-1) * $polls_perpage;
46
-
47
- ### Determine Max Number Of Polls To Display On Page
48
- if(($offset + $polls_perpage) > $total_polls) {
49
- $max_on_page = $total_polls;
50
- } else {
51
- $max_on_page = ($offset + $polls_perpage);
52
- }
53
-
54
- ### Determine Number Of Polls To Display On Page
55
- if (($offset + 1) > ($total_polls)) {
56
- $display_on_page = $total_polls;
57
- } else {
58
- $display_on_page = ($offset + 1);
59
- }
60
-
61
- ### Determing Total Amount Of Pages
62
- $total_pages = ceil($total_polls / $polls_perpage);
63
-
64
- ### Make Sure Poll Is Not Disabled
65
- if(intval(get_settings('poll_currentpoll')) != -1 && $page < 2) {
66
- // Hardcoded Poll ID Is Not Specified
67
- if(intval($temp_poll_id) == 0) {
68
- // Current Poll ID Is Not Specified
69
- if(intval(get_settings('poll_currentpoll')) == 0) {
70
- // Get Lastest Poll ID
71
- $poll_id = intval(get_settings('poll_latestpoll'));
72
- } else {
73
- // Get Current Poll ID
74
- $poll_id = intval(get_settings('poll_currentpoll'));
75
- }
76
- // Get Hardcoded Poll ID
77
- } else {
78
- $poll_id = intval($temp_poll_id);
79
- }
80
- }
81
-
82
- ### Get Poll Questions
83
- $questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE pollq_id != $poll_id ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
84
- if($questions) {
85
- foreach($questions as $question) {
86
- $polls_questions[] = array('id' => intval($question->pollq_id), 'question' => stripslashes($question->pollq_question), 'timestamp' => $question->pollq_timestamp, 'totalvotes' => intval($question->pollq_totalvotes));
87
- $poll_questions_ids .= intval($question->pollq_id).', ';
88
- }
89
- $poll_questions_ids = substr($poll_questions_ids, 0, -2);
90
- }
91
-
92
- ### Get Poll Answers
93
- $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_settings('poll_ans_result_sortby').' '.get_settings('poll_ans_result_sortorder'));
94
- if($answers) {
95
- foreach($answers as $answer) {
96
- $polls_answers[] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => stripslashes($answer->polla_answers), 'votes' => intval($answer->polla_votes));
97
- }
98
- }
99
-
100
- ### Get Poll IPs
101
- $ips = $wpdb->get_results("SELECT pollip_qid, pollip_aid FROM $wpdb->pollsip WHERE pollip_qid IN ($poll_questions_ids) AND pollip_ip = '".get_ipaddress()."'");
102
- if($ips) {
103
- foreach($ips as $ip) {
104
- $polls_ips[] = array('qid' => intval($ip->pollip_qid), 'aid' => intval($ip->pollip_aid));
105
- }
106
- }
107
- ### Function: Check Voted To Get Voted Answer
108
- function check_voted($poll_id) {
109
- global $polls_ips;
110
- $temp_voted_aid = 0;
111
- if(intval($_COOKIE["voted_$poll_id"]) > 0) {
112
- $temp_voted_aid = intval($_COOKIE["voted_$poll_id"]);
113
- } else {
114
- if($polls_ips) {
115
- foreach($polls_ips as $polls_ip) {
116
- if($polls_ip['qid'] == $poll_id) {
117
- $temp_voted_aid = $polls_ip['aid'];
118
- }
119
- }
120
- }
121
- }
122
- return $temp_voted_aid;
123
- }
124
- ?>
125
- <?php get_header(); ?>
126
- <div id="content" class="narrowcolumn">
127
- <?php
128
- if($page < 2) {
129
- echo "<!-- <Currrent Poll> -->\n";
130
- echo '<h2 class="pagetitle">'.__('Current Poll').'</h2>'."\n";
131
- // Current Poll
132
- if(intval(get_settings('poll_currentpoll')) == -1) {
133
- echo get_settings('poll_template_disable');
134
- } else {
135
- // User Click on View Results Link
136
- if(intval($_GET['pollresult']) == 1) {
137
- display_pollresult($poll_id);
138
- // Check Whether User Has Voted
139
- } else {
140
- // Check Cookie First
141
- $voted_cookie = check_voted_cookie($poll_id);
142
- if($voted_cookie > 0) {
143
- display_pollresult($poll_id, $voted_cookie);
144
- // Check IP If Cookie Cannot Be Found
145
- } else {
146
- $voted_ip = check_voted_ip($poll_id);
147
- if($voted_ip > 0) {
148
- display_pollresult($poll_id, $voted_ip);
149
- // User Never Vote. Display Poll Voting Form
150
- } else {
151
- display_pollvote($poll_id);
152
- }
153
- }
154
- }
155
- }
156
- echo "<!-- </Currrent Poll> -->\n";
157
- }
158
- ?>
159
- <!-- <Poll Archives> -->
160
- <h2 class="pagetitle"><?php _e('Polls Archive'); ?></h2>
161
- <?php
162
- foreach($polls_questions as $polls_question) {
163
- // Is The Poll Total Votes 0?
164
- $poll_totalvotes_zero = true;
165
- if($polls_question['totalvotes'] > 0) {
166
- $poll_totalvotes_zero = false;
167
- }
168
- // Poll Question Variables
169
- $template_question = stripslashes(get_settings('poll_template_resultheader'));
170
- $template_question = str_replace("%POLL_QUESTION%", $polls_question['question'], $template_question);
171
- $template_question = str_replace("%POLL_ID%", $polls_question['id'], $template_question);
172
- $template_question = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_question);
173
- // Print Out Result Header Template
174
- echo $template_question;
175
- foreach($polls_answers as $polls_answer) {
176
- if($polls_question['id'] == $polls_answer['qid']) {
177
- // Calculate Percentage And Image Bar Width
178
- if(!$poll_totalvotes_zero) {
179
- if($polls_answer['votes'] > 0) {
180
- $poll_answer_percentage = round((($polls_answer['votes']/$polls_question['totalvotes'])*100));
181
- $poll_answer_imagewidth = round($poll_answer_percentage*0.9);
182
- } else {
183
- $poll_answer_percentage = 0;
184
- $poll_answer_imagewidth = 1;
185
- }
186
- } else {
187
- $poll_answer_percentage = 0;
188
- $poll_answer_imagewidth = 1;
189
- }
190
- // Let User See What Options They Voted
191
- if(check_voted($polls_question['id']) == $polls_answer['aid']) {
192
- // Results Body Variables
193
- $template_answer = stripslashes(get_settings('poll_template_resultbody2'));
194
- $template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
195
- $template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
196
- $template_answer = str_replace("%POLL_ANSWER_VOTES%", $polls_answer['votes'], $template_answer);
197
- $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
198
- $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
199
- // Print Out Results Body Template
200
- echo $template_answer;
201
- } else {
202
- // Results Body Variables
203
- $template_answer = stripslashes(get_settings('poll_template_resultbody'));
204
- $template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
205
- $template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
206
- $template_answer = str_replace("%POLL_ANSWER_VOTES%", $polls_answer['votes'], $template_answer);
207
- $template_answer = str_replace("%POLL_ANSWER_PERCENTAGE%", $poll_answer_percentage, $template_answer);
208
- $template_answer = str_replace("%POLL_ANSWER_IMAGEWIDTH%", $poll_answer_imagewidth, $template_answer);
209
- // Print Out Results Body Template
210
- echo $template_answer;
211
- }
212
- // Delete Away From Array
213
- unset($polls_answer['answers']);
214
- }
215
- }
216
- // Results Footer Variables
217
- $template_footer = stripslashes(get_settings('poll_template_resultfooter'));
218
- $template_footer = str_replace("%POLL_TOTALVOTES%", $polls_question['totalvotes'], $template_footer);
219
- // Print Out Results Footer Template
220
- echo $template_footer;
221
- echo "<br /><hr class=\"Divider\" />\n";
222
- }
223
- ?>
224
- <!-- </Poll Archives> -->
225
-
226
- <!-- <Paging> -->
227
- <?php
228
- if($total_polls > 0) {
229
- ?>
230
- <br />
231
- <table width="100%" cellspacing="0" cellpadding="0" border="0">
232
- <tr>
233
- <td align="left" width="50%">
234
- <?php
235
- if($page > 1 && ((($page*$polls_perpage)-($polls_perpage-1)) <= $total_polls)) {
236
- echo '<b>&laquo;</b> <a href="wp-polls.php?page='.($page-1).'" title="&laquo; '.__('Previous Page').'">'.__('Previous Page').'</a>';
237
- } else {
238
- echo '&nbsp;';
239
- }
240
- ?>
241
- </td>
242
- <td align="right" width="50%">
243
- <?php
244
- if($page >= 1 && ((($page*$polls_perpage)+1) <= $total_polls)) {
245
- echo '<a href="wp-polls.php?page='.($page+1).'" title="'.__('Next Page').' &raquo;">'.__('Next Page').'</a> <b>&raquo;</b>';
246
- } else {
247
- echo '&nbsp;';
248
- }
249
- ?>
250
- </td>
251
- </tr>
252
- <tr>
253
- <td colspan="2" align="center">
254
- <?php _e('Pages'); ?> (<?echo $total_pages; ?>) :
255
- <?php
256
- if ($page >= 4) {
257
- echo '<b><a href="wp-polls.php?page=1" title="'.__('Go to First Page').'">&laquo; '.__('First').'</a></b> ... ';
258
- }
259
- if($page > 1) {
260
- echo ' <b><a href="wp-polls.php?page='.($page-1).'" title="&laquo; '.__('Go to Page').' '.($page-1).'">&laquo;</a></b> ';
261
- }
262
- for($i = $page - 2 ; $i <= $page +2; $i++) {
263
- if ($i >= 1 && $i <= $total_pages) {
264
- if($i == $page) {
265
- echo "<b>[$i]</b> ";
266
- } else {
267
- echo '<a href="wp-polls.php?page='.($i).'" title="'.__('Page').' '.$i.'">'.$i.'</a> ';
268
- }
269
- }
270
- }
271
- if($page < $total_pages) {
272
- echo ' <b><a href="wp-polls.php?page='.($page+1).'" title="'.__('Go to Page').' '.($page+1).' &raquo;">&raquo;</a></b> ';
273
- }
274
- if (($page+2) < $total_pages) {
275
- echo ' ... <b><a href="wp-polls.php?page='.($total_pages).'" title="'.__('Go to Last Page').'">'.__('Last').' &raquo;</a></b>';
276
- }
277
- ?>
278
- </td>
279
- </tr>
280
- </table>
281
- <!-- </Paging> -->
282
- <?php
283
- }
284
- ?>
285
- </div>
286
- <?php
287
- get_sidebar();
288
- get_footer();
289
- ?>