3c3 < // With Patches to allow anonymous vote --- > 142c142 < '#title' => t('URL where anonymous users will be directed to when they try to vote. If equal anonymous_vote, anonymous user will be allow to vote. If blank, people will be directed to user/login'), --- > '#title' => t('URL where anonymous users will be directed to when they try to vote. If blank, people will be directed to user/login'), 577,578c577 < //$result = db_result(db_query("SELECT COUNT(*) AS count FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", $account->uid, 'points', 'vote', $limit_every)); < $result = db_result(db_query("SELECT COUNT(*) AS count FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", _extra_voting_forms_get_uid(), 'points', 'vote', $limit_every)); --- > $result = db_result(db_query("SELECT COUNT(*) AS count FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", $account->uid, 'points', 'vote', $limit_every)); 621,622c620 < //$result = db_result(db_query("SELECT SUM(abs(value)) FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", $account->uid, 'points', 'vote', $total_every)); < $result = db_result(db_query("SELECT SUM(abs(value)) FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", _extra_voting_forms_get_uid(), 'points', 'vote', $total_every)); --- > $result = db_result(db_query("SELECT SUM(abs(value)) FROM {votingapi_vote} WHERE uid = %d AND value_type = '%s' AND tag = '%s' AND timestamp > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - %d", $account->uid, 'points', 'vote', $total_every)); 738,739c736 < // if ($form_type != 'ajax' && $user->uid == 0) { < if ($form_type != 'ajax' && _extra_voting_forms_get_uid() == 0) { --- > if ($form_type != 'ajax' && $user->uid == 0) { 778,782c775,778 < < #if ($account->uid == 0) { < # return array( t("Only logged in users can vote!"), 0 ); < #} < --- > if ($account->uid == 0) { > return array( t("Only logged in users can vote!"), 0 ); > } > 792,793c788 < //if ($o->sk_type == 'c' && $account->uid == $o->uid && $account->uid != 1 & ! user_access('voting administrator', $account)) { < if ($o->sk_type == 'c' && _extra_voting_forms_get_uid() == $o->uid && _extra_voting_forms_get_uid() != 1 && ! user_access('voting administrator', $account)) { --- > if ($o->sk_type == 'c' && $account->uid == $o->uid && $account->uid != 1 & ! user_access('voting administrator', $account)) { 829,830c824 < //$criteria['uid'] = $account->uid; < $criteria['uid'] = _extra_voting_forms_get_uid(); --- > $criteria['uid'] = $account->uid; 873,874c867 < //$votes['uid'] = $account->uid; < $votes['uid'] = _extra_voting_forms_get_uid(); --- > $votes['uid'] = $account->uid; 892,914d884 < function _extra_voting_forms_get_uid() { < global $user; < $anounymous_url = variable_get('extra_voting_forms_anonymous_url', ''); < < if ($user->uid) { < $uid = $user->uid; < } < else if($anounymous_url == 'anonymous_vote') { < // Fake uid for anonymous users. < // If the IP is valid turn it into a integer and add the number of the current day. < // The current day is what limit anonymous voting to one vote per day and IP address. < $hostname = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ip_address(); < if ($long = ip2long($hostname)) { < $uid = abs($long) + date('z'); < } < } < else { < $uid = NULL; < } < < return $uid; < } < 1123,1124c1093 < //if ($o->sk_type == 'c' && $user->uid == $o->uid && $user->uid != 1 && ! user_access('voting administrator')) { < if ($o->sk_type == 'c' && _extra_voting_forms_get_uid() == $o->uid && _extra_voting_forms_get_uid() != 1 && ! user_access('voting administrator')) { --- > if ($o->sk_type == 'c' && $user->uid == $o->uid && $user->uid != 1 && ! user_access('voting administrator')) { 1137,1138c1106 < //$criteria['uid'] = $user->uid; < $criteria['uid'] = _extra_voting_forms_get_uid(); --- > $criteria['uid'] = $user->uid; 1159,1160c1127 < //if ($user->uid == 0) { < if (_extra_voting_forms_get_uid() == 0) { --- > if ($user->uid == 0) {