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.

providers/mailchimp/class-mailchimp-groups.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
class WPMC_MailChimp_Groups {
3
4
	/**
5
	 * @var string ID of the current list group
6
	 * @since 1.1
7
	 */
8
	protected $group_id;
9
10
	/**
11
	 * @var array Group values
12
	 * @since 1.1
13
	 */
14
	protected $options;
15
16
	/**
17
	 * @var int Current popup (post) ID
18
	 * @since 1.1
19
	 */
20
	protected $post_id;
21
22
	public function __construct( $group_id = '', $options = array(), $post_id = 0 ) {
23
24
		if ( ! empty( $group_id ) && ! empty( $options ) ) {
25
		
26
			$this->group_name = $group_id;
0 ignored issues
show
The property group_name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
27
			$this->options    = $options;
28
			$this->post_id    = $post_id;
29
30
		}
31
32
	}
33
34
	/**
35
	 * Get the value.
36
	 *
37
	 * Get the value for a specific group.
38
	 *
39
	 * @since  1.1.0
40
	 * @param  integer  $group  The group ID
41
	 * @param  boolean  $post_id Post ID
42
	 * @return array             Array of values for this group (empty array if no values)
43
	 */
44
	public function get_value( $group, $post_id = false ) {
45
46
		/* Make sure we have a post ID to check */
47
		if ( false === $post_id ) {
48
			$post_id = $this->post_id;
49
		}
50
51
		$value = maybe_unserialize( get_post_meta( $post_id, 'wpbo_mc_list_groups', true ) );
52
53
		if ( isset( $value[$group] ) ) {
54
			return apply_filters( "wpmc_mailchimp_groups_value_$group", $value[$group] );
55
		} else {
56
			return array();
57
		}
58
		
59
60
	}
61
62
	/**
63
	 * Display group options as checkboxes.
64
	 *
65
	 * @since  1.1.0
66
	 */
67
	public function show_group_type_checkboxes() {
68
69
		do_action( 'wpmc_mailchimp_groups_type_checkboxes_before', $this->group_name ); ?>
70
71
		<fieldset>
72
			<?php
73
			foreach( $this->options as $option ):
74
75
				$value   = $this->get_value( $this->group_name );
76
				$checked = in_array( $option['name'], $value ) ? 'checked="checked"' : '';
77
				?>
78
				<legend class="screen-reader-text"><span><?php echo $option['name']; ?></span></legend>
79
				<label for="wpbo_mc_group_<?php echo $option['id']; ?>" class="ta-label-block">
80
						<input name="wpbo_mc_list_groups[<?php echo $this->group_name; ?>][]" type="checkbox" id="wpbo_mc_group_<?php echo $option['id']; ?>" value="<?php echo $option['name']; ?>" <?php echo $checked; ?>> <?php echo $option['name']; ?>
81
				</label>
82
			<?php endforeach; ?>
83
		</fieldset>
84
85
		<?php
86
		do_action( 'wpmc_mailchimp_groups_type_checkboxes_after', $this->group_name );
87
88
	}
89
90
	/**
91
	 * Display group options as radio.
92
	 *
93
	 * @since  1.1.0
94
	 */
95 View Code Duplication
	public function show_group_type_radio() {
0 ignored issues
show
This method 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...
96
97
		do_action( 'wpmc_mailchimp_groups_type_radio_before', $this->group_name ); ?>
98
99
		<fieldset>
100
			<?php
101
			foreach( $this->options as $option ):
102
103
				$value   = $this->get_value( $this->group_name );
104
				$checked = $option['name'] == $value ? 'checked="checked"' : '';
105
				?>
106
				<label>
107
					<input type="radio" name="wpbo_mc_list_groups[<?php echo $this->group_name; ?>]" value="<?php echo $option['name']; ?>" <?php echo $checked; ?>> 
108
					<span><?php echo $option['name']; ?></span>
109
				</label>
110
				<br>
111
			<?php endforeach; ?>
112
		</fieldset>
113
114
		<?php
115
		do_action( 'wpmc_mailchimp_groups_type_radio_after', $this->group_name );
116
117
	}
118
119
	/**
120
	 * Display group options as dropdown.
121
	 *
122
	 * @since  1.1.0
123
	 */
124 View Code Duplication
	public function show_group_type_dropdown() {
0 ignored issues
show
This method 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...
125
126
		do_action( 'wpmc_mailchimp_groups_type_dropdown_before', $this->group_name ); ?>
127
128
		<select name="wpbo_mc_list_groups[<?php echo $this->group_name; ?>]" id="wpbo_mc_list_groups_<?php echo $this->group_name; ?>" style="width:100%">
129
			<?php
130
			foreach( $this->options as $option ):
131
132
				$value   = $this->get_value( $this->group_name );
133
				$checked = ( $option['name'] == $value ) ? 'selected="selected"' : '';
134
				?>
135
136
				<option value="<?php echo $option['name']; ?>" <?php echo $checked; ?>><?php echo $option['name']; ?></option>
137
138
			<?php endforeach; ?>
139
		</select>
140
141
		<?php
142
		do_action( 'wpmc_mailchimp_groups_type_dropdown_after', $this->group_name );
143
144
	}
145
146
}