summaryrefslogtreecommitdiffstats
path: root/source/WebAdmin.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-15 22:14:47 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-15 22:14:47 +0200
commitcb9ccb36acfb1d80684098759f8f39c7022891dd (patch)
treef65f9ca3c1c70f447c41d9b7190bb5dc8fbb5071 /source/WebAdmin.cpp
parentMerge submodule changes (diff)
parentAdded HOOK_PLAYER_RIGHT_CLICK (diff)
downloadcuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.gz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.bz2
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.lz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.xz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.zst
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.zip
Diffstat (limited to '')
-rw-r--r--source/WebAdmin.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp
index 08817139a..316513f11 100644
--- a/source/WebAdmin.cpp
+++ b/source/WebAdmin.cpp
@@ -79,8 +79,14 @@ bool cWebAdmin::Init(void)
return false;
}
- AString PortsIPv4 = m_IniFile.GetValue("WebAdmin", "Port", "8080");
- AString PortsIPv6 = m_IniFile.GetValue("WebAdmin", "PortsIPv6", "");
+ if (!m_IniFile.GetValueSetB("WebAdmin", "Enabled", true))
+ {
+ // WebAdmin is disabled, bail out faking a success
+ return true;
+ }
+
+ AString PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080");
+ AString PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", "");
if (!m_HTTPServer.Initialize(PortsIPv4, PortsIPv6))
{
@@ -185,8 +191,19 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
HTTPfd.Name = itr->first;
TemplateRequest.Request.FormData[itr->first] = HTTPfd;
TemplateRequest.Request.PostParams[itr->first] = itr->second;
- TemplateRequest.Request.Params[itr->first] = itr->second;
} // for itr - Data->m_Form[]
+
+ // Parse the URL into individual params:
+ size_t idxQM = a_Request.GetURL().find('?');
+ if (idxQM != AString::npos)
+ {
+ cHTTPFormParser URLParams(cHTTPFormParser::fpkURL, a_Request.GetURL().c_str() + idxQM + 1, a_Request.GetURL().length() - idxQM - 1, *Data);
+ URLParams.Finish();
+ for (cHTTPFormParser::const_iterator itr = URLParams.begin(), end = URLParams.end(); itr != end; ++itr)
+ {
+ TemplateRequest.Request.Params[itr->first] = itr->second;
+ } // for itr - URLParams[]
+ }
}
// Try to get the template from the Lua template script