? .DS_Store
? affiliates.507346.patch
? affiliates.507346_2.patch
? affiliates.patch
? tools
? translations/.DS_Store
Index: affiliates.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/affiliates/affiliates.module,v
retrieving revision 1.1.4.5.2.16
diff -r1.1.4.5.2.16 affiliates.module
23a24,26
> define('AFFILIATE_DENIED_URI_REFERRERS',          'affiliate_denied_uri_referrers');
> define('AFFILIATE_DENIED_IPS',                    'affiliate_denied_ips');
> define('AFFILIATE_DENIED_USERS',                  'affiliate_denied_users');
237a241,274
> 
>   $form['affiliates_settings']['spam'] = array(
>     '#type' => 'fieldset',
>     '#title' => t('Spam'),
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>  
>   $form['affiliates_settings']['spam'][AFFILIATE_DENIED_URI_REFERRERS] = array(
>     '#type' => 'textarea',
>     '#title' => t('Denied by referrer URI'),
>     '#default_value' => variable_get(AFFILIATE_DENIED_URI_REFERRERS,""),
>     '#size' => 70,
>     '#rows' => 4,
>     '#description' => t('List all referral URI that will not be allocated affiliate points'),
>   );	
> 
>   $form['affiliates_settings']['spam'][AFFILIATE_DENIED_IPS] = array(
>     '#type' => 'textarea',
>     '#title' => t('Denied by IP'),
>     '#default_value' => variable_get(AFFILIATE_DENIED_IPS,""),
>     '#size' => 70,
>     '#rows' => 4,
>     '#description' => t('List all IP that will not be allocated affiliate points'),
>   );
> 
>   $form['affiliates_settings']['spam'][AFFILIATE_DENIED_USERS] = array(
>     '#type' => 'textarea',
>     '#title' => t('Denied by User'),
>     '#default_value' => variable_get(AFFILIATE_DENIED_USERS,""),
>     '#size' => 70,
>     '#rows' => 4,
>     '#description' => t('List all users that will not be allocated affiliate points'),
>   );
929a967,985
> 
>         if (user_access('administer affiliates')) {
> 	      $result = db_query("SELECT DISTINCT referer 
> 		    FROM {affiliates} 
> 		    WHERE user_id = %d 
> 		    ORDER BY id DESC 
> 		    LIMIT 100", $account->uid);
> 		  while ($data = db_fetch_object($result)) {
> 		    $referrers .= $data->referer . "\n";	
> 		  } 
> 	      $referrers = array(
> 		    '#type' => 'textarea',
> 		    '#title' => t('Recent referrers'),
> 		    '#value' => $referrers,
> 		    '#size' => 70,
> 		    '#rows' => 4,
> 		  );
> 	      $account->content['Affiliates'][] = $referrers;
>         }
930a987,1014
> 	break;
> 	case 'form':
> 	  if (user_access('administer affiliates')) {
> 	    if ($category == 'account') {
> 	      $form['affiliates'] = array(
> 	        '#type' => 'fieldset',
> 	        '#title' => t('Affiliate settings'),
> 	        '#collapsible' => FALSE,
> 	        '#weight' => 4,
> 	        '#tree' => FALSE,
> 	      );
> 	      $form['affiliates']['delete_affiliate_points'] = array(
> 	        '#type' => 'checkbox',
> 	        '#title' => t('Delete affiliate points for this user'),
> 	        '#description' => t('To delete all affiliate points for this user, click this checkbox and then click the save button at the bottom of this page.'),
> 	      );
> 	      return $form;
> 	    }
>   	  }
> 	break;
> 	case 'update':
> 	  if ($edit['delete_affiliate_points']) {
> 		affiliates_delete_points($account->uid);
>       }
> 	break;
> 	case 'delete':
> 	  affiliates_delete_points($account->uid);
> 	break;
933a1018,1027
> function affiliates_delete_points($user_id) {
>   db_query('DELETE FROM {affiliates} WHERE user_id=%d', $user_id);
>   $affiliate_records_deleted = db_affected_rows();
>   if ($affiliate_records_deleted) {
>     //affiliate records deleted
>     $account = user_load(array('uid' => $user_id));
>     drupal_set_message(t("%username's affiliate records has been deleted.", array('%username' => $account->name)));
>   }	
> }
> 
1000a1095,1110
> function affiliates_click_denied() {
>   global $user;
>   $denied_users = explode(",", variable_get(AFFILIATE_DENIED_USERS,''));
>   if (in_array($user->name, $denied_users)) return TRUE;
>   $ip = ip_address();
>   $denied_ips = explode(",",  variable_get(AFFILIATE_DENIED_IPS,''));
>   if (in_array($ip, $denied_ips)) return TRUE;
>   $denied_uri_referrers = explode(",", variable_get(AFFILIATE_DENIED_URI_REFERRERS,'')); 
>   foreach ($denied_uri_referrers as $referrer) {
>     if (strstr($_SERVER['HTTP_REFERER'], $referrer)) return TRUE;
>   }
>   $timeout_flag = _check_timeout_query();
>   if ($timeout_flag) return TRUE; 
>   return FALSE;	
> }
> 
1008c1118
<   $timeout_flag = _check_timeout_query();
---
>   $affiliates_click_denied = affiliates_click_denied();  
1014c1124
<   if ((!$timeout_flag) && user_access('affiliate click')) {
---
>   if ((!$affiliates_click_denied) && user_access('affiliate click')) {
