Issues (1751)

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.

lib/includes/loader.webdav.php (34 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
     loader.webdav.php                                     Muze Ariadne
4
     ------------------------------------------------------------------
5
     Author: Muze ([email protected])
6
     Date: 11 december 2002
7
8
     Copyright 2002 Muze
9
10
     This file is part of Ariadne.
11
12
     Ariadne is free software; you can redistribute it and/or modify
13
     it under the terms of the GNU General Public License as published
14
     by the Free Software Foundation; either version 2 of the License,
15
     or (at your option) any later version.
16
17
     Ariadne is distributed in the hope that it will be useful,
18
     but WITHOUT ANY WARRANTY; without even the implied warranty of
19
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
     GNU General Public License for more details.
21
22
     You should have received a copy of the GNU General Public License
23
     along with Ariadne; if not, write to the Free Software
24
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25
     02111-1307  USA
26
27
    -------------------------------------------------------------------
28
29
     Description:
30
31
       This is loader that contains all functions for the Ariadne web
32
       interface.
33
34
    ******************************************************************/
35
36
	$ERRMODE="htmljs"; // alternative: "text"/"html"/"js"
37
38
	define('LD_ERR_ACCESS', -1);
39
	define('LD_ERR_SESSION', -2);
40
41
	include_once($store_config['code']."includes/loader.webdav.auth.php");
42
43
	$DB["method"]["loader"] = false;
44
	$DB["method"]["file"] = true;
45
46
	if($webdav_config['debugfile']) {
47
		$DB["file"] = $webdav_config['debugfile'];
48
	} else {
49
		$DB["file"] = '/tmp/webdav.log';
50
	}
51
52
	function debug_print( $text ) {
0 ignored issues
show
The function debug_print() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.web.php (L55-58) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
53
		echo "<b>".$text."</b><br>";
54
		flush();
55
	}
56
57 View Code Duplication
	function error($text) {
0 ignored issues
show
This function 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...
The function error() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L48-50) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
58
		global $ERRMODE;
59
		switch ($ERRMODE) {
60
			case "html" :
61
				echo "<b><font color='red'>Error: $text</font></b><BR>\n";
62
				break;
63
			case "js" :
64
				echo "\nalert('Error: $text');\n";
65
				break;
66
			case "text" :
67
				echo "\nERROR: $text\n";
68
				break;
69
			case "htmljs" :
70
			default:
71
				echo "// <b><font color='red'>Error: $text</font></b><BR>\n<!--\nalert('Error: $text');\n// -->\n";
72
				break;
73
		}
74
	}
75
76
	function ldRegisterFile($field = "file", &$error) {
0 ignored issues
show
ldRegisterFile uses the super-global variable $_FILES which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
The function ldRegisterFile() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L52-81) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
77
	global $ARnls, $store;
78
79
		require_once($store->code."modules/mod_mimemagic.php");
80
81
		$result = Array();
82
83
		$file_temp=$_FILES[$field]['tmp_name'];
84
		$file=$_FILES[$field]['name'];
85
		if ($file && is_uploaded_file($file_temp)) {
86
			// new file uploaded -> save it before PHP deletes it
87
			$file_artemp=tempnam($store->get_config("files")."temp","upload");
88
			if (move_uploaded_file($file_temp, $file_artemp)) {
89
				// now make the new values available to wgWizKeepVars()
90
				$result[$field]=$file;
91
				$result[$field."_temp"]=substr($file_artemp,strlen($store->get_config("files")."temp"));
92
				$result[$field."_size"]=(int)$_FILES[$field]['size'];
93
				$type = get_mime_type($file_artemp);
94
				if (!$type) {
95
					$type = get_mime_type($file, MIME_EXT);
96
				}
97
				$result[$field."_type"]=$type;
98
			}
99
		}
100
		return $result;
101
	}
102
103
	function ldOnFinish() {
0 ignored issues
show
The function ldOnFinish() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.web.php (L153-168) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
104
	global $ARCurrent, $store;
105
106
		if ($ARCurrent->session) {
107
			$ARCurrent->session->save();
108
		}
109
		if ($store) {
110
			$store->close();
111
		}
112
	}
113
114
	function ldObjectNotFound($requestedpath, $requestedtemplate) {
0 ignored issues
show
The function ldObjectNotFound() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L157-159) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
115
	global $store, $AR;
116
117
		$path=$requestedpath;
118
		if (!$path) {
119
			error("Empty path requested with template: $requestedtemplate");
120
		} else {
121 View Code Duplication
			while ($path!=$prevPath && !$store->exists($path)) {
0 ignored issues
show
The variable $prevPath does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
122
				$prevPath=$path;
123
				$path=$store->make_path($path, "..");
124
			}
125
			if ($prevPath==$path) {
126
				error("Database is not initialised, please run <a href=\"".$AR->dir->www."install/install.php\">the installer</a>");
127
			} else {
128
				// no results: page couldn't be found, show user definable 404 message
129
				$store->call("user.notfound.html",
130
					 Array(	"arRequestedPath" => $requestedpath,
131
					 		"arRequestedTemplate" => $requestedtemplate ),
132
					 $store->get($path));
133
			}
134
		}
