From 968f41ba511f8f74377b1a1c7b61ff759ebe3078 Mon Sep 17 00:00:00 2001 From: faketruth Date: Tue, 31 Jan 2012 20:56:42 +0000 Subject: Changed how Lua handles the (Post)Params in the HTTPRequest of a WebPlugin It should now be theoretically possible to upload files through WebAdmin git-svn-id: http://mc-server.googlecode.com/svn/trunk@203 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- Plugins/Core/web_playerlist.lua | 4 ++-- Plugins/Core/web_reload.lua | 2 +- Plugins/Core/web_whitelist.lua | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'Plugins') diff --git a/Plugins/Core/web_playerlist.lua b/Plugins/Core/web_playerlist.lua index 205306ba8..6c736ce3c 100644 --- a/Plugins/Core/web_playerlist.lua +++ b/Plugins/Core/web_playerlist.lua @@ -2,8 +2,8 @@ function HandleRequest_PlayerList( Request ) local World = cRoot:Get():GetWorld() local Content = "" - if( Request.Params:get("playerlist-kick") ~= "" ) then - local KickPlayerName = Request.Params:get("playerlist-kick") + if( Request.Params["playerlist-kick"] ~= nil ) then + local KickPlayerName = Request.Params["playerlist-kick"] local Player = World:GetPlayer( KickPlayerName ) if( Player == nil ) then Content = Content .. "

Could not find player " .. KickPlayerName .. " !

" diff --git a/Plugins/Core/web_reload.lua b/Plugins/Core/web_reload.lua index 45ed1a40b..3a59ad6b6 100644 --- a/Plugins/Core/web_reload.lua +++ b/Plugins/Core/web_reload.lua @@ -1,7 +1,7 @@ function HandleRequest_Reload( Request ) local Content = "" - if( Request.PostParams:get("reload") ~= "" ) then + if( Request.PostParams["reload"] ~= nil ) then Content = Content .. "" Content = Content .. "

Reloading plugins... This can take a while depending on the plugins you're using.

" cRoot:Get():GetPluginManager():ReloadPlugins() diff --git a/Plugins/Core/web_whitelist.lua b/Plugins/Core/web_whitelist.lua index 1a99a9f95..2c9ddb953 100644 --- a/Plugins/Core/web_whitelist.lua +++ b/Plugins/Core/web_whitelist.lua @@ -4,8 +4,8 @@ end function HandleRequest_WhiteList( Request ) local UpdateMessage = "" - if( Request.PostParams:get("whitelist-add") ~= "" ) then - local PlayerName = Request.PostParams:get("whitelist-add") + if( Request.PostParams["whitelist-add"] ~= nil ) then + local PlayerName = Request.PostParams["whitelist-add"] if( WhiteListIni:GetValueB("WhiteList", PlayerName, false) == true ) then UpdateMessage = "".. PlayerName.." is already on the whitelist" @@ -14,18 +14,18 @@ function HandleRequest_WhiteList( Request ) UpdateMessage = "Added " .. PlayerName .. " to whitelist." WhiteListIni:WriteFile() end - elseif( Request.PostParams:get("whitelist-delete") ~= "" ) then - local PlayerName = Request.PostParams:get("whitelist-delete") + elseif( Request.PostParams["whitelist-delete"] ~= nil ) then + local PlayerName = Request.PostParams["whitelist-delete"] WhiteListIni:DeleteValue( "WhiteList", PlayerName ) UpdateMessage = "Removed " .. PlayerName .. " from whitelist." WhiteListIni:WriteFile() - elseif( Request.PostParams:get("whitelist-reload") ~= "" ) then + elseif( Request.PostParams["whitelist-reload"] ~= nil ) then WhiteListIni:Erase() -- Empty entire loaded ini first, otherwise weird shit goes down WhiteListIni:ReadFile() UpdateMessage = "Loaded from disk" - elseif( Request.Params:get("whitelist-setenable") ~= "" ) then - local Enabled = Request.Params:get("whitelist-setenable"); - local CreateNewValue = false; + elseif( Request.Params["whitelist-setenable"] ~= nil ) then + local Enabled = Request.Params["whitelist-setenable"] + local CreateNewValue = false if( WhiteListIni:FindValue( WhiteListIni:FindKey("WhiteListSettings"), "WhiteListOn" ) == cIniFile.noID ) then -- Find out whether the value is in the ini CreateNewValue = true end -- cgit v1.2.3