Roxen.git / server / modules / tags / writefile.pike

version» Context lines:

Roxen.git/server/modules/tags/writefile.pike:3:   // <srb@cuci.nl>   //   // This module is open source software; you can redistribute it and/or   // modify it under the terms of the GNU General Public License as published   // by the Free Software Foundation; either version 2, or (at your option) any   // later version.   //      #define _ok id->misc->defines[" _ok"]    - constant cvs_version = "$Id: writefile.pike,v 1.9 2001/10/30 21:29:17 srb%cuci.nl Exp $"; + constant cvs_version = +  "$Id: writefile.pike,v 1.10 2001/10/30 22:24:53 srb%cuci.nl Exp $";   constant thread_safe = 1; - constant language = roxen->language; +       #include <module.h>   #include <config.h>      inherit "module";         // ---------------- Module registration stuff ----------------      constant module_type = MODULE_TAG;
Roxen.git/server/modules/tags/writefile.pike:37:    set_module_creator("Stephen R. van den Berg <srb@cuci.nl>");    defvar ("onlysubdirs", 1,    "Within tree only", TYPE_FLAG,    "Setting this will force all specified chroots and filenames to be "    "relative to the directory this tag is located in. "    "It functions as an enforced dynamic chroot to constrain users in "    "e.g. a user filesystem."    );   }    + static string lastfile; +  + string status() { +  return sprintf("Last file written: %s",lastfile||"NONE"); + } +    #define IS(arg) ((arg) && sizeof(arg))      // ------------------- Containers ----------------      class TagWritefile {    inherit RXML.Tag;    constant name = "writefile";    constant flags = RXML.FLAG_DONT_RECOVER;    mapping(string:RXML.Type) req_arg_types = ([    "filename" : RXML.t_text(RXML.PEnt)
Roxen.git/server/modules/tags/writefile.pike:104:    } else    towrite=content;    object privs;    ;{ Stat st;    string diro,dirn;    int domkdir=0;    for(dirn=filename;    diro=dirn, diro!=(dirn=dirname(dirn)) && !(st = file_stat(dirn));    domkdir=1);    if(st) { -  privs = Privs("Writefile", st[5], st[6]); +  privs = Privs("Writefile", st->uid, st->gid);    if(domkdir && args->mkdirhier)    Stdio.mkdirhier(dirname(filename));    }    }    _ok = 0;    object file=Stdio.File(); -  if(file->open(filename, args->append?"wrca":"wrct")) { +  if(file->open(lastfile=filename, args->append?"wrca":"wrct")) {    _ok = 1;    file->write(towrite);    object dims;    if (IS(args["min-height"])|| IS(args["max-height"])||    IS(args["min-width"]) || IS(args["max-width"])) {    file->seek(0);    dims = Dims.dims();    array xy = dims->get(file);    if(xy &&    (IS(args["min-height"])&& xy[1] < (int)args["min-height"]||