? .DS_Store
? extractor.php
? po/.DS_Store
? po/svInstall.po
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/postcard/CHANGELOG.txt,v
retrieving revision 1.10.2.3
diff -u -p -r1.10.2.3 CHANGELOG.txt
--- CHANGELOG.txt	4 Apr 2007 14:49:34 -0000	1.10.2.3
+++ CHANGELOG.txt	10 Apr 2007 00:22:07 -0000
@@ -1,5 +1,8 @@
 $Id: CHANGELOG.txt,v 1.10.2.3 2007/04/04 14:49:34 add1sun Exp $
 
+* 09-Apr-2007
+Added hook_cron and admin setting to auto delete postcards after x days
+
 * 04-Apr-2007
 Added ability to copy yourself when sending a postcard based on work by mgifford and lufthans (#128909)
 
Index: postcard.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/postcard/postcard.install,v
retrieving revision 1.2.2.2
diff -u -p -r1.2.2.2 postcard.install
--- postcard.install	22 Feb 2007 14:15:44 -0000	1.2.2.2
+++ postcard.install	10 Apr 2007 00:22:07 -0000
@@ -45,6 +45,7 @@ function postcard_install() {
 
   // set our default variables so the email will work without a visit to settings
   variable_set('postcard_term', '0');
+  variable_set('postcard_cron', '0');
   variable_set('postcard_subject', 'Postcard from %site');
   variable_set('postcard_letter', "Dear %recipient!\n\n%sender made an e-postcard for you.\nAt any time you may see your card by clicking this link:\n\n%card_url\n\n(if your email client doesn't allow you to click on the site link,\nthen just copy and paste the URL into your browser)\n\nAny complaints about this e-postcard service please send to %site_mail\n\n-- \nThis postcard was sent through %site");
   variable_set('postcard_help', '');
@@ -56,8 +57,17 @@ function postcard_install() {
 function postcard_uninstall() {
   db_query('DROP TABLE {postcard}');
   variable_del('postcard_term');
+  variable_del('postcard_cron');
   variable_del('postcard_subject');
   variable_del('postcard_letter');
   variable_del('postcard_help');
 }
-?>
\ No newline at end of file
+
+/**
+ * Implementation of hook_update().
+ **/
+function postcard_update_1() {
+  variable_set('postcard_cron', '0');
+  // this is needed so update doesn't freak out
+  return array();
+}
\ No newline at end of file
Index: postcard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/postcard/postcard.module,v
retrieving revision 1.23.2.8
diff -u -p -r1.23.2.8 postcard.module
--- postcard.module	4 Apr 2007 23:22:18 -0000	1.23.2.8
+++ postcard.module	10 Apr 2007 00:22:07 -0000
@@ -6,7 +6,6 @@
  *  Allows the creation of postcards (image + text) and sends a link by email.
  *
  * @todo
- *  - Make sure $letter and $sender variables are set (warn or set on install)
  *  - Allow multiselect for galleries
  *  - Allow admin to pick picture size for creation and display
  *  - Give admin/user a link to all postcards sent
@@ -76,7 +75,7 @@ function postcard_admin_settings() {
     foreach (taxonomy_get_tree(_image_gallery_get_vid()) as $term) {
      $terms[$term->tid] = str_repeat('--', $term->depth) . $term->name;
     }
-    // @todo: allow multiselect
+    // TODO: allow multiselect
     $form['main']['postcard_term'] = array(
       '#type' => 'select',
       '#multiple' => false,
@@ -111,6 +110,13 @@ function postcard_admin_settings() {
     '#type' => 'fieldset',
     '#title' => t('Miscellaneous settings'),
   );
+  $form['misc']['postcard_cron'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Days to keep postcards'),
+    '#description' => t('Postcards that are aged more than the number of days entered above will automatically be deleted from the database. Use 0 to never delete. Note that this will only be checked when cron.php is run.'),
+    '#size' => '2',
+    '#default_value' => variable_get('postcard_cron', '0'),
+  );
   $form['misc']['postcard_help'] = array(
     '#type' => 'textarea',
     '#title' => t('Explanation or submission guidelines'),
@@ -387,6 +393,17 @@ function postcard_create_form_submit($fo
   drupal_goto('postcard');
 }
 
+/**
+ * Implementation of hook_cron().
+ **/
+function postcard_cron() {
+  // convert cron days into timestamp
+  $postcard_cron = variable_get('postcard_cron', '0') * 86400;
+  // delete postcards older than setting
+  if (!empty($postcard_cron)) {
+  db_query('DELETE FROM {postcard} WHERE send_time < %d', time() - $postcard_cron);
+  }
+}
 
 /**
  * Theme a gallery page (taken from theme_image_gallery)
