Index: file/file.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/file/file.module,v
retrieving revision 1.46
diff -p -u -r1.46 file.module
--- file/file.module	14 Dec 2006 07:43:04 -0000	1.46
+++ file/file.module	14 Dec 2006 22:24:17 -0000
@@ -329,7 +329,7 @@ function file_my_overview($expired = fal
   // Check 1: Grab all explicit file downloads
   $result = db_query('SELECT st.created, st.expires, stp.title, pf.size, pf.fpath FROM {ec_transaction} AS st, {users} AS u, {ec_product} AS p, {ec_product_file} AS pf, {ec_transaction_product} AS stp WHERE u.uid = st.uid AND st.uid = %d AND p.nid = stp.nid AND st.txnid = stp.txnid AND pf.nid = p.nid AND st.payment_status = 2'. tablesort_sql($header), $uid);
   while ($data = db_fetch_object($result)) {
-    $dload_link = t('<a href="%file-download-uri">download</a>', array('%file-download-uri' => ec_file_create_url($data->fpath)));
+    $dload_link = ec_file_create_link(t("download"), $data->fpath);
     if ($expired) {
       if (($data->created + $expired_length > $max_expired_date && !$data->expires) || ($data->expires && $data->expires < time())) {
         $time_left = (!$data->expires) ? time() - ($data->created + $expired_length) : time() - $data->expires;
@@ -359,7 +359,7 @@ function file_my_overview($expired = fal
       // of the product package. Grab the individual product title which is more userful.
       $data->node_title = $node->title;
 
-      $dload_link = t('<a href="%file-download-uri">download</a>', array('%file-download-uri' => ec_file_create_url($data->fpath)));
+      $dload_link = ec_file_create_link(t("download"), $data->fpath);
       if ($expired) {
         if (($data->created + $expired_length > $max_expired_date && !$data->expires) || ($data->expires && $data->expires < time())) {
           $time_left = (!$data->expires) ? time() - ($data->created + $expired_length) : time() - $data->expires;
@@ -417,6 +417,20 @@ function ec_file_create_url($path) {
 }
 
 /**
+ * Create a hyperlink to download the file.
+ *
+ * @param $text Text to place in the hyperlink
+ * @param $path Path to the file to generate URL for
+ * @return HTML fragment with a download link
+ */
+function ec_file_create_link($text, $path) {
+  $text_htmlsafe = check_plain($text);
+  $url = ec_file_create_url($path);
+  return "<a href=\"{$url}\">{$text_htmlsafe}</a>";
+}
+
+
+/**
  * Make sure the destination is a complete path and resides in the
  * file system directory, if it is not prepend the
  * file system directory.
