Example #1
0
function ftpMkDir($ftpConn, $perms, $dir)
{
    // Create the new dir
    if (!ftp_mkdir($ftpConn, $dir)) {
        return false;
    } else {
        // Also then set perms (we must be able to do that if we created dir, so can always return true)
        ftpPerms($ftpConn, $perms, $dir);
        return true;
    }
}
    } else {
        $finalAction = "nothing";
        $doNext .= 'top.ICEcoder.message(\'' . $t['Sorry, could not...'] . ' ' . $file . '\');';
    }
    $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);';
}
// =======================
// CHANGING FILE/DIR PERMS
// =======================
if (!$error && $_GET['action'] == "perms") {
    if (!$demoMode && ($ftpSite || is_writable($file))) {
        $updateFM = false;
        // FTP
        if (isset($ftpSite)) {
            $ftpFilepath = ltrim($fileLoc . "/" . $fileName, "/");
            if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) {
                $doNext .= 'top.ICEcoder.message("Sorry, could not set perms on ' . $ftpFilepath . ' at ' . $ftpHost . '");';
            } else {
                $updateFM = true;
            }
            // Local
        } else {
            chmod($file, octdec(numClean($_GET['perms'])));
            // Reload file manager
            $updateFM = true;
        }
        // Update file manager on success
        if ($updateFM) {
            $doNext .= 'top.ICEcoder.updateFileManagerList(\'chmod\',\'' . $fileLoc . '\',\'' . $fileName . '\',\'' . numClean($_GET['perms']) . '\');';
        }
        $finalAction = "perms";