diff options
Diffstat (limited to 'src/java/com/juick/http/www/Help.java')
-rw-r--r-- | src/java/com/juick/http/www/Help.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java index 9fc21aad..7adcb920 100644 --- a/src/java/com/juick/http/www/Help.java +++ b/src/java/com/juick/http/www/Help.java @@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse; * @author Ugnich Anton */ public class Help { - + protected void doRedirectToHelpIndex(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String lang = request.getLocale().getLanguage(); if (!(lang.equals("ru") || lang.equals("fr"))) { @@ -42,19 +42,19 @@ public class Help { } Utils.sendTemporaryRedirect(response, "/help/" + lang + "/"); } - + protected void doGetHelp(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request); Locale locale = request.getLocale(); ResourceBundle rb = ResourceBundle.getBundle("Global", locale); - + String path[] = request.getRequestURI().split("/"); String page; if (path.length < 3 || path.length > 4 || path[2].length() != 2 || !path[2].matches("^[a-z]+$")) { response.sendError(404); return; } - + if (path.length == 4) { page = path[3]; if (!page.matches("^[a-zA-Z0-9\\-]*$") || page.equals("navigation") || page.equals("index")) { @@ -64,41 +64,40 @@ public class Help { } else { page = "index"; } - + File f = new File("/var/www/juick.com/help3/" + path[2] + "/" + page); if (!f.isFile()) { response.sendError(404); return; } - + response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { PageTemplates.pageHead(out, rb.getString("Help"), ""); PageTemplates.pageNavigation(out, locale, visitor, null); - + out.println("<div id=\"topwrapper\">"); out.println("<div id=\"wrapper\">"); out.println("<div id=\"content\">"); printFile(out, f); + PageTemplates.pageFooter(request, out, locale, visitor, false); out.println("</div>"); out.println("</div>"); - + out.println("<div id=\"column\" class=\"abs\">"); printFile(out, new File("/var/www/juick.com/help3/" + path[2] + "/navigation")); out.println("<hr/>"); printFile(out, new File("/var/www/juick.com/help3/langs")); out.println("</div>"); - + out.println("</div>"); - - PageTemplates.pageFooter(request, out, locale, visitor, false); PageTemplates.pageEnd(out); } finally { out.close(); } } - + private void printFile(PrintWriter out, File f) throws IOException { BufferedReader br = new BufferedReader(new FileReader(f)); String str; |