setvar('is_start', 1); $tmpl->setvar('path', $path); $tmpl->setvar('_MOVE_STRING', $cfg['_MOVE_STRING']); $tmpl->setvar('_MOVE_FILE', $cfg['_MOVE_FILE']); if ((isset($cfg["move_paths"])) && (strlen($cfg["move_paths"]) > 0)) { $tmpl->setvar('move_start', 1); $dirs = explode(":", trim($cfg["move_paths"])); $dir_list = array(); foreach ($dirs as $dir) { $target = trim($dir); if ((strlen($target) > 0) && ((substr($target, 0, 1)) != ";")) array_push($dir_list, array('target' => $target)); } $tmpl->setloop('dir_list', $dir_list); } else { $tmpl->setvar('move_start', 0); } } else { $file = $_POST['file']; $targetDir = ""; if (isset($_POST['dest'])) { $tempDir = trim(rawurldecode($_POST['dest'])); if (strlen($tempDir) > 0) { $targetDir = $tempDir; } else { if (isset($_POST['selector'])) $targetDir = trim(urldecode($_POST['selector'])); } } // only valid dirs + entries with permission if (!((tfb_isValidPath($cfg["path"].$file)) && (tfb_isValidPath($targetDir)) && (isValidEntry(basename($cfg["path"].$file))) && (hasPermission($file, $cfg["user"], 'w')))) { AuditAction($cfg["constants"]["error"], "ILLEGAL MOVE: ".$cfg["user"]." tried to move ".$file." to ".$targetDir); @error("Illegal move. Action has been logged.", "", ""); } // we need absolute paths or stuff will end up in docroot // inform user .. don't move it into a fallback-dir which may be a hassle $dirValid = true; if (strlen($targetDir) <= 0) { $dirValid = false; } else { if ($targetDir{0} != '/') { $tmpl->setvar('not_absolute', 1); $dirValid = false; } else { $tmpl->setvar('not_absolute', 0); } } $tmpl->setvar('is_start', 0); $tmpl->setvar('targetDir', $targetDir); // check dir if (($dirValid) && (checkDirectory($targetDir, 0777))) { $tmpl->setvar('is_valid', 1); $targetDir = checkDirPathString($targetDir); // Add slashes if magic_quotes off: if (get_magic_quotes_gpc() !== 1) $targetDir = addslashes($targetDir); // Use single quote to escape mv args: $cmd = "mv '".$cfg["path"].$file."' '".$targetDir."'"; $cmd .= ' 2>&1'; $handle = popen($cmd, 'r'); // get the output and print it. $gotError = -1; $buff= ""; while (!feof($handle)) { $buff .= @fgets($handle,30); $gotError = $gotError + 1; } $tmpl->setvar('messages', nl2br($buff)); pclose($handle); if ($gotError <= 0) { $tmpl->setvar('got_no_error', 1); $tmpl->setvar('file', $file); } else { $tmpl->setvar('got_no_error', 0); } } else { $tmpl->setvar('is_valid', 1); } } // tmplSetTitleBar($cfg["pagetitle"]." - ".$cfg['_MOVE_FILE_TITLE'], false); tmplSetIidVars(); // parse template $tmpl->pparse(); ?>