summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--php/admin/include/menu.php6
-rw-r--r--www/admin/user/forward.php18
-rw-r--r--www/admin/user/vacation.php26
4 files changed, 40 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index e0ccafa..0c80811 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,7 +75,8 @@ wssharedfolder_DATA = $(WSsharedfolder_FILES)
WSUSER_FILES = www/admin/user/forward.php \
www/admin/user/index.php \
www/admin/user/user.php \
- www/admin/user/vacation.php
+ www/admin/user/vacation.php \
+ www/admin/user/deliver.php
wsuserdir = $(wsadmindir)/user
wsuser_DATA = $(WSUSER_FILES)
@@ -116,6 +117,7 @@ PHP_TEMPLATES_EN = php/admin/templates/en/maintainerdeleted.tpl \
php/admin/templates/en/kolab.tpl \
php/admin/templates/en/addrlistall.tpl \
php/admin/templates/en/forward.tpl \
+ php/admin/templates/en/deliver.tpl \
php/admin/templates/en/distlistall.tpl \
php/admin/templates/en/kdab.tpl \
php/admin/templates/en/userlistall.tpl \
diff --git a/php/admin/include/menu.php b/php/admin/include/menu.php
index 6006e99..4034582 100644
--- a/php/admin/include/menu.php
+++ b/php/admin/include/menu.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ * Copyright (c) 2004 Klarälvdalens Datakonsult AB
*
* Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
@@ -32,6 +32,8 @@ if( $auth->group() == "admin" || $auth->group() == "maintainer" ) {
'url' => $topdir.'/user/user.php?action=modify',
'title' => _('My User Settings'),
'submenu' => array(
+ array( 'name' => _('Mail Delivery'),
+ 'url' => 'deliver.php'),
array( 'name' => _('Forward Email'),
'url' => 'forward.php' ),
array( 'name' => _('Vacation'),
@@ -94,7 +96,7 @@ $menuitems['about'] = array( 'name' => _('About Kolab'),
'url' => 'erfrakon.php' ),
array( 'name' => _('Intevation'),
'url' => 'intevation.php' ),
- array( 'name' => _('Klarälvdalens Datakonsult'),
+ array( 'name' => _('Klarälvdalens Datakonsult'),
'url' => 'kdab.php' ),
array( 'name' => _('Code Fusion'),
'url' => 'codefusion.php' ),
diff --git a/www/admin/user/forward.php b/www/admin/user/forward.php
index 3da8131..f183f7e 100644
--- a/www/admin/user/forward.php
+++ b/www/admin/user/forward.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ * Copyright (c) 2004 Klarälvdalens Datakonsult AB
*
* Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
@@ -52,6 +52,15 @@ if( !$errors ) {
$obj = $ldap->read( $auth->dn() );
$sieve =& new Net_Sieve( $auth->uid(), $auth->password(), $obj['kolabHomeServer'][0] );
+ // Fetch script data from server
+ $scripts = $sieve->listScripts();
+ if( in_array( "kolab-deliver.siv", $scripts ) ) {
+ $deliverscript = $sieve->getScript( $scriptname );
+
+ if( ereg('fileinto "INBOX/(.*)";', $deliverscript, $regs ) ) {
+ $inbox = $regs[1];
+ }
+ }
// Update sieve script on server in case we have submit data
if( $_REQUEST['submit'] ) {
@@ -63,7 +72,10 @@ if( !$errors ) {
$errors[] = _('Please enter an email address');
} else {
$script =
- "redirect \"".addslashes($address)."\";".($keep?" keep;":"");
+ "require \"fileinto\";\r\nredirect \"".addslashes($address)."\";".($keep?" keep;":"");
+ if( $inbox ) {
+ $script .= "\r\nif header :contains [\"X-Kolab-Scheduling-Message\"] [\"FALSE\"] {\r\nfileinto \"INBOX/$inbox\";\r\n}\r\n";
+ }
if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) {
$errors[] = $res->getMessage();
$errors[] = _('Script was:');
@@ -80,8 +92,6 @@ if( !$errors ) {
}
}
- // Fetch script data from server
- $scripts = $sieve->listScripts();
if( in_array( $scriptname, $scripts ) ) {
$script = $sieve->getScript( $scriptname );
if( ereg('redirect "(.*)";', $script, $regs ) ) {
diff --git a/www/admin/user/vacation.php b/www/admin/user/vacation.php
index 789f28e..088c870 100644
--- a/www/admin/user/vacation.php
+++ b/www/admin/user/vacation.php
@@ -1,6 +1,6 @@
<?php
/*
- (c) 2004 Klarälvdalens Datakonsult AB
+ (c) 2004 Klarälvdalens Datakonsult AB
This program is Free Software under the GNU General Public License (>=v2).
Read the file COPYING that comes with this packages for details.
@@ -38,16 +38,29 @@ $scriptname = 'kmail-vacation.siv';
if( !$errors ) {
$obj = $ldap->read( $auth->dn() );
$sieve =& new Net_Sieve( $auth->uid(), $auth->password(), $obj['kolabHomeServer'][0] );
-
+
+ // Fetch script data from server
+ $scripts = $sieve->listScripts();
+ if( in_array( "kolab-deliver.siv", $scripts ) ) {
+ $deliverscript = $sieve->getScript( $scriptname );
+
+ if( ereg('fileinto "INBOX/(.*)";', $deliverscript, $regs ) ) {
+ $inbox = $regs[1];
+ }
+ }
+
// Update sieve script on server in case we have submit data
if( $_REQUEST['submit'] ) {
$addresses = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_POST['addresses'] ) ), 'strlen') );
-
$script =
"require \"vacation\";\r\n\r\n".
+ "require \"fileinto\";\r\n\r\n".
"vacation :addresses [ \"".join('", "', $addresses )."\" ] :days ".
$_REQUEST['days']." text:\r\n".
- dotstuff($_REQUEST['text'])."\r\n.\r\n;";
+ dotstuff($_REQUEST['text'])."\r\n.\r\n;\r\n\r\n";
+ if( $inbox ) {
+ $script .= "if header :contains [\"X-Kolab-Scheduling-Message\"] [\"FALSE\"] {\r\nfileinto \"INBOX/$inbox\";\r\n}\r\n";
+ }
$active = isset($_REQUEST['active']);
if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) {
@@ -65,12 +78,10 @@ if( !$errors ) {
}
}
- // Fetch script data from server
- $scripts = $sieve->listScripts();
if( in_array( $scriptname, $scripts ) ) {
$script = $sieve->getScript( $scriptname );
//debug("<pre>".htmlentities($script)."</pre>");
- if( ereg(':addresses \[(.*)\]', $script, $regs ) ) {
+ if( ereg(':addresses \[([^\]]*)\]', $script, $regs ) ) {
$tmp = split(',', $regs[1] );
$addresses = array();
foreach( $tmp as $a ) {
@@ -121,6 +132,7 @@ $smarty->assign( 'active', $active );
$smarty->assign( 'text', $text );
$smarty->assign( 'addresses', $addresses );
$smarty->assign( 'days', $days );
+$smarty->assign( 'inbox', $inbox );
$smarty->assign( 'maincontent', 'vacation.tpl' );
$smarty->display('page.tpl');