2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
38 class EmailManController extends SugarController
40 function action_Save(){
43 require_once('include/OutboundEmail/OutboundEmail.php');
44 require_once('modules/Configurator/Configurator.php');
46 $configurator = new Configurator();
49 if ( !is_admin($current_user)
50 && !is_admin_for_module($GLOBALS['current_user'],'Emails')
51 && !is_admin_for_module($GLOBALS['current_user'],'Campaigns') ){
52 sugar_die("Unauthorized access to administration.");
55 //Do not allow users to spoof for sendmail if the config flag is not set.
56 if( !isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound'])
57 $_REQUEST['mail_sendtype'] = "SMTP";
59 // save Outbound settings #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
60 if(isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
61 $oe = new OutboundEmail();
62 $oe->populateFromPost();
68 $focus = new Administration();
70 if(isset($_POST['tracking_entities_location_type'])) {
71 if ($_POST['tracking_entities_location_type'] != '2') {
72 unset($_POST['tracking_entities_location']);
73 unset($_POST['tracking_entities_location_type']);
76 // cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
77 if( !isset($_POST['mail_smtpauth_req']) )
79 $_POST['mail_smtpauth_req'] = 0;
80 if (empty($_POST['campaignConfig'])) {
81 $_POST['notify_allow_default_outbound'] = 0; // If smtp auth is disabled ensure outbound is disabled.
85 if( !empty($_POST['notify_allow_default_outbound']) )
87 $oe = new OutboundEmail();
88 if( !$oe->isAllowUserAccessToSystemDefaultOutbound() )
89 $oe->removeUserOverrideAccounts();
94 // save User defaults for emails
95 $configurator->config['email_default_delete_attachments'] = (isset($_REQUEST['email_default_delete_attachments'])) ? true : false;
97 ///////////////////////////////////////////////////////////////////////////////
100 if(isset($_REQUEST['applet'])) $security['applet'] = 'applet';
101 if(isset($_REQUEST['base'])) $security['base'] = 'base';
102 if(isset($_REQUEST['embed'])) $security['embed'] = 'embed';
103 if(isset($_REQUEST['form'])) $security['form'] = 'form';
104 if(isset($_REQUEST['frame'])) $security['frame'] = 'frame';
105 if(isset($_REQUEST['frameset'])) $security['frameset'] = 'frameset';
106 if(isset($_REQUEST['iframe'])) $security['iframe'] = 'iframe';
107 if(isset($_REQUEST['import'])) $security['import'] = '\?import';
108 if(isset($_REQUEST['layer'])) $security['layer'] = 'layer';
109 if(isset($_REQUEST['link'])) $security['link'] = 'link';
110 if(isset($_REQUEST['object'])) $security['object'] = 'object';
111 if(isset($_REQUEST['style'])) $security['style'] = 'style';
112 if(isset($_REQUEST['xmp'])) $security['xmp'] = 'xmp';
113 $security['script'] = 'script';
115 $configurator->config['email_xss'] = base64_encode(serialize($security));
118 ///////////////////////////////////////////////////////////////////////////////
120 ksort($sugar_config);
122 $configurator->handleOverride();