/** * * Function copy loop * This function copies files from one folder to another (does not move - copies) * @param string $start_path - string to check against the database * @param string $final_path - string to check against the database * @version 1.0 * @author Patrick Lockley */ function copy_loop($start_path, $final_path) { global $xerte_toolkits_site; if (!file_exists($final_path)) { mkdir($final_path, 0777, true); } $d = opendir($start_path); while ($f = readdir($d)) { if (is_dir($start_path . $f)) { if ($f != "." && $f != "..") { copy_loop($start_path . $f . "/", $final_path . $f . "/"); } } else { $ok = copy($start_path . $f, $final_path . $f); /* $data = file_get_contents($start_path . $f); $fh = fopen($final_path . $f, "w"); fwrite($fh,$data); fclose($fh); */ } } closedir($d); }
/** * * Function copy loop * This function checks http security settings * @param string $zip_path = path to the zipped files * @param string $final_path = path to where the files are going * @version 1.0 * @author Patrick Lockley */ function copy_loop($zip_path, $final_path) { global $xerte_toolkits_site; $d = opendir($zip_path); while ($f = readdir($d)) { if (is_dir($zip_path . $f)) { if ($f != "." && $f != "..") { mkdir($final_path . $f . "/"); chmod($final_path . $f . "/", 0777); copy_loop($zip_path . $f . "/", $final_path . $f . "/"); } } else { rename($zip_path . $f, $final_path . $f); } } closedir($d); }