Reverted previous commit, this is an unfinished area
[mailer.git] / inc / functions.php
index 119c23891de8d87676deec8a70a5d493a2f3a2ee..cb8212eb88378bef8e24ba51420e055c346c94d5 100644 (file)
@@ -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
 //-----------------------------------------------------------------------------