Issues (234)

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/pages/licenses.php (2 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
 * Licenses management page
4
 *
5
 * @package SimpleCalendar/Admin
6
 */
7
namespace SimpleCalendar\Admin\Pages;
8
9
use SimpleCalendar\Abstracts\Admin_Page;
10
11
if ( ! defined( 'ABSPATH' ) ) {
12
	exit;
13
}
14
15
/**
16
 * Licenses.
17
 *
18
 * Handles the plugin add-ons licenses if at least one is installed and active.
19
 *
20
 * @since 3.0.0
21
 */
22
class Licenses extends Admin_Page {
23
24
	/**
25
	 * Constructor.
26
	 *
27
	 * @since 3.0.0
28
	 */
29 View Code Duplication
	public function __construct() {
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...
30
31
		$this->id           = $tab = 'licenses';
32
		$this->option_group = $page = 'settings';
33
		$this->label        = __( 'Add-on Licenses', 'google-calendar-events' );
34
		//$this->description  = __( 'Manage your premium add-on license keys.', 'google-calendar-events' );
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
35
		$this->sections     = $this->add_sections();
36
		$this->fields       = $this->add_fields();
37
38
		// Disabled the 'save changes' button for this page.
39
		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
40
41
		// Add html to page.
42
		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( __CLASS__, 'html' ) );
43
	}
44
45
	/**
46
	 * Add additional html.
47
	 *
48
	 * @since  3.0.0
49
	 *
50
	 * @return void
51
	 */
52
	public static function html()  {
53
		// Add a nonce field used in ajax.
54
		wp_nonce_field( 'simcal_license_manager', 'simcal_license_manager' );
55
		// Add a license 'reset' button.
56
		?>
57
		<br><br>
58
		<a href="#" id="simcal-reset-licenses" data-dialog="<?php _e( 'WARNING: Are you sure you want to start over and delete all license keys from the settings?', 'google-calendar-events' ) ?>">
59
			<?php _e( 'Delete your license keys', 'google-calendar-events' ) ?>
60
			<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i>
61
		</a>
62
		<?php
63
64
	}
65
66
	/**
67
	 * Add sections.
68
	 *
69
	 * @since  3.0.0
70
	 *
71
	 * @return array
72
	 */
73
	public function add_sections() {
74
		$sections = array(
75
			'keys' => array(
76
				'title' => __( 'Premium Add-on License Keys', 'google-calendar-events' ),
77
				'description' => __( 'Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events' ) .
78
				                 '<br/><br/>' .
79
				                 '<em>' . __( 'Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events' ) . '</em>',
80
			),
81
		);
82
		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
83
	}
84
85
	/**
86
	 * Add fields.
87
	 *
88
	 * @since  3.0.0
89
	 *
90
	 * @return array
91
	 */
92
	public function add_fields() {
93
94
		$fields = array();
95
		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
96
97
		foreach ( $this->sections as $section => $contents ) {
98
99
			if ( 'keys' == $section ) {
100
101
				$addons = apply_filters( 'simcal_installed_addons', array() );
102
103
				if ( ! empty( $addons ) && is_array( $addons ) ) {
104
105
					foreach ( $addons as $addon_id => $addon_name ) {
106
107
						$fields[ $section ][ $addon_id ] = array(
108
							'type'      => 'license',
109
							'addon'     => $addon_id,
110
							'title'     => esc_attr( $addon_name ),
111
							'name'      => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $addon_id . ']',
112
							'id'        => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-' . sanitize_key( $addon_id ),
113
							'value'     => $this->get_option_value( $section, $addon_id ),
114
							'class'     => array(
115
								'regular-text',
116
								'ltr',
117
							)
118
						);
119
120
					}
121
122
				}
123
124
			}
125
126
		}
127
128
		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
129
	}
130
131
}
132