X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Frallye_functions.php;h=ae706217491ef433e3b25e4ae2d24d537d6bedc2;hb=77f1fa8cd38db6a89be86c51b9aef70915457ed8;hp=d88550529135925a0f2b1c34c20220e7978217d1;hpb=63f159414369b5ea19a8ca75d8cd8033c45d8341;p=mailer.git diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index d885505291..ae70621749 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -74,7 +74,7 @@ ORDER BY // Merge both arrays $content = merge_array($content, $row); - $un = false; + $un = FALSE; // Get refs by userid $count = getReferralRallyeRefsCount($content['userid']); @@ -91,7 +91,7 @@ WHERE LIMIT 1", array(bigintval($content['id']), bigintval($content['userid'])), __FUNCTION__, __LINE__); - // Do we have an entry? + // Is there an entry? if (SQL_HASZERONUMS($result_ref)) { // Add userid and his ref count to table $result_ref = SQL_QUERY_ESC("SELECT @@ -140,7 +140,7 @@ WHERE bigintval($count), $cpoints ), __FUNCTION__, __LINE__); - $un = true; + $un = TRUE; } // END - if // Free memory @@ -150,7 +150,7 @@ WHERE $content['refs'] = $count; // Shall I notify this member? - if (($content['send_notify'] == 'Y') && ($un === true)) { + if (($content['send_notify'] == 'Y') && ($un === TRUE)) { // Load email template and send it to the user $message = loadEmailTemplate('member_rallye_notify', $content, $content['userid']); sendEmail($content['userid'], '{%message,MEMBER_RALLYE_NOTIFY_SUBJECT=' . $content['title'] . '%}', $message); @@ -174,7 +174,7 @@ WHERE function addReferralRallyePrices ($rallye, $mode = 'email') { // Output mode switch($mode) { - case 'email': $mode = chr(10); break; + case 'email': $mode = PHP_EOL; break; case 'html' : $mode = '
'; break; } // END - switch @@ -195,7 +195,7 @@ ORDER BY if (!SQL_HASZERONUMS($result_prices)) { // Load prices $prices = ''; - if ($mode == chr(10)) { + if ($mode == PHP_EOL) { $prices = '{--RALLYE_MEMBER_PRICES_ADDED--}:' . $mode . '------------------------------' . $mode; } // END - if @@ -217,7 +217,7 @@ ORDER BY } // Add last line for email mode - if ($mode == chr(10)) { + if ($mode == PHP_EOL) { $prices .= '------------------------------'; } // END - if @@ -324,7 +324,7 @@ LIMIT 1", SQL_FREERESULT($result); // Sort whole array - array_pk_sort($content, array('cpoints', 'ref'), 0, 1, true); + array_pk_sort($content, array('cpoints', 'ref'), 0, 1, TRUE); // Generate table $OUT = ''; @@ -346,7 +346,7 @@ LIMIT 1", ); // Load row template and switch color - $OUT .= loadTemplate($mode . '_list_rallye_row', true, $row); + $OUT .= loadTemplate($mode . '_list_rallye_row', TRUE, $row); } // END - for // Add min_prices/users @@ -355,7 +355,7 @@ LIMIT 1", $content['min_users'] = bigintval($min_users); // And finnally return the output - return loadTemplate($mode . '_list_rallye', true, $content); + return loadTemplate($mode . '_list_rallye', TRUE, $content); } // Sends out a notification about the rallye @@ -378,7 +378,7 @@ function addUserToReferralRallye ($userid, $content = array()) { // Updated extension? if (isExtensionInstalledAndNewer('rallye', '0.2.0')) { - $add .= ',`min_users`,`min_prices`'; + $add .= ',`min_users`, `min_prices`'; } // END - if // Check for an auto-add rallye @@ -466,11 +466,11 @@ function getTotalRallyeWinners ($rallyeId) { // "Walk" through all entries foreach ($prices['userid'] as $key => $userid) { // Check for userid - $active = countSumTotalData($userid, 'user_data', 'userid', 'userid', true, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); + $active = countSumTotalData($userid, 'user_data', 'userid', 'userid', TRUE, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); // Allow valid and active users with at least one ref //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'rallyeId=' . $rallyeId . ',userid=' . $userid . ',ref=' . $prices['ref'][$key] . ',cpoints=' . $prices['cpoints'][$key]); - if ((isValidUserId($userid)) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) { + if ((isValidId($userid)) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) { $GLOBALS[__FUNCTION__][$rallyeId]++; } // END - if } // END - foreach @@ -506,12 +506,12 @@ function stopRallyeByResult ($result) { * active = 1: account is still confirmed * active = 0: account is deleted or locked */ - $active = countSumTotalData($userid, 'user_data', 'userid', 'userid', true, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); + $active = countSumTotalData($userid, 'user_data', 'userid', 'userid', TRUE, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); $prices['active'][$key] = $active; // Allow valid and active users with at least one ref to get points - if ((isValidUserId($userid)) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) { + if ((isValidId($userid)) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) { $total++; } // END - if } // END - foreach @@ -529,7 +529,7 @@ function stopRallyeByResult ($result) { // Run array through (by userid is the most important 2nd-level-array) foreach ($prices['userid'] as $key => $userid) { // Allow valid and active users with at least one ref to get points - if ((isValidUserId($userid)) && ($prices['ref'][$key] > 0) && ($prices['active'][$key] == 1) && ($prices['cpoints'][$key] > 0)) { + if ((isValidId($userid)) && ($prices['ref'][$key] > 0) && ($prices['active'][$key] == 1) && ($prices['cpoints'][$key] > 0)) { // Transfer data to array for the mail template $content['level'] = $prices['level'][$key]; $content['points'] = $prices['points'][$key]; @@ -610,7 +610,7 @@ function getReferralRallyeUserDataFromArray ($userIds) { // Load users $result = SQL_QUERY_ESC("SELECT - `userid`,`gender`,`surname`,`family`,`email` + `userid`, `gender`, `surname`, `family`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE @@ -650,7 +650,9 @@ function getArrayFromReferralRallyePrices ($rallye) { // Load prices $result = SQL_QUERY_ESC("SELECT - `price_level`,`points`,`info` + `price_level`, + `points`, + `info` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE @@ -747,7 +749,7 @@ LIMIT 1", SQL_FREERESULT($result_user); // Sort array for refs (descending) - array_pk_sort($users, array('cpoints', 'ref'), 0, 1, true); + array_pk_sort($users, array('cpoints', 'ref'), 0, 1, TRUE); // Load prices array (!) $prices = getArrayFromReferralRallyePrices($rallye); @@ -782,7 +784,7 @@ function addReferralRallyeWinners ($mode, $rallye, $default=0) { * active = 1: account is still confirmed * active = 0: account is deleted or locked */ - $active = countSumTotalData($content['userid'][$idx], 'user_data', 'userid', 'userid', true, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); + $active = countSumTotalData($content['userid'][$idx], 'user_data', 'userid', 'userid', TRUE, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'")); if ((empty($content['ref'][$idx])) || ($content['ref'][$idx] == '0') || ($active == '0') || ('' . round($content['cpoints'][$idx]) . '' == '0') || (empty($content['cpoints'][$idx]))) { // Allow valid and active users with at least one ref to get points @@ -816,7 +818,7 @@ function addReferralRallyeWinners ($mode, $rallye, $default=0) { ); // Load row template - $OUT .= loadTemplate($mode . '_list_rallye_row', true, $row); + $OUT .= loadTemplate($mode . '_list_rallye_row', TRUE, $row); } // END - for // Prepare content @@ -827,7 +829,7 @@ function addReferralRallyeWinners ($mode, $rallye, $default=0) { ); // Load main template and finnally return the output - return loadTemplate($mode . '_list_rallye', true, $content); + return loadTemplate($mode . '_list_rallye', TRUE, $content); } // @@ -862,11 +864,11 @@ WHERE // Purge whole rallye addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1", - array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s LIMIT 1", - array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1", - array(bigintval($content['id'])), __FUNCTION__, __LINE__, false)); + array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); // Add task (we ignore the task id here createNewTask('{--ADMIN_RALLYE_PURGED_TASK--}: ' . $content['title'], '{--ADMIN_RALLYE_PURGED_TEXT--}', 'RALLYE_PURGED'); @@ -890,7 +892,7 @@ function addReferralRallyeTemplateSelection ($name = 'template', $default = '') $basePath = sprintf("templates/%s/html/rallye/", getLanguage()); // Read the directory - $templates = getArrayFromDirectory($basePath, 'rallye_', false, true, array(), '.tpl'); + $templates = getArrayFromDirectory($basePath, 'rallye_', FALSE, TRUE, array(), '.tpl'); // And walk through foreach ($templates as $read) { @@ -907,7 +909,7 @@ function addReferralRallyeTemplateSelection ($name = 'template', $default = '') } } // END - foreach - // Do we have found templates which we can link with the new rallye? + // Is there found templates which we can link with the new rallye? if (!empty($ral[0])) { // Generate selection box for all found templates $OUT = '