X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fmodules%2Fadmin%2Fwhat-del_transfer.php;h=acc7054d03ec474c72f20e84e7fcf4021efea829;hb=3c311675e341584ad25c561a5a65198f3717125f;hp=0f1b92788eda977fccf5ced8472938535f1bf3c0;hpb=ec0b7816cd0d6f0bcda7a924203bd7fcc6a89b50;p=mailer.git diff --git a/inc/modules/admin/what-del_transfer.php b/inc/modules/admin/what-del_transfer.php index 0f1b92788e..acc7054d03 100644 --- a/inc/modules/admin/what-del_transfer.php +++ b/inc/modules/admin/what-del_transfer.php @@ -1,7 +1,7 @@ 0) - { + if (ifPostContainsSelections()) { + // Init SQLs + initSqls(); + // Delete entries... - foreach ($_POST['sel'] as $id => $sel) - { - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_in WHERE trans_id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_out WHERE trans_id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - } - } -} + foreach (postRequestElement('sel') as $id => $sel) { + addSql(SQL_QUERY_ESC('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `trans_id`=%s LIMIT 1', + array(bigintval($id)), __FILE__, __LINE__, false)); + addSql(SQL_QUERY_ESC('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `trans_id`=%s LIMIT 1', + array(bigintval($id)), __FILE__, __LINE__, false)); + } // END - foreach + + // Run all SQLs + runFilterChain('run_sqls'); + } // END - if +} // END - if // We only need outgoing transfers -$result = SQL_QUERY("SELECT userid, to_uid, trans_id, points, reason, time_trans FROM "._MYSQL_PREFIX."_user_transfers_out ORDER BY trans_id", __FILE__, __LINE__); -$total = 0; -if (SQL_NUMROWS($result) > 0) -{ +$result = SQL_QUERY('SELECT + `userid` AS `from_userid`,`to_userid`,`trans_id`,`points`,`reason`,`time_trans` +FROM + `{?_MYSQL_PREFIX?}_user_transfers_out` +ORDER BY + `trans_id` ASC', __FILE__, __LINE__); + +$total = '0'; +if (!SQL_HASZERONUMS($result)) { // Output rows - $OUT = ""; $SW = 2; - while(list($uid1, $uid2, $idx, $points, $reason, $stamp) = SQL_FETCHROW($result)) - { + $OUT = ''; + while ($content = SQL_FETCHARRAY($result)) { // Prepare data for the row template - $content = array( - 'sw' => $SW, - 'idx' => $idx, - 'stamp' => MAKE_DATETIME($stamp, "3"), - 'uid_from' => ADMIN_USER_PROFILE_LINK($uid1), - 'uid_to' => ADMIN_USER_PROFILE_LINK($uid1), - 'reason' => $reason, - 'points' => TRANSLATE_COMMA($points), - ); + $content['time_trans'] = generateDateTime($content['time_trans'], 3); // Load row template - $OUT .= LOAD_TEMPLATE("admin_del_transfer_row", true, $content); + $OUT .= loadTemplate('admin_delete_transfer_row', true, $content); // Sum points and switch colors - $total += $points; $SW = 3 - $SW; - } + $total += $content['points']; + } // END - while // Free memory SQL_FREERESULT($result); -} - else -{ +} else { // Nothing for in and out - $OUT = "