determinate determinate

Author Topic: PxWeb 1.0c LUA 5.11 [Strict] [API 2]  (Read 3647 times)

0 Members and 1 Guest are viewing this topic.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« on: October 21, 2007, 03:01:11 am »
Script Updated: 11/21/07

Code: [Select]
--[[
PxWeb 1.0c LUA 5.11 [Strict] [API 2]

By Mutor 07/21/07

Generates HTML pages for use with PtokaX/Other Web Server
-A total rewrite of pxstats

You can use this single script to:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

- Generates all required folders and files with no user intervention required.
- Display online users, recent chat, top shares, top uptimes, hub stats and file downloads.
- Offer file downloads by merely copying files to the download folder and restarting script.
- Display a list of hopefully useful web and dchub links.
- Provide an E-Mail contact link for users that may have been banned for bad pass etc.
- Edit site-wide style and colors through cascading style sheet.
- Provides MainText parameter which allows you to display text file on the main page.
- Provides Ad, a quickly ammenadable parameter that is appended to the text of MainText.
- Both MainText and Ad may contain escaped HTML code [links, images, email, etc.]

Note: This script will overwrite any existing files of the same name. Backup your
existing web server files if this is of concern to you. Users that haven't used the Px
web server , just set the server port on PtokaX -> Options tab, enable the server there
and start the script.

Changes from 1.0 08/03/07
+Added user commands and context menus [right click]
*User commands sent with ZPipe [saves b/w]
+Added command permission by profile per command
+Added report 'option' for status messages
+Added ASCII table & function
+Added startup and connect message
+Added error logging
~Fixed bum link to LUA-Users Wiki

Changes from 1.0b 10/13/07
+Converted for the new PtokaX API

]]

local Web = {
-- Name of hub owner
Owner = "Mutor",
-- Send status / error messages to Admin nick? "on"/"off" [If = "on", set OpNick]
Report = "on",
-- Admins nick for status / error messages [Report must = "on"]
OpNick = "Mutor",
-- Advert to display to all at startup and each new connection ["" = disabled]
Addy = "Please visit the hub's web site at http://mutor.no-ip.com:415",
-- Botname pulled from the hub or use "CustomName"
Bot = SetMan.GetString(21),
-- Bot description
Desc = "I generate HTML for the hub's web server.",
-- Bot/Website email address
Mail = "admin@mutor.no-ip.com",
-- Text file that will be displyed in main frame of homepage
-- [This path/file should reside in PtokaX folder in root or subdirectory]
-- Note: This file may contain [escaped LUA 'magic' chars] HTML code
-- ie. - "\<br\>\<a href=\"http://www.yourlink.com/image.jpg\">Image\</a\>"
MainText = "cfg/motd.txt",
-- Addendum to the MainText [will appear at end of file]. "" = disable
-- This text may contain [escaped LUA 'magic' chars] HTML code
Ad = "\<br\>\<a href=\"http://validator.w3.org/\"\>\n"..
"\<img src=\"http://www.w3.org/Icons/valid-html401-blue\" "..
"alt=\"Valid HTML 4.01 Frameset\" height=\"31\" width=\"88\" border=\"0\"\>\</a\>",
--"\n\<br\>\n\<img src=\"http://www.w3.org/Icons/valid-html401-blue\"\>\</a\>",
-- Links to display on the menu [idx] = {"http://linkaddress.com","Link Text"},
Links = {
[1] = {"http://ptokax.ath.cx/index.html","PtokaX DC Hub"},
[2] = {"http://bugtracker.ptokax.ath.cx/","The PtokaX Bugtracker"},
[3] = {"http://luaboard.sytes.net/index.php","The PtokaX Portal"},
[4] = {"http://uknnet.com/lua/index.php","The PtokaX LUA Board"},
[5] = {"http://wiki.ptokax.ath.cx/doku.php?id=homepage","The PtokaX Wiki"},
[6] = {"#","Hub Links:"},
[7] = {"dchub://ptokax-lua.damnserver.com:2006","PtokaX Admins Hub"},
--You can make a seperator like this [idx] = {"#","Separator Text"},
[8] = {"#","Reference:"},
[9] = {"http://www.lua.org/","LUA Home Page"},
[10] = {"http://www.lua.org/manual/5.1/","LUA 5.1 Ref. Manual"},
[11] = {"http://lua-users.org/wiki/","LUA-Users Wiki"},
[12] = {"http://luaforge.net/","LuaForge"},
[13] = {"http://validator.w3.org/","Validate This Page's HTML"},
},

--Short message for new logins
Greeting = "Welcome [usr]. It's nice of you to stop by...",
--Basic CSS Settings, use color codes or friendly color names
--See DoCss function for extended CSS settings
Style = {
--Font Family
font = "Verdana, Geneva, Arial, Helvetica, sans-serif",
--Font Color
fcolor = "Black",
--Background Color
bgcolor = "transparent",
--Background Image (Path and Filename)
bgimage = "",--images/bg.gif
--Link Color
lcolor = "Blue",
--Visited Link Color
vcolor = "Silver",
--Link Hover Color
hcolor = "Red",
--Show Table Borders? "yes" = enabled /"no" = disabled
tborder = "no",
},
}

OnStartup = function()
Web.Script,Web.HubPath,Web.Content = "PxWeb 1.0c",Core.GetPtokaXPath(),"motd.html"
Web.Body,Web.Foot,Web.ErrLog,Web.Refresh = "\</head\>\n\<body\>\n","\</body\>\n\</html\>",{}
Web.Downloads,Web.FileUrl,Web.Path = "..\\html\\webstats\\files","files","\\html\\webstats\\"
Web.Url = ".."..Web.Path:gsub("\\","/")
Web.Asc = {
[34]="&quot;",[38]="&amp;",[39]="&#39;",[60]="&lt;",[62]="&gt;",[94]="&circ;",[126]="&tilde;",[127]="&#127;",
[128]="&euro;",[130]="&sbquo;",[131]="&fnof;",[132]="&bdquo;",[133]="&hellip;",[134]="&dagger;",[135]="&Dagger;",
[136]="&circ;",[137]="&permil;",[138]="&Scaron;",[139]="&lsaquo;",[140]="&OElig;",[142]="&#381;",[145]="&lsquo;",
[146]="&rsquo;",[147]="&ldquo;",[148]="&rdquo;",[149]="&bull;",[150]="&ndash;",[151]="&mdash;",[152]="&tilde;",
[153]="&trade;",[154]="&scaron;",[155]="&rsaquo;",[156]="&oelig;",[157]="&#356;",[158]="&#382;",[159]="&Yuml;",
[160]="&nbsp;",[161]="&#711;",[162]="&#728;",[163]="&#321;",[164]="&curren;",[165]="&#260;",[166]="&brvbar;",
[167]="&sect;",[168]="&uml;",[169]="&copy;",[170]="&#350;",[171]="&laquo;",[172]="&not;",[173]="&shy;",
[174]="&reg;",[175]="&#379;",[176]="&deg;",[177]="&plusmn;",[178]="&sup2;",[179]="&#322;",[180]="&acute;",
[181]="&micro;",[182]="&para;",[183]="&middot;",[184]="&cedil;",[185]="&#261;",[186]="&#351;",[187]="&raquo;",
[188]="&#317;",[189]="&#733;",[190]="&#318;",[191]="&#380;",[192]="&#340;",[193]="&Aacute;",[194]="&Acirc;",
[195]="&#258;",[196]="&Auml;",[197]="&#313;",[198]="&#262;",[199]="&Ccedil;",[200]="&#268;",[201]="&Eacute;",
[202]="&#280;",[203]="&Euml;",[204]="&#282;",[205]="&Iacute;",[206]="&Icirc;",[207]="&#270;",[208]="&#272;",
[209]="&#323;",[210]="&#327;",[211]="&Oacute;",[212]="&Ocirc;",[213]="&#336;",[214]="&Ouml;",[215]="&times;",
[216]="&#344;",[217]="&#366;",[218]="&Uacute;",[219]="&#368;",[220]="&Uuml;",[221]="&Yacute;",[222]="&#354;",
[223]="&szlig;",[224]="&agrave;",[225]="&aacute;",[226]="&acirc;",[227]="&#259;",[228]="&auml;",[229]="&#314;",
[230]="&#263;",[231]="&ccedil;",[232]="&#269;",[233]="&eacute;",[234]="&#281;",[235]="&euml;",[236]="&#283;",
[237]="&iacute;",[238]="&icirc;",[239]="&#271;",[240]="&#273;",[241]="&#324;",[242]="&#328;",[243]="&oacute;",
[244]="&ocirc;",[245]="&#337;",[246]="&ouml;",[247]="&divide;",[248]="&#345;",[249]="&#367;",[250]="&uacute;",
[251]="&#369;",[252]="&uuml;",[253]="&yacute;",[254]="&#355;",[255]="&#729;"
}
Web.Timer = TmrMan.AddTimer(60000)
local r,e = os.rename("web","web")
if e then
if not e:find("Permission denied") then
os.execute("md web")
end
end
Initialize()
DoCss()
DoRoot(1)
DoTabs(1)
Web.Refresh = true
Initialize,DoCss,DoRoot,Web.Links,Web.Style,Copy = nil,nil,nil,nil,nil,nil
collectgarbage("collect")
if Web.Addy ~= "" then
Core.SendToAll("<"..Web.Bot.."> "..Web.Addy)
end
OnError(Web.Script.." has been started. Memory usage: "..string.format("%.2f Kb.",collectgarbage("count")))
end

OnExit = function()
DoTabs(1,Web.Site[1])
local time = os.time()
for _,v in ipairs(Times) do
v[3] = (time - v[2]) + v[3]
v[2] = time
v[4] = 0
end
SaveToFile(Web.Site[3][2],Shares,"Shares")
SaveToFile(Web.Site[2][2],Chat ,"Chat")
collectgarbage("collect")
OnError(Web.Script.." has been stopped, freeing "..
string.format("%.2f Kb.",collectgarbage("count")).." of memory.")
end

OnError = function(msg)
local stamp = os.date()
table.insert(Web.ErrLog,{stamp,msg})
if Web.Report == "on" and Web.OpNick ~= "" then
Core.SendToNick(Web.OpNick,"<"..Web.Bot.."> "..msg)
end
end

OnTimer = function(Id)
if Id == Web.Timer then
SaveToFile(Web.Site[2][2],Chat ,"Chat")
if next(Web.ErrLog) then
SaveToFile("web/errlog.web",Web.ErrLog,"Web.ErrLog")
Web.ErrLog = {}
end
DoTabs(1)
collectgarbage("collect")
end
end

UserConnected = function(user)
DoTabs(1,Web.Site[1]) DoTabs(1,Web.Site[3]) DoTabs(1,Web.Site[4],user.sNick)
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Greeting:gsub("%b[]",user.sNick))
if Web.Addy ~= "" then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Addy)
end
if user.iProfile ~= -1 then
if GenCmds(user) then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Script.." commands enabled, see hub tab for more.")
end
end
end
OpConnected,RegConnected = UserConnected,UserConnected

UserDisconnected = function(user)
DoTabs(1,Web.Site[1]) DoTabs(1,Web.Site[4],user.sNick)
end
OpDisconnected = UserDisconnected

ChatArrival = function(user, data)
local _,_,pfx = data:find("^%b<> (%p)%w+")
if not pfx then
local _,_,txt = data:find("^%b<> (.*)|$")
if txt and txt:len() >= 2 then
data = DoAscii(data:sub(1,-2))
local now = string.lower(os.date("[%I:%M %p]"))
table.insert(Chat,{now,data})
if #Chat > 100 then
table.remove(Chat,1)
end
end
else
local _,_,cmd = data:find("^%b<> %p(%a+)")
if cmd then
local str
for i,v in ipairs(Web.Site) do
if cmd:lower() == v[1]:lower() then
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
str = "\r\n\r\n\t"..v[4].."\r\n\t"..string.rep("¯",v[4]:len()).."\r\n"
for idx,val in ipairs(v[6]()) do
if cmd:lower() == "chat" or cmd:lower() == "hubstats" then
str = str..val.."\r\n"
else
str = str.."\t"..idx.."\t"..val.."\r\n"
end
end
str = str.."\r\n"
return Core.SendPmToNick(user.sNick,Web.Bot,str),true
else
local prof
if u.iProfile ~= -1 then
prof = ProfMan.GetProfile(u.iProfile).sProfileName
else
prof = "Unregistered User"
end
local pfx = SetMan.GetString(29):sub(1,1) or "+"
local msg = "Sorry "..user.sNick..", "..prof.."'s are "..
"not allowed use of the "..pfx..cmd:lower().." command."
return Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..msg),
Core.SendPmToNick(user.sNick,Web.Bot,msg),true
end
end
end
end
end
end
ToArrival = ChatArrival

