[Kolab-devel] martin: server/kolab-webadmin/kolab-webadmin/www/admin/user user.php.in, 1.19, 1.20

Gunnar Wrobel wrobel at pardus.de
Fri Jul 13 16:40:13 CEST 2007


This commit contains syntax errors.

cvs at kolab.org writes:

> Author: martin
>
> Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user
> In directory doto:/tmp/cvs-serv25723
>
> Modified Files:
> 	user.php.in 
> Log Message:
> Martin Konold: unfinished support for kolabAllowSMTPRecipient (I am tired now)
>
>
> Index: user.php.in
> ===================================================================
> RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php.in,v
> retrieving revision 1.19
> retrieving revision 1.20
> diff -u -d -r1.19 -r1.20
> --- user.php.in	28 May 2007 19:24:10 -0000	1.19
> +++ user.php.in	2 Jul 2007 22:33:47 -0000	1.20
> @@ -165,6 +165,49 @@
>    return '';
>  }
>  
> +function checksmtprecipient ( $form, $key, $value ) {
> +  $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
> +  $str = '';
> +  foreach( $lst as $SMTPRecipient ) {
> +    $trimmed = ltrim($SMTPRecipient, "-."); // potentially every entry is negated with a '-'
> +    // $SMTPRecipient is either an 
> +    // - email address
> +    // - local part of an email address with an @ suffix
> +    // - a domain part
> +         
> +    if (! ( valid_email_address($SMTPRecipient) 
> +          | valid_domain($SMTPRecipient)
> +          | valid_local_part($SMTPRecipient))
> +      return sprintf(_("Syntax for Recipient %s is invalid"), $SMTPRecipient);
> +    }
> +  }
> +  return '';
> +}
> +
> +
> +function valid_email_address($address) {
> +// the following addresses are invalid
> +// email1.. at kolab.org
> +// email1.- at kolab.org
> +// email1._ at kolab.org
> +// email1 at 2sub.kolab.org
> +// email1 at sub.sub.2sub.kolab.org
> +  return preg_match("/^[a-z]+[a-z0-9]*[\.|\-|_]?[a-z0-9]+@([a-z]+[a-z0-9]*[\.|\-]?[a-z]+[a-z0-9]*[a-z0-9]+){1,4}\.[a-z]{2,4}$/i", $address));
> +}
> +
> +function valid_domain($domain) {
> +// the following subdomains are invalid
> +// 2sub.kolab.org
> +// sub.sub.2sub.kolab.org
> +  return preg_match("/^[a-z]+[a-z0-9]*[\.|\-]?[a-z]+[a-z0-9]*[a-z0-9]+){1,4}\.[a-z]{2,4}$/i", $domain));
> +}
> +
> +function valid_local_part($local_part) {
> +  // the local part always has an @ appended
> +  return preg_match("/^[a-z]+[a-z0-9]*[\.|\-|_]?[a-z0-9]+@/i", $local_part));
> +}
> +
> +
>  // Check uid/gid used in invitation policy
>  // We're pretty relaxed about what is entered 
>  // here and only check some basic syntax
> @@ -443,15 +486,24 @@
>  									 'comment' => _('For automatic invitation handling') . '<br/>' .
>  									 _("NOTE: For regular accounts to use this feature, give the 'calendar' user access to the Calendar folder") ),
>  		  'title_0' => array( 'name' => _('Title') ) );
> +
>  $entries['alias'] = array( 'name' => _('Email Aliases'), 
>  						   'type' => 'textarea',
>  						   'validation' => 'checkuniquealias',
>  						   'comment' => _('One address per line') );
> +
>  $entries['kolabdelegate'] =array( 'name' => _('Email-Delegates'),
>  		'type' => 'textarea',
>  		'validation' => 'checkdelegate',
>  		'comment' => _('Others allowed to send emails with a "from" address of this account.') . '<br/>' .
>  			_('One email address per line.') );
> +
> +$entries['kolabAllowSMTPRecipient'] =array( 'name' => _('Allowed Recipients'),
> +                'type' => 'textarea',
> +                'validation' => 'checksmtprecipient',
> +                'comment' => _('restrict allowed recipients of SMTP messages') . '<br/>' .
> +                        _('One entry per line.') );
> +
>  $entries['o_0'] = array( 'name' => _('Organisation') );
>  $entries['ou_0'] = array( 'name' => _('Organisational Unit') );
>  $entries['roomNumber_0'] = array( 'name' => _('Room Number') );
>
>
> _______________________________________________
> Kolab-commits mailing list
> Kolab-commits at kolab.org
> https://kolab.org/mailman/listinfo/kolab-commits

-- 
____ http://www.pardus.de _________________ http://gunnarwrobel.de _

    >> Mail at ease - Rent a kolab groupware server at p at rdus <<

p at rdus Kolab work is funded in part by KDAB and the Kolab Konsortium




More information about the devel mailing list