]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Added debug line
[mailer.git] / inc / mysql-manager.php
index 625598d66e02d782deb982ea8f7e4dc04783304a..e9d5c40fcdeef682d87e01f66bb7b9d2a536fb94 100644 (file)
@@ -160,13 +160,15 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
                $search = substr($search, 0, -4);
        } // END - if
 
+       // Is ext-sql_patches installed?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isExtensionInstalledAndNewer()=' . intval(isExtensionInstalledAndNewer('sql_patches', '0.2.3')) . ',youre_here=' . getConfig('youre_here') . ',isAdmin()=' . intval(isAdmin()) . ',modCheck=' . $modCheck);
        if (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) {
                // Output HTML code
                $OUT = $prefix . '<strong><a class="you_are_here" href="{%url=modules.php?module=' . $modCheck . '&amp;' . $type . '=' . $search . $LINK_ADD . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
 
                // Can we close the you-are-here navigation?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . 'getWhat()=' . getWhat());
-               if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'welcome')))) {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',getWhat()=' . getWhat() . ',isWhatSet()=' . intval(isWhatSet()));
+               if (($type == 'what') || (($type == 'action') && (!isWhatSet()))) {
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type);
                        // Add closing div and br-tag
                        $GLOBALS['nav_depth'] = '0';
@@ -464,9 +466,6 @@ function fetchUserData ($value, $column = 'userid') {
                // Secure userid
                $value = bigintval($value);
 
-               // Set it here
-               setCurrentUserId($value);
-
                // Don't look for invalid userids...
                if (!isValidUserId($value)) {
                        // Invalid, so abort here
@@ -870,12 +869,12 @@ function getCategory ($cid) {
 }
 
 // Get a string of "mail title" and price back
-function getPaymentTitlePrice ($pid, $full = false) {
+function getPaymentTitlePrice ($paymentsId, $full = false) {
        // Only title or also including price?
        if ($full === false) {
-               $ret = getPaymentData($pid, 'main_title');
+               $ret = getPaymentData($paymentsId, 'main_title');
        } else {
-               $ret = getPaymentData($pid, 'main_title') . ' / {%pipe,getPaymentData,translateComma=' . $pid . '%} {?POINTS?}';
+               $ret = getPaymentData($paymentsId, 'main_title') . ' / {%pipe,getPaymentData,translateComma=' . $paymentsId . '%} {?POINTS?}';
        }
 
        // Return result
@@ -883,15 +882,14 @@ function getPaymentTitlePrice ($pid, $full = false) {
 }
 
 // "Getter" for payment data (cached)
-function getPaymentData ($pid, $lookFor = 'price') {
+function getPaymentData ($paymentsId, $lookFor = 'price') {
        // Default value...
        $data[$lookFor] = NULL;
 
        // Do we have cache?
-       if (isset($GLOBALS['cache_array']['payments']['id'][$pid])) {
+       if (isset($GLOBALS['cache_array']['payments'][$paymentsId]['id'])) {
                // Use it if found to save SQL queries
-               die('<pre>'.print_r($GLOBALS['cache_array']['payments'],true).'</pre>');
-               $data[$lookFor] = $GLOBALS['cache_array']['payments'][$lookFor][$pid];
+               $data[$lookFor] = $GLOBALS['cache_array']['payments'][$lookFor][$paymentsId];
 
                // Update cache hits
                incrementStatsEntry('cache_hits');
@@ -900,7 +898,7 @@ function getPaymentData ($pid, $lookFor = 'price') {
                $result = SQL_QUERY_ESC('SELECT `%s` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1',
                        array(
                                $lookFor,
-                               bigintval($pid)
+                               bigintval($paymentsId)
                        ), __FUNCTION__, __LINE__);
 
                // Is the entry there?
@@ -1795,14 +1793,20 @@ function registerExtensionPointsData ($subject, $columnName, $lockedMode, $payme
        $add = '';
 
        // Is the extension equal or newer 0.8.9?
-       if ((getExtensionMode() == 'register') || (getExtensionMode() == 'update') || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
+       if (((isInstallationPhase()) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
                // Then add provider
                $add = " AND `account_provider`='EXTENSION'";
        } // END - if
 
        // Is the 'subject' there?
        if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
-               // Not found so add an SQL query
+               // Not found so:
+               if (isset($GLOBALS['previous_extension'][getCurrentExtensionName()])) {
+                       $dummy = $GLOBALS['previous_extension'][getCurrentExtensionName()];
+                       reportBug(__FUNCTION__, __LINE__, 'previous_extension[' . gettype($dummy) . ']=' . $dummy . ',getCurrentExtensionName()=' . getCurrentExtensionName() . ' - Under development, please report this!');
+               } // END - if
+
+               // ... add an SQL query
                addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
                        $subject,
                        $columnName,