#!/usr/bin/env php email_addr\n"; } function send_notify_emails() { $t = time() - (86400 + 3600); // 1-hour slop factor $query = "select notify.* from DBNAME.notify, DBNAME.forum_preferences where forum_preferences.pm_notification=2 and notify.userid = forum_preferences.userid and notify.create_time > $t"; $notifies = BoincNotify::enum_general($query); $userid = 0; $message = ""; $i = 1; foreach ($notifies as $notify) { if ($userid && $notify->userid != $userid) { send_notify_email($userid, $message); $message = ""; $i = 1; } $userid = $notify->userid; $message .= "$i) "; switch ($notify->type) { case NOTIFY_FRIEND_REQ: $message .= friend_notify_req_email_line($notify); break; case NOTIFY_FRIEND_ACCEPT: $message .= friend_notify_accept_email_line($notify); break; case NOTIFY_PM: $message .= pm_email_line($notify); break; case NOTIFY_SUBSCRIBED_POST: $message .= subscribed_post_email_line($notify); break; } $message .= "\n"; $i++; } if ($userid) { send_notify_email($userid, $message); } } $t = time_str(time()); echo "Starting at $t\n"; delete_old_notifies(); send_notify_emails(); $t = time_str(time()); echo "Ending at $t\n\n"; ?>