Roxen.git / server / modules / js-support / yui.pike

version» Context lines:

Roxen.git/server/modules/js-support/yui.pike:4:   inherit "roxen-module://filesystem";      #include <module.h>      //<locale-token project="mod_filesystem">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("mod_filesystem",X,Y)   // end of the locale related stuff      #define EXPIRE_TIME 31536000    - constant cvs_version = "$Id: yui.pike,v 1.21 2012/02/08 18:16:18 jonasw Exp $"; + constant cvs_version = "$Id$";      LocaleString module_name = LOCALE(67,"JavaScript Support: The Yahoo! User "    "Interface Library");   LocaleString module_doc =   LOCALE(68,"This sets The Yahoo! User Interface Library (YUI) as a virtual file system "    "of your site.");      string module_dir = combine_path(__FILE__, "../");   string yui_root_dir = combine_path(getenv("VARDIR") || "../var", "yui/");   
Roxen.git/server/modules/js-support/yui.pike:63:   #endif    }   }         void start(int when) {    set("searchpath", yui_root_dir);    set("no-parse", 1);    ::start();    limit_yui_paths = query("limit-yui-paths"); -  if(when == 0) +  if(when == 0) {    setup_yui(); -  +  +  // Windows needs another initialization of filesystem paths since the +  // path normalization doesn't work for non-existing directories. +  ::start();    } -  + }      void set_invisible(string var)   {    if (Variable.Variable v = getvar(var)) {    v->set_invisibility_check_callback(    lambda(RequestID id, Variable.Variable var)    {    return 1;    });    v->set_flags(v->get_flags() & ~VAR_INITIAL);
Roxen.git/server/modules/js-support/yui.pike:96:    return 0;   }      mixed stat_file( string f, RequestID id )   {    if(is_hidden(f))    return 0;    return ::stat_file(f,id);   }    - mixed find_file( string f, RequestID id ) + mixed low_find_file( string f, RequestID id )   {    if(is_hidden(f))    return 0;       // Filter known security holes in SWF files in 2.4.0-2.8.1. These are    // permanently disabled since Roxen itself has no use of it, and    // shipping newer versions will not replace already expanded tar files.    string lc_f;   #ifndef ENABLE_YUI2_SWF    if (has_prefix(f, "2.") &&
Roxen.git/server/modules/js-support/yui.pike:129: Inside #if undefined(ENABLE_YUI2_SWF)
   //    // More info at <http://yuilibrary.com/support/2.8.2/>.    if (has_value(lc_f, "charts.swf") ||    has_value(lc_f, "swfstore.swf") ||    has_value(lc_f, "uploader.swf"))    return 0;    }    }   #endif    -  mixed m = ::find_file(f,id); +  return ::find_file(f,id); + }    -  + mixed handle_combo(RequestID id) + { +  string data = ""; +  string type; +  +  foreach(id->query / "&" - ({ "" }), string f) { +  mixed fid = low_find_file(f, id); +  +  if (!fid) { + #ifdef DEBUG +  report_warning("YUI combo loader failed to find file %O\n", f); + #endif +  continue; +  } +  +  if (fid->file) { +  data += fid->file->read(); +  } +  if (fid->type) { +  type = fid->type; +  } +  } +  +  return ([ +  "data" : data, +  "type" : type, +  ]); + } +  + mixed find_file( string f, RequestID id ) + { +  mixed m; +  if (f == "combo") +  m = handle_combo(id); +  else +  m = low_find_file(f, id); +  +  if (!m) return 0; +     id->set_response_header ("Cache-Control",    sprintf ("public, max-age=%d", EXPIRE_TIME));       RAISE_CACHE(EXPIRE_TIME); -  +  PROTO_CACHE();    return m;   }      void create()   {    ::create();       defvar("mountpoint", "/yui/", LOCALE(15,"Mount point"),    TYPE_LOCATION,    LOCALE(16,"Where the module will be mounted in the site's virtual "
Roxen.git/server/modules/js-support/yui.pike:161:    defvar("limit-yui-paths", 1, LOCALE(69, "Limit YUI paths"), TYPE_FLAG,    LOCALE(70, "If set, access is limited to the assets and build directories."));      }      string query_name()   {    sscanf ((string) module_name, "%*s:%*[ ]%s", string name);    return name;   } -  +