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 | * Description: TODO: To be written. |
||
44 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
||
45 | * All Rights Reserved. |
||
46 | * Contributor(s): ______________________________________.. |
||
47 | ********************************************************************************/ |
||
48 | |||
49 | |||
50 | |||
51 | |||
52 | |||
53 | require_once('include/DetailView/DetailView.php'); |
||
54 | require_once('modules/Campaigns/Charts.php'); |
||
55 | |||
56 | |||
57 | global $mod_strings; |
||
58 | global $app_strings; |
||
59 | global $app_list_strings; |
||
60 | global $sugar_version, $sugar_config; |
||
61 | |||
62 | $focus = new Campaign(); |
||
63 | |||
64 | $detailView = new DetailView(); |
||
65 | $offset = 0; |
||
66 | $offset=0; |
||
67 | if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) { |
||
68 | $result = $detailView->processSugarBean("CAMPAIGN", $focus, $offset); |
||
69 | if($result == null) { |
||
70 | sugar_die($app_strings['ERROR_NO_RECORD']); |
||
71 | } |
||
72 | $focus=$result; |
||
73 | } else { |
||
74 | header("Location: index.php?module=Accounts&action=index"); |
||
75 | } |
||
76 | |||
77 | // if campaign type is set to newsletter, then include newsletter detail view.. |
||
78 | // ..else default to legacy detail view |
||
79 | |||
80 | // include ('modules/Campaigns/NewsLetterTrackDetailView.php'); |
||
81 | |||
82 | if(isset($focus->campaign_type) && $focus->campaign_type == "NewsLetter"){ |
||
83 | echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_NEWSLETTER'],$focus->name), true); |
||
84 | } else{ |
||
85 | echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'],$focus->name), true); |
||
86 | } |
||
87 | |||
88 | $GLOBALS['log']->info("Campaign detail view"); |
||
89 | $smarty = new Sugar_Smarty(); |
||
90 | $smarty->assign("MOD", $mod_strings); |
||
91 | $smarty->assign("APP", $app_strings); |
||
92 | |||
93 | $smarty->assign("GRIDLINE", $gridline); |
||
94 | $smarty->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']); |
||
95 | $smarty->assign("ID", $focus->id); |
||
96 | $smarty->assign("ASSIGNED_TO", $focus->assigned_user_name); |
||
97 | $smarty->assign("STATUS", $app_list_strings['campaign_status_dom'][$focus->status]); |
||
98 | $smarty->assign("NAME", $focus->name); |
||
99 | $smarty->assign("TYPE", $app_list_strings['campaign_type_dom'][$focus->campaign_type]); |
||
100 | $smarty->assign("START_DATE", $focus->start_date); |
||
101 | $smarty->assign("END_DATE", $focus->end_date); |
||
102 | |||
103 | $smarty->assign("BUDGET", $focus->budget); |
||
104 | $smarty->assign("ACTUAL_COST", $focus->actual_cost); |
||
105 | $smarty->assign("EXPECTED_COST", $focus->expected_cost); |
||
106 | $smarty->assign("EXPECTED_REVENUE", $focus->expected_revenue); |
||
107 | |||
108 | |||
109 | $smarty->assign("OBJECTIVE", nl2br($focus->objective)); |
||
110 | $smarty->assign("CONTENT", nl2br($focus->content)); |
||
111 | $smarty->assign("DATE_MODIFIED", $focus->date_modified); |
||
112 | $smarty->assign("DATE_ENTERED", $focus->date_entered); |
||
113 | |||
114 | $smarty->assign("CREATED_BY", $focus->created_by_name); |
||
115 | $smarty->assign("MODIFIED_BY", $focus->modified_by_name); |
||
116 | $smarty->assign("TRACKER_URL", $sugar_config['site_url'] . '/campaign_tracker.php?track=' . $focus->tracker_key); |
||
117 | $smarty->assign("TRACKER_COUNT", intval($focus->tracker_count)); |
||
118 | $smarty->assign("TRACKER_TEXT", $focus->tracker_text); |
||
119 | $smarty->assign("REFER_URL", $focus->refer_url); |
||
120 | |||
121 | if(isset($focus->campaign_type) && $focus->campaign_type == "Email" || $focus->campaign_type == "NewsLetter") { |
||
122 | $smarty->assign("TRACK_DELETE_BUTTON","<input title=\"{$mod_strings['LBL_TRACK_DELETE_BUTTON_TITLE']}\" class=\"button\" onclick=\"this.form.module.value='Campaigns'; this.form.action.value='Delete';this.form.return_module.value='Campaigns'; this.form.return_action.value='TrackDetailView';this.form.mode.value='Test';return confirm('{$mod_strings['LBL_TRACK_DELETE_CONFIRM']}');\" type=\"submit\" name=\"button\" value=\" {$mod_strings['LBL_TRACK_DELETE_BUTTON_LABEL']} \">"); |
||
123 | } |
||
124 | |||
125 | $currency = new Currency(); |
||
126 | if(isset($focus->currency_id) && !empty($focus->currency_id)) |
||
127 | { |
||
128 | $currency->retrieve($focus->currency_id); |
||
129 | if( $currency->deleted != 1){ |
||
130 | $smarty->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol ); |
||
131 | }else $smarty->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() ); |
||
132 | }else{ |
||
133 | |||
134 | $smarty->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() ); |
||
135 | |||
136 | } |
||
137 | global $current_user; |
||
138 | if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){ |
||
139 | $smarty->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDIT_LAYOUT'])."</a>"); |
||
140 | } |
||
141 | |||
142 | global $xtpl; |
||
143 | $xtpl = $smarty; |
||
144 | |||
145 | $detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled()); |
||
146 | // adding custom fields: |
||
147 | require_once('modules/DynamicFields/templates/Files/DetailView.php'); |
||
148 | |||
149 | |||
150 | //if this is a newsletter, we need to build dropdown |
||
151 | $selected_marketing_id = ''; |
||
152 | if(isset($focus->campaign_type)){ |
||
153 | //we need to build the dropdown of related marketing values |
||
154 | $options_str = "<select onchange= \"this.form.module.value='Campaigns';this.form.action.value='TrackDetailView'; submit()\" name='mkt_id'>"; |
||
155 | $latest_marketing_id = ''; |
||
156 | if(isset($_REQUEST['mkt_id'])) $selected_marketing_id = $_REQUEST['mkt_id']; |
||
157 | |||
158 | $options_str .= '<option value="all">--None--</option>'; |
||
159 | //query for all email marketing records related to this campaign |
||
160 | $latest_marketing_query = "select id, name, date_modified from email_marketing where campaign_id = '$focus->id' order by date_modified desc"; |
||
161 | |||
162 | //build string with value(s) retrieved |
||
163 | $result =$focus->db->query($latest_marketing_query); |
||
164 | if ($row = $focus->db->fetchByAssoc($result)){ |
||
165 | //first, populated the latest marketing id variable, as this |
||
166 | // variable will be used to build chart and subpanels |
||
167 | if($focus->campaign_type == 'NewsLetter') { |
||
168 | $latest_marketing_id = $row['id']; |
||
169 | } |
||
170 | |||
171 | //fill in first option value |
||
172 | $options_str .= '<option value="'. $row['id'] .'"'; |
||
173 | // if the marketing id is same as selected marketing id, set this option to render as "selected" |
||
174 | if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) { |
||
175 | $options_str .=' selected>'. $row['name'] .'</option>'; |
||
176 | // if the marketing id is empty then set this first option to render as "selected" |
||
177 | }elseif(empty($selected_marketing_id) && $focus->campaign_type == 'NewsLetter'){ |
||
178 | $options_str .=' selected>'. $row['name'] .'</option>'; |
||
179 | // if the marketing is not empty, but not same as selected marketing id, then.. |
||
180 | //.. do not set this option to render as "selected" |
||
181 | }else{ |
||
182 | $options_str .='>'. $row['name'] .'</option>'; |
||
183 | } |
||
184 | } |
||
185 | //process rest of records, if they exist |
||
186 | while ($row = $focus->db->fetchByAssoc($result)){ |
||
187 | //add to list of option values |
||
188 | $options_str .= '<option value="'. $row['id'] .'"'; |
||
189 | //if the marketing id is same as selected marketing id, then set this option to render as "selected" |
||
190 | if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) { |
||
191 | $options_str .=' selected>'. $row['name'] .'</option>'; |
||
192 | }else{ |
||
193 | $options_str .=' >'. $row['name'] .'</option>'; |
||
194 | } |
||
195 | } |
||
196 | $options_str .="</select>"; |
||
197 | //populate the dropdown |
||
198 | $smarty->assign("FILTER_LABEL", $mod_strings['LBL_FILTER_CHART_BY']); |
||
199 | $smarty->assign("MKT_DROP_DOWN",$options_str); |
||
200 | } |
||
201 | //add chart |
||
202 | $seps = array("-", "/"); |
||
203 | $dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat); |
||
204 | $dateFileNameSafe = str_replace($seps, "_", $dates); |
||
205 | $cache_file_name = $current_user->getUserPrivGuid()."_campaign_response_by_activity_type_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"; |
||
206 | $cache_file_name_roi = $current_user->getUserPrivGuid()."_campaign_response_by_roi_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"; |
||
207 | $chart= new campaign_charts(); |
||
208 | |||
209 | //if marketing id has been selected, then set "latest_marketing_id" to the selected value |
||
210 | //latest marketing id will be passed in to filter the charts and subpanels |
||
211 | |||
212 | if(!empty($selected_marketing_id)){$latest_marketing_id = $selected_marketing_id;} |
||
213 | if(empty($latest_marketing_id) || $latest_marketing_id === 'all'){ |
||
214 | $smarty->assign("MY_CHART", $chart->campaign_response_by_activity_type($app_list_strings['campainglog_activity_type_dom'],$app_list_strings['campainglog_target_type_dom'],$focus->id,sugar_cached("xml/$cache_file_name"),true)); |
||
215 | }else{ |
||
216 | $smarty->assign("MY_CHART", $chart->campaign_response_by_activity_type($app_list_strings['campainglog_activity_type_dom'],$app_list_strings['campainglog_target_type_dom'],$focus->id,sugar_cached("xml/$cache_file_name"),true,$latest_marketing_id)); |
||
217 | } |
||
218 | |||
219 | //end chart |
||
220 | //custom chart code |
||
221 | require_once('include/SugarCharts/SugarChartFactory.php'); |
||
222 | $sugarChart = SugarChartFactory::getInstance(); |
||
223 | $resources = $sugarChart->getChartResources(); |
||
224 | $smarty->assign('chartResources', $resources); |
||
225 | |||
226 | echo $smarty->fetch('modules/Campaigns/TrackDetailView.tpl'); |
||
227 | |||
228 | require_once('include/SubPanel/SubPanelTiles.php'); |
||
229 | $subpanel = new SubPanelTiles($focus, 'Campaigns'); |
||
230 | //if latest marketing id is empty, or if it is set to 'all'', then do no filtering, otherwise filter.. |
||
231 | //.. out the chart and subpanels by marketing id |
||
232 | if(empty($latest_marketing_id) || $latest_marketing_id === 'all'){ |
||
0 ignored issues
–
show
|
|||
233 | //do nothing, no filtering is needed |
||
234 | }else{ |
||
235 | |||
236 | // assign selected marketing ID back to request in order to let ListView use it as a part of subpanel base URL |
||
237 | $_GET['mkt_id'] = $latest_marketing_id; |
||
238 | |||
239 | //get array of layout defs |
||
240 | $layoutDefsArr= $subpanel->subpanel_definitions->layout_defs; |
||
241 | |||
242 | //iterate through layout defs for processing of subpanels. If a marketing Id is specified, then we need to... |
||
243 | //.. filter the subpanels by it so they match the chart rendered in code above. |
||
244 | foreach($layoutDefsArr as $subpanels_name => $subpanels){ |
||
0 ignored issues
–
show
The expression
$layoutDefsArr of type string|array is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
![]() |
|||
245 | |||
246 | //process each subpanel definition |
||
247 | foreach($subpanels as $subpane_key => $subpane){ |
||
248 | |||
249 | //see if "function_parameters" key exists in subpanel properties array |
||
250 | if (isset($subpane['function_parameters'])){ |
||
251 | //if a function_parameters property key exists, then process further |
||
252 | $functionParamsArr = $subpane['function_parameters'];//$panelProperty; |
||
253 | |||
254 | //Check the array of function parameters and see if |
||
255 | //one exists for market value id. |
||
256 | if (isset($functionParamsArr['EMAIL_MARKETING_ID_VALUE'])){ |
||
257 | //We found the property, lets fill in the marketing id value... |
||
258 | //.. into the subpanel object, using the keys of the array that.. |
||
259 | //.. we used to get to thi property |
||
260 | $subpanel->subpanel_definitions->layout_defs[$subpanels_name][$subpane_key]['function_parameters']['EMAIL_MARKETING_ID_VALUE'] = $latest_marketing_id; |
||
261 | } |
||
262 | }//end if (isset($subpane['function_parameters'])){ |
||
263 | }//end foreach($subpanels as $subpane_key => $subpane){ |
||
264 | |||
265 | }//_pp($subpanel->subpanel_definitions->layout_defs); |
||
266 | }//end else |
||
267 | |||
268 | $deletedCampaignLogLeadsCount = $focus->getDeletedCampaignLogLeadsCount(); |
||
269 | if ($deletedCampaignLogLeadsCount > 0) |
||
270 | { |
||
271 | $subpanel->subpanel_definitions->layout_defs['subpanel_setup']['lead']['top_buttons'][] = array( |
||
272 | 'widget_class' => 'SubPanelTopMessage', |
||
273 | 'message' => string_format($mod_strings['LBL_LEADS_DELETED_SINCE_CREATED'], array($deletedCampaignLogLeadsCount)), |
||
274 | ); |
||
275 | } |
||
276 | |||
277 | $alltabs=$subpanel->subpanel_definitions->get_available_tabs(); |
||
278 | if (!empty($alltabs)) { |
||
279 | |||
280 | foreach ($alltabs as $name) { |
||
281 | if ($name == 'prospectlists' || $name=='emailmarketing' || $name == 'tracked_urls') { |
||
282 | $subpanel->subpanel_definitions->exclude_tab($name); |
||
283 | } |
||
284 | } |
||
285 | } |
||
286 | echo $subpanel->display(); |
||
287 | ?> |
This check looks for the bodies of
if
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
if
bodies can be removed. If you have an empty if but statements in theelse
branch, consider inverting the condition.could be turned into
This is much more concise to read.