Example #1
0
 function move($file, $path, $overwrite = 1, $bak = 0)
 {
     if (file_exists($file)) {
         if (is_dir($file)) {
             if (substr($file, -1) == '/') {
                 $dirname = basename(substr($file, 0, strlen($file) - 1));
             } else {
                 $dirname = basename($file);
             }
             if (substr($path, -1) != '/') {
                 $path .= '/';
             }
             if ($file != '.' || $file != '..' || $file != '../' || $file != './') {
                 $path .= $dirname;
             }
             File::movedir($file, $path, $overwrite, $bak);
             if (!$bak) {
                 File::delforder($file);
             }
         } else {
             if (file_exists($path)) {
                 if (is_dir($path)) {
                     chmod($path, 0777);
                 } else {
                     if ($overwrite) {
                         @unlink($path);
                     } else {
                         return false;
                     }
                 }
             } else {
                 File::notfate_any_mkdir($path);
             }
             if (substr($path, -1) != '/') {
                 $path .= '/';
             }
             File::movefile($file, $path . basename($file), $overwrite, $bak);
         }
     } else {
         return false;
     }
 }