Esempio n. 1
0
function get_dir_status($dir)
{
    // Collect files and diretcories in these arrays
    $directories = array();
    $files = array();
    // Open the directory
    $handle = @opendir($dir);
    // Walk through all names in the directory
    while ($file = @readdir($handle)) {
        // If we found a file with one or two point as a name,
        // or a CVS directory, skip the file
        if (preg_match("/^\\.{1,2}/", $file) || $file == 'CVS') {
            continue;
        }
        // Collect files and directories
        if (is_dir($dir . $file)) {
            $directories[] = $file;
        } else {
            $files[] = $file;
        }
    }
    // Close the directory
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Go through files first
    $dir_status = array();
    foreach ($files as $file) {
        // If the file status is OK, append the status info
        if ($file_status = get_file_status($dir . $file)) {
            $dir_status[] = $file_status;
        }
    }
    // Then go through subdirectories, merging all the info
    // coming from subdirs to one array
    foreach ($directories as $file) {
        $dir_status = array_merge($dir_status, get_dir_status($dir . $file . '/'));
    }
    // Return with collected file info in
    // this dir and subdirectories [if any]
    return $dir_status;
}
Esempio n. 2
0
function get_dir_status($dir)
{
    // If this is an old "functions" directory
    // (not under reference) then do not travers
    if (preg_match("!/en/functions|/chmonly!", $dir)) {
        return array();
    }
    // Collect files and diretcories in these arrays
    $directories = array();
    $files = array();
    // Open the directory
    $handle = @opendir($dir);
    // Walk through all names in the directory
    while ($file = @readdir($handle)) {
        // If we found a file with one or two point as a name,
        // or a CVS directory, skip the file
        if (preg_match("/^\\.{1,2}/", $file) || $file == 'CVS') {
            continue;
        }
        // JUST TEMPORARY TILL THE <TRANSLATION>/REFERENCE/FUNCTIONS.XML - ISSUE IS CLARIFIED
        // If we found a file functions.xml in the
        // <lang>/reference/ tree, skip the file
        if ($file == "rsusi.txt" || $file == "missing-ids.xml" || $file == "extensions.xml" && strpos($dir, '/appendices/') || $file == "README" || $file == "contributors.xml" || $file == "contributors.ent" || $file == "reserved.constants.xml" || $file == "DO_NOT_TRANSLATE" || $file == "functions.xml" && strpos($dir, '/reference/')) {
            continue;
        }
        // Collect files and directories
        if (is_dir($dir . $file)) {
            $directories[] = $file;
        } else {
            $files[] = $file;
        }
    }
    // Close the directory
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Go through files first
    $dir_status = array();
    foreach ($files as $file) {
        // If the file status is OK, append the status info
        if ($file_status = get_file_status($dir . $file)) {
            $dir_status[] = $file_status;
        }
    }
    // Then go through subdirectories, merging all the info
    // coming from subdirs to one array
    foreach ($directories as $file) {
        $dir_status = array_merge($dir_status, get_dir_status($dir . $file . '/'));
    }
    // Return with collected file info in
    // this dir and subdirectories [if any]
    return $dir_status;
}
Esempio n. 3
0
function get_dir_status($dir)
{
    global $DOCDIR;
    // Collect files and diretcories in these arrays
    $directories = array();
    $files = array();
    // Open the directory
    $handle = @opendir($dir);
    // Walk through all names in the directory
    while ($file = @readdir($handle)) {
        if (!is_dir($dir . '/' . $file) && !in_array(substr($file, -3), array('xml', 'ent')) && substr($file, -13) != 'PHPEditBackup' || strpos($file, 'entities.') === 0 || $dir == $DOCDIR . 'en/chmonly/' || $dir == $DOCDIR . 'en/internals/' || $dir == $DOCDIR . 'en/internals2/' || $file == 'contributors.ent' || $file == 'contributors.xml' || $dir == $DOCDIR . 'en/appendices/' && ($file == 'reserved.constants.xml' || $file == 'extensions.xml') || $file == 'README' || $file == 'DO_NOT_TRANSLATE' || $file == 'rsusi.txt' || $file == 'missing-ids.xml' || $file == 'license.xml' || $file == 'versions.xml') {
            continue;
        }
        if ($file != '.' && $file != '..' && $file != '.svn' && $dir != '/functions') {
            if (is_dir($dir . '/' . $file)) {
                $directories[] = $file;
            } elseif (is_file($dir . '/' . $file)) {
                $files[] = $file;
            }
        }
    }
    // Close the directory
    @closedir($handle);
    // Sort files and directories
    sort($directories);
    sort($files);
    // Go through files first
    $dir_status = array();
    foreach ($files as $file) {
        // If the file status is OK, append the status info
        if ($file_status = get_file_status($dir . $file)) {
            $dir_status[] = $file_status;
        }
    }
    // Then go through subdirectories, merging all the info
    // coming from subdirs to one array
    foreach ($directories as $file) {
        $dir_status = array_merge($dir_status, get_dir_status($dir . $file . '/'));
    }
    // Return with collected file info in
    // this dir and subdirectories [if any]
    return $dir_status;
}