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 | * EdtiViewMetaParser.php |
||
44 | * This is a utility file that attempts to provide support for parsing pre 5.0 SugarCRM |
||
45 | * QuickCreate.html files and produce a best guess editviewdefs.php file equivalent. |
||
46 | * |
||
47 | * @author Collin Lee |
||
48 | */ |
||
49 | |||
50 | require_once('include/SugarFields/Parsers/MetaParser.php'); |
||
51 | |||
52 | class QuickCreateMetaParser extends MetaParser { |
||
53 | |||
54 | function __construct() { |
||
55 | $this->mView = 'QuickCreate'; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @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 |
||
60 | */ |
||
61 | function QuickCreateMetaParser(){ |
||
62 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
||
63 | if(isset($GLOBALS['log'])) { |
||
64 | $GLOBALS['log']->deprecated($deprecatedMessage); |
||
65 | } |
||
66 | else { |
||
67 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
||
68 | } |
||
69 | self::__construct(); |
||
70 | } |
||
71 | |||
72 | |||
73 | /** |
||
74 | * parse |
||
75 | * |
||
76 | * @param $filePath The file path of the HTML file to parse |
||
77 | * @param $vardefs The module's vardefs |
||
78 | * @param $moduleDir The module's directory |
||
79 | * @param $merge boolean value indicating whether or not to merge the parsed contents |
||
80 | * @param $masterCopy The file path of the mater copy of the metadata file to merge against |
||
81 | * @return String format of metadata contents |
||
82 | **/ |
||
83 | function parse($filePath, $vardefs = array(), $moduleDir = '', $merge=false, $masterCopy=null) { |
||
84 | |||
85 | global $app_strings; |
||
86 | $contents = file_get_contents($filePath); |
||
87 | |||
88 | // The contents are not well formed so we add this section to make it easier to parse |
||
89 | $contents = $this->trimHTML($contents) . '</td></tr></table>'; |
||
90 | $moduleName = ''; |
||
91 | |||
92 | $forms = $this->getElementsByType("form", $contents); |
||
93 | $tables = $this->getElementsByType("table", $forms[0] . "</td></tr></table>"); |
||
94 | $mainrow = $this->getElementsByType("tr", $tables[1]); |
||
95 | $rows = substr($mainrow[0], strpos($mainrow[0], "</tr>")); |
||
96 | $tablerows = $this->getElementsByType("tr", $rows); |
||
97 | |||
98 | foreach($tablerows as $trow) { |
||
99 | |||
100 | $emptyCount = 0; |
||
101 | $tablecolumns = $this->getElementsByType("td", $trow); |
||
102 | $col = array(); |
||
103 | $slot = 0; |
||
104 | |||
105 | foreach($tablecolumns as $tcols) { |
||
106 | |||
107 | $sugarAttrLabel = $this->getTagAttribute("sugar", $tcols, "'^slot[^b]+$'"); |
||
108 | $sugarAttrValue = $this->getTagAttribute("sugar", $tcols, "'slot[0-9]+b$'"); |
||
109 | |||
110 | // If there wasn't any slot numbering/lettering then just default to expect label->vallue pairs |
||
111 | $sugarAttrLabel = count($sugarAttrLabel) != 0 ? $sugarAttrLabel : ($slot % 2 == 0) ? true : false; |
||
112 | $sugarAttrValue = count($sugarAttrValue) != 0 ? $sugarAttrValue : ($slot % 2 == 1) ? true : false; |
||
113 | |||
114 | $slot++; |
||
115 | |||
116 | if($sugarAttrValue) { |
||
117 | |||
118 | $spanValue = strtolower($this->getElementValue("span", $tcols)); |
||
119 | if(empty($spanValue)) { |
||
120 | $spanValue = strtolower($this->getElementValue("slot", $tcols)); |
||
121 | } |
||
122 | if(empty($spanValue)) { |
||
123 | $spanValue = strtolower($this->getElementValue("td", $tcols)); |
||
124 | } |
||
125 | |||
126 | //Get all the editable form elements' names |
||
127 | $formElementNames = $this->getFormElementsNames($spanValue); |
||
128 | $customField = $this->getCustomField($formElementNames); |
||
129 | |||
130 | $name = ''; |
||
131 | $readOnly = false; |
||
132 | $fields = null; |
||
133 | $customCode = null; |
||
134 | |||
135 | if(!empty($customField)) { |
||
136 | // If it's a custom field we just set the name |
||
137 | $name = $customField; |
||
138 | |||
139 | } else if(empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) { |
||
140 | // We are here if the $spanValue did not contain a form element for editing. |
||
141 | // We will assume that it is read only (since there were no edit form elements) |
||
142 | |||
143 | |||
144 | // If there is more than one matching {} value then try to find the right one to key off |
||
145 | // based on vardefs.php file. Also, use the entire spanValue as customCode |
||
146 | if(count($matches) > 1) { |
||
147 | $name = $matches[0][1]; |
||
148 | $customCode = $spanValue; |
||
149 | foreach($matches as $pair) { |
||
150 | if(preg_match("/^(mod[\.]|app[\.]).*?/s", $pair[1])) { |
||
151 | $customCode = str_replace($pair[1], '$'.strtoupper($pair[1]), $customCode); |
||
152 | } else if(!empty($vardefs[$pair[1]])) { |
||
153 | $name = $pair[1]; |
||
154 | $customCode = str_replace($pair[1], '$fields.'.$pair[1].'.value', $customCode); |
||
155 | } |
||
156 | } //foreach |
||
157 | } else { |
||
158 | //If it is only a label, skip |
||
159 | if(preg_match("/^(mod[\.]|app[\.]).*?/s", $matches[0][1])) { |
||
160 | continue; |
||
161 | } else if(preg_match("/^[\$].*?/s", $matches[0][1])) { |
||
162 | $name = '{' . strtoupper($matches[0][1]) . '}'; |
||
163 | } else { |
||
164 | $name = $matches[0][1]; |
||
165 | } |
||
166 | } |
||
167 | |||
168 | $readOnly = true; |
||
169 | } else if(is_array($formElementNames)) { |
||
170 | |||
171 | if(count($formElementNames) == 1) { |
||
172 | if(!empty($vardefs[$formElementNames[0]])) { |
||
173 | $name = $formElementNames[0]; |
||
174 | } |
||
175 | } else { |
||
176 | $fields = array(); |
||
177 | foreach($formElementNames as $elementName) { |
||
178 | // What we are doing here is saying that we will add all your fields assuming |
||
179 | // there are none that are of type relate or link. However, if we find such a type |
||
180 | // we'll take the first one found and assume that is the field you want (the SugarFields |
||
181 | // library will handle rendering the popup and select and clear buttons for you). |
||
182 | if(isset($vardefs[$elementName])) { |
||
183 | $type = $vardefs[$elementName]['type']; |
||
184 | if($type != 'relate' && $type != 'link') { |
||
185 | $fields[] = $elementName; |
||
186 | $name = $elementName; |
||
187 | } else { |
||
188 | unset($fields); |
||
189 | $name = $elementName; |
||
190 | break; |
||
191 | } |
||
192 | } |
||
193 | } |
||
194 | } //if-else |
||
195 | } |
||
196 | |||
197 | // Build the entry |
||
198 | if(preg_match("/<textarea/si", $spanValue)) { |
||
199 | //special case for textarea form elements (add the displayParams) |
||
200 | $displayParams = array(); |
||
201 | $displayParams['rows'] = $this->getTagAttribute("rows", $spanValue); |
||
202 | $displayParams['cols'] = $this->getTagAttribute("cols", $spanValue); |
||
203 | |||
204 | if(!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
||
205 | $field = array(); |
||
206 | $field['name'] = $name; |
||
207 | $field['displayParams'] = $displayParams; |
||
208 | } else { |
||
209 | $field = $name; |
||
210 | } |
||
211 | $col[] = $field; |
||
212 | } else if($readOnly) { |
||
213 | $field = array(); |
||
214 | $field['name'] = $name; |
||
215 | $field['type'] = 'readonly'; |
||
216 | if(isset($customCode)) { |
||
217 | $field['customCode'] = $customCode; |
||
218 | } //if |
||
219 | $col[] = $field; |
||
220 | } else { |
||
221 | |||
222 | if(isset($fields) || isset($customCode)) { |
||
223 | $field = array(); |
||
224 | $field['name'] = $name; |
||
225 | if(isset($fields)) { |
||
226 | $field['fields'] = $fields; |
||
227 | } |
||
228 | if(isset($customCode)) { |
||
229 | $field['customCode'] = $customCode; |
||
230 | } |
||
231 | |||
232 | $col[] = $field; |
||
233 | } else { |
||
234 | $emptyCount = $name == '' ? $emptyCount + 1 : $emptyCount; |
||
235 | $col[] = $name; |
||
236 | } |
||
237 | } //if-else if-else block |
||
238 | } //if($sugarAttrValue) |
||
239 | } //foreach |
||
240 | |||
241 | // One last final check. If $emptyCount does not equal Array $col count, don't add |
||
242 | if($emptyCount != count($col)) { |
||
243 | $metarow[] = $col; |
||
244 | } //if |
||
245 | } //foreach |
||
246 | |||
247 | $templateMeta = array(); |
||
248 | $templateMeta['form']['buttons'] = 'button'; |
||
249 | |||
250 | preg_match_all("/(<input[^>]*?)>/si", $tables[0], $matches); |
||
251 | $buttons = array(); |
||
252 | foreach($matches[0] as $button) { |
||
253 | $buttons[] = array('customCode'=>$button); |
||
254 | } |
||
255 | $templateMeta['form']['buttons'] = $buttons; |
||
256 | |||
257 | $formElements = $this->getFormElements($contents); |
||
258 | $hiddenInputs = array(); |
||
259 | foreach($formElements as $elem) { |
||
260 | $type = $this->getTagAttribute("type", $elem); |
||
261 | if(preg_match('/hidden/si',$type, $matches)) { |
||
262 | $name = $this->getTagAttribute("name", $elem); |
||
263 | $value = $this->getTagAttribute("value", $elem); |
||
264 | $index = stripos($value, '$REQUEST'); |
||
265 | $value = !empty($index) ? '$smarty.request.' . substr($value, 10) : $value; |
||
266 | $hiddenInputs[] = '<input id="' . $name . '" name="' . $name . '" value="' . $value . '">'; |
||
267 | } |
||
268 | } //foreach |
||
269 | |||
270 | $templateMeta['form']['hidden'] = $hiddenInputs; |
||
271 | $templateMeta['widths'] = array(array('label' => '10', 'field' => '30'), array('label' => '10', 'field' => '30')); |
||
272 | $templateMeta['maxColumns'] = 2; |
||
273 | |||
274 | $panels = array(); |
||
275 | $panels['default'] = $metarow; |
||
276 | $panels = $this->appplyRules($moduleDir, $panels); |
||
0 ignored issues
–
show
|
|||
277 | return $this->createFileContents($moduleDir, $panels, $templateMeta, $filePath); |
||
278 | |||
279 | |||
280 | } |
||
281 | |||
282 | |||
283 | } |
||
284 | ?> |
||
285 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.