====== Hiding IPs Plugin ====== ---- plugin ---- description: Avoid IP addresses shown to public. Admins can view IPs even with this plugin. author : Hokkaidoperson email : dosankomali@yahoo.co.jp type : Action, Helper lastupdate : 2018-11-05 compatible : Greebo, Hogfather tags : ip, anonymous downloadurl: https://github.com/hokkaidoperson/DokuWiki-HidingIP-Plugin/archive/master.zip bugtracker : https://github.com/hokkaidoperson/DokuWiki-HidingIP-Plugin/issues sourcerepo : https://github.com/hokkaidoperson/DokuWiki-HidingIP-Plugin/ ---- :!: [[ja:plugin:hidingip|このページは日本語でご覧頂けます(This page is also available in Japanese)]]\\ :!: I’m not a native English speaker, so this page may contain some mistakes in English sentences. ===== Summary ===== In default, DokuWiki sometimes show IPs of those who are not logging in. For example, recent changes or old revisions are shown like this: 2018/05/27 12:39 pagename – Summary. XXX.XXX.XXX.XXX -xxx B 2018/05/22 23:54 pagename – Summary. username ±0 B But some people think that IPs shouldn't be shown to public.\\ This plugin tries to replace such IPs with alternative texts (''A User Not Logged in'' in default). Admins can view IPs even with this plugin. ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ===== Examples/Usage ===== It doesn't need any additional settings.\\ After you install this plugin, it'll automatically hide IPs in: * Recent Changes (via an event [[devel:event:html_recentform_output|HTML_RECENTFORM_OUTPUT]]) * Old Revisions (via an event [[devel:event:html_revisionsform_output|HTML_REVISIONSFORM_OUTPUT]]) * Showing Diffs (via an event [[devel:event:tpl_content_display|TPL_CONTENT_DISPLAY]]) * Last Modified (via an event [[devel:event:common_user_link|COMMON_USER_LINK]]) * Page Locking (via an event [[devel:event:common_user_link|COMMON_USER_LINK]]) The plugin will rewrite only superficial data, core data won't be overwritten. When to run this plugin can be specified on the config (see [[#Configuration and Settings]]). ==== Helper Plugin Option ==== You can use the localization of the alternative text used by this plugin.\\ Here is a sample of the code: if (!isset($_SERVER['REMOTE_USER'])) { if(!plugin_isdisabled('hidingip')) { $hidingip = plugin_load('helper', 'hidingip'); $user = $hidingip->altText(); // "$hidingip->getLang('notloggedin')" works similarly } A practical sample can be seen in the program of my [[plugin:autotweet2|Autotweet2 plugin]] ([[https://github.com/hokkaidoperson/DokuWiki-AutoTweet2-Plugin/blob/master/action.php#L71|Here]]). ==== How IPs are Replaced ==== === In Recent Changes and Old Revisions === When ''%%$event->data->_content['(number)']['class']%%'' has 'user', there is an user name or an IP address in ''%%$event->data->_content['(the next number)']%%''.\\ Thus this plugin detects the 'user' texts, and substitutes TRUE for ''$flag'' if found.\\ If the ''$flag'' is TRUE, this plugin will check whether or not there is an IP in the texts. If found, it'll be hidden .\\ But, the first item of the old revision is different a little from others, so there is some customizing. === In Showing Diffs === The function is similar to that in recent changes and old revisions, but it'll modify HTML directly. === In Last Modified and Page Locking === :!: **UPDATED**\\ If ''%%$event->data['username']%%'' is likely to be an IP, the plugin will write ''%%$event->data['name']%%''.\\ :!: You can't use the user name like IPs (that'll be accidentally replaced. e.g.: 3.57.2.13 ).((though I think that the case is rare)) ===== Configuration and Settings ===== You can change the following setting by using the [[plugin:config|Configuration Manager]]. ^Option^Description^Value Type^Default Value^ |''whenToHide''|When to run the plugin (In the text box, you can specify when to run if you'll use Hidingip Helper plugin in other plugins.)|multiple choice from ''revision'' (Old revisions), ''recent'' (Recent changes), ''diff'' (Showing diffs), and ''userlink'' (COMMON_USER_LINK event (such as page locking and showing "last modified"))|''revision,recent,diff,userlink''| |''rightToSeeIP''|Who can see IP addresses? (see config "[[config:manager]]" and "[[config:superuser]]|pull-down choice from ''sp'' (Superusers) or ''mg'' (Managers (including superusers))|''sp''| ===== Development ===== === Change Log === * **2018-06-01** * Initial release * **2018-06-02** * modified text garbling * **2018-10-24** * Update with bug fixing (The problem about WARNING level errors, and the problem that the plugin didn't work well if [[config:showuseras|the config Showuseras]] was ''username_link'' or ''email_link'') * **2018-10-30** * Adding some options (configs and the helper plugin section) * **2018-11-05** * Fixed invalid syntax === Known Bugs and Issues === Currently none === ToDo/Wish List === Currently none ===== Contact Me ===== If you find some problems in this plugin, you can make issue topics on the [[https://github.com/hokkaidoperson/DokuWiki-HidingIP-Plugin|GitHub page]], or if you wanna contact me for other things, you can contact me by: * * [[https://twitter.com/YukkuriDosanko|My Twitter]] (Japanese account but English acceptable) ===== Discussion =====