Roxen.git / server / config_interface / logutil.pike

version» Context lines:

Roxen.git/server/config_interface/logutil.pike:1:   #include <config.h> - #include <roxen.h> +     - //<locale-token project="roxen_config">LOCALE</locale-token> - #define LOCALE(X,Y) _STR_LOCALE("roxen_config",X,Y) - #define CALL(X,Y) _LOCALE_FUN("roxen_config",X,Y) -  +    int __lt;   string describe_time(int t)   {    int full;    if(localtime(__lt)->yday != localtime(t)->yday)    {    __lt = t;    full=1;    }       if(full)    return capitalize(roxen->language(roxen.locale->get(),"date")(t));    else    return sprintf("%02d:%02d",localtime(t)->hour,localtime(t)->min);   }    - string _units(string unit, int num) + string units(string unit, int num)   {    if(num==1) return "one "+unit;    return num+" "+unit+"s";   }      string describe_interval(int i)   {    switch(i) {    case 0..50: -  return CALL("units", _units)("second", i); +  return units("second", i);    case 51..3560: -  return CALL("units", _units)("minute", ((i+20)/60)); +  return units("minute", ((i+20)/60));    default: -  return CALL("units", _units)("hour", ((i+300)/3600)); +  return units("hour", ((i+300)/3600));    }   }      string describe_times(array (int) times)   {    __lt=0;    if(sizeof(times) < 6) -  return String.implode_nicely(map(times, describe_time), -  LOCALE("cw", "and")); +  return String.implode_nicely(map(times, describe_time));       int d, every=1;    int ot = times[0];    foreach(times[1..], int t)    if(d)    {    if(abs(t-ot-d)>(d/4))    {    every=0;    break;    }    ot=t;    } else    d = t-ot;    if(every && (times[-1]+d) >= time(1)-10) -  return (LOCALE(207, "every") +" " -  +describe_interval(d)+" "+LOCALE(208, "since")+" "+ +  return ("every " +  +describe_interval(d)+" since "+    describe_time(times[0]));    return String.implode_nicely(map(times[..4], describe_time)+({"..."})+ -  map(times[sizeof(times)-3..], describe_time), -  LOCALE("cw", "and")); +  map(times[sizeof(times)-3..], describe_time));   }      string fix_err(string s)   {    sscanf(reverse(s), "%*[ \t\n]%s", s);    s=reverse(s);    if(s=="")    return s;    if(!(<'.','!','?'>)[s[-1]]) s+=".";    return Roxen.html_encode_string(capitalize(s));   }      int last_time;   string describe_error(string err, array (int) times,    string lang, int|void no_links)   {    int code, nt;    string links = "", reference, server; -  array(string) codetext=({ LOCALE(209, "Notice"), -  LOCALE(210, "Warning"), -  LOCALE(211, "Error") }); +  array(string) codetext = ({ "Notice", +  "Warning", +  "Error" });       if(sizeof(times)==1 && times[0]/60==last_time) nt=1;    last_time=times[0]/60;    sscanf(err, "%d,%[^,],%s", code, reference, err);    switch(no_links)    {    Configuration conf;    RoxenModule module;    case 2:    sscanf(reference, "%[^/]", server);