pax_global_header00006660000000000000000000000064131365734120014517gustar00rootroot0000000000000052 comment=bdb7409539f8db826622e24426b44eedaf9ebae9 gosa-plugin-mailaddress-0.99.6/000077500000000000000000000000001313657341200163375ustar00rootroot00000000000000gosa-plugin-mailaddress-0.99.6/AUTHORS.txt000066400000000000000000000002141313657341200202220ustar00rootroot00000000000000The Mail Addres Plugin for GOsa² has been derived from gosa-plugin-mail is developed by Mike Gabriel gosa-plugin-mailaddress-0.99.6/COPYING000066400000000000000000000355641313657341200174070ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS gosa-plugin-mailaddress-0.99.6/ChangeLog000066400000000000000000000120031313657341200201050ustar00rootroot000000000000002017-07-28 10:34:18 +0200 Mike Gabriel (b6803b6) * release 0.99.6 (HEAD -> master) 2017-07-28 10:30:48 +0200 Mike Gabriel (eb5651e) * PHP 7 compatibility: Fix parent constructor calls. (gh/master) 2015-10-30 19:20:35 +0100 Mike Gabriel (61e0c6e) * Drop "²" from GOsa in headline. 2015-10-30 19:03:16 +0100 Mike Gabriel (cc5f919) * Make README.md headline match Github project description. 2015-10-30 19:02:55 +0100 Mike Gabriel (637ace0) * Fix missing line break at EOF. 2015-10-30 19:00:56 +0100 Mike Gabriel (81fb319) * Add AUTHORS.txt file. 2015-10-30 18:59:39 +0100 Mike Gabriel (01405cc) * Add README.md file that explains about this plugin. 2015-10-30 11:54:44 +0100 Mike Gabriel (31501f5) * Add README.gosa-compat, compatible with GOsa² 2.7.x. (origin/master) 2015-09-16 15:19:54 +0200 Mike Gabriel (4d1fbde) * Don't lower-case mail addresses. The user should be allowed to stored mingled-cased mail addresses in the LDAP address book. 2015-09-01 14:18:49 +0200 Mike Gabriel (49af559) * fine-tune .tpl gettext extraction for parameterized {t} blocks 2015-09-01 13:50:06 +0200 Mike Gabriel (6616b63) * update-locale: Make parameterized {t} blocks translatable. 2015-08-27 12:15:01 +0200 Mike Gabriel (2e07b7f) * release 0.99.5 (tag: 0.99.5) 2015-08-27 12:14:33 +0200 Mike Gabriel (4df0a5b) * fix indentations, provide comment block for class_groupMail.inc 2015-08-27 12:00:25 +0200 Mike Gabriel (6c81415) * class_mailAccount: Fix incomplete line of code. 2015-08-27 01:14:17 +0200 Mike Gabriel (2608aac) * release 0.99.4 (tag: 0.99.4) 2015-08-27 01:16:50 +0200 Mike Gabriel (cbc1f9b) * pre-release white-space cleanup 2015-08-27 01:10:26 +0200 Mike Gabriel (27d803c) * update i18n 2015-08-27 01:01:03 +0200 Mike Gabriel (f926e25) * empty mail field on multi-edits: Remember objects' former mail addresses and reinstate them after plugin::set_multi_edit_values() has been called. 2015-08-27 00:53:54 +0200 Mike Gabriel (cf29954) * class_groupMail: Only set object into is_account state, if a mail pattern is provided. 2015-08-27 00:48:00 +0200 Mike Gabriel (c969f70) * class_mailAccount: On multi-edit actions, interprete an empty mail pattern as no action to take on mail address fields. 2015-08-27 00:44:17 +0200 Mike Gabriel (a7cb30d) * object creation on multi-edits: If mailaddress object is not yet in account state, set it into that state on multi-edit actions. 2015-08-27 00:21:54 +0200 Mike Gabriel (257294b) * smarty-gettext obviously does not render html entities, using curly braces in translations instead 2015-08-27 00:03:24 +0200 Mike Gabriel (9c30df8) * .tpl files: Replace smarty tags {ldelim} and {rdelim} by the corresponding html entities to fix gettext translations. 2015-08-26 23:10:10 +0200 Mike Gabriel (17f7985) * class_groupMail.inc: Drop translation for acl property. Not needed in gosa-plugin-mailaddress. 2015-08-26 22:52:11 +0200 Mike Gabriel (e463331) * de.po: Rework translation of mail everywhere (e-Mail -> Mail). 2015-08-26 22:43:35 +0200 Mike Gabriel (a7f3b68) * class_groupMail.inc: Clean variable declarartions. 2015-08-26 22:35:54 +0200 Mike Gabriel (8fb474f) * class_groupMail.inc: Make sure that sanity checks on entered mail addresses actually happen. 2015-08-26 21:59:49 +0200 Mike Gabriel (aa95ba9) * de.po: Fix line wrappeing (via poedit). 2015-08-26 21:47:26 +0200 Mike Gabriel (771cbf4) * de.po: Typo fix. 2015-08-26 21:39:37 +0200 Mike Gabriel (36b7b1b) * update locale 2015-08-26 21:39:28 +0200 Mike Gabriel (55d6fee) * Drop the idea of listing mails about to be changed with mailAccount multi-edit. 2015-08-26 21:38:43 +0200 Mike Gabriel (492d71e) * paste_mailaddress.tpl: Rephrase translatable strings, drop "Add local" button. 2015-08-26 20:50:35 +0200 Mike Gabriel (19c366d) * initial draft of a groupMail mail address plugin 2015-08-26 16:21:56 +0200 Mike Gabriel (7a64e2c) * line break added 2015-08-26 16:21:46 +0200 Mike Gabriel (f840553) * some hightlighting fixes for mcedit in comments 2015-08-26 16:20:45 +0200 Mike Gabriel (23ab94e) * mailAccount: Add multi-edit support. 2015-08-05 20:34:48 +0200 Mike Gabriel (bc3d0e4) * release 0.99.3 (tag: 0.99.3) 2015-08-05 20:01:05 +0200 Mike Gabriel (b6233e5) * Fix typo (gosaMailserver -> gosaMailServer). 2015-08-05 19:59:46 +0200 Mike Gabriel (8ba90bd) * update header of German locale file 2015-08-05 19:11:46 +0200 Mike Gabriel (e295862) * release 0.99.2 (tag: 0.99.2) 2015-08-05 19:10:55 +0200 Mike Gabriel (810faaa) * Add COPYING file (GPL-2+). 2015-08-05 19:10:41 +0200 Mike Gabriel (281cc8b) * Drop all images obtained from gosa-plugin-mail, none is needed for this minimal plugin. 2015-08-05 18:51:49 +0200 Mike Gabriel (fce4476) * release 0.99.1 (tag: 0.99.1) 2015-08-05 18:55:58 +0200 Mike Gabriel (d57f84c) * update localization (en, de) 2015-08-05 18:50:13 +0200 Mike Gabriel (0faee72) * initial version gosa-plugin-mailaddress-0.99.6/README.gosa-compat000066400000000000000000000003401313657341200214250ustar00rootroot00000000000000GOsa² Compatibility ------------------- The Mail Address Plugin (gosa-plugin-mailaddress) has been developed and tested under GOsa² 2.7.4. -- Mike Gabriel Fr 30. Okt 11:56:15 CET 2015 gosa-plugin-mailaddress-0.99.6/README.md000066400000000000000000000012251313657341200176160ustar00rootroot00000000000000# Simple plugin for managing user mail addresses in GOsa This plugin is a very light-weighted version of the GOsa² mail plugin. Whereas gosa-plugin-mail can be used to manage a complete mail server farm, this tiny plugin only provides means to modify the user's mail address via a text field. This plugin is useful for people that need to maintain users' email addresses via GOsa², but do not run their own mailserver(s). GOsa² is a combination of system-administrator and end-user web interface, designed to handle LDAP based setups. The mail address plugin is licensed under GPL-2+. For further details, please check the AUTHORS.txt and COPYING files. gosa-plugin-mailaddress-0.99.6/admin/000077500000000000000000000000001313657341200174275ustar00rootroot00000000000000gosa-plugin-mailaddress-0.99.6/admin/groups/000077500000000000000000000000001313657341200207465ustar00rootroot00000000000000gosa-plugin-mailaddress-0.99.6/admin/groups/mailaddress/000077500000000000000000000000001313657341200232365ustar00rootroot00000000000000gosa-plugin-mailaddress-0.99.6/admin/groups/mailaddress/class_groupMail.inc000066400000000000000000000567021313657341200270670ustar00rootroot00000000000000 \version 0.99.6 \date 2015.08.27 This class provides basic information on mail accounts. This plugin has been derived from gosa-plugin-mail, but it is not used to actually control mailservers. It is only used for allowing mail information to be stored in LDAP. This plugin actually breaks gosa-mail-account and is intended to be a drop-in replacement for it in situations where it is only necessary to store information in inetOrgPerson''s mail LDAP attribute description. Functions : - mailgroup (&$config, $dn=NULL, $base_object=NULL) - execute () - remove_from_parent () - save_object () - save () - check () - adapt_from_template ($dn,$skip=array()) - make_name ($attrs) - getCopyDialog () - saveCopyDialog () - PrepareForCopyPaste ($source) - plInfo () - multiple_execute () - init_multiple_support ($attrs,$all) - multiple_save_object () - multiple_check () - get_multi_edit_values () - set_multi_edit_values ($attrs) - addForwarder ($address) - delForwarder ($addresses) - addAlternate ($address) - delAlternate ($addresses) */ class mailgroup extends plugin { /* Multiple edit */ var $gosaMailForwardingAddress_Some=array (); // Used in multiple edit /* Default values */ var $mail=""; // Default mail address var $gosaMailAlternateAddress=array (); // Set default Alternate Mail Adresses to empty array var $gosaMailForwardingAddress=array (); // Forwarding also empty /* Internal */ var $view_logged=FALSE; /* GOsa mail account attributes filled with dummy values, * required due to gosaMailAccount objectclass requirements. */ var $gosaMailServer="NULL"; var $gosaMailDeliveryMode="[ ]"; // /* attribute list for save action */ var $attributes=array ("mail","gosaMailServer","gosaMailDeliveryMode","gosaMailAlternateAddress","gosaMailForwardingAddress"); var $objectclasses=array ("gosaMailAccount"); var $multiple_support=TRUE; // Not tested yet var $uid=""; var $cn=""; function __construct (&$config,$dn=NULL,$base_object=NULL) { plugin::__construct ($config,$dn); /* Get attributes from parent object */ foreach (array ("uid","cn") as $attr) { if (isset ($this->parent->by_object['group'])&&isset ($this->parent->by_object['group']->$attr)) { $this->$attr=$this->parent->by_object['group']->$attr; } elseif (isset ($this->attrs[$attr])) { $this->$attr=$this->attrs[$attr][0]; } } /* Remember account status */ $this->initially_was_account=$this->is_account; /* Initialize configured values */ if ($this->is_account) { /* Load attributes containing arrays */ foreach (array ("gosaMailAlternateAddress","gosaMailForwardingAddress") as $val) { $this->$val=array (); if (isset ($this->attrs["$val"]["count"])) { for ($i=0;$i<$this->attrs["$val"]["count"];$i++) { array_push ($this->$val,$this->attrs["$val"][$i]); } } } } } function execute () { /* Call parent execute */ plugin::execute (); /* Log view */ if ($this->is_account&&!$this->view_logged) { $this->view_logged=TRUE; new log ("view","groups/".get_class ($this),$this->dn); } /**************** Account status ****************/ if (!$this->multiple_support_active) { if (isset ($_POST['modify_state'])) { if ($this->is_account&&$this->acl_is_removeable ()) { $this->is_account=FALSE; } elseif (!$this->is_account&&$this->acl_is_createable ()) { $this->is_account=TRUE; } } if ($this->is_account) { $display=$this->show_disable_header (msgPool::removeFeaturesButton (_ ("Mail")),msgPool::featuresEnabled (_ ("Mail"))); } else { $display=$this->show_disable_header (msgPool::addFeaturesButton (_ ("Mail")),msgPool::featuresDisabled (_ ("Mail"))); return ($display); } } /**************** Forward addresses ****************/ if (isset ($_POST['mailAddressSelect_cancel'])) { $this->mailAddressSelect=FALSE; $this->dialog=FALSE; } if (isset ($_POST['mailAddressSelect_save'])) { if ($this->acl_is_writeable ("gosaMailForwardingAddress")) { $list=$this->mailAddressSelect->save (); foreach ($list as $entry) { $val=$entry['mail'][0]; if (!in_array_strict ($val,$this->gosaMailAlternateAddress)&&$val!=$this->mail) { $this->addForwarder ($val); $this->is_modified=TRUE; } } $this->mailAddressSelect=FALSE; $this->dialog=FALSE; } else { msg_dialog::display (_ ("Error"),_ ("Please select an entry!"),ERROR_DIALOG); } } if ($this->mailAddressSelect instanceOf mailAddressSelect) { $used=array (); $used['mail']=array_values ($this->gosaMailAlternateAddress); $used['mail']=array_merge ($used['mail'],array_values ($this->gosaMailForwardingAddress)); $used['mail'][]=$this->mail; // Build up blocklist session::set ('filterBlacklist',$used); return ($this->mailAddressSelect->execute ()); } if (isset ($_POST['add_forwarder'])) { if ($_POST['forward_address']!="") { $address=get_post ('forward_address'); $valid=FALSE; if (!tests::is_email ($address)) { if (!tests::is_email ($address,TRUE)) { if ($this->is_template) { $valid=TRUE; } else { msg_dialog::display (_ ("Error"),msgPool::invalid (_ ("Mail address"),"","","your-address@your-domain.com"),ERROR_DIALOG); } } } elseif ($address==$this->mail||in_array_strict ($address,$this->gosaMailAlternateAddress)) { msg_dialog::display (_ ("Error"),_ ("Cannot add primary address to the list of forwarders!"),ERROR_DIALOG); } else { $valid=TRUE; } if ($valid) { if ($this->acl_is_writeable ("gosaMailForwardingAddress")) { $this->addForwarder ($address); $this->is_modified=TRUE; } } } } if (isset ($_POST['delete_forwarder'])) { $this->delForwarder (get_post ('forwarder_list')); } /**************** Alternate addresses ****************/ if (isset ($_POST['add_alternate'])) { $valid=FALSE; if (!tests::is_email (get_post ('alternate_address'))) { if ($this->is_template) { if (! (tests::is_email (get_post ('alternate_address'),TRUE))) { msg_dialog::display (_ ("Error"),msgPool::invalid (_ ("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG); } else { $valid=TRUE; } } else { msg_dialog::display (_ ("Error"),msgPool::invalid (_ ("Mail address"),"","","your-domain@your-domain.com"),ERROR_DIALOG); } } else { $valid=TRUE; } if ($valid&& ($user=$this->addAlternate (get_post ('alternate_address')))!="") { $ui=get_userinfo (); $addon=""; if ($user[0]=="!") { $addon=sprintf (_ ("Address is already in use by group '%s'."),mb_substr ($user,1)); } else { $addon=sprintf (_ ("Address is already in use by user '%s'."),$user); } msg_dialog::display (_ ("Error"),msgPool::duplicated (_ ("Mail address"))."

