summaryrefslogtreecommitdiff
path: root/modules/extra/webcpanel/pages/hostserv
diff options
context:
space:
mode:
Diffstat (limited to 'modules/extra/webcpanel/pages/hostserv')
-rw-r--r--modules/extra/webcpanel/pages/hostserv/request.cpp36
-rw-r--r--modules/extra/webcpanel/pages/hostserv/request.h24
2 files changed, 60 insertions, 0 deletions
diff --git a/modules/extra/webcpanel/pages/hostserv/request.cpp b/modules/extra/webcpanel/pages/hostserv/request.cpp
new file mode 100644
index 000000000..aad933c3a
--- /dev/null
+++ b/modules/extra/webcpanel/pages/hostserv/request.cpp
@@ -0,0 +1,36 @@
+/*
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#include "../../webcpanel.h"
+
+WebCPanel::HostServ::Request::Request(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u)
+{
+}
+
+bool WebCPanel::HostServ::Request::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
+{
+ if (message.post_data.count("req") > 0)
+ {
+ std::vector<Anope::string> params;
+ std::stringstream cmdstr;
+
+ cmdstr << HTTPUtils::URLDecode(message.post_data["req"]);
+ params.push_back(cmdstr.str());
+ WebPanel::RunCommand(na->nc->display, na->nc, Config->HostServ, "hostserv/request", params, replacements);
+ }
+
+ if (na->HasVhost())
+ {
+ if (na->GetVhostIdent().empty() == false)
+ replacements["VHOST"] = na->GetVhostIdent() + "@" + na->GetVhostHost();
+ else
+ replacements["VHOST"] = na->GetVhostHost();
+ }
+ TemplateFileServer page("hostserv/request.html");
+ page.Serve(server, page_name, client, message, reply, replacements);
+ return true;
+}
diff --git a/modules/extra/webcpanel/pages/hostserv/request.h b/modules/extra/webcpanel/pages/hostserv/request.h
new file mode 100644
index 000000000..e26bea224
--- /dev/null
+++ b/modules/extra/webcpanel/pages/hostserv/request.h
@@ -0,0 +1,24 @@
+/*
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+namespace WebCPanel
+{
+
+namespace HostServ
+{
+
+class Request : public WebPanelProtectedPage
+{
+ public:
+ Request(const Anope::string &cat, const Anope::string &u);
+
+ bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override;
+};
+
+}
+
+}