Issues (4069)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

modules/Campaigns/PopupCampaignRoi.php (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

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
require_once('include/DetailView/DetailView.php');
53
require_once('modules/Campaigns/Charts.php');
54
55
56
global $mod_strings;
57
global $app_strings;
58
global $app_list_strings;
59
global $sugar_version, $sugar_config;
60
61
global $theme;
62
63
64
65
66
$GLOBALS['log']->info("Campaign detail view");
67
68
$xtpl=new XTemplate ('modules/Campaigns/PopupCampaignRoi.html');
69
70
//_pp($_REQUEST['id']);
71
$campaign_id=$_REQUEST['id'];
72
$campaign = new Campaign();
73
$opp_query1  = "select camp.name, camp.actual_cost,camp.budget,camp.expected_revenue,count(*) opp_count,SUM(opp.amount) as Revenue, SUM(camp.actual_cost) as Investment,
74
                            ROUND((SUM(opp.amount) - SUM(camp.actual_cost))/(SUM(camp.actual_cost)), 2)*100 as ROI";
75
            $opp_query1 .= " from opportunities opp";
76
            $opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
77
            $opp_query1 .= " where opp.sales_stage = 'Closed Won' and camp.id='$campaign_id'";
78
            $opp_query1 .= " group by camp.name";
79
            //$opp_query1 .= " and deleted=0";
80
            $opp_result1=$campaign->db->query($opp_query1);
81
            $opp_data1=$campaign->db->fetchByAssoc($opp_result1);
82
 //get the click-throughs
83
 $query_click = "SELECT count(*) hits ";
84
			$query_click.= " FROM campaign_log ";
85
			$query_click.= " WHERE campaign_id = '$campaign_id' AND activity_type='link' AND related_type='CampaignTrackers' AND archived=0 AND deleted=0";
86
87
            //if $marketing id is specified, then lets filter the chart by the value
88
            if (!empty($marketing_id)){
89
                $query_click.= " AND marketing_id ='$marketing_id'";
90
            }
91
92
			$query_click.= " GROUP BY  activity_type, target_type";
93
			$query_click.= " ORDER BY  activity_type, target_type";
94
			$result = $campaign->db->query($query_click);
95
96
97
  $xtpl->assign("OPP_COUNT", $opp_data1['opp_count']);
98
  $xtpl->assign("ACTUAL_COST",$opp_data1['actual_cost']);
99
  $xtpl->assign("PLANNED_BUDGET",$opp_data1['budget']);
100
  $xtpl->assign("EXPECTED_REVENUE",$opp_data1['expected_revenue']);
101
102
103
104
105
	$currency  = new Currency();
106
if(isset($focus->currency_id) && !empty($focus->currency_id))
107
{
108
	$currency->retrieve($focus->currency_id);
109
	if( $currency->deleted != 1){
110
		$xtpl->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
111
	}else $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
112
}else{
113
114
	$xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
115
116
}
117
118
global $current_user;
119
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
120
121
	$xtpl->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>");
122
123
}
124
125
//$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled());
126
// adding custom fields:
127
//require_once('modules/DynamicFields/templates/Files/DetailView.php');
128
129
/* we need to build the dropdown of related marketing values
130
    $latest_marketing_id = '';
131
    $selected_marketing_id = '';
132
    if(isset($_REQUEST['mkt_id'])) $selected_marketing_id = $_REQUEST['mkt_id'];
133
    $options_str = '<option value="all">--None--</option>';
134
    //query for all email marketing records related to this campaign
135
    $latest_marketing_query = "select id, name, date_modified from email_marketing where campaign_id = '$focus->id' order by date_modified desc";
136
137
    //build string with value(s) retrieved
138
    $result =$campaign->db->query($latest_marketing_query);
139
    if ($row = $campaign->db->fetchByAssoc($result)){
140
        //first, populated the latest marketing id variable, as this
141
        // variable will be used to build chart and subpanels
142
        $latest_marketing_id = $row['id'];
143
        //fill in first option value
144
        $options_str .= '<option value="'. $row['id'] .'"';
145
        // if the marketing id is same as selected marketing id, set this option to render as "selected"
146
        if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
147
            $options_str .=' selected>'. $row['name'] .'</option>';
148
        // if the marketing id is empty then set this first option to render as "selected"
149
        }elseif(empty($selected_marketing_id)){
150
            $options_str .=' selected>'. $row['name'] .'</option>';
151
        // if the marketing is not empty, but not same as selected marketing id, then..
152
        //.. do not set this option to render as "selected"
153
        }else{
154
            $options_str .='>'. $row['name'] .'</option>';
155
        }
156
    }
157
    //process rest of records, if they exist
158
    while ($row = $campaign->db->fetchByAssoc($result)){
159
        //add to list of option values
160
        $options_str .= '<option value="'. $row['id'] .'"';
161
        //if the marketing id is same as selected marketing id, then set this option to render as "selected"
162
        if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
163
            $options_str .=' selected>'. $row['name'] .'</option>';
164
        }else{
165
            $options_str .=' >'. $row['name'] .'</option>';
166
        }
167
     }
168
    //populate the dropdown
169
    $xtpl->assign("MKT_DROP_DOWN",$options_str);
170
171
  */
172
173
//add chart
174
$seps				= array("-", "/");
175
$dates				= array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
176
$dateFileNameSafe	= str_replace($seps, "_", $dates);
177
$cache_file_name_roi	= $current_user->getUserPrivGuid()."_campaign_response_by_roi_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
178
$chart= new campaign_charts();
179
180
//ob_start();
181
182
    //if marketing id has been selected, then set "latest_marketing_id" to the selected value
183
    //latest marketing id will be passed in to filter the charts and subpanels
184
185
    if(!empty($selected_marketing_id)){$latest_marketing_id = $selected_marketing_id;}
186
    if(empty($latest_marketing_id) ||  $latest_marketing_id === 'all'){
187
        $xtpl->assign("MY_CHART_ROI", $chart->campaign_response_roi_popup($app_list_strings['roi_type_dom'],$app_list_strings['roi_type_dom'],$campaign_id,sugar_cached("xml/") . $cache_file_name_roi,true));
0 ignored issues
show
The method campaign_response_roi_popup() does not exist on campaign_charts. Did you maybe mean campaign_response_roi()?

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.

Loading history...
188
    }else{
189
190
    $xtpl->assign("MY_CHART_ROI", $chart->campaign_response_roi_popup($app_list_strings['roi_type_dom'],$app_list_strings['roi_type_dom'],$campaign_id,sugar_cached("xml/") .$cache_file_name_roi,true));
0 ignored issues
show
The method campaign_response_roi_popup() does not exist on campaign_charts. Did you maybe mean campaign_response_roi()?

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.

Loading history...
191
    }
192
193
//$output_html .= ob_get_contents();
194
//ob_end_clean();
195
196
197
//_ppd($xtpl);
198
//end chart
199
200
$xtpl->parse("main");
201
$xtpl->out("main");
202
203
?>