background image

if

 (

$isall

 == 1){

hx_dirtree(

$dir

);

}

else

{

hx_dealdir(

$dir

);

}

exit

();

}
 

function

 hx_dirtree(

$path

="."){

global

 

$sstr

,

$rpstr

,

$isreg

,

$arrext

;

 

$d

 = dir(

$path

);

while

(false !== (

$v

 = 

$d

->read())) {

if

(

$v

 == "." || 

$v

 == "..") 

continue

;

$file

 = 

$d

->path."/".

$v

;

if

(

is_dir

(

$file

)) {

echo

 "<p>$v</p>"; hx_dirtree(

$file

);

}

else

{

$ext

=

substr

(

strrchr

(

$v

,"."), 1);

if

( in_array(

$ext

 , 

$arrext

) ){

echo

 "<li>$file ";

$body

 = 

file_get_contents

(

$file

);

if

(

$isreg

 == 1){

$body2

 = preg_replace(

$sstr

$rpstr

$body

);

}

else

{

$body2

 = 

str_replace

(

$sstr

$rpstr

$body

);

}

if

(

$body

 != 

$body2

 && 

$body2

 != ''){

tofile(

$file

,

$body2

);

echo

 ' OK';

}

else

{

echo

 ' NO';

}

echo

 '</li>';

}
}
}

$d

->close();

}

function

 hx_dealdir(

$dir

){

global

 

$sstr

,

$rpstr

,

$isreg

,

$arrext

;

if

 (

$dh

 = opendir(

$dir

)) {

while

 (false !== (

$file

 = readdir(

$dh

))) {

if

(

filetype

(

$dir

.'/'.

$file

)=='file'){