• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révisionbf44d376c9e956659e3ba90679d9990ebfe9c433 (tree)
l'heure2021-12-11 01:33:20
Auteurumorigu <umorigu@gmai...>
Commiterumorigu

Message de Log

BugTrack/2178 counter plugin: Ignore REMOTE_ADDR

define('PLUGIN_COUNTER_IGNORE_REMOTE_ADDR', FALSE);

Introduce PLUGIN_COUNTER_IGNORE_REMOTE_ADDR constant.

If true, the plugin always count up counter for all requests.
This option is for reverse proxy or load balancer environments.

Change Summary

Modification

--- a/plugin/counter.inc.php
+++ b/plugin/counter.inc.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // counter.inc.php
44 // Copyright
5-// 2002-2019 PukiWiki Development Team
5+// 2002-2021 PukiWiki Development Team
66 // 2002 Y.MASUI GPL2 http://masui.net/pukiwiki/ masui@masui.net
77 // License: GPL2
88 //
@@ -10,6 +10,8 @@
1010
1111 // Counter file's suffix
1212 define('PLUGIN_COUNTER_SUFFIX', '.count');
13+// Ignore REMOTE_ADDR : TRUE for reverse proxy / load balancer environment
14+define('PLUGIN_COUNTER_IGNORE_REMOTE_ADDR', FALSE);
1315 // Use Database (1) or not (0)
1416 define('PLUGIN_COUNTER_USE_DB', 0);
1517 // Database Connection setting
@@ -148,6 +150,9 @@ function plugin_counter_get_count($page)
148150
149151 // Anothoer day?
150152 $remote_addr = $_SERVER['REMOTE_ADDR'];
153+ if (! $remote_addr) {
154+ $remote_addr = '_';
155+ }
151156 $count_up = FALSE;
152157 if ($c['date'] != $default['date']) {
153158 $modify = TRUE;
@@ -158,7 +163,7 @@ function plugin_counter_get_count($page)
158163 $c['today'] = 1;
159164 $c['total']++;
160165 $count_up = TRUE;
161- } else if ($c['ip'] != $remote_addr) {
166+ } else if ($c['ip'] != $remote_addr || PLUGIN_COUNTER_IGNORE_REMOTE_ADDR) {
162167 // Not the same host
163168 $modify = TRUE;
164169 $c['ip'] = $remote_addr;