f41b982009-05-07Martin Stjernholm // This is a roxen module. Copyright © 1998 - 2009, Roxen IS.
c24ebf1998-07-15David Hedbor // // This module is basically the CGI module with some different // defaults and a new variable, to make it possible to use Frontpage // with Roxen when using virtual hosting.
0917d32013-03-04Anders Johansson constant cvs_version = "$Id$";
c24ebf1998-07-15David Hedbor  #include <module.h>
980e332000-09-27Martin Nilsson inherit "modules/scripting/cgi.pike";
c24ebf1998-07-15David Hedbor 
980e332000-09-27Martin Nilsson void create(Configuration c)
c24ebf1998-07-15David Hedbor {
f110f51998-11-30Henrik Grubbström (Grubba)  ::create(c);
980b261998-07-15Henrik Grubbström (Grubba) 
a182bc1998-07-18David Hedbor  defvar("FrontPagePort", 0, "Frontpage: Server Port", TYPE_INT,
c24ebf1998-07-15David Hedbor  "If this variable is set (ie not zero) ");
980e332000-09-27Martin Nilsson  killvar("location"); defvar("location", "/", "Frontpage: Root Mountpoint", TYPE_LOCATION,
c24ebf1998-07-15David Hedbor  "This is where the module will be inserted in the "
a182bc1998-07-18David Hedbor  "namespace of your server. In most cases this should be the root " "file system. This module will only answer to requests if the " "url has vti_bin in it. Some examples:<pre>\n" " /cgi-bin/ Ignored.\n" " /_vti_bin/ Handled.\n" " /index.html Ignored.\n" " /mysubweb/_vti_bin/ Handled.\n</pre>" "As you can see the only time you would want to change this is " "if you don't want the root _vti_bin to be handled.");
980e332000-09-27Martin Nilsson 
c24ebf1998-07-15David Hedbor  killvar("searchpath");
a182bc1998-07-18David Hedbor  defvar("searchpath", "<DOCUMENT ROOT>", "Frontpage: Document Root",
980e332000-09-27Martin Nilsson  TYPE_DIR|VAR_INITIAL,
c24ebf1998-07-15David Hedbor  "This is where the module will find the files in the <b>real</b> "
a182bc1998-07-18David Hedbor  "file system. In a normal setup, this would mean the same directory " "as the root filesystem is mounted from.");
c24ebf1998-07-15David Hedbor  killvar("ex"); killvar("ext");
980e332000-09-27Martin Nilsson  killvar("cgi_tag"); }
c24ebf1998-07-15David Hedbor 
980e332000-09-27Martin Nilsson void start() {
ed540b2001-01-13Martin Nilsson  if (query("FrontPagePort")) global_env->SERVER_PORT = (string)query("FrontPagePort");
c24ebf1998-07-15David Hedbor }
1973552000-02-10Martin Nilsson constant module_type = MODULE_LOCATION; constant module_name = "Frontpage Script support";
40a3532001-04-17Per Hedbor constant module_doc = "This module is an extension to the normal CGI module. " "This module's default mountpoint is <tt>/</tt>. "
1973552000-02-10Martin Nilsson  "The " "reason for this is that we need to be able to handle Frontpage sub-webs. " "<p>Another feature is that you easily can modify the value of the " "environment variable SERVER_PORT. The reason for doing that is that " "Frontpage uses it to figure out which configuration file to use. " "Without it you wouldn't be able to use Frontpage and Roxen when doing " "virtual hosting (where many servers will have the same port number).</p>";
c24ebf1998-07-15David Hedbor 
980e332000-09-27Martin Nilsson int|object(Stdio.File)|mapping find_file(string f, RequestID id)
a182bc1998-07-18David Hedbor { #ifdef FPSCRIPT_DEBUG werror("FPScript: find_file(%O)\n", f); #endif
40a3532001-04-17Per Hedbor  if(search(f, "_vti_bin/") == -1)
a182bc1998-07-18David Hedbor  return 0; return ::find_file(f, id); }
980e332000-09-27Martin Nilsson array(string) find_dir(string f, RequestID id)
a182bc1998-07-18David Hedbor { #ifdef FPSCRIPT_DEBUG werror("FPScript: find_dir(%O)\n", f); #endif
40a3532001-04-17Per Hedbor  if(search(f, "_vti_bin/") == -1)
a182bc1998-07-18David Hedbor  return 0; return ::find_dir(f, id); }