"; exit; }elseif(!is_readable($_CONFIG['backup_path'])){ echo ""; exit; } if($_REQUEST['act'] == "checkall"){ check($loc, $exfile, 1); } elseif($_REQUEST['act'] == "uncheckall"){ check($loc, $exfile, 0); } if($loc == "") $loc = "/"; $data = ""; if($fp = @fopen($exfile,"r")){ while(!feof($fp)){ $data .= fread($fp, 1024); } fclose($fp); } $_COOKIES = explode("\r\n", $data); $exc = 0; if($fp = @fopen($exfile,"w")){ if(is_array($_COOKIES)) foreach($_COOKIES as $key=>$value) if(trim($value!="")){ if($value!=$path){ fwrite($fp, $value."\r\n"); }else{ $exc = 1; } } if((!$exc)&&(trim($path)!='')) fwrite($fp, $path."\r\n"); fclose($fp); } $data = ""; if($fp = @fopen($exfile,"r")){ while(!feof($fp)){ $data .= fread($fp, 1024); } fclose($fp); } else{ echo ""; exit; } $_COOKIES = explode("\r\n", $data); if(is_array($_COOKIES)) foreach($_COOKIES as $key=>$value) if($value!='') { $exclude[] = $value; } sort($exclude); if (@is_dir($fulldir)){ if ($root=@opendir($fulldir)){ while ($file=@readdir($root)){ if(@is_dir($fulldir."/".$file)){ //is folder if($file=="." || $file==".."){continue;} else{ $d_arr[] = $file; } }else{ //is file $type=substr($file, strrpos($file, '.')); $f_arr[] = $file; } } } sort($f_arr); sort($d_arr); echo ""; foreach($d_arr as $file){ if(in_array($dir."/".$file, $_COOKIES)) $check = 'checked'; else $check = ''; echo "".htmlspecialchars($file).""; } foreach($f_arr as $file){ if(in_array($dir."/".$file, $_COOKIES)) $check = 'checked'; else $check = ''; echo "".htmlspecialchars($file).""; } foreach($exclude as $file) echo "".str_replace("","",htmlspecialchars($file)).""; echo ""; } function check($loc, $exfile, $act ){ global $_CONFIG; $fulldir = $loc; $flist = array(); $_COOKIES = array(); if (@is_dir($fulldir)){ if ($root=@opendir($fulldir)){ while ($file=readdir($root)) if(($file!='.')&&($file != '..')) { $flist[] = $loc ."/". $file; } } } if($fp = @fopen($exfile,"r")){ while(!feof($fp)){ $data .= fread($fp, 1024); } fclose($fp); } $_COOKIES = explode("\r\n", $data); if($act == 1){ $flist = @array_merge($_COOKIES, $flist); } else{ $flist = @array_diff($_COOKIES, $flist); } $flist = @array_unique($flist); if($fp = @fopen($exfile,"w")){ foreach($flist as $file){ fwrite($fp, $file."\r\n"); } fclose($fp); } } ?>