예제 #1
0
function fm_chmod($filename, $recursive = 0, $mode)
{
    if (is_dir($filename) && $recursive) {
        $dir_handle = opendir($dir);
        while ($item = readdir($dir_handle)) {
            if (!in_array($item, array('.', '..'))) {
                $new_item = $filename . '/' . $item;
                chmod($new_item, octdec($mode));
                if (is_dir($new_item)) {
                    fm_chmod($new_item, $recursive, $mode);
                }
            }
        }
    } else {
        chmod($filename, octdec($mode));
    }
}
예제 #2
0
             $redir = false;
         }
     }
     $buffer .= "</td></tr>";
     break;
 case 'chmod':
     //--------------------
     // CHMOD
     //--------------------
     $tfile = $val;
     $_POST['perms'] = trim($_POST['perms']);
     $buffer .= "<tr><td>CHMODing '" . basename($d . $tfile) . "' to '" . $_POST['perms'] . "'...</td><td>";
     if (!fm_canaccess($d . $tfile)) {
         $buffer .= '<strong style="color:#F00;">Access denied</strong>';
     } else {
         if (ctype_digit($_POST['perms']) && strlen($_POST['perms']) == 3 && fm_chmod($d . $tfile, $_POST['perms'])) {
             $buffer .= '<strong style="color:#090;">Successful</strong>';
             $acted[] = file2id($tfile);
         } else {
             $buffer .= '<strong style="color:#F00;">Failed' . (fm_exists($d . $tfile) ? ', ' . $_POST['perms'] . ' may not be a valid CHMOD value' : ', file doesn\'t exist') . '</strong>';
             $redir = false;
         }
     }
     $buffer .= "</td></tr>";
     break;
 case 'urlupload':
     //--------------------
     // Upload from URL
     //--------------------
     $tfile = $val;
     $buffer .= "<tr><td>Uploading file '" . basename($tfile) . "'...</td><td>";