gunnar: server/kolab-webadmin/kolab-webadmin/www/admin/user deliver.php.in, 1.5, 1.6 forward.php.in, 1.4, 1.5 vacation.php.in, 1.6, 1.7

cvs at kolab.org cvs at kolab.org
Tue Apr 6 12:18:57 CEST 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user
In directory doto:/tmp/cvs-serv26820/kolab-webadmin/www/admin/user

Modified Files:
	deliver.php.in forward.php.in vacation.php.in 
Log Message:
The new handler reads the old forward and vacation scripts just fine.

In addition this switches from the patched PEAR-Net_Sieve in kolab-webadmin/php/admin/include/Sieve.php to the standard PEAR-Net_Sieve package.
The patched version was imported as is into Kolab CVS. There is no hint if there was anything specific that needed patching or what has actually
been patched. The diff to the current PEAR-Net_Sieve also did not indicate anything that looked like it might be specific to the Kolab server.
The patched version did however fail to work with the new handler as it was not able to load several sieve scripts in succession (which is necessary
to avoid loosing data).

Index: deliver.php.in
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/deliver.php.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- deliver.php.in	6 Apr 2010 09:00:34 -0000	1.5
+++ deliver.php.in	6 Apr 2010 10:18:55 -0000	1.6
@@ -38,7 +38,7 @@
 }
 
 $errors = array();
-if( (@include_once '@kolab_php_module_prefix at admin/include/Sieve.php' ) === false ) {
+if( (@include_once 'Net/Sieve.php' ) === false ) {
   $errors[] = _('Net/Sieve.php is missing. Without that, filter settings are not available');
   $errors[] = _("Suggest your system administrator to run \"pear install http://pear.php.net/get/Net_Sieve\" on the server");
 }

Index: forward.php.in
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/forward.php.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- forward.php.in	31 Mar 2010 19:55:10 -0000	1.4
+++ forward.php.in	6 Apr 2010 10:18:55 -0000	1.5
@@ -22,7 +22,12 @@
 require_once '@kolab_php_module_prefix at admin/include/headers.php';
 require_once('@kolab_php_module_prefix at admin/include/locale.php');
 require_once '@kolab_php_module_prefix at admin/include/authenticate.php';
+require_once 'KolabAdmin/Sieve.php';
 require_once 'KolabAdmin/Sieve/Script.php';
+require_once 'KolabAdmin/Sieve/Segment.php';
+require_once 'KolabAdmin/Sieve/Segment/Delivery.php';
+require_once 'KolabAdmin/Sieve/Segment/Forward.php';
+require_once 'KolabAdmin/Sieve/Segment/Vacation.php';
 
 // Funny multiline string escaping in Sieve
 function dotstuff( $str ) {
@@ -34,7 +39,7 @@
 }
 
 $errors = array();
-if( (@include_once '@kolab_php_module_prefix at admin/include/Sieve.php' ) === false ) {
+if( (@include_once 'Net/Sieve.php' ) === false ) {
   $errors[] = _('Net/Sieve.php is missing. Without that, vacation settings are not available');
   $errors[] = _("Suggest your system administrator to run \"pear install http://pear.php.net/get/Net_Sieve\" on the server");
 }
@@ -84,16 +89,7 @@
 	}
   }
 
-  $scripts = $sieve->listScripts();
-  if( in_array( $scriptname, $scripts ) ) {
-	$script = $sieve->getScript($scriptname);
-	$address = KolabAdmin_Sieve_Script::getForwardAddress( $script );
-	$keep = KolabAdmin_Sieve_Script::getKeepOnServer( $script );
-  } else {
-	$address = '';
-	$keep = true;
-  }
-  $active = ( $sieve->getActive() === $scriptname );  
+  $handler = new KolabAdmin_Sieve($sieve);
 }
 
 /**** Insert into template and output ***/
@@ -107,9 +103,9 @@
 $smarty->assign( 'submenuitems', 
 				 array_key_exists('submenu', 
 								  $menuitems[$sidx])?$menuitems[$sidx]['submenu']:array() );
-$smarty->assign( 'active', $active );
-$smarty->assign( 'keep', $keep );
-$smarty->assign( 'address', $address );
+$smarty->assign( 'active', $handler->fetchForwardSegment()->isActive() );
+$smarty->assign( 'keep', $handler->fetchForwardSegment()->getKeepOnServer() );
+$smarty->assign( 'address', $handler->fetchForwardSegment()->getForwardAddress() );
 $smarty->assign( 'maincontent', 'forward.tpl' );
 $smarty->display('page.tpl');
 

