This repository has been archived on 2024-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
mybb-digest/email.php
2017-05-05 16:51:40 +07:00

63 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// forbidden: forbidden forums IDs
// skips over threads made by this user with 0 replies
function print_email($username, $unsubscription, $threads, $forbidden) {
$th_style = "padding: 0.5em; border: 1px solid #eee;";
$td_style = "padding: 0.5em; border: 1px solid #eee;";
$message = <<<END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<head>
<title>Daily digest from Olympic Business Forum</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 11pt;">
<p>$username,</p>
<p>Heres a daily update of activity on the Olympic Business forum.</p>
<p><table style="padding: 1em; border: 1px solid #eee;border-collapse: collapse;">
<thead>
<th style="$th_style">Forum</th>
<th style="$th_style">Thread</th>
<th style="$th_style">Started by</th>
<th style="$th_style">Replies</th>
<th style="$th_style">Last update</th>
</thead>
<tbody>
END;
foreach ($threads as $thread) {
if (in_array($thread['fid'], $forbidden))
continue;
if ($thread['replies'] === '0' && $thread['username'] === $username)
continue;
$message .= '
<tr>
<td style="'.$td_style.'">'.$thread['forumname'].'</td>
<td style="'.$td_style.'">'.$thread['subject'].'</td>
<td style="'.$td_style.'">'.
$thread['username'].', '.
date(DATE_FORMAT, $thread['dateline']).'
</td>
<td style="'.$td_style.'">'.$thread['replies'].'</td>
<td style="'.$td_style.'">'.
$thread['lastposter'].', '.
date(DATE_FORMAT, $thread['lastpost']).'
</td>
</tr>
';
}
$message .= <<<END
</tbody>
</table></p>
<p>Thank you,<br>
Olympic Business Forum Staff</p>
<p>To unsubscribe from these daily digests, click here: <a href="$unsubscription">$unsubscription</a></p>
</body>
</html>
END;
return $message;
} ?>