This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | class ACLJSController{ |
||
44 | |||
45 | public function __construct($module,$form='', $is_owner=false){ |
||
46 | |||
47 | $this->module = $module; |
||
48 | $this->is_owner = $is_owner; |
||
49 | $this->form = $form; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @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 |
||
54 | */ |
||
55 | public function ACLJSController($module,$form='', $is_owner=false){ |
||
56 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
||
57 | if(isset($GLOBALS['log'])) { |
||
58 | $GLOBALS['log']->deprecated($deprecatedMessage); |
||
59 | } |
||
60 | else { |
||
61 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
||
62 | } |
||
63 | self::__construct($module, $form, $is_owner); |
||
64 | } |
||
65 | |||
66 | |||
67 | function getJavascript(){ |
||
68 | global $action; |
||
69 | if(!ACLController::moduleSupportsACL($this->module)){ |
||
70 | return ''; |
||
71 | } |
||
72 | $script = "<SCRIPT>\n//BEGIN ACL JAVASCRIPT\n"; |
||
73 | |||
74 | if($action == 'DetailView'){ |
||
75 | if(!ACLController::checkAccess($this->module,'edit', $this->is_owner)){ |
||
76 | $script .= <<<EOQ |
||
77 | if(typeof(document.DetailView) != 'undefined'){ |
||
78 | if(typeof(document.DetailView.elements['Edit']) != 'undefined'){ |
||
79 | document.DetailView.elements['Edit'].disabled = 'disabled'; |
||
80 | } |
||
81 | if(typeof(document.DetailView.elements['Duplicate']) != 'undefined'){ |
||
82 | document.DetailView.elements['Duplicate'].disabled = 'disabled'; |
||
83 | } |
||
84 | } |
||
85 | EOQ; |
||
86 | } |
||
87 | if(!ACLController::checkAccess($this->module,'delete', $this->is_owner)){ |
||
88 | $script .= <<<EOQ |
||
89 | if(typeof(document.DetailView) != 'undefined'){ |
||
90 | if(typeof(document.DetailView.elements['Delete']) != 'undefined'){ |
||
91 | document.DetailView.elements['Delete'].disabled = 'disabled'; |
||
92 | } |
||
93 | } |
||
94 | EOQ; |
||
95 | } |
||
96 | } |
||
97 | if(file_exists('modules/'. $this->module . '/metadata/acldefs.php')){ |
||
98 | include('modules/'. $this->module . '/metadata/acldefs.php'); |
||
99 | |||
100 | foreach($acldefs[$this->module]['forms'] as $form_name=>$form){ |
||
101 | |||
102 | foreach($form as $field_name=>$field){ |
||
103 | |||
104 | if($field['app_action'] == $action){ |
||
105 | switch($form_name){ |
||
106 | case 'by_id': |
||
107 | $script .= $this->getFieldByIdScript($field_name, $field); |
||
108 | break; |
||
109 | case 'by_name': |
||
110 | $script .= $this->getFieldByNameScript($field_name, $field); |
||
111 | break; |
||
112 | default: |
||
113 | $script .= $this->getFieldByFormScript($form_name, $field_name, $field); |
||
114 | break; |
||
115 | } |
||
116 | } |
||
117 | |||
118 | } |
||
119 | } |
||
120 | } |
||
121 | $script .= '</SCRIPT>'; |
||
122 | |||
123 | return $script; |
||
124 | |||
125 | |||
126 | } |
||
127 | |||
128 | function getHTMLValues($def){ |
||
129 | $return_array = array(); |
||
130 | switch($def['display_option']){ |
||
131 | case 'clear_link': |
||
132 | $return_array['href']= "#"; |
||
133 | $return_array['className']= "nolink"; |
||
134 | break; |
||
135 | default; |
||
0 ignored issues
–
show
|
|||
136 | $return_array[$def['display_option']] = $def['display_option']; |
||
137 | break; |
||
138 | |||
139 | } |
||
140 | return $return_array; |
||
141 | |||
142 | } |
||
143 | |||
144 | function getFieldByIdScript($name, $def){ |
||
145 | $script = ''; |
||
146 | if(!ACLController::checkAccess($def['module'], $def['action_option'], true)){ |
||
147 | foreach($this->getHTMLValues($def) as $key=>$value){ |
||
148 | $script .= "\nif(document.getElementById('$name'))document.getElementById('$name')." . $key . '="' .$value. '";'. "\n"; |
||
149 | } |
||
150 | } |
||
151 | return $script; |
||
152 | |||
153 | } |
||
154 | |||
155 | function getFieldByNameScript($name, $def){ |
||
156 | $script = ''; |
||
157 | if(!ACLController::checkAccess($def['module'], $def['action_option'], true)){ |
||
158 | |||
159 | foreach($this->getHTMLValues($def) as $key=>$value){ |
||
160 | $script .= <<<EOQ |
||
161 | var aclfields = document.getElementsByName('$name'); |
||
162 | for(var i in aclfields){ |
||
163 | aclfields[i].$key = '$value'; |
||
164 | } |
||
165 | EOQ; |
||
166 | } |
||
167 | } |
||
168 | return $script; |
||
169 | |||
170 | } |
||
171 | |||
172 | function getFieldByFormScript($form, $name, $def){ |
||
173 | $script = ''; |
||
174 | |||
175 | |||
176 | if(!ACLController::checkAccess($def['module'], $def['action_option'], true)){ |
||
177 | foreach($this->getHTMLValues($def) as $key=>$value){ |
||
178 | $script .= "\nif(typeof(document.$form.$name.$key) != 'undefined')\n document.$form.$name.".$key . '="' .$value. '";'; |
||
179 | } |
||
180 | } |
||
181 | return $script; |
||
182 | |||
183 | } |
||
184 | |||
185 | |||
186 | |||
187 | |||
188 | |||
189 | |||
190 | |||
191 | |||
192 | } |
||
193 | |||
194 | |||
195 | |||
196 | ?> |
As per the PSR-2 coding standard, default statements should not be wrapped in curly braces.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.