135
	}
136
137
138
	function ldAccessDenied($path, $message) {
0 ignored issues
show
The function ldAccessDenied() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L83-88) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
139
	global $ARCurrent, $store;
140
		/*
141
			since there is no 'peek' function, we need to pop and push
142
			the arCallArgs variable.
143
		*/
144
145
		$arCallArgs = array_pop($ARCurrent->arCallStack);
146
		array_push($ARCurrent->arCallStack, $arCallArgs);
147
148
		if (!$arCallArgs || is_array($arCallArgs)) {
149
			$arCallArgs["arLoginMessage"] = $message;
150
		} else {
151
			$arCallArgs.="&arLoginMessage=".urlencode($message);
152
		}
153
		if (!$ARCurrent->arLoginSilent) {
154
			$ARCurrent->arLoginSilent = true;
155
			$store->call("user.login.html",
156
								$arCallArgs,
157
								$store->get($path) );
158
		}
159
160
	}
161
162
	function ldSetRoot($session='', $nls='') {
0 ignored issues
show
The parameter $session is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The function ldSetRoot() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L90-92) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
163
	global $store, $AR, $ARCurrent, $root, $rootoptions;
164
165
		$root=$AR->root;
166
		$rootoptions="";
167
		if ($nls) {
168
			$rootoptions.="/$nls";
169
			$ARCurrent->nls=$nls;
170
		}
171
		$root.=$rootoptions;
172
		if ($store) { // loader.php uses this function before the store is initialized.
173
			$store->root=$root;
174
			$store->rootoptions=$rootoptions;
175
		}
176
	}
177
178
	function ldSetNls($nls) {
0 ignored issues
show
The function ldSetNls() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L94-96) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
179
	global $ARCurrent;
180
181
		$session=$ARCurrent->session->id;
182
		ldSetRoot($session, $nls);
183
	}
184
185
	function ldSetSession($session='') {
0 ignored issues
show
The function ldSetSession() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L98-100) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
186
	global $ARCookie, $AR, $ARCurrent;
187
188
		$nls=$ARCurrent->nls;
189
		$check = ldGetCredentials();
190
		if (!$check[$ARCurrent->session->id]) {
191
			$cookie = Array();
192
			$cookie[$ARCurrent->session->id]['timestamp']=time();
193
			$ARCookie=json_encode($cookie);
194
			debug("setting cookie ($ARCookie)");
195
			setcookie("ARCookie",$ARCookie, 0, '/');
196
		}
197
		ldSetRoot($session, $nls);
198
	}
199
200
	function ldStartSession($sessionid='') {
0 ignored issues
show
The function ldStartSession() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L102-104) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
201
	global $ARCurrent, $AR, $ariadne, $LD_NO_SESSION_SUPPORT;
202
		if ($LD_NO_SESSION_SUPPORT) {
203
			debug("ldStartSession($sessionid): no session support");
204
			return;
205
		}
206
207
		require($ariadne."/configs/sessions.phtml");
208
		$ARCurrent->session=new session($session_config,$sessionid);
0 ignored issues
show
The variable $session_config does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
209
		ldSetSession($ARCurrent->session->id);
210
	}
211
212
	function ldSetCache($file, $time, $image, $headers) {
0 ignored issues
show
The function ldSetCache() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L106-108) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
213
	global $store;
214
215
		debug("ldSetCache($file, $time, [image], [headers])","object");
216 View Code Duplication
		if ($time==-2) {
217
			$time=0;
218
		} else {
219
			$time=time()+($time*3600);
220
		}
221
		if (!preg_match("/\.\./",$file)) {
222
			if ($image) {
223
				$path=substr($file, 1, strrpos($file, "/")-1);
224 View Code Duplication
				if (!file_exists($store->get_config("files")."cache/".$path)) {
225
					ldMkDir("cache/".$path);
226
					ldMkDir("cacheheaders/".$path);
227
				}
228
				$fp=fopen($store->get_config("files")."cache".$file, "wb");
229
				fwrite($fp, $image);
230
				fclose($fp);
231
				$fp=fopen($store->get_config("files")."cacheheaders".$file, "wb");
232
				fwrite($fp, $headers);
233
				fclose($fp);
234
				if (!touch($store->get_config("files")."cache".$file, $time)) {
235
					debug("ldSetCache: ERROR: couldn't touch image","object");
236
				}
237
			}
238
		}
239
	}
240
241 View Code Duplication
	function ldMkDir($dir) {
0 ignored issues
show
This function 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...
The function ldMkDir() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.soap.php (L205-217) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
242
	global $store;
243
244
		debug("ldMkDir($dir)","object");
245
		$dir=strtok($dir, "/");
246
		$curr=$store->get_config("files");
247
		while ($dir) {
248
			$curr.=$dir."/";
249
			debug("ldMkDir: $curr","all");
250
			@mkdir($curr, 0755);
251
			$dir=strtok("/");
252
		}
253
	}
