]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/removeip_functions.php
Missing SVN properties set
[mailer.git] / inc / libs / removeip_functions.php
index ab59b19cf978e6d95029578a1e546f60d4aede0d..4c6a4b2a48c23d54d8a4296b0021a6c41200ce03 100644 (file)
@@ -1,7 +1,7 @@
 <?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                           *
@@ -17,7 +17,7 @@
  * 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 *
 
 // 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') {
                // 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 "RANDOM": // Pseudo-random IP number
-                               $remoteAddr = mt_rand(1,254).".".mt_rand(0,254).".".mt_rand(0,254).".".mt_rand(1,254);
+                       case 'ZERO': // All four numbers zero
+                               $remoteAddr = '0.0.0.0';
+                               break;
+
+                       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
@@ -62,43 +64,47 @@ 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') {
                // 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') {
                // 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') {
                // 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++;
@@ -110,39 +116,39 @@ function REMOVEIP_ADD_INFOS () {
        $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));
+       $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
@@ -151,14 +157,14 @@ function FILTER_ADD_ANONYMITY_NOTICE ($data) {
        $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]
 ?>