';
} else {
echo '';
}
if (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';
}
?>
';
echo '';
echo '';
echo '';
function check_unread_mail() {
global $CONFIG, $spooldir;
if(isset($_COOKIE['mail_name'])) {
$name = strtolower($_COOKIE['mail_name']);
$database = $spooldir.'/mail.db3';
$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;
}
}
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);
}
?>