254
255 View Code Duplication
	function ldGetUserCookie($cookiename="ARUserCookie") {
0 ignored issues
show
This function 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...
ldGetUserCookie uses the super-global variable $_COOKIE which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
The function ldGetUserCookie() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L114-117) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
256
257
		$cookie = false;
258
259
		if( $_COOKIE[$cookiename] && !($cookiename == "ARCookie")) {
260
			$ARUserCookie = $_COOKIE[$cookiename];
261
262
			debug("ldGetUserCookie() = $ARUserCookie","object");
263
			$cookie=json_decode($ARUserCookie,true);
264
			if ($cookie === null) {
265
				$cookie=unserialize($ARUserCookie);
266
			}
267
		}
268
		return $cookie;
269
	}
270
271
	function ldSetUserCookie($cookie, $cookiename="ARUserCookie", $expire=null, $path="/", $domain="", $secure=0) {
0 ignored issues
show
The function ldSetUserCookie() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L119-122) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
272
273
		$result = false;
274
275 View Code Duplication
		if( $cookiename != "ARCookie") {
276
			$ARUserCookie=json_encode($cookie);
277
			debug("ldSetUserCookie(".$ARUserCookie.")","object");
278
			$result = setcookie($cookiename,$ARUserCookie, $expire, $path, $domain, $secure);
279
		}
280
281
		return $result;
282
	}
283
284
	function ldRedirect($uri) {
0 ignored issues
show
The function ldRedirect() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L133-134) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
285
		debug("ldRedirect($uri)");
286
		return ldHeader("Location: $uri");
287
	}
288
289
	function ldHeader($header) {
0 ignored issues
show
The function ldHeader() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L136-137) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
290
	global $ARCurrent;
291
292
		$result=false;
293
		if (!Headers_sent()) {
294
			$result=true;
295
			if (is_array($header)) {
296
				$header=implode('\n',$header);
297
			}
298
			debug("ldHeader($header)");
299
			Header($header);
300
			$ARCurrent->ldHeaders[strtolower($header)]=$header;
301
		} else {
302
			debug("Headers already sent, couldn't send $header","all");
303
		}
304
		return $result;
305
	}
306
307
	function ldSetClientCache($cache_on, $expires=0, $modified=0) {
0 ignored issues
show
The function ldSetClientCache() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L139-141) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
308
		global $ARCurrent;
309
		$now=time();
310
		if ($cache_on) {
311
			if (!$expires) {
312
				$expires=$now+1800;
313
			}
314
			if (!$modified) {
315
				$modified=$now;
316
			}
317
			ldHeader("Pragma: cache");
318
			ldHeader("Cache-control: cache");
319
			ldHeader("Expires: ".gmdate(DATE_RFC1123,$expires));
320
			$result=ldHeader("Last-Modified: ".gmdate(DATE_RFC1123,$modified));
321
		} else {
322
			if (!$modified) {
323
				$modified=time();
324
			}
325
			ldHeader("Pragma: no-cache");
326
			ldHeader("Cache-control: must-revalidate, max-age=0, private");
327
			ldHeader("Expires: ".gmdate(DATE_RFC1123,$expires));
328
			$result=ldHeader("Last-Modified: ".gmdate(DATE_RFC1123,$modified));
329
		}
330
		return $result;
331
	}
332
333
	function ldSetContent($mimetype, $size=0) {
0 ignored issues
show
The parameter $mimetype is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $size is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The function ldSetContent() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L143-145) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
334
	/*
335
		$result=ldHeader("Content-Type: ".$mimetype);
336
		if ($size) {
337
			$result=ldHeader("Content-Length: ".$size);
338
		}
339
		return $result;
340
	*/
341
	}
342
343
	function ldGetServerVar($server_var) {
0 ignored issues
show
ldGetServerVar uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
The function ldGetServerVar() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L147-150) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
344
345
		return $_SERVER[$server_var];
346
	}
347
348 View Code Duplication
	function ldGetClientVar($client_var) {
0 ignored issues
show
This function 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...
The function ldGetClientVar() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L152-155) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
349
		// not all environment variables should be disclosed
350
		switch($client_var) {
351
			case "REMOTE_ADDR": $result = getenv("REMOTE_ADDR"); break;
352
			case "HTTP_USER_AGENT": $result = getenv("HTTP_USER_AGENT"); break;
353
			case "HTTP_ACCEPT": $result = getenv("HTTP_ACCEPT"); break;
354
			case "HTTP_ACCEPT_LANGUAGE": $result = getenv("HTTP_ACCEPT_LANGUAGE"); break;
355
			default: $result = false; break;
356
		}
357
		return $result;
358
	}
359
360
	function ldDisablePostProcessing() {
0 ignored issues
show
The function ldDisablePostProcessing() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L181-184) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
361
		// dummy function
362
		return false;
363
	}
364
365
	function ldGetRequestedHost() {
0 ignored issues
show
The function ldGetRequestedHost() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L110-112) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
366
		// dummy function
367
	}
368