X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=5fb35afd9f707113a8e54ec8c0466baff0661b9b;hp=806bf7da525c2ca3c7513677bac2f5d9e2372435;hb=96d8f54d3fee1d51c38dd6b79c28215f7f5c83ec;hpb=da50e51b98ba0901d6251b7f36e138ac6f63518d diff --git a/inc/functions.php b/inc/functions.php index 806bf7da52..5fb35afd9f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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 // ----------------------------------------------------------------------------