change call function

1.replace 'dir' function to 'opendir' and 'readdir' function
2.change output format when action is 'SERVER' or 'var'