]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Double question mark fixed
[mailer.git] / inc / functions.php
index 119c23891de8d87676deec8a70a5d493a2f3a2ee..da112b43fab7d71e293f3c5c0fe2df27ad410655 100644 (file)
@@ -550,17 +550,8 @@ function redirectToUrl ($URL, $allowSpider = true) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $URL);
        //* DEBUG: */ die($URL);
 
-       // Simple probe for bots/spiders from search engines
-       if ((isSpider()) && ($allowSpider === true)) {
-               // Set HTTP-Status
-               setHttpStatus('200 OK');
-
-               // Set content-type here to fix a missing array element
-               setContentType('text/html');
-
-               // Output new location link as anchor
-               outputHtml('<a href="' . $URL . '"' . $rel . '>' . secureString($URL) . '</a>');
-       } elseif (!headers_sent()) {
+       // We should not sent a redirect if headers are already sent
+       if (!headers_sent()) {
                // Clear output buffer
                clearOutputBuffer();
 
@@ -634,9 +625,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 +645,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 +2208,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 +2280,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
 //-----------------------------------------------------------------------------