~ubuntu-branches/ubuntu/vivid/gosa/vivid

« back to all changes in this revision

Viewing changes to groupware/admin/ogroups/GroupwareDistributionList/class_GroupwareDistributionList.inc

Tags: 2.7.1-1
* New upstream release
* Updated packaging to not include smarty (Closes: #620489)
* Fixed case of POSIX (Closes: #620486)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
new GroupwareDefinitions();
 
4
 
 
5
class GroupwareDistributionList extends plugin
 
6
{
 
7
    public $view_logged = FALSE;
 
8
 
 
9
    // Error hanlding related attributes.
 
10
    private $initialized  = FALSE;
 
11
    private $rpcError = FALSE;
 
12
    private $rpcErrorMessage = "";
 
13
 
 
14
 
 
15
    // Attribute definition 
 
16
    public $attributes = array('primaryMailAddress','alternateAddresses','memberList','mailSizeLimit');
 
17
    public $mailSizeLimit = NULL;
 
18
    public $primaryMailAddress = "";
 
19
    public $alternateAddresses = array();
 
20
    public $memberList = array();   
 
21
 
 
22
    // Feature handling
 
23
    private $featuresEnabled = array();
 
24
 
 
25
 
 
26
    /*! \brief  Constructs the plugin, loads required parent values 
 
27
     *           and initiates the initialization.
 
28
     */
 
29
    function __construct($config, $dn, $attrs = NULL)
 
30
    {
 
31
        plugin::plugin($config, $dn, $attrs);
 
32
 
 
33
        // Get attributes from parent object
 
34
        $this->cn = "";
 
35
        if(isset($this->attrs['cn'])){
 
36
            $this->cn = $this->attrs['cn'][0];
 
37
        }
 
38
        $this->orig_cn = $this->cn;
 
39
 
 
40
        // Initialize the distribution list using the gosa-ng backend 
 
41
        $this->init();
 
42
    }
 
43
 
 
44
 
 
45
    /*! \brief      Check whether a feature is enabled or not.
 
46
     *  @param      The feature name to check for
 
47
     *  @return     TRUE on success else FALSE
 
48
     */
 
49
    function featureEnabled($name)
 
50
    {
 
51
        return(isset($this->featuresEnabled[$name]) && $this->featuresEnabled[$name]);
 
52
    }
 
53
 
 
54
 
 
55
    /*! \brief      Try to initialize the plugin using a json-rpc connection
 
56
     *               to the gosa-ng server.
 
57
     */
 
58
    function init()
 
59
    {
 
60
        // Detect supported capabilities 
 
61
        $rpc = $this->config->getRpcHandle();
 
62
        $capabilities = $rpc->gwGetCapabilities();
 
63
        if(!$rpc->success()){
 
64
            $this->rpcError = TRUE;
 
65
            $this->rpcErrorMessage = $rpc->get_error();
 
66
            $message = sprintf(_("Failed to load supported capabilities from server! Error was: '%s'."), 
 
67
                    $rpc->get_error());
 
68
            msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
69
            return;
 
70
        }
 
71
 
 
72
        // Detect features we can use
 
73
        $map['alternateAddresses'] = array('distGetAlternateMailAddresses','distSetAlternateMailAddresses');
 
74
        $map['mailSizeLimit'] = array('distGetMailLimit','distGetMailLimit');
 
75
        foreach($map as $name => $required){
 
76
            $this->featuresEnabled[$name] = TRUE;
 
77
            foreach($required as $func){
 
78
                $this->featuresEnabled[$name] &= isset($capabilities[$func]) && $capabilities[$func];
 
79
            }
 
80
        }
 
81
 
 
82
        // If we're creating a new ogroup, then we've definately no extension, yet.
 
83
        $this->rpcError = FALSE;
 
84
        if($this->cn == "" || $this->dn == "new"){
 
85
            $is_account = FALSE;
 
86
        }else{
 
87
 
 
88
            // Check whether a mathing distribution-list exists or not!
 
89
            $is_account = $rpc->gwDistExists($this->orig_cn);
 
90
            if(!$rpc->success()){
 
91
                $this->rpcError = TRUE;
 
92
                $this->rpcErrorMessage = $rpc->get_error();
 
93
                $message = sprintf(_("Failed to check existence for distribution list '%s'! Error was: '%s'."), 
 
94
                        $this->orig_cn, $rpc->get_error());
 
95
                msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
96
                return;
 
97
            }
 
98
        }
 
99
 
 
100
        // We've detected a valid distribution list, now load all
 
101
        //  configured members, so we're able to update the memberlist
 
102
        //  on save();
 
103
        $memberList = array();
 
104
        $primaryMailAddress = "";
 
105
        $mailSizeLimit = NULL;
 
106
        $alternateAddresses = array();
 
107
 
 
108
        if($is_account){
 
109
 
 
110
            // Load list of members 
 
111
            $memberList = $rpc->gwDistGetMembers($this->orig_cn);
 
112
            if(!$rpc->success()){
 
113
                $this->rpcError = TRUE;
 
114
                $this->rpcErrorMessage = $rpc->get_error();
 
115
                $message = sprintf(_("Failed to load members for distribution list '%s'! Error was: '%s'."), 
 
116
                        $this->orig_cn, $rpc->get_error());
 
117
                msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
118
                return;
 
119
            }
 
120
 
 
121
            // Now get the primary mail address
 
122
            $primaryMailAddress = $rpc->gwDistGetPrimaryMailAddress($this->orig_cn); 
 
123
            if(!$rpc->success()){
 
124
                $this->rpcError = TRUE;
 
125
                $this->rpcErrorMessage = $rpc->get_error();
 
126
                $message = sprintf(_("Failed to load the primary mail address for distribution list '%s'! Error was: '%s'."), 
 
127
                        $this->orig_cn, $rpc->get_error());
 
128
                msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
129
                return;
 
130
            }
 
131
 
 
132
            // Load alternate mail address 
 
133
            if($this->featureEnabled('alternateAddresses')){
 
134
                $alternateAddresses = $rpc->gwDistGetAlternateMailAddresses($this->orig_cn); 
 
135
                if(!$rpc->success()){
 
136
                    $this->rpcError = TRUE;
 
137
                    $this->rpcErrorMessage = $rpc->get_error();
 
138
                    $message = sprintf(_("Failed to load alternate mail addresses for distribution list '%s'! Error was: '%s'."), 
 
139
                            $this->orig_cn, $rpc->get_error());
 
140
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
141
                    return;
 
142
                }
 
143
            }
 
144
 
 
145
            // Load mail size limitation settings 
 
146
            if($this->featureEnabled('mailSizeLimit')){
 
147
                $mailSizeLimit = $rpc->gwDistGetMailLimit($this->orig_cn); 
 
148
                if(!$rpc->success()){
 
149
                    $this->rpcError = TRUE;
 
150
                    $this->rpcErrorMessage = $rpc->get_error();
 
151
                    $message = sprintf(_("Failed to load mail size limit for distribution list '%s'! Error was: '%s'."), 
 
152
                            $this->orig_cn, $rpc->get_error());
 
153
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
154
                    return;
 
155
                }
 
156
                $mailSizeLimit = $mailSizeLimit['receive'];
 
157
            }
 
158
        }
 
159
 
 
160
        // Store values as current and initial values (saved_attributes) 
 
161
        //  to be able to keep track och changes.
 
162
        $this->is_account = $this->initially_was_account = $is_account;
 
163
        $this->saved_attributes = array();
 
164
        $this->memberList = $this->saved_attributes['memberList'] = $memberList;
 
165
        $this->primaryMailAddress = $this->saved_attributes['primaryMailAddress'] = $primaryMailAddress;
 
166
        $this->alternateAddresses = $this->saved_attributes['alternateAddresses'] = $alternateAddresses;
 
167
        $this->mailSizeLimit = $this->saved_attributes['mailSizeLimit'] = $mailSizeLimit;
 
168
        $this->capabilities = $capabilities;        
 
169
        $this->initialized = TRUE;
 
170
    }
 
171
 
 
172
 
 
173
    /*!  \brief     Gets the uids for the ogroup members.
 
174
     */
 
175
    function getOgroupMemberList()
 
176
    {
 
177
        $ldap = $this->config->get_ldap_link();
 
178
        $ldap->cd($this->config->current['BASE']);
 
179
        $members = array();
 
180
        foreach($this->parent->by_object['ogroup']->memberList as $dn => $data){
 
181
            if($data['type'] == 'U'){
 
182
                $ldap->cat($dn, array('uid'));
 
183
                if($ldap->count()){
 
184
                    $attrs = $ldap->fetch();
 
185
                    if(isset($attrs['uid'][0])) $members[] = $attrs['uid'][0];
 
186
                }
 
187
            }
 
188
        }
 
189
        return($members);
 
190
    }
 
191
 
 
192
 
 
193
    function execute()
 
194
    {
 
195
        plugin::execute();
 
196
 
 
197
        // Initialization failed - Display a stripped template which allows 
 
198
        //  to retry initialization
 
199
        if(!$this->initialized){
 
200
            $smarty = get_smarty();
 
201
            $smarty->assign('rpcError' , $this->rpcError);
 
202
            $smarty->assign('rpcErrorMessage' , $this->rpcErrorMessage);
 
203
            return($smarty->fetch(get_template_path('GroupwareDistributionList/initFailed.tpl', TRUE)));
 
204
        }
 
205
 
 
206
        // Log account access
 
207
        if($this->is_account && !$this->view_logged){
 
208
            $this->view_logged = TRUE;
 
209
            new log("view","ogroups/".get_class($this),$this->dn);
 
210
        }
 
211
 
 
212
        // Allow to add or remove the distribution list extension 
 
213
        if(isset($_POST['modify_state'])){
 
214
            if($this->is_account && $this->acl_is_removeable()){
 
215
                $this->is_account= FALSE;
 
216
            }elseif(!$this->is_account && $this->acl_is_createable()){
 
217
                $this->is_account= TRUE;
 
218
            }
 
219
        }
 
220
 
 
221
        // Show account status-changer
 
222
        if ($this->parent !== NULL){
 
223
            if ($this->is_account){
 
224
                $display= $this->show_disable_header(_("Remove distribution list"),
 
225
                        msgPool::featuresEnabled(_("Distribution list")));
 
226
            } else {
 
227
                $display= $this->show_enable_header(_("Create distribution list"),
 
228
                        msgPool::featuresDisabled(_("Distribution list")));
 
229
                return ($display);
 
230
            }
 
231
        }
 
232
 
 
233
 
 
234
        /****************
 
235
          Alternate addresses
 
236
         ****************/
 
237
 
 
238
        // Add manually inserted alternate mail address.
 
239
        if (isset($_POST['addAlternateAddress'])){
 
240
            $valid= FALSE;
 
241
            if (!tests::is_email($_POST['alternateAddressInput'])){
 
242
                msg_dialog::display(_("Error"),msgPool::invalid(_("Mail address"),
 
243
                            "","","your-domain@your-domain.com"),ERROR_DIALOG);
 
244
            } else {
 
245
                $valid= TRUE;
 
246
            }
 
247
            if ($valid && ($user= $this->addAlternate (get_post('alternateAddressInput'))) != ""){
 
248
                $ui= get_userinfo();
 
249
                $addon= "";
 
250
                if ($user[0] == "!") {
 
251
                    $addon= sprintf(_("Address is already in use by group '%s'."), mb_substr($user, 1));
 
252
                } else {
 
253
                    $addon= sprintf(_("Address is already in use by user '%s'."), $user);
 
254
                }
 
255
                msg_dialog::display(_("Error"), msgPool::duplicated(_("Mail address"))."<br><br><i>".
 
256
                        "$addon</i>", ERROR_DIALOG);
 
257
            }
 
258
        }
 
259
 
 
260
        // Remove alternate mail address.
 
261
        if (isset($_POST['deleteAlternateAddress']) && isset($_POST['alternateAddressList'])){
 
262
            $this->delAlternate ($_POST['alternateAddressList']);
 
263
        }
 
264
 
 
265
 
 
266
        /****************
 
267
          Generate HTML output
 
268
         ****************/
 
269
 
 
270
        $smarty = get_smarty();
 
271
        $smarty->assign('rpcError' , $this->rpcError);
 
272
        foreach(array("primaryMailAddress","alternateAddresses","mailSizeLimit") as $attr){
 
273
            $smarty->assign("{$attr}ACL", $this->getacl($attr));
 
274
            $smarty->assign($attr, set_post($this->$attr));
 
275
        }
 
276
        foreach(array('mailSizeLimit','alternateAddresses') as $feature){
 
277
            $smarty->assign("{$feature}_isActive", $this->featureEnabled($feature));
 
278
        }
 
279
        
 
280
 
 
281
        $smarty->assign("useMailSizeLimit", ($this->mailSizeLimit != NULL));
 
282
        $smarty->assign("memberList", set_post($this->memberList));
 
283
        $smarty->assign('rpcErrorMessage' , $this->rpcErrorMessage);
 
284
        return($display.$smarty->fetch(get_template_path('GroupwareDistributionList/generic.tpl', TRUE)));
 
285
    }
 
286
 
 
287
 
 
288
    /*! \brief  ACL settings
 
289
     */
 
290
    static function plInfo()
 
291
    {
 
292
        return (array(
 
293
                    "plShortName"     => _("Distribution list"),
 
294
                    "plDescription"   => _("Groupware distribution lists"),
 
295
                    "plSelfModify"    => FALSE,
 
296
                    "plDepends"       => array("ogroup"),                     // This plugin depends on
 
297
                    "plPriority"      => 4,                                 // Position in tabs
 
298
                    "plSection"     => array("administration"),
 
299
                    "plCategory"    => array("ogroups"),
 
300
                    "plOptions"       => array(),
 
301
                    "plProvidedAcls"  => array(
 
302
                        "primaryMailAddress"   => _("Mail address"),
 
303
                        "mailSizeLimit"   => _("Mail size limit"),
 
304
                        "alternateAddresses"   => _("Alternate mail addresses"))
 
305
                    ));
 
306
    }
 
307
 
 
308
 
 
309
    /*! \brief  Get posted values and check which are interesting for us.
 
310
     */ 
 
311
    function save_object()
 
312
    {
 
313
        if(isset($_POST['retryInit'])){
 
314
            $this->init();
 
315
        }
 
316
        if(isset($_POST['DistributionList_posted'])){
 
317
            if(!isset($_POST['useMailSizeLimit'])) $this->mailSizeLimit = NULL;
 
318
            plugin::save_object();
 
319
        }
 
320
    }
 
321
 
 
322
 
 
323
    /*! \brief  Add given mail address to the list of alternate adresses,
 
324
     *           check if this mal address is used, skip addition in this case.
 
325
     */
 
326
    function addAlternate($address)
 
327
    {
 
328
        if(empty($address)) return;
 
329
        if($this->acl_is_writeable("alternateAddresses")){
 
330
            $ldap= $this->config->get_ldap_link();
 
331
            $address= strtolower($address);
 
332
 
 
333
            /* Is this address already assigned in LDAP? */
 
334
            $ldap->cd ($this->config->current['BASE']);
 
335
            $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)".
 
336
                    "(alias=$address)(gosaMailAlternateAddress=$address)))", array("uid", "cn"));
 
337
            if ($ldap->count() > 0){
 
338
                $attrs= $ldap->fetch ();
 
339
                if (!isset($attrs["uid"])) {
 
340
                    return ("!".$attrs["cn"][0]);
 
341
                }
 
342
                return ($attrs["uid"][0]);
 
343
            }
 
344
            if (!in_array($address, $this->alternateAddresses)){
 
345
                $this->alternateAddresses[]= $address;
 
346
                $this->is_modified= TRUE;
 
347
            }
 
348
            sort ($this->alternateAddresses);
 
349
            reset ($this->alternateAddresses);
 
350
            return ("");
 
351
        }else{
 
352
            msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
 
353
        }
 
354
    }
 
355
 
 
356
 
 
357
    /*!   \brief    Removes the distribution list extension from the current 
 
358
     *               object group.
 
359
     */  
 
360
    function remove_from_parent()
 
361
    {
 
362
        // Do nothing if this asn't an active account before.
 
363
        if(!$this->initially_was_account) return;
 
364
 
 
365
        // Remove distribution list 
 
366
        $rpc = $this->config->getRpcHandle();
 
367
        $rpc->gwDistDel($this->orig_cn);
 
368
 
 
369
        // An error occured abort here
 
370
        if(!$rpc->success()){
 
371
            $this->rpcError = TRUE;
 
372
            $this->rpcErrorMessage = $rpc->get_error();
 
373
            $message = sprintf(_("Failed to remove the distribution list '%s'! Error was: '%s'."), 
 
374
                    $this->orig_cn, $rpc->get_error());
 
375
            msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
376
            return;
 
377
        }
 
378
    }
 
379
 
 
380
 
 
381
    /*!   \brief    Saves the distribution list extension for the current 
 
382
     *               object group.
 
383
     */  
 
384
    function save()
 
385
    {
 
386
        // Cast mailSizeLimit to integer
 
387
        if($this->mailSizeLimit!=NULL){
 
388
           $this->mailSizeLimit += 0;
 
389
        }
 
390
 
 
391
        // If this is a new account then add it.
 
392
        $rpc = $this->config->getRpcHandle();
 
393
        if(!$this->initially_was_account){
 
394
            $rpc->gwDistAdd($this->cn, $this->primaryMailAddress);
 
395
            if(!$rpc->success()){
 
396
                $message = sprintf(_("Failed to add distribution list '%s'! Error was: '%s'."), 
 
397
                        $this->cn, $rpc->get_error());
 
398
                return;
 
399
            }
 
400
        }
 
401
 
 
402
        // Rename distribution list if cn has changed.
 
403
        if($this->cn != $this->orig_cn && $this->initially_was_account){
 
404
            $rpc->gwDistRename($this->orig_cn, $this->cn);
 
405
            if(!$rpc->success()){
 
406
                $message = sprintf(_("Failed to rename distribution list '%s' to '%s'! Error was: '%s'."), 
 
407
                        $this->orig_cn,$this->cn, $rpc->get_error());
 
408
                msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
409
                return;
 
410
            }
 
411
        }
 
412
 
 
413
        // Updated primaryMailAddress value, if needed:  
 
414
        //  -> the value for 'primaryMailAddress' has changed.
 
415
        if($this->initially_was_account && $this->primaryMailAddress != $this->saved_attributes['primaryMailAddress']){
 
416
            $rpc->gwDistSetPrimaryMailAddress($this->cn, $this->primaryMailAddress);
 
417
            if(!$rpc->success()){
 
418
                $message = sprintf(_("Failed to update the primary mail address for distribution list '%s'! Error was: '%s'."), 
 
419
                        $this->cn, $rpc->get_error());
 
420
                msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
421
            }
 
422
        }
 
423
 
 
424
        // Updated mail size limitations, if needed:  
 
425
        //  -> is a new distribution list or
 
426
        //  -> the value for 'mailSizeLimit' has changed.
 
427
        if($this->featureEnabled('mailSizeLimit')){
 
428
            if(!$this->initially_was_account || $this->mailSizeLimit != $this->saved_attributes['mailSizeLimit']){
 
429
                $rpc->gwDistSetMailLimit($this->cn, $this->mailSizeLimit);
 
430
                if(!$rpc->success()){
 
431
                    $message = sprintf(_("Failed to update mail size limitations for distribution list '%s'! Error was: '%s'."), 
 
432
                            $this->cn, $rpc->get_error());
 
433
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
434
                }
 
435
            }
 
436
        }
 
437
 
 
438
        // Updated alternate mail addresses, if needed:  
 
439
        //  -> is a new distribution list or
 
440
        //  -> the value for 'alternateAddresses' has changed.
 
441
        if($this->featureEnabled('alternateAddresses')){
 
442
            sort($this->alternateAddresses);
 
443
            sort($this->saved_attributes['alternateAddresses']);
 
444
            $changed = array_differs($this->alternateAddresses,$this->saved_attributes['alternateAddresses']);
 
445
            if(!$this->initially_was_account || $changed){
 
446
                $rpc->gwDistSetAlternateMailAddresses($this->cn, $this->alternateAddresses);
 
447
                if(!$rpc->success()){
 
448
                    $message = sprintf(_("Failed to update alternate addresses for distribution list '%s'! Error was: '%s'."), 
 
449
                            $this->cn, $rpc->get_error());
 
450
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
451
                }
 
452
            }
 
453
        }
 
454
 
 
455
        // Check which object-group member have a valid groupware mail addresses.
 
456
        // We can only add valid groupware extensions as distribution list member.
 
457
        $uids = $this->getOgroupMemberList();
 
458
        $rpc = $this->config->getRpcHandle(); 
 
459
        $verified = $rpc->gwVerifyAcct($uids);
 
460
        $hasExt = array();
 
461
        if(!$rpc->success()){
 
462
            $messages[] = sprintf(_("Failed to verify account ids! Error was: '%s'."),$rpc->get_error());
 
463
        }else{
 
464
            $hasExt = array();
 
465
            foreach($verified as $uid => $mail){
 
466
                if(!empty($mail)) $hasExt[] = $mail;
 
467
            }   
 
468
        }
 
469
 
 
470
        // Check for added or removed distribution list members now.
 
471
        $all = array_merge($hasExt, $this->saved_attributes['memberList']);
 
472
        foreach($all as $member){
 
473
            if(!in_array($member,$hasExt)){
 
474
                $rpc->gwDistDelMember($this->cn, $member);
 
475
                if(!$rpc->success()){
 
476
                    $message = sprintf(_("Failed to remove member '%s' from distribution list '%s'! Error was: '%s'."), 
 
477
                            $member, $this->cn, $rpc->get_error());
 
478
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
479
                }
 
480
            }elseif(!in_array($member,$this->saved_attributes['memberList'])){
 
481
                $rpc->gwDistAddMember($this->cn, $member);
 
482
                if(!$rpc->success()){
 
483
                    $message = sprintf(_("Failed to add member '%s' to distribution list '%s'! Error was: '%s'."), 
 
484
                            $member, $this->cn, $rpc->get_error());
 
485
                    msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
 
486
                }
 
487
            }
 
488
        }
 
489
    }
 
490
 
 
491
 
 
492
    /*! \brief  Removes the given mail address from the alternate addresses list
 
493
     */
 
494
    function delAlternate($addresses)
 
495
    {
 
496
        if($this->acl_is_writeable("alternateAddresses")){
 
497
            $this->alternateAddresses= array_remove_entries ($addresses,$this->alternateAddresses);
 
498
            $this->is_modified= TRUE;
 
499
        }else{
 
500
            msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
 
501
        }
 
502
    }
 
503
 
 
504
    
 
505
    function check()
 
506
    {
 
507
        $messages = plugin::check();
 
508
 
 
509
        // Get current object-group name maybe it is invalid for us.
 
510
        if(isset($this->parent->by_object['ogroup']->cn)){
 
511
            $this->cn = &$this->parent->by_object['ogroup']->cn;
 
512
        }
 
513
 
 
514
        // Validate email address
 
515
        if(!tests::is_email($this->primaryMailAddress)) {
 
516
            $messages[] = msgPool::invalid(_("Mail address"), $this->primaryMailAddress, '', 'example@gonicus.de');
 
517
        }
 
518
 
 
519
        // Validate email address
 
520
        if($this->featureEnabled('mailSizeLimit')){
 
521
            if($this->mailSizeLimit != NULL && !is_numeric($this->mailSizeLimit)){
 
522
                $messages[] = msgPool::invalid(_("Incoming mail size limitation"), $this->mailSizeLimit, '/[0-9]/' );
 
523
            }
 
524
        }
 
525
 
 
526
        // Check which accounts have valid groupware mail addresses.
 
527
        if(!count($messages)){
 
528
            $uids = $this->getOgroupMemberList();
 
529
            $rpc = $this->config->getRpcHandle(); 
 
530
            $verified = $rpc->gwVerifyAcct($uids);
 
531
            if(!$rpc->success()){
 
532
                $messages[] = sprintf(_("Failed to verify account ids! Error was: '%s'."),$rpc->get_error());
 
533
            }else{
 
534
                $noExt = array();
 
535
                foreach($verified as $uid => $mail){
 
536
                    if(empty($mail)) $noExt[] = $uid;
 
537
                }   
 
538
                if(count($noExt)){
 
539
                    $message = sprintf(_("The following object group members do not have a valid groupware extension and will be ignored as distribution list members: %s"),msgPool::buildList($noExt));
 
540
                    msg_dialog::display(_("Info"),$message, INFO_DIALOG);
 
541
                }
 
542
            }
 
543
        }
 
544
        
 
545
        return($messages);
 
546
    }
 
547
}
 
548
?>