Issues (4335)

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.

includes/admin/emails/backward-compatibility.php (10 issues)

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
/**
4
 * Offline donation instruction setting backward compatibility.
5
 *
6
 * @since 2.0
7
 *
8
 * @param string                  $notification_status
9
 * @param Give_Email_Notification $email
10
 * @param int                     $form_id
11
 *
12
 * @return string
13
 */
14 View Code Duplication
function _give_bc_offline_donation_instruction_notification_status( $notification_status, $email, $form_id ) {
0 ignored issues
show
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
	// Bailout.
16
	if ( ! $form_id ) {
17
		return $notification_status;
18
	}
19
20
	if ( ! get_post_meta( $form_id, '_give_offline-donation-instruction_notification', true ) ) {
21
		$old_value           = get_post_meta( $form_id, '_give_customize_offline_donations', true );
22
		$notification_status = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) )
0 ignored issues
show
array('enabled', 'global') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a string|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
23
			? $old_value
24
			: 'global';
25
	}
26
0 ignored issues
show
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
27
28
	return $notification_status;
29
}
30
31
add_filter( 'give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3 );
32
33
34
/**
35
 * Offline donation instruction setting backward compatibility.
36
 *
37
 * @since 2.0
38
 *
39
 * @param mixed                   $option_value
40
 * @param string                  $option_name
41
 * @param Give_Email_Notification $email
42
 * @param int                     $form_id
43
 *
44
 * @return mixed
45
 */
46
function _give_bc_offline_donation_instruction_email_setting_values( $option_value, $option_name, $email, $form_id ) {
47
	// Bailout.
48
	if ( empty( $form_id ) || 'offline-donation-instruction' !== $email->config['id'] ) {
49
		return $option_value;
50
	}
51
52
	switch ( $option_name ) {
53 View Code Duplication
		case '_give_offline-donation-instruction_email_message':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
			if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) {
55
				$option_value = get_post_meta( $form_id, '_give_offline_donation_email', true );
56
			}
57
			break;
58
59 View Code Duplication
		case '_give_offline-donation-instruction_email_subject':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
			if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) {
61
				$option_value = get_post_meta( $form_id, '_give_offline_donation_subject', true );
62
			}
63
			break;
64
	}
65
66
	return $option_value;
67
}
68
69
add_filter( 'give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4 );
70
71
72
/**
73
 * Offline donation instruction setting for form metabox setting
74
 *
75
 * @since 2.0
76
 *
77
 * @param $field_value
78
 * @param $field
79
 * @param $form_id
80
 *
81
 * @return string
82
 */
83 View Code Duplication
function _give_bc_offline_instruction_status_setting_value( $field_value, $field, $form_id ) {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
85
		$old_value   = get_post_meta( $form_id, '_give_customize_offline_donations', true );
86
		$field_value = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) )
0 ignored issues
show
array('enabled', 'global') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a string|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87
			? $old_value
88
			: 'global';
89
	}
90
91
	return $field_value;
92
}
93
94
add_filter( '_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3 );
95
96
97
/**
98
 * Offline donation instruction setting for form metabox setting
99
 *
100
 * @since 2.0
101
 *
102
 * @param $field_value
103
 * @param $field
104
 * @param $form_id
105
 *
106
 * @return string
107
 */
108 View Code Duplication
function _offline_donation_instruction_email_subject_setting_value( $field_value, $field, $form_id ) {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
110
		$field_value = get_post_meta( $form_id, '_give_offline_donation_subject', true );
111
	}
112
113
	return $field_value;
114
}
115
116
add_filter( '_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3 );
117
118
119
/**
120
 * Offline donation instruction setting for form metabox setting
121
 *
122
 * @since 2.0
123
 *
124
 * @param $field_value
125
 * @param $field
126
 * @param $form_id
127
 *
128
 * @return string
129
 */
130 View Code Duplication
function _give_bc_offline_donation_instruction_email_message_setting_value( $field_value, $field, $form_id ) {
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
131
	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
132
		$field_value = get_post_meta( $form_id, '_give_offline_donation_email', true );
133
	}
134
135
	return $field_value;
136
}
137
138
add_filter( '_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3 );