|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Transaction Details |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* This program is distributed in the hope that it will be useful, |
|
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
* |
|
12
|
|
|
* @package :: xdonations |
|
13
|
|
|
* @subpackage:: admin |
|
14
|
|
|
* @author :: zyspec ([email protected]) |
|
15
|
|
|
* @license :: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
|
16
|
|
|
* @since :: File available since version 1.96 |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
include_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
|
20
|
|
|
include_once __DIR__ . '/admin_header.php'; |
|
21
|
|
|
|
|
22
|
|
|
xoops_loadLanguage('main', $xoopsModule->getVar('dirname')); |
|
23
|
|
|
|
|
24
|
|
|
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
25
|
|
|
include dirname(__DIR__) . '/include/functions.php'; |
|
26
|
|
|
|
|
27
|
|
|
xoops_cp_header(); |
|
28
|
|
|
//adminmain(); |
|
29
|
|
|
|
|
30
|
|
|
$indexAdmin = new ModuleAdmin(); |
|
31
|
|
|
echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
32
|
|
|
|
|
33
|
|
|
$txn_id = isset($_GET['txn_id']) ? $_GET['txn_id'] : null; |
|
34
|
|
|
$txn_id = isset($_POST['txn_id']) ? $_POST['txn_id'] : $txn_id; |
|
35
|
|
|
|
|
36
|
|
|
// display search box |
|
37
|
|
|
$searchForm = new XoopsThemeForm(_AD_DON_SEARCH_FORM, 'searchform', $_SERVER['PHP_SELF'], 'POST'); |
|
38
|
|
|
$searchForm->addElement(new XoopsFormText(_AD_DON_SEARCH_TERM, 'txn_id', 20, 20)); |
|
39
|
|
|
$buttonTray = new XoopsFormElementTray(''); |
|
40
|
|
|
$sButton = new XoopsFormButton('', 'search', _SEARCH, 'submit'); |
|
41
|
|
|
$buttonTray->addElement($sButton); |
|
42
|
|
|
$searchForm->addElement($buttonTray); |
|
43
|
|
|
$searchForm->display(); |
|
44
|
|
|
|
|
45
|
|
|
if (isset($txn_id) && ($txn_id != 0)) { |
|
46
|
|
|
//find the transaction in the database |
|
47
|
|
|
$sql = 'SELECT id, item_name, item_number, custom, memo, option_name1, option_selection1,' . ' option_name2, option_selection2, payer_id, mc_gross, mc_fee,' . ' (mc_gross - mc_fee) as mc_net, mc_currency, payment_status, payment_date, txn_id, txn_type,' . " payment_type, CONCAT(first_name,' ',last_name) AS full_name, payer_email, payer_status" . ' FROM ' . $xoopsDB->prefix('donations_transactions') . " WHERE `txn_id` = '" . addslashes($txn_id) . "' LIMIT 1"; |
|
48
|
|
|
|
|
49
|
|
|
$txnRecord = $xoopsDB->query($sql); |
|
50
|
|
|
$row_txnRecord = $xoopsDB->fetchArray($txnRecord); //get the transaction |
|
51
|
|
|
$txnForm = new XoopsThemeForm(_AD_DON_TXN_FORM, 'txnform', $_SERVER['PHP_SELF'], 'POST'); |
|
52
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_TXN_ID, $row_txnRecord['txn_id'])); |
|
53
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_PMNT_DATE, $row_txnRecord['payment_date'])); |
|
54
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_PMNT_TYPE, $row_txnRecord['payment_type'])); |
|
55
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_TXN_TYPE, $row_txnRecord['txn_type'])); |
|
56
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_ITEM_INFO, $row_txnRecord['item_name'] . ' [' . $row_txnRecord['item_number'] . ']')); |
|
57
|
|
|
$custInfo = "<a href=\"mailto:{$row_txnRecord['payer_email']}?subject=PayPal%20TXN:%20{$row_txnRecord['txn_id']}\">{$row_txnRecord['full_name']}</a>"; |
|
58
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_CUST_NAME, $custInfo . ' (' . ucfirst($row_txnRecord['payer_status']) . ')')); |
|
59
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_CUST_ID, $row_txnRecord['payer_id'])); |
|
60
|
|
|
if ('' != $row_txnRecord['option_name1']) { |
|
61
|
|
|
$txnForm->addElement(new XoopsFormLabel($row_txnRecord['option_name1'], $row_txnRecord['option_selection1'])); |
|
62
|
|
|
} |
|
63
|
|
|
if ('' != $row_txnRecord['option_name2']) { |
|
64
|
|
|
$txnForm->addElement(new XoopsFormLabel($row_txnRecord['option_name2'], $row_txnRecord['option_selection2'])); |
|
65
|
|
|
} |
|
66
|
|
|
$amount = defineCurrency($row_txnRecord['mc_currency']) . $row_txnRecord['mc_gross'] . ' (' . $row_txnRecord['mc_currency'] . ') ' . _AD_DON_GROSS . '<br />' . defineCurrency($row_txnRecord['mc_currency']) . $row_txnRecord['mc_net'] . ' (' . $row_txnRecord['mc_currency'] . ') ' . _AD_DON_NETBAL; |
|
67
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_TXN_AMOUNT, $amount)); |
|
68
|
|
|
$txnForm->addElement(new XoopsFormLabel(_AD_DON_TXN_MEMO, $row_txnRecord['memo'])); |
|
69
|
|
|
$txnForm->display(); |
|
70
|
|
|
} else { |
|
71
|
|
|
//list 10 most recent transactions in the database |
|
72
|
|
|
$sql = 'SELECT id, item_name, item_number, custom, memo, option_name1, option_selection1,' . ' (mc_gross - mc_fee) as mc_net, mc_currency, payment_status, payment_date, txn_id, txn_type,' . " payment_type, CONCAT(first_name,' ',last_name) AS full_name, payer_email, payer_status" . ' FROM ' . $xoopsDB->prefix('donations_transactions') // . " WHERE `test_ipn` = `0`" |
|
73
|
|
|
. ' ORDER BY `payment_date` DESC' . ' LIMIT 10'; |
|
74
|
|
|
|
|
75
|
|
|
$txnRecords = $xoopsDB->query($sql); |
|
76
|
|
|
/* |
|
|
|
|
|
|
77
|
|
|
$txnRecordArray = $xoopsDB->fetchArray($txnRecords); //get the transaction |
|
78
|
|
|
var_dump($txnRecordArray); |
|
79
|
|
|
exit(); |
|
80
|
|
|
*/ |
|
81
|
|
|
$allForm = new XoopsThemeForm(_AD_DON_TXN_RECENT_FORM, 'txnform', $_SERVER['PHP_SELF'], 'POST'); |
|
82
|
|
|
while (false != ($txnRecord = $xoopsDB->fetchArray($txnRecords))) { |
|
83
|
|
|
// foreach ($txnRecordArray as $txnRecord) { |
|
|
|
|
|
|
84
|
|
|
$thisTray = 'txnTray_' . $txnRecord['id']; |
|
85
|
|
|
$$thisTray = new XoopsFormElementTray($txnRecord['id'], '<br />', $txnRecord['id']); |
|
86
|
|
|
$txnLink = "<a href=\"transaction.php?txn_id={$txnRecord['txn_id']}\">{$txnRecord['txn_id']}</a>"; |
|
87
|
|
|
$$thisTray->addElement(new XoopsFormLabel(_AD_DON_TXN_ID, $txnLink)); |
|
88
|
|
|
$$thisTray->addElement(new XoopsFormLabel(_AD_DON_PMNT_DATE, $txnRecord['payment_date'])); |
|
89
|
|
|
$custInfo = "<a href=\"mailto:{$txnRecord['payer_email']}?subject=PayPal%20TXN:%20{$txnRecord['txn_id']}\">{$txnRecord['full_name']}</a>"; |
|
90
|
|
|
$$thisTray->addElement(new XoopsFormLabel(_AD_DON_CUST_NAME, $custInfo . ' (' . ucfirst($txnRecord['payer_status']) . ')')); |
|
91
|
|
|
$$thisTray->addElement(new XoopsFormLabel(_AD_DON_TXN_AMOUNT, $txnRecord['mc_net'] . ' (' . $txnRecord['mc_currency'] . ')')); |
|
92
|
|
|
$allForm->addElement($$thisTray); |
|
93
|
|
|
} |
|
94
|
|
|
$allForm->display(); |
|
95
|
|
|
} |
|
96
|
|
|
include_once __DIR__ . '/admin_footer.php'; |
|
97
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.