]> git.mxchange.org Git - mailer.git/commitdiff
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 eb0ba63455b268642061309e2d03b24b16963fac..1f462bdfa4d466482e7c4ee4f97d7def49c7c545 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 dca70d03fe50b2ca9d46e46c7c542163bfaab3b6..122104458fe7ff4b1cd6f68fd2bc97b43d97130c 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 ef8c29fa9672373c42f9825beeecfbc2be4abb1e..547148947cb461456ef3a10108040a33e2befbef 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 488f774618eb4443aac58966d1877325b2ba1d41..65a55abe35eb088493d28ca503bc1360a87a02cd 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 ecf71dff0ff46533d98ed18032c5eeb581c29b9a..ce118a8891e10151f335fef9f3207ac6591b4989 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 e12ea8eb2bf3e6f304506421adc780f1180dc7c5..d5a2b824d8c93acf9c8c70b30c59766c6286035c 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 7d64dcb2413784b242f03bc793875104daf95a8b..2aedbdb8cf4a184929ffdf4ff3e81035af6b5c4e 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");