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.

include/QuickSearchDefaults.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 1
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
 * QuickSearchDefaults class, outputs default values for setting up quicksearch
44
 *
45
 * @copyright  2004-2007 SugarCRM Inc.
46
 * @license    http://www.sugarcrm.com/crm/products/sugar-professional-eula.html  SugarCRM Professional End User License
47
 * @since      Class available since Release 4.0
48
 */
49
50
class QuickSearchDefaults
51
{
52
53
	var $form_name = 'EditView';
54
55
    /**
56
     * getQuickSearchDefaults
57
     *
58
     * This is a static function to get an instance of QuickSearchDefaults object
59
     *
60
     * @param array $lookup Array with custom files and class names for custom QuickSearchDefaults classes, optional
61
     * @return QuickSearchDefaults
62
     */
63 5
    static public function getQuickSearchDefaults(array $lookup = array())
0 ignored issues
show
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
64
    {
65 5
       $lookup['custom/include/QuickSearchDefaults.php'] = 'QuickSearchDefaultsCustom';
66 5
       foreach ($lookup as $file => $class)
67
       {
68 5
           if (file_exists($file))
69
           {
70
               require_once($file);
71 5
               return new $class();
72
           }
73
       }
74 5
       return new QuickSearchDefaults();
75
    }
76
77 5
	function setFormName($name = 'EditView') {
78 5
		$this->form_name = $name;
79 5
	}
80
81
    function getQSParent($parent = 'Accounts') {
82
        global $app_strings;
83
84
        $qsParent = array(
85
                    'form' => $this->form_name,
86
                    'method' => 'query',
87
                    'modules' => array($parent),
88
                    'group' => 'or',
89
                    'field_list' => array('name', 'id'),
90
                    'populate_list' => array('parent_name', 'parent_id'),
91
                    'required_list' => array('parent_id'),
92
                    'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
93
                    'order' => 'name',
94
                    'limit' => '30',
95
                    'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
96
                    );
97
98
        return $qsParent;
99
    }
100
101 1
    function getQSAccount($nameKey, $idKey, $billingKey = null, $shippingKey = null, $additionalFields = null) {
102
103 1
        global $app_strings;
104
105
106 1
        $field_list = array('name', 'id');
107 1
        $populate_list = array($nameKey, $idKey);
108 1
        if($billingKey != null) {
109
            $field_list = array_merge($field_list, array('billing_address_street', 'billing_address_city',
110
                                                           'billing_address_state', 'billing_address_postalcode', 'billing_address_country'));
111
112
            $populate_list = array_merge($populate_list, array($billingKey . "_address_street", $billingKey . "_address_city",
113
                                                                $billingKey . "_address_state", $billingKey . "_address_postalcode", $billingKey . "_address_country"));
114
        } //if
115
116 1
        if($shippingKey != null) {
117
            $field_list = array_merge($field_list, array('shipping_address_street', 'shipping_address_city',
118
                                                           'shipping_address_state', 'shipping_address_postalcode', 'shipping_address_country'));
119
120
            $populate_list = array_merge($populate_list, array($shippingKey . "_address_street", $shippingKey . "_address_city",
121
                                                                $shippingKey . "_address_state", $shippingKey . "_address_postalcode", $shippingKey . "_address_country"));
122
        }
123
124 1
        if(!empty($additionalFields) && is_array($additionalFields)) {
125
           $field_list = array_merge($field_list, array_keys($additionalFields));
126
           $populate_list = array_merge($populate_list, array_values($additionalFields));
127
        }
128
129
        $qsParent = array(
130 1
					'form' => $this->form_name,
131 1
                    'method' => 'query',
132
                    'modules' => array('Accounts'),
133 1
                    'group' => 'or',
134 1
                    'field_list' => $field_list,
135 1
                    'populate_list' => $populate_list,
136
                    'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
137 1
                    'required_list' => array($idKey),
138 1
                    'order' => 'name',
139 1
                    'limit' => '30',
140 1
                    'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
141
                    );
142
143 1
        return $qsParent;
144
    }
145
146
    /**
147
     * getQSContact
148
     * This is a customized method to handle returning in JSON notation the QuickSearch formats
149
     * for searching the Contacts module for a contact name.  The method takes into account
150
     * the locale settings (s = salutation, f = first name, l = last name) that are permissible.
151
     * It should be noted though that any other characters present in the formatting will render
152
     * this widget non-functional.
153
     * @return The JSON format of a QuickSearch definition for the Contacts module
154
     */
155
    function getQSContact($name, $idName) {
156
        global $app_strings, $locale;
157
158
        $qsContact = array('form' => $this->form_name,
159
        				   'method'=>'get_contact_array',
160
                           'modules'=>array('Contacts'),
161
                           'field_list' => array('salutation', 'first_name', 'last_name', 'id'),
162
                           'populate_list' => array($name, $idName, $idName, $idName),
163
                           'required_list' => array($idName),
164
                           'group' => 'or',
165
                           'conditions' => array(
166
                                                 array('name'=>'first_name', 'op'=>'like_custom','end'=>'%','value'=>''),
167
                                                 array('name'=>'last_name', 'op'=>'like_custom','end'=>'%','value'=>'')
168
                                           ),
169
                           'order'=>'last_name',
170
                           'limit'=>'30',
171
                           'no_match_text'=> $app_strings['ERR_SQS_NO_MATCH']);
172
        return $qsContact;
173
    }
174
175 4
    function getQSUser($p_name = 'assigned_user_name', $p_id ='assigned_user_id') {
176 4
        global $app_strings;
177
178 4
        $qsUser = array('form' => $this->form_name,
179 4
        				'method' => 'get_user_array', // special method
180
                        'field_list' => array('user_name', 'id'),
181 4
                        'populate_list' => array($p_name, $p_id),
182 4
                        'required_list' => array($p_id),
183
                        'conditions' => array(array('name'=>'user_name','op'=>'like_custom','end'=>'%','value'=>'')),
184 4
                        'limit' => '30','no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
185 4
        return $qsUser;
186
    }
187 1
    function getQSCampaigns($c_name = 'campaign_name', $c_id = 'campaign_id') {
188 1
        global $app_strings;
189
190 1
        $qsCampaign = array('form' => $this->form_name,
191 1
        					'method' => 'query',
192
                            'modules'=> array('Campaigns'),
193 1
                            'group' => 'or',
194
                            'field_list' => array('name', 'id'),
195 1
                            'populate_list' => array($c_name, $c_id),
196
                            'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
197
                            'required_list' => array('campaign_id'),
198 1
                            'order' => 'name',
199 1
                            'limit' => '30',
200 1
                            'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
201 1
        return $qsCampaign;
202
    }
203
204
205
    /**
206
     * Loads Quick Search Object for any object (if suitable method is defined)
207
     *
208
     * @param string $module the given module we want to load the vardefs for
209
     * @param string $object the given object we wish to load the vardefs for
210
     * @param string $relationName the name of the relation between entities
211
     * @param type $nameField the name of the field to populate
212
     * @param type $idField the id of the field to populate
213
     */
214 1
    function loadQSObject($module, $object, $relationName, $nameField, $idField)
215
    {
216 1
        $result = array();
217 1
        VardefManager::loadVardef($module, $object);
218 1
        if (isset($GLOBALS['dictionary'][$object]['relationships']) && array_key_exists($relationName, $GLOBALS['dictionary'][$object]['relationships']))
219
        {
220
            if (method_exists($this, 'getQS' . $module))
221
            {
222
                $result = $this->{'getQS' . $module};
223
            } elseif (method_exists($this, 'getQS' . $object))
224
            {
225
                $result = $this->{'getQS' . $object};
226
            }
227
        } else
228
        {
229 1
            if (method_exists($this, 'getQS' . $module))
230
            {
231 1
                $result = $this->{'getQS' . $module}($nameField, $idField);
232
            } elseif (method_exists($this, 'getQS' . $object))
233
            {
234
                $result = $this->{'getQS' . $object}($nameField, $idField);
235
            }
236
        }
237 1
        return $result;
238
    }
239
240
    // BEGIN QuickSearch functions for 4.5.x backwards compatibility support
241
    function getQSScripts() {
242
		global $sugar_version, $sugar_config, $theme;
243
		$qsScripts = '<script type="text/javascript">sqsWaitGif = "' . SugarThemeRegistry::current()->getImageURL('sqsWait.gif') . '";</script>
244
		<script type="text/javascript" src="'. getJSPath('include/javascript/quicksearch.js') . '"></script>';
245
		return $qsScripts;
246
	}
247
248
	function getQSScriptsNoServer() {
249
		return $this->getQSScripts();
250
	}
251
252
	function getQSScriptsJSONAlreadyDefined() {
253
		global $sugar_version, $sugar_config, $theme;
254
		$qsScriptsJSONAlreadyDefined = '<script type="text/javascript">sqsWaitGif = "' . SugarThemeRegistry::current()->getImageURL('sqsWait.gif') . '";</script><script type="text/javascript" src="' . getJSPath('include/javascript/quicksearch.js') . '"></script>';
255
		return $qsScriptsJSONAlreadyDefined;
256
	}
257
    // END QuickSearch functions for 4.5.x backwards compatibility support
258
}
259
260
?>
261