2000-07-02
2000-07-02 16:58:56 by Martin Nilsson <mani@lysator.liu.se>
-
5b0413eec8f81c524e5dce6a63c4bba560e1784e
(19 lines)
(+18/-1)
[
Show
| Annotate
]
Branch: 5.2
Added &client.host; and initial timezone support in <date/>
Rev: server/modules/tags/rxmltags.pike:1.135
7:
#define _rettext id->misc->defines[" _rettext"]
#define _ok id->misc->defines[" _ok"]
- constant cvs_version="$Id: rxmltags.pike,v 1.134 2000/06/29 21:05:15 mast Exp $";
+ constant cvs_version="$Id: rxmltags.pike,v 1.135 2000/07/02 16:58:56 nilsson Exp $";
constant thread_safe=1;
constant language = roxen->language;
199:
}
}
+ class EntityClientHost {
+ inherit RXML.Value;
+ string rxml_const_eval(RXML.Context c) {
+ c->id->misc->cacheable=0;
+ if(c->id->host) return c->id->host;
+ return c->id->host=roxen->quick_ip_to_host(c->id->remoteaddr);
+ }
+ }
+
mapping client_scope=([
"ip":EntityClientIP(),
"name":EntityClientName(),
207:
"accept-languages":EntityClientAcceptLanguages(),
"language":EntityClientLanguage(),
"languages":EntityClientLanguages(),
+ "host":EntityClientHost(),
]);
void set_entities(RXML.Context c) {
699:
array do_return(RequestID id) {
int t=(int)args["unix-time"] || time(1);
+ if(args->timezone=="GMT") t += localtime(t)->timezone;
t+=Roxen.time_dequantifier(args);
if(!(args->brief || args->time || args->date))
1649: Inside #if defined(manual)
#ifdef manual
constant tagdoc=([
"&client.ip;":"<desc ent>The client is located on this IP-address.</desc>",
+ "&client.host;":"<desc ent>The host name of the client, if possible to resolve.</desc>",
"&client.name;":"<desc ent>The name of the client, i.e. \"Mozilla/4.7\". </desc>",
"&client.full-name;":#"<desc ent>The full user agent string, i.e. name of the client
and additional info like; operating system, type of computer, etc.
1919: Inside #if defined(manual)
<ex ><date unix-time='120'/></ex>
</attr>
+ <attr name=timezone value=local|GMT default=local>
+ Display the time from another timezone.
+ </attr>
+
<attr name=years value=number>
Add this number of years to the result.
<ex ><date date='' years='2' type='discordian'/></ex>