Issues (83)

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/MslsPostTagClassic.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
 * MslsPostTagClassic
4
 * @author Dennis Ploetner <[email protected]>
5
 * @since 0.9.9
6
 */
7
8
namespace lloc\Msls;
9
10
/**
11
 * Post Tag Clasic
12
 * @package Msls
13
 */
14
class MslsPostTagClassic extends MslsPostTag {
15
16
	/**
17
	 * Add the input fields to the add-screen of the taxonomies
18
	 * @param \StdClass $tag
19
	 */
20
	public function add_input( $tag ) {
21
		$title_format = '<h3>%s</h3>';
22
23
		$item_format = '<label for="msls_input_%1$s">%2$s</label>
24
			<select class="msls-translations" name="msls_input_%1$s">
25
			<option value=""></option>
26
			%3$s
27
			</select>';
28
29
		echo '<div class="form-field">';
30
		$this->the_input( $tag, $title_format, $item_format );
31
		echo '</div>';
32
	}
33
34
	/**
35
	 * Add the input fields to the edit-screen of the taxonomies
36
	 * @param \StdClass $tag
37
	 */
38
	public function edit_input( $tag ) {
39
		$title_format = '<tr>
40
			<th colspan="2">
41
			<strong>%s</strong>
42
			</th>
43
			</tr>';
44
45
		$item_format = '<tr class="form-field">
46
			<th scope="row" valign="top">
47
			<label for="msls_input_%1$s">%2$s</label></th>
48
			<td>
49
			<select class="msls-translations" name="msls_input_%1$s">
50
			<option value=""></option>
51
			%3$s
52
			</select></td>
53
			</tr>';
54
55
		$this->the_input( $tag, $title_format, $item_format );
56
	}
57
58
	/**
59
	 * Prints options inputs
60
	 * @uses selected
61
	 * @param MslsBlog $blog
62
	 * @param string $type
63
	 * @param MslsOptionsTax $mydata
64
	 * @param string $item_format
65
	 */
66
	public function print_option( MslsBlog $blog, $type, MslsOptionsTax $mydata, $item_format ) {
67
		switch_to_blog( $blog->userblog_id );
68
69
		$language = $blog->get_language();
70
		$icon     = MslsAdminIcon::create()
71
			->set_language( $language )
72
			->set_icon_type( 'flag' );
73
		$options  = '';
74
		$terms    = get_terms( $type, [ 'hide_empty' => 0 ] );
75
76
		if ( $mydata->has_value( $language ) ) {
77
			$icon->set_href( $mydata->$language );
78
		}
79
80
		if ( ! empty( $terms ) ) {
81
			foreach ( $terms as $term ) {
82
				$options .= sprintf(
83
					'<option value="%s" %s>%s</option>',
84
					$term->term_id,
85
					selected( $term->term_id, $mydata->$language, false ),
86
					$term->name
87
				);
88
			}
89
		}
90
91
		printf( $item_format, $language, $icon, $options );
92
93
		restore_current_blog();
94
	}
95
96
	/**
97
	 * Print the input fields
98
	 * Returns true if the blogcollection is not empty
99
	 * @param \StdClass $tag
100
	 * @param string $title_format
101
	 * @param string $item_format
102
	 * @return boolean
103
	 */
104
	public function the_input( $tag, $title_format, $item_format ) {
105
		$blogs = $this->collection->get();
106
		if ( $blogs ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $blogs of type lloc\Msls\MslsBlog[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
107
			$term_id = ( is_object( $tag ) ? $tag->term_id : 0 );
108
			$mydata  = MslsOptionsTax::create( $term_id );
109
			$type    = MslsContentTypes::create()->get_request();
110
111
			$this->maybe_set_linked_term( $mydata );
112
113
			printf(
114
				$title_format,
115
				apply_filters(
116
					'msls_term_select_title',
117
					__( 'Multisite Language Switcher', 'multisite-language-switcher' )
118
				)
119
			);
120
121
			foreach ( $blogs as $blog ) {
122
				$this->print_option( $blog, $type, $mydata, $item_format );
123
			}
124
			return true;
125
		}
126
		return false;
127
	}
128
}
129