function listMessages() { include_once 'MaillogDao.class.php'; $dao = new MaillogDao(CodendiDataAccess::instance()); $dar = $dao->getAllMessages(); $nb = $dao->getNbMessages(); echo "<h1>List of emails sent by " . $GLOBALS['sys_name'] . "</h1>\n"; echo "<div style=\"text-align: center;\">Nb messages: " . $nb . "</div>\n"; echo "<form name=\"maillog\" method=\"post\" action=\"?\">\n"; echo "<p>\n"; echo "<input type=\"submit\" name=\"delete\" value=\"Delete\" />\n"; echo "</p>\n"; $hp = Codendi_HTMLPurifier::instance(); while ($dar->valid()) { $row = $dar->current(); $dar2 = $dao->getAllHeaders($row['id_message']); echo '<table class="table table-bordered table-striped"><tbody>'; while ($dar2->valid()) { $row2 = $dar2->current(); echo "<tr><th>" . $hp->purify($row2['name']) . ":</th><td>" . $hp->purify($row2['value']) . "</td></tr>"; $dar2->next(); } $input = preg_replace("/=\r?\n/", '', $row['html_body']); $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input); echo '<tr><th></th><td>'; var_dump(substr($input, 0, 400)); echo '</td></tr>'; echo "</table>\n"; $dar->next(); } echo "</form>"; }
function listMessages() { $dao = new MaillogDao(CodendiDataAccess::instance()); $dar = $dao->getAllMessages(); $nb = $dao->getNbMessages(); echo "<h1>List of emails sent by " . $GLOBALS['sys_name'] . "</h1>\n"; echo "<div style=\"text-align: center;\">Nb messages: " . $nb . "</div>\n"; echo "<form name=\"maillog\" method=\"post\" action=\"?\">\n"; echo "<p>\n"; echo "<input type=\"submit\" name=\"delete\" value=\"Delete\" />\n"; echo "</p>\n"; $hp =& Codendi_HTMLPurifier::instance(); while ($dar->valid()) { $row = $dar->current(); $dar2 = $dao->getAllHeaders($row['id_message']); echo "<div style=\"background-color: lightgrey;\">\n"; while ($dar2->valid()) { $row2 = $dar2->current(); echo "<strong>" . $hp->purify($row2['name']) . ":</strong> " . $hp->purify($row2['value']) . "<br>\n"; $dar2->next(); } echo "</div>\n"; echo '<div style="width: 80em; font-family: monospace; margin-bottom: 0.5em;">' . "\n"; echo $hp->purify($row['body'], CODENDI_PURIFIER_BASIC); echo "</div>\n"; $dar->next(); } echo "</form>"; }