You can find, download or submit Web Client Plugins here.

How to access LUA variables in client plugins

Tue May 19, 2015 7:03 pm

How to ?

I want to control the visibility and access to a client plugin. If the user accessing the FTP server from within my local network (defined by IP range) the user must see and activate the menu item but if the usre come from the internet the user may not see it. If it is possible to access LUA server variables i would be possible to du this.

Can anyone tell me how to do it.

Re: How to access LUA variables in client plugins

Wed May 20, 2015 2:45 am

Yes, you can get the client IP by the Lua global variable "_REMOTE_IP".

Re: How to access LUA variables in client plugins

Wed May 20, 2015 8:57 pm

Thanks, it works

To other, who need to create client menu entry. The code below control the IP number of the user, my WINGFTP server is behind a F5 proxy then all external users come from only one IP number. If they come from the Internet they do not have the menu entry. I they come from intranet they will see the menu entry.

local tab1 = {}
if _REMOTE_IP == "xx.xx.xx.xx" then a=""; else
tab1.plugin_enabled = true
tab1.extbutton_name = "User manager"
tab1.extbutton_func = "show_mydiv1()"
tab1.extbutton_icon = "plugins/User_Adm_1/icon3.png"
tab1.need_selectfile = false
tab1.exthtml = [[ <div id="commandUser" style="position:absolute; border:0; z-index:50; top:75px;
left:500px; width:150px; height:10px; padding:1px; text-align:center;
background:#FFFFFF; display:none; onclick="hide_mydiv1()";>
<form action="http://my-server:8080/" method="get"><input type="image" src="plugins/User_Adm_1/icon3.png" alt="User Manager" ></form>
tab1.extjs = [[
function show_mydiv1() { $("commandUser").style.display = "";}
function hide_mydiv1() { $("commandUser").style.display = "none";}