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 |
||
0 ignored issues
–
show
Security
Bug
introduced
by
![]() |
|||
2 | /********************************************************************************* |
||
3 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
4 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
5 | |||
6 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
7 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
8 | * |
||
9 | * This program is free software; you can redistribute it and/or modify it under |
||
10 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
11 | * Free Software Foundation with the addition of the following permission added |
||
12 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
13 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
14 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
15 | * |
||
16 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
18 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
19 | * details. |
||
20 | * |
||
21 | * You should have received a copy of the GNU Affero General Public License along with |
||
22 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
23 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
24 | * 02110-1301 USA. |
||
25 | * |
||
26 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
27 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
28 | * |
||
29 | * The interactive user interfaces in modified source and object code versions |
||
30 | * of this program must display Appropriate Legal Notices, as required under |
||
31 | * Section 5 of the GNU Affero General Public License version 3. |
||
32 | * |
||
33 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
34 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
35 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
36 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
38 | ********************************************************************************/ |
||
39 | |||
40 | require_once ('modules/ModuleBuilder/MB/AjaxCompose.php') ; |
||
41 | require_once ('modules/ModuleBuilder/MB/ModuleBuilder.php') ; |
||
42 | require_once ('modules/ModuleBuilder/views/view.relationship.php') ; |
||
43 | require_once ('modules/ModuleBuilder/Module/StudioModule.php') ; |
||
44 | require_once ('modules/ModuleBuilder/Module/StudioBrowser.php') ; |
||
45 | |||
46 | class ViewRelationships extends SugarView |
||
47 | { |
||
48 | /** |
||
49 | * @see SugarView::_getModuleTitleParams() |
||
50 | */ |
||
51 | protected function _getModuleTitleParams($browserTitle = false) |
||
52 | { |
||
53 | global $mod_strings; |
||
54 | |||
55 | return array( |
||
56 | translate('LBL_MODULE_NAME','Administration'), |
||
57 | ModuleBuilderController::getModuleTitle(), |
||
58 | ); |
||
59 | } |
||
60 | |||
61 | function display() |
||
62 | { |
||
63 | $moduleName = ! empty ( $_REQUEST [ 'view_module' ] ) ? $_REQUEST [ 'view_module' ] : $_REQUEST [ 'edit_module' ] ; |
||
64 | $smarty = new Sugar_Smarty ( ) ; |
||
65 | // set the mod_strings as we can be called after doing a Repair and the mod_strings are set to Administration |
||
66 | $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'ModuleBuilder'); |
||
67 | $smarty->assign ( 'mod_strings', $GLOBALS [ 'mod_strings' ] ) ; |
||
68 | $smarty->assign ( 'view_module', $moduleName ) ; |
||
69 | |||
70 | $ajax = new AjaxCompose ( ) ; |
||
71 | $json = getJSONobj () ; |
||
72 | $this->fromModuleBuilder = !empty ( $_REQUEST [ 'MB' ] ) || (!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio') ; |
||
73 | $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder); |
||
74 | if (!$this->fromModuleBuilder) |
||
75 | { |
||
76 | $smarty->assign ( 'view_package', '' ) ; |
||
77 | |||
78 | $relationships = new DeployedRelationships ( $moduleName ) ; |
||
79 | $ajaxRelationships = $this->getAjaxRelationships( $relationships ) ; |
||
80 | $smarty->assign ( 'relationships', $json->encode ( $ajaxRelationships ) ) ; |
||
81 | $smarty->assign ( 'empty', (sizeof ( $ajaxRelationships ) == 0) ) ; |
||
82 | $smarty->assign ( 'studio', true ) ; |
||
83 | |||
84 | //crumb |
||
85 | global $app_list_strings ; |
||
86 | $moduleNames = array_change_key_case ( $app_list_strings [ 'moduleList' ] ) ; |
||
87 | $translatedModule = $moduleNames [ strtolower ( $moduleName ) ] ; |
||
88 | $ajax->addCrumb ( translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")' ) ; |
||
89 | $ajax->addCrumb ( $translatedModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $moduleName . '")' ) ; |
||
90 | $ajax->addCrumb ( translate('LBL_RELATIONSHIPS'), '' ) ; |
||
91 | $ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl')); |
||
92 | |||
93 | } else |
||
94 | { |
||
95 | $smarty->assign ( 'view_package', $_REQUEST [ 'view_package' ] ) ; |
||
96 | |||
97 | $mb = new ModuleBuilder ( ) ; |
||
98 | $module = & $mb->getPackageModule ( $_REQUEST [ 'view_package' ], $_REQUEST [ 'view_module' ] ) ; |
||
99 | $package = $mb->packages [ $_REQUEST [ 'view_package' ] ] ; |
||
100 | $package->loadModuleTitles(); |
||
101 | $relationships = new UndeployedRelationships ( $module->getModuleDir () ) ; |
||
102 | $ajaxRelationships = $this->getAjaxRelationships( $relationships ) ; |
||
103 | $smarty->assign ( 'relationships', $json->encode ( $ajaxRelationships ) ) ; |
||
104 | $smarty->assign ( 'empty', (sizeof ( $ajaxRelationships ) == 0) ) ; |
||
105 | |||
106 | $module->help [ 'default' ] = (empty ( $_REQUEST [ 'view_module' ] )) ? 'create' : 'modify' ; |
||
107 | $module->help [ 'group' ] = 'module' ; |
||
108 | |||
109 | $ajax->addCrumb ( translate('LBL_MODULEBUILDER'), 'ModuleBuilder.main("mb")' ) ; |
||
110 | $ajax->addCrumb ( $package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")' ) ; |
||
111 | $ajax->addCrumb ( $moduleName, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $package->name . '&view_module=' . $moduleName . '")' ) ; |
||
112 | $ajax->addCrumb ( translate('LBL_RELATIONSHIPS'), '' ) ; |
||
113 | $ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl')); |
||
114 | } |
||
115 | echo $ajax->getJavascript () ; |
||
116 | } |
||
117 | |||
118 | /* |
||
119 | * Encode the relationships for this module for display in the Ext grid layout |
||
120 | */ |
||
121 | function getAjaxRelationships ( $relationships ) |
||
122 | { |
||
123 | $ajaxrels = array ( ) ; |
||
124 | foreach ( $relationships->getRelationshipList () as $relationshipName ) |
||
125 | { |
||
126 | $rel = $relationships->get ( $relationshipName )->getDefinition () ; |
||
127 | $rel [ 'lhs_module' ] = translate( $rel [ 'lhs_module' ] ) ; |
||
128 | $rel [ 'rhs_module' ] = translate( $rel [ 'rhs_module' ] ) ; |
||
129 | |||
130 | //#28668 , translate the relationship type before render it . |
||
131 | switch($rel['relationship_type']){ |
||
132 | case 'one-to-one': |
||
133 | $rel['relationship_type'] = translate ( 'LBL_ONETOONE' ); |
||
134 | break; |
||
135 | case 'one-to-many': |
||
136 | $rel['relationship_type'] = translate ( 'LBL_ONETOMANY' ); |
||
137 | break; |
||
138 | case 'many-to-one': |
||
139 | $rel['relationship_type'] = translate ( 'LBL_MANYTOONE' ); |
||
140 | break; |
||
141 | case 'many-to-many': |
||
142 | $rel['relationship_type'] = translate ( 'LBL_MANYTOMANY' ); |
||
143 | break; |
||
144 | default: $rel['relationship_type'] = ''; |
||
0 ignored issues
–
show
The default body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a default statement must start on the line immediately following the statement. switch ($expr) {
default:
doSomething(); //right
break;
}
switch ($expr) {
default:
doSomething(); //wrong
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
145 | } |
||
146 | $rel [ 'name' ] = $relationshipName ; |
||
147 | if ($rel [ 'is_custom' ] && isset($rel [ 'from_studio' ]) && $rel [ 'from_studio' ]) { |
||
148 | $rel [ 'name' ] = $relationshipName . "*"; |
||
149 | } |
||
150 | $ajaxrels [] = $rel ; |
||
151 | } |
||
152 | return $ajaxrels ; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * fetchTemplate |
||
157 | * This function overrides fetchTemplate from SugarView. |
||
158 | * |
||
159 | * @param FieldViewer $mixed the Sugar_Smarty instance |
||
0 ignored issues
–
show
There is no parameter named
$mixed . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
160 | * @param string $template the file to fetch |
||
0 ignored issues
–
show
There is no parameter named
$template . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
161 | * @return string contents from calling the fetch method on the Sugar_Smarty instance |
||
162 | */ |
||
163 | protected function fetchTemplate($smarty/*, $template*/) |
||
164 | { |
||
165 | $template = func_get_arg(1); |
||
166 | return $smarty->fetch($this->getCustomFilePathIfExists($template)); |
||
167 | } |
||
168 | } |