*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
-import net.pterodactylus.sone.web.page.Page.Request.Method;
-import net.pterodactylus.util.template.DataProvider;
+import net.pterodactylus.sone.text.TextFilter;
+import net.pterodactylus.sone.web.page.FreenetRequest;
- protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException {
- super.processTemplate(request, dataProvider);
+ protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
+ super.processTemplate(request, templateContext);
String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36);
String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim();
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36);
String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim();
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
if (text.length() > 0) {
String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43);
Sone sender = webInterface.getCore().getLocalSone(senderId, false);
if (sender == null) {
sender = getCurrentSone(request.getToadletContext());
}
if (text.length() > 0) {
String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43);
Sone sender = webInterface.getCore().getLocalSone(senderId, false);
if (sender == null) {
sender = getCurrentSone(request.getToadletContext());
}
- webInterface.getCore().createReply(sender, post, text);
+ text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
+ webInterface.getCore().createReply(sender, post.get(), text);
- dataProvider.set("postId", postId);
- dataProvider.set("text", text);
- dataProvider.set("returnPage", returnPage);
+ templateContext.set("postId", postId);
+ templateContext.set("text", text);
+ templateContext.set("returnPage", returnPage);