]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Added doTemplateGuestFooterExtras() call-back and guest_footer_extras filter chain
[mailer.git] / inc / mysql-manager.php
index 419859d5cb83839c112e1185c22d5841fa180d55..679d415d40235a35dd061089cef05002e0006c7f 100644 (file)
@@ -2026,7 +2026,7 @@ function doGenericAddEntries ($tableName, $columns = array(), $filterFunctions =
                // Is columnIndex set?
                if (!is_null($columnIndex)) {
                        // Check conditions
-                       //* DEBUG: */ die('columnIndex=<pre>'.print_r($columnIndex,TRUE).'</pre>'.debug_get_printable_backtrace());
+                       //* DEBUG: */ die('columnName=<pre>'.print_r($columnName,TRUE).'</pre>columnIndex=<pre>'.print_r($columnIndex,TRUE).'</pre>'.debug_get_printable_backtrace());
                        assert((is_array($columnName)) && (is_string($columnIndex)) && (isset($columnName[$columnIndex])));
 
                        // Then use that index "blindly"
@@ -2040,11 +2040,22 @@ function doGenericAddEntries ($tableName, $columns = array(), $filterFunctions =
                $sqlColumns[$key] = SQL_ESCAPE($columnName);
                $sqlValues[$key]  = SQL_ESCAPE(postRequestElement($columnName));
 
+               // Search for it
+               $search = key(search_array($columns, 'column', $columnName));
+
                // Try to handle call-back functions and/or extra values on the list
-               $sqlValues[$key] = doHandleExtraValues($filterFunctions, $extraValues, $key . '_list', $sqlValues[$key], $userIdColumn, key(search_array($columns, 'column', $key)));
+               //* DEBUG: */ outputHtml($key . '/' . $columnName . '=<pre>'.print_r($columns,true).'</pre>search_array()=<pre>'.print_r(search_array($columns, 'column', $columnName), true).'</pre>');
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '(' . gettype($key) . ')][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
+               if (is_string($key)) {
+                       // Key is a string
+                       $sqlValues[$key] = doHandleExtraValues($filterFunctions, $extraValues, $key . '_list', $sqlValues[$key], array(''), $search);
+               } else {
+                       // Is a number
+                       $sqlValues[$key] = doHandleExtraValues($filterFunctions, $extraValues, $key, $sqlValues[$key], array(''), $search);
+               }
 
                // Is the value not a number?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key]);
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '(' . gettype($key) . ')][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
                if (($sqlValues[$key] != 'NULL') && (is_string($sqlValues[$key]))) {
                        // Add quotes around it
                        $sqlValues[$key] = chr(39) . $sqlValues[$key] . chr(39);
@@ -2239,7 +2250,7 @@ function doGenericDeleteEntriesConfirm ($tableName, $columns = array(), $filterF
 
        // Is a user id provided?
        //* BUG: */ die('<pre>'.print_r($rawUserId,TRUE).'</pre><pre>'.print_r($userIdColumn,TRUE).'</pre>');
-       if ((isset($rawUserId[0])) && (isPostRequestElementSet($rawUserId[0])) && (isset($userIdColumn[0]))) {
+       if ((isset($rawUserId[0])) && (isset($userIdColumn[0])) && (isPostRequestElementSet($rawUserId[0])) && (!is_array(postRequestElement($rawUserId[0])))) {
                // Add user id as well
                $sql .= ' AND `' . $userIdColumn[0] . '`=' . bigintval(postRequestElement($rawUserId[0]));
        } // END - if
@@ -2372,7 +2383,7 @@ function doGenericListBuilder ($prefix, $listType, $tableName, $columns, $filter
                                // Try to handle call-back functions and/or extra values
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'idx=' . $idx . ',row[' . $key . ']=' . $row[$key]);
                                //if ($key == 'forced_campaign_created') die($idx.'=<pre>'.print_r($columns,true).'</pre><pre>'.print_r($extraValues,true).'</pre>');
-                               $row[$key] = doHandleExtraValues($filterFunctions, $extraValues, $idx, $row[$key], $userIdColumn, ((!is_null($name)) ? $name : $key));
+                               $row[$key] = doHandleExtraValues($filterFunctions, $extraValues, $idx, $row[$key], $userIdColumn, ((!is_null($name)) ? $name : $key), $id);
                        } // END - foreach
 
                        // Then list it