Now it's possible to only show the plugin's WebAdmin content without the template around it by going to /~webadmin/ instead of /webadmin/

git-svn-id: http://mc-server.googlecode.com/svn/trunk@772 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
faketruth 2012-08-21 22:17:59 +00:00
parent 39ff5b0985
commit 46904e1820
1 changed files with 9 additions and 3 deletions

View File

@ -122,7 +122,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
AStringVector Split = StringSplit(r->path_.substr(1), "/");
if (Split.empty() || (Split[0] != "webadmin"))
if (Split.empty() || (Split[0] != "webadmin" && Split[0] != "~webadmin"))
{
r->answer_ += "<h1>Bad request</h1>";
return;
@ -133,6 +133,12 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
r->answer_ += "no auth";
r->auth_realm_ = "MCServer WebAdmin";
}
bool bDontShowTemplate = false;
if (Split[0] == "~webadmin")
{
bDontShowTemplate = true;
}
std::string UserPassword = WebAdmin->m_IniFile->GetValue( "User:"+r->username_, "Password", "");
if ((UserPassword != "") && (r->password_ == UserPassword))
@ -149,7 +155,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
std::string Menu;
std::string Content;
std::string Template = WebAdmin->GetTemplate();
std::string Template = bDontShowTemplate ? "{CONTENT}" : WebAdmin->GetTemplate();
std::string FoundPlugin;
for (PluginList::iterator itr = WebAdmin->m_Plugins.begin(); itr != WebAdmin->m_Plugins.end(); ++itr)
@ -238,7 +244,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
if( Split.size() > 1 )
if (bDontShowTemplate == false && Split.size() > 1)
{
Content += "\n<p><a href='" + BaseURL + "'>Go back</a></p>";
}