Changeset 23 for trunk/expressoAdmin1_2/inc/class.maillist.inc.php
- Timestamp:
- 05/07/07 15:06:04 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.maillist.inc.php
r15 r23 262 262 } 263 263 264 function save_scl($new_values) 265 { 266 // Verifica o acesso do gerente 267 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_maillists')) 268 { 269 $return['status'] = false; 270 $return['msg'] = 'Você não tem acesso para editar listas de email.'; 271 return $return; 272 } 273 274 $return['status'] = true; 275 276 //Retira os uids duplicados se existir 277 $array_tmp = array(); 278 $array_tmp = array_unique($new_values['members']); 279 $new_values['members'] = $array_tmp; 280 281 $old_values = $this->get_scl_info($new_values['uidnumber'], $new_values['manager_context']); 282 $diff = array_diff($new_values, $old_values); 283 $dn = $old_values['dn']; 284 285 //echo '<pre>'; 286 //print_r($new_values['participantCanSendMail']); 287 //print_r($old_values['participantCanSendMail']); 288 289 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 290 // ADD ATTRS 291 if (($new_values['participantCanSendMail'] == 'on') && ($old_values['participantCanSendMail'] == '')) 292 { 293 $ldap_add['participantCanSendMail'] = "TRUE"; 294 $this->db_functions->write_log("Ativado participantCanSendMail da SCL da lista de email " . $new_values['mail'],'','','',''); 295 } 296 if (($new_values['accountRestrictive'] == 'on') && ($old_values['accountRestrictive'] == '')) 297 { 298 $ldap_add['accountRestrictive'] = "mailListRestriction"; 299 $ldap_add['accountDeliveryMessage'] = 'OK'; 300 $this->db_functions->write_log("Ativado mailListRestriction da SCL da lista de email " . $new_values['mail'],'','','',''); 301 } 302 if (count($ldap_add)) 303 { 304 $result = $this->ldap_functions->add_user_attributes($dn, $ldap_add); 305 if (!$result['status']) 306 { 307 $return['status'] = false; 308 $return['msg'] .= $result['msg']; 309 } 310 } 311 312 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 313 // REMOVE ATTRS 314 if (($new_values['participantCanSendMail'] != 'on') && ($old_values['participantCanSendMail'] == 'TRUE')) 315 { 316 $ldap_remove['participantCanSendMail'] = array(); 317 $this->db_functions->write_log("Desativado participantCanSendMail da SCL da lista de email " . $new_values['mail'],'','','',''); 318 } 319 if (($new_values['accountRestrictive'] != 'on') && ($old_values['accountRestrictive'] == 'mailListRestriction')) 320 { 321 $ldap_remove['accountRestrictive'] = array(); 322 $ldap_remove['accountDeliveryMessage'] = array(); 323 $this->db_functions->write_log("Desativado restrição (mailListRestriction) da SCL da lista de email " . $new_values['mail'],'','','',''); 324 } 325 if (count($ldap_remove)) 326 { 327 $result = $this->ldap_functions->remove_user_attributes($dn, $ldap_remove); 328 if (!$result['status']) 329 { 330 $return['status'] = false; 331 $return['msg'] .= $result['msg']; 332 } 333 } 334 335 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 336 // USERS 337 338 if (!$new_values['members']) 339 $new_values['members'] = array(); 340 if (!$old_values['members']) 341 $old_values['members'] = array(); 342 343 $add_users = array_diff($new_values['members'], $old_values['members']); 344 $remove_users = array_diff($old_values['members'], $new_values['members']); 345 346 if (count($add_users)>0) 347 { 348 $array_emails_add = array(); 349 foreach($add_users as $uidnumber) 350 { 351 $mail = $this->ldap_functions->uidnumber2mail($uidnumber); 352 $array_emails_add[] = $mail; 353 $this->db_functions->write_log("Adicionado usuario $mail a SCL da lista $dn",'',$uidnumber,'',''); 354 } 355 $result = $this->ldap_functions->add_user2maillist_scl($dn, $array_emails_add); 356 if (!$result['status']) 357 { 358 $return['status'] = false; 359 $return['msg'] .= $result['msg']; 360 } 361 362 } 363 364 if (count($remove_users)>0) 365 { 366 $array_emails_remove = array(); 367 foreach($remove_users as $uidnumber) 368 { 369 $mail = $this->ldap_functions->uidnumber2mail($uidnumber); 370 $array_emails_remove[] = $mail; 371 $this->db_functions->write_log("Removido usuario $mail da SCP da lista $dn",'',$uidnumber,'',''); 372 } 373 $result = $this->ldap_functions->remove_user2maillist_scl($dn, $array_emails_remove); 374 if (!$result['status']) 375 { 376 $return['status'] = false; 377 $return['msg'] .= $result['msg']; 378 } 379 } 380 381 return $return; 382 } 264 383 265 384 function get_info($uidnumber, $context) 266 385 { 267 386 $maillist_info_ldap = $this->ldap_functions->get_maillist_info($uidnumber, $context); 387 return $maillist_info_ldap; 388 } 389 390 function get_scl_info($uidnumber, $context) 391 { 392 $maillist_info_ldap = $this->ldap_functions->get_maillist_scl_info($uidnumber, $context); 268 393 return $maillist_info_ldap; 269 394 }
Note: See TracChangeset
for help on using the changeset viewer.