* src/web/: Minor update

SVN Revision: 207
This commit is contained in:
Alexey Shchepin 2004-03-03 21:07:27 +00:00
parent ec182cbd60
commit 0f95685c05
3 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2004-03-03 Alexey Shchepin <alexey@sevcom.net>
* src/web/: Minor update
2004-03-02 Alexey Shchepin <alexey@sevcom.net>
* src/web/: Small HTTP server and admin web-interface to ejabberd

View File

@ -102,7 +102,7 @@ process_request(#state{request_method = 'GET',
LQuery = parse_urlencoded(Query),
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
LPath = string:tokens(NPath, "/"),
case ejabberd_web:process_get(User, LPath, LQuery) of
case ejabberd_web:process_get(User, LPath, LQuery, "") of
El when element(1, El) == xmlelement ->
make_xhtml_output(200, [], El);
{Status, Headers, El} ->
@ -141,7 +141,7 @@ process_request(#state{request_method = 'POST',
LPath = string:tokens(NPath, "/"),
LQuery = parse_urlencoded(Data),
?INFO_MSG("client query: ~p~n", [LQuery]),
case ejabberd_web:process_get(User, LPath, LQuery) of
case ejabberd_web:process_get(User, LPath, LQuery, "") of
El when element(1, El) == xmlelement ->
make_xhtml_output(200, [], El);
{Status, Headers, El} ->

View File

@ -12,7 +12,7 @@
%% External exports
-export([make_xhtml/1,
process_get/3]).
process_get/4]).
-include("ejabberd.hrl").
-include("jlib.hrl").
@ -43,7 +43,21 @@ make_xhtml(Els) ->
-define(P, ?X("p")).
-define(BR, ?X("br")).
process_get(User, [], Query) ->
process_get(User, ["config" | RPath], Query, Lang) ->
case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
deny ->
{401, [], make_xhtml([?XC("h1", "Not Allowed")])};
allow ->
process_config(User, RPath, Query, Lang)
end;
process_get(User, Path, Query, Lang) ->
{404, [], make_xhtml([?XC("h1", "Not found")])}.
process_config(User, [], Query, Lang) ->
make_xhtml([?XC("h1", "ejabberd configuration"),
?XE("ul",
[?LI([?AC("acls/", "Access Control Lists")]),
@ -53,7 +67,7 @@ process_get(User, [], Query) ->
])
]);
process_get(User, ["acls"], Query) ->
process_config(User, ["acls"], Query, Lang) ->
case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
deny ->
{401, [], make_xhtml([?XC("h1", "Not Allowed")])};
@ -97,7 +111,7 @@ process_get(User, ["acls"], Query) ->
])
end;
process_get(User, Path, Query) ->
process_config(User, Path, Query, Lang) ->
{404, [], make_xhtml([?XC("h1", "Not found")])}.