X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=c73058b0a52d1d88e0751a55f50c02ad3f6f4d81;hb=7967841ac94cdcbd10b4d5c011a1e0a9982ec600;hp=bfe60aa6e7b6439b30ec62198d4ea384d710b102;hpb=4ef4c88fc481335dc0631b223111c15a84cccb51;p=mailer.git
diff --git a/inc/functions.php b/inc/functions.php
index bfe60aa6e7..c73058b0a5 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -53,6 +53,7 @@ function is_INCWritable($inc) {
// Open a table (you may want to add some header stuff here)
function OPEN_TABLE($PERCENT = "", $CLASS = "", $ALIGN="left", $VALIGN="", $td_only=false) {
global $table_cnt;
+
// Count tables so we can generate CSS classes for every table... :-)
if (empty($CLASS)) {
// Class is empty so count one up and create a class
@@ -904,7 +905,7 @@ function MAKE_TIME($H, $M, $S, $stamp) {
}
//
function LOAD_URL($URL, $addUrlData=true) {
- global $CSS, $_CONFIG, $link, $db, $footer;
+ global $CSS, $_CONFIG, $footer;
// Check if http(s):// is there
if ((substr($URL, 0, 7) != "http://") && (substr($URL, 0, 8) != "https://")) {
@@ -2031,15 +2032,14 @@ function scrambleString($str) {
// Add it to final output string
$scrambled .= $char;
- }
+ } // END - for
// Return scrambled string
//* DEBUG: */ echo "***Scrambled=".$scrambled."***
";
return $scrambled;
}
//
-function descrambleString($str)
-{
+function descrambleString($str) {
global $_CONFIG;
// Scramble only 40 chars long strings
if (strlen($str) != 40) return $str;
@@ -2053,11 +2053,10 @@ function descrambleString($str)
// Begin descrambling
$orig = str_repeat(" ", 40);
//* DEBUG: */ echo "+++Scrambled=".$str."+++
";
- for ($idx = 0; $idx < 40; $idx++)
- {
+ for ($idx = 0; $idx < 40; $idx++) {
$char = substr($str, $idx, 1);
$orig = substr_replace($orig, $char, $scrambleNums[$idx], 1);
- }
+ } // END - for
// Return scrambled string
//* DEBUG: */ echo "+++Original=".$orig."+++
";
@@ -2077,11 +2076,11 @@ function genScrambleString($len) {
// Check for it by creating more numbers
while (array_key_exists($rand, $scrambleNumbers)) {
$rand = mt_rand(0, ($len -1));
- }
+ } // END - while
// Add number
$scrambleNumbers[$rand] = $rand;
- }
+ } // END - for
// So let's create the string for storing it in database
$scrambleString = implode(":", $scrambleNumbers);
@@ -2089,8 +2088,7 @@ function genScrambleString($len) {
}
// Append data like session ID referral ID to the given URL which would
// normally be stored in cookies
-function ADD_URL_DATA($URL)
-{
+function ADD_URL_DATA($URL) {
global $_CONFIG;
$ADD = "";
@@ -2119,7 +2117,7 @@ function ADD_URL_DATA($URL)
// Add current session
$ADD .= $BIND."PHPSESSID=".session_id();
}
- }
+ } // END - if
// Add all together and return it
return $URL.$ADD;
@@ -2175,8 +2173,8 @@ function FIX_DELETED_COOKIES ($cookies) {
if (get_session($cookieName) == "deleted") {
set_session($cookieName, "");
}
- }
- }
+ } // END - foreach
+ } // END - if
}
// Output error messages in a fasioned way and die...
@@ -2412,7 +2410,7 @@ function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) {
// If we have an array simply use it and pre-extend it with our value
if (is_array($extraValue)) {
// Make the new args array
- $args = array_merge(array($vaue), $extraValue);
+ $args = array_merge(array($value), $extraValue);
} // END - if
// Call the multi-parameter call-back
@@ -2431,6 +2429,36 @@ function FILE_READABLE($fqfn) {
// Check all...
return ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn)));
}
+// Converts timestamp selections into a timestamp
+function CONVERT_SELECTIONS_TO_TIMESTAMP(&$POST, &$DATA, &$id, &$skip) {
+ // Init test variable
+ $TEST2 = "";
+
+ // Get last three chars
+ $TEST = substr($id, -3);
+
+ // Improved way of checking! :-)
+ if (in_array($TEST, array("_ye", "_mo", "_we", "_da", "_ho", "_mi", "_se"))) {
+ // Found a multi-selection for timings?
+ $TEST = substr($id, 0, -3);
+ if ((isset($POST[$TEST."_ye"])) && (isset($POST[$TEST."_mo"])) && (isset($POST[$TEST."_we"])) && (isset($POST[$TEST."_da"])) && (isset($POST[$TEST."_ho"])) && (isset($POST[$TEST."_mi"])) && (isset($POST[$TEST."_se"])) && ($TEST != $TEST2)) {
+ // Generate timestamp
+ $POST[$TEST] = CREATE_TIMESTAMP_FROM_SELECTIONS($TEST, $POST);
+ $DATA[] = "$TEST='".$POST[$TEST]."'";
+
+ // Remove data from array
+ foreach (array("ye", "mo", "we", "da", "ho", "mi", "se") as $rem) {
+ unset($POST[$TEST."_".$rem]);
+ } // END - foreach
+
+ // Skip adding
+ unset($id); $skip = true; $TEST2 = $TEST;
+ } // END - if
+ } else {
+ // Process this entry
+ $skip = false; $TEST2 = "";
+ }
+}
//
//////////////////////////////////////////////////
// //
@@ -2445,7 +2473,7 @@ if (!function_exists('html_entity_decode')) {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
-}
+} // END - if
//
?>