پودمان:Checkuser request
ظاهر
local p = {}
local currentTitle = mw.title.getCurrentTitle()
local subpageName = currentTitle.subpageText
local numConv = require('Module:Numeral converter').convert
local function checkSockpuppet(frame, args, index)
if args["زاپاس" .. numConv('fa', index)] then
return "* " .. frame:expandTemplate{ title = 'بازرسی کاربر', args = { args["زاپاس" .. numConv('fa', index)] } } .. "\n"
end
return ""
end
local function checkIP(frame, args, index)
if args["آیپی" .. numConv('fa', index)] then
return "* " .. frame:expandTemplate{ title = 'بازرسی آیپی', args = { args["آیپی" .. numConv('fa', index)] } } .. "\n"
end
return ""
end
function p.main(frame)
local args = frame:getParent().args
local sockpuppets = ""
local ips = ""
local mainUser = "* '''کاربر اصلی:''' " .. frame:expandTemplate{ title = 'بازرسی کاربر', args = {subpageName} } .. "\n"
-- Process زاپاس arguments
local i = 1
while args["زاپاس" .. numConv('fa', i)] do
sockpuppets = sockpuppets .. checkSockpuppet(frame, args, i)
i = i + 1
end
-- Process آیپی arguments
i = 1
while args["آیپی" .. numConv('fa', i)] do
ips = ips .. checkIP(frame, args, i)
i = i + 1
end
-- Generating tools links
local toolsLinks = "ابزارها: [//tools.wmflabs.org/sigma/editorinteract.py?users=" .. subpageName
for index = 1, i - 1 do
if args["زاپاس" .. numConv('fa', index)] then
toolsLinks = toolsLinks .. "&users=" .. frame:preprocess("{{urlencode:" .. args["زاپاس" .. numConv('fa', index)] .. "}}")
end
end
for index = 1, i - 1 do
if args["آیپی" .. numConv('fa', index)] then
toolsLinks = toolsLinks .. "&users=" .. frame:preprocess("{{urlencode:" .. args["آیپی" .. numConv('fa', index)] .. "}}")
end
end
toolsLinks = toolsLinks .. "&startdate=&enddate=&ns=&server=fawiki تشابهیاب ویرایش] • [//tools.wmflabs.org/interaction-timeline?wiki=fawiki&user=" .. subpageName .. "&user=" .. args["زاپاس۱"] .. " خط زمانی بین ویرایشها]\n"
local result = mainUser .. "\n" .. "==== زاپاسهای احتمالی ====\n" .. sockpuppets .. ips .. toolsLinks
return result
end
return p