Birthday link fixed
[mailer.git] / inc / functions.php
index df26e508c0730adf8d2c8e126598453a39ce78e5..e24be85a2de601d7eb0a4784f70a6b90418b9051 100644 (file)
@@ -786,7 +786,11 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
                break;
 
        case "add-points":
-               $points         = bigintval($_POST['points']);
+               if (isset($_POST['points'])) {
+                       $points         = bigintval($_POST['points']);
+               } else {
+                       $points = __POINTS_VALUE;
+               }
                break;
 
        case "guest_request_confirm":
@@ -1212,9 +1216,15 @@ function GEN_RANDOM_CODE($length, $code, $uid, $DATA="")
        return $return;
 }
 // Does only allow numbers
-function bigintval($num)
+function bigintval($num, $castValue = true)
 {
-       $ret = (int) preg_replace("/[^0123456789]/", "", $num);
+       // Filter all numbers out
+       $ret = preg_replace("/[^0123456789]/", "", $num);
+
+       // Cast the value?
+       if ($castValue) $ret = (int) $ret;
+
+       // Return result
        return $ret;
 }
 // Insert the code in $img_code into jpeg or PNG image
@@ -1800,8 +1810,8 @@ function generateHash($plainText, $salt = "") {
 
        // Is the required extension "sql_patches" there?
        if ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == "")) {
-               // Extension sql_patches is missing/outdated so we return only the regular SHA1 hash
-               return sha1($plainText);
+               // Extension sql_patches is missing/outdated so we return the plain text
+               return $plainText;
        }
 
        // When the salt is empty build a new one, else use the first x configured characters as the salt
@@ -2051,7 +2061,6 @@ function DISPLAY_PARSING_TIME_FOOTER() {
 // Unset/set session variables
 function set_session ($var, $value) {
        global $CSS;
-
        // Abort in CSS mode here
        if ($CSS == 1) return true;
 
@@ -2080,9 +2089,7 @@ function set_session ($var, $value) {
 // Taken from user comments in PHP documentation for function constant()
 function isBooleanConstantAndTrue($constname) { // : Boolean
        $res = false;
-       if (defined($constname)) {
-               $res = (constant($constname) === true);
-       }
+       if (defined($constname)) $res = (constant($constname) === true);
        return($res);
 }