Пример #1
0
                  SET  handler = {?}
                WHERE  handler IS NULL
             ORDER BY  ts
             LIMIT  1', $handler);
 if (XDB::affectedRows() == 0) {
     break;
 }
 $query = XDB::query('SELECT  uid, ml, domain, mid, action, message
                        FROM  email_list_moderate
                       WHERE  handler = {?}', $handler);
 list($uid, $list, $domain, $mid, $action, $reason) = $query->fetchOneRow();
 $user = User::get($uid);
 $fullname = $user->fullName();
 $mlist = new MailingList($list, $domain, $user);
 // send the mail
 $mail = $mlist->getPendingMail($mid);
 list($det, $mem, $own) = $mlist->getMembers();
 $count = 0;
 switch ($action) {
     case 'accept':
         $action = MailingList::REQ_ACCEPT;
         $subject = "Message accepté";
         $append = "a été accepté par {$fullname}.\n";
         $type = 'nonspam';
         $count += count($mem) + count($own);
         break;
     case 'refuse':
         $action = MailingList::REQ_REJECT;
         $subject = "Message refusé";
         $append = "a été refusé par {$fullname} avec la raison :\n\n" . $reason;
         $type = 'nonspam';