ViewConfig::preDisplay()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20
Metric Value
cc 4
eloc 6
nc 2
nop 0
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 20
rs 9.2
1
<?php
2
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
/*********************************************************************************
42
43
 * Description:  TODO: To be written.
44
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
45
 * All Rights Reserved.
46
 * Contributor(s): ______________________________________..
47
 ********************************************************************************/
48
49
require_once('include/MVC/View/SugarView.php');
50
require_once('modules/EmailMan/Forms.php');
51
52
class ViewConfig extends SugarView
53
{
54
    /**
55
	 * @see SugarView::_getModuleTitleParams()
56
	 */
57
	protected function _getModuleTitleParams($browserTitle = false)
58
	{
59
	    global $mod_strings;
60
61
    	return array(
62
    	   "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
63
    	   translate('LBL_MASS_EMAIL_CONFIG_TITLE','Administration'),
64
    	   );
65
    }
66
67
    /**
68
	 * @see SugarView::preDisplay()
69
	 */
70
	public function preDisplay()
71
 	{
72
 	    global $current_user;
73
74
 	    if ( !is_admin($current_user)
75
 	            && !is_admin_for_module($GLOBALS['current_user'],'Emails')
76
 	            && !is_admin_for_module($GLOBALS['current_user'],'Campaigns') )
77
 	        sugar_die("Unauthorized access to administration.");
78
    }
79
80
    /**
81
	 * @see SugarView::display()
82
	 */
83
	public function display()
84
	{
85
        global $mod_strings;
86
        global $app_list_strings;
87
        global $app_strings;
88
        global $current_user;
89
        global $sugar_config;
90
91
        echo $this->getModuleTitle(false);
92
        global $currentModule;
93
94
        $focus = new Administration();
95
        $focus->retrieveSettings(); //retrieve all admin settings.
96
        $GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
97
98
        $this->ss->assign("MOD", $mod_strings);
99
        $this->ss->assign("APP", $app_strings);
100
101
        $this->ss->assign("RETURN_MODULE", "Administration");
102
        $this->ss->assign("RETURN_ACTION", "index");
103
104
        $this->ss->assign("MODULE", $currentModule);
105
        $this->ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
106
        $this->ss->assign("HEADER", get_module_title("EmailMan", "{MOD.LBL_CONFIGURE_SETTINGS}", true));
0 ignored issues
show
Deprecated Code introduced by
The function get_module_title() has been deprecated with message: use SugarView::getModuleTitle() for MVC modules, or getClassicModuleTitle() for non-MVC modules

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
107
        $this->ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
108
        $this->ss->assign("notify_send_from_assigning_user", (isset($focus->settings['notify_send_from_assigning_user']) && !empty($focus->settings['notify_send_from_assigning_user'])) ? "checked='checked'" : "");
109
        $this->ss->assign("notify_on", ($focus->settings['notify_on']) ? "checked='checked'" : "");
110
        $this->ss->assign("notify_fromname", $focus->settings['notify_fromname']);
111
        $this->ss->assign("notify_allow_default_outbound_on", (!empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound']) ? "checked='checked'" : "");
112
113
        $this->ss->assign("mail_smtptype", $focus->settings['mail_smtptype']);
114
        $this->ss->assign("mail_smtpserver", $focus->settings['mail_smtpserver']);
115
        $this->ss->assign("mail_smtpport", $focus->settings['mail_smtpport']);
116
        $this->ss->assign("mail_smtpuser", $focus->settings['mail_smtpuser']);
117
        $this->ss->assign("mail_smtpauth_req", ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : "");
118
        $this->ss->assign("mail_haspass", empty($focus->settings['mail_smtppass'])?0:1);
119
        $this->ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
120
121
        //Assign the current users email for the test send dialogue.
122
        $this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
123
124
        $showSendMail = FALSE;
125
        $outboundSendTypeCSSClass = "yui-hidden";
126
        if(isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'])
127
        {
128
            $showSendMail = TRUE;
129
            $app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
130
            $outboundSendTypeCSSClass = "";
131
        }
132
133
        $this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
134
        $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
135
136
        ///////////////////////////////////////////////////////////////////////////////
137
        ////	USER EMAIL DEFAULTS
138
        // editors
139
        $editors = $app_list_strings['dom_email_editor_option'];
140
        $newEditors = array();
141
        foreach($editors as $k => $v) {
142
            if($k != "") { $newEditors[$k] = $v; }
143
        }
144
145
        // preserve attachments
146
        $preserveAttachments = '';
147
        if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
148
            $preserveAttachments = 'CHECKED';
149
        }
150
        $this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
151
        ////	END USER EMAIL DEFAULTS
152
        ///////////////////////////////////////////////////////////////////////////////
153
154
155
        //setting to manage.
156
        //emails_per_run
157
        //tracking_entities_location_type default or custom
158
        //tracking_entities_location http://www.sugarcrm.com/track/
159
160
        //////////////////////////////////////////////////////////////////////////////
161
        ////	EMAIL SECURITY
162
        if(!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
163
            $sugar_config['email_xss'] = getDefaultXssTags();
164
        }
165
166
        foreach(unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
167
            $this->ss->assign($k."Checked", 'CHECKED');
168
        }
169
170
        ////	END EMAIL SECURITY
171
        ///////////////////////////////////////////////////////////////////////////////
172
173
        require_once('modules/Emails/Email.php');
174
        $email = new Email();
175
        $this->ss->assign('ROLLOVER', $email->rolloverStyle);
176
        $this->ss->assign('THEME', $GLOBALS['theme']);
177
178
        $this->ss->assign("JAVASCRIPT",get_validate_record_js());
179
        $this->ss->display('modules/EmailMan/tpls/config.tpl');
180
    }
181
}
182