Extension ext-coupon continued, naming convention, many improvements:
[mailer.git] / inc / functions.php
index 6f570cdd1ffc2afa2b191fba0d67a3ebc7ee5673..be1223d7b40a3a7ca61983734dae43382adf51bc 100644 (file)
@@ -926,7 +926,7 @@ function generateHash ($plainText, $salt = '', $hash = true) {
                // Sanity check on salt
                if (strlen($salt) != getSaltLength()) {
                        // Not the same!
-                       debug_report_bug(__FUNCTION__, __LINE__, 'salt length mismatch! ('.strlen($salt).'/'.getSaltLength().')');
+                       debug_report_bug(__FUNCTION__, __LINE__, 'salt length mismatch! (' . strlen($salt) . '/' . getSaltLength() . ')');
                } // END - if
        }
 
@@ -2316,6 +2316,33 @@ function getArrayKeysFromSubStrArray ($heystack, array $needles, $offset = 0) {
        return $keys;
 }
 
+// Determines database column name from given subject and locked
+function determinePointsColumnFromSubjectLocked ($subject, $locked) {
+       // Default is 'normal' points
+       $pointsColumn = 'points';
+
+       // Which points, locked or normal?
+       if ($locked === true) {
+               $pointsColumn = 'locked_points';
+       } // END - if
+
+       // Prepare array for filter
+       $filterData = array(
+               'subject' => $subject,
+               'locked'  => $locked,
+               'column'  => $pointsColumn
+       );
+
+       // Run the filter
+       $filterData = runFilterChain('determine_points_column_name', $filterData);
+
+       // Extract column name from array
+       $pointsColumn = $filterData['column'];
+
+       // Return it
+       return $pointsColumn;
+}
+
 //-----------------------------------------------------------------------------
 // Automatically re-created functions, all taken from user comments on www.php.net
 //-----------------------------------------------------------------------------