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.
118
1999/04/22
09
:
20
:
47
per Exp $";
+
string cvs_version = "$Id: mainconfig.pike,v 1.
119
1999/04/22
14
:
17
:
38
per 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);
Roxen.git/server/base_server/mainconfig.pike:174:
{ return !!file_stat(".more_mode"); } object root=Node(); int expert_mode, more_mode=restore_more_mode(); void save_more_mode() { if(more_mode)
-
open
(".more_mode", "wct");
+
Stdio.File
(".more_mode", "wct");
else rm(".more_mode"); } void create() { build_root(root); init_ip_list(); call_out(init_ip_list, 0);
Roxen.git/server/base_server/mainconfig.pike:218:
} mapping file_image(string img) { object o; o=open("roxen-images/"+img, "r"); if (!o) return 0; return ([ "file":o, "type":"image/" + ((img[-1]=='f')?"gif":"jpeg"), ]); }
+
+
mapping charset_encode( mapping what )
+
{
+
if(what->type && (what->type/"/")[0] == "text")
+
{
+
string enc = LOW_LOCALE->reply_encoding || LOW_LOCALE->encoding;
+
if(enc)
+
{
+
what->data = Locale.Charset->encoder(enc)->feed(what->data)->drain();
+
if(!what->extra_heads)
+
what->extra_heads = ([]);
+
what->extra_heads["Content-type"] = what->type+"; charset="+enc;
+
}
+
}
+
return what;
+
}
+
+
string charset_decode_from_url( string what )
+
{
+
string enc = LOW_LOCALE->reply_encoding || LOW_LOCALE->encoding;
+
if(enc) return Locale.Charset->decoder(enc)->feed(what)->drain();
+
return what;
+
}
+
+
+
string charset_decode( string what )
+
{
+
string enc = LOW_LOCALE->encoding;
+
if(enc) return Locale.Charset->decoder(enc)->feed(what)->drain();
+
return what;
+
}
+
+
string encode_filename( string what )
+
{
+
return Locale.Charset->encoder("utf-8")->feed(what)->drain();
+
}
+
mapping stores( string s ) {
-
return
+
return
charset_encode(
([ "data":replace(s, "$docurl", roxen->docurl), "type":"text/html", "extra_heads": ([
-
"
Title":LOCALE->roxen_challenger_maintenance(),
-
// "
Expires":http_date(time(1)+2),
-
//
"Pragma":"no-cache",
+
"Expires":http_date(time(1)+2),
+
"Pragma":"no-cache",
"Last-Modified":http_date(time(1)), ])
-
]);
+
])
)
;
} #define CONFIG_URL roxen->config_url() // Holds the default ports for various protocols. static private constant default_ports = ([ "ftp":21, "http":80, "https":443, ]);
Roxen.git/server/base_server/mainconfig.pike:711:
case NODE_MODULE: node=node->up; case NODE_CONFIGURATION: } if(module) if(module->copies) while(module->copies[i]) i++; orig = node->config()->enable_module(name+"#"+i); if(!orig)
-
return http_string_answer(LOCALE->could_not_enable_module());
+
return
charset_encode(
http_string_answer(LOCALE->could_not_enable_module())
)
;
module = node->config()->modules[name]; node = node->descend(module->name); // Now it is the (probably unbuilt) module main node... node->data = module; node->describer = describe_module; node->type = NODE_MODULE; build_module(node);
Roxen.git/server/base_server/mainconfig.pike:1107:
mapping(string:object) my_colortable = ([]); mapping auto_image(string in, object id) { string key, value; array trans = ({ dR, dG, dB }); mapping r; mixed e; object i;
+
in = charset_decode_from_url( in );
+
+
// werror("Str=%O\n", in);
+
string img_key = "auto/"+replace(in,"/","_")+".gif"-" ";
-
if(e=file_image(img_key))
+
if(e=file_image(
encode_filename(
img_key))
)
return e;
-
if(!sscanf(in, "%s/%s", key, value)) key=in;
+
-
+
key = (in/"/")[0];
+
value = (in/"/")[1..]*"/";
+
// werror("key=%O; value=%O\n", key,value);
+
+
switch(key) { case "module": sscanf(value, "%*d/%s", value);
-
i = draw_module_header(roxen->allmodules[value][0],
+
i = draw_module_header(
charset_decode(
roxen->allmodules[value][0]
)
,
roxen->allmodules[value][2], module_font); break; case "button": int lm,rm;
-
if(
sscanf(
value
,
"lm/
%s
"
, value
)
)
lm=1;
-
if(
sscanf(
value
,
"rm/
%s
"
, value
)
)
rm=1;
+
if(value
[..2]
==
"lm/")
+
{
+
lm=1;
+
value = value[3..];
+
}
+
if(value
[..2]
==
"rm/")
+
{
+
rm=1;
+
value = value[3..];
+
}
i=draw_config_button(value,button_font,lm,rm); break; case "fold": case "fold2": i = draw_fold((int)reverse(key)); break; case "unfold": case "unfold2":
Roxen.git/server/base_server/mainconfig.pike:1163:
if (!i) return 0; object ct; if (!(ct=my_colortable[key])) ct=my_colortable[key]=Image.colortable(i,256,4,4,4); // colortable(4,4,8, // ({0,0,0}),({255,255,0}),16, // ({0,0,0}),({170,170,255}),48, // )
-
object o =
open
("roxen-images/"+img_key,"wct");
+
object o =
Stdio.File
(
encode_filename(
"roxen-images/"+img_key
)
,
"wct");
e=Image.GIF.encode(i,ct); i=0; if(o) { o->write(e); o=0; } #ifdef DEBUG else {perror("Cannot open file for "+in+"\n");} #endif return http_string_answer(e,"image/gif"); }
Roxen.git/server/base_server/mainconfig.pike:1343:
// We also need to determine wether this is the full or the // lobotomized international version. int full_version=0; catch { if (sizeof(indices(master()->resolv("_Crypto")))) { full_version = 1; } };
-
return
http_string_answer(default_head("Roxen Challenger " +
+
mapping
tmp =
http_string_answer(default_head("Roxen Challenger " +
roxen->__roxen_version__ + "." + roxen->__roxen_build__)+ status_row(root)+ display_tabular_header(root)+ Stdio.read_bytes(full_version?"etc/config.html": "etc/config.int.html"), "text/html");
-
+
return charset_encode(tmp);
} if(sizeof(id->prestate)) { switch(indices(id->prestate)[0]) { // It is possible to mark variables as 'VAR_EXPERT', this // will make it impossible to configure them whithout the // 'expert' mode. It can be useful. case "expert": expert_mode = 1; break;
Roxen.git/server/base_server/mainconfig.pike:1438:
// Not useful since load_module() also does it. // _master->set_inhibit_compile_errors(""); if(!o->config()->load_module(modname)) { mapping rep; rep = http_string_answer("The reload of this module failed.\n" "This is (probably) the reason:\n<pre>" + roxen->last_error + "</pre>" ); // _master->set_inhibit_compile_errors(0);
-
return rep;
+
return
charset_encode(
rep
)
;
} program newprg = cache_lookup ("modules", modname); // _master->set_inhibit_compile_errors(0); object mod; if(!o->config()->disable_module(name)) { mapping rep; rep = http_string_answer("Failed to disable this module.\n" "This is (probably) the reason:\n<pre>" + roxen->last_error + "</pre>" );
-
return rep;
+
return
charset_encode(
rep
)
;
} cache_set ("modules", modname, newprg); // Do not compile again in enable_module. if(!(mod=o->config()->enable_module(name))) { mapping rep; rep = http_string_answer("Failed to enable this module.\n" "This is (probably) the reason:\n<pre>" + roxen->last_error + "</pre>" ); // Recover.. master()->programs = oldprgs; cache_set ("modules", modname, oldprg); #ifdef MODULE_DEBUG perror ("Modules: Trying to re-enable the old module.\n"); #endif o->config()->enable_module(name);
-
return rep;
+
return
charset_encode(
rep
)
;
} o->clear(); // roxen->fork_it(); if(mappingp(o->data)) { o->data = o->config()->modules[modname]; build_module(o); } else {