Skip to content

Commit fe6b883

Browse files
committed
updates migrating off global tf handler to the MyAdminApp class handler
1 parent c3b66f5 commit fe6b883

25 files changed

Lines changed: 264 additions & 264 deletions

bin/decrypt_ccs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$account = new Accounts_Ext($db2);
1717
$db->query("select * from accounts_ext where account_key='cc' and account_value like '%/./%'");
1818
while ($db->next_record(MYSQL_ASSOC)) {
19-
$cc = $GLOBALS['tf']->decrypt_old($db->Record['account_value']);
19+
$cc = \MyAdmin\App::decryptOld($db->Record['account_value']);
2020
if ($cc != $db->Record['account_value']) {
2121
$query = "update accounts_ext set account_value='".$db2->real_escape($cc)."' where account_key='cc' and account_id={$db->Record['account_id']}";
2222
echo "$query\n";
@@ -30,7 +30,7 @@
3030
$changed = false;
3131
foreach ($ccs as $cc_idx => $data) {
3232
if (isset($data['cc'])) {
33-
$ccs[$cc_idx]['cc'] = $GLOBALS['tf']->decrypt_old($data['cc']);
33+
$ccs[$cc_idx]['cc'] = \MyAdmin\App::decryptOld($data['cc']);
3434
$changed = true;
3535
}
3636
}

bin/fix_double_encrypted_ccs.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
require_once __DIR__.'/../../include/functions.inc.php';
1313
//include(INCLUDE_ROOT.'/billing.functions.inc.php');
1414

15-
$db = $GLOBALS['tf']->db;
15+
$db = \MyAdmin\App::db();
1616
$db2 = clone $db;
1717
$db->query("select * from accounts_ext where account_key='cc' and length(account_value) > 27");
1818
while ($db->next_record(MYSQL_ASSOC)) {
1919
$cc = $db->Record['account_value'];
20-
while ($cc != $GLOBALS['tf']->decrypt($cc)) {
21-
$cc = $GLOBALS['tf']->decrypt($cc);
20+
while ($cc != \MyAdmin\App::decrypt($cc)) {
21+
$cc = \MyAdmin\App::decrypt($cc);
2222
}
2323
$cc = str_replace(['-', ' '], ['', ''], $cc);
24-
$db2->query("update accounts_ext set account_value='".$db2->real_escape($GLOBALS['tf']->encrypt($cc))."' where account_key='cc' and account_id={$db->Record['account_id']}");
24+
$db2->query("update accounts_ext set account_value='".$db2->real_escape(\MyAdmin\App::encrypt($cc))."' where account_key='cc' and account_id={$db->Record['account_id']}");
2525
}

bin/parse_cc_charges.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
require_once __DIR__.'/../../include/functions.inc.php';
1313
$webpage = false;
1414
define('VERBOSE_MODE', false);
15-
$db = $GLOBALS['tf']->db;
15+
$db = \MyAdmin\App::db();
1616
$db2 = get_module_db('vps');
1717
function_requirements('charge_card');
1818
function_requirements('auth_charge_card');

bin/rebuild_cc_log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
$gb = 1073741824;
88
ini_set('memory_limit', 4*$gb);
99
$taken = [];
10-
$db = clone $GLOBALS['tf']->db;
10+
$db = clone \MyAdmin\App::db();
1111
$db->query('select concat(cc_custid, cc_timestamp, cc_request_amount) as cc_token from cc_log', __LINE__, __FILE__);
1212
while ($db->next_record(MYSQL_ASSOC)) {
1313
$taken[] = $db->Record['cc_token'];
1414
}
1515
unset($db);
16-
$db = $GLOBALS['tf']->db;
16+
$db = \MyAdmin\App::db();
1717
$results = json_decode(file_get_contents(__DIR__.'/cc_charge_results.json'), true);
1818
echo 'Loaded ' . count($results) . " Results\n";
1919
$requests = json_decode(file_get_contents(__DIR__.'/cc_charge_requests.json'), true);
@@ -42,7 +42,7 @@
4242
if ($lid == $rlid && abs($rtime - $time) < 60) {
4343
$combined = array_merge($request, $result);
4444
$combined['cc_timestamp'] = $combined['date'];
45-
$combined['cc_custid'] = intval($GLOBALS['tf']->accounts->cross_reference($combined['lid']));
45+
$combined['cc_custid'] = intval(\MyAdmin\App::accounts()->cross_reference($combined['lid']));
4646
unset($combined['date'], $combined['lid']);
4747
if ($instant_queries == true) {
4848
if (!in_array($combined['cc_custid'].$combined['cc_timestamp'].$combined['cc_request_amount'], $taken)) {

bin/rebuild_cc_maxlengths.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
ini_set('memory_limit', 4*$gb);
55
include_once __DIR__.'/../../include/functions.inc.php';
66
$taken = [];
7-
$db = clone $GLOBALS['tf']->db;
7+
$db = clone \MyAdmin\App::db();
88
$db->query('select concat(cc_custid, cc_timestamp, cc_request_amount) as cc_token from cc_log', __LINE__, __FILE__);
99
while ($db->next_record(MYSQL_ASSOC)) {
1010
$taken[] = $db->Record['cc_token'];
1111
}
1212
unset($db);
13-
$db = $GLOBALS['tf']->db;
13+
$db = \MyAdmin\App::db();
1414
$results = json_decode(file_get_contents(__DIR__.'/cc_charge_results.json'), true);
1515
echo 'Loaded ' . count($results) . " Results\n";
1616
$requests = json_decode(file_get_contents(__DIR__.'/cc_charge_requests.json'), true);
@@ -34,7 +34,7 @@
3434
if ($lid == $rlid && abs($rtime - $time) < 60) {
3535
$combined = array_merge($request, $result);
3636
$combined['cc_timestamp'] = $combined['date'];
37-
$combined['cc_custid'] = intval($GLOBALS['tf']->accounts->cross_reference($combined['lid']));
37+
$combined['cc_custid'] = intval(\MyAdmin\App::accounts()->cross_reference($combined['lid']));
3838
unset($combined['date'], $combined['lid']);
3939
foreach ($combined as $field => $value) {
4040
$length = mb_strlen($value);

bin/recrypt_cc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
$account = new Accounts_Ext($db2);
1717
$db->query("select * from accounts_ext where account_key='cc' and account_value like '%/./%' and length(account_value) <= 30");
1818
while ($db->next_record(MYSQL_ASSOC)) {
19-
$cc = $GLOBALS['tf']->decrypt($db->Record['account_value']);
19+
$cc = \MyAdmin\App::decrypt($db->Record['account_value']);
2020
if ($cc !== false && $cc != $db->Record['account_value']) {
21-
$query = "update accounts_ext set account_value='".$db2->real_escape($GLOBALS['tf']->encrypt($cc))."' where account_key='cc' and account_id={$db->Record['account_id']}";
21+
$query = "update accounts_ext set account_value='".$db2->real_escape(\MyAdmin\App::encrypt($cc))."' where account_key='cc' and account_id={$db->Record['account_id']}";
2222
echo "$query\n";
2323
$db2->query($query);
2424
}

bin/recrypt_cc_log.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
$db->query("select * from cc_log where cc_request_card_num like '/./%'");
1818
while ($db->next_record(MYSQL_ASSOC)) {
1919
$updates = [];
20-
$cc = $GLOBALS['tf']->decrypt($db->Record['cc_request_card_num']);
20+
$cc = \MyAdmin\App::decrypt($db->Record['cc_request_card_num']);
2121
if ($cc !== false) {
22-
$query = "update cc_log set cc_request_card_num='".$db->real_escape($GLOBALS['tf']->encrypt($GLOBALS['tf']->decrypt($db->Record['cc_request_card_num'])))."' where cc_id={$db->Record['cc_id']}";
22+
$query = "update cc_log set cc_request_card_num='".$db->real_escape(\MyAdmin\App::encrypt(\MyAdmin\App::decrypt($db->Record['cc_request_card_num'])))."' where cc_id={$db->Record['cc_id']}";
2323
echo "$query\n";
2424
$db2->query($query);
2525
}

bin/recrypt_ccs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
$changed = false;
2222
foreach ($ccs as $cc_idx => $data) {
2323
if (isset($data['cc'])) {
24-
$cc = $GLOBALS['tf']->decrypt($data['cc']);
24+
$cc = \MyAdmin\App::decrypt($data['cc']);
2525
if ($cc !== false) {
26-
$ccs[$cc_idx]['cc'] = $GLOBALS['tf']->encrypt($cc);
26+
$ccs[$cc_idx]['cc'] = \MyAdmin\App::encrypt($cc);
2727
$changed = true;
2828
}
2929
}

bin/recrypt_history.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
while ($db->next_record(MYSQL_ASSOC)) {
1919
$updates = [];
2020
if (substr($db->Record['history_old_value'], 0, 3) == '/./') {
21-
$cc = $GLOBALS['tf']->decrypt_old($db->Record['history_old_value']);
22-
$cc = $GLOBALS['tf']->encrypt($cc);
21+
$cc = \MyAdmin\App::decryptOld($db->Record['history_old_value']);
22+
$cc = \MyAdmin\App::encrypt($cc);
2323
$updates[] = "history_old_value='".$db->real_escape($cc)."'";
2424
}
2525
if (substr($db->Record['history_new_value'], 0, 3) == '/./') {
26-
$cc = $GLOBALS['tf']->decrypt_old($db->Record['history_new_value']);
27-
$cc = $GLOBALS['tf']->encrypt($cc);
26+
$cc = \MyAdmin\App::decryptOld($db->Record['history_new_value']);
27+
$cc = \MyAdmin\App::encrypt($cc);
2828
$updates[] = "history_new_value='".$db->real_escape($cc)."'";
2929
}
3030
if (sizeof($updates) > 0) {

src/AuthorizeNetCC.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function refund($cc_num, $trans_id, $amount, $custid)
8383
}
8484
}
8585
if ($tresponse['0'] == 1) {
86-
$db = clone $GLOBALS['tf']->db;
86+
$db = clone \MyAdmin\App::db();
8787
$db->query(make_insert_query('cc_log', $cc_log), __LINE__, __FILE__);
8888
}
8989

@@ -148,7 +148,7 @@ public function voidTransaction($trans_id, $cc_num, $custid)
148148
unset($cc_log['cc_request_trans_id']);
149149
}
150150
if ($tresponse['0'] == 1) {
151-
$db = clone $GLOBALS['tf']->db;
151+
$db = clone \MyAdmin\App::db();
152152
$db->query(make_insert_query('cc_log', $cc_log), __LINE__, __FILE__);
153153
}
154154

0 commit comments

Comments
 (0)