X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fremoveip_functions.php;h=8e908dad35e10905448736d5a1d616e25da283bc;hp=e3b69e9e8b0a34cbffebf638a538d4ae684f0ef2;hb=d92d8b4ddd219b65df8e0bba5e4354c0bbfba5c9;hpb=f9a9c09e1ae257449bfd98f8854e321efba1dc3c diff --git a/inc/libs/removeip_functions.php b/inc/libs/removeip_functions.php index e3b69e9e8b..8e908dad35 100644 --- a/inc/libs/removeip_functions.php +++ b/inc/libs/removeip_functions.php @@ -10,9 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Spezielle Funktion fuer removeip-Erweiterung * * -------------------------------------------------------------------- * - * * + * $Revision:: $ * + * $Date:: $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * - * Copyright (c) 2003 - 2008 by Roland Haeder * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -33,23 +38,25 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); + die(); } // "Getter" for anonymous remote IP number -function GET_ANONYMOUS_REMOTE_ADDR ($remoteAddr) { +function getAnonymousRemoteAddress ($remoteAddr) { // Is config enabled? - if (getConfig('removeip_anon_ip') == "Y") { + if (getConfig('removeip_anon_ip') == 'Y') { // Switch way do we like? switch (getConfig('anonymous_ip')) { - case "127.0.0.1": // mod_removeip style - case "0.0.0.0": // Some people may prefer this... - $remoteAddr = getConfig('anonymous_ip'); + case 'LOCAL': // localhost + $remoteAddr = '127.0.0.1'; + break; + + case 'ZERO': // All four numbers zero + $remoteAddr = '0.0.0.0'; break; - case "RANDOM": // Pseudo-random IP number - $remoteAddr = mt_rand(1,254).".".mt_rand(0,254).".".mt_rand(0,254).".".mt_rand(1,254); + case 'RANDOM': // Generate random ip + $remoteAddr = mt_rand(1, 254) . '.' . mt_rand(0, 254) . '.'.mt_rand(0, 254) . '.' . mt_rand(1, 254); break; } // END - switch } // END - if @@ -57,88 +64,107 @@ function GET_ANONYMOUS_REMOTE_ADDR ($remoteAddr) { // Return it return $remoteAddr; } + // "Getter" for anonymous remote hostname -function GET_ANONYMOUS_REMOTE_HOST ($remoteHost) { +function getAnonymousRemoteHost ($remoteHost) { // Is config enabled? - if (getConfig('removeip_anon_host') == "Y") { + if (getConfig('removeip_anon_host') == 'Y') { // Set anon hostname - $remoteHost = "localhost.localnet"; + $remoteHost = 'localhost.localnet'; } // END - if // Return it return $remoteHost; } + // "Getter" for anonymous user agent -function GET_ANONYMOUS_USER_AGENT ($userAgent) { +function getAnonymousUserAgent ($userAgent) { // Is config enabled? - if (getConfig('removeip_anon_ua') == "Y") { + if (getConfig('removeip_anon_ua') == 'Y') { // Set anon user agent - $userAgent = "-"; + $userAgent = '-'; } // END - if // Return it return $userAgent; } + // "Getter" for anonymous referer -function GET_ANONYMOUS_REFERER ($referer) { +function getAnonymousReferer ($referer) { // Is config enabled? - if (getConfig('removeip_anon_ref') == "Y") { + if (getConfig('removeip_anon_ref') == 'Y') { // Set anon user agent - $referer = "-"; + $referer = '-'; } // END - if // Return it return $referer; } + // Adds informations about anonymity/privacy to the menu -function REMOVEIP_ADD_INFOS () { +function addAnonymityLevel () { // "Base-privacy" is by default low (we add more later) $anonymity = 0; // Is some data anonymized? - if (getConfig('removeip_anon_ip') == "Y") $anonymity++; - if (getConfig('removeip_anon_host') == "Y") $anonymity++; - if (getConfig('removeip_anon_ua') == "Y") $anonymity++; - if (getConfig('removeip_anon_ref') == "Y") $anonymity++; + if (getConfig('removeip_anon_ip') == 'Y') $anonymity++; + if (getConfig('removeip_anon_host') == 'Y') $anonymity++; + if (getConfig('removeip_anon_ua') == 'Y') $anonymity++; + if (getConfig('removeip_anon_ref') == 'Y') $anonymity++; // Calculate anonymity level $level = round($anonymity / 4 * 3); // Set constant name suffix depending on that level - $suffix = "unsupported_{$level}"; + $suffix = 'unsupported_' . $level; switch ($level) { case 0: - $suffix = "none"; + $suffix = 'none'; break; case 1: - $suffix = "low"; + $suffix = 'low'; break; case 2: - $suffix = "medium"; + $suffix = 'medium'; break; case 3: // High level - $suffix = "high"; + $suffix = 'high'; break; } // END - while // Construct constant name - $constantName = strtoupper(sprintf("REMOVEIP_LEVEL_%s", $suffix)); + $constantName = sprintf("REMOVEIP_LEVEL_%s", strtoupper($suffix)); // Default message - $message = sprintf(REMOVEIP_UNKNOWN_LEVEL, $suffix); + $message = sprintf(getMessage('REMOVEIP_UNKNOWN_LEVEL'), $suffix); // Is that constant there? - if (defined($constantName)) { + if (isMessageIdValid($constantName)) { // Use that string - $message = constant($constantName); + $message = getMessage($constantName); } // END - if // Output message in template - return LOAD_TEMPLATE("removeip_level", true, $message); + return loadTemplate('removeip_level', true, $message); +} + +// Filter for adding anonymity notice to the output stream +function FILTER_ADD_ANONYMITY_NOTICE ($data) { + // Init content + $content = $data; + + // Extension removeip activated? + if ((isExtensionActive('removeip')) && (getConfig('removeip_'.strtolower($data['access_level']).'_show') == 'Y')) { + // Add anoymity/privacy infos + $content['content'] .= addAnonymityLevel() . "
\n"; + } // END - if + + // Return it + return $content; } -// +// [EOF] ?>