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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1:   // This is a roxen module. Copyright © 1996 - 2000, Roxen IS.      // This is a virtual "file-system".   // It will be located somewhere in the name-space of the server.   // Also inherited by some of the other filesystems.      inherit "module";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.80 2000/05/01 05:42:09 nilsson Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.81 2000/05/05 23:30:26 nilsson Exp $";   constant thread_safe=1;      #include <module.h>   #include <roxen.h>   #include <stat.h>   #include <request_trace.h>      #if DEBUG_LEVEL > 20   # ifndef FILESYSTEM_DEBUG   # define FILESYSTEM_DEBUG
Roxen.git/server/modules/filesystems/filesystem.pike:88:       defvar("dir", 1, "Enable directory listings per default", TYPE_FLAG|VAR_MORE,    "If set, it will be possible to get a directory listings from "    "directories in this file system. It is possible to force a "    "directory to never be browsable by putting a "    "<tt>.www_not_browsable</tt> or a <tt>.nodiraccess</tt> file "    "in it. Similarly it is possible to let a directory be browsable, "    "even if the file system is not, by putting a "    "<tt>.www_browsable</tt> file in it.\n");    +  defvar("nobrowse", ({ ".www_not_browsable", ".nodiraccess" }), +  "List prevention files", TYPE_STRING_LIST|VAR_MORE, +  "All directories containing any of these files will not be " +  "browsable."); +  +     defvar("tilde", 0, "Show backup files", TYPE_FLAG|VAR_MORE,    "If set, files ending with '~', '#' or '.bak' will "+    "be shown in directory listings");       defvar("put", 0, "Handle the PUT method", TYPE_FLAG,    "If set, it will be possible to upload files with the HTTP "    "method PUT, or through FTP.");       defvar("delete", 0, "Handle the DELETE method", TYPE_FLAG,    "If set, it will be possible to delete files with the HTTP "
Roxen.git/server/modules/filesystems/filesystem.pike:214:    return path + f;   }      int dir_filter_function(string f, RequestID id)   {    if(f[0]=='.' && !QUERY(.files)) return 0;    if(!QUERY(tilde) && Roxen.backup_extension(f)) return 0;    return 1;   }    + array(string) list_lock_files() { +  return QUERY(nobrowse); + } +    array find_dir( string f, RequestID id )   { -  mixed ret; +     array dir;       FILESYSTEM_WERR("find_dir for \""+f+"\"");       object privs;       if (((int)id->misc->uid) && ((int)id->misc->gid) &&    (QUERY(access_as_user))) {    // NB: Root-access is prevented.    privs=Privs("Getting dir", (int)id->misc->uid, (int)id->misc->gid );    }       if(!(dir = get_dir( decode_path(path + f) ))) {    privs = 0;    return 0;    }    privs = 0;       if(!QUERY(dir))    // Access to this dir is allowed. -  if(search(dir, ".www_browsable") == -1) +  if(! has_value(dir, ".www_browsable"))    {    errors++;    return 0;    }       // Access to this dir is not allowed. -  if(sizeof(dir & ({".nodiraccess",".www_not_browsable",".nodir_access"}))) +  if( sizeof(dir & QUERY(nobrowse)) )    {    errors++;    return 0;    }       dirlists++;       // Pass _all_ files, hide none.    if(QUERY(tilde) && QUERY(.files) &&    (!sizeof (QUERY (internal_files)) || id->misc->internal_get)) -  /* This is quite a lot faster */ +     return dir;       dir = Array.filter(dir, dir_filter_function, id);       if (!id->misc->internal_get)    foreach (QUERY (internal_files), string globstr)    dir -= glob (globstr, dir);       return dir;   }