Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
filesystem.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb;
15
16 /**
17 * A class with various functions that are related to paths, files and the filesystem
18 */
19 class filesystem
20 {
21 /**
22 * Eliminates useless . and .. components from specified path.
23 *
24 * @param string $path Path to clean
25 * @return string Cleaned path
26 */
27 public function clean_path($path)
28 {
29 $exploded = explode('/', $path);
30 $filtered = array();
31 foreach ($exploded as $part)
32 {
33 if ($part === '.' && !empty($filtered))
34 {
35 continue;
36 }
37
38 if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..')
39 {
40 array_pop($filtered);
41 }
42 else
43 {
44 $filtered[] = $part;
45 }
46 }
47 $path = implode('/', $filtered);
48 return $path;
49 }
50 }
51