]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
rewritten to new functions, some parts rewritten to filters
[mailer.git] / inc / functions.php
index 8bfa1eaac3406275edad455e48464c0920bbbd03..01dd840977e15583dbfaf171e096e672cf0d025f 100644 (file)
@@ -1221,12 +1221,12 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
 }
 
 //
-function TRANSLATE_YESNO($yn) {
+function TRANSLATE_YESNO ($yn) {
        // Default
-       $yn = "??? (".$yn.")";
+       $translated = "??? (".$yn.")";
        switch ($yn) {
-               case "Y": $yn = getMessage('YES'); break;
-               case "N": $yn = getMessage('NO'); break;
+               case "Y": $translated = getMessage('YES'); break;
+               case "N": $translated = getMessage('NO'); break;
                default:
                        // Log unknown value
                        DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown value %s. Expected Y/N!", $yn));
@@ -1234,7 +1234,7 @@ function TRANSLATE_YESNO($yn) {
        }
 
        // Return it
-       return $yn;
+       return $translated;
 }
 
 //
@@ -1978,7 +1978,7 @@ function VALIDATE_URL ($URL, $compile=true) {
        return isUrlValid($URL);
 }
 
-//
+// Generate a list of administrative links to a given userid
 function MEMBER_ACTION_LINKS ($uid, $status = "") {
        // Define all main targets
        $TARGETS = array("del_user", "edit_user", "lock_user", "add_points", "sub_points");
@@ -2015,13 +2015,6 @@ function MEMBER_ACTION_LINKS ($uid, $status = "") {
        return $OUT;
 }
 
-// Function for backward-compatiblity
-// @TODO Can this function be deprecated?
-function ADD_CATEGORY_TABLE ($MODE, $return=false) {
-       // Load it from the register extension
-       return REGISTER_ADD_CATEGORY_TABLE ($MODE, $return);
-}
-
 // Generate an email link
 function CREATE_EMAIL_LINK ($email, $table = "admins") {
        // Default email link (INSECURE! Spammer can read this by harvester programs)
@@ -2045,6 +2038,7 @@ function CREATE_EMAIL_LINK ($email, $table = "admins") {
        // Return email link
        return $EMAIL;
 }
+
 // Generate a hash for extra-security for all passwords
 function generateHash ($plainText, $salt = "") {
        global $_SERVER;
@@ -2095,7 +2089,8 @@ function generateHash ($plainText, $salt = "") {
        // Return hash
        return $salt.sha1($salt.$plainText);
 }
-//
+
+// Scramble a string
 function scrambleString($str) {
        // Init
        $scrambled = "";
@@ -2126,7 +2121,8 @@ function scrambleString($str) {
        //* DEBUG: */ echo "***Scrambled=".$scrambled."***<br />";
        return $scrambled;
 }
-//
+
+// De-scramble a string scrambled by scrambleString()
 function descrambleString($str) {
        // Scramble only 40 chars long strings
        if (strlen($str) != 40) return $str;
@@ -2149,7 +2145,8 @@ function descrambleString($str) {
        //* DEBUG: */ echo "+++Original=".$orig."+++<br />";
        return $orig;
 }
-//
+
+// Generated a "string" for scrambling
 function genScrambleString ($len) {
        // Prepare array for the numbers
        $scrambleNumbers = array();
@@ -2575,19 +2572,8 @@ function getActualVersion ($type = 0) {
 
 // Loads an include file and logs any missing files for debug purposes
 function LOAD_INC ($INC) {
-       // Get constant path
-       $PATH = constant('PATH');
-
-       // Use the include file name directly
-       // @TODO Try to find all locations where an FQFN is given to these two
-       // @TODO functions and avoid it.
-       $FQFN = $INC;
-
-       // Check if PATH is in $INC
-       if (substr($INC, 0, $PATH) != $PATH) {
-               // Add it. This is why we need a trailing slash in config.php
-               $FQFN = $PATH . $INC;
-       } // END - if
+       // Add the path. This is why we need a trailing slash in config.php
+       $FQFN = constant('PATH') . $INC;
 
        // Is the include file there?
        if (!FILE_READABLE($FQFN)) {