X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=c59093bd5004e57c7190a10929cc6e1c0099dc23;hb=9b27fd714bd5db5ca84ec1bd019c7614441f504b;hp=df26e508c0730adf8d2c8e126598453a39ce78e5;hpb=df4543d96d8b13dd770c34f7c84fdfa1786a4595;p=mailer.git
diff --git a/inc/functions.php b/inc/functions.php
index df26e508c0..c59093bd50 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -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
@@ -1636,8 +1646,10 @@ function ADD_EMAIL_NAV($PAGES, $offset, $show_form, $colspan, $return=false) {
//
function MXCHANGE_OPEN ($script) {
+ //* DEBUG */ print("SCRIPT=".$script."
\n");
// Compile the script name
$script = COMPILE_CODE($script);
+ //* DEBUG */ print("SCRIPT=".$script."
\n");
// Use default SERVER_URL by default... ;) So?
$url = SERVER_URL;
@@ -1654,10 +1666,20 @@ function MXCHANGE_OPEN ($script) {
if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
// Generate relative URL
- $script = substr($script, (strlen($url) + 7));
+ //* DEBUG */ print("SCRIPT=".$script."
\n");
+ if (substr(strtolower($script), 0, 7) == "http://") {
+ // But only if http:// is in front!
+ $script = substr($script, (strlen($url) + 7));
+ } elseif (substr(strtolower($script), 0, 8) == "https://") {
+ // Does this work?!
+ $script = substr($script, (strlen($url) + 8));
+ }
+
+ //* DEBUG */ print("SCRIPT=".$script."
\n");
if (substr($script, 0, 1) == "/") $script = substr($script, 1);
// Open connection
+ //* DEBUG */ die("SCRIPT=".$script."
\n");
$fp = @fsockopen($host, 80, $errno, $errdesc, 30);
if (!$fp) {
// Failed!
@@ -1780,7 +1802,7 @@ function CREATE_EMAIL_LINK($email, $table="admins") {
if ((EXT_IS_ACTIVE("admins")) && ($table == "admins")) {
// Create email link for contacting admin in guest area
$EMAIL = ADMINS_CREATE_EMAIL_LINK($email);
- } elseif ((GET_EXT_VERSION("user") >= "0.3.3") && ($table == "user_data")) {
+ } elseif ((EXT_IS_ACTIVE("user", true)) && (GET_EXT_VERSION("user") >= "0.3.3") && ($table == "user_data")) {
// Create email link for contacting a member within admin area (or later in other areas, too?)
$EMAIL = USER_CREATE_EMAIL_LINK($email);
} elseif ((EXT_IS_ACTIVE("sponsor")) && ($table == "sponsor_data")) {
@@ -1795,13 +1817,13 @@ function CREATE_EMAIL_LINK($email, $table="admins") {
return $EMAIL;
}
// Generate a hash for extra-security for all passwords
-function generateHash($plainText, $salt = "") {
+function generateHash ($plainText, $salt = "") {
global $_CONFIG, $_SERVER;
// 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
@@ -1987,6 +2009,11 @@ function generatePassString($passHash) {
//* DEBUG: */ die($passHash."
".$newHash." (".strlen($newHash).")");
$ret = generateHash($newHash, $_CONFIG['master_salt']);
+ } else {
+ // Hash it simple
+ //* DEBUG: */ echo "--".$passHash."--
\n";
+ $ret = md5($passHash);
+ //* DEBUG: */ echo "++".$ret."++
\n";
}
// Return result
@@ -2051,7 +2078,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 +2106,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);
}