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 | 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 | /*usage: initialize the tree, add nodes, generate header for required files inclusion. |
||
42 | * generate function that has tree data and script to convert data into tree init. |
||
43 | * generate call to tree init function. |
||
44 | * subsequent tree data calls will be served by the node class. |
||
45 | * tree view by default make ajax based calls for all requests. |
||
46 | */ |
||
47 | //require_once('include/entryPoint.php'); |
||
48 | |||
49 | 1 | require_once ('include/ytree/Tree.php'); |
|
50 | 1 | require_once ('include/JSON.php'); |
|
51 | |||
52 | class Tree { |
||
53 | var $tree_style='include/ytree/TreeView/css/folders/tree.css'; |
||
54 | var $_header_files=array( |
||
55 | 'include/javascript/yui/build/treeview/treeview.js', |
||
56 | 'include/ytree/treeutil.js', |
||
57 | ); |
||
58 | |||
59 | var $_debug_window=false; |
||
60 | var $_debug_div_name='debug_tree'; |
||
61 | var $_name; |
||
62 | var $_nodes=array(); |
||
63 | var $json; |
||
64 | //collection of parmeter properties; |
||
65 | var $_params=array(); |
||
66 | |||
67 | function __construct($name) { |
||
68 | $this->_name=$name; |
||
69 | $this->json=new JSON(JSON_LOOSE_TYPE); |
||
0 ignored issues
–
show
|
|||
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 Tree($name){ |
||
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($name); |
||
84 | } |
||
85 | |||
86 | |||
87 | //optionally add json.js, required for making AJAX Calls. |
||
88 | function include_json_reference($reference=null) { |
||
89 | // if (empty($reference)) { |
||
90 | // $this->_header_files[]='include/JSON.js'; |
||
91 | // } else { |
||
92 | // $this->_header_files[]=$reference; |
||
93 | // } |
||
94 | } |
||
95 | |||
96 | function add_node($node) { |
||
97 | $this->_nodes[$node->uid]=$node; |
||
98 | } |
||
99 | |||
100 | // returns html for including necessary javascript files. |
||
101 | function generate_header() { |
||
102 | $ret="<link rel='stylesheet' href='{$this->tree_style}'>\n"; |
||
103 | foreach ($this->_header_files as $filename) { |
||
104 | $ret.="<script language='JavaScript' src='" . getJSPath($filename) . "'></script>\n"; |
||
105 | } |
||
106 | return $ret; |
||
107 | } |
||
108 | |||
109 | //properties set here will be accessible from |
||
110 | //the tree's name space.. |
||
111 | function set_param($name, $value) { |
||
112 | if (!empty($name) && !empty($value)) { |
||
113 | $this->_params[$name]=$value; |
||
114 | } |
||
115 | } |
||
116 | |||
117 | function generate_nodes_array($scriptTags = true) { |
||
118 | global $sugar_config; |
||
119 | $node=null; |
||
120 | $ret=array(); |
||
121 | foreach ($this->_nodes as $node ) { |
||
122 | $ret['nodes'][]=$node->get_definition(); |
||
123 | } |
||
124 | |||
125 | //todo removed site_url setting from here. |
||
126 | //todo make these variables unique. |
||
127 | $tree_data="var TREE_DATA= " . $this->json->encode($ret) . ";\n"; |
||
128 | $tree_data.="var param= " . $this->json->encode($this->_params) . ";\n"; |
||
129 | |||
130 | $tree_data.="var mytree;\n"; |
||
131 | $tree_data.="treeinit(mytree,TREE_DATA,'{$this->_name}',param);\n"; |
||
132 | if($scriptTags) return '<script>'.$tree_data.'</script>'; |
||
133 | else return $tree_data; |
||
134 | } |
||
135 | |||
136 | |||
137 | /** |
||
138 | * Generates the javascript node arrays without calling treeinit(). Also generates a callback function that can be |
||
139 | * easily called to instatiate the treeview object onload(). |
||
140 | * |
||
141 | * IE6/7 will throw an "Operation Aborted" error when calling certain types of scripts before the page is fully |
||
142 | * loaded. The workaround is to move the init() call to the onload handler. See: http://www.viavirtualearth. |
||
143 | * com/wiki/DeferScript.ashx |
||
144 | * |
||
145 | * @param bool insertScriptTags Flag to add <script> tags |
||
146 | * @param string customInitFunction Defaults to "onloadTreeInit" |
||
147 | * @return string |
||
148 | */ |
||
149 | function generateNodesNoInit($insertScriptTags=true, $customInitFunction="") { |
||
150 | $node = null; |
||
151 | $ret = array(); |
||
152 | |||
153 | $initFunction = (empty($customInitFunction)) ? 'treeinit' : $customInitFunction; |
||
154 | |||
155 | foreach($this->_nodes as $node) { |
||
156 | $ret['nodes'][] = $node->get_definition(); |
||
157 | } |
||
158 | |||
159 | $treeData = "var TREE_DATA = ".$this->json->encode($ret).";\n"; |
||
160 | $treeData .= "var param = ".$this->json->encode($this->_params).";\n"; |
||
161 | $treeData .= "var mytree;\n"; |
||
162 | $treeData .= "function onloadTreeinit() { {$initFunction}(mytree,TREE_DATA,'{$this->_name}',param); }\n"; |
||
163 | |||
164 | if($insertScriptTags) { |
||
165 | $treeData = "<script type='text/javascript' language='javascript'>{$treeData}</script>"; |
||
166 | } |
||
167 | |||
168 | return $treeData; |
||
169 | } |
||
170 | |||
171 | function generateNodesRaw() { |
||
172 | $node = null; |
||
173 | $ret = array(); |
||
174 | $return = array(); |
||
175 | |||
176 | foreach($this->_nodes as $node) { |
||
177 | $ret['nodes'][] = $node->get_definition(); |
||
178 | } |
||
179 | |||
180 | $return['tree_data'] = $ret; |
||
181 | $return['param'] = $this->_params; |
||
182 | |||
183 | return $return; |
||
184 | } |
||
185 | } |
||
186 | ?> |
||
187 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.