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/widgets/calendar.php (1 issue)

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
 * Calendar Widget
4
 *
5
 * @package SimpleCalendar\Widgets
6
 */
7
namespace SimpleCalendar\Widgets;
8
9
use SimpleCalendar\Abstracts\Calendar_View;
10
use SimpleCalendar\Abstracts\Widget;
11
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit;
14
}
15
16
/**
17
 * Calendar widget.
18
 *
19
 * Display calendars in a widget area.
20
 *
21
 * @since 3.0.0
22
 */
23
class Calendar extends \WP_Widget implements Widget {
24
25
	/**
26
	 * Calendar feeds.
27
	 *
28
	 * @access public
29
	 * @var array
30
	 */
31
	public $calendars = array();
32
33
	/**
34
	 * Calendar view.
35
	 *
36
	 * @access public
37
	 * @var Calendar_View
38
	 */
39
	public $view = null;
40
41
	/**
42
	 * Constructor.
43
	 *
44
	 * @since 3.0.0
45
	 */
46
	public function __construct() {
47
48
		$id_base        = 'gce_widget'; // old id kept for legacy reasons
49
		$name           = __( 'Simple Calendar', 'google-calendar-events' );
50
		$widget_options = array(
51
			'description' => __( 'Display a calendar of events from one of your calendar feeds.', 'google-calendar-events' )
52
		);
53
54
		parent::__construct( $id_base, $name, $widget_options );
55
56
		if ( is_admin() ) {
57
			if ( ! defined( 'DOING_AJAX' ) ) {
58
				$this->calendars = simcal_get_calendars();
59
			} else {
60
				$this->calendars = get_transient( '_simple-calendar_feed_ids' );
61
			}
62
		}
63
	}
64
65
	/**
66
	 * Print the widget content.
67
	 *
68
	 * @since 3.0.0
69
	 *
70
	 * @param array $args     Display arguments.
71
	 * @param array $instance The settings for the particular instance of the widget.
72
	 */
73
	public function widget( $args, $instance ) {
74
75
		echo $args['before_widget'];
76
77
		if ( ! empty( $instance['title'] ) ) {
78
79
			echo $args['before_title']  . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
80
		}
81
82
		$id = isset( $instance['calendar_id'] ) ? absint( $instance['calendar_id'] ) : 0;
83
		if ( $id > 0 ) {
84
			simcal_print_calendar( $id );
85
		}
86
87
		echo $args['after_widget'];
88
	}
89
90
	/**
91
	 * Update a particular instance of the widget.
92
	 *
93
	 * This function should check that $new_instance is set correctly.
94
	 * The newly-calculated value of `$instance` should be returned.
95
	 * If false is returned, the instance won't be saved/updated.
96
	 *
97
	 * @since  3.0.0
98
	 *
99
	 * @param  array $new_instance New settings for this instance as input by the user via
100
	 * @param  array $old_instance Old settings for this instance.
101
	 *
102
	 * @return array Settings to save or bool false to cancel saving.
103
	 */
104
	public function update( $new_instance, $old_instance ) {
105
106
		$instance = array();
107
108
		$instance['title']          = ( ! empty( $new_instance['title'] ) )        ? sanitize_text_field( $new_instance['title'] ) : '';
109
		$instance['calendar_id']    = ( ! empty( $new_instance['calendar_id'] ) )  ? absint( $new_instance['calendar_id'] ) : '';
110
111
		return $instance;
112
	}
113
114
	/**
115
	 * Print the settings update form.
116
	 *
117
	 * @since  3.0.0
118
	 *
119
	 * @param  array  $instance Current settings.
120
	 *
121
	 * @return string
0 ignored issues
show
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
122
	 */
123
	public function form( $instance ) {
124
125
		$title          = isset( $instance['title'] )       ? esc_attr( $instance['title'] ) : __( 'Calendar', 'google-calendar-events' );
126
		$calendar_id    = isset( $instance['calendar_id'] ) ? esc_attr( $instance['calendar_id'] ) : '';
127
128
		?>
129
		<div class="simcal-calendar-widget-settings">
130
131
			<p>
132
				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'google-calendar-events' ); ?></label>
133
				<br>
134
				<input type="text"
135
				       name="<?php echo $this->get_field_name( 'title' ); ?>"
136
				       id="<?php echo $this->get_field_id( 'title' ); ?>"
137
				       class="widefat simcal-field simcal-field-standard simcal-field-text"
138
				       value="<?php echo $title; ?>">
139
			</p>
140
141
			<p>
142
				<label for="<?php echo $this->get_field_id( 'calendar_id' ); ?>"><?php _e( 'Calendar:', 'google-calendar-events' ); ?></label>
143
				<br>
144
				<?php $multiselect = count( $this->calendars ) > 15 ? ' simcal-field-select-enhanced' : ''; ?>
145
				<select name="<?php echo $this->get_field_name( 'calendar_id' ) ?>"
146
				        id="<?php echo $this->get_field_id( 'calendar_id' ) ?>"
147
						class="simcal-field simcal-field-select<?php echo $multiselect; ?>"
148
						data-noresults="<?php __( 'No calendars found.', 'google-calendar-events' ); ?>">
149
						<?php foreach ( $this->calendars as $id => $name ) : ?>
150
							<option value="<?php echo $id; ?>" <?php selected( $id, $calendar_id, true ); ?>><?php echo $name; ?></option>
151
						<?php endforeach; ?>
152
				</select>
153
			</p>
154
155
		</div>
156
		<?php
157
158
	}
159
160
}
161