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.

templates/shortcode-donor-wall.php (7 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
 * This template is used to display the donation grid with [give_donor_wall]
4
 */
5
6
// Exit if accessed directly.
7
if ( ! defined( 'ABSPATH' ) ) {
8
	exit;
9
}
10
11
/** @var $donor Give_Donor */
12
$donation = $args[0];
13
14
$give_settings = $args[1]; // Give settings.
15
$atts          = $args[2]; // Shortcode attributes.
16
?>
17
18
<div class="give-grid__item">
19
	<div class="give-donor give-card">
20
		<div class="give-donor__header">
21
			<?php
22
			if( true === $atts['show_avatar'] ) {
0 ignored issues
show
Space after opening control structure is required
Loading history...
No space before opening parenthesis is prohibited
Loading history...
23
24
				// Get anonymous donor image.
25
				$anonymous_donor_img = sprintf(
26
					'<img src="%1$s" alt="%2$s">',
27
					esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/anonymous-user.svg' ),
28
					esc_attr__( 'Anonymous User', 'give' )
29
				);
30
31
				// Get donor avatar image based on donation parameter.
32
				$donor_avatar = ! empty( $donation['_give_anonymous_donation'] ) ? $anonymous_donor_img : $donation['name_initial'];
33
34
				// Validate donor gravatar.
35
				$validate_gravatar = ! empty( $donation['_give_anonymous_donation'] ) ? 0 : give_validate_gravatar( $donation['_give_payment_donor_email'] );
36
37
				// Maybe display the Avatar.
38
				echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
39
					'<div class="give-donor__image" data-donor_email="%1$s" data-has-valid-gravatar="%2$s">%3$s</div>',
40
					md5( strtolower( trim( $donation['_give_payment_donor_email'] ) ) ),
41
					absint( $validate_gravatar ),
42
					$donor_avatar
43
				);
44
			}
45
			?>
46
47
			<div class="give-donor__details">
48
				<?php if ( true === $atts['show_name'] ) : ?>
49
					<h3 class="give-donor__name">
50
						<?php
51
						// Get donor name based on donation parameter.
52
						$donor_name = ! empty( $donation['_give_anonymous_donation'] )
53
							? __( 'Anonymous', 'give' )
54
							: trim( $donation['_give_donor_billing_first_name'] . ' ' . $donation['_give_donor_billing_last_name'] );
0 ignored issues
show
Expected next thing to be a escaping function, not '$donation'
Loading history...
55
						?>
56
						<?php esc_html_e( $donor_name ); ?>
57
					</h3>
58
				<?php endif; ?>
59
60
				<?php if ( true === $atts['show_total'] ) : ?>
61
					<span class="give-donor__total">
62
						<?php echo esc_html( give_donation_amount( $donation['donation_id'], true ) ); ?>
63
					</span>
64
				<?php endif; ?>
65
66
				<?php if ( true === $atts['show_time'] ) : ?>
67
					<span class="give-donor__timestamp">
68
						<?php echo esc_html( give_get_formatted_date( $donation[ 'donation_date' ], give_date_format(), 'Y-m-d H:i:s' ) ); ?>
0 ignored issues
show
Array keys should NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
69
					</span>
70
				<?php endif; ?>
71
			</div>
72
		</div>
73
74
		<?php
75
		if (
76
			true === $atts['show_comments']
77
			&& absint( $atts['comment_length'] )
78
			&& ! empty( $donation['donor_comment'] )
79
			&& ! $donation['_give_anonymous_donation']
80
		) :
81
			?>
82
			<div class="give-donor__content">
83
				<?php
84
				$comment     = trim( $donation['donor_comment'] );
85
				$total_chars = strlen( $comment );
86
				$max_chars   = $atts['comment_length'];
87
88
				// A truncated excerpt is displayed if the comment is too long.
89
				if ( $max_chars < $total_chars ) {
90
					$excerpt    = '';
91
					$offset     = -( $total_chars - $max_chars );
92
					$last_space = strrpos( $comment, ' ', $offset );
93
94
					if ( $last_space ) {
95
						// Truncate excerpt at last space before limit.
96
						$excerpt = substr( $comment, 0, $last_space );
97
					} else {
98
						// There are no spaces, so truncate excerpt at limit.
99
						$excerpt = substr( $comment, 0, $max_chars );
100
					}
101
102
					$excerpt = trim( $excerpt, '.!,:;' );
103
104
					echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
105
						'<p class="give-donor__excerpt">%s&hellip;<span> <a class="give-donor__read-more">%s</a></span></p>',
106
						nl2br( esc_html( $excerpt ) ),
107
						esc_html( $atts['readmore_text'] )
108
					);
109
				}
110
111
				echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
112
					'<p class="give-donor__comment">%s</p>',
113
					nl2br( esc_html( $comment ) )
114
				);
115
				?>
116
			</div>
117
		<?php endif; ?>
118
	</div>
119
</div>
120