Roxen.git
/
server
/
base_server
/
mainconfig.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/base_server/mainconfig.pike:1:
inherit "config/builders";
-
string cvs_version = "$Id: mainconfig.pike,v 1.
52
1997/08/12
09
:
35
:
06
neotron
Exp $";
+
string cvs_version = "$Id: mainconfig.pike,v 1.
53
1997/08/12
11
:
10
:
33
per
Exp $";
inherit "roxenlib"; inherit "config/draw_things"; import Array; import Stdio; string status_row(object node); string display_tabular_header(object node); /* Work-around for Simulate.perror */ #define perror roxen_perror
Roxen.git/server/base_server/mainconfig.pike:60:
+(changed?"2":"")+" alt=\""+(changed?"*-":"--")+"\">" "</a>\n "+s+"\n"); else return ("<a name=\""+name+"\">\n" "<a href=\"/(fold)" + name + "?"+(bar++)+ "\">\n<img border=0 src=/auto/fold"+(changed?"2":"") +" alt="+(changed?"**":"\"\\/\"")+">" "</a>\n "+s+"\n"); }
-
string
describe(int i)
+
mixed
describe(int i
, object id
)
{ array (string) res=({""}); object node,prevnode; mixed tmp; if(describer)
-
tmp = describer(this_object());
+
tmp = describer(this_object()
, id
);
#ifdef NODE_DEBUG else { perror("No describer in node "+path(1)+"\n"); return 0; } #endif
-
+
if(mappingp(tmp)) {
+
werror("Got mapping.\n");
+
return tmp;
+
}
if(arrayp(tmp) && sizeof(tmp)) PUSH(tmp[0] + "<dt>" + (i?tmp[i]:show_me(tmp[1])) + "\n"); else if(stringp(tmp) && strlen(tmp)) PUSH("<dt>"+(i?tmp:show_me(tmp)) + "\n"); else if(!tmp) return ""; if(!folded) { PUSH("<dl><dd>\n");
Roxen.git/server/base_server/mainconfig.pike:267:
if(prt != def) res += sprintf(" <input type=radio name=\"%s\" value=\"%s\"> %s\n", name, prt, prt); } res += sprintf(" <input type=radio checked value=own name=\"%s\"> " "<input size=70 name=\"%s->own\" " "value=\"%s\">\n</pre><p>", name, name, def); }
-
changed_port_servers = (
[]
);
+
changed_port_servers = (
<>
);
return stores(res+"<input type=submit value=\"Continue...\"></form>"); } mapping save_it(object id, object o) { changed_port_servers = (<>); root->save(); roxen->update_supports_from_roxen_com(); roxen->initiate_configuration_port( 0 ); id->referer = ({ CONFIG_URL + o->path(1) });
Roxen.git/server/base_server/mainconfig.pike:967:
//PUSH("<br>"); return res*""; } mapping (string:string) selected_nodes = ([ "Configurations":"/Configurations", "Globals":"/Globals", "Status":"/Status", "Errors":"/Errors",
+
"Actions":"/Actions",
]); array tabs = ({ "Configurations", "Globals", "Status", "Errors",
-
+
"Actions",
}); array tab_names = ({
-
"
Virtual
servers
",
-
"
Global variables
",
-
"
Status
info
",
-
"
Event log
",
+
"Virtual
Servers
",
+
"Global variables",
+
"Status",
+
"
Events",
+
"
Actions"
,
}); string display_tabular_header(object node) { string p, s; array links = ({ selected_nodes[tabs[0]]+"?"+(bar++), selected_nodes[tabs[1]]+"?"+(bar++), selected_nodes[tabs[2]]+"?"+(bar++), selected_nodes[tabs[3]]+"?"+(bar++),
-
+
selected_nodes[tabs[4]]+"?"+(bar++),
}); if(node != root) { s = extract_almost_top(node) - "/"; selected_nodes[s] = node->path(1); links[search(tabs,s)]="/"+s+"/"+"?"+(bar++); } return tablist(tab_names, links, search(tabs,s));
Roxen.git/server/base_server/mainconfig.pike:1119:
{ i+=nfoldedr(node); node=node->next; } return i; } string dn(object node) { if(!node) return "???";
-
string s = node->_path[-1];
+
string s =
sizeof(
node->_path
)?node->_path
[-1]
:"."
;
if(((string)((int)s))==s) return "Instance "+s;
-
+
switch(s)
+
{
+
case "Globals":
+
return "Global Variables";
+
case "Configurations":
+
return "Servers";
+
case "Errors":
+
return "Events";
+
}
return s; } string describe_node_path(object node) { string q="", res=""; int cnt; foreach(node->path(1)/"/", string p) { q+=p+"/";
-
if(cnt>
=2
)
+
if(cnt>
0
)
{ // werror("q="+q+"\n");
-
res += "<font size=+1><a href="+q+">"+
-
dn(find_node(http_decode_string(q[..strlen(q)-2])))+"</a></font> -> ";
+
res += "<
b><
font size=+1><a href="+q+">"+
+
dn(find_node(http_decode_string(q[..strlen(q)-2])))+"</a></font>
</b>
-> ";
} 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 align=left><a href=$docurl><img border=0 "
+
" cellspacing=0><tr><td
valign=center
align=left><a href=$docurl><img border=0 "
"src=/image/roxen-small.gif></a></td><td align=right valign=top>"+
-
describe_node_path(node)+"</td></tr></table><br>");
+
describe_node_path(node)+"</td><
td> <
/
td></
tr></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);
+
}
+
mapping configuration_parse(object id) { array (string) res=({}); string tmp; // Is it an image? if(sscanf(id->not_query, "/image/%s", tmp)) return file_image(tmp) || (["data":"No such image"]); object o; int i;
Roxen.git/server/base_server/mainconfig.pike:1579:
if(equal(o->original, tmp)) o->change(-1); else if(!o->changed) o->change(1); } break; } return std_redirect(o, id); }
+
check_login(id);
+
PUSH(default_head("Roxen server configuration")); // PUSH("<table><tr><td> <td>" PUSH("<dl>\n"); PUSH("\n"+status_row(o)+"\n"+display_tabular_header( o )+"\n"); PUSH("<p>"); if(o->up != root && o->up) PUSH("<a href=\""+ o->up->path(1)+"?"+(bar++)+"\">" "<img src=/auto/back alt='[Up]' align=left hspace=0 border=0></a>\n"); if(i=o->folded) o->folded=0;
-
string
tmp = o->describe(1);
+
mixed
tmp = o->describe(1
,id
);
+
if(mappingp(tmp)) return tmp;
if(!id->supports->font) tmp = parse_html(tmp, ([]),(["font":remove_font, ])); PUSH(tmp); o->folded=i; PUSH("</dl>"); PUSH("<p><br clear=all> \n"); int lm=1;