*************** *** 341,368 **** } else { if (drupal_valid_token($_POST['token'], $content_type .'/'. $content_id)) { - $criteria = array( - 'content_type' => $content_type, - 'content_id' => $content_id, - 'value_type' => 'mark', - 'value' => 1, - 'tag' => $mark->name, - ); - - if (mark_is_set($mark->name, $content_type, $content_id)) { - if (!$mark->settings['global']) { - global $user; - $criteria['uid'] = $user->uid; - } - $votes = array(); - votingapi_set_votes($votes, $criteria); - $msg = $mark->settings['unmark_confirm_text']; - } - else { - $votes = array($criteria); - votingapi_set_votes($votes); - $msg = $mark->settings['mark_confirm_text']; - } return drupal_json(array( 'markup' => theme('mark_link', array($mark->name => array( 'mark' => $mark, --- 484,490 ---- } else { if (drupal_valid_token($_POST['token'], $content_type .'/'. $content_id)) { + list ($msg, $criteria) = mark_vote_process($mark, $content_type, $content_id); return drupal_json(array( 'markup' => theme('mark_link', array($mark->name => array( 'mark' => $mark,