From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- htc/dml.htc | 382 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ htc/dmled.htc | 128 +++++++++++++++++++ htc/help.htc | 31 +++++ htc/htcd.htc | 4 + htc/html.htc | 152 +++++++++++++++++++++++ htc/http.htc | 61 +++++++++ htc/latex.htc | 262 +++++++++++++++++++++++++++++++++++++++ htc/layout.htc | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++++ htc/mailer.htc | 53 ++++++++ htc/posit.htc | 23 ++++ htc/prefs.hdb | Bin 0 -> 24576 bytes htc/server.htc | 321 ++++++++++++++++++++++++++++++++++++++++++++++++ htc/system.htc | 35 ++++++ htc/tree.htc | 21 ++++ htc/upload.htc | 26 ++++ htc/users.hdb | Bin 0 -> 98304 bytes 16 files changed, 1847 insertions(+) create mode 100644 htc/dml.htc create mode 100644 htc/dmled.htc create mode 100644 htc/help.htc create mode 100644 htc/htcd.htc create mode 100644 htc/html.htc create mode 100644 htc/http.htc create mode 100644 htc/latex.htc create mode 100644 htc/layout.htc create mode 100644 htc/mailer.htc create mode 100644 htc/posit.htc create mode 100644 htc/prefs.hdb create mode 100644 htc/server.htc create mode 100644 htc/system.htc create mode 100644 htc/tree.htc create mode 100644 htc/upload.htc create mode 100644 htc/users.hdb (limited to 'htc') diff --git a/htc/dml.htc b/htc/dml.htc new file mode 100644 index 0000000..9781952 --- /dev/null +++ b/htc/dml.htc @@ -0,0 +1,382 @@ +\include{system.htc} +\include{html.htc} +\const{dml.address}{nobody} +\def{dml.init}{xxxx}{ + %{listname}{group}{path}{http} + \global{dml.listname}{\1} + \global{dml.group}{\2} + \global{dml.path}{\3} + \global{dml.http}{\4} + \if(count \dml.group){\open{DML}{\dml.path/data/dml.hdb}{1}} +} +\def{dml.mailuser}{xx}{ + \if{\user.id}{ + \log{mail user: \1} + \mail{\dml.address}{}{\user.email}{DML Server}{\now}{\1}{text/plain}{\2} + } +} +\def{dml.dfs}{xr}{ + \find.rec{\1}{ + \2; + \query(PARENT==\1){ + \dml.dfs(INDEX){\2} + } + } +} +\def{dml.bfs}{xr}{ + [cur:="";bfs:=\1]; + \while(count bfs){ + [cur=first bfs]; + \find.rec(cur){\2}; + \query(PARENT==cur)(bfs=bfs+++INDEX); + [bfs=rest bfs]; + } +} +\def{dml.ups}{xr}{ + [cur:=\1]; + \while(cur){ + \find.rec(cur){\2;[cur=PARENT]}(cur=0) + } +} +\def{dml.watchers}{}{ + \if(count \dml.group){ + [ + m.<-@; + break:=\dml.ups(m.INDEX){[BREAK] }; + attime:=\if(m.PROTECT)(m.TIME){\now}; + people:=\db{USERS}{\query(\allowed{\dml.group}(attime)){[UID] }} + ]; + [people---break]; + } +} +\def{dml.resubj}{x}{ + [tmp:=first \1];\if(tmp nen "re" && tmp nen "re:"){Re: \1}{\1} +} +\def{dml.opennode}{x}{ + \db{DML}{ + \dml.ups{\1}(BREAK=BREAK---\user.id); + \dml.confirm{Opening \dml.listname\[\1\]}; + } +} +\def{dml.closenode}{x}{ + \db{DML}{ + \find.rec{\1}{ + [BREAK=BREAK|||\user.id]; + \dml.confirm{Closing \dml.listname\[\1\]}; + } + } +} +\def{dml.addnode}{x}{ + %(node) - add to this node + %T.from - mail address + %T.reply - reply address + %T.name - user name + %T.subject - subject + %T.mime - MIME type + %T.body - message + %T.parts - attachments + %T.mime[i] - attachment MIME type + %T.body[i] - attachment body + %RETURN - node number + \db{DML}{ + [ + t.TIME:=\now; + t.PARENT:=\1; + t.AUTHOR:=\user.id; + t.MIME:=\T.mime; + t.SUBJECT:=\T.subject; + t.BODY:=\T.body; + t.INDEX:=\lastkey+1; + t.PROTECT:=1; + @<-t.; + ]; + \log{dml: adding \dml.listname\[[INDEX]\]}; + [t.INDEX]; + \for(i:=0)(i<\T.parts)(i+=1){ + [file:="A"++INDEX++"_"++\filesafe{\T.body[i]}]; + \log{dml: uploading \dml.listname\[[file]\]}; + \save{\dml.path/attach/[file]}{T.body[i]}{385}; + [ATTACH=ATTACH|||file]; + } + } +} +\def{dml.footer}{x}{ + \if(\1 eq "text/html"){
}{----------------------------------------------} + Help: send email to \dml.address with subject 'help \dml.listname' +} +\def{dml.quickguide}{}{ + QUICK GUIDE + + Mailing-lists on this server (\dml.address): + + \getlists;[ex:=\dml.listname] + + Mails received from the server ALWAYS starts with the listname + enclosed in stars (*). For example, + + *[ex]\[7\]* hello world + + means you've received a message from the list '[ex]' with + subject 'hello world'. The message is identified by its + message number, in this case 7. + + EXAMPLES + + To post a new message on '[ex]' with subject 'hello world', + mail to \dml.address with subject + + new [ex] hello world + + To post a new message on a particular message number, e.g. 7, + mail to \dml.address with subject + + new [ex]\[7\] hello world + + Note that message number 1 is the message root, and is the same + as issuing new without the \[\]. + + To reply to a message from the list, use 'reply' in your mailing program, + but DO NOT REMOVE anything before the subject. The server will + insert the appropriate 'Re:'. For instance, replying to the first example + above would normally give a reply-subject in your mailprogram like + + Re: *[ex]\[7\]* hello world + + which will be sent from the server as + + *[ex]\[n\]* Re: hello world + + where n is some new number assigned to your message. +} +\def{dml.message}{}{ + HELP ON USAGE OF THE *\dml.listname* MAILING LIST AT \dml.address. + + The address handles multiple mailinglists, and takes commands on the form: + + \[\] + or + *\[\]* + + where is a command, is a mailinglist, + is a message number, and is the subject + line. The brackets \[\] should however be there as is. + + Mailing-lists on this server (\dml.address): + + \getlists + + You are \user.name, and your user name at \dml.address + is \user.email. You may have clearance to several of + the lists above. + \if(\dml.listname eq "demo"){ + \n; + This is a demo mailing list and will not work to send mails to. + You will need to know the name of a list to which you belong. + } + Commands are not case sensitive. Available commands are: + + HELP \dml.listname + + Displays this message. + + WHO \dml.listname\[\] + + Retrieve which people are registered at the list. + If a node number is given, it tells which people + will receive a new message from that node. + Note that this command may be restricted on some lists. + + SILENT \dml.listname\[\] + + Adds a new message to message number on \dml.listname, + without broadcasting. + + NEW \dml.listname\[\] + + Adds a new message to message number on \dml.listname, + and broadcasts to \dml.listname. + + REPLY \dml.listname\[\] + + Replies to message number on \dml.listname. + Possible acronyms are Re, Re:, Sv, Sv:. + Note that this command is issued when you do + a normal reply, whether it be on a swedish or + american mail program. + + OPEN \dml.listname\[\] + + Opens a . When a is open, you recieve + broadcast messages descending from that . + + CLOSE \dml.listname\[\] + + Closes a . When a is closed, you do not + recieve the broadcast messages descending from that . + The obvious usage of this command is to turn off + uninteresting of lengthy threads. Also, since everything + added to this node will pass unnoticed, it may be used + to structure e.q. news in topics, together with the + SILENT command. + + MAIL \dml.listname\[\] + + Retrieve message number from \dml.listname. + This command may not serve certain messages on the basis of your + clearance and when you first entered the list. + + \if(\dml.listname ne "demo"){ + To get additional help on how to use this system, how to + view or protect message trees, you may visit the + \dml.http/ web page. Of course the commands listed + above can be issued from there as well. You PIN code + at the server is \user.pin. + } +} +\def{dml.layout}{?xx}{ + [mime:=\on.arg{0}{\0}(MIME)]; + \2 + \if(ATTACH ne ""){ + \if(mime eq "text/html"){ +
+ Attachments (PIN: \su{\1}{\user.pin}) + \forall{i}(ATTACH){ + \href{\dml.http/attach/[i]?alias=\su{\1}{\user.alias}}(i)\n; + } + }{ + ---------------------------------------------- + Attachments (PIN: \su{\1}{\user.pin}) + \forall{i}(ATTACH){ + \dml.http/attach/[i]?alias=\su{\1}{\user.alias}\n; + } + } + }; + \dml.footer(mime) +} +\def{dml.error}{x}{ + %T.cmd + %T.list + %T.node + %T.subject + \mail.root{mailer: \1}{ + check <\T.cmd> \T.list\[\T.node\] \T.subject + }; + \dml.mailuser{error}{ + An error occurred while processing your command + + \T.cmd \T.list\[\T.node\] \T.subject + + \1 + ---------------------------------------------- + \dml.quickguide + \dml.footer(MIME) + } +} +\def{dml.help}{}{ + \dml.mailuser{help \dml.listname}{ + \dml.quickguide + + ---------------------------------------------- + \dml.message + } +} +\def{dml.who}{x}{ + %(node) - mail this node to group + \db{DML}{ + \find.rec{\1}{ + \dml.mailuser{who \dml.listname}{ + PEOPLE LISTENING TO \dml.listname;\[\1\] at \dml.address + + \forall{i}{\dml.watchers}{ + \su(i){\user.name <\user.email>}\n + } + } + }{ + \dml.error{Could not find node \dml.listname;\[\1\]} + } + } +} +\def{dml.confirm}{x}{ + %T.cmd + %T.list + %T.node + %T.subject + \dml.mailuser{\dml.listname: confirmation}{ + Your command + + \1 + + was processed sucessfully. + } +} +\def{dml.mail}{x}{ + %(node) - mail this node to user + \db{DML}{ + \find.rec{\1}{ + [attime:=\if(PROTECT)(TIME){\now}]; + \if{\user.allow{\dml.group}(attime)}{ + \log{dml: mailing \dml.listname\[[INDEX]\] to (\user.id)}; + \mail{\su(AUTHOR){\user.email}}{}{\user.email}{\su(AUTHOR){\user.name}} + (TIME){*\dml.listname\[[INDEX]\]* [SUBJECT]}(MIME){\dml.layout{\user.id}(BODY)}; + }{ + \log{dml: denying \dml.listname\[[INDEX]\] to (\user.id)}; + \dml.mailuser{\dml.listname\[[INDEX]\]: not found}{ + The node you requested could not be found + + (or may be protected) + } + } + }{ + \dml.error{Could not find node \dml.listname;\[\1\]} + } + } +} +\def{dml.broadcast}{x}{ + %(node) - mail this node to group + \db{DML}{ + \find.rec{\1}{ + \if(!BROADCAST){ + \log{dml: broadcasting \dml.listname\[[INDEX]\]} + [ + femail:=\su(AUTHOR){\user.email}; + fname:=\su(AUTHOR){\user.name}; + fsubj:="*"++\dml.listname++"["++INDEX++"]* "++SUBJECT; + watchers:=\dml.watchers; + BROADCAST=count watchers; + ]; + \forall{i}(watchers){ + [ + temail:=\su(i){\user.email}; + talias:=\su(i){\user.alias}; + tname:=\su(i){\user.name}; + tpin:=\su(i){\user.pin}; + tbody:=\replace(BODY){\recipient.email}(temail); + tbody=\replace(tbody){\recipient.alias}(talias); + tbody=\replace(tbody){\recipient.name}(tname); + tbody=\replace(tbody){\recipient.pin}(tpin); + tbody=\replace(tbody){\recipient.id}(i); + ]; + \mail(femail){\dml.listname <\dml.address>}(temail)(fname) + (TIME)(fsubj)(MIME){\dml.layout(i)(tbody)}; + \sleep(2); + } + } + } + } +} +\def{dml.addbroad}{x}{ + [node:=\dml.addnode{\1}]; + \if(node){ + \dml.broadcast(node) + }{ + \dml.error{Could not add to \dml.listname;\[\1\]} + } +} +\def{dml.addsilent}{x}{ + [node:=\dml.addnode{\1}]; + \if(node){ + \dml.confirm{Added \dml.listname\[[node]\] to \dml.listname\[\1\]} + }{ + \dml.error{Could not add to \dml.listname;\[\1\]} + } +} diff --git a/htc/dmled.htc b/htc/dmled.htc new file mode 100644 index 0000000..61929fa --- /dev/null +++ b/htc/dmled.htc @@ -0,0 +1,128 @@ +\include{dml.htc} +\def{dmled.init}{xx}{ + %{listname}{address} + \dml.init{\1}{\group}{\npwd}{\server\npwd}; + \reconst{dml.address}{\2}; + \sort{DML}{INDEX}{>} +} +\def{dmled.page}{}{ + \cond{T.find}{} + \cond{T.msg}{0} + \title{Database Mailing List (\dml.listname)} + \db{DML}{ + \form{ + \table{width=100% bgcolor=#dddddd}{ + \tr{valign=top}{ + \td{ + + } + \td{ + \button{View}
+ \button{Reply}
+ \button{New} + } + } + \tr{valign=top}{ + \td{ + \input{find}{60}{\T.find} + } + \td{ + \button{Search} + } + } + } + } + \find.rec{\T.msg}{ + \if(!PROTECT||\user.allow(\dml.group)(TIME)){ + \table{width=100% bgcolor=#dddddd}{ + \tr{ + \th{align=left}{[INDEX] - [SUBJECT]} + \td{align=right}{ + \find.rec(PARENT){ + \if(!PROTECT||\user.allow(\dml.group)(TIME)){ + \bf{Prev:} + \href{\this?msg=[INDEX]}{[INDEX] - \sub(SUBJECT){0}{30}} + \su(AUTHOR){\[\user.name\]} + } + } + } + } + \tr{ + \td{align=left}{ + \su(AUTHOR){ + \user.name \lt;\href{mailto:\user.email}{\user.email};\gt + } + } + \td{align=right}{ + \time2htc(TIME) + } + } + \tr{ + \td{align=left colspan=2}{ + \htmlize(BODY) + } + } + \if(count ATTACH){ + \tr{ + \td{align=left colspan=2}{ + \forall{i}(ATTACH){ + \href{\npwd/attach/[i]}(i)\n + } + } + } + } + \tr{ + \td{align=left colspan=2}{ + [idx:=INDEX]; + \query(PARENT==idx&&(!PROTECT||\user.allow(\dml.group)(TIME))){ + \bf{Next:} + \href{\this?msg=[INDEX]}{[INDEX] - [SUBJECT]} + \su(AUTHOR){\[\user.name\]} +
+ } + } + } + } + } + } + } +} +\def{dmled.onpost}{}{ + \switch{\T.cmd} + {View}{ + \redirect{\server\this?msg=\T.dummy} + } + {Reply}{ + \redirect{\server\this} + \db{DML}{ + \find.rec{\T.dummy}{ + \if(!PROTECT||\user.allow(\dml.group)(TIME)){ + \redirect{ + mailto:\dml.address?subject=Reply \dml.listname\[[INDEX]\] [SUBJECT] + } + } + } + } + } + {New}{ + [node:=\on.glob{T.dummy}{\T.dummy}{1}]; + \redirect{mailto:\dml.address?subject=New \dml.listname\[[node]\] (no subject)} + } + { + \on.glob{T.find}{ + \redirect{\server\this?find=\encode{\T.find}} + } + } +} diff --git a/htc/help.htc b/htc/help.htc new file mode 100644 index 0000000..d35d210 --- /dev/null +++ b/htc/help.htc @@ -0,0 +1,31 @@ +\throw{help: OBSOLETED} +\def{list.unary}{}{ + \ops.htc{ + \order{PRE1}{>} + \query(PRE1){ + \left(OP){10}[DESC] + } + } +} +\def{list.binary}{}{ + \ops.htc{ + \order{PRE2}{>} + \query(PRE2){ + \left(OP){10}[DESC] + } + } +} +\def{list.mod}{x}{ + \tokens{ + \query(MOD==\1){ + [TOK] + } + } +} +\def{list.users}{x}{ + \users{\1}{ + \query{1}{ + \left(ID){4} \left(NAME){38} \left(GID){3} \sub{\time2htc(LAST)}{4}{12} [LASTIN] + } + } +} diff --git a/htc/htcd.htc b/htc/htcd.htc new file mode 100644 index 0000000..038bf89 --- /dev/null +++ b/htc/htcd.htc @@ -0,0 +1,4 @@ +\include{latex.htc} +\include{html.htc} +\include{http.htc} +\include{dmled.htc} diff --git a/htc/html.htc b/htc/html.htc new file mode 100644 index 0000000..bd96870 --- /dev/null +++ b/htc/html.htc @@ -0,0 +1,152 @@ +\const{icons}{/icons} +\const{space}{ } +\const{lt}{<} +\const{gt}{>} +\def{indent}{x}{\for(i:=0)(i<\1)(i+=1){\space}} +\def{option}{?xx}{ + %{value}{desc} + + \2 +} +\def{select}{xx*}{ + %{name}{selected}.. + +} +\def{button}{?x}{ + %[option]{value} + +} +\def{variable}{xx}{ + %{name}{value} + +} +\def{radio}{xx?}{ + %{name}{value}[bool] + +} +\def{target}{x}{} +\def{href}{xx}{ + %{uri}{name} + \2 +} +\def{iref}{xx}{ + %{uri}{image} + +} +\def{form}{?x}{ + %{body} +
+ \1 +
+} +\def{form.multi}{?x}{ + %{body} +
+ \1 +
+} +\def{input}{xx?}{ + %{name}{size}[value] + +} +\def{passwd}{xx?}{ + %{name}{size}[value] + +} +\def{check}{xx?}{ + %{name}{value}[bool] + +} +\def{file}{?xx}{ + %{name}{size}[value] + +} +\def{text}{xxx?}{ + %{name}{row}{col}[value] + +} +\def{image}{?x}{ + %[options]{body} + +} +\def{table}{?x}{ + %[options]{body} + + \1 + +} +\def{th}{?x}{ + %[options]{body} + + \1 + +} +\def{tr}{?x}{ + %[options]{body} + + \1 + +} +\def{td}{?x}{ + %[options]{body} + \on.arg{1}{\1}{\space} +} +\def{font}{?x}{ + %[options]{body} + \1 +} +\def{ul}{?x}{ + %[options]{body} + + \1 + +} +\def{li}{?x}{ + %[options]{body} + \1 +} +\def{h1}{?x}{ + %[options]{body} + \1 +} +\def{h2}{?x}{ + %[options]{body} + \1 +} +\def{h3}{?x}{ + %[options]{body} + \1 +} +\def{h4}{?x}{ + %[options]{body} + \1 +} +\def{h5}{?x}{ + %[options]{body} + \1 +} +\def{h6}{?x}{ + %[options]{body} + \1 +} +\def{center}{?x}{ + %[options]{body} + \1 +} +\def{body}{?x}{ + %[options]{body} + + \1 + +} diff --git a/htc/http.htc b/htc/http.htc new file mode 100644 index 0000000..c9a8557 --- /dev/null +++ b/htc/http.htc @@ -0,0 +1,61 @@ +\include{system.htc} +\include{tree.htc} +\include{layout.htc} +\include{upload.htc} +\include{posit.htc} +\const{server}{http://\HOST\if(\port!=80){:\port}} +\const{server.alias}(\HOST left ".") +\const{server.admin}{\ADMIN} +% +% Some special stuff +% +\def{setcookie}{xx?}{ + \resp.cookie{\1}{\2}{ +% domain=\HOST\; path=/\if(\0){; expires=\time2http{\0}} +% the domain spec above does not work on modern browsers such as firefox +% if host is not a fully qualified dns name + path=/\if(\0){; expires=\time2http{\0}} + } +} +\def{redirect}{x}{ + \if(\req.version gt "HTTP/1.0"){ + \resp.status{\HTTP.303} + }{ + \resp.status{\HTTP.302} + } + \if(\1 cnt ":"){ + \resp.location{\1} + }{ + \resp.location{\server\1} + } +} +\def{onget}{r}{ + \if("GET HEAD" which \req.method){ + \1 + } +} +\def{onpost}{r}{ + \if(\req.method eq "POST"){ + \1 + } +} +% +% Cookie allowance +% +\def{cookie.allow}{x}{ + [ok:=1;name:=first \1;val:=rest \1]; + \if(name ne ""){ + [ok=0]; + \for(i:=0)(i<\ncookie)(i+=1){ + \if(\cookie[i].name eq name && \cookie[i].val eq val)(ok=1); + } + }; + [ok] +} +% +% CRONTAB +% +\cron(211){\sync} +\cron(120){\tree.update} +\cron(300){\tempfile.update} + diff --git a/htc/latex.htc b/htc/latex.htc new file mode 100644 index 0000000..5b962bb --- /dev/null +++ b/htc/latex.htc @@ -0,0 +1,262 @@ +\def{symbol}{x}{\1} + +\const{alpha}{\symbol{a}} +\const{beta}{\symbol{b}} +\const{gamma}{\symbol{g}} +\const{delta}{\symbol{d}} +\const{epsilon}{\symbol{e}} +\const{varepsilon}{\symbol{e}} +\const{zeta}{\symbol{z}} +\const{eta}{\symbol{h}} +\const{theta}{\symbol{q}} +\const{vartheta}{\symbol{J}} +\const{iota}{\symbol{i}} +\const{kappa}{\symbol{k}} +\const{lambda}{\symbol{l}} +\const{mu}{\symbol{m}} +\const{nu}{\symbol{n}} +\const{xi}{\symbol{x}} +\const{omicron}{\symbol{o}} +\const{pi}{\symbol{p}} +\const{varpi}{\symbol{v}} +\const{rho}{\symbol{r}} +\const{varrho}{\symbol{r}} +\const{sigma}{\symbol{s}} +\const{varsigma}{\symbol{V}} +\const{tau}{\symbol{t}} +\const{upsilon}{\symbol{u}} +\const{phi}{\symbol{f}} +\const{varphi}{\symbol{j}} +\const{chi}{\symbol{c}} +\const{psi}{\symbol{y}} +\const{omega}{\symbol{w}} +\const{Gamma}{\symbol{G}} +\const{Delta}{\symbol{D}} +\const{Theta}{\symbol{Q}} +\const{Lambda}{\symbol{L}} +\const{Xi}{\symbol{X}} +\const{Pi}{\symbol{P}} +\const{Sigma}{\symbol{S}} +\const{Upsilon}{\symbol{¡}} +\const{Phi}{\symbol{F}} +\const{Psi}{\symbol{Y}} +\const{Omega}{\symbol{W}} +\const{pm}{\symbol{±}} +\const{times}{\symbol{´}} +\const{div}{\symbol{¸}} +\const{bullet}{\symbol{·}} +\const{cdot}{\symbol{×}} +\const{varplus}{\symbol{+}} +\const{cap}{\symbol{Ç}} +\const{cup}{\symbol{È}} +\const{vee}{\symbol{Ù}} +\const{wedge}{\symbol{Ú}} +\const{varminus}{\symbol{-}} +\const{diamond}{\symbol{à}} +\const{oplus}{\symbol{Å}} +\const{otimes}{\symbol{Ä}} +\const{leq}{\symbol{£}} +\const{subset}{\symbol{Ì}} +\const{subseteq}{\symbol{Í}} +\const{in}{\symbol{Î}} +\const{notin}{\symbol{Ï}} +\const{geq}{\symbol{³}} +\const{supset}{\symbol{É}} +\const{supseteq}{\symbol{Ê}} +\const{equiv}{\symbol{º}} +\const{sim}{\symbol{~}} +\const{approx}{\symbol{»}} +\const{cong}{\symbol{@}} +\const{neq}{\symbol{¹}} +\const{propto}{\symbol{µ}} +\const{less}{\symbol{<}} +\const{perp}{\symbol{^}} +\const{mid}{\symbol{|}} +\const{equal}{\symbol{=}} +\const{greater}{\symbol{>}} +\const{colon}{\symbol{:}} +\const{semi}{\symbol{;}} +\const{ldots}{\symbol{¼}} +\const{leftarrow}{\symbol{¬}} +\const{Leftarrow}{\symbol{Ü}} +\const{rightarrow}{\symbol{®}} +\const{Rightarrow}{\symbol{Þ}} +\const{leftrightarrow}{\symbol{«}} +\const{Leftrightarrow}{\symbol{Û}} +\const{uparrow}{\symbol{¯}} +\const{Uparrow}{\symbol{Ý}} +\const{downarrow}{\symbol{­}} +\const{Downarrow}{\symbol{ß}} +\const{aleph}{\symbol{À}} +\const{wp}{\symbol{Ã}} +\const{Re}{\symbol{Â}} +\const{Im}{\symbol{Á}} +\const{prime}{\symbol{¢}} +\const{doubleprime}{\symbol{²}} +\const{emptyset}{\symbol{Æ}} +\const{nabla}{\symbol{Ñ}} +\const{surd}{\symbol{Ö}} +\const{angle}{\symbol{Ð}} +\const{deg}{\symbol{°}} +\const{neg}{\symbol{Ø}} +\const{partial}{\symbol{¶}} +\const{infty}{\symbol{¥}} +\const{clubsuit}{\symbol{§}} +\const{diamondsuit}{\symbol{¨}} +\const{heartsuit}{\symbol{©}} +\const{spadesuit}{\symbol{ª}} +\const{apple}{\symbol{ð}} +\const{tm}{\symbol{Ô}} +\const{vartm}{\symbol{ä}} +\const{copyright}{\symbol{Ó}} +\const{circledR}{\symbol{Ò}} +\const{prod}{\symbol{Õ}} +\const{int}{\symbol{ò}} +\const{sum}{\symbol{å}} +\const{ast}{*} +\const{backslash}{ + \ +} +\const{setminus}{ + \ +} + +\const{`A}{À} +\const{'A}{Á} +\const{^A}{Â} +\const{~A}{Ã} +\const{"A}{Ä} +\const{AA}{Å} +\const{AE}{Æ} +\const{`E}{È} +\const{'E}{É} +\const{^E}{Ê} +\const{"E}{Ë} +\const{`I}{Ì} +\const{'I}{Í} +\const{^I}{Î} +\const{"I}{Ï} +\const{'N}{Ñ} +\const{`O}{Ò} +\const{'O}{Ó} +\const{^O}{Ô} +\const{~O}{Õ} +\const{"O}{Ö} +\const{OO}{Ø} +\const{`U}{Ù} +\const{'U}{Ú} +\const{^U}{Û} +\const{"U}{Ü} +\const{'Y}{Ý} +\const{`a}{à} +\const{'a}{á} +\const{^a}{â} +\const{~a}{ã} +\const{"a}{ä} +\const{aa}{å} +\const{ae}{æ} +\const{cc}{ç} +\const{`e}{è} +\const{'e}{é} +\const{^e}{ê} +\const{"e}{ë} +\const{`i}{ì} +\const{'i}{í} +\const{^i}{î} +\const{"i}{ï} +\const{~n}{ñ} +\const{`o}{ò} +\const{'o}{ó} +\const{^o}{ô} +\const{~o}{õ} +\const{"o}{ö} +\const{oo}{ø} +\const{`u}{ù} +\const{'u}{ú} +\const{^u}{û} +\const{"u}{ü} +\const{'y}{ý} +\const{"y}{ÿ} +\const{ + \ +}{ +
+} +\const{,}{ } +\const{!}{} +\const{para}{

\n} + +\const{newpage}{\n} +\const{det}{det} +\const{ln}{ln} +\const{lim}{lim} +%\const{tilde}{~} +\const{tilde}{} +\const{protect}{} + +\def{emph}{x}{\1} +\def{title}{x}{

\1

} +\def{chapter}{x}{

\1

} +\def{section}{x}{

\1

} +\def{subsection}{x}{

\1

} +\def{subsubsection}{x}{
\1
} +\def{itemize}{x}{ +
    + \1 +
+} +\def{item}{x}{
  • \1
  • } +\const{draft}{} +\const{maketitle}{} + +\global{LATEX.CITEN}{1} +\def{cite}{x}{ + \global{LATEX.CITECUR}( + \forall{ii}{\1}{ ,}{ + \LATEX.CITEN,\on.glob{LATEX.CITE[ii]}{}{ + \global{LATEX.CITE[ii]}{\LATEX.CITEN}\global{LATEX.CITEN}(\LATEX.CITEN+1) + } + } + rleft "," + ); + $^\LATEX.CITECUR$ +} +\def{onlinecite}{x}{\cite{\1}} +\def{bibitem}{x}{\[\LATEX.CITE[\1]\]} + +\def{author}{x}{} +\def{address}{x}{} +\def{pacs}{x}{} +\def{ref}{x}{} +\def{caption}{x}{} +\def{abstract}{x}{\bf \1} +\def{label}{x}{} +\def{frac}{xx}{$\1/\2$} + +\def{document}{r}{ + \page{ + \1 + } +} +\def{array}{x}{ + \table{ + \forall{ii}{\1}{
    }{ + \tr{ + \forall{jj}(ii){&}{ + \td(jj) + } + } + } + } +} +\def{ltable}{x}{ + \table{ + \forall{ii}{\1}{
    }{ + \tr{ + \forall{jj}(ii){&}{ + \td(jj) + } + } + } + } +} diff --git a/htc/layout.htc b/htc/layout.htc new file mode 100644 index 0000000..b3e7b44 --- /dev/null +++ b/htc/layout.htc @@ -0,0 +1,348 @@ +\const{HEIGHT.head}{40} +\const{HEIGHT.foot}{32} +\const{COLOR.private}{#ffffcc} +\const{COLOR.public}{#ffffff} +\const{COLOR.special}{#cccccc} +\const{COLOR.grayed}{#999999} +\def{page}{r}{ + \if("GET HEAD" which \req.method){ + \output{ + \body{bgcolor=\if(\group ne ""){\COLOR.private}{\COLOR.public}}{ + \1 + } + } + } +} +\def{show.head}{}{ + + \server.alias\uri + +} +\def{show.page}{}{ + \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}}; + \switch(stat.MIME) + {text/x-htc}{ + \if(stat.MOD&1){ + \parse.public(stat.REFER) + }{ + \if(stat.MOD&8){ + \parse.private(stat.REFER) + }{ + \parse(stat.REFER) + } + } + } + {text/x-htx}{ + \show.latex(stat.REFER) + } + {text/html}{ + \resp.cont.type(stat.MIME); + \output{\minilang{\load(stat.REFER)}} + } +} +\def{show.rawpage}{}{ + \resp.cont.type(stat.MIME); + \output{\load(stat.REFER)} +} +\def{show.srcpage}{}{ + \resp.cont.type{text/plain} + \nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}}; + \output{ + \switch(stat.MIME) + {text/x-htc}{ + \%/SRC\uri HTC/1.2 Last modified \time2http(stat.LASTMOD) + } + {text/html}{ + \%/SRC\uri HTML Last modified \time2http(stat.LASTMOD) + } + {text/x-htx}{ + \%/SRC\uri HTX/1.2 (LaTeX) Last modified \time2http(stat.LASTMOD) + } + \load(stat.REFER) + } +} +\def{show.banner}{}{ + \ldef{shist}{x}{ + \find.rec{\1}{ + \if(count BANNER){ + [ban:=rest BANNER]\run.local{ban} + }{ + \if(count PARENT){\shist(PARENT)} + } + } + }; + \db{TREE}{\shist(stat.URI rleftand "/")} +} +\def{calc.height}{}{ + \ldef{chist}{x}{ + \find.rec{\1}{ + \if(count BANNER)(first BANNER){\if(count PARENT){\chist(PARENT)}{\HEIGHT.head}} + }{ + \HEIGHT.head + } + }; + \db{TREE}{\chist(stat.URI rleftand "/")} +} +\def{page.header}{}{ + \ldef{hist}{x}{ + \find.rec{\1}{ + \if(count PARENT){\hist(PARENT)}; + \if(URI eq uri){\run.local{ALIAS}}{\href{\andlang;[URI]}{\run.local{ALIAS}}}> + } + } + \page{ + \show.banner + \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{ + \tr{valign=top align=left}{ + \td{width=60%}{ + \font{size=3}{ + [uri:=stat.URI;dir:=uri rleftand "/";n:=0]; + \db{TREE}{ + \hist(dir); + \query(PARENT eq dir && URI ne "/"){ + \if{\user.allow(X.CLEAR){\now}}{ + \if(n){|}[n+=1]\if(URI eq uri){ + \run.local{ALIAS} + }{ + \href{\andlang;[URI]}{\run.local{ALIAS}} + } + } + } + }\space; + } + }; + \td{width=40% align=right}{ + \font{size=3}{ + \if{\user.id}{\user.name}{\lang{Anonymous}{Anonym}}, \time2htc{\now} + } + } + } + } + } +} +\def{show.icons}{}{} +\def{page.footer}{}{ + \output{ + \body{bgcolor=\COLOR.special}{ + \table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{ + \td{valign=top align=left}{ + \iref{mailto:\server.admin}{\icons/mail.gif} + \if{\user.id}{ + \iref{/LOGOUT\uri\andarg}{\icons/logout.gif} + }{ + \iref{/LOGIN\uri\andarg}{\icons/login.gif} + } + \on.clear{ADM}{ + \iref{\andlang/HTC/admin.htc}{\icons/adm.gif} + } + \iref{ + \lang{/sv}{/en}[stat.URI] + }{ + \icons/lang.gif + } + \if{\user.id}{ + \iref{\andlang/HTC/prefs.htc}{\icons/prefs.gif} + } + \iref{/SRC[stat.URI]}{\icons/source.gif} + [acc:=\upload.clear(stat.URI)]\if((first acc) ne "ROOT"){ + \on.clear(acc){ + \iref{\server/RAW[stat.URI]}{\icons/transfer.gif} + } + } + \show.icons; + } + \td{valign=center align=right}{ + HTCd/1.2 \[\lang{en}{sv}\] \time2htc(stat.LASTMOD) + } + } + } + } +} +\redef{show.register}{}{ + \lang{ + If your are not a registered user, register first. + }{ + Om du inte {\"a}r en registrerad anv{\"a}ndare, + registrera dig f{\"o}rst. + } +} +\def{page.login}{}{ + \cond{T.alias}{} + \page{ + \h1{\server.alias Login} + \if{\user.id}{ + \lang{ + You are logged in as \user.name; (\user.alias). + }{ + Du {\"a}r inloggad som \user.name; (\user.alias). + } +

    + \href{\referer}{\lang{Continue}{Forts{\"a}tt}} + }{ + \lang{ + This server contains information only accessible to registered users. + Each registered user receives a user ID and a PIN code. + }{ + Den h{\"a}r servern inneh{\aa}ller information som bara {\"a}r + tillg{\"a}nglig f{\"o}r registrerade anv{\"a}ndare. + Varje registrerad anv{\"a}ndare erh{\aa}ller ett anv{\"a}ndar-ID + och en PIN-kod. + }; +

    + \show.register; +

    + \lang{ + To login, enter your email address and PIN code below. + \it{DO NOT} enter your unix password! + }{ + F{\"o}r att logga in, fyll i din epostadress och PIN kod nedan. + An{\"a}nd \it{EJ} ditt unix passord! + }; + [remcookie:=0;email:=\T.alias]; + \for(i:=0)(i<\ncookie)(i+=1){ + \if(\cookie[i].name eq "RESEND"){ + [remcookie=1;email=\cookie[i].val]; +

    + \font{color=red}{ + \lang{E-mail has been sent to }{E-post har skickats till }[email] + (\lang{provided user exist}{f{\"o}rutsatt anv{\"a}ndaren existerar}) + } + } + }; +

    + \form{ + \variable{remcookie}(remcookie); + \variable{ref}{\referer}; + \table{ + \tr{ + \td{\lang{E-mail (or alias)}{E-post (eller alias)}:} + \td{\input{email}{28}(email)} + }; + \tr{ + \td{PIN:} + \td{ + \passwd{pin}{6} + } + }; + \tr{ + \td{colspan=2}{ + \check{T.keep}{\endtime} + \lang{ + Keep me logged in by storing to disk + }{ + H{\aa}ll mig inloggad genom att spara till disk + }; + } + }; + \tr{ + \td{colspan=2}{ + \button{Login} + \button{Forgot my PIN code} + \button{Assign a new (4 digit) PIN code} + } + } + } + } + \h3{\lang{Nota bene}{Observera}} +

    + \li{ + \lang{ + You must allow a COOKIE containing your user ID and + PIN code to be set. If you normally do not allow cookies, + you need to make an exception in this case, or by some other + means arrange for the cookie to be set. + If you don't know what a cookie is, you can probably ignore + this paragraph. + }{ + Du m{\aa}ste till{\aa}ta s{\"a}ttning av en COOKIE med + ditt anv{\"a}ndar-ID och PIN-kod. Om du normalt inte till{\aa}ter + "kakor", m{\aa}ste du antingen g{\"o}ra ett undantag i det + h{\"a}r fallet, eller p{\aa} n{\aa}got annat s{\"a}tt + se till att kakan blir satt p{\aa} r{\"a}tt s{\"a}tt. + Vet du inte vad en kaka {\"a}r, kan du troligtvis bortse + fr{\aa}n denna paragraf. + } + }; +

    + \li{ + \lang{ + If logging in from a 'shared' browser, don't forget to logout + properly when you're done. Otherwise, the person after you may + enter the server as you. + }{ + Om du loggar in fr{\aa}n en 'delad' webbl{\"a}sare, gl{\"o}m + inte att logga ut dig ordentligt. Annars kan n{\"a}sta person + komma in p{\aa} servern som dig. + } + } + } + }; + \onpost{ + \cond{T.keep}{0}; + \cond{T.uid}{\getuser{\T.email}}; + \switch(first \T.cmd) + {Login}{ + \log{SetID \[\T.uid.\T.pin\] (\T.keep)}; + \setcookie{ID}{\T.uid.\T.pin}{\T.keep}; + \if{\T.remcookie}{\setcookie{RESEND}{deleted}{1}}; + \redirect{\T.ref}; + } + {Forgot}{ + \su{\T.uid}{ + \mail.user{PIN code}{ + Your PIN code is \user.pin. + + /Admin + } + }; + \if(\T.email ne ""){\setcookie{RESEND}{\T.email}}; + \redirect{\server\this\andarg}; + } + {Assign}{ + \su{\T.uid}{ + \if(\user.pin eq \T.pin){ + \user.pin.set{\random{4}}\user.update; + \mail.user{New PIN code}{ + Your new PIN code is \user.pin. + + /Admin + } + } + }; + \if(\T.email ne ""){\setcookie{RESEND}{\T.email}}; + \redirect{\server\this\andarg}; + }{ + Don't understand "\T.cmd" + } + } +} +\def{page.logout}{}{ + \setcookie{ID}{deleted}{1}; + \resp.cont.type.charset{}; + \redirect{\server/} +} +\def{layout}{}{ + \if{\FRAMES}{ + [cacheok=1;stat.X.CACHE=\days{14}]; + \output{ + \show.head; + + + + + + } + }{ + \resp.cont.type.charset{}; + \output{\show.head}; + \page.header; + \output{

    }; + \show.page; + \output{

    }; + \page.footer + } +} +\def{show.latex}{x}{ + \parse.public{\1} +} + diff --git a/htc/mailer.htc b/htc/mailer.htc new file mode 100644 index 0000000..65f0d98 --- /dev/null +++ b/htc/mailer.htc @@ -0,0 +1,53 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% maild Mailinglist +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\setuser{\getuser{\T.from}} +\nif(count \T.node){\reconst{T.node}{1}} +\dml.init{demo}{}{}{} +\if{\user.id}{ + \setlist{\T.list}; + \if(count \dml.group){ + \on.clear{\dml.group}{ + \switch{\T.cmd} + {help}{ + \dml.help + } + {who}{ + \dml.who{\T.node} + } + {silent}{ + \dml.addsilent{\T.node} + } + {new}{ + \dml.addbroad{\T.node} + } + {reply}{ + \reconst{T.subject}{\dml.resubj{\T.subject}} + \dml.addbroad{\T.node} + } + {open}{ + \dml.opennode{\T.node} + } + {close}{ + \dml.closenode{\T.node} + } + {mail}{ + \dml.mail{\T.node} + } + { + \dml.error{\T.list: Bad command (\T.cmd)} + } + }{ + \dml.error{\T.list: User denied (\T.from)} + } + }{ + \if(\T.cmd eq "help"){ + \dml.help + }{ + \dml.error{\T.list: Not found} + } + } +}{ + \dml.error{\HOST: Could not find user \T.from} +} + diff --git a/htc/posit.htc b/htc/posit.htc new file mode 100644 index 0000000..af92038 --- /dev/null +++ b/htc/posit.htc @@ -0,0 +1,23 @@ +\def{select.posit}{xx}{ + \select + {\1}{\2} + {Temp}{Temporary} + {ProfEmerit}{Professor Emeritus} + {Prof}{Professor} + {AssocProf}{Associate Professor} + {AssistProf}{Assistant Professor} + {ResAssoc}{Research Associate} + {Postdoc}{Post-doc} + {Doc}{Docent} + {PhD}{PhD} + {MD}{MD} + {Sec}{Secretary} + {Grad}{Graduate Student} + {Lic}{Licentiate} + {Master}{Master of Science} + {Diploma}{Diploma worker} + {Stud}{Student} + {Psi}{Psychologist} + {Prog}{Programmer} + {Other}{Other} +} diff --git a/htc/prefs.hdb b/htc/prefs.hdb new file mode 100644 index 0000000..15cf68c Binary files /dev/null and b/htc/prefs.hdb differ diff --git a/htc/server.htc b/htc/server.htc new file mode 100644 index 0000000..4060556 --- /dev/null +++ b/htc/server.htc @@ -0,0 +1,321 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% HTCd/1.2 Server (H. Rydberg, 2001) +% Supports methods HEAD, GET, PUT, POST, DELETE +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Useragent setting +% +\if(count \req.accept.lang){\setlang{\req.accept.lang}} +\const{FRAMES}(int(\req.useragent past "Mozilla/")>=2); +\if{\FRAMES}{ + \redef{target}{x}{ + \if( + (\1 cnt "//") || + ( (\sub{\1}{0}{1} eq "/") && ("HEAD BODY FOOT" which (\1 past "/" left "/"))==0) + ){ target=_top} + } +} +\const{killframes}{ + \if(int(\req.useragent past "Mozilla/")>2){ + if(self!=top) top.location.replace(self.location)}{ + if(self!=top) top.location=self.location}} +% +% Set userid and other cookies +% Handle errors directly +% +[userok:=1;]; +\def{statlog}{x}{\resp.status{\HTTP.[\1]}} +\for(i:=0)(i<\ncookie)(i+=1){ + \switch{\cookie[i].name} + {LANG}{ + \setlang{\cookie[i].val} + } + {FRAMES}{ + \reconst{FRAMES}(int \cookie[i].val); + } + {AUTH}{ + %MIGRATION to HTCd/1.1 + %Just silently remove the cookie and continue + \resp.cookie{AUTH}{deleted}{path=/; expires=\time2http{1}} + } + {ID}{ + [uid:=\cookie[i].val left ".";pin:=\cookie[i].val past "."]; + \setuser(uid); + [MAXFAIL:=\on.clear{EXPERT}{1}{3}]; + \if(\user.id && \user.pin eq pin){ + \if(\user.fail>0){ + \if(\user.fail>=MAXFAIL){ + \statlog{409}[userok=0;]; + \resp.cont.type.charset{}; + \output{ + \body{ + \h3{Login \lang{Failure}{fel}} + \lang{ + There has been too many bad logins. + Please contact the \href{mailto:\ADMIN}{Server Administrator}. + }{ + F{\"o}r m{\aa}nga login-fel har gjorts. + Var v{\"a}nlig kontakta \href{mailto:\ADMIN}{Serveradministrat{\"o}ren}. + } + } + } + \setcookie{ID}{deleted}{1} + }{ + \mail.user{LOGIN ALERT}{ + \lang{ + There has been (\user.fail) PIN failures + }{ + Ett antal (\user.fail) PIN fel har gjorts. + } + + \user.lastin; (\gethost{\user.lastin}) + \time2htc{\user.last} + } + \user.fail.set{0}\user.update; + } + }{ + \if(\user.lastin ne \remote.address){ + \on.clear{EXPERT}{ + \mail.user{HOST ALERT}{ + \lang{ + A change of access address has occured. + }{ + Ett byte av access-adress har intr{\"a}ffat. + } + + \lang{Current access:}{Nuvarande access:} + \remote.address; (\remote.name) + \time2htc{\now} + + \lang{Last access:}{Senaste access:} + \user.lastin; (\gethost{\user.lastin}) + \time2htc{\user.last} + } + }{ + \log{HOST ALERT \user.lastin -> \remote.address} + } + } + } + }{ + \if{\user.id}{ + \user.fail.set(\user.fail+1)\user.update; + \if(\user.fail==MAXFAIL){ + \mail.root{PIN failure}{ + PIN failure (\user.fail) for \user.id: \user.name <\user.email> + From: \remote.address:\remote.port; (\remote.name) + } + } + } + \statlog{409}[userok=0;]; + \resp.cont.type.charset{}; + \output{ + \body{ + \h3{\lang{Bad User}{Felaktig anv{\"a}ndare}} + \lang{ + Please check your user credentials and press the Back button. + }{ + Var v{\"a}nlig kontrollera din anv{\"a}ndarinformation + och tryck p{\aa} Tillbaka-knappen. + } + } + } + \setcookie{ID}{deleted}{1} + } + } +} +% +% At this point, user is set. +% +\if(\user.id){\user.last.set{\now}\user.lastin.set{\remote.address}\user.update} +% +% userok tells whether we should continue or not. +% +\if(userok){ + % + % Start by checking special URIs + % + [muri:=\req.uri;sroute:=muri past "/" left "/"]; + \if(sroute eq "POST")(muri=muri past "/" past sroute;sroute=muri past "/" left "/"); + \const{this}(muri); + \if("LOGIN LOGOUT" which sroute)(muri=muri past "/" past sroute)(sroute=""); + \const{referer}{\server;[muri]\andarg} + [route:=muri past "/" left "/";]; + \if("SRC RAW HEAD FOOT BODY" which route)(muri=muri past "/" past route)(route=""); + \seturi(muri); + [lroute:=muri past "/" left "/";]; + \if("en sv" which lroute){[muri=muri past "/" past lroute]\setlang(lroute)}(lroute=""); + \const{andlang}{/\lang{en}{sv}} + % + % sroute -> LOGIN|LOGOUT|none + % route -> SRC|RAW|HEAD|FOOT|BODY|none + % lroute -> en|sv|none + % this -> req.uri without POST + % referer -> complete URL (without POST|LOGIN|LOGOUT) + % uri -> directory URI (without SRC|RAW|HEAD|FOOT|BODY) + % andlang -> /[lang] + % muri -> mappable uri (without en|sv) + % + % Check method and dispatch + % + \if(\req.method eq "PUT" || \req.method eq "DELETE"){ + % + % PUT and DELETE treated together + % + [wclear:=\upload.clear(muri)]; + \if((count sroute)||(count lroute)|| !("SRC RAW" which route)||(wclear eq "ROOT")){ + \statlog{405}; + \resp.cont.type.charset{}; + \output{ + \body{ + \h3{\lang{Method not allowed}{Metoden ej till{\aa}ten}} + \lang{ + \req.method is not allowed here. + }{ + \req.method; {\"a}r ej till{\aa}ten h{\"a}r. + } +

    + \href{\server}{\lang{Home}{Hem}} + } + } + }{ + \if{\user.allow(wclear){\now}}{ + \statlog{200}; + \if(\req.method eq "DELETE"){\upload.delete(muri)}{\upload.put(muri)} + }{ + \statlog{409} + \resp.cont.type.charset{}; + \output{ + \body{ + \h3{\lang{Conflict}{Konflikt}} + \lang{ + The request could not be granted. + }{ + Kommandot kunde ej utf{\"o}ras. + } +

    + \href{\server}{\lang{Home}{Hem}} + } + } + } + } + }{ + % + % HEAD, GET and POST treated together + % + [fallow:=0;uallow:=0;rallow:=0;callow:=0]; + \switch(sroute){LOGIN}{\page.login}{LOGOUT}{\page.logout}{ + \staturi(muri){ + \if(stat.URI ne muri){ + [canonized:={\server\andlang;[stat.URI]\andarg}]; + \resp.status{\HTTP.301}; + \resp.location(canonized); + \resp.cont.type.charset{}; + \output{\href(canonized)(canonized)} + }{ + \if(count stat.ALIAS){\db{TREE}(@<-stat.)}; + \setgroup(first stat.X.CLEAR); + [ + fallow=1; + ttime:=\if(stat.MOD&36){\now}(stat.LASTMOD); + uallow=\user.allow(stat.X.CLEAR)(ttime); + rallow=\remote.allow(stat.X.DOMAIN); + callow=\cookie.allow(stat.X.COOKIE); + ]; + \nif((count stat.REFER) && uallow && rallow && callow)(userok=0){ + \statlog{200}[cacheok:=0]; + \if("text/x-htc text/x-htx text/html" which stat.MIME){ + \if(\req.method eq "POST"){ + \show.page; + }{ + \switch(route) + {SRC}{ + \show.srcpage + } + {RAW}{ + \show.rawpage + } + {HEAD}{ + \page.header + } + {FOOT}{ + \page.footer + } + {BODY}{ + \show.page; + [cacheok=(first \resp.getstatus == 200);] + } + { + \if(count lroute){\layout}{ + [canonized:={\server\andlang\uri\andarg}]; + \resp.status{\HTTP.301}; + \resp.location(canonized); + \resp.cont.type.charset{}; + \output{\href(canonized)(canonized)} + } + } + } + }{ + \resp.cont.type(stat.MIME); + \output{\load(stat.REFER)}[cacheok=1;] + } + \if(cacheok&&(count stat.X.CACHE)){ + \resp.pragma{} + \if(stat.X.CACHE){ + \resp.lastmod{\time2http(stat.LASTMOD)} + [expire:=\now+stat.X.CACHE; + \if(expire<=stat.LASTMOD)(expire=stat.LASTMOD+1)]; + \resp.expires{\time2http(expire)} + } + } + } + } + }(userok=0) + } + \nif(userok){ + \statlog{404}; + \resp.cont.type.charset{}; + \output{ + \body{ + \h3{\lang{Not Found}{Ej hittad}} + \lang{ + The requested uri (\req.uri) could not be found. + }{ + Den beg{\"a}rda sidan (\req.uri) kunde inte hittas. + } + \nif{\user.id}{ + \if(\req.useragent cnt "Mozilla"){ +

    + \lang + {The reason \it{may} be that you need need to } + {Andledningen \it{kan} vara att du beh{\"o}ver } + \href{/LOGIN\req.uri\andarg}{\lang{login}{logga in}} \lang{first}{f{\"o}rst}. + }{ +

    + \lang{ + The reason \it{may} be that your user credentials were improperly set. + }{ + Anledningen \it{kan} vara att din anv{\"a}ndar information {\"a}r felaktigt satt. + } +

    + \lang{ + Please go back try again. + }{ + G{\aa} tillbaka och f{\"o}rs{\"o}k igen. + } + } + }{ + \if(fallow){ +

    + \lang{Reason:}{Orsak:} + \nif(uallow){\lang{Bad clearance}{Fel r{\"a}ttigheter}} + \nif(rallow){\lang{Bad access address}{Felaktig access-adress}} + \nif(callow){\lang{Bad cookie}{Felaktig 'cookie'}} + } + } +

    + \href{\server}{\lang{Home}{Hem}} + } + } + } + } +} diff --git a/htc/system.htc b/htc/system.htc new file mode 100644 index 0000000..ecae08e --- /dev/null +++ b/htc/system.htc @@ -0,0 +1,35 @@ +% +% User stuff +% +\def{mail.root}{xx}{ + \log{mail root: \1} + \mail{\ROOT}{}{\ROOT}{server root}{\now}{\1}{text/plain}{\2} +} +\def{mail.admin}{xx}{ + \log{mail admin: \1} + \mail{\ADMIN}{}{\ADMIN}{server admin}{\now}{\1}{text/plain}{\2} +} +\def{mail.user}{xx}{ + \if{\user.id}{ + \log{mail user: \1} + \mail{\ADMIN}{}{\user.email}{\HOST}{\now}{\1}{text/plain}{\2} + } +} +% +% Modification time handling +% +\def{statmod}{x}{ + [mtime:=\dirmtime{\1}]; + \if(mtime>stat.LASTMOD)(stat.LASTMOD=mtime); + \1 +} +\def{statinclude}{x}{ + \include{\statmod{\1}} +} +\def{statopen}{xx?}{ + \open{\1}{\statmod{\2}}{\3} +} +\def{statdb}{x}{ + [mtime:=\dbmod{\1}]; + \if(mtime>stat.LASTMOD)(stat.LASTMOD=mtime); +} diff --git a/htc/tree.htc b/htc/tree.htc new file mode 100644 index 0000000..8615108 --- /dev/null +++ b/htc/tree.htc @@ -0,0 +1,21 @@ +\const{HTCEXT}{htc htx html} +\const{SKIPDIR}{sys htc SCCS} +\def{tree.update}{}{ + [xmod:=\now]; + \ldef{trav}{x}{ + \staturi{\1}{ + \if(count stat.ALIAS)(@<-stat.); + \forall{it}{\dirent{\1}}{ + \if(\dirmod(it)&24576){ + \nif(\SKIPDIR which (it past \1)){\trav{[it]/}} + }{ + \if(\HTCEXT which (it rpast ".")){ + \staturi(it){\if(count stat.ALIAS)(@<-stat.)} + } + } + } + } + }; + \db{TREE}{\trav{/}\query(XMOD + \href{\server}{\lang{Home}{Hem}} + } +} +\def{upload.put}{x}{ + \log{upload: PUTTING \1} + \save{\1}{T.body}{417} +} + diff --git a/htc/users.hdb b/htc/users.hdb new file mode 100644 index 0000000..a55fc11 Binary files /dev/null and b/htc/users.hdb differ -- cgit v1.2.3