summaryrefslogtreecommitdiff
path: root/modules/extra/webcpanel/pages/hostserv/request.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-12-12 01:04:08 -0500
committerAdam <Adam@anope.org>2012-12-12 01:04:08 -0500
commit5f72d1fda5e297990aee7e0be805df0a734ca87d (patch)
tree93ac817b2614b66a2674a2acee2c378c64084620 /modules/extra/webcpanel/pages/hostserv/request.cpp
parentdfff54425b5995f0f4267abbaab7cb420cf18642 (diff)
Squashed commit of the following:
commit 317ead6b395237fd0fcf8a39ef028404fcd0ece2 Author: MatthewM <mcm@they-got.us> Date: Tue Dec 11 02:14:06 2012 -0500 Added the HostServ link to the navigation bar commit 6b15d7fc5e68809f282f5d8597f5bc198851b41c Author: MatthewM <mcm@they-got.us> Date: Tue Dec 11 01:58:18 2012 -0500 Correct some slight over sights that was missed eariler commit b356a46789fabe4f69af8739e721bc069aa7a348 Author: MatthewM <mcm@they-got.us> Date: Mon Dec 10 23:44:51 2012 -0500 Started work on adding HostServ to the web panel
Diffstat (limited to 'modules/extra/webcpanel/pages/hostserv/request.cpp')
-rw-r--r--modules/extra/webcpanel/pages/hostserv/request.cpp36
1 files changed, 36 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;
+}