';
// Set tzo if possible
?>
';
if ((isset($_SESSION['theme'])) && file_exists($rootdir . '/common/themes/' . $do_theme . '/images/rocksolidlight.png')) {
$header_image = $rootdir . '/common/themes/' . $do_theme . '/images/rocksolidlight.png';
} else {
$header_image = $rootdir . 'common/images/rocksolidlight.png';
}
echo '
';
?>
';
include ($config_dir . '/fortunes.conf');
// If $config_dir/motd.txt is not blank, show it
if (file_exists($config_dir . '/motd.txt')) {
$motd = file_get_contents($config_dir . '/motd.txt');
}
// If specific -motd.txt exists, use it
if (file_exists($config_dir . '/' . $config_name . '-motd.txt')) {
$motd = file_get_contents($config_dir . '/' . $config_name . '-motd.txt');
}
echo '';
$config_name = basename(getcwd());
if (!isset($OVERRIDES['disable_msgid_search']) || $OVERRIDES['disable_msgid_search'] == false) {
if ($config_name != "common" && $config_name != 'spoolnews') {
echo '
';
}
}
// Soup...Uh, Message of the Day
if ($unread) {
$motd = '*** You have unread mail. Click Here ***';
}
echo '' . $motd . '
';
function check_unread_mail()
{
global $CONFIG, $spooldir;
if (isset($_COOKIE['mail_name'])) {
$name = strtolower($_COOKIE['mail_name']);
$database = $spooldir . '/mail.db3';
if (is_file($database)) {
$dbh = head_mail_db_open($database);
$query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to');
$query->execute([
'rcpt_to' => $name
]);
$newmail = false;
while (($row = $query->fetch()) !== false) {
if (($row['rcpt_viewed'] != 'true') && ($row['to_hide'] != 'true')) {
$newmail = true;
}
}
$dbh = null;
return $newmail;
} else {
return false;
}
}
}
function head_mail_db_open($database, $table = 'messages')
{
try {
$dbh = new PDO('sqlite:' . $database);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
exit();
}
$dbh->exec("CREATE TABLE IF NOT EXISTS messages(
id INTEGER PRIMARY KEY,
msgid TEXT UNIQUE,
mail_from TEXT,
mail_viewed TEXT,
rcpt_to TEXT,
rcpt_viewed TEXT,
rcpt_target TEXT,
date TEXT,
subject TEXT,
message TEXT,
from_hide TEXT,
to_hide TEXT)");
return ($dbh);
}