mambax7 /
xdonations
| 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 | use XoopsModules\Xdonations; |
||||||
| 20 | |||||||
| 21 | require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
||||||
| 22 | require_once __DIR__ . '/admin_header.php'; |
||||||
| 23 | |||||||
| 24 | xoops_loadLanguage('main', $xoopsModule->getVar('dirname')); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 25 | |||||||
| 26 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 27 | // require_once dirname(__DIR__) . '/class/Utility.php'; |
||||||
| 28 | |||||||
| 29 | xoops_cp_header(); |
||||||
|
0 ignored issues
–
show
The function
xoops_cp_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 30 | |||||||
| 31 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||||||
|
0 ignored issues
–
show
The type
Xmf\Module\Admin was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 32 | $adminObject->displayNavigation(basename(__FILE__)); |
||||||
| 33 | |||||||
| 34 | $txn_id = isset($_GET['txn_id']) ? $_GET['txn_id'] : null; |
||||||
| 35 | $txn_id = isset($_POST['txn_id']) ? $_POST['txn_id'] : $txn_id; |
||||||
| 36 | |||||||
| 37 | // display search box |
||||||
| 38 | $searchForm = new \XoopsThemeForm(_AD_XDONATION_SEARCH_FORM, 'searchform', $_SERVER['PHP_SELF'], 'post', true); |
||||||
|
0 ignored issues
–
show
The type
XoopsThemeForm was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 39 | $searchForm->addElement(new \XoopsFormText(_AD_XDONATION_SEARCH_TERM, 'txn_id', 20, 20)); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormText was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 40 | $buttonTray = new \XoopsFormElementTray(''); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormElementTray was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 41 | $sButton = new \XoopsFormButton('', 'search', _SEARCH, 'submit'); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormButton was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 42 | $buttonTray->addElement($sButton); |
||||||
| 43 | $searchForm->addElement($buttonTray); |
||||||
| 44 | $searchForm->display(); |
||||||
| 45 | |||||||
| 46 | if (isset($txn_id) && (0 != $txn_id)) { |
||||||
| 47 | //find the transaction in the database |
||||||
| 48 | $sql = 'SELECT id, item_name, item_number, custom, memo, option_name1, option_selection1,' |
||||||
| 49 | . ' option_name2, option_selection2, payer_id, mc_gross, mc_fee,' |
||||||
| 50 | . ' (mc_gross - mc_fee) as mc_net, mc_currency, payment_status, payment_date, txn_id, txn_type,' |
||||||
| 51 | . " payment_type, CONCAT(first_name,' ',last_name) AS full_name, payer_email, payer_status" |
||||||
| 52 | . ' FROM ' |
||||||
| 53 | . $xoopsDB->prefix('donations_transactions') |
||||||
| 54 | . " WHERE `txn_id` = '" |
||||||
| 55 | . addslashes($txn_id) |
||||||
| 56 | . "' LIMIT 1"; |
||||||
| 57 | |||||||
| 58 | $txnRecord = $xoopsDB->query($sql); |
||||||
| 59 | $row_txnRecord = $xoopsDB->fetchArray($txnRecord); //get the transaction |
||||||
| 60 | $txnForm = new \XoopsThemeForm(_AD_XDONATION_TXN_FORM, 'txnform', $_SERVER['PHP_SELF'], 'post', true); |
||||||
| 61 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_ID, $row_txnRecord['txn_id'])); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormLabel was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 62 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_PMNT_DATE, $row_txnRecord['payment_date'])); |
||||||
| 63 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_PMNT_TYPE, $row_txnRecord['payment_type'])); |
||||||
| 64 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_TYPE, $row_txnRecord['txn_type'])); |
||||||
| 65 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_ITEM_INFO, $row_txnRecord['item_name'] . ' [' . $row_txnRecord['item_number'] . ']')); |
||||||
| 66 | $custInfo = "<a href=\"mailto:{$row_txnRecord['payer_email']}?subject=PayPal%20TXN:%20{$row_txnRecord['txn_id']}\">{$row_txnRecord['full_name']}</a>"; |
||||||
| 67 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_CUST_NAME, $custInfo . ' (' . ucfirst($row_txnRecord['payer_status']) . ')')); |
||||||
| 68 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_CUST_ID, $row_txnRecord['payer_id'])); |
||||||
| 69 | if ('' != $row_txnRecord['option_name1']) { |
||||||
| 70 | $txnForm->addElement(new \XoopsFormLabel($row_txnRecord['option_name1'], $row_txnRecord['option_selection1'])); |
||||||
| 71 | } |
||||||
| 72 | if ('' != $row_txnRecord['option_name2']) { |
||||||
| 73 | $txnForm->addElement(new \XoopsFormLabel($row_txnRecord['option_name2'], $row_txnRecord['option_selection2'])); |
||||||
| 74 | } |
||||||
| 75 | $amount = $utility::defineCurrency($row_txnRecord['mc_currency']) |
||||||
| 76 | . $row_txnRecord['mc_gross'] |
||||||
| 77 | . ' (' |
||||||
| 78 | . $row_txnRecord['mc_currency'] |
||||||
| 79 | . ') ' |
||||||
| 80 | . _AD_XDONATION_GROSS |
||||||
| 81 | . '<br>' |
||||||
| 82 | . $utility::defineCurrency($row_txnRecord['mc_currency']) |
||||||
| 83 | . $row_txnRecord['mc_net'] |
||||||
| 84 | . ' (' |
||||||
| 85 | . $row_txnRecord['mc_currency'] |
||||||
| 86 | . ') ' |
||||||
| 87 | . _AD_XDONATION_NETBAL; |
||||||
| 88 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_AMOUNT, $amount)); |
||||||
| 89 | $txnForm->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_MEMO, $row_txnRecord['memo'])); |
||||||
| 90 | $txnForm->display(); |
||||||
| 91 | } else { |
||||||
| 92 | //list 10 most recent transactions in the database |
||||||
| 93 | $sql = 'SELECT id, item_name, item_number, custom, memo, option_name1, option_selection1,' |
||||||
| 94 | . ' (mc_gross - mc_fee) as mc_net, mc_currency, payment_status, payment_date, txn_id, txn_type,' |
||||||
| 95 | . " payment_type, CONCAT(first_name,' ',last_name) AS full_name, payer_email, payer_status" |
||||||
| 96 | . ' FROM ' |
||||||
| 97 | . $xoopsDB->prefix('donations_transactions') |
||||||
| 98 | // . " WHERE `test_ipn` = `0`" |
||||||
| 99 | . ' ORDER BY `payment_date` DESC' |
||||||
| 100 | . ' LIMIT 10'; |
||||||
| 101 | |||||||
| 102 | $txnRecords = $xoopsDB->query($sql); |
||||||
| 103 | /* |
||||||
| 104 | $txnRecordArray = $xoopsDB->fetchArray($txnRecords); //get the transaction |
||||||
| 105 | var_dump($txnRecordArray); |
||||||
| 106 | exit(); |
||||||
| 107 | */ |
||||||
| 108 | $allForm = new \XoopsThemeForm(_AD_XDONATION_TXN_RECENT_FORM, 'txnform', $_SERVER['PHP_SELF'], 'post', true); |
||||||
| 109 | while (false !== ($txnRecord = $xoopsDB->fetchArray($txnRecords))) { |
||||||
| 110 | // foreach ($txnRecordArray as $txnRecord) { |
||||||
| 111 | $thisTray = 'txnTray_' . $txnRecord['id']; |
||||||
| 112 | $$thisTray = new \XoopsFormElementTray($txnRecord['id'], '<br>', $txnRecord['id']); |
||||||
| 113 | $txnLink = "<a href=\"transaction.php?txn_id={$txnRecord['txn_id']}\">{$txnRecord['txn_id']}</a>"; |
||||||
| 114 | $$thisTray->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_ID, $txnLink)); |
||||||
| 115 | $$thisTray->addElement(new \XoopsFormLabel(_AD_XDONATION_PMNT_DATE, $txnRecord['payment_date'])); |
||||||
| 116 | $custInfo = "<a href=\"mailto:{$txnRecord['payer_email']}?subject=PayPal%20TXN:%20{$txnRecord['txn_id']}\">{$txnRecord['full_name']}</a>"; |
||||||
| 117 | $$thisTray->addElement(new \XoopsFormLabel(_AD_XDONATION_CUST_NAME, $custInfo . ' (' . ucfirst($txnRecord['payer_status']) . ')')); |
||||||
| 118 | $$thisTray->addElement(new \XoopsFormLabel(_AD_XDONATION_TXN_AMOUNT, $txnRecord['mc_net'] . ' (' . $txnRecord['mc_currency'] . ')')); |
||||||
| 119 | $allForm->addElement($$thisTray); |
||||||
| 120 | } |
||||||
| 121 | $allForm->display(); |
||||||
| 122 | } |
||||||
| 123 | require_once __DIR__ . '/admin_footer.php'; |
||||||
| 124 |