X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=010cad850080d80485c4f72b0e44db0ca4d2ecc9;hp=5acdb2688c6ffd4f175d0e48924813409cca7649;hb=f928ad2bed60fa256d0641eaf6d2c027a2944688;hpb=444470f309a050293341c95917beb89d60a394b9 diff --git a/inc/functions.php b/inc/functions.php index 5acdb2688c..010cad8500 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -238,7 +238,7 @@ 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(getUserId()), __FUNCTION__, __LINE__); // Is content an array? @@ -250,13 +250,13 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { $content['gender'] = translateGender($content['gender']); } else { // @DEPRECATED - // @TODO Fine all templates which are using these direct variables and rewrite them. + // @TODO Find all templates which are using these direct variables and rewrite them. // @TODO After this step is done, this else-block is history list($gender, $surname, $family, $email) = SQL_FETCHROW($result); // Translate gender $gender = translateGender($gender); - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("DEPRECATION-WARNING: content is not array (%s).", gettype($content))); + DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("DEPRECATION-WARNING: content is not array [%s], template=%s.", gettype($content), $template)); } // Free result @@ -347,8 +347,11 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { $ret = $tmpl_file; } - // Add surrounding HTML comments to help finding bugs faster - $ret = "\n" . $ret . "\n"; + // Normal HTML output? + if ($GLOBALS['output_mode'] == 0) { + // Add surrounding HTML comments to help finding bugs faster + $ret = "\n" . $ret . "\n"; + } // END - if } elseif ((IS_ADMIN()) || ((isInstalling()) && (!isInstalled()))) { // Only admins shall see this warning or when installation mode is active $ret = "
{--TEMPLATE_404--}
@@ -390,14 +393,16 @@ function sendEmail ($toEmail, $subject, $message, $HTML = 'N', $mailHeader = '') eval($eval); // Set from header - if ((!eregi("@", $toEmail)) && ($toEmail > 0)) { + if ((!eregi('@', $toEmail)) && ($toEmail > 0)) { // Value detected, is the message extension installed? - if (EXT_IS_ACTIVE("msg")) { + // @TODO Extension 'msg' does not exist + if (EXT_IS_ACTIVE('msg')) { ADD_MESSAGE_TO_BOX($toEmail, $subject, $message, $HTML); return; } else { // Load email address - $result_email = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($toEmail)), __FUNCTION__, __LINE__); + $result_email = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1", + array(bigintval($toEmail)), __FUNCTION__, __LINE__); //* DEBUG: */ print __FUNCTION__."(".__LINE__."):numRows=".SQL_NUMROWS($result_email)."
\n"; // Does the user exist? @@ -794,13 +799,13 @@ function LOAD_EMAIL_TEMPLATE ($template, $content = array(), $UID = '0') { if (EXT_IS_ACTIVE('nickname')) { //* DEBUG: */ print __FUNCTION__."(".__LINE__."):NICKNAME!
\n"; // Load nickname - $result = SQL_QUERY_ESC("SELECT surname, family, gender, email, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval($UID)), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `gender`, `email`, `nickname` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1", + array(bigintval($UID)), __FUNCTION__, __LINE__); } else { //* DEBUG: */ print __FUNCTION__."(".__LINE__."):NO-NICK!
\n"; /// Load normal data - $result = SQL_QUERY_ESC("SELECT surname, family, gender, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval($UID)), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `gender`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1", + array(bigintval($UID)), __FUNCTION__, __LINE__); } // Fetch and merge data @@ -917,7 +922,7 @@ function redirectToUrl ($URL) { } // END - if // Three different debug ways... - //* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); + /* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, $URL); //* DEBUG: */ die($URL); @@ -1240,7 +1245,7 @@ function generateRandomCode ($length, $code, $uid, $DATA = '') { $keys = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY'); if (isConfigEntrySet('secret_key')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key'); if (isConfigEntrySet('file_hash')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash'); - $keys .= getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))); + $keys .= getConfig('ENCRYPT_SEPERATOR') . date("d-m-Y (l-F-T)", getConfig('patch_ctime')); if (isConfigEntrySet('master_salt')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt'); // Build string from misc data @@ -1292,9 +1297,9 @@ function bigintval ($num, $castValue = true) { // Has the whole value changed? // @TODO Remove this if() block if all is working fine - if ("" . $ret."" != '' . $num."") { + if ('' . $ret . '' != '' . $num . '') { // Log the values - debug_report_bug("{$ret}<>{$num}"); + //debug_report_bug("{$ret}<>{$num}"); } // END - if // Return result @@ -1418,7 +1423,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = $OUT .= "
{--_YEARS--}\n"; } - if (ereg("M", $display) || (empty($display))) { + if (ereg('M', $display) || (empty($display))) { $OUT .= "
{--_MONTHS--}\n"; } @@ -1458,7 +1463,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = $OUT .= "\n"; } - if (ereg("M", $display) || (empty($display))) { + if (ereg('M', $display) || (empty($display))) { // Generate month selection $OUT .= "