--- userpoints_reserve.module	Fri Jun 29 17:54:50 2007
+++ userpoints_reserve_new.module	Sun Jun 01 15:16:31 2008
@@ -31,6 +31,7 @@
           userpoints_translation(), array(
-          '!circulation' => number_format($total_points_in_circulation), 
-          '!reserve' => number_format($total_currency_in_reserve, 2),
-          '!exchange' => $exchange_rate,
-          ))),
+            '!circulation' => number_format($total_points_in_circulation), 
+            '!reserve' => number_format($total_currency_in_reserve, 2),
+            '!exchange' => $exchange_rate,
+          )
+        )),
         '#collapsible' => TRUE,
@@ -61,7 +62,11 @@
   $result = db_fetch_object(db_query("SELECT SUM(points) `total` FROM {userpoints};"));
-
+  
+  $total_points_in_circulation = $result->total;
+  $total_currency_in_reserve = variable_get(USERPOINTS_RESERVE_CURRENCY, USERPOINTS_RESERVE_CURRENCY_DEFAULT);
+  $exchange_rate = $total_currency_in_reserve / $total_points_in_circulation;
+  
   return array(
-    'total_points_in_circulation' => $total_points_in_circulation = $result->total,
-    'total_currency_in_reserve' => $total_currency_in_reserve = variable_get(USERPOINTS_RESERVE_CURRENCY, USERPOINTS_RESERVE_CURRENCY_DEFAULT),
-    'exchange_rate' => $total_currency_in_reserve>0? $total_currency_in_reserve / $total_points_in_circulation : 0,
+    'total_points_in_circulation' => $total_points_in_circulation,
+    'total_currency_in_reserve' => $total_currency_in_reserve,
+    'exchange_rate' => $exchange_rate,
   );
@@ -73,9 +78,12 @@
 function userpoints_reserve_block($op = 'list', $delta = 0, $edit = array()) {
+  $translation = userpoints_translation();
+  
   if ($op == 'list') {
     $blocks = array(
-      'userpoints-reserve' => array('info' => t('!Points Market', userpoints_translation()))
-      );
+      'userpoints-reserve' => array('info' => t('!Points Market', $translation))
+    );
+    
     return $blocks;
   }
-  else if ($op == 'view') {
+  elseif ($op == 'view') {
     extract(userpoints_reserve_stats());
@@ -83,12 +91,14 @@
     return array(
-      'subject' => t('!Points Market', userpoints_translation()),
-      'content' =>
-        t('<p><strong>Cash in Reserve:</strong> !reserve <br />
-        <p><strong>!Points in Circulation:</strong> !circulation <br />
-        <p><strong>Exchange Rate:</strong> 1:!exchange <br />',
+      'subject' => t('!Points Market', $translation),
+      'content' => t(
+        '<p><strong>Cash in Reserve:</strong> !reserve </p>
+        <p><strong>!Points in Circulation:</strong> !circulation </p>
+        <p><strong>Exchange Rate:</strong> 1:!exchange </p>',
         array_merge(array(
-        '!reserve' => number_format($total_currency_in_reserve, 2),
-        '!circulation' => number_format($total_points_in_circulation),
-        '!exchange' => round($exchange_rate, 3),
-        ), userpoints_translation()))
+          '!reserve' => number_format($total_currency_in_reserve, 2),
+          '!circulation' => number_format($total_points_in_circulation),
+          '!exchange' => round($exchange_rate, 3),
+        ),
+        $translation
+      ))
     );
