Anope IRC Services  Version 2.0
request.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 Anope Team
3  * Contact us at team@anope.org
4  *
5  * Please read COPYING and README for further details.
6  */
7 
8 #include "../../webcpanel.h"
9 
11 {
12 }
13 
15 {
16  if (message.post_data.count("req") > 0)
17  {
18  std::vector<Anope::string> params;
19  params.push_back(HTTPUtils::URLDecode(message.post_data["req"]));
20 
21  WebPanel::RunCommand(na->nc->display, na->nc, "HostServ", "hostserv/request", params, replacements, "CMDR");
22  }
23 
24  if (na->HasVhost())
25  {
26  if (na->GetVhostIdent().empty() == false)
27  replacements["VHOST"] = na->GetVhostIdent() + "@" + na->GetVhostHost();
28  else
29  replacements["VHOST"] = na->GetVhostHost();
30  }
31  if (ServiceReference<Command>("Command", "hostserv/request"))
32  replacements["CAN_REQUEST"] = "YES";
33  TemplateFileServer page("hostserv/request.html");
34  page.Serve(server, page_name, client, message, reply, replacements);
35  return true;
36 }
Serialize::Reference< NickCore > nc
Definition: account.h:47
void Serve(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, Replacements &)
const Anope::string & GetVhostHost() const
Definition: nickalias.cpp:106
bool HasVhost() const
Definition: nickalias.cpp:96
void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector< Anope::string > &params, TemplateFileServer::Replacements &r, const Anope::string &key)
Definition: webcpanel.cpp:234
bool empty() const
Definition: anope.h:126
bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override
Definition: request.cpp:14
std::map< Anope::string, Anope::string > post_data
Definition: httpd.h:81
Request(const Anope::string &cat, const Anope::string &u)
Definition: request.cpp:10
Anope::string URLDecode(const Anope::string &url)
Definition: httpd.h:163
const Anope::string & GetVhostIdent() const
Definition: nickalias.cpp:101