Index: vacation.php.in
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/vacation.php.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- vacation.php.in	31 Mar 2010 19:55:10 -0000	1.6
+++ vacation.php.in	6 Apr 2010 10:18:55 -0000	1.7
@@ -10,10 +10,15 @@
 require_once '@kolab_php_module_prefix at admin/include/headers.php';
 require_once('@kolab_php_module_prefix at admin/include/locale.php');
 require_once '@kolab_php_module_prefix at admin/include/authenticate.php';
+require_once 'KolabAdmin/Sieve.php';
 require_once 'KolabAdmin/Sieve/Script.php';
+require_once 'KolabAdmin/Sieve/Segment.php';
+require_once 'KolabAdmin/Sieve/Segment/Delivery.php';
+require_once 'KolabAdmin/Sieve/Segment/Forward.php';
+require_once 'KolabAdmin/Sieve/Segment/Vacation.php';
 
 $errors = array();
-if( (@include_once '@kolab_php_module_prefix at admin/include/Sieve.php' ) === false ) {
+if( (@include_once 'Net/Sieve.php' ) === false ) {
   $errors[] = _('Net/Sieve.php is missing. Without that, vacation settings are not available');
   $errors[] = _("Suggest your system administrator to run \"pear install http://pear.php.net/get/Net_Sieve\" on the server");
 }
@@ -70,36 +75,13 @@
 	}
   }
 
-  $addresses = $days = $text = false;
-  $scripts = $sieve->listScripts();
-  if( in_array( $scriptname, $scripts ) ) {
-	$script = $sieve->getScript($scriptname);
-	$maildomain = KolabAdmin_Sieve_Script::getMailDomain( $script );
-	$reacttospam = KolabAdmin_Sieve_Script::getReactToSpam( $script );
-	debug("reacttospam=".($reacttospam?"true":"false"));
-	$addresses = KolabAdmin_Sieve_Script::getVacationAddresses( $script );
-	$days = KolabAdmin_Sieve_Script::getVacationDays( $script );
-	$text = KolabAdmin_Sieve_Script::getVacationText( $script );
-  } else $reacttospam = true;
-  if( $addresses === false ) {
-	$object = $ldap->read( $auth->dn() );
-	$addresses = array_merge( (array)$object['mail'], (array)$object['alias'] );
-  }
-  if( $days === false || $days < 1 ) $days = 7;
-  if( $text === false ) {
-	$date = strftime(_('%x'));
-	$text = sprintf(
-					_("I am out of office until %s.\r\n").
-					_("In urgent cases, please contact Mrs. <vacation replacement>\r\n\r\n").
-					_("email: <email address of vacation replacement>\r\n").
-					_("phone: +49 711 1111 11\r\n").
-					_("fax.:  +49 711 1111 12\r\n\r\n").
-					_("Yours sincerely,\r\n").
-					_("-- \r\n").
-					_("<enter your name and email address here>"),
-					$date);
+  $handler = new KolabAdmin_Sieve($sieve);
+
+  $addresses = $handler->fetchVacationSegment()->getRecipientAddresses();
+  if (empty($addresses)) {
+	$object = $ldap->read($auth->dn());
+	$addresses = array_merge((array) $object['mail'], (array) $object['alias']);
   }
-  $active = ( $sieve->getActive() === $scriptname );  
 }
 
 /**** Insert into template and output ***/
@@ -113,13 +95,12 @@
 $smarty->assign( 'submenuitems', 
 				 array_key_exists('submenu', 
 								  $menuitems[$sidx])?$menuitems[$sidx]['submenu']:array() );
-$smarty->assign( 'active', $active );
-$smarty->assign( 'text', $text );
+$smarty->assign( 'active', $handler->fetchVacationSegment()->isActive() );
+$smarty->assign( 'text', $handler->fetchVacationSegment()->getResponse() );
 $smarty->assign( 'addresses', $addresses );
-$smarty->assign( 'maildomain', $maildomain );
-$smarty->assign( 'reacttospam', $reacttospam );
-$smarty->assign( 'days', $days );
-$smarty->assign( 'inbox', $inbox );
+$smarty->assign( 'maildomain', $handler->fetchVacationSegment()->getDomain() );
+$smarty->assign( 'reacttospam', !$handler->fetchVacationSegment()->getReactToSpam() );
+$smarty->assign( 'days', $handler->fetchVacationSegment()->getResendAfter() );
 $smarty->assign( 'maincontent', 'vacation.tpl' );
 $smarty->display('page.tpl');
 





More information about the commits mailing list