From 9270eabb4c34f6fe04d56e7e702cf000849358d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 25 Dec 2008 19:00:41 +0000 Subject: [PATCH] Some marjor bugfixes and little improvements - Ugly line "No mail orders found" replaced with nicer looking "admin_setting_saved" template - Fixed bug in deleting any member mails without entries in mxchange_user_stats (reolved #28) - Fixed bug in "member list" if no extension "country" is installed (resolved #29) - Fixed bug in "Edit admin accounts" when current admin has access level "DENY" (resolved #27) - Fixed missing array $_CONFIG in templates --- inc/databases.php | 2 +- inc/functions.php | 2 +- inc/language/de.php | 1 + inc/libs/admins_functions.php | 13 +++++----- inc/modules/admin/what-del_email.php | 32 +++++++++++++++++++----- inc/modules/admin/what-email_archiv.php | 6 ++--- inc/modules/admin/what-email_details.php | 22 +++++++--------- inc/modules/admin/what-list_user.php | 7 ++++-- inc/pool/pool-bonus.php | 3 +++ inc/pool/pool-user.php | 3 +++ 10 files changed, 57 insertions(+), 34 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 7121547965..012beba67e 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', "703"); +define('CURR_SVN_REVISION', "704"); // 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 5c0715d6bb..591f12976b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -752,7 +752,7 @@ function SET_LANGUAGE($lang) { } // function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { - global $DATA, $REPLACER; + global $DATA, $REPLACER, $_CONFIG; // Make sure all template names are lowercase! $template = strtolower($template); diff --git a/inc/language/de.php b/inc/language/de.php index 1ed76cb73a..cea0a96434 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1125,6 +1125,7 @@ define('ADMIN_CONFIG_PROXY_PASSWORD', "Passwort (falls vorhanden):"); define('EDIT_ENTRIES', "Einträge ändern"); define('_CATEGORY_NONE', "Keine Kategorie"); define('__UNUSED', "Im Aufbau"); +define('ADMIN_DELETED_MAILS_COUNT', "Es wurden %s/ Einträge gelöscht."); define('ADMIN_SEND_RESET_LINK_TITLE', "1/4: Administratorkennwort zurücksetzen"); define('ADMIN_VALIDATE_HASH_TITLE', "2/4: Validierung Iher Logindaten"); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 403c32150c..251e2a4e07 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -53,7 +53,6 @@ function ADMINS_CHECK_ACL($act, $wht) { // Get admin's defult access right $default = GET_ADMIN_DEFAULT_ACL($aid); - if (!empty($wht)) { // Check for parent menu: // First get it's action value @@ -259,6 +258,9 @@ WHERE id=%s LIMIT 1", // Make admin accounts editable function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) { + // "Resolve" current's admin access mode + $currMode = GET_ADMIN_DEFAULT_ACL(GET_CURRENT_ADMIN_ID()); + // Begin the edit loop $SW = 2; $OUT = ""; foreach ($POST['sel'] as $id => $sel) { @@ -267,7 +269,7 @@ function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) { // Get the admin's data $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", - array($id), __FILE__, __LINE__); + array($id), __FILE__, __LINE__); if ((SQL_NUMROWS($result) == 1) && ($sel == 1)) { // Entry found $content = SQL_FETCHARRAY($result); @@ -278,7 +280,7 @@ function ADMINS_EDIT_ADMIN_ACCOUNTS ($POST) { $content['id'] = $id; // Shall we allow changing default ACL? - if ($content['mode'] == "allow") { + if ($currMode == "allow") { // Allow chaning it $content['mode'] = ADD_OPTION_LINES("/ARRAY/", array("allow", "deny"), array(ADMINS_ALLOW_MODE, ADMINS_DENY_MODE), $content['mode']); } else { @@ -396,10 +398,7 @@ function ADMINS_LIST_ADMIN_ACCOUNTS() { } // Filter for adding extra data to the query -function FILTER_ADD_EXTRA_SQL_DATA () { - // Init extra data - $ADD = ""; - +function FILTER_ADD_EXTRA_SQL_DATA ($ADD = "") { // Is the admins extension updated? (should be!) if (GET_EXT_VERSION("admins") >= "0.3") $ADD .= ", default_acl AS def_acl"; if (GET_EXT_VERSION("admins") >= "0.6.7") $ADD .= ", la_mode"; diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 90da0a95d0..56fd39be7b 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -43,10 +43,13 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR("admin", __FILE__); +// Init counter for deleted mails +$cnt = 0; + if (!empty($_GET['mid'])) { // Load email data $result = SQL_QUERY_ESC("SELECT id, sender, subject, url, timestamp, payment_id FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1", - array(bigintval($_GET['mid'])), __FILE__, __LINE__); + array(bigintval($_GET['mid'])), __FILE__, __LINE__); // Delete mail only once if (SQL_NUMROWS($result) == 1) { @@ -128,20 +131,25 @@ WHERE s.pool_id=%s LIMIT 1", LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_SHREDDED, $totalPoints)); } - // Delete mail from queue - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1", - array(bigintval($_GET['mid'])), __FILE__, __LINE__); - // Remove links from DB SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s", array(bigintval($stats_id)), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); - // Output link for manually removing stats entry + // Load template for link LOAD_TEMPLATE("admin_settings_saved", false, "".ADMIN_REMOVE_STATS_ENTRY.""); } // END - if // Free the result SQL_FREERESULT($result_pool); + + // Delete mail from queue + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1", + array(bigintval($_GET['mid'])), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); + + // Output link for manually removing stats entry + OUTPUT_HTML(sprintf(ADMIN_DELETED_MAILS_COUNT, $cnt)); } else { // Mail already deleted! LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NORMAL_MAIL_ALREADY_DELETED); @@ -166,17 +174,23 @@ WHERE s.pool_id=%s LIMIT 1", // Reset sent mails for recipient(s) REDUCT_RECIPIENT_RECEIVED_MAILS ("bonus_id", $_GET['bid'], $sent); + // Init counter for deleted mails + $cnt = 0; + // Delete bonus mail entirely from database SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", array(bigintval($_GET['bid'])), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s", array(bigintval($_GET['bid'])), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); // Prepare data for the template define('__ID' , $id); define('__SUBJECT', $subject); define('__URL' , DEREFERER($url)); define('__ORDERED', MAKE_DATETIME($timestamp, "0")); + define('__CNT' , $cnt); // Load template LOAD_TEMPLATE("admin_del_email_bonus"); @@ -198,17 +212,23 @@ WHERE s.pool_id=%s LIMIT 1", list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result); SQL_FREERESULT($result); + // Init counter for deleted mails + $cnt = 0; + // Delete bonus mail entirely from database SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", array(bigintval($_GET['nid'])), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s", array(bigintval($_GET['nid'])), __FILE__, __LINE__); + $cnt += SQL_AFFECTEDROWS(); // Prepare data for the template define('__ID' , $id); define('__SUBJECT', $subject); define('__URL' , DEREFERER($url)); define('__ORDERED', MAKE_DATETIME($timestamp, "0")); + define('__CNT' , $cnt); // Load template LOAD_TEMPLATE("admin_del_email_notify"); diff --git a/inc/modules/admin/what-email_archiv.php b/inc/modules/admin/what-email_archiv.php index e67b4c3a40..8888a50385 100644 --- a/inc/modules/admin/what-email_archiv.php +++ b/inc/modules/admin/what-email_archiv.php @@ -129,11 +129,9 @@ if (SQL_NUMROWS($result) > 0) // Load main template LOAD_TEMPLATE("admin_email_archiv"); -} - else -{ +} else { // No mail orders fond - OUTPUT_HTML("".ADMIN_NO_MAILS_IN_POOL.""); + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_MAILS_IN_POOL); } // ?> diff --git a/inc/modules/admin/what-email_details.php b/inc/modules/admin/what-email_details.php index 1795e056ab..effc1b8c72 100644 --- a/inc/modules/admin/what-email_details.php +++ b/inc/modules/admin/what-email_details.php @@ -60,8 +60,7 @@ ORDER BY timestamp DESC"; $WHO = _ALL; $SQL2 = ""; -if (!empty($_GET['mid'])) -{ +if (!empty($_GET['mid'])) { // Only a specific mail shall be displayed // 0 1 2 3 4 5 6 7 8 9 10 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id @@ -69,9 +68,7 @@ if (!empty($_GET['mid'])) WHERE id='".bigintval($_GET['mid'])."' LIMIT 1"; $WHO = MAIL_ID.": ".$_GET['mid']; -} - elseif (!empty($_GET['u_id'])) -{ +} elseif (!empty($_GET['u_id'])) { // All mails by a specific member shall be displayed // 0 1 2 3 4 5 6 7 8 9 10 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id @@ -101,8 +98,7 @@ if (empty($_GET['page'])) $_GET['page'] = "1"; if (empty($_GET['offset'])) $_GET['offset'] = getConfig('mails_page'); // Add limitation to SQL string -if (empty($_GET['mid'])) -{ +if (empty($_GET['mid'])) { // Create limitation line $ADD = " LIMIT ".(bigintval($_GET['offset']) * bigintval($_GET['page']) - bigintval($_GET['offset'])).", ".bigintval($_GET['offset']); @@ -111,7 +107,7 @@ if (empty($_GET['mid'])) // For bonus mails if (!empty($SQL2)) $SQL2 .= $ADD; -} +} // END - if // Run SQL query for normal mails $result_list = SQL_QUERY($SQL, __FILE__, __LINE__); @@ -211,7 +207,7 @@ if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL)) { // Load row template $OUT .= LOAD_TEMPLATE("admin_list_bonus_emails_row", true, $content); - } + } // END - while // Add navigation (without change box but with colspan=3) $content['nav'] = ""; @@ -223,13 +219,13 @@ if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL)) { // Load main template LOAD_TEMPLATE("admin_list_bonus_emails", false, $content); $MAIL = true; - } -} + } // END - if +} // END - if if (!$MAIL) { // No mail orders fond - OUTPUT_HTML("".ADMIN_NO_MAILS_IN_POOL.""); -} + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_MAILS_IN_POOL); +} // END - if // ?> diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 00d2c1f7fa..7aac557d3a 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -79,7 +79,10 @@ if (GET_EXT_VERSION("user") >= "0.3.4") { if (EXT_IS_ACTIVE("country")) { // Add country code $MORE .= ", country_code"; -} // END - if +} else { + // Add direct value + $MORE .= ", country"; +} // Init unset data (bad that we change $_GET here!) if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; } @@ -323,7 +326,7 @@ LIMIT 1", if (EXT_IS_ACTIVE("country")) { // Then overwrite country information $content['country'] = COUNTRY_GENERATE_INFO($content['country_code']); - } elseif ($content['country'] == 0) { + } elseif ($content['country'] == "") { // Zero ID??? $content['country'] = "???"; } diff --git a/inc/pool/pool-bonus.php b/inc/pool/pool-bonus.php index 0d93da0e2b..5fa5a82e0f 100644 --- a/inc/pool/pool-bonus.php +++ b/inc/pool/pool-bonus.php @@ -46,6 +46,9 @@ if (defined('__DAILY_RESET')) { return false; } +// Need this here +global $REPLACER; + // Only send bonus mail when bonus extension is active and maximum send-mails is not reached if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Do we need to send out bonus mails? diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php index 12afa10400..5b8be7a708 100644 --- a/inc/pool/pool-user.php +++ b/inc/pool/pool-user.php @@ -46,6 +46,9 @@ if (defined('__DAILY_RESET')) { return false; } +// Need this here +global $REPLACER; + // Check for freed mail orders to send out if (EXT_IS_ACTIVE("html_mail")) { // 0 1 2 3 4 5 6 7 8 9 10 -- 2.30.2