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/CampaignTrackers/CampaignTracker.php (1 issue)

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
/*********************************************************************************
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
/*********************************************************************************
41
42
 * Description: The primary Function of this file is to manage all the data
43
 * used by other files in this nodule. It should extend the SugarBean which implements
44
 * all the basic database operations. Any custom behaviors can be implemented here by
45
 * implementing functions available in the SugarBean.
46
 ********************************************************************************/
47
48
49
50
51
52
53
class CampaignTracker extends SugarBean {
54
    /* Foreach instance of the bean you will need to access the fields in the table.
55
    * So define a variable for each one of them, the variable name should be same as the field name
56
    * Use this module's vardef file as a reference to create these variables.
57
    */
58
    var $id;
59
    var $date_entered;
60
    var $created_by;
61
    var $date_modified;
62
    var $modified_by;
63
    var $deleted;
64
    var $tracker_key;
65
    var $tracker_url;
66
    var $tracker_name;
67
    var $campaign_id;
68
    var $campaign_name;
69
    var $message_url;
70
    var $is_optout;
71
72
    /* End field definitions*/
73
74
    /* variable $table_name is used by SugarBean and methods in this file to constructs queries
75
    * set this variables value to the table associated with this bean.
76
    */
77
    var $table_name = 'campaign_trkrs';
78
79
    /*This  variable overrides the object_name variable in SugarBean, wher it has a value of null.*/
80
    var $object_name = 'CampaignTracker';
81
82
    /**/
83
    var $module_dir = 'CampaignTrackers';
84
85
    /* This is a legacy variable, set its value to true for new modules*/
86
    var $new_schema = true;
87
88
    /* $column_fields holds a list of columns that exist in this bean's table. This list is referenced
89
    * when fetching or saving data for the bean. As you modify a table you need to keep this up to date.
90
    */
91
    var $column_fields = Array(
92
            'id'
93
            ,'tracker_key'
94
            ,'tracker_url'
95
            ,'tracker_name'
96
            ,'campaign_id'
97
    );
98
99
    // This is used to retrieve related fields from form posts.
100
    var $additional_column_fields = Array('campaign_id');
101
    var $relationship_fields = Array('campaing_id'=>'campaign');
102
103
    var $required_fields =  array('tracker_name'=>1,'tracker_url'=>1);
104
105
    /*This bean's constructor*/
106 9
    public function __construct() {
107 9
        parent::__construct();
108 9
    }
109
110
    /**
111
     * @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
112
     */
113
    public function CampaignTracker(){
114
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
115
        if(isset($GLOBALS['log'])) {
116
            $GLOBALS['log']->deprecated($deprecatedMessage);
117
        }
118
        else {
119
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
120
        }
121
        self::__construct();
122
    }
123
124
125 1
    function save($check_notify = false) {
126
        //make sure that the url has a scheme, if not then add http:// scheme
127 1
        if ($this->is_optout!=1 ){
128
            $url = strtolower(trim($this->tracker_url));
129
            if(!preg_match('/^(http|https|ftp):\/\//i', $url)){
130
                $this->tracker_url = 'http://'.$url;
131
            }
132
        }
133
134 1
        parent::save($check_notify);
135 1
    }
136
137
    /* This method should return the summary text which is used to build the bread crumb navigation*/
138
    /* Generally from this method you would return value of a field that is required and is of type string*/
139 2
    function get_summary_text()
140
    {
141 2
        return "$this->tracker_name";
142
    }
143
144
145
    /* This method is used to generate query for the list form. The base implementation of this method
146
    * uses the table_name and list_field variable to generate the basic query and then  adds the custom field
147
    * join and team filter. If you are implementing this function do not forget to consider the additional conditions.
148
    */
149
150 1
    function fill_in_additional_detail_fields() {
151 1
        global $sugar_config;
152
153
        //setup campaign name.
154 1
        $query = "SELECT name from campaigns where id = '$this->campaign_id'";
155 1
        $result =$this->db->query($query,true," Error filling in additional detail fields: ");
156
157
        // Get the id and the name.
158 1
        $row = $this->db->fetchByAssoc($result);
159 1
        if($row != null) {
160
            $this->campaign_name=$row['name'];
161
        }
162
163 1
        if (!class_exists('Administration')) {
0 ignored issues
show
This if statement is empty and can be removed.

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 the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
164
165
        }
166 1
        $admin=new Administration();
167 1
        $admin->retrieveSettings('massemailer'); //retrieve all admin settings.
168 1
        if (isset($admin->settings['massemailer_tracking_entities_location_type']) and $admin->settings['massemailer_tracking_entities_location_type']=='2'  and isset($admin->settings['massemailer_tracking_entities_location']) ) {
169
            $this->message_url=$admin->settings['massemailer_tracking_entities_location'];
170
        } else {
171 1
            $this->message_url=$sugar_config['site_url'];
172
        }
173 1
        if ($this->is_optout == 1) {
174 1
            $this->message_url .= '/index.php?entryPoint=removeme&identifier={MESSAGE_ID}';
175
        } else {
176 1
            $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track=' . $this->id;
177
        }
178 1
    }
179
}
180
?>
181