- 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
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);
}
//
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);
define('EDIT_ENTRIES', "Einträge ändern");
define('_CATEGORY_NONE', "Keine Kategorie");
define('__UNUSED', "Im Aufbau");
+define('ADMIN_DELETED_MAILS_COUNT', "Es wurden <u>%s/<u> 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");
// 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
// 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) {
// 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);
$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 {
}
// 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";
// 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) {
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, "<A href=\"".URL."/modules.php?module=admin&what=del_email&pid=".bigintval($_GET['mid'])."\">".ADMIN_REMOVE_STATS_ENTRY."</A>");
} // 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);
// 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");
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");
// Load main template
LOAD_TEMPLATE("admin_email_archiv");
-}
- else
-{
+} else {
// No mail orders fond
- OUTPUT_HTML("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");
+ LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_MAILS_IN_POOL);
}
//
?>
$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
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
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']);
// For bonus mails
if (!empty($SQL2)) $SQL2 .= $ADD;
-}
+} // END - if
// Run SQL query for normal mails
$result_list = SQL_QUERY($SQL, __FILE__, __LINE__);
// 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'] = "";
// 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("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");
-}
+ LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_MAILS_IN_POOL);
+} // END - if
//
?>
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; }
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'] = "???";
}
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?
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