Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
2104
wp/wp-content/plugins/ip-geo-block/admin/js/admin.js
Normal file
2104
wp/wp-content/plugins/ip-geo-block/admin/js/admin.js
Normal file
File diff suppressed because it is too large
Load Diff
6
wp/wp-content/plugins/ip-geo-block/admin/js/admin.min.js
vendored
Normal file
6
wp/wp-content/plugins/ip-geo-block/admin/js/admin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
520
wp/wp-content/plugins/ip-geo-block/admin/js/authenticate.js
Normal file
520
wp/wp-content/plugins/ip-geo-block/admin/js/authenticate.js
Normal file
@@ -0,0 +1,520 @@
|
||||
/*jslint white: true */
|
||||
/*!
|
||||
* Project: WP-ZEP - Zero-day exploit Prevention for wp-admin
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
(function ($, window, document) {
|
||||
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Description
|
||||
var auth = IP_GEO_BLOCK_AUTH, wpzep = {
|
||||
init: false,
|
||||
regexp: new RegExp(auth.key + '(?:=|%3D)\\w+')
|
||||
},
|
||||
|
||||
// regular expression to find target for is_admin()
|
||||
regexp = new RegExp(
|
||||
'^(?:' + (auth.home || '') + auth.admin
|
||||
+ '|' + (auth.home || '') + auth.plugins
|
||||
+ '|' + (auth.home || '') + auth.themes
|
||||
+ '|' + (auth.admin ) // when site url is different from home url
|
||||
+ ')(?:.*\\.php|.*\\/)?$'
|
||||
),
|
||||
|
||||
// `theme-install.php` eats the query and set it to `request[browse]` as a parameter
|
||||
theme_featured = function (data) {
|
||||
var i = data.length, q = 'request%5Bbrowse%5D=' + auth.key;
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) !== -1) {
|
||||
data[i] = 'request%5Bbrowse%5D=featured'; // correct the parameter
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// `upload.php` eats the query and set it to `query[ip-geo-block-auth-nonce]` as a parameter
|
||||
media_library = function (data) {
|
||||
var i = data.length, q = 'query%5B' + auth.key + '%5D=';
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) !== -1) {
|
||||
delete data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// list of excluded links
|
||||
ajax_links = {
|
||||
'upload.php': media_library,
|
||||
'theme-install.php': theme_featured,
|
||||
'network/theme-install.php': theme_featured
|
||||
};
|
||||
|
||||
// Check path that should be excluded
|
||||
function check_ajax(path) {
|
||||
path = path.replace(auth.home + auth.admin, '');
|
||||
return ajax_links.hasOwnProperty(path) ? ajax_links[path] : null;
|
||||
}
|
||||
|
||||
// Escape string for use in HTML.
|
||||
function escapeHTML(html) {
|
||||
var elem = document.createElement('div');
|
||||
elem.appendChild(document.createTextNode(html));
|
||||
html = elem.innerHTML.replace(/["']/g, function (match) {
|
||||
return {
|
||||
'"': '"',
|
||||
"'": ''' //"
|
||||
}[match];
|
||||
});
|
||||
elem = '';
|
||||
return html;
|
||||
}
|
||||
|
||||
// Parse a URL and return its components
|
||||
function parse_uri(uri) {
|
||||
// avoid malformed URI error when uri includes '%'
|
||||
uri = /*decodeURIComponent*/(uri ? uri.toString() : '');
|
||||
|
||||
var m = uri.match(
|
||||
// https://tools.ietf.org/html/rfc3986#appendix-B
|
||||
/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/
|
||||
);
|
||||
|
||||
// scheme :// authority path ? query # fragment
|
||||
return {
|
||||
scheme: m[1] || '',
|
||||
relative: m[2] || '',
|
||||
authority: m[3] || '',
|
||||
path: m[4] || '',
|
||||
query: m[5] || '',
|
||||
fragment: m[6] || ''
|
||||
};
|
||||
}
|
||||
|
||||
// Compose a URL from components
|
||||
function compose_uri(uri) {
|
||||
return (uri.scheme ? uri.scheme + ':' : '') +
|
||||
(uri.relative + uri.path) +
|
||||
(uri.query ? '?' + uri.query : '') +
|
||||
(uri.fragment ? '#' + uri.fragment : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert relative url to absolute url using browser feature
|
||||
*
|
||||
* @param string target url
|
||||
* @param string base of absolute url (default window.locatoin.href)
|
||||
* @return component of url
|
||||
*/
|
||||
var absolute_uri = (function () {
|
||||
var doc = null;
|
||||
|
||||
try {
|
||||
new URL('/', 'http://example.com/'); // test if URL object is abailable
|
||||
} catch (e) {
|
||||
try {
|
||||
doc = (new DOMParser()).parseFromString('<html><head></head><body></body></html>', 'text/html'); // IE11
|
||||
} catch (f) {
|
||||
doc = document.implementation.createHTMLDocument(''); // IE10
|
||||
}
|
||||
}
|
||||
|
||||
return function (url, base) {
|
||||
var d = document, baseElm, aElm, result;
|
||||
url = typeof url !== 'undefined' ? url : window.location.href;
|
||||
if (null === doc) {
|
||||
if (typeof base === 'undefined') {
|
||||
base = window.location.href; // based on current url
|
||||
}
|
||||
try {
|
||||
result = new URL(url, base); // base must be valid
|
||||
} catch (e) {
|
||||
result = new URL(url, window.location.href);
|
||||
}
|
||||
} else {
|
||||
// use anchor element to resolve url
|
||||
if (typeof base !== 'undefined') {
|
||||
// assign base element to anchor to be independent of the current document
|
||||
d = doc;
|
||||
while (d.head.firstChild) {
|
||||
d.head.removeChild(d.head.firstChild);
|
||||
}
|
||||
baseElm = d.createElement('base');
|
||||
baseElm.setAttribute('href', base);
|
||||
d.head.appendChild(baseElm);
|
||||
}
|
||||
aElm = d.createElement('a');
|
||||
aElm.setAttribute('href', url);
|
||||
aElm.setAttribute('href', aElm.href);
|
||||
//d.appendChild(aElm);
|
||||
|
||||
result = {
|
||||
protocol: aElm.protocol,
|
||||
host: aElm.host,
|
||||
hostname: aElm.hostname,
|
||||
port: aElm.port,
|
||||
pathname: aElm.pathname,
|
||||
search: aElm.search,
|
||||
hash: aElm.hash,
|
||||
href: aElm.href,
|
||||
username: '',
|
||||
password: '',
|
||||
origin : aElm.origin || null
|
||||
};
|
||||
if ('http:' === result.protocol && '80' === result.port) {
|
||||
// remove port number `80` in case of `http` and defalut port
|
||||
result.port = '';
|
||||
result.host = result.host.replace(/:80$/, '');
|
||||
} else if ('https:' === result.protocol && '443' === result.port) {
|
||||
// remove port number `443` in case of `https` and defalut port
|
||||
result.port = '';
|
||||
result.host = result.host.replace(/:443$/, '');
|
||||
}
|
||||
if ('http:' === result.protocol || 'https:' === result.protocol) {
|
||||
if (result.pathname && result.pathname.charAt(0) !== '/') {
|
||||
// in case no `/` at the top
|
||||
result.pathname = '/' + result.pathname;
|
||||
}
|
||||
if (!result.origin) {
|
||||
result.origin = result.protocol + '//' + result.hostname + (result.port ? ':' + result.port : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.username || result.password) {
|
||||
// throw an error if basic basic authentication is targeted
|
||||
throw new URIError(result.username + ':' + result.password);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
/*
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
||||
function encodeURIComponentRFC3986(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16);
|
||||
});
|
||||
}
|
||||
*/
|
||||
// Append the nonce as query strings to the uri
|
||||
function add_query_nonce(uri, nonce) {
|
||||
if (typeof uri !== 'object') { // `string` or `undefined`
|
||||
uri = parse_uri(uri || window.location.href);
|
||||
}
|
||||
|
||||
var data = uri.query ? uri.query.split('&') : [],
|
||||
i = data.length,
|
||||
q = auth.key + '=';
|
||||
|
||||
// remove an old nonce
|
||||
while (i-- > 0) {
|
||||
if (data[i].indexOf(q) === 0) { // or `wpzep.regexp.test(data[i])`
|
||||
data.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data.push(auth.key + '=' + encodeURIComponent(nonce)); //RFC3986
|
||||
uri.query = data.join('&');
|
||||
|
||||
return compose_uri(uri);
|
||||
}
|
||||
|
||||
// Check uri component if it is not empty or only fragment (`#...`)
|
||||
function check_uri(uri) {
|
||||
return (!uri.scheme || /^https?$/.test(uri.scheme)) && (uri.path || uri.query);
|
||||
}
|
||||
|
||||
// Check uri where the nonce is needed
|
||||
// Note: in case of url in the admin area of different site, it returns 0
|
||||
function is_admin(url) {
|
||||
// parse uri and get real path
|
||||
try {
|
||||
url = url || window.location.pathname || ''; // in case of empty `action` on the form tag
|
||||
} catch (e) {
|
||||
url = '';
|
||||
}
|
||||
|
||||
var uri = parse_uri(url.toLowerCase());
|
||||
|
||||
// possibly scheme is `javascript` and path is `void(0);`
|
||||
if (check_uri(uri)) {
|
||||
// get absolute path with flattening `./`, `../`, `//`
|
||||
uri = absolute_uri(url);
|
||||
|
||||
// external domain (`http://example` or `www.example`)
|
||||
// https://tools.ietf.org/html/rfc6454#section-4
|
||||
if (uri.origin !== window.location.origin) {
|
||||
return -1; // external
|
||||
}
|
||||
|
||||
// check if uri includes the target path of zep
|
||||
url = regexp.exec(uri.pathname);
|
||||
if (url) {
|
||||
if ((0 <= url[0].indexOf(auth.admin + 'admin-')) ||
|
||||
(0 <= url[0].indexOf(auth.admin )) ||
|
||||
(0 <= url[0].indexOf(auth.plugins )) ||
|
||||
(0 <= url[0].indexOf(auth.themes ))) {
|
||||
return 1; // internal for admin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // internal not admin
|
||||
}
|
||||
|
||||
// Check if current page is admin area and the target of wp-zep
|
||||
function is_backend() {
|
||||
return (is_admin(window.location.pathname) === 1 || wpzep.regexp(window.location.search));
|
||||
}
|
||||
|
||||
// Check if url belongs to multisite
|
||||
function is_multisite(url) {
|
||||
var i, j, n = auth.sites.length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
j = url.indexOf(auth.sites[i] + '/');
|
||||
if (0 <= j && j <= 6) { // from `//` to `https://`
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the uri does not need a nonce
|
||||
function is_neutral(uri) {
|
||||
// return !uri.query; // without queries
|
||||
// return !uri.query || !$('body').hasClass('wp-core-ui'); // without queries or outside dashboard
|
||||
return /\/$/.test(uri.path); // `/wp-admin/`
|
||||
}
|
||||
|
||||
// check if the link has nofollow
|
||||
function has_nofollow($elem) {
|
||||
return -1 !== ($elem.attr('rel') || '').indexOf('nofollow');
|
||||
}
|
||||
/*
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr, settings) {
|
||||
// settings: {
|
||||
// url: '/wp-admin/admin-ajax.php'
|
||||
// method: 'POST' or 'GET'
|
||||
// contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
// data: 'action=...'
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// plupload
|
||||
$(window).on('BeforeUpload', function (uploader, file) {
|
||||
console.log(uploader);
|
||||
});
|
||||
*/
|
||||
// Embed a nonce before an Ajax request is sent
|
||||
// $(document).ajaxSend(function (event, jqxhr, settings) {
|
||||
$.ajaxPrefilter(function (settings /*, original, jqxhr*/) {
|
||||
// POST to async-upload.php causes an error in https://wordpress.org/plugins/mammoth-docx-converter/
|
||||
if (is_admin(settings.url) === 1 && !settings.url.match(/async-upload\.php$/)) {
|
||||
// multipart/form-data (XMLHttpRequest Level 2)
|
||||
// IE10+, Firefox 4+, Safari 5+, Android 3+
|
||||
if (typeof window.FormData !== 'undefined' && settings.data instanceof FormData) {
|
||||
settings.data.append(auth.key, auth.nonce);
|
||||
}
|
||||
|
||||
// application/x-www-form-urlencoded
|
||||
else {
|
||||
// Behavior of jQuery Ajax
|
||||
// method url url+data data
|
||||
// GET query query data
|
||||
// POST query query data
|
||||
var data, callback, uri = parse_uri(settings.url);
|
||||
|
||||
if (typeof settings.data === 'undefined' || uri.query) {
|
||||
settings.url = add_query_nonce(uri, auth.nonce);
|
||||
} else {
|
||||
data = settings.data ? settings.data.split('&') : [];
|
||||
callback = check_ajax(window.location.pathname);
|
||||
if (callback) {
|
||||
data = callback(data);
|
||||
}
|
||||
data.push(auth.key + '=' + encodeURIComponent(auth.nonce)); //RFC3986
|
||||
settings.data = data.join('&');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* jQuery.bind-first library v0.2.3 (jquery >= 1.7)
|
||||
* Copyright (c) 2013 Vladimir Zhuravlev
|
||||
*
|
||||
* Released under MIT License
|
||||
* @license https://github.com/private-face/jquery.bind-first
|
||||
*
|
||||
* Date: Thu Feb 6 10:13:59 ICT 2014
|
||||
*/
|
||||
function moveHandlerToTop($el, eventName, isDelegated) {
|
||||
var data = $._data($el[0]).events,
|
||||
events = data[eventName],
|
||||
handler = isDelegated ? events.splice(events.delegateCount - 1, 1)[0] : events.pop();
|
||||
|
||||
events.splice(isDelegated ? 0 : (events.delegateCount || 0), 0, handler);
|
||||
}
|
||||
|
||||
function moveEventHandlers($elems, eventsString, isDelegate) {
|
||||
var events = eventsString.split(/\s+/);
|
||||
$elems.each(function(i) {
|
||||
for (i = 0; i < events.length; ++i) {
|
||||
var pureEventName = $.trim(events[i]).match(/[^\.]+/i)[0];
|
||||
moveHandlerToTop($(this), pureEventName, isDelegate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof $.fn.onFirst === 'undefined') {
|
||||
$.fn.onFirst = function(types, selector) {
|
||||
var type, $el = $(this), isDelegated = (typeof selector === 'string');
|
||||
|
||||
$.fn.on.apply($el, arguments);
|
||||
|
||||
// events map
|
||||
if (typeof types === 'object') {
|
||||
for (type in types) {
|
||||
if (types.hasOwnProperty(type)) {
|
||||
moveEventHandlers($el, type, isDelegated);
|
||||
}
|
||||
}
|
||||
} else if (typeof types === 'string') {
|
||||
moveEventHandlers($el, types, isDelegated);
|
||||
}
|
||||
|
||||
return $el;
|
||||
};
|
||||
}
|
||||
|
||||
/*--------------------------------
|
||||
* Attach event to the document
|
||||
*--------------------------------*/
|
||||
function attach_event() {
|
||||
// https://www.sitepoint.com/jquery-body-on-document-on/
|
||||
var elem = $(document); // `html` or `body` doesn't work with some browsers
|
||||
|
||||
elem.onFirst('click contextmenu', 'a', function (event) {
|
||||
var admin = 0, // default: do nothing if href is empty
|
||||
$this = $(this),
|
||||
href = $this.attr('href') || '', // returns 'string' or 'undefined'
|
||||
uri = parse_uri(href);
|
||||
|
||||
// check href has right scheme and path
|
||||
if (check_uri(uri)) {
|
||||
admin = is_admin(href);
|
||||
}
|
||||
|
||||
// console.log('href:' + href, uri, 'admin:' + admin, 'is_backend:' + is_backend(), 'is_multisite:' + is_multisite(href));
|
||||
|
||||
// if context menu then continue and should be checked in check_nonce()
|
||||
if ('click' !== event.type) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if admin area (except a link with nofollow in the comment thread) then add a nonce
|
||||
else if (admin === 1) {
|
||||
$this.attr('href', is_neutral(uri) ? href :
|
||||
add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
|
||||
);
|
||||
}
|
||||
|
||||
// if external then redirect with no referrer not to leak out the nonce
|
||||
else if (admin === -1 && is_backend()) {
|
||||
// open within the same window
|
||||
if ('_self' === $this.attr('target') || is_multisite(href)) {
|
||||
$this.attr('href', is_neutral(uri) ? href :
|
||||
add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
|
||||
);
|
||||
}
|
||||
|
||||
// open a new window
|
||||
else if (!this.hasAttribute('onClick')) {
|
||||
// avoid `url=...;url=javascript:...`
|
||||
href = href.split(';', 2).shift();
|
||||
href = escapeHTML(decodeURIComponent(this.href)); // & => &
|
||||
|
||||
admin = window.open();
|
||||
admin.document.write(
|
||||
'<!DOCTYPE html><html><head>' +
|
||||
'<meta name="referrer" content="never" />' +
|
||||
'<meta name="referrer" content="no-referrer" />' +
|
||||
'<meta http-equiv="refresh" content="0; url=' + href + '" />' +
|
||||
($('body').hasClass('webview') ? '<script>window.location.replace("' + href + '")</script>' : '') +
|
||||
'</head></html>'
|
||||
);
|
||||
admin.document.close();
|
||||
|
||||
// stop event propagation and location transition
|
||||
event.stopImmediatePropagation();
|
||||
return false; // same as event.stopPropagation() and event.preventDefault()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
elem.onFirst('submit', 'form', function (/*event*/) {
|
||||
var $this = $(this), action = $this.attr('action'); // possibly 'undefined'
|
||||
|
||||
// if admin area then add the nonce
|
||||
if (is_admin(action) === 1) {
|
||||
if ('post' === ($this.attr('method') || '').toLowerCase()) {
|
||||
$this.attr('action', add_query_nonce(action, auth.nonce));
|
||||
} else {
|
||||
// https://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-name
|
||||
$this.append('<input type="hidden" name="' + auth.key + '" value="' + auth.nonce + '">');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*--------------------------------
|
||||
* Something after document ready
|
||||
*--------------------------------*/
|
||||
function attach_ready(/*stat*/) {
|
||||
if (!wpzep.init) {
|
||||
wpzep.init = true;
|
||||
|
||||
$('img').each(function (/*index*/) {
|
||||
var src = $(this).attr('src');
|
||||
|
||||
// if admin area
|
||||
if (is_admin(src) === 1) {
|
||||
$(this).attr('src', add_query_nonce(src, auth.nonce));
|
||||
}
|
||||
});
|
||||
|
||||
// Restore post revisions (wp-admin/revisions.php @since 2.6.0)
|
||||
if ('undefined' !== typeof window._wpRevisionsSettings) {
|
||||
var i, data = window._wpRevisionsSettings.revisionData, n = data.length;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!wpzep.regexp.test(data[i].restoreUrl)) {
|
||||
window._wpRevisionsSettings.revisionData[i].restoreUrl = add_query_nonce(data[i].restoreUrl, auth.nonce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the title of sub-menu.
|
||||
$('#toplevel_page_ip-geo-block li.wp-first-item').each(function (/*i, obj*/) {
|
||||
var $this = $(this);
|
||||
$this.css('display', 'IP Geo Block' === $this.children('a').text() ? 'none' : 'block');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(window).on('error', function (/*event*/) { // event.originalEvent.message
|
||||
attach_ready(); // fallback on error
|
||||
});
|
||||
|
||||
$(function () {
|
||||
attach_ready();
|
||||
});
|
||||
|
||||
// Attach event to add nonce
|
||||
attach_event();
|
||||
}(jQuery, window, document));
|
||||
16
wp/wp-content/plugins/ip-geo-block/admin/js/authenticate.min.js
vendored
Normal file
16
wp/wp-content/plugins/ip-geo-block/admin/js/authenticate.min.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* Project: WP-ZEP - Zero-day exploit Prevention for wp-admin
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n){var r=IP_GEO_BLOCK_AUTH,o={init:!1,regexp:new RegExp(r.key+"(?:=|%3D)\\w+")},a=new RegExp("^(?:"+(r.home||"")+r.admin+"|"+(r.home||"")+r.plugins+"|"+(r.home||"")+r.themes+"|"+r.admin+")(?:.*\\.php|.*\\/)?$"),i=function(e){for(var t=e.length,n="request%5Bbrowse%5D="+r.key;t-- >0;)if(-1!==e[t].indexOf(n)){e[t]="request%5Bbrowse%5D=featured";break}return e},h={"upload.php":function(e){for(var t=e.length,n="query%5B"+r.key+"%5D=";t-- >0;)if(-1!==e[t].indexOf(n)){delete e[t];break}return e},"theme-install.php":i,"network/theme-install.php":i};function s(e){var t=(e=e?e.toString():"").match(/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return{scheme:t[1]||"",relative:t[2]||"",authority:t[3]||"",path:t[4]||"",query:t[5]||"",fragment:t[6]||""}}var c,p=function(){var e=null;try{new URL("/","http://example.com/")}catch(t){try{e=(new DOMParser).parseFromString("<html><head></head><body></body></html>","text/html")}catch(t){e=n.implementation.createHTMLDocument("")}}return function(r,o){var a,i,h,s=n;if(r=void 0!==r?r:t.location.href,null===e){void 0===o&&(o=t.location.href);try{h=new URL(r,o)}catch(e){h=new URL(r,t.location.href)}}else{if(void 0!==o){for(s=e;s.head.firstChild;)s.head.removeChild(s.head.firstChild);(a=s.createElement("base")).setAttribute("href",o),s.head.appendChild(a)}(i=s.createElement("a")).setAttribute("href",r),i.setAttribute("href",i.href),"http:"===(h={protocol:i.protocol,host:i.host,hostname:i.hostname,port:i.port,pathname:i.pathname,search:i.search,hash:i.hash,href:i.href,username:"",password:"",origin:i.origin||null}).protocol&&"80"===h.port?(h.port="",h.host=h.host.replace(/:80$/,"")):"https:"===h.protocol&&"443"===h.port&&(h.port="",h.host=h.host.replace(/:443$/,"")),"http:"!==h.protocol&&"https:"!==h.protocol||(h.pathname&&"/"!==h.pathname.charAt(0)&&(h.pathname="/"+h.pathname),h.origin||(h.origin=h.protocol+"//"+h.hostname+(h.port?":"+h.port:"")))}if(h.username||h.password)throw new URIError(h.username+":"+h.password);return h}}();function l(e,n){"object"!=typeof e&&(e=s(e||t.location.href));for(var o=e.query?e.query.split("&"):[],a=o.length,i=r.key+"=";a-- >0;)if(0===o[a].indexOf(i)){o.splice(a,1);break}return o.push(r.key+"="+encodeURIComponent(n)),e.query=o.join("&"),function(e){return(e.scheme?e.scheme+":":"")+(e.relative+e.path)+(e.query?"?"+e.query:"")+(e.fragment?"#"+e.fragment:"")}(e)}function f(e){return(!e.scheme||/^https?$/.test(e.scheme))&&(e.path||e.query)}function u(e){try{e=e||t.location.pathname||""}catch(t){e=""}var n=s(e.toLowerCase());if(f(n)){if((n=p(e)).origin!==t.location.origin)return-1;if((e=a.exec(n.pathname))&&(0<=e[0].indexOf(r.admin+"admin-")||0<=e[0].indexOf(r.admin)||0<=e[0].indexOf(r.plugins)||0<=e[0].indexOf(r.themes)))return 1}return 0}function m(e){return/\/$/.test(e.path)}function d(e){return-1!==(e.attr("rel")||"").indexOf("nofollow")}
|
||||
/*
|
||||
* jQuery.bind-first library v0.2.3 (jquery >= 1.7)
|
||||
* Copyright (c) 2013 Vladimir Zhuravlev
|
||||
*
|
||||
* Released under MIT License
|
||||
* @license https://github.com/private-face/jquery.bind-first
|
||||
*
|
||||
* Date: Thu Feb 6 10:13:59 ICT 2014
|
||||
*/
|
||||
function v(t,n,r){var o=e._data(t[0]).events[n],a=r?o.splice(o.delegateCount-1,1)[0]:o.pop();o.splice(r?0:o.delegateCount||0,0,a)}function g(t,n,r){var o=n.split(/\s+/);t.each(function(t){for(t=0;t<o.length;++t){var n=e.trim(o[t]).match(/[^\.]+/i)[0];v(e(this),n,r)}})}function y(){if(!o.init){if(o.init=!0,e("img").each(function(){var t=e(this).attr("src");1===u(t)&&e(this).attr("src",l(t,r.nonce))}),void 0!==t._wpRevisionsSettings){var n,a=t._wpRevisionsSettings.revisionData,i=a.length;for(n=0;n<i;++n)o.regexp.test(a[n].restoreUrl)||(t._wpRevisionsSettings.revisionData[n].restoreUrl=l(a[n].restoreUrl,r.nonce))}e("#toplevel_page_ip-geo-block li.wp-first-item").each(function(){var t=e(this);t.css("display","IP Geo Block"===t.children("a").text()?"none":"block")})}}e.ajaxPrefilter(function(e){if(1===u(e.url)&&!e.url.match(/async-upload\.php$/))if(void 0!==t.FormData&&e.data instanceof FormData)e.data.append(r.key,r.nonce);else{var n,o,a=s(e.url);void 0===e.data||a.query?e.url=l(a,r.nonce):(n=e.data?e.data.split("&"):[],i=(i=t.location.pathname).replace(r.home+r.admin,""),(o=h.hasOwnProperty(i)?h[i]:null)&&(n=o(n)),n.push(r.key+"="+encodeURIComponent(r.nonce)),e.data=n.join("&"))}var i}),void 0===e.fn.onFirst&&(e.fn.onFirst=function(t,n){var r,o=e(this),a="string"==typeof n;if(e.fn.on.apply(o,arguments),"object"==typeof t)for(r in t)t.hasOwnProperty(r)&&g(o,r,a);else"string"==typeof t&&g(o,t,a);return o}),e(t).on("error",function(){y()}),e(function(){y()}),(c=e(n)).onFirst("click contextmenu","a",function(a){var i,h,c=0,p=e(this),v=p.attr("href")||"",g=s(v);if(f(g)&&(c=u(v)),"click"===a.type)if(1===c)p.attr("href",m(g)?v:l(v,d(p)?"nofollow":r.nonce));else if(-1===c&&(1===u(t.location.pathname)||o.regexp(t.location.search)))if("_self"===p.attr("target")||function(e){var t,n,o=r.sites.length;for(t=0;t<o;++t)if(0<=(n=e.indexOf(r.sites[t]+"/"))&&n<=6)return!0;return!1}(v))p.attr("href",m(g)?v:l(v,d(p)?"nofollow":r.nonce));else if(!this.hasAttribute("onClick"))return v=v.split(";",2).shift(),i=decodeURIComponent(this.href),(h=n.createElement("div")).appendChild(n.createTextNode(i)),i=h.innerHTML.replace(/["']/g,function(e){return{'"':""","'":"'"}[e]}),h="",v=i,(c=t.open()).document.write('<!DOCTYPE html><html><head><meta name="referrer" content="never" /><meta name="referrer" content="no-referrer" /><meta http-equiv="refresh" content="0; url='+v+'" />'+(e("body").hasClass("webview")?'<script>window.location.replace("'+v+'")<\/script>':"")+"</head></html>"),c.document.close(),a.stopImmediatePropagation(),!1}),c.onFirst("submit","form",function(){var t=e(this),n=t.attr("action");1===u(n)&&("post"===(t.attr("method")||"").toLowerCase()?t.attr("action",l(n,r.nonce)):t.append('<input type="hidden" name="'+r.key+'" value="'+r.nonce+'">'))})}(jQuery,window,document);
|
||||
11
wp/wp-content/plugins/ip-geo-block/admin/js/cidr.min.js
vendored
Normal file
11
wp/wp-content/plugins/ip-geo-block/admin/js/cidr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
127
wp/wp-content/plugins/ip-geo-block/admin/js/gmap.js
Normal file
127
wp/wp-content/plugins/ip-geo-block/admin/js/gmap.js
Normal file
@@ -0,0 +1,127 @@
|
||||
/*!
|
||||
* Project: GmapRS - google map for WordPress IP Geo Block
|
||||
* Description: A really simple google map plugin based on jQuery-boilerplate.
|
||||
* Version: 0.2.4
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
// https://developers.google.com/maps/documentation/javascript/events?hl=en#auth-errors
|
||||
function gm_authFailure() {
|
||||
jQuery(window).trigger('ip-geo-block-gmap-error');
|
||||
}
|
||||
|
||||
(function ($) {
|
||||
$(function ($) {
|
||||
if ('undefined' === typeof google) {
|
||||
return;
|
||||
}
|
||||
var e = "GmapRS",
|
||||
d = "plugin_" + e,
|
||||
b = {
|
||||
zoom: 2,
|
||||
latitude: 0,
|
||||
longitude: 0
|
||||
},
|
||||
i = google.maps,
|
||||
h = function (j) {
|
||||
this.o = $.extend({}, b);
|
||||
this.q = [];
|
||||
};
|
||||
h.prototype = {
|
||||
init: function (j) {
|
||||
$.extend(this.o, j);
|
||||
this.c = new i.LatLng(this.o.latitude, this.o.longitude);
|
||||
this.m = new i.Map(this.e.get(0), {
|
||||
zoom: this.o.zoom,
|
||||
center: this.c,
|
||||
mapTypeId: i.MapTypeId.ROADMAP
|
||||
});
|
||||
},
|
||||
destroy: function () {
|
||||
this.deleteMarkers();
|
||||
this.e.data(d, null);
|
||||
},
|
||||
setCenter: function () {
|
||||
if (arguments.length >= 2) {
|
||||
var j = new i.LatLng((this.o.latitude = arguments[0]), (this.o.longitude = arguments[1]));
|
||||
delete this.c;
|
||||
this.c = j;
|
||||
}
|
||||
this.m.setCenter(this.c);
|
||||
return this.e;
|
||||
},
|
||||
setZoom: function (j) {
|
||||
this.m.setZoom(j || this.o.zoom);
|
||||
return this.e;
|
||||
},
|
||||
getZoom: function () {
|
||||
return this.m.getZoom();
|
||||
},
|
||||
showMarker: function (l, k) {
|
||||
var j = this.q[l];
|
||||
if (j && j.w) {
|
||||
(false === k) ? j.w.close() : j.w.open(this.m, j.m);
|
||||
}
|
||||
},
|
||||
addMarker: function (l) {
|
||||
var m, j, k;
|
||||
m = new i.LatLng(l.latitude || this.o.latitude, l.longitude || this.o.longitude);
|
||||
j = new i.Marker({
|
||||
position: m,
|
||||
map: this.m,
|
||||
title: l.title || ""
|
||||
});
|
||||
if (l.content) {
|
||||
k = new i.InfoWindow({
|
||||
content: l.content
|
||||
});
|
||||
i.event.addListener(j, "click", function () {
|
||||
k.open(j.getMap(), j);
|
||||
});
|
||||
}
|
||||
this.q.push({
|
||||
p: m,
|
||||
w: k,
|
||||
m: j
|
||||
});
|
||||
this.m.setCenter(m);
|
||||
this.m.setZoom(l.zoom);
|
||||
if (l.show) {
|
||||
this.showMarker(this.q.length - 1);
|
||||
}
|
||||
return this.e;
|
||||
},
|
||||
deleteMarkers: function () {
|
||||
var j, k;
|
||||
for (j in this.q) {
|
||||
if (this.q.hasOwnProperty(j)) {
|
||||
k = this.q[j];
|
||||
k.m.setMap(null);
|
||||
}
|
||||
}
|
||||
this.q.length = 0;
|
||||
return this.e;
|
||||
}
|
||||
};
|
||||
$.fn[e] = function (k) {
|
||||
var l, j;
|
||||
if (!(this.data(d) instanceof h)) {
|
||||
this.data(d, new h(this));
|
||||
}
|
||||
j = this.data(d);
|
||||
j.e = this;
|
||||
if (typeof k === "undefined" || typeof k === "object") {
|
||||
if (typeof j.init === "function") {
|
||||
j.init(k);
|
||||
}
|
||||
} else {
|
||||
if (typeof k === "string" && typeof j[k] === "function") {
|
||||
l = Array.prototype.slice.call(arguments, 1);
|
||||
return j[k].apply(j, l);
|
||||
} else {
|
||||
$.error("Method " + k + " does not exist." + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}(jQuery));
|
||||
8
wp/wp-content/plugins/ip-geo-block/admin/js/gmap.min.js
vendored
Normal file
8
wp/wp-content/plugins/ip-geo-block/admin/js/gmap.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Project: GmapRS - google map for WordPress IP Geo Block
|
||||
* Description: A really simple google map plugin based on jQuery-boilerplate.
|
||||
* Version: 0.2.4
|
||||
* Copyright (c) 2013-2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
function gm_authFailure(){jQuery(window).trigger("ip-geo-block-gmap-error")}jQuery(function(t){if("undefined"!=typeof google){var e="GmapRS",i="plugin_"+e,o={zoom:2,latitude:0,longitude:0},n=google.maps,s=function(e){this.o=t.extend({},o),this.q=[]};s.prototype={init:function(e){t.extend(this.o,e),this.c=new n.LatLng(this.o.latitude,this.o.longitude),this.m=new n.Map(this.e.get(0),{zoom:this.o.zoom,center:this.c,mapTypeId:n.MapTypeId.ROADMAP})},destroy:function(){this.deleteMarkers(),this.e.data(i,null)},setCenter:function(){if(arguments.length>=2){var t=new n.LatLng(this.o.latitude=arguments[0],this.o.longitude=arguments[1]);delete this.c,this.c=t}return this.m.setCenter(this.c),this.e},setZoom:function(t){return this.m.setZoom(t||this.o.zoom),this.e},getZoom:function(){return this.m.getZoom()},showMarker:function(t,e){var i=this.q[t];i&&i.w&&(!1===e?i.w.close():i.w.open(this.m,i.m))},addMarker:function(t){var e,i,o;return e=new n.LatLng(t.latitude||this.o.latitude,t.longitude||this.o.longitude),i=new n.Marker({position:e,map:this.m,title:t.title||""}),t.content&&(o=new n.InfoWindow({content:t.content}),n.event.addListener(i,"click",function(){o.open(i.getMap(),i)})),this.q.push({p:e,w:o,m:i}),this.m.setCenter(e),this.m.setZoom(t.zoom),t.show&&this.showMarker(this.q.length-1),this.e},deleteMarkers:function(){var t;for(t in this.q)this.q.hasOwnProperty(t)&&this.q[t].m.setMap(null);return this.q.length=0,this.e}},t.fn[e]=function(o){var n,r;if(this.data(i)instanceof s||this.data(i,new s(this)),(r=this.data(i)).e=this,void 0===o||"object"==typeof o)"function"==typeof r.init&&r.init(o);else{if("string"==typeof o&&"function"==typeof r[o])return n=Array.prototype.slice.call(arguments,1),r[o].apply(r,n);t.error("Method "+o+" does not exist."+e)}}}});
|
||||
80
wp/wp-content/plugins/ip-geo-block/admin/js/whois.js
Normal file
80
wp/wp-content/plugins/ip-geo-block/admin/js/whois.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/*jslint white: true */
|
||||
/*!
|
||||
* Project: whois.js - get whois infomation from RIPE Network Coordination Center
|
||||
* Description: A jQuery plugin to get whois infomation from RIPE NCC database.
|
||||
* Version: 0.2
|
||||
* Copyright (c) 2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*
|
||||
* RIPE NCC
|
||||
* @link https://stat.ripe.net/docs/data_api#Whois
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend({
|
||||
whois: function (query, callback) {
|
||||
var results = [],
|
||||
url = 'https://stat.ripe.net/data/whois/data.json?resource=';
|
||||
|
||||
function escapeHTML(str) {
|
||||
return str ? str.toString().replace(/[&<>"']/g, function (match) { //'"
|
||||
return {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}[match];
|
||||
}) : '';
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
url: url + query,
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
})
|
||||
|
||||
.done(function (data, textStatus, jqXHR) {
|
||||
// https://stackoverflow.com/questions/722668/traverse-all-the-nodes-of-a-json-object-tree-with-javascript#answer-722676
|
||||
function process(key, value) {
|
||||
if (value && typeof value === 'object') {
|
||||
if (value.key) {
|
||||
value.key = escapeHTML(value.key);
|
||||
value.value = escapeHTML(value.value);
|
||||
if (value.details_link) {
|
||||
value.value = '<a href="' + escapeHTML(value.details_link) + '">' + value.value + '</a>';
|
||||
}
|
||||
results.push({
|
||||
name : value.key,
|
||||
value: value.value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function traverse(obj, func) {
|
||||
for (var i in obj) {
|
||||
func.apply(this, [i, obj[i]]);
|
||||
if (obj[i] !== null && typeof(obj[i]) === 'object') {
|
||||
traverse(obj[i], func); //going one step down in the object tree!!
|
||||
}
|
||||
}
|
||||
}
|
||||
traverse(data.data, process);
|
||||
})
|
||||
|
||||
.fail(function (jqXHR, textStatus, errorThrown) {
|
||||
results.push({
|
||||
name : escapeHTML(textStatus),
|
||||
value: escapeHTML(errorThrown)
|
||||
});
|
||||
})
|
||||
|
||||
.always(function () {
|
||||
if (callback) {
|
||||
callback(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
8
wp/wp-content/plugins/ip-geo-block/admin/js/whois.min.js
vendored
Normal file
8
wp/wp-content/plugins/ip-geo-block/admin/js/whois.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Project: whois.js - get whois infomation from RIPE Network Coordination Center
|
||||
* Description: A jQuery plugin to get whois infomation from RIPE NCC database.
|
||||
* Version: 0.2
|
||||
* Copyright (c) 2019 tokkonopapa (tokkonopapa@yahoo.com)
|
||||
* This software is released under the MIT License.
|
||||
*/
|
||||
!function(e){e.extend({whois:function(t,n){var a=[];function u(e){return e?e.toString().replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]}):""}return e.ajax({url:"https://stat.ripe.net/data/whois/data.json?resource="+t,method:"GET",dataType:"json"}).done(function(e,t,n){!function e(t,n){for(var a in t)n.apply(this,[a,t[a]]),null!==t[a]&&"object"==typeof t[a]&&e(t[a],n)}(e.data,function(e,t){t&&"object"==typeof t&&t.key&&(t.key=u(t.key),t.value=u(t.value),t.details_link&&(t.value='<a href="'+u(t.details_link)+'">'+t.value+"</a>"),a.push({name:t.key,value:t.value}))})}).fail(function(e,t,n){a.push({name:u(t),value:u(n)})}).always(function(){n&&n(a)})}})}(jQuery);
|
||||
Reference in New Issue
Block a user