mirror of
https://github.com/anope/anope.git
synced 2026-07-03 01:33:12 +02:00
Squashed commit of the following:
commit317ead6b39Author: MatthewM <mcm@they-got.us> Date: Tue Dec 11 02:14:06 2012 -0500 Added the HostServ link to the navigation bar commit6b15d7fc5eAuthor: MatthewM <mcm@they-got.us> Date: Tue Dec 11 01:58:18 2012 -0500 Correct some slight over sights that was missed eariler commitb356a46789Author: MatthewM <mcm@they-got.us> Date: Mon Dec 10 23:44:51 2012 -0500 Started work on adding HostServ to the web panel
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -165,4 +165,6 @@ namespace WebPanel
|
||||
|
||||
#include "pages/memoserv/memos.h"
|
||||
|
||||
#include "pages/hostserv/request.h"
|
||||
|
||||
#include "pages/operserv/akill.h"
|
||||
|
||||
Reference in New Issue
Block a user