Code moved because it depends on tables created by ext-user
authorRoland Häder <roland@mxchange.org>
Mon, 8 Mar 2010 11:32:18 +0000 (11:32 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 8 Mar 2010 11:32:18 +0000 (11:32 +0000)
inc/functions.php
inc/language/de.php
inc/libs/user_functions.php
inc/modules/admin/what-list_network_params.php
inc/modules/admin/what-list_network_types.php
inc/modules/member/what-unconfirmed.php
inc/mysql-manager.php

index eb0ba63..1f462bd 100644 (file)
@@ -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 //
 //////////////////////////////////////////////////
index dca70d0..1221044 100644 (file)
@@ -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 <span class=\"data\">%s</span> best&auml;tigt.",
+       'MEMBER_MAIL_BONUS_CONFIRMED_UNKNOWN' => "Es konnte nicht festgestellt werden, wann Sie die Bonus-Mail <span class=\"data\">%s</span> best&auml;tigt hatten.",
        'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;tigt.",
+       'MEMBER_MAIL_NORMAL_CONFIRMED_UNKNOWN' => "Es konnte nicht festgestellt werden, wann Sie die Klickmail <span class=\"data\">%s</span> best&auml;tigt hatten.",
 
 // @TODO Rewrite these two constants
        'MEMBER_MAIL_NORMAL_DETAILS_TITLE_1' => "Details zur Klickmail <u>",
index ef8c29f..5471489 100644 (file)
@@ -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]
 ?>
+
index 488f774..65a55ab 100644 (file)
@@ -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);
index ecf71df..ce118a8 100644 (file)
@@ -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;
index e12ea8e..d5a2b82 100644 (file)
@@ -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);
index 7d64dcb..2aedbdb 100644 (file)
@@ -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("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");