anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

request.cpp (1218B)

      1 /*
      2  * (C) 2003-2022 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 
     10 WebCPanel::HostServ::Request::Request(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u)
     11 {
     12 }
     13 
     14 bool WebCPanel::HostServ::Request::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
     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(client, 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 }