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.

MultisiteLanguageSwitcher.php (1 issue)

Labels
Severity

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
 * Multisite Language Switcher Plugin
4
 *
5
 * @copyright Copyright (C) 2011-2020, Dennis Ploetner, [email protected]
6
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 or later
7
 * @wordpress-plugin
8
 *
9
 * Plugin Name: Multisite Language Switcher
10
 * Version: 2.4.11
11
 * Plugin URI: http://msls.co/
12
 * Description: A simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation.
13
 * Author: Dennis Ploetner
14
 * Author URI: http://lloc.de/
15
 * Text Domain: multisite-language-switcher
16
 * Domain Path: /languages/
17
 * License: GPLv2 or later
18
 *
19
 * This program is free software; you can redistribute it and/or modify
20
 * it under the terms of the GNU General Public License, version 2, as
21
 * published by the Free Software Foundation.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
31
 */
32
33
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
34
	require __DIR__ . '/vendor/autoload.php';
35
}
36
37
/**
38
 * MultisiteLanguageSwitcher
39
 *
40
 * @author Dennis Ploetner <[email protected]>
41
 */
42
if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) {
43
	define( 'MSLS_PLUGIN_VERSION', '2.4.11' );
44
	define( 'MSLS_PLUGIN_PATH', plugin_basename( __FILE__ ) );
45
	define( 'MSLS_PLUGIN__FILE__', __FILE__ );
46
47
	lloc\Msls\MslsPlugin::init();
48
49
	/**
50
	 * Get the output for using the links to the translations in your code
51
	 *
52
	 * @package Msls
53
	 *
54
	 * @param array $attr
55
	 *
56
	 * @return string
57
	 */
58
	function get_the_msls( $attr ) {
59
		$arr = is_array( $attr ) ? $attr : [];
60
		$obj = apply_filters( 'msls_get_output', null );
61
62
		return ! is_null( $obj ) ? strval( $obj->set_tags( $arr ) ) : '';
63
	}
64
65
	add_shortcode( 'sc_msls', 'get_the_msls' );
66
67
	/**
68
	 * Output the links to the translations in your template
69
	 *
70
	 * You can call this function directly like that
71
	 *
72
	 *     if ( function_exists ( 'the_msls' ) )
73
	 *         the_msls();
74
	 *
75
	 * or just use it as shortcode [sc_msls]
76
	 *
77
	 * @package Msls
78
	 * @uses get_the_msls
79
	 *
80
	 * @param array $arr
81
	 */
82
	function the_msls( array $arr = [] ) {
83
		echo get_the_msls( $arr );
84
	}
85
86
	/**
87
	 * Gets the URL of the country flag-icon for a specific locale
88
	 *
89
	 * @param string $locale
90
	 *
91
	 * @return string
92
	 */
93
	function get_msls_flag_url( $locale ) {
94
		return ( new \lloc\Msls\MslsOptions )->get_flag_url( $locale );
95
	}
96
97
	/**
98
	 * Gets the description for a blog for a specific locale
99
	 *
100
	 * @param string $locale
101
	 *
102
	 * @return bool|string
103
	 */
104
	function get_msls_blog_description( $locale ) {
105
		$blog = \lloc\Msls\MslsBlogCollection::instance()->get_blog( $locale );
106
107
		return $blog->get_description();
108
	}
109
110
	/**
111
	 * Gets the permalink for a translation of the current post in a given language
112
	 *
113
	 * @param string $locale
114
	 *
115
	 * @return string
116
	 */
117
	function get_msls_permalink( $locale ) {
118
		$options = \lloc\Msls\MslsOptions::create();
119
		$blog    = \lloc\Msls\MslsBlogCollection::instance()->get_blog( $locale );
120
121
		return $blog->get_url( $options );
0 ignored issues
show
It seems like $options defined by \lloc\Msls\MslsOptions::create() on line 118 can be null; however, lloc\Msls\MslsBlog::get_url() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
122
	}
123
124
}
125