From: Roland Häder Date: Mon, 8 Mar 2010 11:32:18 +0000 (+0000) Subject: Code moved because it depends on tables created by ext-user X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=74ea26a36ff202cfdca545025a17c9faf4d68efb Code moved because it depends on tables created by ext-user --- diff --git a/inc/functions.php b/inc/functions.php index eb0ba63455..1f462bdfa4 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -496,7 +496,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { $GLOBALS['tpl_content'] = readFromFile($FQFN); // Run code - $GLOBALS['tpl_content'] = "\$newContent = decodeEntities(\"".compileRawCode(escapeQuotes($GLOBALS['tpl_content']))."\");"; + $GLOBALS['tpl_content'] = '$newContent = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'])) . '");'; eval($GLOBALS['tpl_content']); } elseif (!empty($template)) { // Template file not found! @@ -3931,6 +3931,21 @@ function searchDirsRecursive ($dir, &$last_changed, $lookFor = 'Date') { } // END - foreach } +// "Fixes" null or empty string to count of dashes +function fixNullEmptyToDashes ($str, $num) { + // Use str as default + $return = $str; + + // Is it empty? + if ((is_null($str)) || (trim($str) == '')) { + // Set it + $return = str_repeat('-', $num); + } // END - if + + // Return final string + return $return; +} + ////////////////////////////////////////////////// // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // ////////////////////////////////////////////////// diff --git a/inc/language/de.php b/inc/language/de.php index dca70d03fe..122104458f 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1153,7 +1153,9 @@ addMessages(array( 'MEMBER_REFLINKS_FOOTER' => "Ihr Referal-Link eingebaut in Ihrer Homepage bringt Ihnen passiv mehr Referals. (Aber Ihren Referal-Link bewerben schadet auch nicht... ;-) )", 'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail %s bestätigt.", + 'MEMBER_MAIL_BONUS_CONFIRMED_UNKNOWN' => "Es konnte nicht festgestellt werden, wann Sie die Bonus-Mail %s bestätigt hatten.", 'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail %s bestätigt.", + 'MEMBER_MAIL_NORMAL_CONFIRMED_UNKNOWN' => "Es konnte nicht festgestellt werden, wann Sie die Klickmail %s bestätigt hatten.", // @TODO Rewrite these two constants 'MEMBER_MAIL_NORMAL_DETAILS_TITLE_1' => "Details zur Klickmail ", diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index ef8c29fa96..547148947c 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -464,5 +464,70 @@ function doNewUserPassword ($email, $userid) { return $errorCode; } +// Get timestamp for given stats type and data +function getTimestampFromUserStats ($statsType, $statsData, $userid = '0') { + // Default timestamp is zero + $data['inserted'] = '0'; + + // User id set? + if ((isMemberIdSet()) && ($userid == '0')) { + $userid = getMemberId(); + } // END - if + + // Is the extension installed and updated? + if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + // Return zero here + return $data['inserted']; + } // END - if + + // Try to find the entry + $result = SQL_QUERY_ESC("SELECT + UNIX_TIMESTAMP(`inserted`) AS inserted +FROM + `{?_MYSQL_PREFIX?}_user_stats_data` +WHERE + `userid`=%s AND + `stats_type`='%s' AND + `stats_data`='%s' +LIMIT 1", + array( + bigintval($userid), + $statsType, + $statsData + ), __FUNCTION__, __LINE__); + + // Is the entry there? + if (SQL_NUMROWS($result) == 1) { + // Get this stamp + $data = SQL_FETCHARRAY($result); + } // END - if + + // Free result + SQL_FREERESULT($result); + + // Return stamp + return $data['inserted']; +} + +// Inserts user stats +function insertUserStatsRecord ($userid, $statsType, $statsData) { + // Is the extension installed and updated? + if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + // Return zero here + return false; + } // END - if + + // Does it exist? + if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { + // Then insert it! + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')", + array(bigintval($userid), $statsType, $statsData), __FUNCTION__, __LINE__); + } elseif (is_array($statsData)) { + // Invalid data! + logDebugMessage(__FUNCTION__, __LINE__, "userid={$userid},type={$statsType},data={".gettype($statsData).": Invalid statistics data type!"); + } +} + // [EOF] ?> + diff --git a/inc/modules/admin/what-list_network_params.php b/inc/modules/admin/what-list_network_params.php index 488f774618..65a55abe35 100644 --- a/inc/modules/admin/what-list_network_params.php +++ b/inc/modules/admin/what-list_network_params.php @@ -112,10 +112,7 @@ ORDER BY } // END - if // Is default value empty or null? - if ((is_null($row['request_param_default'])) || (trim($row['request_param_default']) == '')) { - // Fix it to three dashes - $row['request_param_default'] = '---'; - } // END - if + $row['request_param_default'] = fixNullEmptyToDashes($row['request_param_default'], 3); // Add row template and switch color $OUT .= loadTemplate('admin_list_network_params_row', true, $row); diff --git a/inc/modules/admin/what-list_network_types.php b/inc/modules/admin/what-list_network_types.php index ecf71dff0f..ce118a8891 100644 --- a/inc/modules/admin/what-list_network_types.php +++ b/inc/modules/admin/what-list_network_types.php @@ -89,7 +89,7 @@ ORDER BY while ($row = SQL_FETCHARRAY($result)) { // Add/translate some data $row['sw'] = $SW; - if (trim($row['network_type_banner_url']) == '') $row['network_type_banner_url'] = '---'; + $row['network_type_banner_url'] = fixNullEmptyToDashes($row['network_type_banner_url'], 3); // Set disabled entry $networkData['disabled'][$row['network_type_handle']] = true; diff --git a/inc/modules/member/what-unconfirmed.php b/inc/modules/member/what-unconfirmed.php index e12ea8eb2b..d5a2b824d8 100644 --- a/inc/modules/member/what-unconfirmed.php +++ b/inc/modules/member/what-unconfirmed.php @@ -63,18 +63,22 @@ LIMIT 1", $content = SQL_FETCHARRAY($result_data); // Translate some data - $content['timestamp'] = generateDateTime($content['timestamp'], 2); - $content['category'] = getCategory($content['cat_id']); - $content['points'] = translateComma($content['points']); - $content['is_notify'] = translateYesNo($content['is_notify']); - $content['sender'] = getMessage('USERNAME_ADMIN_SHORT'); - $content['time'] = createFancyTime($content['time']); - $content['userid'] = getMemberId(); - - // Get timestamp from insert - $content['user_status'] = getMaskedMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON', - generateDateTime(getTimestampFromUserStats('bonusid', $content['id']), 2) - ); + $content['timestamp'] = generateDateTime($content['timestamp'], 2); + $content['category'] = getCategory($content['cat_id']); + $content['points'] = translateComma($content['points']); + $content['is_notify'] = translateYesNo($content['is_notify']); + $content['sender'] = getMessage('USERNAME_ADMIN_SHORT'); + $content['time'] = createFancyTime($content['time']); + $content['userid'] = getMemberId(); + $content['user_status'] = getMaskedMessage('MEMBER_MAIL_BONUS_CONFIRMED_UNKNOWN', $content['id']); + + // Is ext-user installed? + if (isExtensionInstalled('user')) { + // Get timestamp from insert + $content['user_status'] = getMaskedMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON', + generateDateTime(getTimestampFromUserStats('bonusid', $content['id']), 2) + ); + } // END - if // Display it depending on mail (data) type loadTemplate('member_mail_bonus_'.strtolower($content['data_type']), false, $content); @@ -109,11 +113,15 @@ LIMIT 1", $content['points'] = translateComma($content['points']); $content['time'] = createFancyTime($content['time']); $content['userid'] = getMemberId(); - - // Get timestamp from insert - $content['user_status'] = getMaskedMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON', - generateDateTime(getTimestampFromUserStats('mailid', $content['id']), 2) - ); + $content['user_status'] = getMaskedMessage('MEMBER_MAIL_NORMAL_CONFIRMED_UNKNOWN', $content['id']); + + // Is ext-user installed? + if (isExtensionInstalled('user')) { + // Get timestamp from insert + $content['user_status'] = getMaskedMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON', + generateDateTime(getTimestampFromUserStats('mailid', $content['id']), 2) + ); + } // END - if // Display it depending on mail (data) type loadTemplate('member_mail_normal_'.strtolower($content['data_type']), false, $content); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 7d64dcb241..2aedbdb8cf 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1959,70 +1959,6 @@ function generateReceiverList ($cat, $receiver, $mode = '') { return $receiverList; } -// Get timestamp for given stats type and data -function getTimestampFromUserStats ($statsType, $statsData, $userid = '0') { - // Default timestamp is zero - $data['inserted'] = '0'; - - // User id set? - if ((isMemberIdSet()) && ($userid == '0')) { - $userid = getMemberId(); - } // END - if - - // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { - // Return zero here - return $data['inserted']; - } // END - if - - // Try to find the entry - $result = SQL_QUERY_ESC("SELECT - UNIX_TIMESTAMP(`inserted`) AS inserted -FROM - `{?_MYSQL_PREFIX?}_user_stats_data` -WHERE - `userid`=%s AND - `stats_type`='%s' AND - `stats_data`='%s' -LIMIT 1", - array( - bigintval($userid), - $statsType, - $statsData - ), __FUNCTION__, __LINE__); - - // Is the entry there? - if (SQL_NUMROWS($result) == 1) { - // Get this stamp - $data = SQL_FETCHARRAY($result); - } // END - if - - // Free result - SQL_FREERESULT($result); - - // Return stamp - return $data['inserted']; -} - -// Inserts user stats -function insertUserStatsRecord ($userid, $statsType, $statsData) { - // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { - // Return zero here - return false; - } // END - if - - // Does it exist? - if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { - // Then insert it! - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')", - array(bigintval($userid), $statsType, $statsData), __FUNCTION__, __LINE__); - } elseif (is_array($statsData)) { - // Invalid data! - logDebugMessage(__FUNCTION__, __LINE__, "userid={$userid},type={$statsType},data={".gettype($statsData).": Invalid statistics data type!"); - } -} - // "Getter" for array for user refs and points in given level function getUserReferalPoints ($userid, $level) { //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ------------------------