]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Fix for missing array elements
[mailer.git] / inc / mysql-manager.php
index 9033db1373b0ca4845d2d5e6bae392156d68022f..bbdcca05698b6076788dc5eff690843f5dda1b09 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -79,7 +80,7 @@ function getModuleTitle ($module) {
        if (empty($data['title'])) {
                // No name found
                $data['title'] = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $module);
-               if (SQL_NUMROWS($result) == '0') {
+               if ((is_resource($result)) && (SQL_HASZERONUMS($result))) {
                        // Add module to database
                        $dummy = checkModulePermissions($module);
                } // END - if
@@ -701,6 +702,11 @@ function fetchUserData ($userid, $column = 'userid') {
 
 // This patched function will reduce many SELECT queries for the specified or current admin login
 function isAdmin ($adminLogin = '') {
+       // No admin in installation phase!
+       if (isInstallationPhase()) {
+               return false;
+       } // END - if
+
        // Init variables
        $ret = false;
        $passCookie = '';
@@ -1043,7 +1049,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $
                                array($rowName, $stats_id, bigintval($userid), $type), __FUNCTION__, __LINE__);
 
                        // Was it *not* found?
-                       if (SQL_NUMROWS($result) == '0') {
+                       if (SQL_HASZERONUMS($result)) {
                                // So we add one!
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_links` (`%s`, `userid`, `link_type`) VALUES ('%s','%s','%s')",
                                        array($rowName, $stats_id, bigintval($userid), $type), __FUNCTION__, __LINE__);
@@ -1920,7 +1926,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
        } // END - if
 
        // Exclude users in holiday?
-       if (getExtensionVersion('holiday') >= '0.1.3') {
+       if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                // Add something for the holiday extension
                $CAT_WHERE .= " AND d.`holiday_active`='N'";
        } // END - if
@@ -1958,70 +1964,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");