"."$addon",ERROR_DIALOG); } } if (isset ($_POST['delete_alternate'])&&isset ($_POST['alternates_list'])) { $this->delAlternate (get_post ('alternates_list')); } /**************** SMARTY- Assign smarty variables ****************/ /* Load templating engine */ $smarty=get_smarty (); $smarty->assign ("initially_was_account",$this->initially_was_account); /* Assign acls */ $tmp=$this->plInfo (); foreach ($tmp['plProvidedAcls'] as $name=>$translation) { $smarty->assign ($name."ACL",$this->getacl ($name)); } foreach ($this->attributes as $name) { $smarty->assign ($name,set_post ($this->$name)); } /****** Multi edit support ******/ foreach ($this->attributes as $attr) { if (in_array_strict ($attr,$this->multi_boxes)) { $smarty->assign ("use_".$attr,TRUE); } else { $smarty->assign ("use_".$attr,FALSE); } } $smarty->assign ("Forward_all",set_post ($this->gosaMailForwardingAddress)); $smarty->assign ("Forward_some",set_post ($this->gosaMailForwardingAddress_Some)); $smarty->assign ("multiple_support",set_post ($this->multiple_support_active)); $display.=$smarty->fetch (get_template_path ('mailaddress.tpl',TRUE,dirname (__FILE__))); return ($display); } /* remove object from parent */ function remove_from_parent () { if (!$this->initially_was_account) { return; } /* Remove GOsa attributes */ plugin::remove_from_parent (); /* Zero arrays */ $this->attrs['gosaMailAlternateAddress']=array (); $this->attrs['gosaMailForwardingAddress']=array (); $this->cleanup (); $ldap=$this->config->get_ldap_link (); $ldap->cd ($this->dn); $ldap->modify ($this->attrs); if (!$ldap->success ()) { msg_dialog::display (_ ("LDAP error"),msgPool::ldaperror ($ldap->get_error (),$this->dn,LDAP_MOD,get_class ())); } new log ("remove","groups/".get_class ($this),$this->dn,array_keys ($this->attrs),$ldap->get_error ()); /* Optionally execute a command after we''re done */ $this->handle_post_events ("remove"); } /* Save data to object */ function save_object () { if (isset ($_POST['mailedit'])) { /* Acquire updated mail address */ if (isset ($_POST['mail'])) { $this->mail=get_post ('mail'); } $mail=$this->mail; $gosaMailServer=$this->gosaMailServer; $gosaMailDeliveryMode=$this->gosaMailDeliveryMode; plugin::save_object (); if ($this->initially_was_account&&!$this->is_template) { $this->mail=$mail; $this->gosaMailServer=$gosaMailServer; $this->gosaMailDeliveryMode=$gosaMailDeliveryMode; } } } /* Save data to LDAP, depending on is_account we save or delete */ function save () { $ldap=$this->config->get_ldap_link (); /* Enforce lowercase mail address and trim whitespaces */ $this->mail=trim (strtolower ($this->mail)); /* Call parents save to prepare $this->attrs */ plugin::save (); /* Save arrays */ $this->attrs['gosaMailAlternateAddress']=$this->gosaMailAlternateAddress; $this->attrs['gosaMailForwardingAddress']=$this->gosaMailForwardingAddress; /* Save data to LDAP */ $ldap->cd ($this->dn); $this->cleanup (); $ldap->modify ($this->attrs); if (!$ldap->success ()) { msg_dialog::display (_ ("LDAP error"),msgPool::ldaperror ($ldap->get_error (),$this->dn,LDAP_MOD,get_class ())); } if ($this->initially_was_account) { new log ("modify","groups/".get_class ($this),$this->dn,array_keys ($this->attrs),$ldap->get_error ()); } else { new log ("create","groups/".get_class ($this),$this->dn,array_keys ($this->attrs),$ldap->get_error ()); } /* Optionally execute a command after we''re done */ if ($this->initially_was_account==$this->is_account) { if ($this->is_modified) { $this->handle_post_events ("modify"); } } else { $this->handle_post_events ("add"); } } /* Check formular input */ function check () { if (!$this->is_account) return array (); $ldap=$this->config->get_ldap_link (); /* Call common method to give check the hook */ $message=plugin::check (); /* Mail address checks */ $mail=$this->mail; if (empty ($mail)) { $message[]=msgPool::required (_ ("Mail address")); } elseif (!tests::is_email ($mail)) { if ($this->is_template) { $message[]=msgPool::invalid (_ ("Mail address"),"","","{%cn}@your-domain.com"); } else { $message[]=msgPool::invalid (_ ("Mail address"),"","","your-address@your-domain.com"); } } /* Check if this mail address is already in use */ $ldap->cd ($this->config->current['BASE']); $filter="(&(!(objectClass=gosaUserTemplate))(!(cn=".$this->cn."))"."(objectClass=gosaMailAccount)"."(|(mail=".$mail.")(alias=".$mail.")(gosaMailAlternateAddress=".$mail.")))"; $ldap->search ($filter,array ("cn")); if ($ldap->count ()!=0) { $message[]=msgPool::duplicated (_ ("Mail address")); } return ($message); } /* Adapt from template, using 'dn' */ function adapt_from_template ($dn,$skip=array ()) { plugin::adapt_from_template ($dn,$skip); // Remove non ASCII charcters $this->mail=iconv ('UTF-8','US-ASCII//TRANSLIT',$this->mail); $this->mail=preg_replace ('/[^(\x20-\x7F)]*/','',$this->mail); // No spaces are allowed here $this->mail=preg_replace ("/[ ]/","",$this->mail); foreach (array ("gosaMailAlternateAddress","gosaMailForwardingAddress") as $val) { if (in_array_strict ($val,$skip)) { continue; } $this->$val=array (); if (isset ($this->attrs["$val"]["count"])) { for ($i=0;$i<$this->attrs["$val"]["count"];$i++) { $value=$this->attrs["$val"][$i]; foreach (array ("sn","givenName","uid") as $repl) { if (preg_match ("/%$repl/i",$value)) { $value=preg_replace ("/%$repl/i",$this->parent->$repl,$value); } // Remove non ASCII charcters and spaces $value=iconv ('UTF-8','US-ASCII//TRANSLIT',$this->mail); $value=preg_replace ('/[^(\x20-\x7F)]*/','',$this->mail); $value=preg_replace ("/[ ]/","",$this->mail); } array_push ($this->$val,$value); } } } } function make_name ($attrs) { $name=""; if (isset ($attrs['sn'][0])) { $name=$attrs['sn'][0]; } if (isset ($attrs['givenName'][0])) { if ($name!="") { $name.=", ".$attrs['givenName'][0]; } else { $name.=$attrs['givenName'][0]; } } if ($name!="") { $name.=" "; } return ($name); } function getCopyDialog () { if (!$this->is_account) return (""); $smarty=get_smarty (); $smarty->assign ("gosaMailAlternateAddress",set_post ($this->gosaMailAlternateAddress)); $smarty->assign ("gosaMailForwardingAddress",set_post ($this->gosaMailForwardingAddress)); $smarty->assign ("mail",set_post ($this->mail)); $display=$smarty->fetch (get_template_path ('paste_mailaddress.tpl',TRUE,dirname (__FILE__))); $ret=array (); $ret['string']=$display; $ret['status']=""; return ($ret); } function saveCopyDialog () { if (!$this->is_account) return; /* Perform ADD / REMOVE ... for mail alternate / mail forwarding addresses */ $this->execute (); if (isset ($_POST['mail'])) { $this->mail=get_post ('mail'); } } function PrepareForCopyPaste ($source) { plugin::PrepareForCopyPaste ($source); /* Reset alternate mail addresses */ $this->gosaMailAlternateAddress=array (); } /* Return plugin informations for acl handling */ static function plInfo () { return (array ("plShortName"=>_ ("Mail"),"plDescription"=>_ ("Group mail"),"plSelfModify"=>FALSE,"plDepends"=>array (),"plPriority"=>10,"plSection"=>array ("administration"),"plCategory"=>array ("groups"),"plProvidedAcls"=>array ("mail"=>_ ("Mail address"),"gosaMailAlternateAddress"=>_ ("Alternate addresses"),"gosaMailForwardingAddress"=>_ ("Forwarding addresses")))); } function multiple_execute () { return ($this->execute ()); } function init_multiple_support ($attrs,$all) { plugin::init_multiple_support ($attrs,$all); $this->gosaMailForwardingAddress=array (); if (isset ($attrs['gosaMailForwardingAddress'])) { for ($i=0;$i<$attrs['gosaMailForwardingAddress']['count'];$i++) { $this->gosaMailForwardingAddress[]=$attrs['gosaMailForwardingAddress'][$i]; } } $this->gosaMailForwardingAddress_Some=array (); if (isset ($all['gosaMailForwardingAddress'])) { for ($i=0;$i<$all['gosaMailForwardingAddress']['count'];$i++) { if (!in_array_strict ($all['gosaMailForwardingAddress'][$i],$this->gosaMailForwardingAddress)) { $this->gosaMailForwardingAddress_Some[]=$all['gosaMailForwardingAddress'][$i]; } } } } function multiple_save_object () { if (isset ($_POST['multiple_mail_group_posted'])) { plugin::multiple_save_object (); } } function multiple_check () { $message=plugin::multiple_check (); /* Mail address checks */ $mail_pattern=$this->mail; if (!empty ($mail_pattern)) { if ( (!tests::is_email ($mail_pattern,TRUE))|| (!preg_match ('/^.*{%cn}.*@.*$/i',$mail_pattern))) { $message[]=msgPool::invalid (_ ("Mail address pattern"),"","","{%cn}@your-domain.com")."


