| 1 |
//Declares the HTMLTemplate class, for displaying template-based banned pages to clients |
| 2 |
|
| 3 |
// For all support, instructions and copyright go to: |
| 4 |
// http://e2guardian.org/ |
| 5 |
// Released under the GPL v2, with the OpenSSL exception described in the README file. |
| 6 |
|
| 7 |
#ifndef __HPP_HTMLTEMPLATE |
| 8 |
#define __HPP_HTMLTEMPLATE |
| 9 |
|
| 10 |
// INCLUDES |
| 11 |
|
| 12 |
#include "String.hpp" |
| 13 |
#include "Socket.hpp" |
| 14 |
|
| 15 |
#include <deque> |
| 16 |
#include <string> |
| 17 |
|
| 18 |
// DECLARATIONS |
| 19 |
|
| 20 |
class HTMLTemplate |
| 21 |
{ |
| 22 |
public: |
| 23 |
// string list for holding the template |
| 24 |
// public so that it can be accessed directly for display without using |
| 25 |
// the default set of placeholders |
| 26 |
std::deque<String> html; |
| 27 |
|
| 28 |
// wipe the loaded template |
| 29 |
void reset(); |
| 30 |
|
| 31 |
// load in a template from the given file, looking for placeholder strings (reason, URL, category etc.) |
| 32 |
// optionally, provide your own set of placeholders |
| 33 |
bool readTemplateFile(const char *filename, const char *placeholders = NULL); |
| 34 |
|
| 35 |
#ifdef NOTDEF |
| 36 |
// fill in the template with the given info and send it to the client over the given socket |
| 37 |
// only useful if you used the default set of placeholders |
| 38 |
void display(Socket *s, String *url, std::string &reason, std::string &logreason, std::string &categories, |
| 39 |
std::string *user, std::string *ip, std::string *host, int filtergroup, String grpname, |
| 40 |
String &hashed); |
| 41 |
#endif |
| 42 |
|
| 43 |
void display_hb(String &ebody, String *url, std::string &reason, std::string &logreason, std::string &categories, |
| 44 |
std::string *user, std::string *ip, std::string *host, int filtergroup, String grpname, |
| 45 |
String &hashed, String &localip, String &extflags); |
| 46 |
|
| 47 |
private: |
| 48 |
// add a string to the list |
| 49 |
void push(String s); |
| 50 |
}; |
| 51 |
|
| 52 |
#endif |