Way more usage of EL code:
[mailer.git] / inc / mysql-manager.php
index 4eb508c5c48c8660c90069531e7d8ab3ee3d269e..9be835047a6c6122fd088736e3a399a6f5a658c3 100644 (file)
@@ -98,13 +98,16 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
                // This is a 'what file'!
                $type = 'what';
                $search = substr($file, 5);
-               $ADD = " AND `visible`='Y' AND `locked`='N'";
 
                // Get access level from it
                $modCheck = getModuleFromFileName($file, $accessLevel);
 
                // Do we have admin? Then display all
-               if (isAdmin()) $ADD = '';
+               $ADD = " AND `visible`='Y' AND `locked`='N'";
+               if (isAdmin()) {
+                       // Display all!
+                       $ADD = '';
+               } // END - if
 
                $dummy = substr($search, 0, -4);
                $ADD .= sprintf(" AND `action`='%s'", getActionFromModuleWhat($accessLevel, $dummy));
@@ -260,7 +263,7 @@ ORDER BY
                                                $OUT .= '<a name="menu" class="menu_blur" href="{%url=modules.php?module=' . getModule() . '&amp;what=' . $content['sub_what'] . '%}" target="_self">';
                                        } else {
                                                // Not found - open
-                                               $OUT .= '<em style="cursor:help" class="notice" title="{%message,ADMIN_MENU_WHAT_404=' . $content['sub_what'] . '%}">';
+                                               $OUT .= '<em style="cursor:help" class="notice" title="{%message,ADMIN_MENU_WHAT_404_TITLE=' . $content['sub_what'] . '%}">';
                                        }
 
                                        // Menu title
@@ -1034,7 +1037,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
        if (!isset($GLOBALS['ref_level'])) {
                // Initialialize referal system
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ' Referal system initialized!');
-               $GLOBALS['ref_level'] = '0';
+               $GLOBALS['ref_level'] = NULL;
        } else {
                // Increase referal level
                $GLOBALS['ref_level']++;
@@ -1077,7 +1080,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                                        $pointsColumn,
                                        $ref_points,
                                        bigintval($userid),
-                                       bigintval($GLOBALS['ref_level'])
+                                       makeZeroToNull($GLOBALS['ref_level'])
                                ), __FUNCTION__, __LINE__);
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$addMode.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
 
@@ -1088,7 +1091,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                                        array(
                                                $pointsColumn,
                                                bigintval($userid),
-                                               bigintval($GLOBALS['ref_level']),
+                                               makeZeroToNull($GLOBALS['ref_level']),
                                                $ref_points
                                        ), __FUNCTION__, __LINE__);
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$addMode.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
@@ -1975,7 +1978,7 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
                                array(implode(',', $userids), count($userids)), __FUNCTION__, __LINE__);
                } else {
                        // Nothing deleted
-                       displayMessage(getMaskedMessage('ADMIN_MAIL_NOTHING_DELETED', $id));
+                       displayMessage('{%message,ADMIN_MAIL_NOTHING_DELETED=' . $id . '%}');
                }
        } // END - if
 
@@ -2014,9 +2017,9 @@ function updateLastActivity($userid) {
 // Get points data for given extension's name
 function getPointsDataArrayFromExtensionName ($ext_name) {
        // If we have cache, shortcut it here
-       if (isset($GLOBALS['cache_array']['points_data'])) {
+       if (isset($GLOBALS['cache_array']['points_data'][$ext_name])) {
                // Return it
-               return $GLOBALS['cache_array']['points_data'];
+               return $GLOBALS['cache_array']['points_data'][$ext_name];
        } // END - if
 
        // Now checkout the entry in database table
@@ -2030,21 +2033,21 @@ function getPointsDataArrayFromExtensionName ($ext_name) {
 
                // Add all remaining entries
                foreach ($pointsData as $key=>$value) {
-                       $GLOBALS['cache_array']['points_data'][$key][$ext_name][$isLocked] = $value;
+                       $GLOBALS['cache_array']['points_data'][$ext_name][$key] = $value;
                } // END - foreach
        } else {
                /*
                 * Having no entry is not bad but it means that all points will go to
                 * the general account which the user can let payout.
                 */
-               logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',isLocked=' . intval($isLocked) . ' - No entry found, switching to general points account.');
+               logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - No entry found, switching to general points account.');
        }
 
        // Free result
        SQL_FREERESULT($result);
 
        // Return it
-       return $GLOBALS['cache_array']['points_data'];
+       return $GLOBALS['cache_array']['points_data'][$ext_name];
 }
 
 // Determines the right points column name for given extension and 'locked'
@@ -2068,7 +2071,7 @@ function getPointsColumnNameFromExtensionNameLocked ($ext_name, $isLocked) {
        } // END - if
 
        // Return the result
-       return $columName;
+       return $columnName;
 }
 
 // Determines the payment method for given extension and 'locked'
@@ -2086,7 +2089,7 @@ function getPaymentMethodFromExtensionName ($ext_name) {
        $paymentMethod = $pointsData['payment_method'];
 
        // Return the result
-       return $columName;
+       return $paymentMethod;
 }
 
 // [EOF]