function fm_chmod($file, $perms)
{
    global $ftp, $ftp_prepath;
    if (!fm_ftpconnect()) {
        return false;
    }
    $ofile = $file;
    aphp($file);
    if ($ofile !== $file) {
        fm_copy($ofile, $file);
    }
    return @ftp_chmod($ftp, octdec($perms), $ftp_prepath . $file);
}
Esempio n. 2
0
 if (!$_SESSION) {
     $buffer .= '<tr><td>Paste clipboard here...</td><td><strong style="color:#F00;">Failed; clipboard doesn\'t exist</strong></td></tr>';
     $redir = false;
 } else {
     if ($file) {
         $buffer .= '<tr><td>Paste clipboard here...</td><td><strong style="color:#F00;">Failed; not in a folder</strong></td></tr>';
         $redir = false;
     } else {
         foreach ($_SESSION['clip'] as $i => $tfilen) {
             if ($_SESSION['cliptype'] == 'c') {
                 $tfiletn = filefrompath($tfilen);
                 $buffer .= "<tr><td>Copying '{$tfiletn}'...</td><td>";
                 if ($tfilen == $d . $tfiletn) {
                     $tfiletn = addbeforeext($tfiletn, ' (copy)');
                 }
                 if (fm_copy($tfilen, $d . $tfiletn, $conflict)) {
                     $buffer .= '<strong style="color:#090;">Successful</strong>';
                     $acted[] = file2id($tfiletn);
                     unset($_SESSION['clip'][$i]);
                 } else {
                     if (fm_exists($d . $tfiletn)) {
                         $buffer .= '<strong style="color:#F00;">Failed, file/folder already exists</strong>';
                         $redir = false;
                     } else {
                         $buffer .= '<strong style="color:#F00;">Failed, permission error</strong>';
                         $redir = false;
                     }
                 }
             }
             if ($_SESSION['cliptype'] == 'm') {
                 $buffer .= "<tr><td>Moving '" . filefrompath($tfilen) . "'...</td><td>";
Esempio n. 3
0
$_REQUEST['sort_field'] = 'name';
//$_REQUEST['sort_field'] = 'atime';
//$_REQUEST['sort_field'] = 'mtime';
$_REQUEST['sort_desc'] = 1;
/*
+-  copy file / dir [ recursive ]
+-  rename(move) file / dir
+-  delete file / dir [ recursive ]
+-  chmod file / dir
+-  chown file / dir
+-  create file
+-  create dir
*/
switch ($_REQUEST['action']) {
    case 'copy':
        fm_copy($_REQUEST['source'], $_REQUEST['dest']);
        break;
    case 'rename':
        fm_rename($_REQUEST['source'], $_REQUEST['dest']);
        break;
    case 'delete':
        fm_delete($_REQUEST['source']);
        break;
    case 'chmod':
        fm_chmod($_REQUEST['source'], $_REQUEST['mode']);
        break;
    case 'chown':
        fm_chown($_REQUEST['source'], $_REQUEST['uid'], $_REQUEST['gid']);
        break;
    case 'create_file':
        fm_create_file($_REQUEST['source'], $_REQUEST['mode'] || FALSE);
function fm_chmod($file, $perms)
{
    global $prepath;
    $ofile = $file;
    aphp($file);
    if ($ofile != $file) {
        fm_copy($ofile, $file);
    }
    return @chmod($prepath . $source, octdec($perms));
}