"._ ("Please make use of the {%cn} placeholder for the group part of the mail address."); } } return ($message); } /* Return selected values for multiple edit */ function get_multi_edit_values () { $ret=plugin::get_multi_edit_values (); $ret['Forward_some']=$this->gosaMailForwardingAddress_Some; $ret['Forward_all']=$this->gosaMailForwardingAddress; $ret['mail']=$this->mail; return ($ret); } function set_multi_edit_values ($attrs) { $forward=array (); foreach ($attrs['Forward_some'] as $addr) { if (in_array_strict ($addr,$this->gosaMailForwardingAddress)) { $forward[]=$addr; } } foreach ($attrs['Forward_all'] as $addr) { $forward[]=$addr; } /* Replace placeholders in mail address patterns */ $mail_pattern=$attrs['mail']; if ($mail_pattern) { $value=$this->cn; if (preg_match ("/{%cn}/",$mail_pattern)) { $attrs['mail']=str_replace ("{%cn}",$value,$mail_pattern); } /* Add mail account data, if object is not in account state, yet */ if (!$this->is_account&&$this->acl_is_createable ()) { $this->is_account=TRUE; } } else { $mail=$this->mail; } plugin::set_multi_edit_values ($attrs); if (!$mail_pattern) { $this->mail=$mail; } $this->gosaMailForwardingAddress=$forward; } /*! \brief Add given mail address to the list of forwarders. */ function addForwarder ($address) { if (empty ($address)) return; $this->gosaMailForwardingAddress[]=$address; $this->gosaMailForwardingAddress=array_unique ($this->gosaMailForwardingAddress); /* Update multiple edit values too */ if ($this->multiple_support_active) { $this->gosaMailForwardingAddress_Some=array_remove_entries (array ($address),$this->gosaMailForwardingAddress_Some); } sort ($this->gosaMailForwardingAddress); reset ($this->gosaMailForwardingAddress); $this->is_modified=TRUE; } /*! \brief Removes the given mail address from the forwarders */ function delForwarder ($addresses) { if (empty ($addresses)) return; $this->gosaMailForwardingAddress=array_remove_entries ($addresses,$this->gosaMailForwardingAddress); /* Update multiple edit values too */ if ($this->multiple_support_active) { $this->gosaMailForwardingAddress_Some=array_remove_entries ($addresses,$this->gosaMailForwardingAddress_Some); } $this->is_modified=TRUE; } /*! \brief Add given mail address to the list of alternate adresses , . check if this mal address is used, skip adding in this case */ function addAlternate ($address) { if (empty ($address)) continue; $ldap=$this->config->get_ldap_link (); $address=strtolower ($address); /* Is this address already assigned in LDAP? */ $ldap->cd ($this->config->current['BASE']); $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))",array ("cn","uid")); if ($ldap->count ()>0) { $attrs=$ldap->fetch (); if (!isset ($attrs["uid"])) { return ("!".$attrs["cn"][0]); } return ($attrs["uid"][0]); } /* Add to list of alternates */ if (!in_array_strict ($address,$this->gosaMailAlternateAddress)) { $this->gosaMailAlternateAddress[]=$address; } sort ($this->gosaMailAlternateAddress); reset ($this->gosaMailAlternateAddress); $this->is_modified=TRUE; return (""); } /*! \brief Removes the given mail address from the alternate addresses */ function delAlternate ($addresses) { if (!count ($addresses)) return; $this->gosaMailAlternateAddress=array_remove_entries ($addresses,$this->gosaMailAlternateAddress); $this->is_modified=TRUE; } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> gosa-plugin-mailaddress-0.99.6/admin/groups/mailaddress/mailaddress.tpl000066400000000000000000000066531313657341200262610ustar00rootroot00000000000000 {/if}
{if !$multiple_support}

