Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dir.php « stream « files « private « lib - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2483385c1d8a09cc6f3ca55205fabc3fc2fb0bb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
 * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace OC\Files\Stream;

class Dir {
	private static $dirs = array();
	private $name;
	private $index;

	public function dir_opendir($path, $options) {
		$this->name = substr($path, strlen('fakedir://'));
		$this->index = 0;
		if (!isset(self::$dirs[$this->name])) {
			self::$dirs[$this->name] = array();
		}
		return true;
	}

	public function dir_readdir() {
		if ($this->index >= count(self::$dirs[$this->name])) {
			return false;
		}
		$filename = self::$dirs[$this->name][$this->index];
		$this->index++;
		return $filename;
	}

	public function dir_closedir() {
		$this->name = '';
		return true;
	}

	public function dir_rewinddir() {
		$this->index = 0;
		return true;
	}

	/**
	 * @param string $path
	 */
	public static function register($path, $content) {
		self::$dirs[$path] = $content;
	}
}