Issues (106)

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.

Classes/CacheManager.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
namespace AOE\Languagevisibility;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2016 AOE GmbH <[email protected]>
9
 *
10
 *  All rights reserved
11
 *
12
 *  This script is part of the TYPO3 project. The TYPO3 project is
13
 *  free software; you can redistribute it and/or modify
14
 *  it under the terms of the GNU General Public License as published by
15
 *  the Free Software Foundation; either version 3 of the License, or
16
 *  (at your option) any later version.
17
 *
18
 *  The GNU General Public License can be found at
19
 *  http://www.gnu.org/copyleft/gpl.html.
20
 *
21
 *  This script is distributed in the hope that it will be useful,
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 *  GNU General Public License for more details.
25
 *
26
 *  This copyright notice MUST APPEAR in all copies of the script!
27
 ***************************************************************/
28
29
/**
30
 * Class CacheManager
31
 * @package AOE\Languagevisibility
32
 */
33
class CacheManager {
34
35
	/**
36
	 * @var boolean
37
	 */
38
	protected static $useCache;
39
40
	/**
41
	 * @var boolean
42
	 */
43
	protected static $enableCache = TRUE;
44
45
	/**
46
	 * @var CacheManager
47
	 */
48
	protected static $instance;
49
50
	/**
51
	 * @var array
52
	 */
53
	protected static $confArray = array();
54
55
	/**
56
	 * @var array
57
	 */
58
	protected $cache = array();
59
60
	/**
61
	 * Class constructor
62
	 *
63
	 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
64
	 */
65 1
	protected function __construct() {
66 1
		if (!isset(self::$useCache)) {
67 1
			self::$useCache = FALSE;
68
69 1
			if (empty(self::$confArray)) {
70 1
				self::$confArray = @unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['languagevisibility']);
71 1
			}
72
73 1
			if (is_array(self::$confArray) && self::$confArray['useCache']) {
74 1
				self::$useCache = (1 === (int)self::$confArray['useCache']);
75 1
			}
76 1
		}
77 1
	}
78
79
	/**
80
	 * Method to determine if preCaching should be used or not.
81
	 *
82
	 * @return boolean
83
	 */
84 4
	public static function isCacheEnabled() {
85 4
		return (self::$useCache && self::$enableCache);
86
	}
87
88
	/**
89
	 * Use this method to force the cache usage.
90
	 *
91
	 * @return void
92
	 */
93 2
	public static function enableCache() {
94 2
		self::$enableCache = TRUE;
95 2
	}
96
97
	/**
98
	 * Use this method to unforce the cache usage.
99
	 *
100
	 * @return void
101
	 */
102 2
	public static function disableCache() {
103 2
		self::$enableCache = FALSE;
104 2
	}
105
106
	/**
107
	 * Flushed all caches.
108
	 *
109
	 * @return void
110
	 */
111 4
	public function flushAllCaches() {
112 4
		$this->cache = array();
113 4
	}
114
115
	/**
116
	 * Returns the cache array for a given name space.
117
	 *
118
	 * @param $namespace
119
	 * @return array
120
	 */
121 3
	public function get($namespace) {
122 3
		if (array_key_exists($namespace, $this->cache) && self::isCacheEnabled()) {
123 3
			return $this->cache[$namespace];
124
		} else {
125 2
			return array();
126
		}
127
	}
128
129
	/**
130
	 * Method to write content into the cache.
131
	 *
132
	 * @param $namespace
133
	 * @param $content
134
	 * @return void
135
	 */
136 3
	public function set($namespace, $content) {
137 3
		$this->cache[$namespace] = $content;
138 3
	}
139
140
	/**
141
	 * Returns an instance of the cacheManager singleton.
142
	 *
143
	 * @return CacheManager
144
	 */
145 4
	public static function getInstance() {
146 4
		if (! self::$instance instanceof CacheManager) {
147 1
			self::$instance = new CacheManager();
148 1
		}
149
150 4
		return self::$instance;
151
	}
152
153
	/**
154
	 * Prevent from cloning
155
	 *
156
	 * @param void
157
	 * @return void
158
	 */
159
	public final function __clone() {
160
		trigger_error('Clone is not allowed for ' . get_class($this) . ' (Singleton)', E_USER_ERROR);
161
	}
162
}
163