Issues (103)

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/providers/mailchimp/functions-admin.php (3 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
 * BetterOptin Provider MailChimp
4
 *
5
 * @package   BetterOptin/Provider/MailChimp
6
 * @author    ThemeAvenue <[email protected]>
7
 * @license   GPL-2.0+
8
 * @link      http://themeavenue.net
9
 * @copyright 2015 ThemeAvenue
10
 */
11
12
// If this file is called directly, abort.
13
if ( ! defined( 'WPINC' ) ) {
14
	die;
15
}
16
17
add_action( 'admin_notices', 'wpbo_mc_settings_warning' );
18
/**
19
 * Incomplete settings warning.
20
 *
21
 * Warn user if settings are not correct.
22
 *
23
 * @since  1.0.0
24
 */
25 View Code Duplication
function wpbo_mc_settings_warning() {
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...
26
27
	if ( ! WPBO_MC()->is_mailchimp_ready() ): ?>
28
29
		<div class="error">
30
			<p><?php printf( __( 'MailChimp integration is not correctly setup. Your popups won\'t send subscribers anywhere! <a href="%s">Click here to see the settings</a>.', 'betteroptin' ), esc_url( add_query_arg( array(
31
					'post_type' => 'wpbo-popup',
32
					'page'      => 'edit.php?post_type=wpbo-popup-settings&tab=mailchimp'
33
				), admin_url( 'edit.php' ) ) ) ); ?></p>
34
		</div>
35
36
	<?php endif;
37
38
}
39
40
add_filter( 'wpbo_checklist', 'wpbo_mc_add_step' );
41
/**
42
 * Add new step.
43
 *
44
 * Add a step in the checklist during popup creation process
45
 * in order to was the user if the settings are not correct.
46
 *
47
 * @since  1.0.0
48
 *
49
 * @param  array $checklist Current checklist
50
 *
51
 * @return array            Updated checklist
52
 */
53
function wpbo_mc_add_step( $checklist ) {
54
55
	if ( ! wpbo_is_popup_edit_screen() ) {
56
		return $checklist;
57
	}
58
59
	$ready = WPBO_MC()->is_mailchimp_ready() ? true : false;
60
	$new   = array();
61
	$step  = array(
62
		'label'   => __( 'Setup MailChimp', 'betteroptin' ),
63
		'check'   => $ready,
64
		'against' => true,
65
		'compare' => 'EQUAL'
66
	);
67
68
	foreach ( $checklist as $id => $check ) {
69
70
		if ( 'published' == $id ) {
71
			$new['mailchimp'] = $step;
72
		}
73
74
		$new[ $id ] = $check;
75
76
	}
77
78
	return $new;
79
80
}
81
82
add_filter( 'wpbo_publish_button_action', 'wpbo_mc_prevent_publishing', 10, 2 );
83
/**
84
 * Prevent from publishing popup if MailChimp is not ready.
85
 *
86
 * @since  1.0.0
87
 *
88
 * @param  array $data    Sanitized data
89
 * @param  array $postarr Raw data
90
 *
91
 * @return array          Sanitized data with updated status
92
 */
93 View Code Duplication
function wpbo_mc_prevent_publishing( $data, $postarr ) {
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...
94
95
	if ( ! wpbo_is_popup_edit_screen() ) {
96
		return $data;
97
	}
98
99
	if ( 'wpbo-popup' == $postarr['post_type'] && 'publish' == $data['post_status'] ) {
100
101
		if ( ! $this->is_mailchimp_ready() ) {
0 ignored issues
show
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
102
			$data['post_status'] = 'draft';
103
		}
104
105
	}
106
107
	return $data;
108
109
}
110
111
add_filter( 'wpbo_publish_button_label', 'wpbo_mc_publish_button_label', 10, 2 );
112
/**
113
 * Change the save button label if MailChimp integration is not yet ready
114
 *
115
 * @since 1.0
116
 *
117
 * @param $translation
118
 * @param $text
119
 *
120
 * @return string|void
121
 */
122
function wpbo_mc_publish_button_label( $translation, $text ) {
123
124
	if ( ! wpbo_is_popup_edit_screen() ) {
125
		return $translation;
126
	}
127
128
	global $typenow;
129
130
	if ( 'wpbo-popup' == $typenow ) {
131
132
		if ( isset( $_GET['post'] ) && 'Publish' == $text && ! WPBO_MC()->is_mailchimp_ready() ) {
133
			$translation = __( 'Save', 'betteroptin' );
134
		}
135
136
	}
137
138
	return $translation;
139
}