- Hyperlinks in the digest - No deleted, closed or moved threads in the digest - No "Last update" column for threads with 0 replies - Changed date format to 17/05/2017 - Set the timzeone explicitly
64 lines
2.3 KiB
PHP
64 lines
2.3 KiB
PHP
<?php
|
||
// forbidden: forbidden forums IDs
|
||
// skips over threads made by this user with 0 replies
|
||
function print_email($username, $unsubscription, $threads, $forbidden, $url) {
|
||
$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;";
|
||
$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>Here’s 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;
|
||
$lastupdate = $thread['lastposter'].', '.date(DATE_FORMAT, $thread['lastpost']);
|
||
if ($thread['replies'] === '0') {
|
||
$lastupdate = ' ';
|
||
}
|
||
$message .= '
|
||
<tr>
|
||
<td style="'.$td_style.'">'.$thread['forumname'].'</td>
|
||
<td style="'.$td_style.'"><a href="'.$url.'/showthread.php?tid='.$thread['tid'].'">'.$thread['subject'].'</a></td>
|
||
<td style="'.$td_style.'">'.
|
||
$thread['username'].', '.
|
||
date(DATE_FORMAT, $thread['dateline']).'
|
||
</td>
|
||
<td style="'.$td_style.'">'.$thread['replies'].'</td>
|
||
<td style="'.$td_style.'">'.$lastupdate.'</td>
|
||
</tr>
|
||
';
|
||
}
|
||
$message .= <<<END
|
||
</tbody>
|
||
</table></p>
|
||
|
||
<p>Thank you,<br>
|
||
Olympic Business Forum Staff</p>
|
||
|
||
<p>To unsubscribe from these daily digests, <a href="$unsubscription">click here.</a></p>
|
||
</body>
|
||
</html>
|
||
END;
|
||
return $message;
|
||
} ?>
|