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/Audit/Popup_picker.php (1 issue)

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
43
44
45
46
require_once("include/upload_file.php");
47
48
require_once('include/utils/db_utils.php');
49
require_once('modules/Audit/Audit.php');
50
51
global $beanList, $beanFiles, $currentModule, $focus, $action, $app_strings, $app_list_strings, $current_language, $timedate, $mod_strings;
52
//we don't want the parent module's string file, but rather the string file specific to this subpanel
53
54
55
56
$bean = $beanList[$_REQUEST['module_name']];
57
require_once($beanFiles[$bean]);
58
$focus = new $bean;
59
60
class Popup_Picker
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Popup_Picker has been defined more than once; this definition is ignored, only the first definition in include/Popups/Popup_picker.php (L47-356) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
61
{
62
63
64
	/*
65
	 *
66
	 */
67
	function __construct()
68
	{
69
70
	}
71
72
    /**
73
     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
74
     */
75
    function Popup_Picker(){
76
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
77
        if(isset($GLOBALS['log'])) {
78
            $GLOBALS['log']->deprecated($deprecatedMessage);
79
        }
80
        else {
81
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
82
        }
83
        self::__construct();
84
    }
85
86
87
	/**
88
	 *
89
	 */
90
	function process_page()
91
	{
92
		global $theme;
93
		global $focus;
94
		global $mod_strings;
95
		global $app_strings;
96
		global $app_list_strings;
97
		global $currentModule;
98
		global $odd_bg;
99
 		global $even_bg;
100
101
        global $audit;
102
        global $current_language;
103
104
		$audit_list =  Audit::get_audit_list();
105
        $xtpl=new XTemplate ('modules/Audit/Popup_picker.html');
106
107
		$xtpl->assign('MOD', $mod_strings);
108
		$xtpl->assign('APP', $app_strings);
109
		insert_popup_header($theme);
110
111
		//output header
112
		echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
113
		$mod_strings = return_module_language($current_language, $focus->module_dir);
114
115
		$printImageURL = SugarThemeRegistry::current()->getImageURL('print.gif');
116
		$titleExtra = <<<EOHTML
117
<a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'>
118
<!--not_in_theme!--><img src="{$printImageURL}" alt="{$GLOBALS['app_strings']['LNK_PRINT']}"></a>
119
<a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'>
120
{$GLOBALS['app_strings']['LNK_PRINT']}
121
</a>
122
EOHTML;
123
124
		$params = array();
125
		$params[] = translate('LBL_MODULE_NAME', $focus->module_dir);
126
		$params[] = $focus->get_summary_text();
127
		$params[] = translate('LBL_CHANGE_LOG', 'Audit');
128
		echo str_replace('</div>',"<span class='utils'>$titleExtra</span></div>",getClassicModuleTitle($focus->module_dir, $params, false));
129
130
		$oddRow = true;
131
		$audited_fields = $focus->getAuditEnabledFieldDefinitions();
132
		asort($audited_fields);
133
		$fields = '';
134
		$field_count = count($audited_fields);
135
		$start_tag = "<table><tr><td >";
136
		$end_tag = "</td></tr></table>";
137
138
		if($field_count > 0)
139
		{
140
			$index = 0;
141
    		foreach($audited_fields as $key=>$value)
142
			{
143
				$index++;
144
				$vname = '';
145
				if(isset($value['vname']))
146
					$vname = $value['vname'];
147
				else if(isset($value['label']))
148
					$vname = $value['label'];
149
				$fields .= str_replace(':', '', translate($vname, $focus->module_dir));
150
151
    			if($index < $field_count)
152
    			{
153
    				$fields .= ", ";
154
    			}
155
    		}
156
157
    		echo $start_tag.translate('LBL_AUDITED_FIELDS', 'Audit').$fields.$end_tag;
158
    	}
159
    	else
160
    	{
161
    		echo $start_tag.translate('LBL_AUDITED_FIELDS', 'Audit').$end_tag;
162
    	}
163
164
		foreach($audit_list as $audit)
165
		{
166
			if(empty($audit['before_value_string']) && empty($audit['after_value_string']))
167
			{
168
				$before_value = $audit['before_value_text'];
169
				$after_value = $audit['after_value_text'];
170
            }
171
            else {
172
				$before_value = $audit['before_value_string'];
173
				$after_value = $audit['after_value_string'];
174
			}
175
176
            // Let's run the audit data through the sugar field system
177
            if(isset($audit['data_type'])){
178
                require_once('include/SugarFields/SugarFieldHandler.php');
179
                $vardef = array('name'=>'audit_field','type'=>$audit['data_type']);
180
                $field = SugarFieldHandler::getSugarField($audit['data_type']);
181
                $before_value = $field->getChangeLogSmarty(array($vardef['name']=>$before_value), $vardef, array(), $vardef['name']);
182
                $after_value = $field->getChangeLogSmarty(array($vardef['name']=>$after_value), $vardef, array(), $vardef['name']);
183
            }
184
185
            $activity_fields = array(
186
                'ID' => $audit['id'],
187
			    'NAME' => $audit['field_name'],
188
                'BEFORE_VALUE' => $before_value,
189
                'AFTER_VALUE' => $after_value,
190
                'CREATED_BY' => $audit['created_by'],
191
                'DATE_CREATED' => $audit['date_created'],
192
			);
193
194
			$xtpl->assign("ACTIVITY", $activity_fields);
195
196
			if($oddRow)
197
   			{
198
        		//todo move to themes
199
				$xtpl->assign("ROW_COLOR", 'oddListRow');
200
				$xtpl->assign("BG_COLOR", $odd_bg);
201
    		}
202
    		else
203
    		{
204
        		//todo move to themes
205
				$xtpl->assign("ROW_COLOR", 'evenListRow');
206
				$xtpl->assign("BG_COLOR", $even_bg);
207
    		}
208
   			$oddRow = !$oddRow;
209
210
			$xtpl->parse("audit.row");
211
		// Put the rows in.
212
        }//end foreach
213
214
		$xtpl->parse("audit");
215
		$xtpl->out("audit");
216
		insert_popup_footer();
217
    }
218
} // end of class Popup_Picker
219
?>
220