From 27f65d023a3388a8bd85be8ee5991f776f541847 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 6 Feb 2009 01:02:50 +0000 Subject: [PATCH] Fixes for a lot bug tickets. (Sorry for lame comment) --- doubler.php | 14 ++-- inc/databases.php | 2 +- inc/functions.php | 17 +++-- inc/language/de.php | 11 +++- inc/libs/doubler_functions.php | 5 +- inc/libs/rallye_functions.php | 31 ++++----- inc/libs/theme_functions.php | 4 +- inc/modules/admin/overview-inc.php | 23 +++---- inc/modules/admin/what-admins_mails.php | 1 + inc/modules/admin/what-config_payouts.php | 69 +++++++------------ inc/modules/admin/what-config_points.php | 4 +- inc/modules/admin/what-guest_add.php | 29 ++++---- inc/modules/admin/what-list_country.php | 80 ++++++++--------------- inc/modules/admin/what-list_links.php | 16 ++++- inc/modules/admin/what-logs.php | 4 +- inc/modules/admin/what-theme_check.php | 6 +- inc/modules/guest/what-register.php | 4 +- inc/modules/member/what-doubler.php | 7 +- inc/modules/member/what-reflinks.php | 31 ++++----- inc/mysql-manager.php | 4 +- 20 files changed, 163 insertions(+), 199 deletions(-) diff --git a/doubler.php b/doubler.php index d002ed7c28..09d00fba02 100644 --- a/doubler.php +++ b/doubler.php @@ -133,8 +133,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points"); // So let's continue with probing his points amount - if (($points - getConfig('doubler_left') - $_POST['points'] * getConfig('doubler_charge')) >= 0) - { + if (($points - getConfig('doubler_left') - $_POST['points'] * getConfig('doubler_charge')) >= 0) // Enough points are left so let's continue with the doubling process // Create doubling "account" width *DOUBLED* points SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".GET_REMOTE_ADDR()."', UNIX_TIMESTAMP(), 'N','N')", @@ -146,15 +145,18 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Add points to "total payed" including charge $points = $_POST['points'] - $_POST['points'] * getConfig('doubler_charge'); UPDATE_CONFIG("doubler_points", $points, "+"); - getConfig('doubler_points') += $points; + incrementConfigEntry('doubler_points', $points); // Add second line for the referal but only when uid != refid if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid)) { // Okay add a refid line and apply refid percents - SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid,refid,points,remote_ip,timemark,completed,is_ref) VALUES ('%s',0,'%s','".GET_REMOTE_ADDR()."',UNIX_TIMESTAMP(),'N','Y')", - array(bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2 * getConfig('doubler_ref'))), __FILE__, __LINE__); + SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".GET_REMOTE_ADDR()."',UNIX_TIMESTAMP(),'N','Y')", + array( + bigintval($GLOBALS['refid']), + bigintval($_POST['points'] * 2 * getConfig('doubler_ref')) + ), __FILE__, __LINE__); - // And that's why we dont't want to you more than one referal level of doubler-points. ^^^ + // And that's why we don't want to you more than one referal level of doubler-points. ^^^ } // END - if // Update usage counter diff --git a/inc/databases.php b/inc/databases.php index 102ac3ed94..946addc2bd 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "708"); +define('CURR_SVN_REVISION', "709"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/functions.php b/inc/functions.php index d47a72123e..fd8b2c5a90 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2593,6 +2593,7 @@ function REVERT_COMMA ($str) { // Return float return $float; } + // Handle menu-depending failed logins and return the rendered content function HANDLE_LOGIN_FAILTURES ($accessLevel) { // Default output is empty ;-) @@ -2621,6 +2622,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) { // Return rendered content return $OUT; } + // Rebuild cache function REBUILD_CACHE ($cache, $inc="") { global $cacheInstance, $CSS; @@ -2650,6 +2652,7 @@ function REBUILD_CACHE ($cache, $inc="") { } // END - if } // END - if } + // Purge admin menu cache function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") { global $cacheInstance; @@ -2668,8 +2671,9 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") { } // Experiemental feature! - trigger_error("You have to delete the admin_*.cache files by yourself at this point."); + trigger_error("Experimental feature: You have to delete the admin_*.cache files by yourself at this point."); } + // Translates the "pool type" into human-readable function TRANSLATE_POOL_TYPE ($type) { // Default type is unknown @@ -2687,6 +2691,7 @@ function TRANSLATE_POOL_TYPE ($type) { // Return "translation" return $translated; } + // "Getter" for remote IP number function GET_REMOTE_ADDR () { // Get remote ip from environment @@ -2973,12 +2978,16 @@ function THEME_GET_ID ($name) { return $id; } -// Increment or init with 1 the given config entry -function incrementConfigEntry ($configEntry) { +// Increment or init with given value or 1 as default the given config entry +function incrementConfigEntry ($configEntry, $value=1) { global $_CONFIG; // Increment it if set or init it with 1 - if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; } + if (getConfig($configEntry) > 0) { + $_CONFIG[$configEntry] += $value; + } else { + $_CONFIG[$configEntry] = $value; + } } ////////////////////////////////////////////////// diff --git a/inc/language/de.php b/inc/language/de.php index 27bd47a004..1ad3693be5 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -583,6 +583,7 @@ define('MEMBER_COOKIES_DISABLED', "Kann nicht einloggen, da Cookies bei Ihnen de define('ADMIN_DEL_COMPLETED', "Account wurde gelöscht! Die {!POINTS!} werden immer in den Jackpot transferiert!"); define('NORMAL_MAIL_PROBLEM', "Mail vom Mitgliedern bereits gelöscht"); define('BONUS_MAIL_PROBLEM', "Bonus-Mail bereits gelöscht"); +define('GENERAL_MAIL_PROBLEM', "BUG! BUG! Bitte reporten auf bugs.mxchange.org."); define('MEMBER_BACK_JACKPOT', "{!POINTS!}-Rueckgutschrift"); define('ADMIN_BACK_JACKPOT', "{!POINTS!}-Aufbuchung fuer Jackpot"); define('MEDIA_DATA', "Mediendaten"); @@ -697,10 +698,11 @@ define('_ALL2', "Alle"); define('WE_HAVE', "Wir haben"); define('MEMBER_TEST_URL', "Zur beworbenen Seite"); define('ADMIN_LOGS_DIR_404_1', "Das Verzeichnis mit den Zugriffslogbüchern konnte nicht gefunden werden! ("); -define('ADMIN_LOGS_DIR_404_2', ")"); +define('ADMIN_LOGS_DIR_404_2', ") Vermutlich unterstützt Ihr Server dieses nicht."); define('ADMIN_USAGE_DIR_404_1', "Das Verzeichnis mit den Webalizer-Statistiken konnte nicht gefunden werden! ("); -define('ADMIN_USAGE_DIR_404_2', ")"); +define('ADMIN_USAGE_DIR_404_2', ") Vermutlich unterstützt Ihr Server dieses nicht."); define('ADMIN_ENTER_REDIRECT_URL', "URL eingeben, wenn abgelehnt werden soll"); +define('MEMBER_NO_REFBANNER_FOUND', "Es sind noch keine Werbebanner eingerichtet worden. Bitte verwende solange deinen Referal-Link."); define('ADMIN_ID_404_1', "ID "); define('ADMIN_ID_404_2', " nicht gefunden!"); define('ADMIN_ASSIGNED_ADMIN', "Zugewiesener Admin-Login"); @@ -1247,5 +1249,10 @@ define('FILTER_FAILED_NO_FILTER_FOUND', "Die Filterkette %s konnte nicht define('FILTER_FAILED_NOT_REMOVED', "Die Filterfunktion %s konnte nicht aus der Filterkette %s entfernt werden, da sie nicht existiert."); define('FILTER_FLUSH_FAILED_NO_DATABASE', "Kann die Filterketten nicht speichern. Datenbank fehlt!"); +// Status changes +define('ADMIN_STATUS_CHANGED_1', "Es wurden "); +define('ADMIN_STATUS_CHANGED_2', " von "); +define('ADMIN_STATUS_CHANGED_3', " Einträgen geändert."); + // ?> diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index d2476e7927..a5379614c2 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -37,8 +37,9 @@ if (!defined('__SECURITY')) { require($INC); } -// -function DOUBLER_GENERATE_TABLE($uid="0", $done='N', $ref='N', $sort="ASC") { +// Generates a HTML table baded on given data +// @TODO Lame description! +function DOUBLER_GENERATE_TABLE ($uid="0", $done='N', $ref='N', $sort="ASC") { global $_CONFIG; if (empty($cnt)) $cnt = 0; $ADD = ""; $DT_MODE = 0; diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index ac949d0a89..08e8cf341b 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -511,9 +511,9 @@ function RALLYE_LOAD_PRICES_ARRAY($rallye) // Return array return $prices; } + // -function RALLYE_LOAD_USERS_ARRAY($rallye) -{ +function RALLYE_LOAD_USERS_ARRAY ($rallye) { global $_CONFIG; // Fix zero points to 0.00000 @@ -528,9 +528,8 @@ function RALLYE_LOAD_USERS_ARRAY($rallye) // Load users uid old points earned $result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%s ORDER BY userid", - array(bigintval($rallye)), __FILE__, __LINE__); - while(list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user)) - { + array(bigintval($rallye)), __FILE__, __LINE__); + while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user)) { // Load current ref count $cnt = RALLYE_GET_REFCOUNT($uid, $refs); @@ -562,21 +561,23 @@ WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p $prices = RALLYE_LOAD_PRICES_ARRAY($rallye); // Merge users into prices - foreach ($prices['level'] as $k => $lvl) - { - $prices['uid'][$k] = $users['uid'][$k]; - if (empty($prices['uid'][$k])) $prices['uid'][$k] = "---"; - $prices['ref'][$k] = $users['ref'][$k]; - if (empty($prices['ref'][$k])) $prices['ref'][$k] = "---"; - $prices['cpoints'][$k] = $users['cpoints'][$k]; - } + foreach ($prices['level'] as $k => $lvl) { + // We only need to check one element in $users, see above while() block + if (isset($users['uid'][$k])) { + $prices['uid'][$k] = $users['uid'][$k]; + if (empty($prices['uid'][$k])) $prices['uid'][$k] = "---"; + $prices['ref'][$k] = $users['ref'][$k]; + if (empty($prices['ref'][$k])) $prices['ref'][$k] = "---"; + $prices['cpoints'][$k] = $users['cpoints'][$k]; + } // END - if + } // END - foreach // Return completed array return $prices; } + // -function RALLYE_LIST_WINNERS($rallye,$default=0) -{ +function RALLYE_LIST_WINNERS ($rallye, $default=0) { // First check how many prices are set $result_prices = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level", array(bigintval($rallye)), __FILE__, __LINE__); diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 0169427c73..31ec274cca 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -86,11 +86,11 @@ function THEME_GET_VERSION ($name) { // Is the extension "theme" installed? if (!EXT_IS_ACTIVE("theme")) { // Then abort here - return "0.0"; + return "!.!"; } // END - if // Default version "number" - $cver = "-.-"; + $cver = "?.?"; // Is the cache entry there? if (isset($cacheArray['themes']['theme_ver'][$name])) { diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 65432430c4..ee772bbdb7 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -117,13 +117,13 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", return $JOBS_DONE; } -// -function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) { +// Outputs selected tasks +function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { global $_CONFIG, $NOTES; - if ((isset($_POST['assign'])) && (count($_POST['task']) > 0)) { + if ((isset($POST['assign'])) && (count($POST['task']) > 0)) { // Assign / do tasks $OUT = ""; $SW = 2; - foreach ($_POST['task'] as $id => $sel) { + foreach ($POST['task'] as $id => $sel) { $result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')) LIMIT 1", array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); if (SQL_NUMROWS($result_task) == 1) { @@ -244,12 +244,13 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) { // Close task but not already closes or deleted or update tasks if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) { + // Solve the task RUN_FILTER('solve_task', $tid); } // END - if } break; - case "EXTENSION_UPDATE": + case "EXTENSION_UPDATE": // Extension update // Extension updates are installed automatically $OUT .= "".ADMIN_EXTENSION_UPDATED."\n"; @@ -274,7 +275,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) { if (EXT_IS_ACTIVE("payout")) { // Extension is installed so let him send a notification to the user $result_pay = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_payouts WHERE userid=%s AND payout_timestamp=%s LIMIT 1", - array(bigintval($uid), bigintval($created)), __FILE__, __LINE__); + array(bigintval($uid), bigintval($created)), __FILE__, __LINE__); list($pid) = SQL_FETCHROW($result_pay); SQL_FREERESULT($result_pay); @@ -359,17 +360,17 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) { // Load final template LOAD_TEMPLATE("admin_overview_list"); } else { - if ((isset($_POST['task'])) && ((sizeof($_POST['task']) > 0) || ($_POST['task'][0] == "1"))) { + if ((isset($POST['task'])) && ((sizeof($POST['task']) > 0) || ($POST['task'][0] == "1"))) { // Only unassign / delete tasks when there are selected tasks posted - if (!empty($_POST['unassign'])) { + if (!empty($POST['unassign'])) { // Unassign from tasks - foreach ($_POST['task'] as $id => $sel) { + foreach ($POST['task'] as $id => $sel) { SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE id=%s AND assigned_admin=%s LIMIT 1", array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); } - } elseif (isset($_POST['del'])) { + } elseif (isset($POST['del'])) { // Delete tasks - foreach ($_POST['task'] as $id => $sel) { + foreach ($POST['task'] as $id => $sel) { SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND assigned_admin IN (%s,0) LIMIT 1", array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); } diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index 6c985fccc3..f1402e7410 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -171,6 +171,7 @@ ORDER BY m.admin_id, m.mail_template", __FILE__, __LINE__); } $content = array( 'sw' => $SW, + 'id' => $id, 'tpl' => $templ, 'alnk' => $admin_link ); diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index 98ca6cb4e3..83ffcc9226 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -42,13 +42,11 @@ ADD_DESCR("admin", __FILE__); if (!empty($_POST['rate'])) $_POST['rate'] = REVERT_COMMA($_POST['rate']); -if ((isset($_POST['add'])) && (!empty($_POST['title'])) && ($_POST['rate'] > 0)) -{ +if ((isset($_POST['add'])) && (!empty($_POST['title'])) && ($_POST['rate'] > 0)) { // Add new payout type $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_payout_types WHERE type='%s' LIMIT 1", - array($_POST['title']), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 0) - { + array($_POST['title']), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 0) { // Add now SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_payout_types (type, rate, min_points, from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url) @@ -65,15 +63,13 @@ VALUES ('%s', %d, %d,'%s','%s','%s','%s','%s','%s','%s')", $_POST['ytrans'], $_POST['allow_url'], ), __FILE__, __LINE__); - $msg = "".ADMIN_PAYOUT_TYPE_ADDED.""; - } - else - { + $msg = "
".ADMIN_PAYOUT_TYPE_ADDED."
"; + } else { // Free memory SQL_FREERESULT($result); // Does already exist - $msg = "".ADMIN_PAYOUT_TYPE_ALREADY.""; + $msg = "
".ADMIN_PAYOUT_TYPE_ALREADY."
"; } } @@ -81,20 +77,16 @@ VALUES ('%s', %d, %d,'%s','%s','%s','%s','%s','%s','%s')", $result_mem = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_user_payouts WHERE status='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__); $display = true; -if ((isset($_POST['edit'])) && (SELECTION_COUNT($_POST['sel']) > 0)) -{ +if ((isset($_POST['edit'])) && (SELECTION_COUNT($_POST['sel']) > 0)) { // Edit payout types - if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok")) - { + if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok")) { // Edit entries - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { // Secure ID $id = bigintval($id); // Edit only if something is entered - if ((!empty($_POST['title'][$id])) && ($_POST['rate'][$id] > 0)) - { + if ((!empty($_POST['title'][$id])) && ($_POST['rate'][$id] > 0)) { // Update entry SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_payout_types SET type='%s', @@ -111,13 +103,10 @@ WHERE id='".$id."' LIMIT 1", } } $msg = ADMIN_PAYOUT_ENTRIES_CHANGED; - } - else - { + } else { $display = false; //Suppress any other outputs $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { // Load data $result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM "._MYSQL_PREFIX."_payout_types WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); @@ -143,26 +132,19 @@ WHERE id='".$id."' LIMIT 1", // Load main template LOAD_TEMPLATE("admin_config_payouts_edit"); } -} - elseif ((isset($_POST['del'])) && (SELECTION_COUNT($_POST['sel']) > 0)) -{ +} elseif ((isset($_POST['del'])) && (SELECTION_COUNT($_POST['sel']) > 0)) { // Delete payout types - if ($_GET['ok'] == "ok") - { + if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok")) { // Delete entries - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_payout_types WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); } $msg = ADMIN_PAYOUT_ENTRIES_DELETED; - } - else - { + } else { $display = false; //Suppress any other outputs $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { // Secure ID number $id = bigintval($id); @@ -192,8 +174,7 @@ WHERE id='".$id."' LIMIT 1", } } -if (!empty($msg)) -{ +if (!empty($msg)) { // Output message LOAD_TEMPLATE("admin_settings_saved", false, $msg); } @@ -201,12 +182,10 @@ if (!empty($msg)) // Payout types $result_type = SQL_QUERY("SELECT id, type, rate, min_points, from_account FROM "._MYSQL_PREFIX."_payout_types ORDER BY type", __FILE__, __LINE__); -if ((SQL_NUMROWS($result_type) > 0) && ($display)) -{ +if ((SQL_NUMROWS($result_type) > 0) && ($display)) { // List all payout types $SW = 2; $OUT = ""; - while (list($id, $type, $rate, $mpoi, $from) = SQL_FETCHROW($result_type)) - { + while (list($id, $type, $rate, $mpoi, $from) = SQL_FETCHROW($result_type)) { // Prepare data for the row template $content = array( 'sw' => $SW, @@ -231,17 +210,15 @@ if ((SQL_NUMROWS($result_type) > 0) && ($display)) } // Does your members request payouts? -if ((SQL_NUMROWS($result_mem) > 0) && ($display)) -{ +if ((SQL_NUMROWS($result_mem) > 0) && ($display)) { // Members has requested payouts SQL_FREERESULT($result_mem); OUTPUT_HTML("

