From 46904e182077154770273e9ea5210f6ad42245cd Mon Sep 17 00:00:00 2001 From: faketruth Date: Tue, 21 Aug 2012 22:17:59 +0000 Subject: 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 --- source/cWebAdmin.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp index 33068ec38..dab6fe9e8 100644 --- a/source/cWebAdmin.cpp +++ b/source/cWebAdmin.cpp @@ -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_ += "

Bad request

"; 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

Go back

"; } -- cgit v1.2.3