/[drupal]/contributions/modules/fivestar/fivestar.module
ViewVC logotype

Diff of /contributions/modules/fivestar/fivestar.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13.2.61, Tue Jun 30 23:58:17 2009 UTC revision 1.13.2.62, Wed Jul 1 00:33:49 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar.module,v 1.13.2.60 2009/06/30 23:47:32 quicksketch Exp $  // $Id: fivestar.module,v 1.13.2.61 2009/06/30 23:58:17 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 697  function fivestar_vote($type, $cid, $tag Line 697  function fivestar_vote($type, $cid, $tag
697      exit($output);      exit($output);
698    }    }
699    
700    $result = _fivestar_cast_vote($type, $cid, $value, $tag, NULL, TRUE);    _fivestar_cast_vote($type, $cid, $value, $tag, TRUE);
701    votingapi_recalculate_results($type, $cid);    votingapi_recalculate_results($type, $cid);
702      $result = fivestar_get_votes($type, $cid, $tag);
703    
704    if ($type == 'node') {    if ($type == 'node') {
705      $node = node_load($cid);      $node = node_load($cid);
# Line 741  function fivestar_vote($type, $cid, $tag Line 742  function fivestar_vote($type, $cid, $tag
742   * Internal function to handle vote casting, flood control, XSS, IP based   * Internal function to handle vote casting, flood control, XSS, IP based
743   * voting, etc...   * voting, etc...
744   */   */
745  function _fivestar_cast_vote($type, $cid, $value, $tag = NULL, $uid = NULL, $result = FALSE, $skip_validation = FALSE) {  function _fivestar_cast_vote($type, $cid, $value, $tag = NULL, $uid = NULL, $skip_validation = FALSE) {
746    global $user;    global $user;
747    $tag = empty($tag) ? 'vote' : $tag;    $tag = empty($tag) ? 'vote' : $tag;
748    $uid = empty($uid) ? $user->uid : $uid;    $uid = empty($uid) ? $user->uid : $uid;
# Line 765  function _fivestar_cast_vote($type, $cid Line 766  function _fivestar_cast_vote($type, $cid
766    
767      if ($value == 0) {      if ($value == 0) {
768        votingapi_delete_votes($user_votes);        votingapi_delete_votes($user_votes);
769          return $user_votes[0];
770      }      }
771      else {      else {
772        $votes = $criteria += array('value' => $value);        $votes = $criteria += array('value' => $value);
773        votingapi_set_votes($votes, $user_votes);        votingapi_set_votes($votes, $user_votes);
774          return $votes[0];
775      }      }
     return fivestar_get_votes($type, $cid, $tag, $uid);  
776    }    }
777    
778      return array();
779  }  }
780    
781  function fivestar_get_votes($type, $cid, $tag = 'vote', $uid = NULL) {  function fivestar_get_votes($type, $cid, $tag = 'vote', $uid = NULL) {

Legend:
Removed from v.1.13.2.61  
changed lines
  Added in v.1.13.2.62

  ViewVC Help
Powered by ViewVC 1.1.2