<?php
/************************************************************************
- * MXChange v0.2.1 Start: 10/01/2008 *
- * =============== Last change: 10/01/2008 *
+ * Mailer v0.2.1-FINAL Start: 10/01/2008 *
+ * =================== Last change: 10/01/2008 *
* *
* -------------------------------------------------------------------- *
* File : removeip_functions.php *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Spezielle Funktion fuer removeip-Erweiterung *
* -------------------------------------------------------------------- *
- * $Revision:: 856 $ *
+ * $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 *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
+ die();
+} // END - if
// "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
// 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;
+ $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";
+ case '0':
+ $suffix = 'none';
break;
- case 1:
- $suffix = "low";
+ case '1':
+ $suffix = 'low';
break;
- case 2:
- $suffix = "medium";
+ case '2':
+ $suffix = 'medium';
break;
- case 3: // High level
- $suffix = "high";
+ case '3': // High level
+ $suffix = 'high';
break;
} // END - while
- // Construct constant name
- $constantName = strtoupper(sprintf("REMOVEIP_LEVEL_%s", $suffix));
-
// Default message
- $message = sprintf(REMOVEIP_UNKNOWN_LEVEL, $suffix);
-
- // Is that constant there?
- if (defined($constantName)) {
- // Use that string
- $message = constant($constantName);
- } // END - if
+ $message = sprintf("{--REMOVEIP_LEVEL_%s--}", strtoupper($suffix));
// 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
$content = $data;
// Extension removeip activated?
- if ((EXT_IS_ACTIVE("removeip")) && (getConfig('removeip_'.strtolower($data['access_level']).'_show') == "Y")) {
+ if ((isExtensionActive('removeip')) && (getConfig('removeip_'.strtolower($data['access_level']).'_show') == 'Y')) {
// Add anoymity/privacy infos
- $content['content'] .= REMOVEIP_ADD_INFOS()."<br />\n";
+ $content['content'] .= addAnonymityLevel() . "<br />\n";
} // END - if
// Return it
return $content;
}
-//
+// [EOF]
?>