Index: userpoints.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/userpoints.module,v
retrieving revision 1.67.2.48
diff -u -F^f -r1.67.2.48 userpoints.module
--- userpoints.module	21 Oct 2009 17:55:23 -0000	1.67.2.48
+++ userpoints.module	22 Oct 2009 15:41:53 -0000
@@ -179,8 +179,8 @@ function userpoints_access_my_points() {
     return TRUE;
   }
   return ( _userpoints_user_exists($user->uid) && 
-					((user_access(USERPOINTS_PERM_VIEW) && user_is_logged_in()) || user_access(USERPOINTS_PERM_VIEW_OWN)) 
-				 );
+          ((user_access(USERPOINTS_PERM_VIEW) && user_is_logged_in()) || user_access(USERPOINTS_PERM_VIEW_OWN)) 
+         );
 }
 
 /**
@@ -204,8 +204,8 @@ function userpoints_theme() {
         )
       ),
     'userpoints_list_users_header' => array(
-	    'arguments' => array()
-	   ),
+      'arguments' => array()
+     ),
     'userpoints_list_users_row' => array(
       'arguments' => array(
         'row' => NULL,
@@ -360,7 +360,7 @@ function userpoints_admin_settings() {
                          be placed on the entry. This is useful so the users will
                          know what happened to their !point balance. In crafting
                          your message you can use the following variables.',
- 												 userpoints_translation()). t('
+                          userpoints_translation()). t('
                          <br /> !points = The name used in branding 
                          above (also use !Points and !point)'). t('
                          <br /> !operation = Original operation that granted the !points
@@ -441,13 +441,13 @@ function userpoints_admin_settings() {
     $options = userpoints_get_categories(); 
     //$options doesn't include all so we'll add it
     $options['all'] = t('All categories');
-	  $form[$group][USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID] = array(
-	    '#type' => 'select',
-	    '#title' => t('Category to display on the user profile page'),
-	    '#default_value' => variable_get(USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID, NULL),
-	    '#options' =>  $options,
-	    '#description' => t('Select which category of !points to display on the user profile page. Select "All" to display a sum total of all categories', userpoints_translation()),
-	  );
+    $form[$group][USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID] = array(
+      '#type' => 'select',
+      '#title' => t('Category to display on the user profile page'),
+      '#default_value' => variable_get(USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID, NULL),
+      '#options' =>  $options,
+      '#description' => t('Select which category of !points to display on the user profile page. Select "All" to display a sum total of all categories', userpoints_translation()),
+    );
   }
   // New configuration options to overide current timestamp
   $group = "stamping";
@@ -719,7 +719,7 @@ function _userpoints_transaction(&$param
       }
     }
     if (isset($params['expirydate']) && !is_numeric($params['expirydate'])) {
-      return false;	
+      return false;  
     }
 
     // check if parameters are set
@@ -875,7 +875,7 @@ function _userpoints_user_exists($uid, $
  *
  */
 function userpoints_user($op, &$edit, &$account, $category = '') {
-	global $user;
+  global $user;
   switch ($op) {
     case 'delete':
       // The user is being deleted, delete all traces in userpoints and txn tables
@@ -887,12 +887,12 @@ function userpoints_user($op, &$edit, &$
       if (user_access(USERPOINTS_PERM_VIEW) || (user_access(USERPOINTS_PERM_VIEW_OWN) && $user->uid == $account->uid )) {
         $details = null;
         if (userpoints_access_my_points()) {
-		  		$details .= l(t('View'), 'myuserpoints/'. $account->uid, array('attributes' => array('title' => t('View detailed transactions'))));
-	    	}
+          $details .= l(t('View'), 'myuserpoints/'. $account->uid, array('attributes' => array('title' => t('View detailed transactions'))));
+        }
         if (user_access(USERPOINTS_PERM_ADMIN)) {
-	        if (!is_null($details)) {
-						$details .= ', ';
-					}
+          if (!is_null($details)) {
+            $details .= ', ';
+          }
           $details .= l(t('Adjust'), 'admin/user/userpoints/add/'. $account->uid, array('attributes' => array('title' => t('Add/substract !points from this user', userpoints_translation()))));
         }
 
@@ -902,12 +902,12 @@ function userpoints_user($op, &$edit, &$
         $account->content['userpoints'] = array(
           '#type' => 'user_profile_category',
           '#title' => t('User !points', userpoints_translation()),
-				);
-				$account->content['userpoints']['points'] = array(
-		  		'#type' => 'user_profile_item',
-		  		'#title' => t('!Points', userpoints_translation()),
-		  		'#value' => $details ? $points .' - '. $details : $points,
-				);
+        );
+        $account->content['userpoints']['points'] = array(
+          '#type' => 'user_profile_item',
+          '#title' => t('!Points', userpoints_translation()),
+          '#value' => $details ? $points .' - '. $details : $points,
+        );
       }
       break;
   }
@@ -1663,18 +1663,19 @@ function userpoints_cron() {
  * no URL argument returns current user otherwise accepts uid. 
  */
 function userpoints_list_my_userpoints() {
-  $overall_total = 0;
-  $unapproved_total = 0;
-  $approved_total = 0;
-
   global $user;
 
+  // Anonymous user, nothing to see for them
+  if (!$user->uid) {
+    return;
+  }
+
   // User which are displaying points for
   $uid = (int)arg(1);
   if ($uid) {
     if ($uid != $user->uid) {
       // If not the same as logged in user
-		  drupal_access_denied();
+      drupal_access_denied();
       return;
     }
   }
@@ -1682,21 +1683,19 @@ function userpoints_list_my_userpoints()
     // Default to currently logged in user
     $uid = $user->uid;
   }
-  $point_user = user_load(array('uid' => $uid));
 
-  // Check permissions
-  if(!user_access(USERPOINTS_PERM_VIEW)) {
-    // User has no access to view points
-		drupal_access_denied();
-    return;
-  }
+  $point_user = user_load(array('uid' => $uid));
 
   if (!user_access(USERPOINTS_PERM_VIEW_OWN)) {
     // User has no access to view own points
-		drupal_access_denied();
+    drupal_access_denied();
     return;
   } 
-		
+    
+  $overall_total = 0;
+  $unapproved_total = 0;
+  $approved_total = 0;
+
   $title = t('!Points for ', userpoints_translation()) . check_plain($point_user->name);
   drupal_set_title($title);
 
@@ -1797,11 +1796,11 @@ function userpoints_list_my_userpoints()
         array('data' => $row->cat),
         array('data' => $description),
     );
-  	if ($num_rows <= 0) {
-    	$rows[] = array(
+    if ($num_rows <= 0) {
+      $rows[] = array(
           array('data' => t('No !Points earned', userpoints_translation()), 'colspan' => 5, 'align' => 'center')
-    			);
-  	}
+          );
+    }
   }
   return theme('userpoints_list_my_userpoints', $args, $header, $rows);
 }
@@ -1811,9 +1810,9 @@ function userpoints_list_my_userpoints()
  *  if no vocab exists it will create one
  */
 function userpoints_get_vid() {
-	if (!module_exists('taxonomy')) {
+  if (!module_exists('taxonomy')) {
     return false;
-	}
+  }
   //code lovingly inspired by the image.module w/ code by drewish
   $vid = variable_get(USERPOINTS_CATEGORY_DEFAULT_VID, '');
   if (empty($vid) || !taxonomy_vocabulary_load($vid)) {
