Roxen.git / server / modules / filesystems / filesystem.pike

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:39:   #endif /* constant(System.normalize_path) */      constant module_type = MODULE_LOCATION;   LocaleString module_name = LOCALE(51,"File systems: Normal File system");   LocaleString module_doc =   LOCALE(2,"This is the basic file system module that makes it possible "    "to mount a directory structure in the virtual file system of "    "your site.");   constant module_unique = 0;    + // Statistics.   int redirects, accesses, errors, dirlists;   int puts, deletes, mkdirs, moves, chmods;      protected mapping http_low_answer(int errno, string data, string|void desc)   {    mapping res = Roxen.http_low_answer(errno, data);       if (desc) {    res->rettext = desc;    }
Roxen.git/server/modules/filesystems/filesystem.pike:239:       defvar("internal_files", ({}), LOCALE(43,"Internal files"), TYPE_STRING_LIST,    LOCALE(44,"A list of glob patterns that matches files which should be "    "considered internal. Internal files cannot be requested "    "directly from a browser, won't show up in directory listings "    "and can never be uploaded, moved or deleted by a browser."    "They can only be accessed internally, e.g. with the RXML tags"    " <tt>&lt;insert&gt;</tt> and <tt>&lt;use&gt;</tt>."));   }    + // Cached defvar values. + // + // NB: path and normalized_path have been recoded according to + // path_encoding.   string path, mountpoint, charset, path_encoding, normalized_path;   int stat_cache, dotfiles, access_as_user, no_symlinks, tilde;   array(string) internal_files; -  +    UserDB access_as_user_db;   int access_as_user_throw;   void start()   {    tilde = query("tilde");    charset = query("charset");    path_encoding = query("path_encoding");    no_symlinks = query("no_symlinks");    access_as_user = query("access_as_user");    access_as_user_throw = query("access_as_user_throw");
Roxen.git/server/modules/filesystems/filesystem.pike:368:    }      #define SETUID_NT(X) \    if( access_as_user && !id->misc->internal_get ) \    { \    User uid = id->conf->authenticate( id,access_as_user_db ); \    if( uid && uid->uid() ) \    privs=Privs(X, uid->uid(), uid->gid() ); \    }    + // NB: The stat_cache is a lookup from real_path to stat. +    mixed stat_file( string f, RequestID id )   {    Stat fs;       FILESYSTEM_WERR("stat_file for \""+f+"\"" +    (id->misc->internal_get ? " (internal)" : ""));       f = path + encode_path(f);       if (FILTER_INTERNAL_FILE (f, id))
Roxen.git/server/modules/filesystems/filesystem.pike:407:   //! Note that the @expr{"iso-8859-1"@} encoding will perform   //! conversion to utf-8 for wide strings OSes other than NT.   string encode_path( string p )   {    if( path_encoding != "iso-8859-1" )    p = Locale.Charset.encoder( path_encoding )->feed( p )->drain();   #ifndef __NT__    if( String.width( p ) != 8 )    p = string_to_utf8( p );   #else +  // NB: stat() on NT doesn't like trailing slashes (cf [bug 76]).    while( strlen(p) && p[-1] == '/' )    p = p[..strlen(p)-2];   #endif    return p;   }      //! Convert from filesystem encoding.   string decode_path(string p)   {   #ifdef __NT__
Roxen.git/server/modules/filesystems/filesystem.pike:560:    return 0;    }       dirlists++;       // Pass _all_ files, hide none.    if(tilde && dotfiles &&    (!sizeof( internal_files ) || id->misc->internal_get))    return dir;    +  FILESYSTEM_WERR(sprintf("raw dir: %O\n", dir)); +     dir = Array.filter(dir, dir_filter_function, id);    -  +  FILESYSTEM_WERR(sprintf("filtered dir: %O\n", dir)); +     if (path_encoding != "iso-8859-1") {    dir = map(dir, decode_path);    }    -  +  FILESYSTEM_WERR(sprintf("decoded dir: %O\n", dir)); +     if (!id->misc->internal_get)    foreach (internal_files, string globstr)    dir -= glob (globstr, dir);       return dir;   }      void recursive_rm(string real_dir, string virt_dir,    int(0..1) check_status_needed, RequestID id)   {