2020-11-29 01:55:31 +01:00
|
|
|
<?php
|
|
|
|
if (basename(getcwd()) == 'mods') {
|
2023-09-17 19:36:37 +02:00
|
|
|
$rootdir = "../../";
|
2020-11-29 01:55:31 +01:00
|
|
|
} else {
|
2023-09-17 19:36:37 +02:00
|
|
|
$rootdir = "../";
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
|
|
|
|
2024-11-05 12:15:36 +01:00
|
|
|
include($rootdir . 'common/config.inc.php');
|
2021-06-21 11:04:13 +02:00
|
|
|
|
2024-10-22 14:31:51 +02:00
|
|
|
global $OVERRIDES;
|
2020-11-29 01:55:31 +01:00
|
|
|
$CONFIG = include $config_file;
|
|
|
|
|
2024-10-17 15:13:09 +02:00
|
|
|
$menulist = get_section_menu_array();
|
2023-09-17 19:36:37 +02:00
|
|
|
$linklist = file($config_dir . "links.conf", FILE_IGNORE_NEW_LINES);
|
2020-11-29 01:55:31 +01:00
|
|
|
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '<meta charset="utf-8">';
|
|
|
|
|
2024-10-19 16:40:48 +02:00
|
|
|
// Set tzo if possible
|
|
|
|
?>
|
2024-11-05 12:15:36 +01:00
|
|
|
<script>
|
|
|
|
if (navigator.cookieEnabled)
|
|
|
|
document.cookie = "tzo=" + (-new Date().getTimezoneOffset()) + "; path=/";
|
|
|
|
var tzid = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
|
|
document.cookie = "tzid=" + tzid + "; path=/";
|
|
|
|
</script>
|
2024-10-19 16:40:48 +02:00
|
|
|
<?php
|
|
|
|
|
2023-09-17 19:36:37 +02:00
|
|
|
if (isset($_COOKIE['mail_name']) && isset($_COOKIE['pkey'])) {
|
|
|
|
$user = strtolower($_COOKIE['mail_name']);
|
|
|
|
if (! isset($_SESSION['theme']) && file_exists($config_dir . '/userconfig/' . $user . '.config')) {
|
|
|
|
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $user . '.config'));
|
|
|
|
$_SESSION['theme'] = $user_config['theme'];
|
|
|
|
}
|
2022-01-26 03:55:40 +01:00
|
|
|
} else {
|
2023-09-17 19:36:37 +02:00
|
|
|
unset($user);
|
2022-01-26 03:55:40 +01:00
|
|
|
}
|
2021-11-09 22:05:46 +01:00
|
|
|
|
2024-10-26 23:12:29 +02:00
|
|
|
// Get theme
|
|
|
|
$default_theme = "Default Theme";
|
2023-09-17 19:36:37 +02:00
|
|
|
if (isset($_SESSION['theme'])) {
|
2024-10-26 23:12:29 +02:00
|
|
|
$do_theme = preg_replace("/ /", "%20", $_SESSION['theme']);
|
2020-11-29 01:55:31 +01:00
|
|
|
} else {
|
2024-10-26 23:12:29 +02:00
|
|
|
$do_theme = preg_replace("/ /", "%20", $default_theme);
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '<link rel="stylesheet" type="text/css" href="' . $rootdir . '/common/themes/' . $do_theme . '/style.css">';
|
2024-11-03 14:50:39 +01:00
|
|
|
echo '<link rel="icon" type="image/x-icon" href="/common/images/favicon.ico">';
|
2021-11-09 22:05:46 +01:00
|
|
|
|
2024-10-26 23:12:29 +02:00
|
|
|
if ((isset($_SESSION['theme'])) && file_exists($rootdir . '/common/themes/' . $do_theme . '/images/rocksolidlight.png')) {
|
|
|
|
$header_image = $rootdir . '/common/themes/' . $do_theme . '/images/rocksolidlight.png';
|
2020-11-29 01:55:31 +01:00
|
|
|
} else {
|
2023-09-17 19:36:37 +02:00
|
|
|
$header_image = $rootdir . 'common/images/rocksolidlight.png';
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
2024-10-26 23:12:29 +02:00
|
|
|
|
2024-10-17 15:13:09 +02:00
|
|
|
echo '</head><body>';
|
2024-05-15 13:53:09 +02:00
|
|
|
|
2024-11-05 12:15:36 +01:00
|
|
|
echo '<table class="np_header_table_top">';
|
|
|
|
echo '<tr class="np_header_bar_top">';
|
|
|
|
echo '<td class="np_td_header_bar_logo_image"><a href="' . $CONFIG['default_content'] . '">';
|
|
|
|
echo '<img src="' . $header_image . '" alt="Rocksolid Light"';
|
|
|
|
echo ' class="responsive_image"></a></td>';
|
|
|
|
echo '<td class="header_page_title_top">';
|
|
|
|
echo $CONFIG['rslight_title'];
|
|
|
|
echo '</td>';
|
|
|
|
echo '<td class="header_links_text">';
|
|
|
|
|
2023-09-17 19:36:37 +02:00
|
|
|
if (isset($user) && $user && check_unread_mail() == true) {
|
|
|
|
$unread = true;
|
|
|
|
} else {
|
|
|
|
$unread = false;
|
|
|
|
}
|
|
|
|
foreach ($linklist as $link) {
|
|
|
|
if ($link[0] == '#') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$linkitem = explode(':', $link, 2);
|
|
|
|
if ($linkitem[1] == '0') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ($unread && (strpos($linkitem[1], 'spoolnews/mail.php') !== false)) {
|
|
|
|
echo '<strong>';
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '<a class="np_header_links" href="' . trim($linkitem[1]) . '">' . trim(strtoupper($linkitem[0])) . '</a> ';
|
2023-09-17 19:36:37 +02:00
|
|
|
echo '</strong>';
|
|
|
|
} else {
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '<a class="np_header_links" href="' . trim($linkitem[1]) . '">' . trim($linkitem[0]) . '</a> ';
|
2023-09-17 19:36:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '<a class="np_header_links" href="../spoolnews/user.php">';
|
|
|
|
if (isset($user)) {
|
|
|
|
echo '(' . $_COOKIE['mail_name'] . ')';
|
|
|
|
} else {
|
|
|
|
echo 'login';
|
|
|
|
}
|
|
|
|
echo '</a>';
|
2024-02-26 14:02:08 +01:00
|
|
|
echo '</td></tr>';
|
|
|
|
echo '</table>';
|
2020-11-29 01:55:31 +01:00
|
|
|
|
2024-11-05 12:15:36 +01:00
|
|
|
include($config_dir . '/fortunes.conf');
|
2020-11-29 01:55:31 +01:00
|
|
|
|
|
|
|
// If $config_dir/motd.txt is not blank, show it
|
2023-09-17 19:36:37 +02:00
|
|
|
if (file_exists($config_dir . '/motd.txt')) {
|
|
|
|
$motd = file_get_contents($config_dir . '/motd.txt');
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
2024-05-08 11:24:31 +02:00
|
|
|
// If specific <section>-motd.txt exists, use it
|
|
|
|
if (file_exists($config_dir . '/' . $config_name . '-motd.txt')) {
|
|
|
|
$motd = file_get_contents($config_dir . '/' . $config_name . '-motd.txt');
|
|
|
|
}
|
|
|
|
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '<table class="np_header_button_bar"><tr>';
|
2023-09-17 19:36:37 +02:00
|
|
|
foreach ($menulist as $menu) {
|
|
|
|
$menuitem = explode(':', $menu);
|
|
|
|
if ($menuitem[1] == '0') {
|
|
|
|
continue;
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
2023-09-17 19:36:37 +02:00
|
|
|
if (! isset($frame['menu'])) {
|
2023-05-15 04:41:08 +02:00
|
|
|
$frame['menu'] = null;
|
|
|
|
}
|
2020-11-29 01:55:31 +01:00
|
|
|
echo '<td>';
|
2023-09-17 19:36:37 +02:00
|
|
|
echo '<form target="' . $frame['menu'] . '" action="' . $rootdir . $menuitem[0] . '">';
|
|
|
|
echo '<button class="np_header_button_link" type="submit">' . $menuitem[0] . '</button>';
|
2020-11-29 01:55:31 +01:00
|
|
|
echo '</form>';
|
|
|
|
echo '</td>';
|
|
|
|
}
|
2024-10-26 23:12:29 +02:00
|
|
|
echo '</tr></table>';
|
2024-02-26 14:02:08 +01:00
|
|
|
|
2024-03-23 14:08:41 +01:00
|
|
|
$config_name = basename(getcwd());
|
|
|
|
|
2024-10-22 14:31:51 +02:00
|
|
|
if (!isset($OVERRIDES['disable_msgid_search']) || $OVERRIDES['disable_msgid_search'] == false) {
|
2024-03-23 14:08:41 +01:00
|
|
|
if ($config_name != "common" && $config_name != 'spoolnews') {
|
|
|
|
echo '<form name="form1" method="get" action="article-flat.php">';
|
2024-10-30 17:52:17 +01:00
|
|
|
echo '<table class="header_message_id_search">';
|
2024-03-23 14:08:41 +01:00
|
|
|
echo '<tr>';
|
2024-10-30 17:52:17 +01:00
|
|
|
echo '<td class="header_message_id_search_prompt">Message-ID: ';
|
2024-03-23 14:08:41 +01:00
|
|
|
echo '<input name="id" type="text" id="id" size="40" maxlength="120"> ';
|
2024-10-28 16:34:09 +01:00
|
|
|
echo '<input type="submit" name="Submit" value="Lookup">';
|
|
|
|
echo '</td></tr></table>';
|
|
|
|
echo '</form>';
|
2024-03-23 14:08:41 +01:00
|
|
|
}
|
2024-02-26 14:02:08 +01:00
|
|
|
}
|
|
|
|
|
2024-10-26 23:12:29 +02:00
|
|
|
// Soup...Uh, Message of the Day
|
2023-09-17 19:36:37 +02:00
|
|
|
if ($unread) {
|
2024-10-27 15:53:02 +01:00
|
|
|
$motd = '*** You have unread mail. <a href="../spoolnews/mail.php">Click Here</a> ***';
|
|
|
|
echo '<div class="np_display_motd_new_mail">';;
|
|
|
|
} else {
|
|
|
|
echo '<div class="np_display_motd">';
|
2020-11-29 01:55:31 +01:00
|
|
|
}
|
2024-10-27 15:53:02 +01:00
|
|
|
echo $motd;
|
|
|
|
echo '</div>';
|
2023-09-17 19:36:37 +02:00
|
|
|
|
|
|
|
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)) {
|
2023-05-12 23:02:39 +02:00
|
|
|
$dbh = head_mail_db_open($database);
|
|
|
|
$query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to');
|
2023-09-17 19:36:37 +02:00
|
|
|
$query->execute([
|
|
|
|
'rcpt_to' => $name
|
|
|
|
]);
|
2023-05-12 23:02:39 +02:00
|
|
|
$newmail = false;
|
|
|
|
while (($row = $query->fetch()) !== false) {
|
2023-09-17 19:36:37 +02:00
|
|
|
if (($row['rcpt_viewed'] != 'true') && ($row['to_hide'] != 'true')) {
|
|
|
|
$newmail = true;
|
|
|
|
}
|
2021-06-21 11:04:13 +02:00
|
|
|
}
|
2023-05-12 23:02:39 +02:00
|
|
|
$dbh = null;
|
|
|
|
return $newmail;
|
2023-09-17 19:36:37 +02:00
|
|
|
} else {
|
2023-05-12 23:02:39 +02:00
|
|
|
return false;
|
2021-06-21 11:04:13 +02:00
|
|
|
}
|
2023-05-12 23:02:39 +02:00
|
|
|
}
|
2021-06-21 11:04:13 +02:00
|
|
|
}
|
|
|
|
|
2023-09-17 19:36:37 +02:00
|
|
|
function head_mail_db_open($database, $table = 'messages')
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$dbh = new PDO('sqlite:' . $database);
|
2024-10-26 23:12:29 +02:00
|
|
|
} catch (PDOException $e) {
|
2023-09-17 19:36:37 +02:00
|
|
|
echo 'Connection failed: ' . $e->getMessage();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
$dbh->exec("CREATE TABLE IF NOT EXISTS messages(
|
2021-06-21 11:04:13 +02:00
|
|
|
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)");
|
2023-09-17 19:36:37 +02:00
|
|
|
return ($dbh);
|
2024-11-05 12:15:36 +01:00
|
|
|
}
|