X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=67a149808f6a231ce91a6d12910edd2bc2bf5900;hp=66324337f68d134e09d79940aba79f6620e04568;hb=4bbd0f6ac8e11a702e000ffdfbd868a4e8a06ba3;hpb=0b0f1ec06f8dda4617f231a208ee30204e041e07
diff --git a/inc/functions.php b/inc/functions.php
index 66324337f6..67a149808f 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -38,7 +38,7 @@ if (!defined('__SECURITY')) {
}
// Check if our config file is writeable or not
-function is_INCWritable($inc) {
+function IS_INC_WRITEABLE($inc) {
// Generate FQFN
$fqfn = sprintf("%sinc/%s.php", PATH, $inc);
@@ -233,8 +233,16 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
$template = strtolower($template);
// Count the template load
- if (!isset($_CONFIG['num_templates'])) $_CONFIG['num_templates'] = 0;
- $_CONFIG['num_templates']++;
+ if (getConfig('num_templates') == null) {
+ $_CONFIG['num_templates'] = 1;
+ } else {
+ $_CONFIG['num_templates']++;
+ }
+
+ // Prepare IP number and User Agent
+ $REMOTE_ADDR = GET_REMOTE_ADDR();
+ if (!defined('REMOTE_ADDR')) define('REMOTE_ADDR', $REMOTE_ADDR);
+ $HTTP_USER_AGENT = GET_USER_AGENT();
// Init some data
$ret = "";
@@ -243,13 +251,13 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
// @DEPRECATED Try to rewrite the if() condition
if ($template == "member_support_form") {
// Support request of a member
- $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1",
array($GLOBALS['userid']), __FILE__, __LINE__);
// Is content an array?
if (is_array($content)) {
// Merge data
- $content = array_merge($content, SQL_FETCHARRAY($result));
+ $content = merge_array($content, SQL_FETCHARRAY($result));
// Translate gender
$content['gender'] = TRANSLATE_GENDER($content['gender']);
@@ -334,7 +342,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
$tmpl_file = implode("", file($file));
// Replace ' to our own chars to preventing them being quoted
- while (strpos($tmpl_file, "\'") !== false) { $tmpl_file = str_replace("\'", '{QUOT}', $tmpl_file); }
+ while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); }
// Do we have to compile the code?
$ret = "";
@@ -397,7 +405,7 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML = "N", $FROM = "") {
return;
} else {
// Load email address
- $result_email = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($TO)), __FILE__, __LINE__);
+ $result_email = SQL_QUERY_ESC("SELECT email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array(bigintval($TO)), __FILE__, __LINE__);
//* DEBUG: */ print __FUNCTION__."(".__LINE__."):numRows=".SQL_NUMROWS($result_email)."
\n";
// Does the user exist?
@@ -450,15 +458,12 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML = "N", $FROM = "") {
if (empty($HTML)) $HTML = "N";
if (isBooleanConstantAndTrue('DEBUG_MODE')) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
- echo "