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

64 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2017-05-04 09:39:07 +03:00
<?php
2017-05-04 15:29:29 +03:00
// forbidden: forbidden forums IDs
// skips over threads made by this user with 0 replies
function print_email($username, $unsubscription, $threads, $forbidden, $url) {
2017-05-09 12:34:36 +03:00
$th_style = "font-family: Arial, Helvetica, sans-serif;padding: 0.5em; border: 1px solid #eee;";
$td_style = "font-family: Arial, Helvetica, sans-serif;padding: 0.5em; border: 1px solid #eee;";
2017-05-04 12:16:16 +03:00
$message = <<<END
2017-05-04 09:39:07 +03:00
<!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>
2017-05-04 15:03:34 +03:00
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 11pt;">
2017-05-04 12:16:16 +03:00
<p>$username,</p>
2017-05-04 09:39:07 +03:00
<p>Heres a daily update of activity on the Olympic Business forum.</p>
2017-05-05 12:51:40 +03:00
<p><table style="padding: 1em; border: 1px solid #eee;border-collapse: collapse;">
2017-05-04 09:39:07 +03:00
<thead>
2017-05-05 12:51:40 +03:00
<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>
2017-05-04 09:39:07 +03:00
</thead>
<tbody>
2017-05-04 12:16:16 +03:00
END;
foreach ($threads as $thread) {
2017-05-04 15:29:29 +03:00
if (in_array($thread['fid'], $forbidden))
continue;
if ($thread['replies'] === '0' && $thread['username'] === $username)
continue;
$lastupdate = $thread['lastposter'].', '.date(DATE_FORMAT, $thread['lastpost']);
if ($thread['replies'] === '0') {
$lastupdate = '&nbsp;';
}
2017-05-04 12:16:16 +03:00
$message .= '
2017-05-04 09:39:07 +03:00
<tr>
2017-05-05 12:51:40 +03:00
<td style="'.$td_style.'">'.$thread['forumname'].'</td>
<td style="'.$td_style.'"><a href="'.$url.'/showthread.php?tid='.$thread['tid'].'">'.$thread['subject'].'</a></td>
2017-05-05 12:51:40 +03:00
<td style="'.$td_style.'">'.
2017-05-04 12:16:16 +03:00
$thread['username'].', '.
2017-05-04 15:03:34 +03:00
date(DATE_FORMAT, $thread['dateline']).'
2017-05-04 09:39:07 +03:00
</td>
2017-05-05 12:51:40 +03:00
<td style="'.$td_style.'">'.$thread['replies'].'</td>
<td style="'.$td_style.'">'.$lastupdate.'</td>
2017-05-04 09:39:07 +03:00
</tr>
2017-05-04 12:16:16 +03:00
';
}
$message .= <<<END
2017-05-04 09:39:07 +03:00
</tbody>
</table></p>
<p>Thank you,<br>
Olympic Business Forum Staff</p>
2017-05-09 12:34:36 +03:00
<p>To unsubscribe from these daily digests, <a href="$unsubscription">click here.</a></p>
2017-05-04 09:39:07 +03:00
</body>
</html>
2017-05-04 12:16:16 +03:00
END;
return $message;
} ?>