Highlight MAIL link if new mail. Change cookie path to / . Move some scripts to spoolnews/
This commit is contained in:
parent
4766775a64
commit
4d61a4d967
@ -8,6 +8,7 @@ if (basename(getcwd()) == 'mods') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
include($rootdir.'common/config.inc.php');
|
include($rootdir.'common/config.inc.php');
|
||||||
|
|
||||||
$CONFIG = include $config_file;
|
$CONFIG = include $config_file;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -49,6 +50,11 @@ if (file_exists($rootdir.'common/mods/images/rocksolidlight.png')) {
|
|||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
|
if(check_unread_mail() == true) {
|
||||||
|
$unread = true;
|
||||||
|
} else {
|
||||||
|
$unread = false;
|
||||||
|
}
|
||||||
foreach($linklist as $link) {
|
foreach($linklist as $link) {
|
||||||
if($link[0] == '#') {
|
if($link[0] == '#') {
|
||||||
continue;
|
continue;
|
||||||
@ -57,7 +63,13 @@ if (file_exists($rootdir.'common/mods/images/rocksolidlight.png')) {
|
|||||||
if($linkitem[1] == '0') {
|
if($linkitem[1] == '0') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo '<a href="'.trim($linkitem[1]).'">'.trim($linkitem[0]).'</a>  ';
|
if($unread && (strpos($linkitem[1], 'spoolnews/mail.php') !== false)) {
|
||||||
|
echo '<strong>';
|
||||||
|
echo '<a href="'.trim($linkitem[1]).'">'.trim(strtoupper($linkitem[0])).'</a>  ';
|
||||||
|
echo '</strong>';
|
||||||
|
} else {
|
||||||
|
echo '<a href="'.trim($linkitem[1]).'">'.trim($linkitem[0]).'</a>  ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -132,5 +144,46 @@ foreach($menulist as $menu) {
|
|||||||
}
|
}
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
|
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);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</body></html>
|
</body></html>
|
||||||
|
@ -20,7 +20,7 @@ if (isset($frames_on) && $frames_on === true) {
|
|||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if (navigator.cookieEnabled)
|
if (navigator.cookieEnabled)
|
||||||
document.cookie = "tzo="+ (- new Date().getTimezoneOffset());
|
document.cookie = "tzo="+ (- new Date().getTimezoneOffset())+"; path=/";
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$title.=' - '.basename(getcwd());
|
$title.=' - '.basename(getcwd());
|
||||||
|
@ -1316,6 +1316,29 @@ function get_search_snippet($body, $content_type='') {
|
|||||||
return $mysnippet;
|
return $mysnippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function 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);
|
||||||
|
}
|
||||||
|
|
||||||
function rslight_db_open($database, $table='overview') {
|
function rslight_db_open($database, $table='overview') {
|
||||||
try {
|
try {
|
||||||
$dbh = new PDO('sqlite:'.$database);
|
$dbh = new PDO('sqlite:'.$database);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# These are the links at the top right of the site
|
# These are the links at the top right of the site
|
||||||
# display name:url
|
# display name:url
|
||||||
mail:/rocksolid/mail.php
|
mail:/spoolnews/mail.php
|
||||||
files:/rocksolid/files.php
|
files:/spoolnews/files.php
|
||||||
register:/common/register.php
|
register:/common/register.php
|
||||||
nodelist:/common/nodelist.php
|
nodelist:/common/nodelist.php
|
||||||
faq:/common/faq.txt
|
faq:/common/faq.txt
|
||||||
|
1
Rocksolid_Light/spoolnews/head.inc
Symbolic link
1
Rocksolid_Light/spoolnews/head.inc
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../rocksolid/head.inc
|
@ -34,8 +34,9 @@ include "head.inc";
|
|||||||
var authcookie = "<?php echo $authkey; ?>";
|
var authcookie = "<?php echo $authkey; ?>";
|
||||||
var savename = "<?php echo stripslashes($name); ?>";
|
var savename = "<?php echo stripslashes($name); ?>";
|
||||||
var auth_expire = "<?php echo $auth_expire; ?>";
|
var auth_expire = "<?php echo $auth_expire; ?>";
|
||||||
document.cookie = "mail_auth="+authcookie+"; max-age="+auth_expire;
|
var name_expire = "7776000";
|
||||||
document.cookie = "mail_name="+savename;
|
document.cookie = "mail_auth="+authcookie+"; max-age="+auth_expire+"; path=/";
|
||||||
|
document.cookie = "mail_name="+savename+"; max-age="+name_expire+"; path=/";
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$logged_in = true;
|
$logged_in = true;
|
||||||
@ -114,12 +115,15 @@ echo '</table>';
|
|||||||
if(($row['mail_from'] != $user) && ($row['rcpt_to'] != $user)) {
|
if(($row['mail_from'] != $user) && ($row['rcpt_to'] != $user)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$istrue = 'true';
|
||||||
if($row['mail_from'] == $user) {
|
if($row['mail_from'] == $user) {
|
||||||
$sql_update = $dbh->prepare('UPDATE messages SET from_hide=? WHERE id=?');
|
$sql_update = $dbh->prepare('UPDATE messages SET from_hide=:from_hide WHERE id=:row_id');
|
||||||
} elseif($row['rcpt_to'] == $user) {
|
$sql_update->execute(array(':from_hide' => $istrue, ':row_id' => $row['id']));
|
||||||
$sql_update = $dbh->prepare('UPDATE messages SET to_hide=? WHERE id=?');
|
}
|
||||||
|
if($row['rcpt_to'] == $user) {
|
||||||
|
$sql_update = $dbh->prepare('UPDATE messages SET to_hide=:to_hide WHERE id=:row_id');
|
||||||
|
$sql_update->execute(array(':to_hide' => $istrue, ':row_id' => $row['id']));
|
||||||
}
|
}
|
||||||
$sql_update->execute(array('true', $row['id']));
|
|
||||||
}
|
}
|
||||||
$dbh = null;
|
$dbh = null;
|
||||||
}
|
}
|
||||||
@ -162,10 +166,12 @@ echo '</table>';
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
if($row['mail_from'] == $user) {
|
if($row['mail_from'] == $user) {
|
||||||
$sql_update = $dbh->prepare('UPDATE messages SET mail_viewed=? WHERE msgid=?');
|
$sql_update = $dbh->prepare('UPDATE messages SET mail_viewed=? WHERE msgid=?');
|
||||||
} elseif($row['rcpt_to'] == $user) {
|
$sql_update->execute(array('true', $row['msgid']));
|
||||||
|
}
|
||||||
|
if($row['rcpt_to'] == $user) {
|
||||||
$sql_update = $dbh->prepare('UPDATE messages SET rcpt_viewed=? WHERE msgid=?');
|
$sql_update = $dbh->prepare('UPDATE messages SET rcpt_viewed=? WHERE msgid=?');
|
||||||
|
$sql_update->execute(array('true', $row['msgid']));
|
||||||
}
|
}
|
||||||
$sql_update->execute(array('true', $row['msgid']));
|
|
||||||
}
|
}
|
||||||
$dbh = null;
|
$dbh = null;
|
||||||
|
|
||||||
@ -173,7 +179,7 @@ echo '</table>';
|
|||||||
if (isSet($_POST['sendMessage'])) {
|
if (isSet($_POST['sendMessage'])) {
|
||||||
if (isSet($_POST['to']) && $_POST['to'] != '' && isSet($_POST['from']) && $_POST['from'] != '' && isSet($_POST['message']) && $_POST['message'] != '') {
|
if (isSet($_POST['to']) && $_POST['to'] != '' && isSet($_POST['from']) && $_POST['from'] != '' && isSet($_POST['message']) && $_POST['message'] != '') {
|
||||||
if(($to = get_config_value('aliases.conf', strtolower($_POST['to']))) == false) {
|
if(($to = get_config_value('aliases.conf', strtolower($_POST['to']))) == false) {
|
||||||
$to = $_POST['to'];
|
$to = strtolower($_POST['to']);
|
||||||
}
|
}
|
||||||
$userlist = scandir($config_dir.'/users/');
|
$userlist = scandir($config_dir.'/users/');
|
||||||
$found = 0;
|
$found = 0;
|
||||||
@ -297,27 +303,4 @@ echo '</table>';
|
|||||||
}
|
}
|
||||||
echo '</tbody></table><br />';
|
echo '</tbody></table><br />';
|
||||||
include "tail.inc";
|
include "tail.inc";
|
||||||
|
|
||||||
function 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);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user