X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=aecb0317be43d219a26733d02766037d63177a2a;hp=dfea280de9436ed474f8bfcfaf3ad5dec72d67da;hb=9b8fe454a575a1f000b00bc7ca37eaad6d59d21a;hpb=ec9f020e34a9f2029a2ea0969564dda015beca8a diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index dfea280de9..aecb0317be 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -108,8 +108,8 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) { $dummy = substr($search, 0, -4); $ADD .= sprintf(" AND `action`='%s'", getActionFromModuleWhat($accessLevel, $dummy)); - } elseif (($accessLevel == 'sponsor') || ($accessLevel == 'engine')) { - // Sponsor / engine menu + } elseif ($accessLevel == 'sponsor') { + // Sponsor menu $type = 'what'; $search = $file; $modCheck = getModule(); @@ -444,8 +444,11 @@ function fetchUserData ($value, $column = 'userid') { // Use cache, so it is fine return true; } - } elseif (isUserDataValid()) { - // Use cache, so it is fine + } elseif (!isExtensionActive('user')) { + // Absent ext-user is really not good + return false; + } elseif (isUserDataValid()) { + // Using cache is fine return true; } @@ -630,18 +633,21 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { // Checks wether the given email address is used. function isEmailTaken ($email) { + // Replace dot with {DOT} + $email = str_replace('.', '{DOT}', $email); + // Query the database - $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `email` LIKE '%%%s%%' OR `email` LIKE '%%%s%%' LIMIT 1", - array($email, str_replace('.', '{DOT}', $email)), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `email` LIKE '%%%s%%' LIMIT 1", + array($email), __FUNCTION__, __LINE__); // Is the email there? - $ret = (SQL_NUMROWS($result) == 1); + $isTaken = (SQL_NUMROWS($result) == 1); // Free the result SQL_FREERESULT($result); // Return result - return $ret; + return $isTaken; } // Validate the given menu action @@ -665,7 +671,7 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) { //* DEBUG: */ debugOutput(__LINE__ . ':' . $mode . '/' . $action . '/' . $what . '*'); if (($mode != 'admin') && ($updateEntry === true)) { // Update guest or member menu - $sql = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1", + $sql = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `counter`=`counter`+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1", array( $mode, $action, @@ -749,7 +755,7 @@ function getActionFromModuleWhat ($module, $what) { // Get it directly from URL return getAction(); } - //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '): ret=' . $data['action']); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ' ret=' . $data['action']); // Does the module have a menu? if (ifModuleHasMenu($module)) { @@ -1004,16 +1010,16 @@ function getReferalLevelPercents ($level) { * sendNotify = shall I send the referal an email or not? * refid = inc/modules/guest/what-confirm.php need this * locked = Shall I pay it to normal (false) or locked (true) points ammount? - * add_mode = Add points only to $userid or also refs? (WARNING! Changing 'ref' to 'direct' + * add_mode = Add points only to $userid or also refs? (WARNING! Changing 'REFERAL' to 'DIRECT' * for default value will cause no referal will get points ever!!!) */ -function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $addMode = 'ref') { +function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $addMode = 'REFERAL') { // By default nothing has been added $added = false; //* DEBUG: */ debugOutput('----------------------- ' . __FUNCTION__ . ' - ENTRY ------------------------