function MCD_response($action, $msg1, $success_msg = '') { //******************* global $_, $ipath, $filename, $EX, $message, $WHSPC_SLASH; $files = $_POST['files']; //List of files to delete (path not included) $count = count($files); //Doesn't include any sub-folders & files. $errors = 0; //number of failed moves, copies, or deletes - not counting recursion. $show_message = 1; //1= show error msg only. if ($count == 1) { $show_message = 3; } //show error or success msg. if ($action == 'rDel') { foreach ($files as $file) { if ($file == "") { continue; } //a blank file name would cause $ipath to be deleted. $errors += Delete_response($ipath . $file, $show_message); } } elseif ($_POST['new_location'] != "" && !is_dir($_POST['new_location'])) { $message .= $EX . '<b>' . $msg1 . ' ' . $_['CRM_msg_01'] . '</b><br>'; $message .= '<span class="filename">' . hte($_POST['new_location']) . '</span><br>'; return; } else { //move or rCopy $mcd_ipath = $ipath; //CRM_response() changes $ipath to $new_location foreach ($files as $file) { $_POST['old_full_name'] = $mcd_ipath . $file; $_POST['new_name'] = $file; //$_POST['new_location'] should already be set by the client ( via MCD_Page() ). $errors += CRM_response($action, $msg1, $show_message); } } $successful = $count - $errors; if ($errors) { $message .= $EX . ' <b>' . $errors . ' ' . hsc($_['errors']) . '.</b><br>'; } if ($count > 1) { $message .= '<b>' . $successful . ' ' . hsc($success_msg) . '</b><br>'; } if ($action != 'rDel') { if ($successful > 0) { //"From:" & "To:" lines if any successes. $message .= '<div id="message_left"><b>' . hsc($_['From']) . '<br>' . hsc($_['To']) . '</b></div>'; $message .= '<b>:</b><span class="filename"> ' . hsc($mcd_ipath) . '</span><br>'; $message .= '<b>:</b><span class="filename"> ' . hsc($ipath) . '</span><br>'; } } }
function MCD_response($action, $msg1, $success_msg = '') { //******************** global $_, $ipath, $ipath_OS, $EX, $message, $WHSPC_SLASH; $files = $_POST['files']; //List of files to delete (path not included) $errors = 0; //number of failed moves, copies, or deletes $successful = 0; $new_location = ""; if (isset($_POST['new_location'])) { $new_location = $_POST['new_location']; $new_location_OS = Convert_encoding($_POST['new_location']); } $show_message = 1; //1= show error msg only. if ($new_location != "" && !is_dir($new_location_OS)) { $message .= $EX . '<b>' . hsc($msg1 . ' ' . $_['CRM_msg_01']) . '</b><br>'; $message .= '<span class="filename">' . hsc($_POST['new_location']) . '</span><br>'; return; } elseif ($action == 'rDel') { foreach ($files as $file) { if ($file == "") { continue; } //a blank file name would cause $ipath to be deleted. $error_code = Delete_response($ipath . $file, $show_message); $successful += $error_code; if ($error_code == 0) { $errors++; } } } else { //move or rCopy $mcd_ipath = $ipath; //CRM_response() changes $ipath to $new_location foreach ($files as $file) { $_POST['old_full_name'] = $mcd_ipath . $file; $_POST['new_name'] = $file; //$_POST['new_location'] should already be set by the client ( via MCD_Page() ). $error_code = CRM_response($action, $msg1, $show_message); $successful += $error_code; if ($error_code == 0) { $errors++; } } } if ($errors) { $message .= $EX . ' <b>' . $errors . ' ' . hsc($_['errors']) . '.</b><br>'; } $message .= '<b>' . $successful . ' ' . hsc($success_msg) . '</b><br>'; if ($action != 'rDel') { if ($successful > 0) { //"From:" & "To:" lines if any successes. $message .= '<div id="message_left"><b>' . hsc($_['From']) . '<br>' . hsc($_['To']) . '</b></div>'; $message .= '<b>:</b><span class="filename"> ' . hsc($mcd_ipath) . '</span><br>'; $message .= '<b>:</b><span class="filename"> ' . hsc($ipath) . '</span><br>'; } } }