Commit 7cc976e1 authored by stimpy's avatar stimpy

allow multiple netmail folders

parent 78194340
......@@ -50,7 +50,7 @@ module.exports = function (grunt) {
]
},
process: {
options: { process: function (content, srcpath ) { return content.replace(/'%VERSION%'/g, "'0.1.3'"); } },
options: { process: function (content, srcpath ) { return content.replace(/'%VERSION%'/g, "'0.1.4'"); } },
files: [
{src: 'src/assets/include/init.inc.php', dest: 'dist/assets/include/init.inc.php'}
]
......
......@@ -82,33 +82,54 @@
$message = filter_input( INPUT_POST, 'message', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES );
$echo = filter_input( INPUT_POST, 'echo', FILTER_SANITIZE_STRING );
$replyid = filter_input( INPUT_POST, 'replyid', FILTER_SANITIZE_NUMBER_INT );
$fromaka = false;
$defaultaka = false;
$domain = false;
$netmail = false;
if ( ( $echo == 'netmail' ) AND ( !array_key_exists( 'netmail', $echos ) ) ) {
$netmail = true;
if ( $receiveraka ) {
foreach ( $user['groups'] as $k => $g ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $echo == 'netmail' ) ) {
$fromaka = $g;
$domain = $echo = $k;
}
}
}
}
if ( $replyid != NULL ) {
$header = $jam->getMsgHeader( $echos[$echo]['filename'], $jam->getLastNumActive( $echos[$echo]['filename'] )-1-$replyid, 1 );
$replyid = $header[0]['MSGID'][0];
}
$fromaka = false;
$defaultaka = false;
$domain = false;
foreach ( $user['groups'] as $k => $g ) {
if ( $defaultaka == false ) $defaultaka = $g;
if ( $receiveraka ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $fromaka == false ) ) {
if ( !$fromaka ) {
if ( $receiveraka ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $fromaka == false ) ) {
$fromaka = $g;
$domain = $k;
}
} elseif ( $k == $echos[$echo]['group'] ) {
$fromaka = $g;
$domain = $k;
}
} elseif ( $k == $echos[$echo]['group'] ) {
$fromaka = $g;
$domain = $k;
}
}
if ( $fromaka == false ) $fromaka = $defaultaka;
$message .= '\n\n--- webJAM v'. VERSION .'\n * Origin: '. substr( $user['origin'], 0, 65-strlen( $fromaka) ) .' ('. $fromaka .')\n';
if ( $echo == 'netmail' ) {
if ( $netmail == true ) {
echo $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, $receiveraka, $subject, time(), time(), time(), $message, $domain, $replyid, array( 'MSG_LOCAL', 'MSG_PRIVATE', 'MSG_TYPENET' ) );
if ( $cfg['semaphores']['netscan'] != false ) $res = touch( $cfg['semaphores']['netscan'] );
} elseif ( $echo == 'netmail' ) {
$ret = $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, $receiveraka, $subject, time(), time(), time(), $message, $domain, $replyid, array( 'MSG_LOCAL', 'MSG_PRIVATE', 'MSG_TYPENET' ) );
if ( $ret ) echo 'netmail';
if ( $cfg['semaphores']['netscan'] != false ) $res = touch( $cfg['semaphores']['netscan'] );
} else {
echo $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, false, $subject, time(), time(), time(), $message, $domain, $replyid );
if ( $cfg['semaphores']['echoscan'] != false ) $res = touch( $cfg['semaphores']['echoscan'] );
......
......@@ -424,7 +424,7 @@
fflush( $fp3 );
flock( $fp3, LOCK_UN );
fclose( $fp3 );
return $messagenumber;
return $domain;
} else {
fclose( $fp3 );
}
......
......@@ -19,9 +19,9 @@
*
*/
$bv = '0.1.3';
$bv = '0.1.4';
if ( $bv == "%VERSION%" ) {
define( 'VERSION', '0.1.4-dev' );
define( 'VERSION', '0.1.5-dev' );
} else {
define( 'VERSION', $bv );
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -248,6 +248,7 @@
$user['aliases'] = <?= json_encode($user['aliases']); ?>;
$user['origin'] = "<?= $user['origin']; ?>";
$user['readonly'] = <?= $user['readonly'] ? 'true' : 'false'; ?>;
$echos = <?= json_encode( $echos ); ?>;
VERSION = "<?= VERSION; ?>";
</script>
<?php
......
......@@ -82,33 +82,54 @@
$message = filter_input( INPUT_POST, 'message', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES );
$echo = filter_input( INPUT_POST, 'echo', FILTER_SANITIZE_STRING );
$replyid = filter_input( INPUT_POST, 'replyid', FILTER_SANITIZE_NUMBER_INT );
$fromaka = false;
$defaultaka = false;
$domain = false;
$netmail = false;
if ( ( $echo == 'netmail' ) AND ( !array_key_exists( 'netmail', $echos ) ) ) {
$netmail = true;
if ( $receiveraka ) {
foreach ( $user['groups'] as $k => $g ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $echo == 'netmail' ) ) {
$fromaka = $g;
$domain = $echo = $k;
}
}
}
}
if ( $replyid != NULL ) {
$header = $jam->getMsgHeader( $echos[$echo]['filename'], $jam->getLastNumActive( $echos[$echo]['filename'] )-1-$replyid, 1 );
$replyid = $header[0]['MSGID'][0];
}
$fromaka = false;
$defaultaka = false;
$domain = false;
foreach ( $user['groups'] as $k => $g ) {
if ( $defaultaka == false ) $defaultaka = $g;
if ( $receiveraka ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $fromaka == false ) ) {
if ( !$fromaka ) {
if ( $receiveraka ) {
if ( ( explode( ':', $g )[0] == explode( ':', $receiveraka )[0] ) AND ( $fromaka == false ) ) {
$fromaka = $g;
$domain = $k;
}
} elseif ( $k == $echos[$echo]['group'] ) {
$fromaka = $g;
$domain = $k;
}
} elseif ( $k == $echos[$echo]['group'] ) {
$fromaka = $g;
$domain = $k;
}
}
if ( $fromaka == false ) $fromaka = $defaultaka;
$message .= '\n\n--- webJAM v'. VERSION .'\n * Origin: '. substr( $user['origin'], 0, 65-strlen( $fromaka) ) .' ('. $fromaka .')\n';
if ( $echo == 'netmail' ) {
if ( $netmail == true ) {
echo $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, $receiveraka, $subject, time(), time(), time(), $message, $domain, $replyid, array( 'MSG_LOCAL', 'MSG_PRIVATE', 'MSG_TYPENET' ) );
if ( $cfg['semaphores']['netscan'] != false ) $res = touch( $cfg['semaphores']['netscan'] );
} elseif ( $echo == 'netmail' ) {
$ret = $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, $receiveraka, $subject, time(), time(), time(), $message, $domain, $replyid, array( 'MSG_LOCAL', 'MSG_PRIVATE', 'MSG_TYPENET' ) );
if ( $ret ) echo 'netmail';
if ( $cfg['semaphores']['netscan'] != false ) $res = touch( $cfg['semaphores']['netscan'] );
} else {
echo $jam->saveMessage( $echos[$echo]['filename'], $user['realname'], $fromaka, $receivername, false, $subject, time(), time(), time(), $message, $domain, $replyid );
if ( $cfg['semaphores']['echoscan'] != false ) $res = touch( $cfg['semaphores']['echoscan'] );
......
......@@ -424,7 +424,7 @@
fflush( $fp3 );
flock( $fp3, LOCK_UN );
fclose( $fp3 );
return $messagenumber;
return $domain;
} else {
fclose( $fp3 );
}
......
[netmail]
filename=/mnt/nas/www/website_jamreader/src/data/internal/netmail
group=netmail
description=(netmail)
[futest]
filename="/mnt/nas/www/website_jamreader/src/data/test/kuehlbox_en"
group="test"
description="(Test)"
filename="/mnt/nas/www/website_jamreader/src/data/internal/netmail"
group="netmail"
description="(netmail) "
[agn_ads]
filename="/mnt/nas/www/website_jamreader/src/data/agoranet/agn_ads"
......
......@@ -21,7 +21,7 @@
$bv = '%VERSION%';
if ( $bv == "%VERSION%" ) {
define( 'VERSION', '0.1.4-dev' );
define( 'VERSION', '0.1.5-dev' );
} else {
define( 'VERSION', $bv );
}
......
......@@ -101,8 +101,8 @@ function getMessage( $echo, $msgid, $count ) {
$reply = '';
if ( $user['readonly'] === false ) {
$reply += '<a href="index.php?action=reply&echo='+$echo+'&msgid='+$msgid+'&receiver='+msg.header.SENDERNAME+'&subject='+msg.header.SUBJECT+'" class="btn btn-lg btn-success btn-replymail btn-replyechomail" title="Reply"><span class="glyphicon glyphicon-share"></span></a>';
if ( $echo != 'netmail' ) {
$reply += '<a href="index.php?action=reply&echo=netmail&msgid='+$msgid+'&receiver='+msg.header.SENDERNAME+'&subject='+msg.header.SUBJECT+'" class="btn btn-lg btn-warning btn-replymail btn-replynetmail" title="Reply via Netmail"><span class="glyphicon glyphicon-user"></span></a>';
if ( $echos[$echo]['group'] != 'netmail' ) {
$reply += '<a href="index.php?action=reply&echo=netmail&msgid='+$msgid+'&receiver='+msg.header.SENDERNAME+'&subject='+msg.header.SUBJECT+'&domain='+$echos[$echo]['group']+'" class="btn btn-lg btn-warning btn-replymail btn-replynetmail" title="Reply via Netmail"><span class="glyphicon glyphicon-user"></span></a>';
}
}
$('.msgbody').html( $details + '<div class="msgtext">'+ msg.text +'</div>'+ $reply );
......@@ -258,7 +258,9 @@ function bindReplymail() {
$('.msgbody').html($html);
if ( $echo == 'netmail' ) {
findReceiver();
bindReceiver();
$('#receivername').focus();
}
bindSavemessage();
});
......@@ -304,9 +306,11 @@ function bindSavemessage( $count ) {
$('.msgheaders table tbody').html('');
$headerPos = 0;
$loading = false;
getMessageHeaders( $echo, $headerPos, false );
if ( msg > -1 ) {
getMessage( $echo, 0 );
if ( msg !== '-1' ) {
getMessageHeaders( msg, $headerPos, false );
getMessage( msg );
$('.echos li').removeClass('active');
$('.echos li a#echo'+msg).parent('li').addClass('active');
$('#disabled').removeClass('active');
} else {
$('.msgbody').html('');
......
......@@ -271,6 +271,7 @@
$user['aliases'] = <?= json_encode($user['aliases']); ?>;
$user['origin'] = "<?= $user['origin']; ?>";
$user['readonly'] = <?= $user['readonly'] ? 'true' : 'false'; ?>;
$echos = <?= json_encode( $echos ); ?>;
VERSION = "<?= VERSION; ?>";
</script>
<?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment