mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-24 17:29:28 +01:00
Fix crashes when browsing some WebAdmin pages (EJAB-821)
SVN Revision: 2111
This commit is contained in:
parent
9bcba6c8b8
commit
0bbbf468f0
@ -574,11 +574,11 @@ user_queue(User, Server, Query, Lang) ->
|
||||
exmpp_xml:indent_document(Packet1, <<" ">>),
|
||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||
?XE("tr",
|
||||
[?XAE("td", [{"class", "valign"}], [?INPUT("checkbox", "selected", ID)]),
|
||||
?XAC("td", [{"class", "valign"}], Time),
|
||||
?XAC("td", [{"class", "valign"}], SFrom),
|
||||
?XAC("td", [{"class", "valign"}], STo),
|
||||
?XAE("td", [{"class", "valign"}], [?XC("pre", FPacket)])]
|
||||
[?XAE("td", [?XMLATTR('class', <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], Time),
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], SFrom),
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], STo),
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], [?XC("pre", FPacket)])]
|
||||
)
|
||||
end, Msgs),
|
||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||
@ -587,7 +587,7 @@ user_queue(User, Server, Query, Lang) ->
|
||||
ok -> [?XREST("Submitted")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[?XE("table",
|
||||
[?XE("thead",
|
||||
[?XE("tr",
|
||||
@ -601,7 +601,7 @@ user_queue(User, Server, Query, Lang) ->
|
||||
if
|
||||
FMsgs == [] ->
|
||||
[?XE("tr",
|
||||
[?XAC("td", [{"colspan", "4"}], " ")]
|
||||
[?XAC("td", [?XMLATTR('colspan', <<"4">>)], " ")]
|
||||
)];
|
||||
true ->
|
||||
FMsgs
|
||||
|
@ -360,8 +360,8 @@ user_queue(User, Server, Query, Lang) ->
|
||||
exmpp_xml:indent_document(Packet, <<" ">>),
|
||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||
?XE("tr",
|
||||
[?XAE("td", [{"class", "valign"}], [?INPUT("checkbox", "selected", ID)]),
|
||||
?XAE("td", [{"class", "valign"}], [?XC("pre", FPacket)])]
|
||||
[?XAE("td", [?XMLATTR('class', <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], [?XC("pre", FPacket)])]
|
||||
)
|
||||
end, Msgs),
|
||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||
@ -370,7 +370,7 @@ user_queue(User, Server, Query, Lang) ->
|
||||
ok -> [?XREST("Submitted")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[?XE("table",
|
||||
[?XE("thead",
|
||||
[?XE("tr",
|
||||
@ -381,7 +381,7 @@ user_queue(User, Server, Query, Lang) ->
|
||||
if
|
||||
FMsgs == [] ->
|
||||
[?XE("tr",
|
||||
[?XAC("td", [{"colspan", "4"}], " ")]
|
||||
[?XAC("td", [?XMLATTR('colspan', <<"4">>)], " ")]
|
||||
)];
|
||||
true ->
|
||||
FMsgs
|
||||
|
@ -1131,16 +1131,16 @@ user_roster(User, Server, Query, Lang) ->
|
||||
TDJID = build_contact_jid_td(R#roster.jid),
|
||||
?XE("tr",
|
||||
[TDJID,
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
binary_to_list(R#roster.name)),
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
atom_to_list(R#roster.subscription)),
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
atom_to_list(Pending)),
|
||||
?XAE("td", [{"class", "valign"}], Groups),
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], Groups),
|
||||
if
|
||||
Pending == in ->
|
||||
?XAE("td", [{"class", "valign"}],
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
||||
[?INPUTT("submit",
|
||||
"validate" ++
|
||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||
@ -1148,7 +1148,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
true ->
|
||||
?X("td")
|
||||
end,
|
||||
?XAE("td", [{"class", "valign"}],
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
||||
[?INPUTT("submit",
|
||||
"remove" ++
|
||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||
@ -1161,7 +1161,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
error -> [?XREST("Bad format")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
FItems ++
|
||||
[?P,
|
||||
?INPUT("text", "newjid", ""), ?C(" "),
|
||||
@ -1171,7 +1171,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
_ ->
|
||||
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
||||
[?CT("Bad format"), ?P] ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[?P,
|
||||
?INPUT("text", "newjid", ""), ?C(" "),
|
||||
?INPUTT("submit", "addjid", "Add Jabber ID")
|
||||
|
@ -970,16 +970,16 @@ user_roster(User, Server, Query, Lang) ->
|
||||
TDJID = build_contact_jid_td(R#roster.jid),
|
||||
?XE("tr",
|
||||
[TDJID,
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
binary_to_list(R#roster.name)),
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
atom_to_list(R#roster.subscription)),
|
||||
?XAC("td", [{"class", "valign"}],
|
||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
||||
atom_to_list(Pending)),
|
||||
?XAE("td", [{"class", "valign"}], Groups),
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], Groups),
|
||||
if
|
||||
Pending == in ->
|
||||
?XAE("td", [{"class", "valign"}],
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
||||
[?INPUTT("submit",
|
||||
"validate" ++
|
||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||
@ -987,7 +987,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
true ->
|
||||
?X("td")
|
||||
end,
|
||||
?XAE("td", [{"class", "valign"}],
|
||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
||||
[?INPUTT("submit",
|
||||
"remove" ++
|
||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||
@ -1000,7 +1000,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
error -> [?XREST("Bad format")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
FItems ++
|
||||
[?P,
|
||||
?INPUT("text", "newjid", ""), ?C(" "),
|
||||
@ -1010,7 +1010,7 @@ user_roster(User, Server, Query, Lang) ->
|
||||
_ ->
|
||||
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
||||
[?CT("Bad format"), ?P] ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[?P,
|
||||
?INPUT("text", "newjid", ""), ?C(" "),
|
||||
?INPUTT("submit", "addjid", "Add Jabber ID")
|
||||
|
@ -199,12 +199,12 @@ process_item(RosterItem, Host) ->
|
||||
|
||||
%% Remove pending out subscription
|
||||
Mod:out_subscription(UserTo, ServerTo,
|
||||
jlib:make_jid(UserFrom, ServerFrom, ""),
|
||||
exmpp_jid:make_jid(UserFrom, ServerFrom),
|
||||
unsubscribe),
|
||||
|
||||
%% Remove pending in subscription
|
||||
Mod:in_subscription(aaaa, UserFrom, ServerFrom,
|
||||
jlib:make_jid(UserTo, ServerTo, ""),
|
||||
exmpp_jid:make_jid(UserTo, ServerTo),
|
||||
unsubscribe, ""),
|
||||
|
||||
%% But we're still subscribed, so respond as such.
|
||||
@ -334,7 +334,7 @@ out_subscription(UserFrom, ServerFrom, JIDTo, unsubscribed) ->
|
||||
|
||||
%% Remove pending out subscription
|
||||
{UserTo, ServerTo, _} = jlib:short_prepd_bare_jid(JIDTo),
|
||||
JIDFrom = jlib:make_jid(UserFrom, UserTo, ""),
|
||||
JIDFrom = exmpp_jid:make_jid(UserFrom, UserTo),
|
||||
Mod:out_subscription(UserTo, ServerTo, JIDFrom, unsubscribe),
|
||||
|
||||
%% Remove pending in subscription
|
||||
@ -707,7 +707,7 @@ push_roster_item(User, Server, ContactU, ContactS, GroupName, Subscription) ->
|
||||
subscription = Subscription,
|
||||
ask = none,
|
||||
groups = [GroupName]},
|
||||
push_item(User, Server, jlib:make_jid("", Server, ""), Item).
|
||||
push_item(User, Server, exmpp_jid:make_jid(Server), Item).
|
||||
|
||||
item_to_xml(Item) ->
|
||||
{U, S, R} = Item#roster.jid,
|
||||
@ -796,7 +796,7 @@ list_shared_roster_groups(Host, Query, Lang) ->
|
||||
error -> [?XREST("Bad format")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[FGroups,
|
||||
?BR,
|
||||
?INPUTT("submit", "delete", "Delete Selected")
|
||||
@ -858,7 +858,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
||||
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
|
||||
DescNL = length(element(2, regexp:split(Description, "\n"))),
|
||||
FGroup =
|
||||
?XAE("table", [{"class", "withtextareas"}],
|
||||
?XAE("table", [?XMLATTR('class', <<"withtextareas">>)],
|
||||
[?XE("tbody",
|
||||
[?XE("tr",
|
||||
[?XCT("td", "Name:"),
|
||||
@ -897,7 +897,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
||||
error -> [?XREST("Bad format")];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
||||
[FGroup,
|
||||
?BR,
|
||||
?INPUTT("submit", "submit", "Submit")
|
||||
|
@ -1228,13 +1228,13 @@ access_rules_to_xhtml(AccessRules, Lang) ->
|
||||
fun({access, Name, Rules} = Access) ->
|
||||
SName = atom_to_list(Name),
|
||||
ID = term_to_id(Access),
|
||||
?XE('trr',
|
||||
?XE('tr',
|
||||
[?XE('td', [?INPUT("checkbox", "selected", ID)]),
|
||||
?XE('td', [?AC(SName ++ "/", SName)]),
|
||||
?XC('td', term_to_string(Rules))
|
||||
]
|
||||
)
|
||||
end, AccessRules) ++
|
||||
end, lists:sort(AccessRules)) ++
|
||||
[?XE('tr',
|
||||
[?X('td'),
|
||||
?XE('td', [?INPUT("text", "namenew", "")]),
|
||||
@ -1293,9 +1293,9 @@ access_rule_to_xhtml(Rules) ->
|
||||
SACL = atom_to_list(ACL),
|
||||
SAccess ++ "\s\t" ++ SACL ++ "\n"
|
||||
end, Rules),
|
||||
?XAC('textarea', [{"name", "rules"},
|
||||
{"rows", "16"},
|
||||
{"cols", "80"}],
|
||||
?XAC('textarea', [?XMLATTR('name', <<"rules">>),
|
||||
?XMLATTR('rows', <<"16">>),
|
||||
?XMLATTR('cols', <<"80">>)],
|
||||
Text).
|
||||
|
||||
parse_access_rule(Text) ->
|
||||
|
Loading…
Reference in New Issue
Block a user