summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/hs_request.cpp2
-rw-r--r--modules/extra/webcpanel/pages/hostserv/request.cpp36
-rw-r--r--modules/extra/webcpanel/pages/hostserv/request.h24
-rw-r--r--modules/extra/webcpanel/templates/default/hostserv/request.html23
-rw-r--r--modules/extra/webcpanel/webcpanel.cpp21
-rw-r--r--modules/extra/webcpanel/webcpanel.h2
6 files changed, 106 insertions, 2 deletions
diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp
index b11059f90..c7cd75c11 100644
--- a/modules/commands/hs_request.cpp
+++ b/modules/commands/hs_request.cpp
@@ -152,7 +152,7 @@ class CommandHSRequest : public Command
HostRequest *req = new HostRequest;
- req->nick = u->nick;
+ req->nick = source.GetNick();
req->ident = user;
req->host = host;
req->time = Anope::CurTime;
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;
+};
+
+}
+
+}
diff --git a/modules/extra/webcpanel/templates/default/hostserv/request.html b/modules/extra/webcpanel/templates/default/hostserv/request.html
new file mode 100644
index 000000000..ced414242
--- /dev/null
+++ b/modules/extra/webcpanel/templates/default/hostserv/request.html
@@ -0,0 +1,23 @@
+{INCLUDE header.html}
+ {FOR M IN MESSAGES}
+ {M}<br/>
+ {END FOR}
+ <table width="100%" height="100%">
+ <tr>
+ <td>Your <b>current</b> vHost</td>
+ {IF EXISTS VHOST}
+ <td>{VHOST}</td>
+ {ELSE}
+ <td><b>None</td>
+ {END IF}
+ </table>
+ {IF EXISTS VHOST}
+ <b>Request a new vHost</b>
+ {ELSE}
+ <b>Request a vHost</b>
+ {END IF}
+ <form method="post" action="/hostserv/request">
+ <input name="req">
+ <input type="submit" value="Request">
+ </form>
+{INCLUDE footer.html}
diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp
index 164c4b903..807fdcd57 100644
--- a/modules/extra/webcpanel/webcpanel.cpp
+++ b/modules/extra/webcpanel/webcpanel.cpp
@@ -34,8 +34,11 @@ class ModuleWebCPanel : public Module
WebCPanel::MemoServ::Memos memoserv_memos;
+ WebCPanel::HostServ::Request hostserv_request;
+
WebCPanel::OperServ::Akill operserv_akill;
+
public:
ModuleWebCPanel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED),
panel(this, "webcpanel"),
@@ -43,7 +46,7 @@ class ModuleWebCPanel : public Module
index("/"), logout("/logout"), _register("/register"), confirm("/confirm"),
nickserv_info(Config->NickServ, "/nickserv/info"), nickserv_cert(Config->NickServ, "/nickserv/cert"), nickserv_access(Config->NickServ, "/nickserv/access"), nickserv_alist(Config->NickServ, "/nickserv/alist"),
chanserv_info(Config->ChanServ, "/chanserv/info"), chanserv_set(Config->ChanServ, "/chanserv/set"), chanserv_access(Config->ChanServ, "/chanserv/access"), chanserv_akick(Config->ChanServ, "/chanserv/akick"),
- memoserv_memos(Config->MemoServ, "/memoserv/memos"), operserv_akill(Config->OperServ, "/operserv/akill")
+ memoserv_memos(Config->MemoServ, "/memoserv/memos"), hostserv_request(Config->HostServ, "/hostserv/request"), operserv_akill(Config->OperServ, "/operserv/akill")
{
this->SetAuthor("Anope");
@@ -143,6 +146,20 @@ class ModuleWebCPanel : public Module
panel.sections.push_back(s);
}
+ if (Config->HostServ.empty() == false)
+ {
+ Section s;
+ s.name = Config->HostServ;
+
+ SubSection ss;
+ ss.name = "vHost Request";
+ ss.url = "/hostserv/request";
+ s.subsections.push_back(ss);
+ provider->RegisterPage(&this->hostserv_request);
+
+ panel.sections.push_back(s);
+ }
+
if (Config->OperServ.empty() == false)
{
Section s;
@@ -183,6 +200,8 @@ class ModuleWebCPanel : public Module
provider->UnregisterPage(&this->chanserv_akick);
provider->UnregisterPage(&this->memoserv_memos);
+
+ provider->UnregisterPage(&this->hostserv_request);
}
}
};
diff --git a/modules/extra/webcpanel/webcpanel.h b/modules/extra/webcpanel/webcpanel.h
index 4ba6a7f65..d21a95571 100644
--- a/modules/extra/webcpanel/webcpanel.h
+++ b/modules/extra/webcpanel/webcpanel.h
@@ -165,4 +165,6 @@ namespace WebPanel
#include "pages/memoserv/memos.h"
+#include "pages/hostserv/request.h"
+
#include "pages/operserv/akill.h"