X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=4b9ee0e0138ad015586eaf8baec4091bb696f930;hp=143048b6de4a766f7c5bb710b7ffc09f0f8f181e;hb=0851db137e420b90617f47b77de2302e770f5f02;hpb=20cff9828debc7f67cda7d4c32a0314aae26b793 diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 143048b6de..4b9ee0e013 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(); @@ -428,6 +428,12 @@ function isMember () { // Fetch user data for given user id function fetchUserData ($value, $column = 'userid') { + // Extension ext-user must be there at any case + if (!isExtensionActive('user')) { + // Absent ext-user is really not good + return false; + } // END - if + // If we should look for userid secure&set it here if (substr($column, -2, 2) == 'id') { // Secure userid @@ -444,8 +450,8 @@ function fetchUserData ($value, $column = 'userid') { // Use cache, so it is fine return true; } - } elseif (isUserDataValid()) { - // Use cache, so it is fine + } elseif (isUserDataValid()) { + // Using cache is fine return true; } @@ -630,18 +636,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 +674,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 +758,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)) { @@ -839,7 +848,7 @@ function getPaymentTitlePrice ($pid, $full=false) { // Get (basicly) the price of given payment id function getPaymentPoints ($pid, $lookFor = 'price') { // Default value... - $data[$lookFor] = '-1'; + $data[$lookFor] = -1; // Search for it in database $result = SQL_QUERY_ESC("SELECT `%s` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1", @@ -996,7 +1005,7 @@ function getReferalLevelPercents ($level) { /** * - * Dynamic referal system, can also send mails! + * Dynamic referal and points system, can also send mails! * * subject = Subject line, write in lower-case letters and underscore is allowed * userid = Referal id wich should receive... @@ -1004,105 +1013,112 @@ 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', $add_mode = 'ref') { +function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $addMode = 'REFERAL') { // By default nothing has been added $added = false; //* DEBUG: */ debugOutput('----------------------- ' . __FUNCTION__ . ' - ENTRY ------------------------