2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/01/2008 *
4 * =================== Last change: 10/01/2008 *
6 * -------------------------------------------------------------------- *
7 * File : removeip_functions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Special functions for removeip extension *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Spezielle Funktion fuer removeip-Erweiterung *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // "Getter" for anonymous remote IP number
44 function getAnonymousRemoteAddress ($remoteAddr) {
46 if (getConfig('removeip_anon_ip') == 'Y') {
47 // Switch way do we like?
48 switch (getConfig('anonymous_ip')) {
49 case 'LOCAL': // localhost
50 $remoteAddr = '127.0.0.1';
53 case 'ZERO': // All four numbers zero
54 $remoteAddr = '0.0.0.0';
57 case 'RANDOM': // Generate random ip
58 $remoteAddr = mt_rand(1, 254) . '.' . mt_rand(0, 254) . '.'.mt_rand(0, 254) . '.' . mt_rand(1, 254);
67 // "Getter" for anonymous remote hostname
68 function getAnonymousRemoteHost ($remoteHost) {
70 if (getConfig('removeip_anon_host') == 'Y') {
72 $remoteHost = 'localhost.localnet';
79 // "Getter" for anonymous user agent
80 function getAnonymousUserAgent ($userAgent) {
82 if (getConfig('removeip_anon_ua') == 'Y') {
83 // Set anon user agent
91 // "Getter" for anonymous referer
92 function getAnonymousReferer ($referer) {
94 if (getConfig('removeip_anon_ref') == 'Y') {
95 // Set anon user agent
103 // Adds informations about anonymity/privacy to the menu
104 function addAnonymityLevel () {
105 // "Base-privacy" is by default low (we add more later)
108 // Is some data anonymized?
109 if (getConfig('removeip_anon_ip') == 'Y') $anonymity++;
110 if (getConfig('removeip_anon_host') == 'Y') $anonymity++;
111 if (getConfig('removeip_anon_ua') == 'Y') $anonymity++;
112 if (getConfig('removeip_anon_ref') == 'Y') $anonymity++;
114 // Calculate anonymity level
115 $level = round($anonymity / 4 * 3);
117 // Set constant name suffix depending on that level
118 $suffix = 'unsupported_' . $level;
132 case '3': // High level
138 $message = sprintf("{--REMOVEIP_LEVEL_%s--}", strtoupper($suffix));
140 // Output message in template
141 return loadTemplate('removeip_level', TRUE, $message);