poll_vote($form, &$form_state)Submit handler for processing a vote.
modules/poll/poll.module, line 712
<?php
function poll_vote($form, &$form_state) {
$node = $form['#node'];
$choice = $form_state['values']['choice'];
global $user;
db_insert('poll_vote')
->fields(array(
'nid' => $node->nid,
'chid' => $choice,
'uid' => $user->uid,
'hostname' => $user->uid ? '' : ip_address(),
'timestamp' => REQUEST_TIME,
))
->execute();
// Add one to the votes.
db_update('poll_choice')
->expression('chvotes', 'chvotes + 1')
->condition('chid', $choice)
->execute();
cache_clear_all();
drupal_set_message(t('Your vote was recorded.'));
// Return the user to whatever page they voted from.
}
?>