'; // submission? if (isset($_POST['subaction'])) { // delete? if (($_POST['subaction'] == 'Delete Log Entries') && isset($_POST['logids']) && is_array($_POST['logids']) && !empty($_POST['logids'])) { foreach ($_POST['logids'] as $id) { if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_LOG . "` WHERE `logid`='" . safeSQLstr($id) . "' LIMIT 1") ) { print '

Failed to delete Log ID ' . safeHTMLstr($id) . '

'; } } } elseif (($_POST['subaction'] == 'Delete Messages') && isset($_POST['queueids']) && is_array($_POST['queueids']) && !empty($_POST['queueids'])) { foreach ($_POST['queueids'] as $id) { if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `id`='" . safeSQLstr($id) . "' LIMIT 1") ) { print '

Failed to delete Message ID ' . safeHTMLstr($id) . '

'; } } } // search if (isset($_POST['q']) && !empty($_POST['q'])) { // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } print '


Log Entries:
'; // log $r = ocsql_query("SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE " . ((isset($_POST['type']) && !empty($_POST['type'])) ? ("`type`='" . safeSQLstr($_POST['type']) . "' AND ") : "") . "(`entry` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `extra` LIKE '%" . safeSQLstr($_POST['q']) . "%') ORDER BY `datetime` DESC, `logid` DESC") or err('Unable to search log'); if (ocsql_num_rows($r) > 0) { print ' '; $row = 1; while ($l = ocsql_fetch_assoc($r)) { print ''; if ($row == 1) { $row = 2; } else { $row = 1; } } print '
Log IDDate / Time (UTC)TypeEntry
' . safeHTMLstr($l['logid']) . '' . safeHTMLstr($l['datetime']) . '' . safeHTMLstr($l['type']) . '' . safeHTMLstr(substr($l['entry'], 0, 80)) . ((strlen($l['entry']) > 80) ? '…' : '') . '
'; } else { print '

No log entries found

'; } // queue if (isset($_POST['checkqueue']) && ($_POST['checkqueue'] == 1)) { print '


Messages:
'; $r = ocsql_query("SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE (`to` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `subject` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `body` LIKE '%" . safeSQLstr($_POST['q']) . "%') ORDER BY `queued` DESC") or err('Unable to search messages'); if (ocsql_num_rows($r) > 0) { print ' '; $row = 1; while ($l = ocsql_fetch_assoc($r)) { print ''; if ($row == 1) { $row = 2; } else { $row = 1; } } print '
Msg IDQueued (UTC)ToSubject
' . safeHTMLstr($l['id']) . '' . safeHTMLstr($l['queued']) . '' . safeHTMLstr($l['to']) . '' . safeHTMLstr(substr($l['subject'], 0, 80)) . ((strlen($l['subject']) > 80) ? '…' : '') . '
'; } else { print '

No messages found

'; } } } } print '
'; printFooter(); ?>