[go: up one dir, main page]

Menu

[r1]: / includes / RMDFS.class.php  Maximize  Restore  History

Download this file

112 lines (104 with data), 2.3 kB

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?
class RMDFS {
var $FS = null;
var $openlink = null;
var $path = array();
function RMDFS(){
$data=file_get_contents('FS.txt');
$this->FS=unserialize($data);
$this->FS['type']=1;
}
function close(){
$f=fopen('FS.txt','wb');
fwrite($f,serialize($this->FS));
fclose($f);
//$this->FS=unserialize($data);
}
function correct_name($name){
return str_replace(array('\\\\','\\',"'",':','<','>','*','?','"','|'),array('\\','/',"\\'",'','','','','','','',''),$name);
}
function is_dir(){
return ($this->openlink['type'])?true:false;
}
function is_file(){
return ($this->openlink['type'])?false:true;
}
function open($path=''){
$path=$this->correct_name($path);
$path =explode('/',$path);
$dinvar='$this->FS';
for($i=0;$i<count($path);$i++){
if($path[$i]!=''){
$dinvar.="['{$path[$i]}']";
}
}
echo "\$is=isset($dinvar);";
eval("\$is=isset($dinvar);");
print_r($this->FS);
if($is){
eval("\$this->openlink=&$dinvar;");
return true;
}else{
return false;
}
}
function mkdir($dirname){
$dirname=basename($this->correct_name($dirname));//TODO: correct '
if($this->openlink!=null){
if($this->openlink['type']==1){
if(isset($this->openlink[$dirname]['type'])){
return false;
}else{
$this->openlink[$dirname]['type']=1;
return true;
}
}else{
return false;
}
}else{
return false;
}
}
function mkfile($filename,$data_arr){
$filename=basename($this->correct_name($filename));//TODO: correct '
if($this->openlink!=null){
if($this->openlink['type']==1){
if(isset($this->openlink[$filename]['type'])){
return false;
}else{
$this->openlink[$filename]['type']=0;
$this->openlink[$filename]=array_merge($this->openlink[$filename],$data_arr);
return true;
}
}else{
return false;
}
}else{
return false;
}
}
function get_file_list(){
if($this->openlink!=null){
if($this->openlink['type']==1){
$keys=array_keys($this->openlink);
$ret=array();
$j=0;
for($i=0;$i<count($keys);$i++){
if($keys[$i]!='type'){
$ret[$j]['name']=$keys[$i];
$ret[$j]['type']=$this->openlink[$keys[i]]['type'];
$j++;
}
}
return $ret;
}else{
return false;
}
}else{
return false;
}
}
function rename($oldname,$newname){
}
}
?>