Module:UserLinks/extra

--------------------------------------------------------------------------------
-- This module holds extra link functions for use with [[Module:UserLinks]].
--
-- It is intended for experimenting with new link functions that will eventually
-- be added to the main module code.
--
-- Since this module is transcluded in only a small number of pages, changes
-- should cause little server overhead and should propagate quickly.
--
-- Link functions using the same link code as a function in the main module will
-- be ignored; please give your function a unique code.
--------------------------------------------------------------------------------

-- Load shared helper functions
local mShared = require('Module:UserLinks/shared')
local raiseError = mShared.raiseError
local makeWikitextError = mShared.makeWikitextError
local makeWikilink = mShared.makeWikilink
local makeUrlLink = mShared.makeUrlLink
local makeFullUrlLink = mShared.makeFullUrlLink
local message = mShared.message

local linkFunctions = {}

function linkFunctions.coibot(snippets)
	-- COIBot report
	return makeWikilink(
		nil,
		4,
		'WikiProject Spam/UserReports/' .. snippets.username,
		'COIBot'
	)
end

function linkFunctions.fa(snippets)
	-- Former admin label
	return message('display-formeradmin')
end

function linkFunctions.ggl(snippets)
	-- Google search for the username
	return makeUrlLink(
		{
			host = 'www.google.com',
			path = '/search',
			query = {q = snippets.username},
		},
		'Google'
	)
end

function linkFunctions.http(snippets)
	-- To see if an IP is serving a web page

	local host = snippets.username
	if not host:match('^%d+%.%d+%.%d+%.%d+$') then
		if host:match('^[%x:]+$') then
			-- It's IPv6, use RFC 3986 IP-Literal syntax
			host = '[' .. host .. ']'
		else
			-- It's neither IPv4 nor IPv6, return nothing
			return ''
		end
	end

	return makeUrlLink(
		{
			protocol = 'http',
			host = host
		},
		'http'
	)
end

function linkFunctions.lr(snippets)
	-- Local rights
	return makeFullUrlLink(
		snippets.interwiki,
		-1,
		'Log',
		{page = 'User:' .. snippets.username},
		message('display-localrights')
	)
end
	
function linkFunctions.mr(snippets)
	-- Meta user rights
	return makeFullUrlLink(
		'meta',
		-1,
		'Log',
		{page = 'User:' .. snippets.username .. '@enwiki'},
		message('display-metarights')
	)
end

function linkFunctions.msg(snippets)
	-- New message on user talk page
	return makeFullUrlLink(
		snippets.interwiki,
		3,
		snippets.username,
		{
			action = 'edit',
			section = 'new',
		},
		'message'
	)
end

function linkFunctions.rbl(snippets)
	-- Realtime blacklists
	return makeUrlLink(
		{
			protocol = 'https',
			host = 'www.robtex.com',
			path = '/ip-lookup/' .. snippets.username .. '#dnsbl',
		},
		'RBLs'
	)
end

function linkFunctions.rdns(snippets)
	-- Reverse DNS lookup
	return makeUrlLink(
		{
			protocol = 'https',
			host = 'www.dnswatch.info',
			path = '/dns/dnslookup',
			query = {
				la = 'en',
				host = snippets.username,
				submit = 'Resolve'
			}
		},
		'RDNS'
	)
end

function linkFunctions.sbx(snippets)
	-- User sandbox
	return makeWikilink(
		snippets.interwiki,
		2,
		snippets.username .. '/sandbox',
		'sandbox'
	)
end

function linkFunctions.sfs(snippets)
	-- StopForumSpam
	return makeUrlLink(
		{
			protocol = 'https',
			host = 'www.stopforumspam.com',
			path = '/search/' .. snippets.username,
		},
		'StopForumSpam'
	)
end

function linkFunctions.sul2(snippets)
	-- Global contribs, Luxo's tool
	return makeUrlLink(
		{
			host = 'tools.wmflabs.org',
			path = '/guc/index.php',
			query = {
				user = snippets.username,
				lang = snippets.toolLang
			}
		},
		'global contribs'
	)
end

function linkFunctions.uc(snippets)
	-- User creation
	return makeWikilink(
		snippets.interwiki,
		-1,
		'Log/newusers/' .. snippets.username,
		'user creation'
	)
end

function linkFunctions.whois(snippets)
	-- WHOIS information for IPs
	return makeUrlLink(
		{
			protocol = 'https',
			host = 'tools.wmflabs.org',
			path = '/whois/gateway.py',
			query = {
				lookup = 'true',
				ip = snippets.username,
			},
		},
		'WHOIS'
	)
end

function linkFunctions.wlh(snippets)
	-- Links to user page (what links here)
	return makeWikilink(
		snippets.interwiki,
		-1,
		'WhatLinksHere/'
			.. mw.site.namespaces[2].name
			.. ':'
			.. snippets.username,
		'links to user page'
	)
end

function linkFunctions.cr(snippets)
	-- Change rights
	return makeWikilink(
		snippets.interwiki,
		-1,
		'UserRights/' .. snippets.username,
		'change rights'
	)
end

return {linkFunctions = linkFunctions}

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.