Added patch_core.sh to all 'cored' PHP projects to ease patching of the 'core' project
[mailer.git] / inc / functions.php
index 119c23891de8d87676deec8a70a5d493a2f3a2ee..45fb99ea6cef95a853db34b4d9eb155ecad7a356 100644 (file)
@@ -634,9 +634,9 @@ function array_pk_sort (&$array, $a_sort, $primary_key = '0', $order = -1, $nums
 
 //
 // Deprecated : $length (still has one reference in this function)
-// Optional   : $DATA
+// Optional   : $extraData
 //
-function generateRandomCode ($length, $code, $userid, $DATA = '') {
+function generateRandomCode ($length, $code, $userid, $extraData = '') {
        // Build server string
        $server = $_SERVER['PHP_SELF'] . getEncryptSeperator() . detectUserAgent() . getEncryptSeperator() . getenv('SERVER_SOFTWARE') . getEncryptSeperator() . detectRealIpAddress() . getEncryptSeperator() . detectRemoteAddr();
 
@@ -654,7 +654,7 @@ function generateRandomCode ($length, $code, $userid, $DATA = '') {
        } // END - if
 
        // Build string from misc data
-       $data   = $code . getEncryptSeperator() . $userid . getEncryptSeperator() . $DATA;
+       $data  = $code . getEncryptSeperator() . $userid . getEncryptSeperator() . $extraData;
 
        // Add more additional data
        if (isSessionVariableSet('u_hash')) {
@@ -2217,7 +2217,7 @@ function generateAdminMailLinks ($mailType, $mailId) {
                if (SQL_NUMROWS($result) == 1) {
                        // Load the entry
                        $content = SQL_FETCHARRAY($result);
-                       die(__FUNCTION__.':<br />content=<pre>'.print_r($content, true).'</pre>');
+                       die('Unfinished area:<br />'.__FUNCTION__.':<br />content=<pre>'.print_r($content, true).'</pre>');
                } // END - if
 
                // Free result
@@ -2289,6 +2289,25 @@ function detectMultiBytePrefix ($str) {
        return $mbPrefix;
 }
 
+// Searches the given array for a sub-string match and returns all found keys in an array
+function getArrayKeysFromSubStrArray ($heystack, array $needles, $offset = 0) {
+       // Init array for all found keys
+       $keys = array();
+
+       // Now check all entries
+       foreach ($needles as $key => $needle) {
+               // Do we have found a partial string?
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'heystack='.$heystack.',key='.$key.',needle='.$needle.',offset='.$offset);
+               if (strpos($heystack, $needle, $offset) !== false) {
+                       // Add the found key
+                       $keys[] = $key;
+               } // END - if
+       } // END - foreach
+
+       // Return the array
+       return $keys;
+}
+
 //-----------------------------------------------------------------------------
 // Automatically re-created functions, all taken from user comments on www.php.net
 //-----------------------------------------------------------------------------