current_time('timestamp')) { $pollq_active = -1; } } // Poll End Date $pollq_expiry_no = isset( $_POST['pollq_expiry_no'] ) ? intval( $_POST['pollq_expiry_no'] ) : 0; if($pollq_expiry_no == 1) { $pollq_expiry = ''; } else { $pollq_expiry_day = intval($_POST['pollq_expiry_day']); $pollq_expiry_month = intval($_POST['pollq_expiry_month']); $pollq_expiry_year = intval($_POST['pollq_expiry_year']); $pollq_expiry_hour = intval($_POST['pollq_expiry_hour']); $pollq_expiry_minute = intval($_POST['pollq_expiry_minute']); $pollq_expiry_second = intval($_POST['pollq_expiry_second']); $pollq_expiry = gmmktime($pollq_expiry_hour, $pollq_expiry_minute, $pollq_expiry_second, $pollq_expiry_month, $pollq_expiry_day, $pollq_expiry_year); if($pollq_expiry <= current_time('timestamp')) { $pollq_active = 0; } if($edit_polltimestamp == 1) { if($pollq_expiry < $pollq_timestamp) { $pollq_active = 0; } } } // Mutilple Poll $pollq_multiple_yes = intval($_POST['pollq_multiple_yes']); $pollq_multiple = 0; if($pollq_multiple_yes == 1) { $pollq_multiple = intval($_POST['pollq_multiple']); } else { $pollq_multiple = 0; } // Update Poll's Question $text = ''; $edit_poll_question = $wpdb->update( $wpdb->pollsq, array( 'pollq_question' => $pollq_question, 'pollq_timestamp' => $pollq_timestamp, 'pollq_totalvotes' => $pollq_totalvotes, 'pollq_active' => $pollq_active, 'pollq_expiry' => $pollq_expiry, 'pollq_multiple' => $pollq_multiple, 'pollq_totalvoters' => $pollq_totalvoters ), array( 'pollq_id' => $pollq_id ), array( '%s', '%s', '%d', '%d', '%s', '%d', '%d' ), array( '%d' ) ); if( ! $edit_poll_question ) { $text = '

'.sprintf(__('No Changes Had Been Made To Poll\'s Question \'%s\'.', 'wp-polls'), removeslashes($pollq_question)).'

'; } // Update Polls' Answers $polla_aids = array(); $get_polla_aids = $wpdb->get_results( $wpdb->prepare( "SELECT polla_aid FROM $wpdb->pollsa WHERE polla_qid = %d ORDER BY polla_aid ASC", $pollq_id ) ); if($get_polla_aids) { foreach($get_polla_aids as $get_polla_aid) { $polla_aids[] = intval($get_polla_aid->polla_aid); } foreach($polla_aids as $polla_aid) { $polla_answers = wp_kses_post( trim( $_POST['polla_aid-'.$polla_aid] ) ); $polla_votes = intval($_POST['polla_votes-'.$polla_aid]); $edit_poll_answer = $wpdb->update( $wpdb->pollsa, array( 'polla_answers' => $polla_answers, 'polla_votes' => $polla_votes ), array( 'polla_qid' => $pollq_id, 'polla_aid' => $polla_aid ), array( '%s', '%d' ), array( '%d', '%d' ) ); if( ! $edit_poll_answer ) { $text .= '

'.sprintf(__('No Changes Had Been Made To Poll\'s Answer \'%s\'.', 'wp-polls'), $polla_answers ).'

'; } else { $text .= '

'.sprintf(__('Poll\'s Answer \'%s\' Edited Successfully.', 'wp-polls'), $polla_answers ).'

'; } } } else { $text .= '

'.sprintf(__('Invalid Poll \'%s\'.', 'wp-polls'), removeslashes($pollq_question)).'

'; } // Add Poll Answers (If Needed) $polla_answers_new = isset($_POST['polla_answers_new']) ? $_POST['polla_answers_new'] : null; if(!empty($polla_answers_new)) { $i = 0; $polla_answers_new_votes = $_POST['polla_answers_new_votes']; foreach($polla_answers_new as $polla_answer_new) { $polla_answer_new = wp_kses_post( trim( $polla_answer_new ) ); if(!empty($polla_answer_new)) { $polla_answer_new_vote = intval( $polla_answers_new_votes[$i] ); $add_poll_answers = $wpdb->insert( $wpdb->pollsa, array( 'polla_qid' => $pollq_id, 'polla_answers' => $polla_answer_new, 'polla_votes' => $polla_answer_new_vote ), array( '%d', '%s', '%d' ) ); if( ! $add_poll_answers ) { $text .= '

'.sprintf(__('Error In Adding Poll\'s Answer \'%s\'.', 'wp-polls'), $polla_answer_new).'