{t}Generic{/t}

{$must} {render acl=$mailACL} {/render}
{else}

{t}Generic{/t}

{t}Please specify a mail address pattern (e.g., {%cn|@your-domain.com) or leave empty.{/t}
 
{$must} {render acl=$mailACL} {/render}
{/if} {if !$multiple_support}

{t}Alternative addresses{/t}

{render acl=$gosaMailAlternateAddressACL} {/render}
{render acl=$gosaMailAlternateAddressACL} {/render} {render acl=$gosaMailAlternateAddressACL}   {/render} {render acl=$gosaMailAlternateAddressACL} {/render}

{t}Advanced mail options{/t}

{t}Forward messages to non group members{/t}

{render acl=$gosaMailForwardingAddressACL} {/render}
{render acl=$gosaMailForwardingAddressACL} {/render} {render acl=$gosaMailForwardingAddressACL}   {/render} {render acl=$gosaMailForwardingAddressACL} {/render}
{if $multiple_support} {/if} gosa-plugin-mailaddress-0.99.6/admin/groups/mailaddress/paste_mailaddress.tpl000066400000000000000000000037461313657341200274550ustar00rootroot00000000000000

{t}Mail settings{/t}

{$must}
{t}Alternative addresses{/t}
 
{t}Forward messages to non group members{/t}
 
gosa-plugin-mailaddress-0.99.6/contrib/000077500000000000000000000000001313657341200177775ustar00rootroot00000000000000gosa-plugin-mailaddress-0.99.6/contrib/update-locale000077500000000000000000000123161313657341200224470ustar00rootroot00000000000000#!/bin/bash # This code has been taken from GOsa² core (contrib/update-locale) and # been copied here for development convenience. # # Copyright (C) 2003-2009 GONICUS GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA generate_po() { ORIG=`pwd` TEMPDIR="/tmp/gosa-locale" TRUE=`which true` echo echo "Creating temporary directory..." [ -d $TEMPDIR ] && rm -rf $TEMPDIR mkdir $TEMPDIR echo "Creating copy of GOsa..." tar c . | tar x -C $TEMPDIR echo "Converting .tpl files..." pushd . &> /dev/null cd $TEMPDIR for template in $(find . -name '*.tpl'); do echo "* converting .tpl files: $(basename $template)" sed -re 's!\{t(|\ [a-z0-9]+=.*)\}([^\{.]*)\{/t\}!!g' $template > $template.new mv $template.new $template done for template in $(find . -name '*.xml'); do echo "* converting .xml files: $(basename $template)" sed -e 's/