Localisation
This commit is contained in:
12
action.php
12
action.php
@@ -309,6 +309,7 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function insertCaptchaLoader() {
|
private function insertCaptchaLoader() {
|
||||||
|
|
||||||
echo '<script>' . NL;
|
echo '<script>' . NL;
|
||||||
|
|
||||||
// add the deferred script loader::
|
// add the deferred script loader::
|
||||||
@@ -318,6 +319,17 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin {
|
|||||||
echo DOKU_TAB . DOKU_TAB . "cj.src='".DOKU_BASE."lib/plugins/botmon/captcha.js';" . NL;
|
echo DOKU_TAB . DOKU_TAB . "cj.src='".DOKU_BASE."lib/plugins/botmon/captcha.js';" . NL;
|
||||||
echo DOKU_TAB . DOKU_TAB . "document.getElementsByTagName('head')[0].appendChild(cj);" . NL;
|
echo DOKU_TAB . DOKU_TAB . "document.getElementsByTagName('head')[0].appendChild(cj);" . NL;
|
||||||
echo DOKU_TAB . "});";
|
echo DOKU_TAB . "});";
|
||||||
|
|
||||||
|
// add the locales for the captcha:
|
||||||
|
echo DOKU_TAB . '$BMLocales = {' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgTitle": ' . json_encode($this->getLang('bm_dlgTitle')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgSubtitle": ' . json_encode($this->getLang('bm_dlgSubtitle')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgConfirm": ' . json_encode($this->getLang('bm_dlgConfirm')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgChecking": ' . json_encode($this->getLang('bm_dlgChecking')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgLoading": ' . json_encode($this->getLang('bm_dlgLoading')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . DOKU_TAB . '"dlgError": ' . json_encode($this->getLang('bm_dlgError')) . ',' . NL;
|
||||||
|
echo DOKU_TAB . '};' . NL;
|
||||||
|
|
||||||
echo '</script>' . NL;
|
echo '</script>' . NL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
admin.js
8
admin.js
@@ -42,7 +42,7 @@ const BotMon = {
|
|||||||
|
|
||||||
// get yesterday's date:
|
// get yesterday's date:
|
||||||
let d = new Date();
|
let d = new Date();
|
||||||
d.setDate(d.getDate() - 1);
|
if (BMSettings.showday == 'yesterday') d.setDate(d.getDate() - 1);
|
||||||
this._datestr = d.toISOString().slice(0, 10);
|
this._datestr = d.toISOString().slice(0, 10);
|
||||||
|
|
||||||
// init the sub-objects:
|
// init the sub-objects:
|
||||||
@@ -185,7 +185,7 @@ const BotMon = {
|
|||||||
/* everything specific to the "Latest" tab is self-contained in the "live" object: */
|
/* everything specific to the "Latest" tab is self-contained in the "live" object: */
|
||||||
BotMon.live = {
|
BotMon.live = {
|
||||||
init: function() {
|
init: function() {
|
||||||
console.info('BotMon.live.init()');
|
//console.info('BotMon.live.init()');
|
||||||
|
|
||||||
// set the title:
|
// set the title:
|
||||||
const tDiff = '<abbr title="Coordinated Universal Time">UTC</abbr> ' + (BotMon._timeDiff != '' ? ` (offset: ${BotMon._timeDiff}` : '' ) + ')';
|
const tDiff = '<abbr title="Coordinated Universal Time">UTC</abbr> ' + (BotMon._timeDiff != '' ? ` (offset: ${BotMon._timeDiff}` : '' ) + ')';
|
||||||
@@ -1056,13 +1056,13 @@ BotMon.live = {
|
|||||||
const prefix = v.ip.split(':').slice(0, kIP6Segments).join(':');
|
const prefix = v.ip.split(':').slice(0, kIP6Segments).join(':');
|
||||||
rawIP = ipSeg.slice(0, kIP6Segments).join(':');
|
rawIP = ipSeg.slice(0, kIP6Segments).join(':');
|
||||||
ipGroup = 'ip6-' + rawIP.replaceAll(':', '-');
|
ipGroup = 'ip6-' + rawIP.replaceAll(':', '-');
|
||||||
ipName = prefix + '::' + '/' + (16 * kIP6Segments);
|
ipName = prefix + '::'; // + '/' + (16 * kIP6Segments);
|
||||||
} else {
|
} else {
|
||||||
ipSeg = ipAddr.split('.');
|
ipSeg = ipAddr.split('.');
|
||||||
const prefix = v.ip.split('.').slice(0, kIP4Segments).join('.');
|
const prefix = v.ip.split('.').slice(0, kIP4Segments).join('.');
|
||||||
rawIP = ipSeg.slice(0, kIP4Segments).join('.') ;
|
rawIP = ipSeg.slice(0, kIP4Segments).join('.') ;
|
||||||
ipGroup = 'ip4-' + rawIP.replaceAll('.', '-');
|
ipGroup = 'ip4-' + rawIP.replaceAll('.', '-');
|
||||||
ipName = prefix + '.x.x.x'.substring(0, 1+(4-kIP4Segments)*2) + '/' + (8 * kIP4Segments);
|
ipName = prefix + '.x.x.x'.substring(0, 1+(4-kIP4Segments)*2); // + '/' + (8 * kIP4Segments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,13 @@ class admin_plugin_botmon extends AdminPlugin {
|
|||||||
echo '<li>No files to process.</li>';
|
echo '<li>No files to process.</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</article></div><!-- End of BotMon Admin Tool -->';
|
echo '</article>' . NL;
|
||||||
|
echo '<script>
|
||||||
|
BMSettings = {
|
||||||
|
showDay: ' . json_encode($this->getConf('showDay')) . '
|
||||||
|
};
|
||||||
|
</script>';
|
||||||
|
echo '</div><!-- End of BotMon Admin Tool -->';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
captcha.js
14
captcha.js
@@ -13,6 +13,13 @@ const $BMCaptcha = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
install: function() {
|
install: function() {
|
||||||
|
|
||||||
|
// localisation helper function:
|
||||||
|
let _loc = function(id, alt) {
|
||||||
|
if ($BMLocales && $BMLocales[id]) return $BMLocales[id];
|
||||||
|
return alt;
|
||||||
|
}
|
||||||
|
|
||||||
// find the parent element:
|
// find the parent element:
|
||||||
let bm_parent = document.getElementsByTagName('body')[0];
|
let bm_parent = document.getElementsByTagName('body')[0];
|
||||||
|
|
||||||
@@ -22,11 +29,14 @@ const $BMCaptcha = {
|
|||||||
dlg.setAttribute('open', 'open');
|
dlg.setAttribute('open', 'open');
|
||||||
dlg.classList.add('checking');
|
dlg.classList.add('checking');
|
||||||
dlg.id = 'botmon_captcha_box';
|
dlg.id = 'botmon_captcha_box';
|
||||||
dlg.innerHTML = '<h2>Captcha box</h2><p>Making sure you are a human:</p>';
|
dlg.innerHTML = '<h2>' + _loc('dlgTitle', 'Title') + '</h2><p>' + _loc('dlgSubtitle', 'Subtitle') + '</p>';
|
||||||
|
|
||||||
// Checkbox:
|
// Checkbox:
|
||||||
const lbl = document.createElement('label');
|
const lbl = document.createElement('label');
|
||||||
lbl.innerHTML = '<span class="confirm">Click to confirm.</span><span class="busy"></span><span class="checking">Checking …</span><span class="loading">Loading …</span><span class="erricon">�</span><span class="error">An error occured.</span>';
|
lbl.innerHTML = '<span class="confirm">' + _loc('dlgConfirm', "Confirm.") + '</span>' +
|
||||||
|
'<span class="busy"></span><span class="checking">' + _loc('dlgChecking', "Checking") + '</span>' +
|
||||||
|
'<span class="loading">' + _loc('dlgLoading', "Loading") + '</span>' +
|
||||||
|
'<span class="erricon">�</span><span class="error">' + _loc('dlgError', "Error") + '</span>';
|
||||||
const cb = document.createElement('input');
|
const cb = document.createElement('input');
|
||||||
cb.setAttribute('type', 'checkbox');
|
cb.setAttribute('type', 'checkbox');
|
||||||
cb.setAttribute('disabled', 'disabled');
|
cb.setAttribute('disabled', 'disabled');
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* @author Sascha Leib <sascha@leib.be>
|
* @author Sascha Leib <sascha@leib.be>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$conf['showday'] = 'yesterday';
|
||||||
$conf['geoiplib'] = 'disabled';
|
$conf['geoiplib'] = 'disabled';
|
||||||
$conf['useCaptcha'] = 'disabled';
|
$conf['useCaptcha'] = 'disabled';
|
||||||
$conf['captchaSeed'] = 'c53bc5f94929451987efa6c768d8856b';
|
$conf['captchaSeed'] = 'c53bc5f94929451987efa6c768d8856b';
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
* @author Sascha Leib <sascha@leib.be>
|
* @author Sascha Leib <sascha@leib.be>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$meta['showday'] = array('multichoice',
|
||||||
|
'_choices' => array ('yesterday', 'today'));
|
||||||
|
|
||||||
$meta['geoiplib'] = array('multichoice',
|
$meta['geoiplib'] = array('multichoice',
|
||||||
'_choices' => array ('disabled', 'phpgeoip'));
|
'_choices' => array ('disabled', 'phpgeoip'));
|
||||||
|
|
||||||
|
|||||||
@@ -342,5 +342,5 @@
|
|||||||
2a02:0598:0096:8a00:0000:0000:1200:0120 2a02:0598:0096:8a00:0000:0000:1200:013f 123
|
2a02:0598:0096:8a00:0000:0000:1200:0120 2a02:0598:0096:8a00:0000:0000:1200:013f 123
|
||||||
|
|
||||||
# localhosts
|
# localhosts
|
||||||
127.0.0.1 127.255.255.255 8
|
#127.0.0.1 127.255.255.255 8
|
||||||
::1 ::1 128
|
#::1 ::1 128
|
||||||
14
lang/de/lang.php
Normal file
14
lang/de/lang.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* German language file for BotMon plugin
|
||||||
|
*
|
||||||
|
* @author Sascha Leib <ad@hominem.info>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Captcha dialog locale strings:
|
||||||
|
$lang['bm_dlgTitle'] = 'Benutzerüberprüfung';
|
||||||
|
$lang['bm_dlgSubtitle'] = 'Bitte bestätige, dass du kein Bot bist:';
|
||||||
|
$lang['bm_dlgConfirm'] = 'Klicke, um zu bestätigen.';
|
||||||
|
$lang['bm_dlgChecking'] = 'Wird überprüft …';
|
||||||
|
$lang['bm_dlgLoading'] = 'Seite wird geladen …';
|
||||||
|
$lang['bm_dlgError'] = 'Es ist ein Fehler aufgetreten.';
|
||||||
14
lang/en/lang.php
Normal file
14
lang/en/lang.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* English language file for BotMon plugin
|
||||||
|
*
|
||||||
|
* @author Sascha Leib <ad@hominem.info>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Captcha dialog locale strings:
|
||||||
|
$lang['bm_dlgTitle'] = 'User Check';
|
||||||
|
$lang['bm_dlgSubtitle'] = 'Please confirm you are not a bot:';
|
||||||
|
$lang['bm_dlgConfirm'] = 'Click to confirm.';
|
||||||
|
$lang['bm_dlgChecking'] = 'Checking …';
|
||||||
|
$lang['bm_dlgLoading'] = 'Loading page …';
|
||||||
|
$lang['bm_dlgError'] = 'An error occured.';
|
||||||
@@ -5,9 +5,13 @@
|
|||||||
* @author Sascha Leib <sascha@leib.be>
|
* @author Sascha Leib <sascha@leib.be>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$lang['showday'] = 'Which data to show in the “Latest” tab:';
|
||||||
|
$lang['showday_o_yesterday'] = 'Last full day (yesterday)';
|
||||||
|
$lang['showday_o_today'] = 'Ongoing logs (today)';
|
||||||
|
|
||||||
$lang['geoiplib'] = 'Add GeoIP Information<br><small>(requires PHP module to be installed)</small>';
|
$lang['geoiplib'] = 'Add GeoIP Information<br><small>(requires PHP module to be installed)</small>';
|
||||||
$lang['geoiplib_o_disabled'] = 'Disabled';
|
$lang['geoiplib_o_disabled'] = 'Disabled';
|
||||||
$lang['geoiplib_o_phpgeoip'] = 'Use GeoIP Module';
|
$lang['geoiplib_o_phpgeoip'] = 'Use GeoIP Module';
|
||||||
|
|
||||||
$lang['useCaptcha'] = 'Enable Captcha<br><small>(Experimental, read the manual first!)</small>';
|
$lang['useCaptcha'] = 'Enable Captcha<br><small>(Experimental, read the manual first!)</small>';
|
||||||
$lang['captchaSeed'] = 'Captcha Seed<br><small>(Enter a 16 to 32 digits random number)</small>';
|
$lang['captchaSeed'] = 'Captcha Seed<br><small>(Best use a random number, e.g. <a href="https://www.browserling.com/tools/random-hex" target="_blank">here</a> )</small>';
|
||||||
|
|||||||
Reference in New Issue
Block a user