Projet

Général

Profil

Révision b858700c

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/fivestar/fivestar.module
162 162
    // Get the user's current vote.
163 163
    $criteria = array('entity_type' => $entity_type, 'entity_id' => $id, 'tag' => $tag, 'uid' => $uid);
164 164
    // Get the unique identifier for the user (IP Address if anonymous).
165
    
165

  
166 166
    if ($vote_source != NULL) {
167 167
      $user_criteria = array('vote_source' => $vote_source);
168 168
      $limit = 1;
......
953 953
function _fivestar_allow_vote($element) {
954 954
  global $user;
955 955

  
956
  // check allowed to re-vote
956
  // Check allowed to re-vote.
957 957
  $can_revote = FALSE;
958 958
  if ($element['#allow_revote']) {
959 959
    $can_revote = TRUE;
......
970 970
  if (!$can_revote) {
971 971
    return FALSE;
972 972
  }
973
  // check allowed own vote
973
  // Check allowed own vote.
974 974
  if ($element['#allow_ownvote']) {
975 975
    return TRUE;
976 976
  }
977
  else {
978
    $entity_id = $element['#settings']['entity_id'];
979
    //$entity = entity_load($element['#settings']['entity_type'], array($element['#settings']['entity_id']));
980
    $entity = entity_load($element['#settings']['entity_type'], array($entity_id));
981
    $entity = $entity[$entity_id];
982
    $uid1 = $entity->uid;
983
    $uid2 = $user->uid;
984
    return $entity->uid != $user->uid;
977
  // Check that we have entity details, allow if not.
978
  if (!isset($element['#settings']['entity_id']) || !isset($element['#settings']['entity_type'])) {
979
    return TRUE;
985 980
  }
981
  $entity_id = $element['#settings']['entity_id'];
982
  $entity = entity_load($element['#settings']['entity_type'], array($entity_id));
983
  $entity = $entity[$entity_id];
984
  $uid1 = $entity->uid;
985
  $uid2 = $user->uid;
986
  return $entity->uid != $user->uid;
986 987
}

Formats disponibles : Unified diff