DataObjects/Core_notify.php
[Pman.Core] / NotifySend.php
index 91d2e70..0bf879e 100644 (file)
@@ -98,7 +98,8 @@ class Pman_Core_NotifySend extends Pman
             print_r($w);
         }
         
-        $sent = preg_match('/^0000/', $w->sent) ? false : true;
+        $sent = (empty($w->sent) || preg_match('/^0000/', $w->sent)) ? false : true;
+        
         if (!$force && (!empty($w->msgid) || $sent)) {
             $ww = clone($w);
             if (!$sent) { 
@@ -108,7 +109,6 @@ class Pman_Core_NotifySend extends Pman
             die("message has been sent already.\n");
         }
         
-        
         $o = $w->object();
         
         if ($o === false)  {
@@ -155,7 +155,6 @@ class Pman_Core_NotifySend extends Pman
         $l->orderBy('sent DESC');
         $l->limit(1);
         $ar = $l->fetchAll('sent');
-        print_r($l->tableName());
         $last = empty($ar) ? date('Y-m-d H:i:s', 0) : $ar[0];
         
         // find last event..
@@ -175,7 +174,6 @@ class Pman_Core_NotifySend extends Pman
         // this may modify $p->email. (it will not update it though)
         $email =  $this->makeEmail($o, $p, $last, $w, $force);
         
-        
         if ($email === true)  {
             
             $ev = $this->addEvent('NOTIFY', $w,
@@ -260,7 +258,6 @@ class Pman_Core_NotifySend extends Pman
         $mxs = $this->mxs($dom);
         $ww = clone($w);
 
-        
         if ($mxs === false) {
             $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - ". $p->email );
             $w->sent = date('Y-m-d H:i:s');
@@ -288,7 +285,7 @@ class Pman_Core_NotifySend extends Pman
             // older that 1 day.
             $retry = 120;
         }
-        if (strtotime($w->act_start) <  strtotime('NOW - 14 DAY')) {
+        if (!$force && strtotime($w->act_start) <  strtotime('NOW - 14 DAY')) {
             $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - ". $p->email );
             $w->sent = date('Y-m-d H:i:s');
             $w->msgid = '';