Initialize = function()
local topic,desc = SetMan.GetString(10) or "",SetMan.GetString(5) or ""
local HubApp,HubVer = "PtokaX", Core.Version
Web.Root = {
[1] = {"index.html","Index"},
[2] = {"top.html","Top"},
[3] = {"main.html","Main"},
[4] = {"bottom.html","Bottom"},
[5] = {"left.html","Menu"},
[6] = {"pxstyle.css","CSS"}
}
Web.Site = {
[1] = {"Users","web/users.web","users.html","Online Users",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"\<b\>Profile\</b\>","\<b\>User Nick\</b\>"..s})
table.insert(x,{" "," "})
Users = {}
for i,u in ipairs(t) do
local p
if u.iProfile ~= -1 then
p = ProfMan.GetProfile(u.iProfile).sProfileName
else
p = "Unregistered User"
end
table.insert(x,{p,u.sNick})
table.insert(Users,{p,u.sNick})
end
SaveToFile(Web.Site[1][2],Users,"Users")
end
return Web.Head..Web.Css.."\<meta http-equiv=\"refresh\" content=\"60\"\>\n"..
Web.Body..GenTab(x,Web.Site[1][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Users) do
table.insert(t,table.concat(v," "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[2] = {"Chat","web/chat.web","chat.html","Recent Chat",
function()
local t,x = Chat,{}
if next(t) then
table.insert(x,{"\<b\>Time\</b\>","\<b\>Chat Message\</b\>"})
table.insert(x,{" "," "})
for i,v in ipairs(t) do
table.insert(x,{v[1],v[2]})
end
end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
return Web.Head..Web.Css.."\<meta http-equiv=\"refresh\" content=\"10\"\>\n"..
Web.Body..GenTab(x,Web.Site[2][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,"\t"..v[1].."  "..DoAscii(v[2],1):gsub("\r\n","%1\t\t   "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[3] = {"Shares","web/shares.web","shares.html","Top Shares",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"\<b\>User Nick\</b\>","\<b\>Share Value\</b\>"..s})
table.insert(x,{" "," "})
for i,u in ipairs(t) do
if Core.GetUserAllData(u) then
local exist
if next(Shares) then
for _,v in ipairs(Shares) do
if v[1]:lower() == u.sNick:lower() then
v[2] = u.iShareSize
exist = true
break
end
end
end
if not exist then
table.insert(Shares,{u.sNick,u.iShareSize})
end
end
end
table.sort(Shares, function(a,b)return a[2] > b[2] end)
SaveToFile(Web.Site[3][2],Shares,"Shares")
if next(Shares) then
for z = 1, math.min(#Shares,10) do
if Shares[z][2] > 0 then
table.insert(x,{Shares[z][1],FmtSz(Shares[z][2])})
end
end
end
end
return Web.Head..Web.Css.."\<meta http-equiv=\"refresh\" content=\"60\"\>\n"..
Web.Body..GenTab(x,Web.Site[3][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Shares) do
if v[2] > 0 then table.insert(t,FmtSz(v[2]).."\t\t"..v[1]) end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[4] = {"Times","web/times.web","times.html","Top Uptimes",
function(nick)
local t,x,time = Core.GetOnlineUsers(),{},os.time()
if t and next(t) or nick then
table.insert(x,{"\<b\>User Nick\</b\>","\<b\>Uptime Value\</b\>"})
table.insert(x,{" "," "})
if nick then
for _,v in ipairs(Times) do
local z = 0
if v[1]:lower() == nick:lower() then
exist = true
if Core.GetUser(nick) then
z = 1
v[2] = time
v[4] = z
else
v[3] = (time - v[2]) + v[3]
v[4] = z
end
break
end
end
else
for i,u in ipairs(t) do
local exist
for _,v in ipairs(Times) do
if v[1]:lower() == u.sNick:lower() then
exist = true
if Web.Refresh then
v[3] = (time - v[2]) + v[3]
v[2] = time
end
v[4] = 1
break
end
end
if not exist then
table.insert(Times,{u.sNick,time,0,1})
end
end
end
table.sort(Times, function(a,b)return a[3] > b[3] end)
SaveToFile(Web.Site[4][2],Times,"Times")
if next(Times) then
for z = 1, math.min(#Times,10) do
if (time - Times[z][3]) > 0 then
table.insert(x,{Times[z][1],Convert(time - Times[z][3])})
end
end
end
end
return Web.Head..Web.Css.."\<meta http-equiv=\"refresh\" content=\"600\"\>\n"..
Web.Body..GenTab(x,Web.Site[4][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(Times) do
if v[2] > 0 and v[3] > 0 then
table.insert(t,string.format("%-50.30s",v[1]).." \t•"..Convert(time - v[3]))
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[5] = {"HubStats","web/stats.web","stats.html","Hub Statistics",
function()
local b,m = "&nbsp;","Public, unregistered users welcome."
local topic = SetMan.GetString(10) or "There is no current topic."
local sr,hr,ss,hs = Chk(SetMan.GetNumber(8)),Chk(SetMan.GetNumber(7)),"slot","hub"
if SetMan.GetBool(5) then m = "Private, registered users only." end
if sr and type(sr) == "number" and sr > 1 then ss = ss.."s" end
if hr and type(hr) == "number" and hr > 1 then hs = hs.."s" end
  local t = {
[1] = {b.."Hub Name:",SetMan.GetString(0)},
[2] = {b.."Hub Desc.:",SetMan.GetString(5)..""},
[3] = {b.."Hub Topic:",topic..""},
[4] = {b.."Hub Time:",os.date("%B %d %Y %X")..""},
[5] = {b.."HubOwner:",Web.Owner..""},
[6] = {b.."Hub Uptime:",Convert(os.time() - Core.GetUpTime())..""},
[7] = {b.."Min Share:",FmtSz(SetMan.GetMinShare())..""},
[8] = {b.."Min Slots:",Chk(SetMan.GetNumber(5)).." per user."},
[9] = {b.."Max Slots:",Chk(SetMan.GetNumber(6)).." per user."},
[10] = {b.."Slot Ratio:",sr.." "..ss.." per "..hr.." "..hs.."."},
[11] = {b.."Max Hubs:",Chk(SetMan.GetNumber(9)).." per user."},
[12] = {b.."Peak Users:",Core.GetMaxUsersPeak()},
[13] = {b.."Hub Share:",FmtSz(Core.GetCurrentSharedSize())},
[14] = {b.."There Are:",#Core.GetOnlineUsers().." of a possible "..SetMan.GetNumber(0).." users online."},
[15] = {b.."Hub Mode:",m},
}
table.insert(t,1,{" "," "})
SaveToFile(Web.Site[5][2],t ,Web.Site[5][1])
return Web.Head..Web.Css.."\<meta http-equiv=\"refresh\" content=\"60\"\>\n"..
Web.Body..GenTab(t,Web.Site[5][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(HubStats) do
if i > 1 then
table.insert(t,"\t"..string.format("%-20.15s",v[1]:gsub("&nbsp;"," ")).."\t•"..v[2])
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[6] = {"Downloads","web/files.web","files.html","File Downloads",
function()
if not Web.Refresh then
local dirlist,path,url,t = "files.lst",Web.Downloads,Web.FileUrl,{}
os.execute("dir "..path.." /o:gn > "..dirlist)
Downloads = {}
for line in io.lines(dirlist) do
if line:find("^[%d]") and not line:find("%b<>") and not line:find("%b()") then
for date,time,size,name in line:gmatch("(%S+)%s+([0-9:]+ [pPaAmM]+)%s+(%S+)%s+(.+)$") do
time = time:gsub("%s%s+","")
local ren = name:gsub(" ","_")
os.rename(path.."\\"..name,path.."\\"..ren)
table.insert(Downloads,{time,date,FmtSz(size:gsub("%,","")),"\<a href=\""..url.."/"..ren.."\"/>"..name.."\</a\>"})
table.insert(t,{time,date,FmtSz(size:gsub("%,","")),"\<a href=\""..url.."/"..ren.."\"/>"..name.."\</a\>"})
end
end
end
os.remove(dirlist)
table.insert(t,1,{"\<b\>Time\</b\>","\<b\>Date\</b\>","\<b\>Size\</b\>","\<b\>Name\</b\>"})
table.insert(t,2,{" "," "," "," "})
SaveToFile(Web.Site[6][2],Downloads,"Downloads")
return Web.Head..Web.Css..Web.Body..GenTab(t,Web.Site[6][4],1)..Web.Foot
end
end,
function()
local t = {}
for i,v in ipairs(Downloads) do
local _,_,file = v[4]:find("%>(%S+)%</")
if file then
table.insert(t,file.."\t("..v[3]..")")
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
}
Web.Head = "\<html\>\n\<head\>\n\<title\>"..SetMan.GetString(0).." - ‹›\</title\>\n"..
"\<meta http-equiv=page-enter content=\"blendTrans(Duration=2)\"\>\n"..
"\<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"\>\n"..
"\<meta name=robots content=\"noindex,nofollow\"\>\n"..
"\<meta http-equiv=pragma content=no-cache\>\n"..
"\<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\"\>\n"..
"\<link rel=\"shortcut icon\" href=\"favicon.ico\"\>\n"
Web.Frame = "\<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n"..
"\"http://www.w3.org/TR/html4/frameset.dtd\"\>\n"..Web.Head
Web.Head = "\<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"..
"\"http://www.w3.org/TR/html4/loose.dtd\"\>\n"..Web.Head
Web.Css = "\<link rel=\"stylesheet\" href=\""..Web.Root[6][1].."\" type=\"text/css\"\>\n"
--Index
Web.Root[1][3] = Web.Frame.."\</head\>\n\<frameset rows=\"130,*,45\" cols=\"*\"\>\n"..
"\<frame name=\"top\" src=\"top.html\" scrolling=\"no\" frameborder=\"0\"\>\n"..
"\<frameset cols=\"200,800\" rows=\"*\" \>\n"..
"\<frame name=\"menu\" src=\"left.html\" scrolling=\"no\" frameborder=\"0\"\>\n"..
"\<frame name=\"contents\" src=\"main.html\" scrolling=\"no\" frameborder=\"0\"\>\n\</frameset\>\n"..
"\<frame name=\"bottom\" scrolling=\"no\" noresize src=\"bottom.html\" frameborder=\"0\"\>\n"..
"\<noframes\>\n\<p\>This document uses frames, but your browser doesn't support them.\</p\>\n"..
"\</noframes\>\n\</frameset\>\n</html\>"
--Top
Web.Root[2][3] = Web.Head..Web.Css.."\</head\>\n\<body\>\n"..
"\<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"..
"\<tr\>\n\<td class=\"table0\" align=\"left\"\>"..
"&nbsp;\<script type=\"text/javascript\"\>document.write(Date())\</script\>\</td\>\n\</tr\>\n"..
"\<tr\>\n\<td class=\"table1\" align=\"right\"\>"..HubApp.." "..HubVer..": "..desc.."&nbsp;&nbsp;&nbsp;\</td\>\n\</tr\>\n"..
"\<tr align=\"center\" valign=\"top\"\>\n\<td class=\"table3\"\>\n\<div align=\"center\"\>\n\<h1\>"..
SetMan.GetString(0).."\</h1\>\n\<h3\>..."..topic.."\</h3\>\n\</div\>\n\</td\>\n\</tr\>\n\</table\>\n"..
Web.Foot
--Main
Web.Root[3][3] = Web.Head..Web.Css..Web.Body..
"\<table width=\"100%\" height=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"\>\n"..
"\<tr\>\<td class=\"table1\" valign=\"top\" align=\"left\"\>.:: "..Web.Root[3][2].." ::.\</td\>\n\</tr\>"..
"\</table\>\n\<iframe name=\"main\" class=\"table2\" scrolling=yes width=\"100%\" "..
"height=\"400\" align=\"left\" frameborder=\"0\" src=\""..Web.Content.."\"\>\</iframe\>\n"..Web.Foot
--Bottom
Web.Root[4][3] = Web.Head..Web.Css..Web.Body..
"\<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"..
"\<tr\>\n\<td class=\"table1\" align=\"left\" colspan=\"2\" \>\</td\>\n\</tr\>\n\<tr\>\n"..
"\<td class=\"table0\" align=\"center\" colspan=\"2\" \>\<script type=\"text/javascript\"\>"..
"document.write(\"You're using: \"+navigator.appName+\" \"+navigator.appCodeName+\" \"+navigator.appVersion+\"\");\n"..
"\</script\>\n\</td\>\n\</tr\>\n\</table\>\n"..Web.Foot
--Left - Menu
Web.Root[5][3] = Web.Head..Web.Css..Web.Body..
"\<table width=\"95%\" align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"..
"\<tr\>\<td class=\"table1\"\>.:: Menu ::.\</td\>\</tr\>\n\<tr valign=\"top\"\>\n\<td class=\"table2\"\>"..
"\<a href=\"#\" class=\"menu\" target=\"_self\"\>Navigation:\</a\>\n\<br\>\<a href=\"index.html\" target=\"_top\"\>Home\</a\>\n"
for i,v in ipairs(Web.Site) do
Web.Root[5][3] = Web.Root[5][3].."\<br\>\<a href=\""..
v[3].."\" target=\"main\"\>"..v[4].."\</a\>\n"
end
local t = {
[1] = {"Connect to Hub","dchub://"..SetMan.GetString(2)..":"..SetMan.GetString(3):gsub("%;.*$","")},
[2] = {"Contact","mailto:"..Web.Mail.."?subject=About the "..SetMan.GetString(0).." website&amp;body=Dear "..Web.Owner..","},
}
t[2][2] = t[2][2]:gsub(" ","%%20")
for i,v in ipairs(t) do
Web.Root[5][3] = Web.Root[5][3].."\<br\>\<a href=\""..
v[2].."\" target=\"main\"\>"..v[1].."\</a\>\n"
end
Web.Root[5][3] = Web.Root[5][3].."\<br\>\<a href=\"#\" class=\"menu\" target=\"_self\"\>Web Links:\</a\>\n"
for i,v in ipairs(Web.Links) do
local url = v[1]:gsub(" ","%%20")
Web.Root[5][3] = Web.Root[5][3].."\<br\>\<a href=\""..url.."\" "
if v[1] == "#" or v[1]:find("dchub://") then
if v[1] == "#" then
Web.Root[5][3] = Web.Root[5][3].."class=\"menu\" "
end
Web.Root[5][3] = Web.Root[5][3].."target=\"_self\"\>"
else
Web.Root[5][3] = Web.Root[5][3].."target=\"_blank\"\>"
end
Web.Root[5][3] = Web.Root[5][3]..v[2].."\</a\>\n"
end
Web.Root[5][3] = Web.Root[5][3].."\</td\>\</tr\>\n\</table\>\n"..Web.Foot
local HubDir = Web.HubPath:gsub("/","\\\\")
local tab = {}
for dir in string.gmatch(Web.Path.."images\\","(%a+)\\") do
table.insert(tab,dir)
end
local CheckDir = HubDir..table.concat(tab,"\\\\")
if not os.rename(CheckDir,CheckDir) then
for _,folder in ipairs(tab) do
HubDir = HubDir..folder
if not os.rename(HubDir,HubDir) then
os.execute("md "..HubDir)
HubDir = HubDir.."\\\\"
end
end
end
Copy(Web.HubPath..Web.MainText,Web.HubPath.."html/webstats/"..Web.Content)
local FileDir,FirstStart = Web.HubPath:gsub("/","\\\\")..Web.Path.."files",true
local r,e = os.rename(FileDir,FileDir)
if e then
if not e:find("Permission denied") then
os.execute("md "..FileDir)
end
else
FirstStart = false
end
local sample = Web.HubPath.."html/webstats/files/Setting_Up_Downloads.txt"
if FirstStart and not os.rename(sample,sample) then
local directions = "Simply copy your files to this folder "..
"[ Default = C:\\Ptokax\\html\\webstats\\files ]\nThen restart this "..
"script and reload the dowloads page to see the new files you've added.\n"..
"You may delete this file at any time.\r\n\r\n"..string.rep(string.char(9),6).." -Mutor"
local f,e = io.open(sample,"w")
if f then
f:write(directions) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end
end

GenTab = function(t,s,noidx)
local txt = "\<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"
if s then
txt = txt.."\t\<tr\>\<td class=\"table0\" valign=\"top\"\>.:: "..s.." ::.\</td\>\</tr\>\</table\>\n"
else
txt = txt.."\t\<tr\>\<td class=\"table0\" valign=\"top\">&nbsp;\</td\>\</tr\>\n"
end
txt = txt.."\<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>"
if next(t) then
for i,v in ipairs(t) do
if noidx then
txt = txt.."\n\t\<tr height=\"12\" align=\"left\" valign=\"top\"\>"
else
txt = txt.."\n\t\<tr height=\"12\" align=\"left\" valign=\"top\"\>"..
"\<td class=\"table3\" width=\"5\"%\>&nbsp;"..i.."\</td\>"
end
if type(v) == "table" then
local z = #v
for x=1, z do
if x < z then
txt = txt.."\<td class=\"table3\" width=\""..(12*x)..
"%\"\>&nbsp;"..v[x].."\</b\></td\>"
else
local s = (100 - (x*12))
txt = txt.."\<td class=\"table3\"width=\""..s.."%\"\>&nbsp;"..v[x].."\</td\>"
end
end
else
txt = txt.."\<td class=\"table3\" width=\"90\"%\>&nbsp;"..v.."\</td\>"
end
end
txt = txt.."\</tr\>\n"
else
txt = txt.."\t\<tr\>\<td\> No\</td\>\n\<td\>Data\</td\>\n\</tr\>\n"
end
txt = txt.."\</table\>\n\<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"..
"\t\<tr\>\<td class=\"table2\" valign=\"top\">\</td\>\</tr\>\n\</table\>\n"
return txt
end

DoHtml = function(file,title,body)
local method = "updated"
if not os.rename(file,file) then method = "saved" end
body = body:gsub("%b‹›",title)
local f,e = io.open(file,"w")
if f then
if not Web.Refresh then
OnError(title.." has been "..method)
end
f:write(body) f:flush() f:close()
else
OnError(e:sub(1,2))
end
end

DoRoot = function(x)
for i,v in ipairs(Web.Root) do
if v[3] then
if x or not os.rename(Web.Url..v[1],Web.Url..v[1]) then
DoHtml(Web.Url..v[1],v[2],v[3])
end
end
end
end

DoTabs = function(x,t,n)
if x and t and n then
if t[5] then
local html = t[5](n)
if html then
DoHtml(Web.Url..t[3],t[4],html)
end
end
else
for i,v in ipairs(Web.Site) do
local tab = v[1]
if loadfile(v[2]) then
dofile(v[2])
if v[1] == "Chat" and next(Chat) then
if Chat[1][3] then
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,{v[1],"&lt;"..v[2].."&gt; "..
DoAscii(v[3]:gsub("&bull;",""))})
end
Chat = t

end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
end
else
tab = {}
SaveToFile(v[2],tab,v[1])
dofile(v[2])
end
if x or not os.rename(Web.Url..v[3],Web.Url..v[3]) then
if v[5] then
local html = v[5]()
if html then
DoHtml(Web.Url..v[3],v[4],html)
end
end
end
end
end
end

DoCss = function()
local css = "body {\n"..
"\tcolor: "..Web.Style.fcolor..";\n"..
"\tfont-family: "..Web.Style.font..";\n"..
"\tbackground-image: url("..Web.Style.bgimage..");\n"..
"\tbackground-repeat: repeat;\n"..
"\tbackground-color: "..Web.Style.bgcolor..";\n"..
"}\n"..
"a:link {\n"..
"\tcolor: "..Web.Style.lcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:visited {\n"..
"\tcolor: "..Web.Style.vcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:hover {\n"..
"\tcolor: "..Web.Style.hcolor..";\n"..
"\ttext-decoration: underline overline;\n"..
"}\n"..
"a.menu:link {\n"..
"\tcolor: #E9E9F8;\n"..
"\ttext-decoration: none;\n"..
"\twidth: 100%;\n"..
"\tbackground: #1E2580;\n"..
"}\n"..
".table0 {\n"..
"\theight: 12px;\n"..
"\tcolor: #E9E9F8;\n"..
"\tfont-size : 12px;\n"..
"\tbackground-color : #1E2580;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table1 {\n"..
"\theight: 12px;\n"..
"\ttext-indent: 5px;\n"..
"\tcolor : White;\n"..
"\tfont-size : 12px;\n"..
"\tbackground : #8784C6;\n"
if Web.Style.tborders == "yes" then
css = css.."\tbackground-color : #8784C6;\n"..
"\tborder-bottom: 2px solid Black;\n"..
"\tborder-left: 1px solid Black;\n"..
"\tborder-right: 1px solid Black;\n"..
"\tborder-top: 1px solid Black;\n"
end
css = css.."}\n"..
".table2 {\n"..
"\theight: 400px;\n"..
"\twidth: 100%;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table3 {\n"..
"\theight: 12px;\n"..
--"\twidth: auto;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}"
local f,e = io.open(Web.Url..Web.Root[6][1], "w")
if f then
f:write(css) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end

function Chk(enable)
if enable == "" or not enable then enable = "not set" end
return enable
end

FmtSz = function(int)
local i,u,x=tonumber(int) or 0,{"","K","M","G","T","P"},1
while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x])
end

Convert = function(time)
time = time or 0
local s,x,n,tab = "",0,os.time(),{
[1] = {31556926,"year"},
[2] = {2592000,"month"},
[3] = {604800,"week"},
[4] = {86400,"day"},
[5] = {3600,"hour"},
[6] = {60,"minute"},
[7] = {1,"second"}
}
if time > 0 then
if time < 2145876659 then
if n > time then
time = n - time
for i,v in ipairs(tab) do
if time > v[1] then
x = math.floor(time/v[1])
if x > 1 then v[2] = v[2].."s" end
if x > 0 then
s = s..x.." "..v[2]..", "
time = time-x*v[1]
end
end
end
end
collectgarbage("collect")
return s:sub(1,-3)
else
return "Invalid date or time supplied. [must be pre 12/31/2037]"
end
else
return "No uptime recorded"
end
end

Copy = function(source,target)
local is,os,text
local f,e = io.open(source)
if f then
text,is = f:read("*a"),f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
if text then
local f,e = io.open(target,"w")
if f then
text = Web.Head:gsub("%b‹›","MOTD")..Web.Css..Web.Body..
"\<table class=\"table2\" bgcolor=\"#E9E9F8\" width=\"100%\" "..
"border=\"0\" cellspacing=\"0\" cellpadding=\"0\"\>\n"..
"\<tr\>\<td class=\"table3\" valign=\"top\"\>\n\<pre\>"..text..Web.Ad.."\</pre\>"..
"\n\</td\>\</tr\>\n\</table\>\n"..Web.Foot
f:write(text) f:flush() os = f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
end
end

--Replace certain characters with html ASCII code & vice versa
DoAscii = function(data,rev)
if rev then
for i,v in pairs(Web.Asc) do
data = data:gsub(v,string.char(i))
end
return data
else
for chr in data:gmatch(".") do
local x = Web.Asc[string.byte(chr)]
if x then
data = data:gsub(chr,x)
end
end
return data
end
end

GenCmds = function(user)
local c,t,x = "",{}
local p,m,s = SetMan.GetString(29):sub(1,1),SetMan.GetString(0),Web.Script
for i,v in ipairs(Web.Site) do
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
x = true
c = c.."$UserCommand 1 1 "..m.."\\"..s.."\\"..
v[4].."$<%[mynick]> "..p..v[1]:lower().."&#124;|"
end
end
if x then
Core.SendToNick(user.sNick,c:sub(1,-2))
return x
end
end

function Serialize(tTable, sTableName, sTab)
sTab = sTab or ""
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in ipairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t")
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
local handle = io.open(file,"w")
handle:write(Serialize(table, tablename)) handle:flush() handle:close()
end
« Last Edit: November 21, 2007, 09:47:55 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #1 on: November 17, 2007, 10:30:33 pm »
Does the rightclicker get sent in this version  ...  I get the message on connect to see hub tab for more.
But commands dont appear  ...

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #2 on: November 18, 2007, 12:53:50 am »
Commands are enabled by profile, per command.
They are sent by Zpipe, if enabled and you don't
get them then it's a failing in your client.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #3 on: November 18, 2007, 09:25:16 am »
Ok thx for reply  .....  But can i ask which client you use ... 
i have now tested with 3 differant clients (czdc++ , dc++ ,crzdc++) and not 1 of these get cmds .

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 245
  • Karma: +206/-17
  • PtokaX "developer"
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #4 on: November 18, 2007, 09:49:59 am »
Working for me, usercommands are in menu on hub tab :P

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #5 on: November 18, 2007, 10:02:46 am »
Ok  ill go thought my settings again .....
Just noticed that since i last reboot pc that none of the clients show messages in the kick bar either

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #6 on: November 18, 2007, 02:40:20 pm »
As a general rule, I write user commands to be DC protocol compliant
and I send them with Zpipe to save some b/w. Any compliant client
should have no problem. Apex, Zion and a handful of other mods are not
100% compliant. DC++, CzDc++ are compliant. If user commands fail
with these then I would assume your hub settings or another script
may be the source of your problem.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #7 on: November 18, 2007, 02:48:01 pm »
Yeah  im narrow'in the prob down    .....     All was working fine lastnight ... but now i got no kick bar message ( popup message from kickbar)
And some othe RC cmds dont appear ....  Ive done fresh install of clients and set test hub up with no scripts running .Still no joy ...
So it must be some pc setting messed up somewhere ... but apart from setting new printer/scanner up ive not altered a thing.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #8 on: November 18, 2007, 03:44:28 pm »
System changes like that aren't really relative.
Check your client settings like accept suer commands
from the hub, filter kick and debug messages etc...
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline DarkElf

  • Forum Ace
  • *****
  • Posts: 97
  • Karma: +10/-0
  • GoTTa HaCk'Em All!!!
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #9 on: November 21, 2007, 10:57:59 am »
it work good, great work but i got those errors in the syte:

Hub statistics:
Hub Name:    Admin
  Hub Desc.:    min 100Gb ][ MeGaShArE NeWsTyLe @ Iƒ§ - ƒu§iøN N€†
  Hub Topic:    GoTTa HaCk'Em All
  Hub Time:    November 21 2007 10:55:26
  HubOwner:    SickHead
  Hub Uptime:    3 minutes, 11 seconds
  Min Share:    100.00 GB.
  Min Slots:    0 per user.
  Max Slots:    0 per user.
  Slot Ratio:    0 slot per 0 hub.
  Max Hubs:    0 per user.
  Peak Users:    1
  Hub Share:    8.03 GB.
  There Are:    1 of a possible 1234 users online.
  Hub Mode:    Public, unregistered users welcome.

where my hubname is: 100Gb ][ MeGaShArE NeWsTyLe - Úñdè®Ðå®k Hµb@ Iƒ§ - ƒu§iøN N€†

then

Connect to hub link: dchub://xxx.xxx-xxx.xxx:1209;411;4111;412;2000;2007;500;666;999

it use all my ports so the link do not work
Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ Iƒ§ - ƒu§iøN Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ Iƒ§ - ƒu§iøN }=- N€†Owner

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #10 on: November 21, 2007, 06:04:22 pm »
Make sure that your sever is allowing the ports . PtokaX does not have a web server anymore so the hub ports wont work for the webpage.

P.S  Mutor i got mine working again ,after i uninstalled the printer.


Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #11 on: November 21, 2007, 09:50:37 pm »
where my hubname is: ...
it use all my ports so the link do not work...

Thanks for the report, script above , corrected and updated.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #12 on: November 24, 2007, 01:10:51 pm »
Since updating fixed version my files dont appear in the file download html
Ive also tried a freah start but that has not fixed it either ... the files dont get listed in the folder web/files page either .

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #13 on: November 24, 2007, 02:51:26 pm »
There is no malfunction of the script. Only the 2 bugs posted were changed.
Temporary Demo on PtokaX 0.3.6.0i

Check your path settings:
Code: [Select]
Web.Downloads,Web.FileUrl,Web.Path = "..\\html\\webstats\\files","files","\\html\\webstats\\"These default settings may be different from your needs, in fact from your post [web/files] we know they are.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #14 on: November 24, 2007, 03:22:51 pm »
yeah thats right  ....  i think im having 1 of those days     the webreg server doesnt seem to be working right either , so im having to go thought all setting.It says error on the web page and the downloads doesnt show .. but in hub i get webreg successfully added nicks to registered users.
So i think error is from here somewhere.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #15 on: November 24, 2007, 03:36:05 pm »
I'm pretty sure of that. Also bear in mind that both may index files.
Ensure that neither is stepping on the function of the other.
Common path setting will quell both.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #16 on: November 24, 2007, 11:50:29 pm »
Right ive got webreg working right again http://twisteds-soul.no-ip.org:8080/register.htm and i got the downloads working with it ok too..
But for the life of me i cant get the downloads to work on the pxstats  ive just got the script again , so i can make sure its all the same..
im using the same folder for webreg as pxstats for downloads ....  but its still not getting them .... i get this in main when i start the script
Code: [Select]
[20071124 - 22:46:32] <Twisted's-Soul> Index has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Top has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Main has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Bottom has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Menu has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Online Users has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Recent Chat has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Top Shares has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Top Uptimes has been updated
[20071124 - 22:46:32] <Twisted's-Soul> Hub Statistics has been updated
[20071124 - 22:46:32] <Twisted's-Soul> File Downloads has been updated
but the Web.FileUrl has this
Code: [Select]
Downloads = {
}
any pointers please ... 

Edited ---
After fresh hub and only this script running i get following error

[23:15] Syntax PxWeb 1.0c LUA 5.11 [Strict] [API 2].lua:115: attempt to index field 'Path' (a nil value)
[23:15] Script started.

With this in main chat

[20071124 - 23:15:56] <{-WebSite-}> PxWeb 1.0c LUA 5.11 [Strict] [API 2].lua:158: attempt to index field 'Site' (a nil value)
[20071124 - 23:15:57] <{-WebSite-}> PxWeb 1.0c LUA 5.11 [Strict] [API 2].lua:115: attempt to index field 'Path' (a nil value)
« Last Edit: November 25, 2007, 12:17:36 am by TwîsTèd-dèvîl »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #17 on: November 25, 2007, 04:33:01 am »
Path is not a valid variable, Web.Path is.
Also, you should NOT index the folder with
both WebReg and this script.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #18 on: November 25, 2007, 10:59:34 am »
After a morning of hell .... ive formated my pc ..  i downloaded latest PX beta and got 1 script running on it pxstats and it still wont generate the download file ....

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #19 on: November 25, 2007, 02:12:02 pm »
That sounds a bit extreme. You do realize that neither script
or WebReg makes any system changes except WebReg's
autostart option. I only hope you formatted for other reasons.
Btw, pxstats was never written for the new API.
Do you mean PxWeb?
« Last Edit: November 25, 2007, 02:49:23 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #20 on: November 25, 2007, 03:03:39 pm »
yes sorry pxweb      and yes i formatted for other reasons ..... i realy cant see any reason why this dont work any more ....

Here is the hubsetup has it is  .. can you just confirm that it is all correct,so i can start looking into other reasons
« Last Edit: November 25, 2007, 03:07:18 pm by TwîsTèd-dèvîl »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #21 on: November 25, 2007, 03:10:48 pm »
Well in truth, both work great, STILL. But rather than flooding this
post with how often and in how many different ways you've found
to make them not work correctly, why don't we take this to PXA hub.

Quote
It is better to remain silent and be thought a fool than to speak up and remove all doubt.
-Abe Lincoln
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
PxWeb 1.0d LUA 5.11 [Strict] [API 2]
« Reply #22 on: April 19, 2008, 10:40:07 pm »
Testers welcome :)

Code: [Select]
--[[
PxWeb 1.0d LUA 5.11 [Strict] [API 2]

By Mutor 07/21/07

Generates HTML pages for use with PtokaX/Other Web Server
-A total rewrite of pxstats

You can use this single script to:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

- Generates all required folders and files with no user intervention required.
- Display online users, recent chat, top shares, top uptimes, hub stats and file downloads.
- Offer file downloads by merely copying files to the download folder and restarting script.
- Display a list of hopefully useful web and dchub links.
- Provide an E-Mail contact link for users that may have been banned for bad pass etc.
- Edit site-wide style and colors through cascading style sheet.
- Provides MainText parameter which allows you to display text file on the main page.
- Provides Ad, a quickly ammenadable parameter that is appended to the text of MainText.
- Both MainText and Ad may contain escaped HTML code [links, images, email, etc.]

Note: This script will overwrite any existing files of the same name. Backup your
existing web server files if this is of concern to you. Users that haven't used the Px
web server , just set the server port on PtokaX -> Options tab, enable the server there
and start the script.

Changes from 1.0 08/03/07
+Added user commands and context menus [right click]
*User commands sent with ZPipe [saves b/w]
+Added command permission by profile per command
+Added report 'option' for status messages
+Added ASCII table & function
+Added startup and connect message
+Added error logging
~Fixed bum link to LUA-Users Wiki

Changes from 1.0b 10/13/07
+Converted for the new PtokaX API

Changes from 1.0c 10/13/07
+ Added PxLuaFileSystem extension library to avoid shell pop ups.
+ Added target frame option for links


***Notes:
This script requires the PXLuaFileSystem extension library. It will not
run without it. You can get it and others here: http://ptokax.ath.cx/libs.html
]]

local Web = {
-- Set MOTD ? string or false
Motd = false,--"WebReg 1.1.1.7 serving PxWeb 1.0d launched by PtokaX "..Core.Version.." running ".._VERSION,
-- Name of hub owner
Owner = "Mutor",
-- Send status / error messages to Admin nick? "on"/"off" [If = "on", set OpNick]
Report = "on",
-- Admins nick for status / error messages [Report must = "on"]
OpNick = "Mutor",
-- Advert to display to all at startup and each new connection ["" = disabled]
Addy = "Please visit the hub's web site at http://mutor.no-ip.com:6803/",
-- Botname pulled from the hub or use "CustomName"
Bot = SetMan.GetString(21),
-- Bot description
Desc = "I generate HTML for the hub's web server.",
-- Bot/Website email address
Mail = "admin@mutor.no-ip.com",
-- Text file that will be displyed in main frame of homepage
-- [This path/file should reside in PtokaX folder in root or subdirectory]
-- Note: This file may contain [escaped LUA 'magic' chars] HTML code
-- ie. - "<br><a href=\"http://www.yourlink.com/image.jpg\">Image</a>"
MainText = "cfg/motd.txt",
-- Addendum to the MainText [will appear at end of file]. "" = disable
-- This text may contain [escaped LUA 'magic' chars] HTML code
Ad = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"http://validator.w3.org/\">\n"..
"<img src=\"http://www.w3.org/Icons/valid-html401-blue\" "..
"alt=\"Valid HTML 4.01 Frameset\" height=\"31\" width=\"88\" border=\"0\"></a>",
--"\n<br>\n<img src=\"http://www.w3.org/Icons/valid-html401-blue\"></a>",
-- Links to display on the menu [idx] = {"http://linkaddress.com","Link Text",target frame},
Links = {
--{"/register.htm","Register in "..SetMan.GetString(0),"main"},
{"/files/index.htm","Dynamic Downloads","main"},
{"#","PtokaX Links:"},
{"http://ptokax.ath.cx/index.html","PtokaX DC Hub"},
{"http://luaboard.sytes.net/index.php","The PtokaX Portal"},
{"http://uknnet.com/lua/index.php","The PtokaX LUA Board"},
--{"http://wiki.ptokax.ath.cx/doku.php?id=homepage","The PtokaX Wiki"},
{"#","Hub Links:"},
{"dchub://ptokax-lua.damnserver.com:2006","PtokaX Admins Hub"},
--You can make a seperator like this [idx] = {"#","Separator Text"},
{"#","Reference:"},
{"http://www.lua.org/","LUA Home Page"},
{"http://www.lua.org/manual/5.1/","LUA 5.1 Ref. Manual"},
{"http://lua-users.org/wiki/","LUA-Users Wiki"},
{"http://luaforge.net/","LuaForge"},
--{"http://validator.w3.org/","Validate HTML"},
},

--Short message for new logins
Greeting = "Welcome [usr]. It's nice of you to stop by...",
--Basic CSS Settings, use color codes or friendly color names
--See DoCss function for extended CSS settings
Style = {
--Font Family
font = "Verdana, Geneva, Arial, Helvetica, sans-serif",
--Font Color
fcolor = "Black",
--Background Color
bgcolor = "transparent",
--Background Image (Path and Filename)
bgimage = "",--images/bg.gif
--Link Color
lcolor = "Blue",
--Visited Link Color
vcolor = "Silver",
--Link Hover Color
hcolor = "Red",
--Show Table Borders? "yes" = enabled /"no" = disabled
tborder = "no",
},
}

require"pxlfs"
assert(lfs._VERSION)
OnStartup = function()
Web.Script,Web.HubPath,Web.Content = "PxWeb 1.0d",Core.GetPtokaXPath(),"motd.html"
Web.Body,Web.Foot,Web.ErrLog,Web.Refresh = "</head>\n<body>\n","</body>\n</html>",{}
Web.Path,Web.Downloads,Web.FileUrl = "web/","web/files","files"
Web.Url = Web.HubPath..Web.Path
if Web.Motd and SetMan.GetMOTD() ~= Web.Motd then SetMan.SetMOTD(Web.Motd) SetMan.Save() end
Web.Asc = {
[34]="&quot;",[38]="&amp;",[39]="&#39;",[60]="&lt;",[62]="&gt;",[94]="&circ;",[126]="&tilde;",[127]="&#127;",
[128]="&euro;",[130]="&sbquo;",[131]="&fnof;",[132]="&bdquo;",[133]="&hellip;",[134]="&dagger;",[135]="&Dagger;",
[136]="&circ;",[137]="&permil;",[138]="&Scaron;",[139]="&lsaquo;",[140]="&OElig;",[142]="&#381;",[145]="&lsquo;",
[146]="&rsquo;",[147]="&ldquo;",[148]="&rdquo;",[149]="&bull;",[150]="&ndash;",[151]="&mdash;",[152]="&tilde;",
[153]="&trade;",[154]="&scaron;",[155]="&rsaquo;",[156]="&oelig;",[157]="&#356;",[158]="&#382;",[159]="&Yuml;",
[160]="&nbsp;",[161]="&#711;",[162]="&#728;",[163]="&#321;",[164]="&curren;",[165]="&#260;",[166]="&brvbar;",
[167]="&sect;",[168]="&uml;",[169]="&copy;",[170]="&#350;",[171]="&laquo;",[172]="&not;",[173]="&shy;",
[174]="&reg;",[175]="&#379;",[176]="&deg;",[177]="&plusmn;",[178]="&sup2;",[179]="&#322;",[180]="&acute;",
[181]="&micro;",[182]="&para;",[183]="&middot;",[184]="&cedil;",[185]="&#261;",[186]="&#351;",[187]="&raquo;",
[188]="&#317;",[189]="&#733;",[190]="&#318;",[191]="&#380;",[192]="&#340;",[193]="&Aacute;",[194]="&Acirc;",
[195]="&#258;",[196]="&Auml;",[197]="&#313;",[198]="&#262;",[199]="&Ccedil;",[200]="&#268;",[201]="&Eacute;",
[202]="&#280;",[203]="&Euml;",[204]="&#282;",[205]="&Iacute;",[206]="&Icirc;",[207]="&#270;",[208]="&#272;",
[209]="&#323;",[210]="&#327;",[211]="&Oacute;",[212]="&Ocirc;",[213]="&#336;",[214]="&Ouml;",[215]="&times;",
[216]="&#344;",[217]="&#366;",[218]="&Uacute;",[219]="&#368;",[220]="&Uuml;",[221]="&Yacute;",[222]="&#354;",
[223]="&szlig;",[224]="&agrave;",[225]="&aacute;",[226]="&acirc;",[227]="&#259;",[228]="&auml;",[229]="&#314;",
[230]="&#263;",[231]="&ccedil;",[232]="&#269;",[233]="&eacute;",[234]="&#281;",[235]="&euml;",[236]="&#283;",
[237]="&iacute;",[238]="&icirc;",[239]="&#271;",[240]="&#273;",[241]="&#324;",[242]="&#328;",[243]="&oacute;",
[244]="&ocirc;",[245]="&#337;",[246]="&ouml;",[247]="&divide;",[248]="&#345;",[249]="&#367;",[250]="&uacute;",
[251]="&#369;",[252]="&uuml;",[253]="&yacute;",[254]="&#355;",[255]="&#729;"
}
Web.Timer = TmrMan.AddTimer(60000)
local r,e = os.rename("web","web")
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath.."scripts") lfs.mkdir("web") lfs.chdir(Web.HubPath)
end
Initialize()
DoCss()
DoRoot(1)
DoTabs(1)
Web.Refresh = true
Initialize,DoCss,DoRoot,Web.Links,Web.Style,Copy = nil,nil,nil,nil,nil,nil
collectgarbage("collect")
if Web.Addy ~= "" then Core.SendToAll("<"..Web.Bot.."> "..Web.Addy) end
OnError(Web.Script.." has been started. Memory usage: "..string.format("%.2f Kb.",collectgarbage("count")))
end

OnExit = function()
DoTabs(1,Web.Site[1])
local time = os.time()
for _,v in ipairs(Times) do
v[3] = (time - v[2]) + v[3]
v[2] = time
v[4] = 0
end
SaveToFile(Web.Site[3][2],Shares,"Shares")
SaveToFile(Web.Site[2][2],Chat ,"Chat")
collectgarbage("collect")
OnError(Web.Script.." has been stopped, freeing "..
string.format("%.2f Kb.",collectgarbage("count")).." of memory.")
end

OnError = function(msg)
local stamp = os.date()
table.insert(Web.ErrLog,{stamp,msg})
if Web.Report == "on" and Web.OpNick ~= "" then
Core.SendToNick(Web.OpNick,"<"..Web.Bot.."> "..msg)
end
end

OnTimer = function(Id)
if Id == Web.Timer then
SaveToFile(Web.Site[2][2],Chat ,"Chat")
if next(Web.ErrLog) then
SaveToFile(Web.HubPath.."web/errlog.web",Web.ErrLog,"Web.ErrLog")
Web.ErrLog = {}
end
DoTabs(1)
collectgarbage("collect")
end
end

UserConnected = function(user)
DoTabs(1,Web.Site[1]) DoTabs(1,Web.Site[3]) DoTabs(1,Web.Site[4],user.sNick)
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Greeting:gsub("%b[]",user.sNick))
if Web.Addy ~= "" then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Addy)
end
if user.iProfile ~= -1 then
if GenCmds(user) then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Script.." commands enabled, see hub tab for more.")
end
end
end
OpConnected,RegConnected = UserConnected,UserConnected

UserDisconnected = function(user)
DoTabs(1,Web.Site[1]) DoTabs(1,Web.Site[4],user.sNick)
end
OpDisconnected = UserDisconnected

ChatArrival = function(user, data)
local _,_,pfx = data:find("%b<> (["..SetMan.GetString(29).."])")
local _,_,ctrl = data:find("%c")
local _,_,sb = data:lower():find("is kicking because:",1,true)
if not pfx and not ctrl and not sb then
local _,_,txt = data:find("^%b<> (.*)|$")
if txt and txt:len() >= 2 then
data = DoAscii(data:sub(1,-2))
local now = string.lower(os.date("[%H:%M]"))
table.insert(Chat,{now,data})
if #Chat > 100 then
table.remove(Chat,1)
end
end
else
local _,_,cmd = data:find("^%b<> %p(%a+)")
if cmd then
local str
for i,v in ipairs(Web.Site) do
if cmd:lower() == v[1]:lower() then
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
str = "\r\n\r\n\t"..v[4].."\r\n\t"..string.rep("¯",v[4]:len()).."\r\n"
for idx,val in ipairs(v[6]()) do
if cmd:lower() == "chat" or cmd:lower() == "hubstats" then
str = str..val.."\r\n"
else
str = str.."\t"..idx.."\t"..val.."\r\n"
end
end
str = str.."\r\n"
return Core.SendPmToNick(user.sNick,Web.Bot,str),true
else
local prof = "Unregistered User"
if u.iProfile ~= -1 then
prof = ProfMan.GetProfile(u.iProfile).sProfileName
end
local pfx = SetMan.GetString(29):sub(1,1) or "+"
local msg = "Sorry "..user.sNick..", "..prof.."'s are "..
"not allowed use of the "..pfx..cmd:lower().." command."
return Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..msg),
Core.SendPmToNick(user.sNick,Web.Bot,msg),true
end
end
end
end
end
end
ToArrival = ChatArrival

Initialize = function()
local topic,desc = SetMan.GetString(10) or "",SetMan.GetString(5) or ""
local HubApp,HubVer = "PtokaX", Core.Version
Web.Root = {
[1] = {"index.html","Index"},
[2] = {"top.html","Top"},
[3] = {"main.html","Main"},
[4] = {"bottom.html","Bottom"},
[5] = {"left.html","Menu"},
[6] = {"pxstyle.css","CSS"}
}
Web.Site = {
[1] = {"Users","web/users.web","users.html","Online Users",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"<b>Profile</b>","<b>User Nick</b>"..s})
table.insert(x,{" "," "})
Users = {}
for i,u in ipairs(t) do
local p
if u.iProfile ~= -1 then
p = ProfMan.GetProfile(u.iProfile).sProfileName
else
p = "Unregistered User"
end
table.insert(x,{p,u.sNick})
table.insert(Users,{p,u.sNick})
end
SaveToFile(Web.Site[1][2],Users,"Users")
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(x,Web.Site[1][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Users) do
table.insert(t,table.concat(v," "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[2] = {"Chat","web/chat.web","chat.html","Recent Chat",
function()
local t,x = Chat,{}
if next(t) then
table.insert(x,{"<b>Time</b>","<b>Chat Message</b>"})
table.insert(x,{" "," "})
for i,v in ipairs(t) do
table.insert(x,{v[1],v[2]})
end
end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"10\">\n"..
Web.Body..GenTab(x,Web.Site[2][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,"\t"..v[1].."  "..DoAscii(v[2],1):gsub("\r\n","%1\t\t   "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[3] = {"Shares","web/shares.web","shares.html","Top Shares",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"<b>User Nick</b>","<b>Share Value</b>"..s})
table.insert(x,{" "," "})
for i,u in ipairs(t) do
if Core.GetUserAllData(u) then
local exist
if next(Shares) then
for _,v in ipairs(Shares) do
if v[1]:lower() == u.sNick:lower() then
v[2] = u.iShareSize
exist = true
break
end
end
end
if not exist then
table.insert(Shares,{u.sNick,u.iShareSize})
end
end
end
table.sort(Shares, function(a,b)return a[2] > b[2] end)
SaveToFile(Web.Site[3][2],Shares,"Shares")
if next(Shares) then
for z = 1, math.min(#Shares,10) do
if Shares[z][2] > 0 then
table.insert(x,{Shares[z][1],FmtSz(Shares[z][2])})
end
end
end
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(x,Web.Site[3][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Shares) do
if v[2] > 0 then table.insert(t,FmtSz(v[2]).."\t\t"..v[1]) end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[4] = {"Times","web/times.web","times.html","Top Uptimes",
function(nick)
local t,x,time = Core.GetOnlineUsers(),{},os.time()
if t and next(t) or nick then
table.insert(x,{"<b>User Nick</b>","<b>Uptime Value</b>"})
table.insert(x,{" "," "})
if nick then
for _,v in ipairs(Times) do
local z = 0
if v[1]:lower() == nick:lower() then
exist = true
if Core.GetUser(nick) then
z = 1
v[2] = time
v[4] = z
else
v[3] = (time - v[2]) + v[3]
v[4] = z
end
break
end
end
else
for i,u in ipairs(t) do
local exist
for _,v in ipairs(Times) do
if v[1]:lower() == u.sNick:lower() then
exist = true
if Web.Refresh then
v[3] = (time - v[2]) + v[3]
v[2] = time
end
v[4] = 1
break
end
end
if not exist then
table.insert(Times,{u.sNick,time,0,1})
end
end
end
table.sort(Times, function(a,b)return a[3] > b[3] end)
SaveToFile(Web.Site[4][2],Times,"Times")
if next(Times) then
for z = 1, math.min(#Times,10) do
if (time - Times[z][3]) > 0 then
table.insert(x,{Times[z][1],Convert(time - Times[z][3])})
end
end
end
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"600\">\n"..
Web.Body..GenTab(x,Web.Site[4][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(Times) do
if v[2] > 0 and v[3] > 0 then
table.insert(t,string.format("%-50.30s",v[1]).." \t•"..Convert(time - v[3]))
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[5] = {"HubStats","web/stats.web","stats.html","Hub Statistics",
function()
local b,m = "&nbsp;","Public, unregistered users welcome."
local topic = SetMan.GetString(10) or "There is no current topic."
local sr,hr,ss,hs = Chk(SetMan.GetNumber(8)),Chk(SetMan.GetNumber(7)),"slot","hub"
if SetMan.GetBool(5) then m = "Private, registered users only." end
if sr and type(sr) == "number" and sr > 1 then ss = ss.."s" end
if hr and type(hr) == "number" and hr > 1 then hs = hs.."s" end
  local t = {
[1] = {b.."Hub Name:",SetMan.GetString(0)},
[2] = {b.."Hub Desc.:",SetMan.GetString(5)..""},
[3] = {b.."Hub Topic:",topic..""},
[4] = {b.."Hub Time:",os.date("%B %d %Y %X")..""},
[5] = {b.."HubOwner:",Web.Owner..""},
[6] = {b.."Hub Uptime:",Convert(os.time() - Core.GetUpTime())..""},
[7] = {b.."Min Share:",FmtSz(SetMan.GetMinShare())..""},
[8] = {b.."Min Slots:",Chk(SetMan.GetNumber(5)).." per user."},
[9] = {b.."Max Slots:",Chk(SetMan.GetNumber(6)).." per user."},
[10] = {b.."Slot Ratio:",sr.." "..ss.." per "..hr.." "..hs.."."},
[11] = {b.."Max Hubs:",Chk(SetMan.GetNumber(9)).." per user."},
[12] = {b.."Peak Users:",Core.GetMaxUsersPeak()},
[13] = {b.."Hub Share:",FmtSz(Core.GetCurrentSharedSize())},
[14] = {b.."There Are:",#Core.GetOnlineUsers().." of a possible "..SetMan.GetNumber(0).." users online."},
[15] = {b.."Hub Mode:",m},
}
table.insert(t,1,{" "," "})
SaveToFile(Web.Site[5][2],t ,Web.Site[5][1])
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(t,Web.Site[5][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(HubStats) do
if i > 1 then
table.insert(t,"\t"..string.format("%-20.15s",v[1]:gsub("&nbsp;"," ")).."\t•"..v[2])
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[6] = {"Downloads","web/files.web","files.html","File Downloads",
function()
if not Web.Refresh then
local path,url,t = Web.HubPath..Web.Downloads,Web.FileUrl,{}
local Invalid = {"wr.cfg",".db",".pif",".lnk",".sys",".part",".msc",".vxd",".mft",".adm",
".mapimail",".ins",".cpl",".nt","~",".tmp",".$",".&",".chk",".shs",".desklink",".url",".htm"}
local CheckFile = function(file)
for i,v in ipairs(Invalid) do
if file:find(v:lower(),1,true) then return false end
end
return true
end
Downloads = {}
lfs.chdir(path)
for item in lfs.dir(path) do
if CheckFile(item) then
local x = lfs.attributes(item)
if x and x.mode == "file" then
local time,size,name = os.date(nil,x.modification),x.size,item:gsub("%s","%%20")
table.insert(Downloads,{time,FmtSz(size),"<a href=\""..url.."/"..name.."\"/>"..item.."</a>"})
table.insert(t,{time,FmtSz(size),"<a href=\""..url.."/"..name.."\"/>"..item.."</a>"})
end
end
end
table.insert(t,1,{"<b>Date / Time</b>","<b>Size</b>","<b>Name</b>"})
table.insert(t,2,{" "," "," "})
lfs.chdir(Web.HubPath.."scripts")
SaveToFile(Web.Site[6][2],Downloads,"Downloads")
return Web.Head..Web.Css..Web.Body..GenTab(t,Web.Site[6][4],1)..Web.Foot
end
end,
function()
local t = {}
for i,v in ipairs(Downloads) do
local _,_,file = v[3]:find("%>(%S+)%</")
if file then
table.insert(t,file.."\t("..v[2]..")")
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
}
Web.Head = "<html>\n<head>\n<title>"..SetMan.GetString(0).." - ‹›</title>\n"..
"<meta http-equiv=page-enter content=\"blendTrans(Duration=2)\">\n"..
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"..
"<meta name=robots content=\"noindex,nofollow\">\n"..
"<meta http-equiv=pragma content=no-cache>\n"..
"<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">\n"..
"<link rel=\"shortcut icon\" href=\"favicon.ico\">\n"
Web.Frame = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n"..
"\"http://www.w3.org/TR/html4/frameset.dtd\">\n"..Web.Head
Web.Head = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"..
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"..Web.Head
Web.Css = "<link rel=\"stylesheet\" href=\""..Web.Root[6][1].."\" type=\"text/css\">\n"
--Index
Web.Root[1][3] = Web.Frame.."</head>\n<frameset rows=\"130,*,45\" cols=\"*\">\n"..
"<frame name=\"top\" src=\"top.html\" scrolling=\"no\" frameborder=\"0\">\n"..
"<frameset cols=\"200,800\" rows=\"*\" >\n"..
"<frame name=\"menu\" src=\"left.html\" scrolling=\"no\" frameborder=\"0\">\n"..
"<frame name=\"contents\" src=\"main.html\" scrolling=\"no\" frameborder=\"0\">\n</frameset>\n"..
"<frame name=\"bottom\" scrolling=\"no\" noresize src=\"bottom.html\" frameborder=\"0\">\n"..
"<noframes>\n<p>This document uses frames, but your browser doesn't support them.</p>\n"..
"</noframes>\n</frameset>\n</html>"
--Top
Web.Root[2][3] = Web.Head..Web.Css.."</head>\n<body>\n"..
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr>\n<td class=\"table0\" align=\"left\">"..
"&nbsp;<script type=\"text/javascript\">document.write(Date())</script></td>\n</tr>\n"..
"<tr>\n<td class=\"table1\" align=\"right\">"..HubApp.." "..HubVer..": "..desc.."&nbsp;&nbsp;&nbsp;</td>\n</tr>\n"..
"<tr align=\"center\" valign=\"top\">\n<td class=\"table3\">\n<div align=\"center\">\n<h1>"..
SetMan.GetString(0).."</h1>\n<h3>..."..topic.."</h3>\n</div>\n</td>\n</tr>\n</table>\n"..
Web.Foot
--Main
Web.Root[3][3] = Web.Head..Web.Css..Web.Body..
"<table width=\"100%\" height=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n"..
"<tr><td class=\"table1\" valign=\"top\" align=\"left\">.:: "..Web.Root[3][2].." ::.</td>\n</tr>"..
"</table>\n<iframe name=\"main\" class=\"table2\" scrolling=yes width=\"100%\" "..
"height=\"400\" align=\"left\" frameborder=\"0\" src=\""..Web.Content.."\"></iframe>\n"..Web.Foot
--Bottom
Web.Root[4][3] = Web.Head..Web.Css..Web.Body..
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr>\n<td class=\"table1\" align=\"left\" colspan=\"2\" ></td>\n</tr>\n<tr>\n"..
"<td class=\"table0\" align=\"center\" colspan=\"2\" ><script type=\"text/javascript\">"..
"document.write(\"You're using: \"+navigator.appName+\" \"+navigator.appCodeName+\" \"+navigator.appVersion+\"\");\n"..
"</script>\n</td>\n</tr>\n</table>\n"..Web.Foot
--Left - Menu
Web.Root[5][3] = Web.Head..Web.Css..Web.Body..
"<table width=\"95%\" align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr><td class=\"table1\">.:: Menu ::.</td></tr>\n<tr valign=\"top\">\n<td class=\"table2\">"..
"<a href=\"#\" class=\"menu\" target=\"_self\">Navigation:</a>\n<br><a href=\"index.html\" target=\"_top\">Home</a>\n"
for i,v in ipairs(Web.Site) do
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..
v[3].."\" target=\"main\">"..v[4].."</a>\n"
end
local t = {
[1] = {"Connect to Hub","dchub://"..SetMan.GetString(2)..":"..SetMan.GetString(3):gsub("%;.*$","")},
[2] = {"Contact","mailto:"..Web.Mail.."?subject=About the "..SetMan.GetString(0).." website&amp;body=Dear "..Web.Owner..","},
}
t[2][2] = t[2][2]:gsub(" ","%%20")
for i,v in ipairs(t) do
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..
v[2].."\" target=\"main\">"..v[1].."</a>\n"
end
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\"#\" class=\"menu\" target=\"_self\">Web Links:</a>\n"
for i,v in ipairs(Web.Links) do
local url = v[1]:gsub(" ","%%20")
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..url.."\" "
if v[1] == "#" or v[1]:find("^dchub://") then
if v[1] == "#" then
Web.Root[5][3] = Web.Root[5][3].."class=\"menu\" "
end
Web.Root[5][3] = Web.Root[5][3].."target=\"_self\">"
else
if v[3] then
Web.Root[5][3] = Web.Root[5][3].."target=\""..v[3].."\">"
else
Web.Root[5][3] = Web.Root[5][3].."target=\"_blank\">"
end
end
Web.Root[5][3] = Web.Root[5][3]..v[2].."</a>\n"
end
Web.Root[5][3] = Web.Root[5][3].."</td></tr>\n</table>\n"..Web.Foot
local HubDir = Web.HubPath
local tab = {}
for dir in string.gmatch(Web.Path.."/images/","(%a+)/") do
table.insert(tab,dir)
end
local CheckDir = HubDir..table.concat(tab,"//")
if not os.rename(CheckDir,CheckDir) then
for _,folder in ipairs(tab) do
HubDir = HubDir..folder
local r,e = os.rename(HubDir,HubDir)
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath) lfs.mkdir(folder)
end
HubDir = HubDir.."/"
end
end
Copy(Web.HubPath..Web.MainText,Web.HubPath..Web.Path..Web.Content)
local FileDir,FirstStart = Web.HubPath..Web.Path..Web.FileUrl,true
local r,e = os.rename(FileDir,FileDir)
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath..Web.Path) lfs.mkdir(Web.FileUrl)
else
FirstStart = false
end
local sample = Web.HubPath..Web.FileUrl.."/Setting_Up_Downloads.txt"
if FirstStart and not os.rename(sample,sample) then
local directions = "Simply copy your files to this folder "..
"[ Default = C:/Ptokax/html/webstats/files ]\nThen restart this "..
"script and reload the dowloads page to see the new files you've added.\n"..
"You may delete this file at any time.\r\n\r\n"..string.rep(string.char(9),6).." -Mutor"
local f,e = io.open(sample,"w")
if f then
f:write(directions) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end
end

GenTab = function(t,s,noidx)
local txt = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
if s then
txt = txt.."\t<tr><td class=\"table0\" valign=\"top\">.:: "..s.." ::.</td></tr></table>\n"
else
txt = txt.."\t<tr><td class=\"table0\" valign=\"top\">&nbsp;</td></tr>\n"
end
txt = txt.."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
if next(t) then
for i,v in ipairs(t) do
if noidx then
txt = txt.."\n\t<tr align=\"left\" valign=\"top\">"
else
txt = txt.."\n\t<tr align=\"left\" valign=\"top\">"..
"<td class=\"table3\" width=\"10%\">&nbsp;"..i.."</td>"
end
if type(v) == "table" then
local z = #v
for x=1, z do
if x < z then
txt = txt.."<td class=\"table3\" width=\""..(12*x)..
"%\">&nbsp;<b>"..v[x].."</b></td>"
else
local s = (100 - (x*12))
txt = txt.."<td class=\"table3\"width=\""..s.."%\">&nbsp;"..v[x].."</td>"
end
end
else
txt = txt.."<td class=\"table3\" width=\"90%\">&nbsp;"..v.."</td>"
end
end
txt = txt.."</tr>\n"
else
txt = txt.."\t<tr><td> No</td>\n<td>Data</td>\n</tr>\n"
end
txt = txt.."</table>\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"\t<tr><td class=\"table2\" valign=\"top\"></td></tr>\n</table>\n"
return txt
end

DoHtml = function(file,title,body)
local method = "updated"
if not os.rename(file,file) then method = "saved" end
body = body:gsub("%b‹›",title)
local f,e = io.open(file,"w")
if f then
if not Web.Refresh then
OnError(title.." has been "..method)
end
f:write(body) f:flush() f:close()
else
OnError(e:sub(1,2))
end
end

DoRoot = function(x)
for i,v in ipairs(Web.Root) do
if v[3] then
if x or not os.rename(Web.Url..v[1],Web.Url..v[1]) then
DoHtml(Web.Url..v[1],v[2],v[3])
end
end
end
end

DoTabs = function(x,t,n)
if x and t and n then
if t[5] then
local html = t[5](n)
if html then
DoHtml(Web.Url..t[3],t[4],html)
end
end
else
for i,v in ipairs(Web.Site) do
local tab = v[1]
if loadfile(v[2]) then
dofile(v[2])
if v[1] == "Chat" and next(Chat) then
if Chat[1][3] then
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,{v[1],"&lt;"..v[2].."&gt; "..
DoAscii(v[3]:gsub("&bull;",""))})
end
Chat = t
end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
end
else
tab = {}
SaveToFile(v[2],tab,v[1])
dofile(v[2])
end
if x or not os.rename(Web.Url..v[3],Web.Url..v[3]) then
if v[5] then
local html = v[5]()
if html then
DoHtml(Web.Url..v[3],v[4],html)
end
end
end
end
end
end

DoCss = function()
local css = "body {\n"..
"\tcolor: "..Web.Style.fcolor..";\n"..
"\tfont-family: "..Web.Style.font..";\n"..
"\tbackground-image: url("..Web.Style.bgimage..");\n"..
"\tbackground-repeat: repeat;\n"..
"\tbackground-color: "..Web.Style.bgcolor..";\n"..
"}\n"..
"a:link {\n"..
"\tcolor: "..Web.Style.lcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:visited {\n"..
"\tcolor: "..Web.Style.vcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:hover {\n"..
"\tcolor: "..Web.Style.hcolor..";\n"..
"\ttext-decoration: underline overline;\n"..
"}\n"..
".menu {\n"..
"\tcolor: #E9E9F8;\n"..
"\ttext-decoration: none;\n"..
"\twidth: 100%;\n"..
"\tbackground-color: #8784C6;\n"..
"}\n"..
".table0 {\n"..
"\theight: 12px;\n"..
"\tcolor: #E9E9F8;\n"..
"\tfont-size: 12px;\n"..
"\tbackground-color : #1E2580;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table1 {\n"..
"\theight: 12px;\n"..
"\ttext-indent: 5px;\n"..
"\tcolor : White;\n"..
"\tfont-size : 12px;\n"..
"\tbackground : #8784C6;\n"
if Web.Style.tborders == "yes" then
css = css.."\tbackground-color : #8784C6;\n"..
"\tborder-bottom: 2px solid Black;\n"..
"\tborder-left: 1px solid Black;\n"..
"\tborder-right: 1px solid Black;\n"..
"\tborder-top: 1px solid Black;\n"
end
css = css.."}\n"..
".table2 {\n"..
"\theight: 400px;\n"..
"\twidth: 100%;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table3 {\n"..
"\theight: 12px;\n"..
"\twidth: auto;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table4 {\n"..
"\theight: 12px;\n"..
"\twidth: auto;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 8px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}"
local f,e = io.open(Web.Url..Web.Root[6][1], "w")
if f then
f:write(css) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end

function Chk(enable)
if enable == "" or not enable then enable = "not set" end
return enable
end

FmtSz = function(int)
local i,u,x=tonumber(int) or 0,{"","K","M","G","T","P"},1
while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x])
end

Convert = function(time)
time = time or 0
local s,x,n,tab = "",0,os.time(),{
[1] = {31556926,"year"},
[2] = {2592000,"month"},
[3] = {604800,"week"},
[4] = {86400,"day"},
[5] = {3600,"hour"},
[6] = {60,"minute"},
[7] = {1,"second"}
}
if time > 0 then
if time < 2145876659 then
if n > time then
time = n - time
for i,v in ipairs(tab) do
if time > v[1] then
x = math.floor(time/v[1])
if x > 1 then v[2] = v[2].."s" end
if x > 0 then
s = s..x.." "..v[2]..", "
time = time-x*v[1]
end
end
end
end
collectgarbage("collect")
return s:sub(1,-3)
else
return "Invalid date or time supplied. [must be pre 12/31/2037]"
end
else
return "No uptime recorded"
end
end

Copy = function(source,target)
local is,os,text
local f,e = io.open(source)
if f then
text,is = f:read("*a"),f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
if text then
local f,e = io.open(target,"w")
if f then
text = Web.Head:gsub("%b‹›","MOTD")..Web.Css..Web.Body..
"<table class=\"table2\" bgcolor=\"#E9E9F8\" width=\"100%\" "..
"border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr><td class=\"table3\" valign=\"top\">\n<pre>"..text.."</pre>"..Web.Ad..
"\n</td></tr>\n</table>\n"..Web.Foot
f:write(text) f:flush() os = f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
end
end

--Replace certain characters with html ASCII code & vice versa
DoAscii = function(data,rev)
if rev then
for i,v in pairs(Web.Asc) do
data = data:gsub(v,string.char(i))
end
return data
else
for chr in data:gmatch(".") do
local x = Web.Asc[string.byte(chr)]
if x then
data = data:gsub(chr,x)
end
end
return data
end
end

GenCmds = function(user)
local c,t,x = "",{}
local p,m,s = SetMan.GetString(29):sub(1,1),SetMan.GetString(0),Web.Script
for i,v in ipairs(Web.Site) do
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
x = true
c = c.."$UserCommand 1 1 "..m.."\\"..s.."\\"..
v[4].."$<%[mynick]> "..p..v[1]:lower().."&#124;|"
end
end
if x then
Core.SendToNick(user.sNick,c:sub(1,-2))
return x
end
end

function Serialize(tTable, sTableName, sTab)
sTab = sTab or ""
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in ipairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t")
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
local handle,err = io.open(file,"w")
if handle then
handle:write(Serialize(table, tablename)) handle:flush() handle:close()
else
OnError(err:sub(1,2))
end
end
« Last Edit: April 20, 2008, 10:27:20 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TwîsTèd-dèvîl

  • Viking
  • ****
  • Posts: 510
  • Karma: +79/-2
    • EURO-OP
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #23 on: April 20, 2008, 01:36:49 pm »
Thx for the update   
Onstartup of hub it shows this error   " cannot open web/users.web: No such file or directory  "
But script and html seem to work ok

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #24 on: April 20, 2008, 02:21:47 pm »
Assuming that was a restart, it is more likely you got that error during OnExit [script stop]
At any rate, script above [1.0d] updated with what I hope is more concise handling of the paths.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline 2Ceedz

  • Junior Member
  • **
  • Posts: 16
  • Karma: +1/-0
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #25 on: April 21, 2008, 08:18:09 am »
I think this is a stupid question, (and pretty obvious) but if im lucky its not.
LoL.
This script cant work on new ptokax (0.4.0c) because of no web server in it, correct? I am currently trying to upgrade to ptokax 0.4.0c , so it would be pointless to run my current hub (0.3.5.2) just for the script because it would pull the info from the hub the script is running in, correct?(which will be empty once i go to 0.4.0) 

Seems to run great, and get all info from index.html from web folder, but without ptokax having a webserver its impossible, and there is no way to have the 0.3.5.2 hub pxweb pull info from the 0.4.0c hub, right?

Its a great script, too bad i missed it when you originally wrote it!  Thanks for all your work and advice, use much of it!!


edit:
of course i  got 'PXLuaFileSystem.7z' from the link in script and put in main ptokax directory (both 0.3.5.2 and 0.4.0c), :) and
when i do try to run it in 0.3.5.2 lua 5.1.1 i get this error (like this script, and may ''hold-off''' on upgrade if i get it working.
Quote
0.3.5.2\scripts\PxWeb1.0d.5.11.lua:62: attempt to index global 'SetMan' (a nil value)

after that i put the contents of 'PXLuaFileSystem.7z' in the 'scripts' folder just to make sure - LoL

Thanks again!
« Last Edit: April 21, 2008, 08:37:36 am by 2Ceedz »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #26 on: April 21, 2008, 12:24:54 pm »
I'm not sure if there was a question in all that. :P
Quote
PxWeb 1.0d LUA 5.11 [Strict] [API 2]
From the tag above you can see this script is only for
the new API [> 0.3.6.0d] the PXLFS lib version is for
the new API as well. There are however, versions of
both this script and the PXLFS available for the original
API. I wouldn't let the lack of a web server in the new
Px stop me from using it. There are so many web servers
available as freeware/GPL that you can use. WebReg
may also be used. [See link in my signature]
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline 2Ceedz

  • Junior Member
  • **
  • Posts: 16
  • Karma: +1/-0
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #27 on: April 21, 2008, 01:54:14 pm »
:)  Sorry Mutor, but thanks for the help!! Whatever my question was, you definently answered it.   ;)

Just saw the link in your sig for '[ WebReg 1.1.1.7 serving PxWeb 1.0d ] API 2'   yea i feel stupid now.  :)


Thanks again!
« Last Edit: April 21, 2008, 01:58:10 pm by 2Ceedz »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #28 on: April 22, 2008, 12:09:33 am »
Don't feel stupid for the inquiry dude. And certainly don't feel obligated to use WR.
There are a myriad of servers you may use from Apache, ported for all OS's to Omni,
anyone will serve quite well for the basically static HTML PxWeb serves. If you have
need for greater security or support for CGI/Perl, ASP, Sql or other you may want to
seek out a more advanced server.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Psycho_Chihuahua

  • Systemspecialist IT
  • Administrator
  • Emperor
  • *****
  • Posts: 1 125
  • Karma: +112/-2
  • I am wherever i want to be
    • PtokaX Luaboard
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #29 on: April 22, 2008, 09:09:37 am »
Mutor, could you change the script a tiny bit please?
To use it on an extrnal server it would be nice to be able to change the output folder to a root based one.
ie on linux the webserver is for instance under /var/www so it would be nice if possible to create the files there.

i dont know if this is possible within the script but i decided to ask anyway ;)

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #30 on: April 22, 2008, 10:36:04 pm »
I'm sure we can change paths to accommodate you Sir.
Yet in my experience it is easier to maintain current path
[PtokaX root] and in the external web server set that path
as the root or virtual folder. Is this not an option for you?
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TZB

  • Double Ace
  • *
  • Posts: 149
  • Karma: +13/-0
  • ||-T-z-B-||
    • Gigabyte
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #31 on: August 27, 2010, 03:49:45 pm »
Good morning Mutor.
Sir i have a small request to make if already included please let me know how get it done.
I need a Sub-Menu option in the output.Can it be done?
For example:
If i have Navigation as a main Main Menu option i would like it to show out an arrow and another box containing the Options under it like Home, Online users etc.So as to limit the total number of links in the home page.
I hope you do consider my request.
Thanks in advance.
gigahub.no-ip.biz:666

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
PxWeb 1.0e LUA 5.11 [Strict] [API 2]
« Reply #32 on: August 28, 2010, 06:49:46 pm »
Pursuant to your request:

Code: [Select]
--[[
PxWeb 1.0e LUA 5.11 [Strict] [API 2]

By Mutor 07/21/07

Generates HTML pages for use with PtokaX/Other Web Server
-A total rewrite of pxstats

You can use this single script to:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

- Generates all required folders and files with no user intervention required.
- Display online users, recent chat, top shares, top uptimes, hub stats and file downloads.
- Offer file downloads by merely copying files to the download folder and restarting script.
- Display a list of hopefully useful web and dchub links.
- Provide an E-Mail contact link for users that may have been banned for bad pass etc.
- Edit site-wide style and colors through cascading style sheet.
- Provides MainText parameter which allows you to display text file on the main page.
- Provides Ad, a quickly ammenadable parameter that is appended to the text of MainText.
- Both MainText and Ad may contain escaped HTML code [links, images, email, etc.]

Note: This script will overwrite any existing files of the same name. Backup your
existing web server files if this is of concern to you. Users that haven't used the Px
web server , just set the server port on PtokaX -> Options tab, enable the server there
and start the script.

Changes from 1.0 08/03/07
+Added user commands and context menus [right click]
*User commands sent with ZPipe [saves b/w]
+Added command permission by profile per command
+Added report 'option' for status messages
+Added ASCII table & function
+Added startup and connect message
+Added error logging
~Fixed bum link to LUA-Users Wiki

Changes from 1.0b 10/13/07
+Converted for the new PtokaX API

Changes from 1.0c 10/13/07
+Added PxLuaFileSystem extension library to avoid shell pop ups.
+Added target frame option for links

Changes from 1.0d 08/27/10
+Added option for links submenu, requested by TZB


***Notes:
This script requires the PXLuaFileSystem extension library. It will not
run without it. You can get it and others here: http://board.ptokax.ch/index.php/board,38.0.html
]]

local Web = {
-- Set MOTD ? string or false
Motd = false,
-- Name of hub owner
Owner = "Mutor",
-- Send status / error messages to Admin nick? "on"/"off" [If = "on", set OpNick]
Report = "on",
-- Admins nick for status / error messages [Report must = "on"]
OpNick = "Mutor",
-- List files for OpNick at script start? true/false
ListFiles = false,
-- Advert to display to all at startup and each new connection ["" = disabled]
Addy = "Please visit the hub's web site at http://mutor.no-ip.com:6803/",
-- Botname pulled from the hub or use "CustomName"
Bot = SetMan.GetString(21),
-- Bot description
Desc = "I generate HTML for the hub's web server.",
-- Bot/Website email address
Mail = "admin@mutor.no-ip.com",
-- Text file that will be displyed in main frame of homepage
-- [This path/file should reside in PtokaX folder in root or subdirectory]
-- Note: This file may contain [escaped LUA 'magic' chars] HTML code
-- ie. - "<br><a href=\"http://www.yourlink.com/image.jpg\">Image</a>"
MainText = "cfg/motd.txt",
-- Addendum to the MainText [will appear at end of file]. "" = disable
-- This text may contain [escaped LUA 'magic' chars] HTML code
Ad = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"http://validator.w3.org/\">\n"..
"<img src=\"http://www.w3.org/Icons/valid-html401-blue\" "..
"alt=\"Valid HTML 4.01 Frameset\" height=\"31\" width=\"88\" border=\"0\"></a>",
--"\n<br>\n<img src=\"http://www.w3.org/Icons/valid-html401-blue\"></a>",
-- Links to display on the menu {"http://linkaddress.com","Link Text",target frame},
Links = {
{"http://mutor.no-ip.com:6804/register.htm","Register in "..SetMan.GetString(0),"main"},
{"/files/index.html","WebReg Downloads","main"},
{"/files/index.htm","Dynamic Downloads","main"},
--You can make a submenu like this: {"Number","Submenu Name"},
{"1","PtokaX Links:"},
--You can make a submenu links like this: {"Number","Link URL","Link Name"},
{"1","http://www.ptokax.org","PtokaX Home"},
{"1","http://www.ptokax.ch","PtokaX Home Mirror"},
{"1","http://board.ptokax.ch/index.php","The PtokaX Portal"},
{"1","http://wiki.ptokax.ch","The PotaX Wiki"},
{"#","Hub Links:"},
{"dchub://ptokax-lua.damnserver.com:2006","PtokaX Admins Hub"},
--You can make a seperator like this [idx] = {"#","Separator Text"},
{"#","Reference:"},
{"http://www.lua.org/","LUA Home Page"},
{"http://www.lua.org/manual/5.1/","LUA 5.1 Ref. Manual"},
{"http://lua-users.org/wiki/","LUA-Users Wiki"},
{"http://luaforge.net/","LuaForge"},
--{"http://validator.w3.org/","Validate HTML"},
},

--Short message for new logins ["" = disable]
Greeting = "Welcome [usr]. It's nice of you to stop by...",
--Basic CSS Settings, use color codes or friendly color names
--See DoCss function for extended CSS settings
Style = {
--Font Family
font = "Verdana, Geneva, Arial, Helvetica, sans-serif",
--Font Color
fcolor = "Black",
--Background Color
bgcolor = "transparent",
--Background Image (Path and Filename)
bgimage = "",--images/bg.gif
--Link Color
lcolor = "Blue",
--Visited Link Color
vcolor = "Silver",
--Link Hover Color
hcolor = "Red",
--Show Table Borders? "yes" = enabled /"no" = disabled
tborder = "no",
},
}

require"pxlfs"
assert(lfs._VERSION)
local path = Core.GetPtokaXPath().."scripts/"
OnStartup = function()
Web.Script,Web.HubPath,Web.Content = "PxWeb 1.0e",Core.GetPtokaXPath(),"motd.html"
Web.Body,Web.Foot,Web.ErrLog,Web.Refresh = "</head>\n<body>\n","</body>\n</html>",{}
Web.Path,Web.Downloads,Web.FileUrl = "web/",Web.HubPath.."web/files","files"
Web.Url = Web.HubPath..Web.Path
if Web.Motd and SetMan.GetMOTD() ~= Web.Motd then SetMan.SetMOTD(Web.Motd) SetMan.Save() end
Web.Asc = {
[34]="&quot;",[38]="&amp;",[39]="&#39;",[60]="&lt;",[62]="&gt;",[94]="&circ;",[126]="&tilde;",[127]="&#127;",
[128]="&euro;",[130]="&sbquo;",[131]="&fnof;",[132]="&bdquo;",[133]="&hellip;",[134]="&dagger;",[135]="&Dagger;",
[136]="&circ;",[137]="&permil;",[138]="&Scaron;",[139]="&lsaquo;",[140]="&OElig;",[142]="&#381;",[145]="&lsquo;",
[146]="&rsquo;",[147]="&ldquo;",[148]="&rdquo;",[149]="&bull;",[150]="&ndash;",[151]="&mdash;",[152]="&tilde;",
[153]="&trade;",[154]="&scaron;",[155]="&rsaquo;",[156]="&oelig;",[157]="&#356;",[158]="&#382;",[159]="&Yuml;",
[160]="&nbsp;",[161]="&#711;",[162]="&#728;",[163]="&#321;",[164]="&curren;",[165]="&#260;",[166]="&brvbar;",
[167]="&sect;",[168]="&uml;",[169]="&copy;",[170]="&#350;",[171]="&laquo;",[172]="&not;",[173]="&shy;",
[174]="&reg;",[175]="&#379;",[176]="&deg;",[177]="&plusmn;",[178]="&sup2;",[179]="&#322;",[180]="&acute;",
[181]="&micro;",[182]="&para;",[183]="&middot;",[184]="&cedil;",[185]="&#261;",[186]="&#351;",[187]="&raquo;",
[188]="&#317;",[189]="&#733;",[190]="&#318;",[191]="&#380;",[192]="&#340;",[193]="&Aacute;",[194]="&Acirc;",
[195]="&#258;",[196]="&Auml;",[197]="&#313;",[198]="&#262;",[199]="&Ccedil;",[200]="&#268;",[201]="&Eacute;",
[202]="&#280;",[203]="&Euml;",[204]="&#282;",[205]="&Iacute;",[206]="&Icirc;",[207]="&#270;",[208]="&#272;",
[209]="&#323;",[210]="&#327;",[211]="&Oacute;",[212]="&Ocirc;",[213]="&#336;",[214]="&Ouml;",[215]="&times;",
[216]="&#344;",[217]="&#366;",[218]="&Uacute;",[219]="&#368;",[220]="&Uuml;",[221]="&Yacute;",[222]="&#354;",
[223]="&szlig;",[224]="&agrave;",[225]="&aacute;",[226]="&acirc;",[227]="&#259;",[228]="&auml;",[229]="&#314;",
[230]="&#263;",[231]="&ccedil;",[232]="&#269;",[233]="&eacute;",[234]="&#281;",[235]="&euml;",[236]="&#283;",
[237]="&iacute;",[238]="&icirc;",[239]="&#271;",[240]="&#273;",[241]="&#324;",[242]="&#328;",[243]="&oacute;",
[244]="&ocirc;",[245]="&#337;",[246]="&ouml;",[247]="&divide;",[248]="&#345;",[249]="&#367;",[250]="&uacute;",
[251]="&#369;",[252]="&uuml;",[253]="&yacute;",[254]="&#355;",[255]="&#729;"
}
Web.Timer = TmrMan.AddTimer(60000)
local r,e = os.rename("web","web")
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath.."scripts") lfs.mkdir("web") lfs.chdir(Web.HubPath)
end
Initialize()
DoCss()
DoRoot(1)
DoTabs(1)
Web.Refresh = true
Initialize,DoCss,DoRoot,DoPopMenu,Web.Links,Web.Style,Copy = nil,nil,nil,nil,nil,nil,nil
collectgarbage("collect")
if Web.Addy ~= "" then Core.SendToAll("<"..Web.Bot.."> "..Web.Addy) end
OnError(Web.Script.." has been started. Memory usage: "..string.format("%.2f Kb.",collectgarbage("count")),true)
end

OnExit = function()
DoTabs(1,Web.Site[1])
local time = os.time()
for _,v in ipairs(Times) do
v[3] = (time - v[2]) + v[3]
v[2] = time
v[4] = 0
end
SaveToFile(Web.HubPath.."scripts/web/errlog.web",Web.ErrLog,"Web.ErrLog")
SaveToFile(Web.Site[3][2],Shares,"Shares")
SaveToFile(Web.Site[2][2],Chat,"Chat")
collectgarbage("collect")
OnError(Web.Script.." has been stopped, freeing "..
string.format("%.2f Kb.",collectgarbage("count")).." of memory.",true)
end

OnError = function(msg,nolog)
local stamp = os.date()
if not nolog then table.insert(Web.ErrLog,{stamp,msg}) end
if Web.Report == "on" and Web.OpNick ~= "" then
Core.SendToNick(Web.OpNick,"<"..Web.Bot.."> "..msg)
end
end

OnTimer = function(Id)
if Id == Web.Timer then
SaveToFile(Web.Site[2][2],Chat ,"Chat")
if next(Web.ErrLog) then
SaveToFile(Web.HubPath.."scripts/web/errlog.web",Web.ErrLog,"Web.ErrLog")
Web.ErrLog = {}
end
DoTabs(1)
collectgarbage("collect")
end
end

UserConnected = function(user)
DoTabs(1,Web.Site[1]); DoTabs(1,Web.Site[4],user.sNick)
if #Web.Greeting > 0 then Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Greeting:gsub("%b[]",user.sNick)) end
if Web.Addy ~= "" then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Addy)
end
if user.iProfile ~= -1 then
if GenCmds(user) then
Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..Web.Script.." commands enabled, see hub tab for more.")
end
end
end
OpConnected,RegConnected = UserConnected,UserConnected

UserDisconnected = function(user)
DoTabs(1,Web.Site[1]) DoTabs(1,Web.Site[4],user.sNick)
end
OpDisconnected = UserDisconnected

MyINFOArrival = function(user,data)
DoTabs(1,Web.Site[3])
end

ChatArrival = function(user,data)
local _,_,pfx = data:find("%b<> (["..SetMan.GetString(29).."])")
local _,_,ctrl = data:find("%c")
local _,_,sb = data:lower():find("is kicking because:",1,true)
if not pfx and not ctrl and not sb then
local _,_,txt = data:find("^%b<> (.*)|$")
if txt then
local _,n = data:gsub("%p","%1")
if n <= 5 and txt:len() >= 2 then
data = DoAscii(data:sub(1,-2))
local now = string.lower(os.date("[%H:%M]"))
table.insert(Chat,{now,data})
if #Chat > 100 then table.remove(Chat,1) end
end
end
else
local _,_,cmd = data:find("^%b<> %p(%a+)")
if cmd then
local str
for i,v in ipairs(Web.Site) do
if cmd:lower() == v[1]:lower() then
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
str = "\r\n\r\n\t"..v[4].."\r\n\t"..string.rep("¯",v[4]:len()).."\r\n"
for idx,val in ipairs(v[6]()) do
if cmd:lower() == "chat" or cmd:lower() == "hubstats" then
str = str..val.."\r\n"
else
str = str.."\t"..idx.."\t"..val.."\r\n"
end
end
str = str.."\r\n"
return Core.SendPmToNick(user.sNick,Web.Bot,str),true
else
local prof = "Unregistered User"
if u.iProfile ~= -1 then
prof = ProfMan.GetProfile(u.iProfile).sProfileName
end
local pfx = SetMan.GetString(29):sub(1,1) or "+"
local msg = "Sorry "..user.sNick..", "..prof.."'s are "..
"not allowed use of the "..pfx..cmd:lower().." command."
return Core.SendToNick(user.sNick,"<"..Web.Bot.."> "..msg),
Core.SendPmToNick(user.sNick,Web.Bot,msg),true
end
end
end
end
end
end
ToArrival = ChatArrival

Initialize = function()
local topic,desc = SetMan.GetString(10) or "",SetMan.GetString(5) or ""
local HubApp,HubVer = "PtokaX", Core.Version
Web.Root = {
[1] = {"index.html","Index"},
[2] = {"top.html","Top"},
[3] = {"main.html","Main"},
[4] = {"bottom.html","Bottom"},
[5] = {"left.html","Menu"},
[6] = {"pxstyle.css","CSS"}
}
Web.Site = {
[1] = {"Users",path.."web/users.web","users.html","Online Users",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"<b>Profile</b>","<b>User Nick</b>"..s})
table.insert(x,{" "," "})
Users = {}
for i,u in ipairs(t) do
local p
if u.iProfile ~= -1 then
p = ProfMan.GetProfile(u.iProfile).sProfileName
else
p = "Unregistered User"
end
table.insert(x,{p,u.sNick})
table.insert(Users,{p,u.sNick})
end
SaveToFile(Web.Site[1][2],Users,"Users")
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(x,Web.Site[1][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Users) do
table.insert(t,table.concat(v," "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[2] = {"Chat",path.."web/chat.web","chat.html","Recent Chat",
function()
local t,x = Chat,{}
if next(t) then
table.insert(x,{"<b>Time</b>","<b>Chat Message</b>"})
table.insert(x,{" "," "})
for i,v in ipairs(t) do
table.insert(x,{v[1],v[2]})
end
end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
local cform = "<form method=\"POST\" action=\"http://mutor.no-ip.com:6800\">"..
"Nick:<input size=\"40\" maxlength=\"40\" type=\"text\" name=\"Nick\"><br>"..
"Message:<input size=\"100\" maxlength=\"100\" type=\"text\" name=\"msg\"><br>"..
"<input type=\"submit\" value=\"Send\"></center><br><br></form>"
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"10\">\n"..
Web.Body..GenTab(x,Web.Site[2][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,"\t"..v[1].."  "..DoAscii(v[2],1):gsub("\r\n","%1\t\t   "))
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[3] = {"Shares",path.."web/shares.web","shares.html","Top Shares",
function()
local t,x = Core.GetOnlineUsers(),{}
if t and next(t) then
local s = "&nbsp;&nbsp;"
s = s:rep(20)
table.insert(x,{"<b>User Nick</b>","<b>Share Value</b>"..s})
table.insert(x,{" "," "})
for i,u in ipairs(t) do
if Core.GetUserAllData(u) then
local exist
if next(Shares) then
for _,v in ipairs(Shares) do
if v[1]:lower() == u.sNick:lower() then
v[2] = u.iShareSize
exist = true
break
end
end
end
if not exist then
table.insert(Shares,{u.sNick,u.iShareSize})
end
end
end
table.sort(Shares, function(a,b)return a[2] > b[2] end)
SaveToFile(Web.Site[3][2],Shares,"Shares")
if next(Shares) then
for z = 1, math.min(#Shares,10) do
if Shares[z][2] > 0 then
table.insert(x,{Shares[z][1],FmtSz(Shares[z][2])})
end
end
end
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(x,Web.Site[3][4],1)..Web.Foot
end,
function()
local t = {}
for i,v in ipairs(Shares) do
if v[2] > 0 then table.insert(t,FmtSz(v[2]).."\t\t"..v[1]) end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[4] = {"Times",path.."web/times.web","times.html","Top Uptimes",
function(nick)
local t,x,time = Core.GetOnlineUsers(),{},os.time()
if t and next(t) or nick then
table.insert(x,{"<b>User Nick</b>","<b>Uptime Value</b>"})
table.insert(x,{" "," "})
if nick then
for _,v in ipairs(Times) do
local z = 0
if v[1]:lower() == nick:lower() then
exist = true
if Core.GetUser(nick) then
z = 1
v[2] = time
v[4] = z
else
v[3] = (time - v[2]) + v[3]
v[4] = z
end
break
end
end
else
if next(t) then
for i,u in ipairs(t) do
local exist
for _,v in ipairs(Times) do
if v[1]:lower() == u.sNick:lower() then
exist = true
if Web.Refresh then
v[3] = (time - v[2]) + v[3]
v[2] = time
end
v[4] = 1
break
end
end
if not exist then
table.insert(Times,{u.sNick,time,0,1})
end
end
end
end
table.sort(Times, function(a,b)return a[3] > b[3] end)
SaveToFile(Web.Site[4][2],Times,"Times")
if next(Times) then
for z = 1, math.min(#Times,10) do
if (time - Times[z][3]) > 0 then
table.insert(x,{Times[z][1],Convert(time - Times[z][3])})
end
end
end
end
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"600\">\n"..
Web.Body..GenTab(x,Web.Site[4][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(Times) do
if v[2] > 0 and v[3] > 0 then
table.insert(t,string.format("%-50.30s",v[1]).." \t•"..Convert(time - v[3]))
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[5] = {"HubStats",path.."web/stats.web","stats.html","Hub Statistics",
function()
local b,m = "&nbsp;","Public, unregistered users welcome."
local topic = SetMan.GetString(10) or "There is no current topic."
local sr,hr,ss,hs = Chk(SetMan.GetNumber(8)),Chk(SetMan.GetNumber(7)),"slot","hub"
if SetMan.GetBool(5) then m = "Private, registered users only." end
if sr and type(sr) == "number" and sr > 1 then ss = ss.."s" end
if hr and type(hr) == "number" and hr > 1 then hs = hs.."s" end
  local t = {
[1] = {b.."Hub Name:",SetMan.GetString(0)},
[2] = {b.."Hub Desc.:",SetMan.GetString(5)..""},
[3] = {b.."Hub Topic:",topic..""},
[4] = {b.."Hub Time:",os.date("%B %d %Y %X")..""},
[5] = {b.."HubOwner:",Web.Owner..""},
[6] = {b.."Hub Uptime:",Convert(os.time() - Core.GetUpTime())..""},
[7] = {b.."Min Share:",FmtSz(SetMan.GetMinShare())..""},
[8] = {b.."Min Slots:",Chk(SetMan.GetNumber(5)).." per user."},
[9] = {b.."Max Slots:",Chk(SetMan.GetNumber(6)).." per user."},
[10] = {b.."Slot Ratio:",sr.." "..ss.." per "..hr.." "..hs.."."},
[11] = {b.."Max Hubs:",Chk(SetMan.GetNumber(9)).." per user."},
[12] = {b.."Peak Users:",Core.GetMaxUsersPeak()},
[13] = {b.."Hub Share:",FmtSz(Core.GetCurrentSharedSize())},
[14] = {b.."There Are:",#Core.GetOnlineUsers().." of a possible "..SetMan.GetNumber(0).." users online."},
[15] = {b.."Hub Mode:",m},
}
table.insert(t,1,{" "," "})
SaveToFile(Web.Site[5][2],t ,Web.Site[5][1])
return Web.Head..Web.Css.."<meta http-equiv=\"refresh\" content=\"60\">\n"..
Web.Body..GenTab(t,Web.Site[5][4],1)..Web.Foot
end,
function()
local t,time = {},os.time()
for i,v in ipairs(HubStats) do
if i > 1 then
table.insert(t,"\t"..string.format("%-20.15s",v[1]:gsub("&nbsp;"," ")).."\t•"..v[2])
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
[6] = {"Downloads",path.."web/files.web","files.html","File Downloads",
function()
if not Web.Refresh then
local fpath,url,t = Web.Downloads,Web.FileUrl,{}
local Invalid = {"wr.cfg",".db",".pif",".lnk",".sys",".part",".msc",".vxd",".mft",".adm",
".mapimail",".ins",".cpl",".nt","~",".tmp",".$",".&",".chk",".shs",".desklink",".url",".htm"}
local CheckFile = function(file)
for i,v in ipairs(Invalid) do
if file:find(v:lower(),1,true) then return false end
end
return true
end
Downloads,Total = {},0
if Web.ListFiles then OnError("Listing files in: "..fpath) end
lfs.chdir(fpath)
for item in lfs.dir(fpath) do
if CheckFile(item) then
local x = lfs.attributes(item)
if x and x.mode == "file" then
local time,size,name = os.date(nil,x.modification),x.size,item:gsub("%s","%%20")
Total = Total + size
table.insert(Downloads,{time,FmtSz(size),"<a href=\""..url.."/"..name.."\"/>"..item.."</a>"})
table.insert(t,{time,FmtSz(size),"<a href=\""..url.."/"..name.."\"/>"..item.."</a>"})
if Web.ListFiles then OnError(tostring(#Downloads).." ) "..item) end
end
end
end
if Web.ListFiles then
OnError("End of listing, "..tostring(#Downloads).." found.")
else
OnError(tostring(#Downloads).." downloads in "..fpath.." processed.")
end
local pl,sp = "s","&nbsp;"
if #Downloads == 1 then pl = "" end
table.insert(t,{" "," "," "})
table.insert(t,{sp:rep(25).."<b>Totals:</b>","<b>"..FmtSz(Total).."</b>","<b>"..AddComma(#Downloads).." file"..pl})
table.insert(t,1,{"<b>Date / Time</b>","<b>Size</b>","<b>Name</b>"})
table.insert(t,2,{" "," "," "})
lfs.chdir(Web.HubPath.."scripts")
SaveToFile(Web.Site[6][2],Downloads,"Downloads")
return Web.Head..Web.Css..Web.Body..GenTab(t,Web.Site[6][4],1)..Web.Foot
end
end,
function()
local t = {}
for i,v in ipairs(Downloads) do
local _,_,file = v[3]:find("%>(%S+)%</")
if file then
table.insert(t,file.."\t("..v[2]..")")
end
end
return t
end,
-- Adjust To Your Profiles [0 = disable / 1 = enable]
{[-1] = 0,[0] = 1,[1] = 1,[2] = 1,[3] = 1,[4] = 1,[5] = 1,[6] = 1,}},
}
Web.Head = "<html>\n<head>\n<title>"..SetMan.GetString(0).." - ‹›</title>\n"..
"<meta http-equiv=page-enter content=\"blendTrans(Duration=2)\">\n"..
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"..
"<meta name=robots content=\"noindex,nofollow\">\n"..
"<meta http-equiv=pragma content=no-cache>\n"..
"<link rel=\"shortcut icon\" href=\"favicon.ico\">\n"
Web.Frame = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n"..
"\"http://www.w3.org/TR/html4/frameset.dtd\">\n"..Web.Head
Web.Head = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"..
"\"http://www.w3.org/TR/html4/loose.dtd\">\n"..Web.Head
Web.Css = "<link rel=\"stylesheet\" href=\""..Web.Root[6][1].."\" type=\"text/css\">\n"
--Index
Web.Root[1][3] = Web.Frame.."</head>\n<frameset rows=\"130,*,45\" cols=\"*\">\n"..
"<frame name=\"top\" src=\"top.html\" scrolling=\"no\" frameborder=\"0\">\n"..
"<frameset cols=\"200,800\" rows=\"*\" >\n"..
"<frame name=\"menu\" src=\"left.html\" scrolling=\"no\" frameborder=\"0\">\n"..
"<frame name=\"contents\" src=\"main.html\" scrolling=\"no\" frameborder=\"0\">\n</frameset>\n"..
"<frame name=\"bottom\" scrolling=\"no\" noresize src=\"bottom.html\" frameborder=\"0\">\n"..
"<noframes>\n<p>This document uses frames, but your browser doesn't support them.</p>\n"..
"</noframes>\n</frameset>\n</html>"
--Top
Web.Root[2][3] = Web.Head..Web.Css.."</head>\n<body>\n"..
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr>\n<td class=\"table0\" align=\"left\">"..
"&nbsp;<script type=\"text/javascript\">document.write(Date())</script></td>\n</tr>\n"..
"<tr>\n<td class=\"table1\" align=\"right\">"..HubApp.." "..HubVer..": "..desc.."&nbsp;&nbsp;&nbsp;</td>\n</tr>\n"..
"<tr align=\"center\" valign=\"top\">\n<td class=\"table3\">\n<div align=\"center\">\n<h1>"..
SetMan.GetString(0).."</h1>\n<h3>..."..topic.."</h3>\n</div>\n</td>\n</tr>\n</table>\n"..
Web.Foot
--Main
Web.Root[3][3] = Web.Head..Web.Css..Web.Body..
"<table width=\"100%\" height=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n"..
"<tr><td class=\"table1\" valign=\"top\" align=\"left\">.:: "..Web.Root[3][2].." ::.</td>\n</tr>"..
"</table>\n<iframe name=\"main\" class=\"table2\" scrolling=yes width=\"100%\" "..
"height=\"400\" align=\"left\" frameborder=\"0\" src=\""..Web.Content.."\"></iframe>\n"..Web.Foot
--Bottom
Web.Root[4][3] = Web.Head..Web.Css..Web.Body..
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr>\n<td class=\"table1\" align=\"left\" colspan=\"2\" ></td>\n</tr>\n<tr>\n"..
"<td class=\"table0\" align=\"center\" colspan=\"2\" ><script type=\"text/javascript\">"..
"document.write(\"You're using: \"+navigator.appName+\" \"+navigator.appCodeName+\" \"+navigator.appVersion+\"\");\n"..
"</script>\n</td>\n</tr>\n</table>\n"..Web.Foot
--Left - Menu
local ScpLinks = {}
for i,v in ipairs(Web.Links) do
local t = {}
if tonumber(v[1]) and v[3] then
table.insert(ScpLinks,{v[1],v[2],v[3]})
end
end
Web.Root[5][3] = Web.Head..DoPopMenu(ScpLinks)..Web.Css..Web.Body..
"<table width=\"95%\" align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr><td class=\"table1\">.:: Menu ::.</td></tr>\n<tr valign=\"top\">\n<td class=\"table2\">"..
"<a href=\"#\" class=\"menu\" target=\"_self\">Navigation:</a>\n<br><a href=\"index.html\" target=\"_top\">Home</a>\n"
for i,v in ipairs(Web.Site) do
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..
v[3].."\" target=\"main\">"..v[4].."</a>\n"
end
local t = {
[1] = {"Connect to Hub","dchub://"..SetMan.GetString(2)..":"..SetMan.GetString(3):gsub("%;.*$","")},
[2] = {"Contact","mailto:"..Web.Mail.."?subject=About the "..SetMan.GetString(0).." website&amp;body=Dear "..Web.Owner..","},
}
t[2][2] = t[2][2]:gsub(" ","%%20")
for i,v in ipairs(t) do
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..
v[2].."\" target=\"main\">"..v[1].."</a>\n"
end
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\"#\" class=\"menu\" target=\"_self\">Web Links:</a>\n"
for i,v in ipairs(Web.Links) do
if tonumber(v[1]) then
if not v[3] then
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\"#\" onMouseover=\"showmenu(event,linkset["..
v[1].."], '130px')\" onMouseout=\"delayhidemenu()\">"..v[2].."</a> <b>&raquo;</b>\n"
end
else
local url = v[1]:gsub(" ","%%20")
Web.Root[5][3] = Web.Root[5][3].."<br><a href=\""..url.."\" "
if v[1] == "#" or v[1]:find("^dchub://") then
if v[1] == "#" then
Web.Root[5][3] = Web.Root[5][3].."class=\"menu\" "
end
Web.Root[5][3] = Web.Root[5][3].."target=\"_self\">"
elseif not tonumber(v[1]) then
if v[3] then
Web.Root[5][3] = Web.Root[5][3].."target=\""..v[3].."\">"
else
Web.Root[5][3] = Web.Root[5][3].."target=\"_blank\">"
end
end
Web.Root[5][3] = Web.Root[5][3]..v[2].."</a>\n"
end
end
Web.Root[5][3] = Web.Root[5][3].."</td></tr>\n</table>\n"..Web.Foot
local HubDir = Web.HubPath
local tab = {}
for dir in string.gmatch(Web.Path.."/images/","(%a+)/") do
table.insert(tab,dir)
end
local CheckDir = HubDir..table.concat(tab,"//")
if not os.rename(CheckDir,CheckDir) then
for _,folder in ipairs(tab) do
HubDir = HubDir..folder
local r,e = os.rename(HubDir,HubDir)
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath) lfs.mkdir(folder)
end
HubDir = HubDir.."/"
end
end
Copy(Web.HubPath..Web.MainText,Web.HubPath..Web.Path..Web.Content)
local FileDir,FirstStart = Web.HubPath..Web.Path..Web.FileUrl,true
local r,e = os.rename(FileDir,FileDir)
if e and not e:lower():find("permission denied") then
lfs.chdir(Web.HubPath..Web.Path) lfs.mkdir(Web.FileUrl)
else
FirstStart = false
end
local sample = Web.HubPath..Web.FileUrl.."/Setting_Up_Downloads.txt"
if FirstStart and not os.rename(sample,sample) then
local directions = "Simply copy your files to this folder "..
"[ Default = C:/Ptokax/html/webstats/files ]\nThen restart this "..
"script and reload the dowloads page to see the new files you've added.\n"..
"You may delete this file at any time.\r\n\r\n"..string.rep(string.char(9),6).." -Mutor"
local f,e = io.open(sample,"w")
if f then
f:write(directions) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end
end

GenTab = function(t,s,noidx)
local txt = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
if s then
txt = txt.."\t<tr><td class=\"table0\" valign=\"top\">.:: "..s.." ::.</td></tr></table>\n"
else
txt = txt.."\t<tr><td class=\"table0\" valign=\"top\">&nbsp;</td></tr>\n"
end
txt = txt.."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
if next(t) then
for i,v in ipairs(t) do
if noidx then
txt = txt.."\n\t<tr align=\"left\" valign=\"top\">"
else
txt = txt.."\n\t<tr align=\"left\" valign=\"top\">"..
"<td class=\"table3\" width=\"10%\">&nbsp;"..i.."</td>"
end
if type(v) == "table" then
local z = #v
for x=1, z do
if x < z then
txt = txt.."<td class=\"table3\" width=\""..(12*x)..
"%\">&nbsp;<b>"..v[x].."</b></td>"
else
local s = (100 - (x*12))
txt = txt.."<td class=\"table3\"width=\""..s.."%\">&nbsp;"..v[x].."</td>"
end
end
else
txt = txt.."<td class=\"table3\" width=\"90%\">&nbsp;"..v.."</td>"
end
end
txt = txt.."</tr>\n"
else
txt = txt.."\t<tr><td> No</td>\n<td>Data</td>\n</tr>\n"
end
txt = txt.."</table>\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"\t<tr><td class=\"table2\" valign=\"top\"></td></tr>\n</table>\n"
return txt
end

DoHtml = function(file,title,body)
local method = "updated"
if not os.rename(file,file) then method = "saved" end
body = body:gsub("%b‹›",title)
local f,e = io.open(file,"w")
if f then
if not Web.Refresh then
OnError(title.." has been "..method)
end
f:write(body) f:flush() f:close()
else
OnError(e:sub(1,2))
end
end

DoRoot = function(x)
for i,v in ipairs(Web.Root) do
if v[3] then
if x or not os.rename(Web.Url..v[1],Web.Url..v[1]) then
DoHtml(Web.Url..v[1],v[2],v[3])
end
end
end
end

DoTabs = function(x,t,n)
if x and t and n then
if t[5] then
local html = t[5](n)
if html then
DoHtml(Web.Url..t[3],t[4],html)
end
end
else
for i,v in ipairs(Web.Site) do
local tab = v[1]
if loadfile(v[2]) then
dofile(v[2])
if v[1] == "Chat" and Chat and next(Chat) then
if Chat[1][3] then
local t = {}
for i,v in ipairs(Chat) do
table.insert(t,{v[1],"&lt;"..v[2].."&gt; "..
DoAscii(v[3]:gsub("&bull;",""))})
end
Chat = t
end
SaveToFile(Web.Site[2][2],Chat ,"Chat")
end
else
tab = {}
SaveToFile(v[2],tab,v[1])
dofile(v[2])
end
if x or not os.rename(Web.Url..v[3],Web.Url..v[3]) then
if v[5] then
local html = v[5]()
if html then
DoHtml(Web.Url..v[3],v[4],html)
end
end
end
end
end
end

DoCss = function()
local css = "body {\n"..
"\tcolor: "..Web.Style.fcolor..";\n"..
"\tfont-family: "..Web.Style.font..";\n"..
"\tbackground-image: url("..Web.Style.bgimage..");\n"..
"\tbackground-repeat: repeat;\n"..
"\tbackground-color: "..Web.Style.bgcolor..";\n"..
"}\n"..
"a:link {\n"..
"\tcolor: "..Web.Style.lcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:visited {\n"..
"\tcolor: "..Web.Style.vcolor..";\n"..
"\ttext-decoration: none;\n"..
"}\n"..
"a:hover {\n"..
"\tcolor: "..Web.Style.hcolor..";\n"..
"\ttext-decoration: underline overline;\n"..
"}\n"..
".menu {\n"..
"\tcolor: #E9E9F8;\n"..
"\ttext-decoration: none;\n"..
"\twidth: 100%;\n"..
"\tbackground-color: #8784C6;\n"..
"}\n"..
".table0 {\n"..
"\theight: 12px;\n"..
"\tcolor: #E9E9F8;\n"..
"\tfont-size: 12px;\n"..
"\tbackground-color : #1E2580;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table1 {\n"..
"\theight: 12px;\n"..
"\ttext-indent: 5px;\n"..
"\tcolor : White;\n"..
"\tfont-size : 12px;\n"..
"\tbackground : #8784C6;\n"
if Web.Style.tborders == "yes" then
css = css.."\tbackground-color : #8784C6;\n"..
"\tborder-bottom: 2px solid Black;\n"..
"\tborder-left: 1px solid Black;\n"..
"\tborder-right: 1px solid Black;\n"..
"\tborder-top: 1px solid Black;\n"
end
css = css.."}\n"..
".table2 {\n"..
"\theight: 400px;\n"..
"\twidth: 100%;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table3 {\n"..
"\theight: 12px;\n"..
"\twidth: auto;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 12px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}\n"..
".table4 {\n"..
"\theight: 12px;\n"..
"\twidth: auto;\n"..
"\tcolor: Black;\n"..
"\tfont-size: 8px;\n"..
"\tbackground: #E9E9F8;\n"
if Web.Style.tborders == "yes" then
css = css.."\tborder-top: 1px solid #8784C6;\n"..
"\tborder-bottom: 1px solid #8784C6;\n"..
"\tborder-left: 1px solid #8784C6;\n"..
"\tborder-right: 1px solid #8784C6;\n"
end
css = css.."}"
local f,e = io.open(Web.Url..Web.Root[6][1], "w")
if f then
f:write(css) f:flush() f:close()
else
OnError(e:sub(1,-2))
end
end

DoPopMenu = function(t)
if next(t) then
local scp = "<style type=\"text/css\">\n"..
"\n"..
"#popitmenu{\n"..
"position: absolute;\n"..
"background-color: white;\n"..
"border:1px solid black;\n"..
"font: normal 12px Verdana;\n"..
"line-height: 18px;\n"..
"z-index: 100;\n"..
"visibility: hidden;\n"..
"}\n"..
"\n"..
"#popitmenu a{\n"..
"text-decoration: none;\n"..
"padding-left: 6px;\n"..
"color: black;\n"..
"display: block;\n"..
"}\n"..
"\n"..
"#popitmenu a:hover{ /*hover background color*/\n"..
"background-color: #E9E9F8;\n"..
"}\n"..
"\n"..
"</style>\n"..
"\n"..
"<script type=\"text/javascript\">\n"..
"\n"..
"/***********************************************\n"..
"* Pop-it menu- &copy; Dynamic Drive (www.dynamicdrive.com)\n"..
"* This notice MUST stay intact for legal use\n"..
"* Visit http://www.dynamicdrive.com/ for full source code\n"..
"***********************************************/\n"..
"\n"..
"var defaultMenuWidth=\"150px\" //set default menu width.\n"..
"\n"..
"var linkset=new Array()\n"..
"\n"
--"linkset[0]+='\<a href=\"http://www.javascriptkit.com\"\>JavaScript Kit\</a\>'\n"..
for i,v in ipairs(t) do
local add = "+"
if i == 1 then add = "" end
--OnError(tostring(i).."\t"..v[1].."\t"..v[2].."\t"..v[3])
scp = scp.."linkset["..v[1].."]"..add.."='<a href=\""..v[2].."\" target=\"_blank\">"..v[3].."</a>'\n"
end
scp = scp.."\n"..
"var ie5=document.all && !window.opera\n"..
"var ns6=document.getElementById\n"..
"if (ie5||ns6)\n"..
"document.write('<div id=\"popitmenu\" onMouseover=\"clearhidemenu();\" onMouseout=\"dynamichide(event)\"></div>')\n"..
"function iecompattest(){\n"..
"return (document.compatMode && document.compatMode.indexOf(\"CSS\")!=-1)? document.documentElement : document.body\n"..
"}\n"..
"function showmenu(e, which, optWidth){\n"..
"if (!document.all&&!document.getElementById)\n"..
"return\n"..
"clearhidemenu()\n"..
"menuobj=ie5? document.all.popitmenu : document.getElementById(\"popitmenu\")\n"..
"menuobj.innerHTML=which\n"..
"menuobj.style.width=(typeof optWidth!=\"undefined\")? optWidth : defaultMenuWidth\n"..
"menuobj.contentwidth=menuobj.offsetWidth\n"..
"menuobj.contentheight=menuobj.offsetHeight\n"..
"eventX=ie5? event.clientX : e.clientX\n"..
"eventY=ie5? event.clientY : e.clientY\n"..
"//Find out how close the mouse is to the corner of the window\n"..
"var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX\n"..
"var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY\n"..
"//if the horizontal distance isn't enough to accomodate the width of the context menu\n"..
"if (rightedge<menuobj.contentwidth)\n"..
"//move the horizontal position of the menu to the left by it's width\n"..
"menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+\"px\" : window.pageXOffset+eventX-menuobj.contentwidth-\"px\"\n"..
"else\n"..
"//position the horizontal position of the menu where the mouse was clicked\n"..
"menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+\"px\" : window.pageXOffset+eventX+\"px\"\n"..
"//same concept with the vertical position\n"..
"if (bottomedge<menuobj.contentheight)\n"..
"menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+\"px\" : window.pageYOffset+eventY-menuobj.contentheight+\"px\"\n"..
"else\n"..
"menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+\"px\" : window.pageYOffset+eventY+\"px\"\n"..
"menuobj.style.visibility=\"visible\"\n"..
"return false\n"..
"}\n"..
"function contains_ns6(a, b) {\n"..
"//Determines if 1 element in contained in another- by Brainjar.com\n"..
"while (b.parentNode)\n"..
"if ((b = b.parentNode) == a)\n"..
"return true;\n"..
"return false;\n"..
"}\n"..
"function hidemenu(){\n"..
"if (window.menuobj)\n"..
"menuobj.style.visibility=\"hidden\"\n"..
"}\n"..
"function dynamichide(e){\n"..
"if (ie5&&!menuobj.contains(e.toElement))\n"..
"hidemenu()\n"..
"else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))\n"..
"hidemenu()\n"..
"}\n"..
"function delayhidemenu(){\n"..
"delayhide=setTimeout(\"hidemenu()\",500)\n"..
"}\n"..
"function clearhidemenu(){\n"..
"if (window.delayhide)\n"..
"clearTimeout(delayhide)\n"..
"}\n"..
"if (ie5||ns6)\n"..
"document.onclick=hidemenu\n"..
"</script>\n"
return scp
end
end

function Chk(enable)
if enable == "" or not enable then enable = "not set" end
return enable
end

FmtSz = function(int)
local i,u,x=tonumber(int) or 0,{"","K","M","G","T","P"},1
while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x])
end

AddComma = function(i) i = tostring(i) repeat i,x = i:gsub("^(-?%d+)(%d%d%d)", '%1,%2') until x == 0 return i end

Convert = function(time)
time = time or 0
local s,x,n,tab = "",0,os.time(),{
[1] = {31556926,"year"},
[2] = {2592000,"month"},
[3] = {604800,"week"},
[4] = {86400,"day"},
[5] = {3600,"hour"},
[6] = {60,"minute"},
[7] = {1,"second"}
}
if time > 0 then
if time < 2145876659 then
if n > time then
time = n - time
for i,v in ipairs(tab) do
if time > v[1] then
x = math.floor(time/v[1])
if x > 1 then v[2] = v[2].."s" end
if x > 0 then
s = s..x.." "..v[2]..", "
time = time-x*v[1]
end
end
end
end
collectgarbage("collect")
return s:sub(1,-3)
else
return "Invalid date or time supplied. [must be pre 12/31/2037]"
end
else
return "No uptime recorded"
end
end

Copy = function(source,target)
local is,os,text
local f,e = io.open(source)
if f then
text,is = f:read("*a"),f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
local tab = {
{"%[Hub%]",0},{"%[Admin%]",1},{"%[Addr%]",2},{"%[Desc%]",5},{"%[Redir%]",6},
{"%[List%]",7},{"%[Topic%]",10},{"%[Bot%]",21},{"%[OpChat%]",24},{"%[Email%]",30},
{"%[Lang%]",34}, }
for i,v in ipairs(tab) do text = text:gsub(v[1],SetMan.GetString(v[2]) or "%1: Not Set In GUI!") end
if text then
local f,e = io.open(target,"w")
if f then
text = Web.Head:gsub("%b‹›","MOTD")..Web.Css..Web.Body..
"<table class=\"table2\" bgcolor=\"#E9E9F8\" width=\"100%\" "..
"border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"..
"<tr><td class=\"table3\" valign=\"top\">\n<pre>"..text.."</pre>"..Web.Ad..
"\n</td></tr>\n</table>\n"..Web.Foot
f:write(text) f:flush() os = f:seek("end") f:close()
else
OnError(e:sub(1,-2))
end
end
end

--Replace certain characters with html ASCII code & vice versa
DoAscii = function(data,rev)
if rev then
for i,v in pairs(Web.Asc) do
data = data:gsub(v,string.char(i))
end
return data
else
for chr in data:gmatch(".") do
local x = Web.Asc[string.byte(chr)]
if x then
data = data:gsub(chr,x)
end
end
return data
end
end

GenCmds = function(user)
local c,t,x = "",{}
local p,m,s = SetMan.GetString(29):sub(1,1),SetMan.GetString(0),Web.Script
for i,v in ipairs(Web.Site) do
if v[7][user.iProfile] and v[7][user.iProfile] == 1 then
x = true
c = c.."$UserCommand 1 1 "..m.."\\"..s.."\\"..
v[4].."$<%[mynick]> "..p..v[1]:lower().."&#124;|"
end
end
if x then
Core.SendToNick(user.sNick,c:sub(1,-2))
return x
end
end

function Serialize(tTable, sTableName, sTab)
sTab = sTab or ""
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in ipairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t")
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename,mode)
if not mode then mode = "w" end
local handle,err = io.open(file,mode)
if handle then
handle:write(Serialize(table, tablename)) handle:flush() handle:close()
else
OnError(err:sub(1,2))
end
end
« Last Edit: August 28, 2010, 06:55:14 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline TZB

  • Double Ace
  • *
  • Posts: 149
  • Karma: +13/-0
  • ||-T-z-B-||
    • Gigabyte
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #33 on: August 29, 2010, 06:44:18 am »
Thanks a lot.. working great.
gigahub.no-ip.biz:666

Offline sky202_how89

  • Junior Member
  • **
  • Posts: 21
  • Karma: +0/-0
Re: PxWeb 1.0c LUA 5.11 [Strict] [API 2]
« Reply #34 on: October 28, 2010, 05:32:14 pm »
Sorry.. Error here..

[23:33] Syntax ...412\scripts\PxWeb 1.0e LUA 5.11 [Strict] [API 2].lua:430: bad argument #1 to 'ipairs' (table expected, got nil)


 

determinate determinate
guestbook