".ADMIN_PAYOUT_LIST_REQUESTS."

"); -} - elseif ($display) -{ +} elseif ($display) { // No member requests so far OUTPUT_HTML("

".ADMIN_PAYOUT_NO_MEMBER_REQUESTS."

"); } + // Add new paypout type if ($display) LOAD_TEMPLATE("admin_payout_add_new"); diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 9af8f84fb0..f874710e81 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -184,7 +184,7 @@ WHERE mails_confirmed < %s", $REF, $REF); // Load template LOAD_TEMPLATE("admin_config_point_settings"); } elseif ($_GET['sub'] == "ref") { - if ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) { + if ((isset($_POST['del'])) && (isset($_POST['sel'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) { // Delete entries $SW = 2; $OUT = ""; foreach ($_POST['sel'] as $id => $value) { @@ -209,7 +209,7 @@ WHERE mails_confirmed < %s", $REF, $REF); // Load main template LOAD_TEMPLATE("admin_points_del"); - } elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) { + } elseif ((isset($_POST['edit'])) && (isset($_POST['sel'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) { // Edit entries $SW = 2; $OUT = ""; foreach ($_POST['sel'] as $id => $value) { diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php index f4c75d15ab..0cc22e2bb3 100644 --- a/inc/modules/admin/what-guest_add.php +++ b/inc/modules/admin/what-guest_add.php @@ -41,23 +41,19 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Check if the admin has entered title and what-php file name... -if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok']))) -{ +if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok'])) { unset($_POST['ok']); } -if (!isset($_POST['ok'])) -{ +if (!isset($_POST['ok'])) { // Create arrays $menus = array(); $titles = array(); $below = array(); // Get all available main menus $result = SQL_QUERY("SELECT action, title, sort FROM `"._MYSQL_PREFIX."_guest_menu` WHERE (what='' OR what IS NULL) ORDER BY sort", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { + if (SQL_NUMROWS($result) > 0) { // Read menu structure - while (list($act, $title, $sort) = SQL_FETCHROW($result)) - { + while (list($act, $title, $sort) = SQL_FETCHROW($result)) { // Menu actions $menus[] = $act; @@ -73,27 +69,24 @@ if (!isset($_POST['ok'])) // Remove double eintries $prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below; - foreach ($menus as $key => $value) - { - if ($value == $prev) - { + foreach ($menus as $key => $value) { + if ($value == $prev) { unset($dmy[$key]); unset($dmy2[$key]); unset($dmy3[$key]); - } - else - { + } else { $prev = $value; } } + $menus = $dmy; $titles = $dmy2; $below = $dmy3; + // Load sub menus :) - foreach ($menus as $key_main => $value_main) - { + foreach ($menus as $key_main => $value_main) { $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", - array(bigintval($value_main)), __FILE__, __LINE__); + array($value_main), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Initialize arrays diff --git a/inc/modules/admin/what-list_country.php b/inc/modules/admin/what-list_country.php index 70ea85152e..776b59948d 100644 --- a/inc/modules/admin/what-list_country.php +++ b/inc/modules/admin/what-list_country.php @@ -41,22 +41,18 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Add new code? -if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr']))) -{ +if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr']))) { // Check if country code does already exist $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_countries WHERE code='%s' LIMIT 1", array(strtoupper($_POST['code'])), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 0) - { + if (SQL_NUMROWS($result) == 0) { // Save entry SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_countries (code, descr, is_active) VALUES ('%s','%s','%s')", array(strtoupper(substr($_POST['code'], 0, 2)), $_POST['descr'], $_POST['is_active']), __FILE__, __LINE__); // Country added $MSG = ADMIN_COUNTRY_ADDED_1.strtoupper($_POST['descr']).ADMIN_COUNTRY_ADDED_2; - } - else - { + } else { // Free memory SQL_FREERESULT($result); @@ -67,20 +63,12 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Display message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); OUTPUT_HTML("
"); -} -// Change status? - elseif ((isset($_POST['change'])) && (!empty($_POST['id']))) -{ +} elseif ((isset($_POST['change'])) && (!empty($_POST['id']))) { // Change all status ADMIN_CHANGE_ACTIVATION_STATUS($_POST['id'], "countries", "is_active"); -} -// Edit / delete entries? - elseif (((isset($_POST['edit'])) || (isset($_POST['delete']))) && (!empty($_POST['id']))) -{ - if (count($_POST['id']) > 0) - { - if (isset($_POST['edit'])) - { +} elseif (((isset($_POST['edit'])) || (isset($_POST['delete']))) && (!empty($_POST['id']))) { + if (count($_POST['id']) > 0) { + if (isset($_POST['edit'])) { // Edit template $row = "admin_list_country_edit_row"; $post = "modify"; @@ -88,9 +76,7 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' $submit = ADMIN_COUNTRY_EDIT_NOW; $title = ADMIN_COUNTRY_EDIT_TITLE; $reset = " *\n"; - } - else - { + } else { // Delete template $row = "admin_list_country_del_row"; $post = "remove"; @@ -102,13 +88,11 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Edit all selected country codes $OUT = ""; $SW = 2; - foreach ($_POST['id'] as $id => $status) - { + foreach ($_POST['id'] as $id => $status) { // Load data from DB $result = SQL_QUERY_ESC("SELECT code, descr FROM "._MYSQL_PREFIX."_countries WHERE id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($id)), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { // Load data list($code, $descr) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -120,16 +104,16 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' 'descr' => $descr, 'sw' => $SW, ); - if ($post == "modify") - { + + if ($post == "modify") { // Generate default selection in edit-mode $content['status'] = ADD_OPTION_LINES("/ARRAY/", array("Y","N"), array(YES, NO ), $status); - } - else - { + } else { // Only display status when in delete-mode $content['status'] = TRANSLATE_YESNO($status); } + + // Insert row template and switch color $OUT .= LOAD_TEMPLATE($row, true, $content); $SW = 3 - $SW; } @@ -144,37 +128,29 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Load main template LOAD_TEMPLATE("admin_list_country_form"); } -} - else -{ +} else { // Shall we modify / remove entries now? $MSG = ""; $SQLs = array(); - if ((isset($_POST['modify'])) && (!empty($_POST['id']))) - { + if ((isset($_POST['modify'])) && (!empty($_POST['id']))) { // Modify - foreach ($_POST['id'] as $id => $sel) - { + foreach ($_POST['id'] as $id => $sel) { $SQLs[] = "UPDATE "._MYSQL_PREFIX."_countries SET code='".$_POST['code'][$id]."', descr='".$_POST['descr'][$id]."', is_active='".$_POST['is_active'][$id]."' WHERE id='".$id."' LIMIT 1"; } // Create message $MSG = ADMIN_COUNTRIES_MODIFIED; - } - elseif ((isset($_POST['remove'])) && (!empty($_POST['id']))) - { + } elseif ((isset($_POST['remove'])) && (!empty($_POST['id']))) { // Remove - $IDs = implode(", ", bigintval($_POST['id'])); + $IDs = implode(", ", $_POST['id']); $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_countries WHERE id IN (".$IDs.") LIMIT ".count($_POST['id']).""; // Create message $MSG = ADMIN_COUNTRIES_REMOVED; } - if ((!empty($MSG)) && (count($SQLs) > 0)) - { + if ((!empty($MSG)) && (count($SQLs) > 0)) { // Run SQL commands - foreach ($SQLs as $sql) - { + foreach ($SQLs as $sql) { $result = SQL_QUERY($sql, __FILE__, __LINE__); } @@ -185,12 +161,10 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Load currenty setup country codes to list $result = SQL_QUERY("SELECT id, code, descr, is_active FROM "._MYSQL_PREFIX."_countries ORDER BY code", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { + if (SQL_NUMROWS($result) > 0) { // List all countries $OUT = ""; $SW = 2; - while(list($id, $code, $descr, $active) = SQL_FETCHROW($result)) - { + while(list($id, $code, $descr, $active) = SQL_FETCHROW($result)) { // Prepare array for the template $content = array( 'id' => $id, @@ -208,9 +182,7 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Free memory SQL_FREERESULT($result); - } - else - { + } else { // No code setup so far (not possible by this software! 'DE' for 'Deutschland' is default $OUT = LOAD_TEMPLATE("admin_list_country_no_row", true); } diff --git a/inc/modules/admin/what-list_links.php b/inc/modules/admin/what-list_links.php index 1ea98ba548..18848922d9 100644 --- a/inc/modules/admin/what-list_links.php +++ b/inc/modules/admin/what-list_links.php @@ -87,23 +87,33 @@ if (!empty($_GET['u_id'])) { // List all unconfirmed mails $SW = 2; $OUT = ""; while (list($id, $id2, $type) = SQL_FETCHROW($result)) { - // Load data from stats table... + // Initializes some variables $cat = ""; + $DATA = ""; + $PROBLEM = GENERAL_MAIL_PROBLEM; + $result_data = false; // Closes Bug #58 + + // Load data from stats table... switch ($type) { case "NORMAL": $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); + array(bigintval($id)), __FILE__, __LINE__); $type = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM; $LINK = "".$id.""; break; case "BONUS": $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array(bigintval($id2)), __FILE__, __LINE__); + array(bigintval($id2)), __FILE__, __LINE__); $type = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM; $LINK = "".$id2.""; break; + + default: // Problem in application detected! + // Log the error + DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid email type %s detected.", $type)); + break; } if (SQL_NUMROWS($result_data) == 1) { diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index 14ab44f115..c229c552f2 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -86,9 +86,7 @@ if (!empty($_GET['access'])) { } @closedir($handle); OUTPUT_HTML(""); - } - else - { + } else { // logs directory does not exist LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LOGS_DIR_404_1.LOGS_BASE.ADMIN_LOGS_DIR_404_2); } diff --git a/inc/modules/admin/what-theme_check.php b/inc/modules/admin/what-theme_check.php index 53ef7809ca..e29ae53c25 100644 --- a/inc/modules/admin/what-theme_check.php +++ b/inc/modules/admin/what-theme_check.php @@ -50,8 +50,7 @@ $SEL = 0; $response = GET_URL("check-themes.php"); // Are theme_check found? -if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) -{ +if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) { // Ok, mark found and create the array $THEMES = array( 'fname' => array(), // File names @@ -77,7 +76,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) $cver = THEME_GET_VERSION($name); // Is the extension already installed or not? - if (((SQL_NUMROWS($result) == 0) && (!FILE_READABLE($file))) || ($ver != $cver)) { + if (($ver != $cver) && ($cver != "?") && ($cver != "!")) { // No, it isn't. So let's add this one! $THEMES['fname'][] = $name; $THEMES['fsize'][] = $response[$idx + 1]; @@ -85,6 +84,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) $THEMES['ver'][] = $ver; $THEMES['cver'][] = $cver; + // Extract language strings from reponse $LANG_DUMMY = explode("[nl]", $response[$idx + 4]); $LANG = array(); $INFO = ADMIN_EXT_NO_INFO_FOUND; diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index c44257b4be..b7f3948965 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -455,11 +455,11 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF // Shall I add a counrty selection box or the old input box? if (EXT_IS_ACTIVE("country")) { // New variant, good! - $OUT = "\n"; $whereStatement = "WHERE is_active='Y'"; if (IS_ADMIN()) $whereStatement = ""; $OUT .= ADD_OPTION_LINES("countries", "id", "descr", $_POST['country_code'], "code", $whereStatement); - $OUT .= ""; + $OUT .= ""; define('__COUNTRY_CONTENT', $OUT); } else { // Old out-dated variant diff --git a/inc/modules/member/what-doubler.php b/inc/modules/member/what-doubler.php index 631f8420f8..a57b9ea8fa 100644 --- a/inc/modules/member/what-doubler.php +++ b/inc/modules/member/what-doubler.php @@ -76,11 +76,10 @@ if (EXT_IS_ACTIVE("nickname")) } // Usage counter -define('__DOUBLER_COUNTER', getConfig('doubler_counter')); +define('__DOUBLER_COUNTER', TRANSLATE_COMMA(getConfig('doubler_counter'))); // Which mail-send-mode did the admin setup? -switch (getConfig('doubler_send_mode')) -{ +switch (getConfig('doubler_send_mode')) { case "DIRECT": define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT); break; @@ -103,7 +102,7 @@ define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], "N", " define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout'))); // Points left to double -define('__LEFT_VALUE', DOUBLER_GET_TOTAL_POINTS_LEFT()); +define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT())); // Load template LOAD_TEMPLATE("member_doubler"); diff --git a/inc/modules/member/what-reflinks.php b/inc/modules/member/what-reflinks.php index 2ce512e060..eaf8e39298 100644 --- a/inc/modules/member/what-reflinks.php +++ b/inc/modules/member/what-reflinks.php @@ -44,8 +44,7 @@ ADD_DESCR("member", __FILE__); // Load current referal clicks $result = SQL_QUERY_ESC("SELECT ref_clicks FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); - + array($GLOBALS['userid']), __FILE__, __LINE__); list($c) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -53,20 +52,16 @@ OUTPUT_HTML("".YOUR_PERSONAL_REFLINK.":
".URL."/ref.php?ref=".$GLOBALS['userid']."

"); -if (EXT_IS_ACTIVE("nickname")) -{ +if (EXT_IS_ACTIVE("nickname")) { // Add nickname link when nickname is entered $nick = NICKNAME_GET_NICK($GLOBALS['userid']); - if (!empty($nick)) - { + if (!empty($nick)) { // Display nickname link OUTPUT_HTML(NICKNAME_YOUR_REFLINK.":
".URL."/ref.php?ref=".$nick."

"); - } - else - { + } else { // Display link to nickname form OUTPUT_HTML("".NO_NICKNAME_SET."
".PLEASE_CLICK_NICKNAME_FORM.""); @@ -79,23 +74,18 @@ $whereStatement = " WHERE visible='Y'"; if (IS_ADMIN()) $whereStatement = ""; $result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM "._MYSQL_PREFIX."_refbanner", __FILE__, __LINE__); -if (SQL_NUMROWS($result) > 0) -{ +if (SQL_NUMROWS($result) > 0) { // List available ref banners $SW = 2; $OUT = ""; - while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result)) - { + while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result)) { $test = str_replace(URL, PATH, $url); $size = 0; - if ($test == $url) - { + if ($test == $url) { // Download banner (I hope you keep the banner on same server???) $fp = GET_URL($url); $file = ""; - if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0)) - { + if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) { // Loads only found banner, when there is a 404 error this foreach() command // will cause an "Invalid argument supplied for foreach()" error - foreach ($fp as $f) - { + foreach ($fp as $f) { $file .= $f; } } @@ -127,6 +117,9 @@ if (SQL_NUMROWS($result) > 0) // Load final template LOAD_TEMPLATE("member_reflinks_table", false, $GLOBALS['userid']); +} else { + // No refbanner found! + LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_NO_REFBANNER_FOUND); } // Free result diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 4f2c89ca68..084bb5ad27 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1457,7 +1457,7 @@ function GET_ADMIN_DEFAULT_ACL ($aid) { return $ret; } // -function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") { +function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where="") { $ret = ""; if ($table == "/ARRAY/") { // Selection from array @@ -1476,7 +1476,7 @@ function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") $ORDER = $name.$SPEC; if ($table == "country") $ORDER = $special; $result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM "._MYSQL_PREFIX."_%s ".$where." ORDER BY %s", - array($id, $ORDER, $table, $name), __FILE__, __LINE__); + array($id, $ORDER, $table, $name), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option while (list($value, $title, $add) = SQL_FETCHROW($result)) { -- 2.30.2