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/mailpoet/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 MailPoet
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
/**
18
 * Check if MailChimp settings are correct.
19
 *
20
 * @since  1.0.0
21
 * @return boolean True if MailPoet integration is ready to work
22
 */
23
function wpbo_is_mailpoet_ready() {
24
25
	$list_id = wpbo_get_option( 'mp_list_id', '' );
26
27
	if ( empty( $list_id ) ) {
28
		return false;
29
	}
30
31
	return true;
32
33
}
34
35
add_action( 'admin_notices', 'wpbo_mp_settings_warning' );
36
/**
37
 * User warning.
38
 *
39
 * Warn user if settings are not correct.
40
 *
41
 * @since  1.0.0
42
 */
43 View Code Duplication
function wpbo_mp_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...
44
45
	if ( ! wpbo_is_mailpoet_ready() ): ?>
46
47
		<div class="error">
48
			<p><?php printf( __( 'Please select a list for your new subscribers, otherwise your popups won\'t send subscribers anywhere! <a href="%s">Click here to see the settings</a>.', 'betteroptin' ), esc_url( add_query_arg( array(
49
					'post_type' => 'wpbo-popup',
50
					'page'      => 'edit.php?post_type=wpbo-popup-settings&tab=mailpoet'
51
				), admin_url( 'edit.php' ) ) ) ); ?></p>
52
		</div>
53
54
	<?php endif;
55
56
}
57
58
add_filter( 'wpbo_checklist', 'wpbo_mp_add_step' );
59
/**
60
 * Add new step.
61
 *
62
 * Add a step in the checklist during popup creation process
63
 * in order to was the user if the settings are not correct.
64
 *
65
 * @since  1.0.0
66
 *
67
 * @param  array $checklist Current checklist
68
 *
69
 * @return array            Updated checklist
70
 */
71
function wpbo_mp_add_step( $checklist ) {
72
73
	$ready = wpbo_is_mailpoet_ready() ? true : false;
74
	$new   = array();
75
	$step  = array(
76
		'label'   => __( 'Setup MailPoet', 'betteroptin' ),
77
		'check'   => $ready,
78
		'against' => true,
79
		'compare' => 'EQUAL'
80
	);
81
82
	foreach ( $checklist as $id => $check ) {
83
84
		if ( 'published' == $id ) {
85
			$new['mailpoet'] = $step;
86
		}
87
88
		$new[ $id ] = $check;
89
90
	}
91
92
	return $new;
93
94
}
95
96
add_filter( 'wpbo_publish_button_action', 'wpbo_mp_prevent_publishing', 10, 2 );
97
/**
98
 * Prevent from publishing popup if MailPoet is not ready.
99
 *
100
 * @since  1.0.0
101
 *
102
 * @param  array $data    Sanitized data
103
 * @param  array $postarr Raw data
104
 *
105
 * @return array          Sanitized data with updated status
106
 */
107 View Code Duplication
function wpbo_mp_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...
108
109
	if ( 'wpbo-popup' == $postarr['post_type'] && 'publish' == $data['post_status'] ) {
110
111
		if ( ! wpbo_is_mailpoet_ready() ) {
112
			$data['post_status'] = 'draft';
113
		}
114
115
	}
116
117
	return $data;
118
119
}
120
121
add_filter( 'wpbo_publish_button_label', 'wpbo_mp_publish_button_label', 10, 2 );
122
/**
123
 * Change the "Publish" button label
124
 *
125
 * @param $translation
126
 * @param $text
127
 *
128
 * @return string
129
 */
130 View Code Duplication
function wpbo_mp_publish_button_label( $translation, $text ) {
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
132
	global $typenow;
133
134
	if ( 'wpbo-popup' == $typenow ) {
135
136
		if ( isset( $_GET['post'] ) && 'Publish' == $text && ! wpbo_is_mailpoet_ready() ) {
137
			$translation = __( 'Save', 'betteroptin' );
138
		}
139
140
	}
141
142
	return $translation;
143
}
144
145
/**
146
 * Get user lists.
147
 *
148
 * @since  1.0.0
149
 * @return array Array of available lists for this account
150
 */
151
function wpbo_mp_get_mailpoet_lists() {
152
153
	if ( ! class_exists( 'WYSIJA' ) ) {
154
		return array();
155
	}
156
157
	$model_list     = WYSIJA::get( 'list', 'model' );
158
	$mailpoet_lists = $model_list->get( array( 'name', 'list_id' ), array( 'is_enabled' => 1 ) );
159
160
	return $mailpoet_lists;
161
162
}