Issues (4069)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

modules/InboundEmail/DetailView.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
require_once('include/DetailView/DetailView.php');
43
44
require_once('include/SugarFolders/SugarFolders.php');
45
46
47
global $mod_strings;
48
global $app_strings;
49
global $sugar_config;
50
global $timedate;
51
global $theme;
52
53
/* start standard DetailView layout process */
54
$GLOBALS['log']->info("InboundEmails DetailView");
55
$focus = new InboundEmail();
56
$focus->retrieve($_REQUEST['record']);
57
if (empty($focus->id)) {
58
	sugar_die($app_strings['ERROR_NO_RECORD']);
59
} // if
60
$focus->checkImap();
61
$detailView = new DetailView();
62
$offset=0;
63
64
65
66
/* end standard DetailView layout process */
67
$exServ = explode('::',$focus->service);
68
if($focus->delete_seen == 1) {
69
	$delete_seen = $mod_strings['LBL_MARK_READ_NO'];
70
} else {
71
	$delete_seen = $mod_strings['LBL_MARK_READ_YES'];
72
}
73
74
// deferred
75
//$r = $focus->db->query("SELECT id, name FROM queues WHERE owner_id = '".$focus->id."'");
76
//$a = $focus->db->fetchByAssoc($r);
77
//$queue = '<a href="index.php?module=Queues&action=EditView&record='.$a['id'].'">'.$a['name'].'</a>';
78
$groupName = '';
79
if($focus->group_id) {
0 ignored issues
show
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
80
	
81
	//$group = new Group();
82
	//$group->retrieve($focus->group_id);
83
	//$groupName = $group->user_name;
84
}
85
86
if($focus->template_id) {
87
	
88
	$et = new EmailTemplate();
89
	$et->retrieve($focus->template_id);
90
	$emailTemplate = $et->name;
91
} else {
92
	$emailTemplate = $mod_strings['LBL_NONE'];
93
}
94
$ssl = $app_list_strings['dom_email_bool']['bool_false'];
95
$allow_outbound_group_usage = $app_list_strings['dom_email_bool']['bool_false'];
96
$tls = $app_list_strings['dom_email_bool']['bool_false'];
97
$ca = $app_list_strings['dom_email_bool']['bool_false'];
98
if(!empty($focus->service)) {
99
	// will always have 2 values: /tls || /notls and /validate-cert || /novalidate-cert
100
	$exServ = explode('::', $focus->service);
101
	if($exServ[0] == 'tls') {
102
		$tls = $app_list_strings['dom_email_bool']['bool_true'];
103
	}
104
	if($exServ[1] == 'validate-cert') {
105
		$cert = $app_list_strings['dom_email_bool']['bool_true'];
106
	}
107
	if(isset($exServ[2]) && !empty($exServ[2]) && $exServ[2] == 'ssl') {
108
		$ssl = $app_list_strings['dom_email_bool']['bool_true'];
109
	}
110
}
111
112
// FROM NAME FROM ADDRESS STRINGS
113
$email = new Email();
114
$from = $email->getSystemDefaultEmail();
115
$default_from_name = $from['name'];
116
$default_from_addr = $from['email'];
117
$from_name = '';
118
$from_addr = '';
119
$reply_to_name = '';
120
$reply_to_addr = '';
121
$distrib_method ='';
122
$filterDomain = '';
123
$trashFolder = '';
124
$sentFolder = '';
125
$distributionMethod = '';
126
$create_case_email_template='';
127
$create_case_email_template_name = $mod_strings['LBL_NONE'];
128
$leaveMessagesOnMailServer = $app_strings['LBL_EMAIL_NO'];
129
130
//$fromNameAddr = $fromName.' &lt;'.$from['email'].'&gt; <br><em>('.$mod_strings['LBL_SYSTEM_DEFAULT'].')</em>';
131
//$replyNameAddr = $mod_strings['LBL_SAME_AS_ABOVE'];
132
$onlySince = $mod_strings['LBL_ONLY_SINCE_NO'];
133
134
if(!empty($focus->stored_options)) {
135
	// FROM NAME and Address
136
	$storedOptions = unserialize(base64_decode($focus->stored_options));
137
138
	$from_name = (isset($storedOptions['from_name']) ? $storedOptions['from_name'] : "");
139
	$from_addr = (isset($storedOptions['from_addr']) ? $storedOptions['from_addr'] : "");
140
141
	$reply_to_name = (isset($storedOptions['reply_to_name'])) ? $storedOptions['reply_to_name'] : "";
142
	$reply_to_addr = (isset($storedOptions['reply_to_addr'])) ? $storedOptions['reply_to_addr'] : "";
143
		// only-since option
144
	if($storedOptions['only_since']) {
145
		$onlySince = $mod_strings['LBL_ONLY_SINCE_YES'];
146
	} else {
147
		$onlySince = $mod_strings['LBL_ONLY_SINCE_NO'];
148
	}
149
	// filter-domain
150
	if(isset($storedOptions['filter_domain']) && !empty($storedOptions['filter_domain'])) {
151
		$filterDomain = $storedOptions['filter_domain'];
152
	} else {
153
		$filterDomain = $app_strings['NTC_NO_ITEMS_DISPLAY'];
154
	}
155
	// Trash Folder
156
	if(isset($storedOptions['trashFolder']) && !empty($storedOptions['trashFolder'])) {
157
		$trashFolder = $storedOptions['trashFolder'];
158
	} else {
159
		$trashFolder = $mod_strings['LBL_NONE'];
160
	}
161
	// Sent Folder
162
	if(isset($storedOptions['sentFolder']) && !empty($storedOptions['sentFolder'])) {
163
		$sentFolder = $storedOptions['sentFolder'];
164
	} else {
165
		$sentFolder = $mod_strings['LBL_NONE'];
166
	}
167
168
	if(!isset($storedOptions['leaveMessagesOnMailServer']) || $storedOptions['leaveMessagesOnMailServer'] == 1) {
169
		$leaveMessagesOnMailServer = $app_strings['LBL_EMAIL_YES'];
170
	} else {
171
		$leaveMessagesOnMailServer = $app_strings['LBL_EMAIL_NO'];
172
	} // else
173
	if(!isset($storedOptions['leaveMessagesOnMailServer']) || $storedOptions['leaveMessagesOnMailServer'] == 1) {
174
		$leaveMessagesOnMailServer = $app_strings['LBL_EMAIL_YES'];
175
	} else {
176
		$leaveMessagesOnMailServer = $app_strings['LBL_EMAIL_NO'];
177
	} // else
178
	$distrib_method = (isset($storedOptions['distrib_method'])) ? $storedOptions['distrib_method'] : "";
179
	$create_case_email_template = (isset($storedOptions['create_case_email_template'])) ? $storedOptions['create_case_email_template'] : "";
180
	$email_num_autoreplies_24_hours = (isset($storedOptions['email_num_autoreplies_24_hours'])) ? $storedOptions['email_num_autoreplies_24_hours'] : $focus->defaultEmailNumAutoreplies24Hours;
181
    
182
	if( isset($storedOptions['allow_outbound_group_usage']) && $storedOptions['allow_outbound_group_usage'] == 1) 
183
	   $allow_outbound_group_usage = $app_list_strings['dom_email_bool']['bool_true'];
184
	
185
}
186
187
if(!empty($create_case_email_template)) {
188
	
189
	$et = new EmailTemplate();
190
	$et->retrieve($create_case_email_template);
191
	$create_case_email_template_name = $et->name;
192
}
193
if (!empty($distrib_method)) {
194
	$distributionMethod = $app_list_strings['dom_email_distribution_for_auto_create'][$distrib_method];
195
} // if
196
$xtpl = new XTemplate('modules/InboundEmail/DetailView.html');
197
////	ERRORS from Save
198
if(isset($_REQUEST['error'])) {
199
	$xtpl->assign('ERROR', "<div class='error'>".$mod_strings['ERR_NO_OPTS_SAVED']."</div>");
200
}
201
//cma, June 24,2008 - Fix bug 21670. User status and group/personal statements are not localized.
202
$userStatus = $mod_strings['LBL_STATUS_ACTIVE'];
203
if('Inactive' == $focus->status) {
204
    $userStatus = $mod_strings['LBL_STATUS_INACTIVE'];
205
}
206
207
$xtpl->assign('MODULE_TITLE', getClassicModuleTitle('InboundEmail', array($mod_strings['LBL_MODULE_NAME'],$focus->name), true));
208
$xtpl->assign('MOD', $mod_strings);
209
$xtpl->assign('APP', $app_strings);
210
$xtpl->assign('CREATED_BY', $focus->created_by_name);
211
$xtpl->assign('MODIFIED_BY', $focus->modified_by_name);
212
$xtpl->assign('GRIDLINE', $gridline);
213
$xtpl->assign('PRINT_URL', 'index.php?'.$GLOBALS['request_string']);
214
$xtpl->assign('ID', $focus->id);
215
$xtpl->assign('STATUS', $userStatus);
216
$xtpl->assign('SERVER_URL', $focus->server_url);
217
$xtpl->assign('USER', $focus->email_user);
218
$xtpl->assign('NAME', $focus->name);
219
$xtpl->assign('MAILBOX', $focus->mailbox);
220
$xtpl->assign('TRASHFOLDER', $trashFolder);
221
$xtpl->assign('SENTFOLDER', $sentFolder);
222
223
$protocol = filterInboundEmailPopSelection($app_list_strings['dom_email_server_type']);
224
$xtpl->assign('SERVER_TYPE', $protocol[$focus->protocol]);
225
$xtpl->assign('SSL', $ssl);
226
$xtpl->assign('TLS', $tls);
227
$xtpl->assign('CERT', $ca);
228
$xtpl->assign('MARK_READ', $delete_seen);
229
$xtpl->assign('ALLOW_OUTBOUND_GROUP_USAGE', $allow_outbound_group_usage);
230
231
// deferred
232
//$xtpl->assign('QUEUE', $queue);
233
$createCaseRowStyle = "display:none";
234
$leaveMessagesOnMailServerStyle = "display:none";
235
if ($focus->is_personal) {
236
	$xtpl->assign('EDIT_GROUP_FOLDER_STYLE', "display:none");
237
} else {
238
	$is_auto_import = $app_list_strings['checkbox_dom']['2'];
239
	
240
	if (!empty($focus->groupfolder_id)) {
241
		$is_auto_import = $app_list_strings['checkbox_dom']['1'];
242
		$leaveMessagesOnMailServerStyle = "display:''";
243
	} // if
244
	$xtpl->assign('IS_AUTO_IMPORT_ENABLED', $is_auto_import);
245
	$xtpl->assign('EDIT_GROUP_FOLDER_STYLE', "display:''");
246
	if ($focus->isMailBoxTypeCreateCase()) {
247
		$createCaseRowStyle = "display:''";
248
	}
249
250
}
251
$xtpl->assign('LEAVEMESSAGESONMAILSERVER_STYLE', $leaveMessagesOnMailServerStyle);
252
$xtpl->assign('LEAVEMESSAGESONMAILSERVER', $leaveMessagesOnMailServer);
253
$xtpl->assign('CREATE_CASE_ROW_STYLE', $createCaseRowStyle);
254
$xtpl->assign('DISTRIBUTION_METHOD', $distributionMethod);
255
$xtpl->assign('CREATE_CASE_EMAIL_TEMPLATE', $create_case_email_template_name);
256
if ($focus->isPop3Protocol()) {
257
	$xtpl->assign('TRASH_SENT_FOLDER_STYLE', "display:none");
258
} else {
259
	$xtpl->assign('TRASH_SENT_FOLDER_STYLE', "display:''");
260
} // else
261
262
$possibleAction = "pick";
263
if (!isset($app_list_strings['dom_mailbox_type'][$focus->mailbox_type])) {
264
	$possibleAction = $app_list_strings['dom_mailbox_type']['pick'];
265
} else {
266
	$possibleAction = $app_list_strings['dom_mailbox_type'][$focus->mailbox_type];
267
}
268
269
if($focus->mailbox_type == 'createcase')
270
    $is_create_case = $app_list_strings['checkbox_dom']['1'];
