]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Mailer continued, sub-id tracking continued:
[mailer.git] / inc / functions.php
index 806bf7da525c2ca3c7513677bac2f5d9e2372435..5fb35afd9f707113a8e54ec8c0466baff0661b9b 100644 (file)
@@ -330,7 +330,7 @@ function translateMenuVisibleLocked ($content, $prefix = '') {
 }
 
 // Generates an URL for the dereferer
-function generateDerefererUrl ($url) {
+function generateDereferrerUrl ($url) {
        // Don't de-refer our own links!
        if (substr($url, 0, strlen(getUrl())) != getUrl()) {
                // Encode URL
@@ -2396,6 +2396,18 @@ function memberListBuilder ($listType, $tableName, $columns, $filterFunctions, $
        doGenericListBuilder('member', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId);
 }
 
+// Checks whether given address is IPv4
+function isIp4AddressValid ($address) {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__][$address])) {
+               // Determine it ...
+               $GLOBALS[__FUNCTION__][$address] = preg_match('/((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))/', $address);
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$address];
+}
+
 // ----------------------------------------------------------------------------
 //              "Translatation" functions for points_data table
 // ----------------------------------------------------------------------------