Roxen.git / server / base_server / mainconfig.pike

version» Context lines:

Roxen.git/server/base_server/mainconfig.pike:1:   inherit "config/builders"; - string cvs_version = "$Id: mainconfig.pike,v 1.68 1997/08/13 22:10:09 grubba Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.69 1997/08/13 22:29:29 grubba Exp $";   inherit "roxenlib";   inherit "config/draw_things";      import Array;   import Stdio;   string status_row(object node);   string display_tabular_header(object node);   object get_template(string t);      /* Work-around for Simulate.perror */
Roxen.git/server/base_server/mainconfig.pike:515:    loc = replace(replace(replace(loc, "://", ""), "//", "/"), "", "://");       return http_redirect(http_decode_string(loc));   }      string configuration_list()   {    string res="";    object o;    foreach(roxen->configurations, o) -  res += "<option>Copy of '"+o->name+"'"; +  res += "<option>Copy of '"+o->name+"'\n";    return res;   }      string configuration_types()   {    string res="";    foreach(get_dir("server_templates"), string c)    {    array err;    if (err = catch {
Roxen.git/server/base_server/mainconfig.pike:549:   }      string describe_config_modules(array mods)   {    string res = "This configuration template adds the following modules:<p><ul>";    if(!mods||!sizeof(mods)) return "This configuration template adds no modules";       foreach(mods, string mod)    {    sscanf(mod, "%s#", mod); -  if(!roxen->allmodules[mod]) res += "<li>The unknown modules '"+mod+"'"; +  if(!roxen->allmodules[mod]) res += "<li>The unknown modules '"+mod+"'\n";    else res += "<li>"+roxen->allmodules[mod][0]+"\n";    }    return res+"</ul>";   }      string configuration_docs()   {    string res="";    foreach(get_dir("server_templates"), string c)    {    catch {    if(c[-1]=='e' || c[0]!='#') -  res += ("<dt><b>"+get_template(c)->name+"</b>"+ -  "<dd>"+get_template(c)->desc+"<br>"+ -  describe_config_modules(get_template(c)->modules)); +  res += ("<dt><b>"+get_template(c)->name+"</b>\n"+ +  "<dd>"+get_template(c)->desc+"<br>\n"+ +  describe_config_modules(get_template(c)->modules) + "\n");    };    }    return res;   }      string new_configuration_form()   {    return (default_head("") + status_row(root) +    "<h2>Add a new virtual server</h2>\n"    "<table bgcolor=#000000><tr><td >\n"    "<table cellpadding=3 cellspacing=1 bgcolor=lightblue><tr><td>\n"    "<form>\n"    "<tr><td>Server name:</td><td><input name=name size=40,1>"    "</td></tr>\n"    "<tr><td>Configuration type:</td><td><select name=type>"+    configuration_types()+configuration_list()+"</select></tr>"    "</td>\n"    "<tr><td colspan=2><table><tr><td align=left>"    "<input type=submit name=ok value=\" Ok \"></td>"    "<td align=right>" -  "<input type=submit name=no value=\" Cancel \"></td></tr>" -  "</table></td></tr></table></td></tr></table>" + +  "<input type=submit name=no value=\" Cancel \"></td></tr>\n" +  "</table></td></tr></table></td></tr>\n</table>\n" +    "<p>The only thing the type change is the initial " -  "configuration of the server. <p>The types are:<dl>"+ -  configuration_docs() + +  "configuration of the server.\n" +  "<p>The types are:<dl>\n" + configuration_docs() +    "<dt><b>Copy of ...</b>:\n"    "<dd>Make an exact copy of the mentioned virtual server.\n" -  "You should change at least the listen ports. <p>" +  "You should change at least the listen ports.<p>\n"    "This can be very useful, since you can make 'template' virtual "    "servers (servers without any open ports), that you can copy later " -  "on.\n</dl>\n</body>"); +  "on.\n</dl>\n</body>\n");   }         mapping module_nomore(string name, int type, object conf)   {    mapping module;    object o;   // perror("Module: "+name+"\n");    if((module = conf->modules[name])    && (!module->copies && module->enabled))
Roxen.git/server/base_server/mainconfig.pike:1154:   string describe_node_path(object node)   {    string q="", res="";    int cnt;    foreach(node->path(1)/"/", string p)    {    q+=p+"/";    if(cnt>0)    {   // werror("q="+q+"\n"); -  res += ("<b><font size=+1><a href=\""+q+"?"+bar+++"\">"+ +  res += ("\n<b><font size=+1><a href=\""+q+"?"+bar+++"\">"+    dn(find_node(http_decode_string(q[..strlen(q)-2])))+ -  "</a></font></b> -&gt; "); +  "</a></font></b> -&gt;\n");    }    else    cnt++;    }    return res[0..strlen(res)-8];   }      string status_row(object node)   {    return ("<table width=\"100%\" bgcolor=\"#dddddd\" border=0 cellpadding=0" -  " cellspacing=0><tr><td valign=middle align=left><a " -  "href=\"$docurl\"><img border=0 src=\"/image/roxen-small.gif\" " -  "alt=\"Roxen\"></a></td><td align=right valign=top>"+ -  describe_node_path(node)+"</td><td>&nbsp;</td></tr></table><br>"); +  " cellspacing=0>\n" +  "<tr><td valign=middle align=left><a href=\"$docurl\">" +  "<img border=0 src=\"/image/roxen-small.gif\" alt=\"Roxen\"></a>" +  "</td>\n<td align=right valign=top>" + describe_node_path(node) + +  "</td>\n<td>&nbsp;</td></tr>\n</table><br>");   }      mapping logged = ([ ]);      void check_login(object id)   {    if(logged[id->remoteaddr]+1000<time())    report_notice("Administrator logged on from "+    roxen->blocking_ip_to_host(id->remoteaddr)+".");    logged[id->remoteaddr]=time(1);