';
} else {
echo ' ';
}
if ((isset($_SESSION['theme'])) && file_exists($rootdir . 'common/themes/' . $_SESSION['theme'] . '/images/rocksolidlight.png')) {
$header_image = $rootdir . 'common/themes/' . $_SESSION['theme'] . '/images/rocksolidlight.png';
} else {
$header_image = $rootdir . 'common/images/rocksolidlight.png';
}
?>
';
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');
}
echo '';
foreach ($menulist as $menu) {
if ($menu[0] == '#') {
continue;
}
$menuitem = explode(':', $menu);
if ($menuitem[1] == '0') {
continue;
}
if (! isset($frame['menu'])) {
$frame['menu'] = null;
}
echo '';
echo '';
echo ' ';
}
echo '
';
if($OVERRIDES['disable_msgid_search'] != true) {
echo '
';
}
echo '';
echo '';
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 (PDOExeption $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);
}
?>