mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/web/ejabberd_web_admin.erl: Fixed encoding of user names in
URLs * src/web/ejabberd_http.erl: Added url_encode function from yaws SVN Revision: 441
This commit is contained in:
parent
f765d7f612
commit
3fdf05a507
@ -1,5 +1,10 @@
|
|||||||
2005-11-22 Alexey Shchepin <alexey@sevcom.net>
|
2005-11-22 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/web/ejabberd_web_admin.erl: Fixed encoding of user names in
|
||||||
|
URLs
|
||||||
|
|
||||||
|
* src/web/ejabberd_http.erl: Added url_encode function from yaws
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl: Send stream error when connection is
|
* src/ejabberd_c2s.erl: Send stream error when connection is
|
||||||
replaced (thanks to Maxim Ryazanov)
|
replaced (thanks to Maxim Ryazanov)
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
%% External exports
|
%% External exports
|
||||||
-export([start/2,
|
-export([start/2,
|
||||||
start_link/2,
|
start_link/2,
|
||||||
receive_headers/1]).
|
receive_headers/1,
|
||||||
|
url_encode/1]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
@ -652,6 +653,46 @@ parse_urlencoded(undefined, _, _, _) ->
|
|||||||
[].
|
[].
|
||||||
|
|
||||||
|
|
||||||
|
url_encode([H|T]) ->
|
||||||
|
if
|
||||||
|
H >= $a, $z >= H ->
|
||||||
|
[H|url_encode(T)];
|
||||||
|
H >= $A, $Z >= H ->
|
||||||
|
[H|url_encode(T)];
|
||||||
|
H >= $0, $9 >= H ->
|
||||||
|
[H|url_encode(T)];
|
||||||
|
H == $_; H == $.; H == $-; H == $/; H == $: -> % FIXME: more..
|
||||||
|
[H|url_encode(T)];
|
||||||
|
true ->
|
||||||
|
case integer_to_hex(H) of
|
||||||
|
[X, Y] ->
|
||||||
|
[$%, X, Y | url_encode(T)];
|
||||||
|
[X] ->
|
||||||
|
[$%, $0, X | url_encode(T)]
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
url_encode([]) ->
|
||||||
|
[].
|
||||||
|
|
||||||
|
integer_to_hex(I) ->
|
||||||
|
case catch erlang:integer_to_list(I, 16) of
|
||||||
|
{'EXIT', _} ->
|
||||||
|
old_integer_to_hex(I);
|
||||||
|
Int ->
|
||||||
|
Int
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
old_integer_to_hex(I) when I<10 ->
|
||||||
|
integer_to_list(I);
|
||||||
|
old_integer_to_hex(I) when I<16 ->
|
||||||
|
[I-10+$A];
|
||||||
|
old_integer_to_hex(I) when I>=16 ->
|
||||||
|
N = trunc(I/16),
|
||||||
|
old_integer_to_hex(N) ++ old_integer_to_hex(I rem 16).
|
||||||
|
|
||||||
|
|
||||||
% The following code is mostly taken from yaws_ssl.erl
|
% The following code is mostly taken from yaws_ssl.erl
|
||||||
|
|
||||||
parse_request(State, Data) ->
|
parse_request(State, Data) ->
|
||||||
|
@ -1343,8 +1343,11 @@ list_given_users(Users, Prefix, Lang, URLFunc) ->
|
|||||||
?T("Online")
|
?T("Online")
|
||||||
end,
|
end,
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XE("td", [?AC(URLFunc({user, Prefix, User, Server}),
|
[?XE("td",
|
||||||
us_to_list(US))]),
|
[?AC(URLFunc({user, Prefix,
|
||||||
|
ejabberd_http:url_encode(User),
|
||||||
|
Server}),
|
||||||
|
us_to_list(US))]),
|
||||||
?XE("td", FQueueLen),
|
?XE("td", FQueueLen),
|
||||||
?XC("td", FLast)])
|
?XC("td", FLast)])
|
||||||
end, Users)
|
end, Users)
|
||||||
@ -1397,7 +1400,9 @@ list_online_users(Host, _Lang) ->
|
|||||||
SUsers = lists:usort(Users),
|
SUsers = lists:usort(Users),
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun({S, U} = SU) ->
|
fun({S, U} = SU) ->
|
||||||
[?AC("../user/" ++ U ++ "/", su_to_list(SU)), ?BR]
|
[?AC("../user/" ++ ejabberd_http:url_encode(U) ++ "/",
|
||||||
|
su_to_list(SU)),
|
||||||
|
?BR]
|
||||||
end, SUsers).
|
end, SUsers).
|
||||||
|
|
||||||
user_info(User, Server, Query, Lang) ->
|
user_info(User, Server, Query, Lang) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user