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

fakedirstream.php « lib - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa3e64da62c0bd4e44c2141113c79c8d158a7a75 (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
<?php
global $FAKEDIRS;
$FAKEDIRS=array();

class fakeDirStream{
	private $name;
	private $data;
	private $index;

	public function dir_opendir($path,$options){
		global $FAKEDIRS;
		$url=parse_url($path);
		$this->name=substr($path,strlen('fakedir://'));
		$this->index=0;
		if(isset($FAKEDIRS[$this->name])){
			$this->data=$FAKEDIRS[$this->name];
		}else{
			$this->data=array();
		}
		return true;
	}

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

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

	public function dir_rewinddir() {
		$this->index=0;
		return true;
	}
}
 
stream_wrapper_register("fakedir", "fakeDirStream");