'; } else { $text .= '

'.sprintf(__('Poll\'s Answer \'%s\' Added Successfully.', 'wp-polls'), $polla_answer_new).'

'; } } $i++; } } if(empty($text)) { $text = '

'.sprintf(__('Poll \'%s\' Edited Successfully.', 'wp-polls'), removeslashes($pollq_question)).'

'; } // Update Lastest Poll ID To Poll Options $latest_pollid = polls_latest_id(); $update_latestpoll = update_option('poll_latestpoll', $latest_pollid); do_action( 'wp_polls_update_poll', $latest_pollid ); cron_polls_place(); break; } } ### Determines Which Mode It Is switch($mode) { // Poll Logging case 'logs': require('polls-logs.php'); break; // Edit A Poll case 'edit': $last_col_align = is_rtl() ? 'right' : 'left'; $poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d", $poll_id ) ); $poll_answers = $wpdb->get_results( $wpdb->prepare( "SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = %d ORDER BY polla_aid ASC", $poll_id ) ); $poll_noquestion = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(polla_aid) FROM $wpdb->pollsa WHERE polla_qid = %d", $poll_id ) ); $poll_question_text = removeslashes($poll_question->pollq_question); $poll_totalvotes = intval($poll_question->pollq_totalvotes); $poll_timestamp = $poll_question->pollq_timestamp; $poll_active = intval($poll_question->pollq_active); $poll_expiry = trim($poll_question->pollq_expiry); $poll_multiple = intval($poll_question->pollq_multiple); $poll_totalvoters = intval($poll_question->pollq_totalvoters); ?>
'.removeslashes($text).'
'; } else { echo ''; } ?>

polla_aid); $polla_answers = removeslashes($poll_answer->polla_answers); $polla_votes = intval($poll_answer->polla_votes); $pollip_answers[$polla_aid] = $polla_answers; echo "\n"; echo ''."\n"; echo "\n"; echo '\n\n"; $poll_actual_totalvotes += $polla_votes; $i++; } } ?>
'.sprintf(__('Answer %s', 'wp-polls'), number_format_i18n($i)).'   "; echo "'.number_format_i18n($polla_votes)."
 
   


 

/>

     

get_results( "SELECT * FROM $wpdb->pollsq ORDER BY pollq_timestamp DESC" ); $total_ans = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->pollsa" ); $total_votes = 0; $total_voters = 0; ?>


pollq_id); $poll_question = removeslashes($poll->pollq_question); $poll_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll->pollq_timestamp)); $poll_totalvotes = intval($poll->pollq_totalvotes); $poll_totalvoters = intval($poll->pollq_totalvoters); $poll_active = intval($poll->pollq_active); $poll_expiry = trim($poll->pollq_expiry); if(empty($poll_expiry)) { $poll_expiry_text = __('No Expiry', 'wp-polls'); } else { $poll_expiry_text = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll_expiry)); } if($i%2 == 0) { $style = 'class="alternate"'; } else { $style = ''; } if($current_poll > 0) { if($current_poll == $poll_id) { $style = 'class="highlight"'; } } elseif($current_poll == 0) { if($poll_id == $latest_poll) { $style = 'class="highlight"'; } } else if(in_array($poll_id, $multiple_polls)) { $style = 'class="highlight"'; } echo "\n"; echo ''."\n"; echo '\n"; echo '\n"; echo "\n"; echo "\n"; echo '\n"; echo "\n"; echo "\n"; echo "\n"; echo ''; $i++; $total_votes+= $poll_totalvotes; $total_voters+= $poll_totalvoters; } } else { echo ''; } ?>
'.number_format_i18n($poll_id).''; if($current_poll > 0) { if($current_poll == $poll_id) { echo ''.__('Displayed:', 'wp-polls').' '; } } elseif($current_poll == 0) { if($poll_id == $latest_poll) { echo ''.__('Displayed:', 'wp-polls').' '; } } else if(in_array($poll_id, $multiple_polls)) { echo ''.__('Displayed:', 'wp-polls').' '; } echo wp_kses_post( $poll_question )."'.number_format_i18n($poll_totalvoters)."$poll_date$poll_expiry_text'; if($poll_active == 1) { _e('Open', 'wp-polls'); } elseif($poll_active == -1) { _e('Future', 'wp-polls'); } else { _e('Closed', 'wp-polls'); } echo "".__('Logs', 'wp-polls')."".__('Edit', 'wp-polls')."".__('Delete', 'wp-polls')."
'.__('No Polls Found', 'wp-polls').'

 


 


get_var( "SELECT COUNT(pollip_id) FROM $wpdb->pollsip" ) ); if($poll_ips > 0) { ?>