271
else 
272
    $is_create_case = $app_list_strings['checkbox_dom']['2'];
273
274
275
$xtpl->assign('GROUP_NAME', $groupName);
276
$xtpl->assign('IS_CREATE_CASE', $is_create_case);
277
$xtpl->assign('EMAIL_TEMPLATE', $emailTemplate);
278
$xtpl->assign('FROM_NAME', $from_name);
279
$xtpl->assign('FROM_ADDR', $from_addr);
280
$xtpl->assign('DEFAULT_FROM_NAME', $default_from_name);
281
$xtpl->assign('DEFAULT_FROM_ADDR', $default_from_addr);
282
$xtpl->assign('REPLY_TO_NAME', $reply_to_name);
283
$xtpl->assign('REPLY_TO_ADDR', $reply_to_addr);
284
$xtpl->assign('ONLY_SINCE', $onlySince);
285
$xtpl->assign('FILTER_DOMAIN', $filterDomain);
286
$xtpl->assign('EMAIL_NUM_AUTOREPLIES_24_HOURS', $email_num_autoreplies_24_hours);
287
if(!empty($focus->port)) {
288
	$xtpl->assign('PORT', $focus->port);
289
}
290
if($focus->handleIsPersonal()) {
291
	$xtpl->assign('LBL_GROUP_QUEUE', $mod_strings['LBL_ASSIGN_TO_USER']);
292
} else {
293
	$xtpl->assign('LBL_GROUP_QUEUE', $mod_strings['LBL_GROUP_QUEUE']);
294
}
295
296
//Overrides for bounce mailbox accounts
297
if ($focus->mailbox_type == 'bounce')
298
{
299
    $xtpl->assign('MODULE_TITLE', getClassicModuleTitle('InboundEmail', array($mod_strings['LBL_BOUNCE_MODULE_NAME'],$focus->name), true));
300
}
301
else if( $focus->is_personal == '1')
302
     $xtpl->assign('MODULE_TITLE', getClassicModuleTitle('InboundEmail', array($mod_strings['LBL_PERSONAL_MODULE_NAME'],$focus->name), true));
303
304
$xtpl->parse('main');
305
$xtpl->out('main');
306
?>