Skip to content

Commit 63e13cb

Browse files
committed
updates migrating off global tf handler to the MyAdminApp class handler
1 parent a0fd570 commit 63e13cb

7 files changed

Lines changed: 14 additions & 14 deletions

bin/activate_fantastico.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<?php
33

44
require_once __DIR__.'/../../../../include/functions.inc.php';
5-
$GLOBALS['tf']->session->create(160308, 'services');
6-
$GLOBALS['tf']->session->verify();
5+
\MyAdmin\App::session()->create(160308, 'services');
6+
\MyAdmin\App::session()->verify();
77

88
activate_fantastico('66.23.229.238', 2);
99

10-
$GLOBALS['tf']->session->destroy();
10+
\MyAdmin\App::session()->destroy();

bin/fantastico_licenses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
print_r(get_fantastico_licenses());
77

8-
//$GLOBALS['tf']->session->destroy();
8+
//\MyAdmin\App::session()->destroy();

src/Plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function getChangeIp(GenericEvent $event)
7575
$event['status'] = 'error';
7676
$event['status_text'] = 'Error Code '.$result['faultcode'].': '.$result['fault'];
7777
} else {
78-
$GLOBALS['tf']->history->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
78+
\MyAdmin\App::history()->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
7979
$serviceClass->set_ip($event['newip'])->save();
8080
$event['status'] = 'ok';
8181
$event['status_text'] = 'The IP Address has been changed.';
@@ -90,7 +90,7 @@ public static function getChangeIp(GenericEvent $event)
9090
public static function getMenu(GenericEvent $event)
9191
{
9292
$menu = $event->getSubject();
93-
if ($GLOBALS['tf']->ima == 'admin') {
93+
if (\MyAdmin\App::ima() == 'admin') {
9494
$menu->add_link(self::$module, 'choice=none.reusable_fantastico', '/images/myadmin/replicate-rows.png', _('ReUsable Fantastico Licenses'));
9595
$menu->add_link(self::$module, 'choice=none.fantastico_list', '/images/myadmin/active-directory.png', _('Fantastico Licenses Breakdown'));
9696
$menu->add_link(self::$module.'api', 'choice=none.fantastico_licenses_list', '/images/myadmin/list.png', _('List all Fantastico Licenses'));

src/fantastico_licenses_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
function fantastico_licenses_list()
1313
{
14-
if ($GLOBALS['tf']->ima == 'admin') {
14+
if (\MyAdmin\App::ima() == 'admin') {
1515
$table = new \TFTable();
1616
$table->set_title('Fantastico License List');
1717
$header = false;

src/fantastico_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
function fantastico_list()
1313
{
14-
if ($GLOBALS['tf']->ima == 'admin') {
14+
if (\MyAdmin\App::ima() == 'admin') {
1515
page_title('Fantastico License List');
1616
add_output(render_form('fantastico_list'));
1717
}

src/reusable_fantastico.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
function reusable_fantastico()
2020
{
2121
page_title('ReUsable Fantastico Licenses');
22-
if ($GLOBALS['tf']->ima == 'admin') {
22+
if (\MyAdmin\App::ima() == 'admin') {
2323
$module = 'licenses';
2424
$serviceTypes = run_event('get_service_types', false, $module);
2525
$db = get_module_db($module);
2626
$settings = \get_module_settings($module);
2727
$fantastico = new Fantastico(FANTASTICO_USERNAME, FANTASTICO_PASSWORD);
2828
$ips = $fantastico->getIpList(Fantastico::ALL_TYPES);
2929
$frequency = 1;
30-
if (isset($GLOBALS['tf']->variables->request['add']) && $GLOBALS['tf']->variables->request['add'] == 1) {
31-
$ipAddress = $db->real_escape($GLOBALS['tf']->variables->request['ip']);
30+
if (isset(\MyAdmin\App::variables()->request['add']) && \MyAdmin\App::variables()->request['add'] == 1) {
31+
$ipAddress = $db->real_escape(\MyAdmin\App::variables()->request['ip']);
3232
if (in_array($ipAddress, $ips)) {
3333
$db->query("select * from {$settings['TABLE']} left join services on {$settings['PREFIX']}_type=services_id where services_module='{$module}' and services_category=".get_service_define('FANTASTICO')." and license_ip='{$ipAddress}'", __LINE__, __FILE__);
3434
if ($db->num_rows() == 0) {

tests/SourceFileAnalysisTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testLicensesListFileDefinesFunction(): void
300300
public function testLicensesListChecksAdmin(): void
301301
{
302302
$content = file_get_contents(self::$srcDir . '/fantastico_licenses_list.php');
303-
$this->assertStringContainsString("\$GLOBALS['tf']->ima == 'admin'", $content);
303+
$this->assertStringContainsString("\\MyAdmin\App::ima() == 'admin'", $content);
304304
}
305305

306306
/**
@@ -341,7 +341,7 @@ public function testListFileDefinesFunction(): void
341341
public function testListChecksAdmin(): void
342342
{
343343
$content = file_get_contents(self::$srcDir . '/fantastico_list.php');
344-
$this->assertStringContainsString("\$GLOBALS['tf']->ima == 'admin'", $content);
344+
$this->assertStringContainsString("\\MyAdmin\App::ima() == 'admin'", $content);
345345
}
346346

347347
/**
@@ -391,7 +391,7 @@ public function testReusableFileDefinesFunction(): void
391391
public function testReusableChecksAdmin(): void
392392
{
393393
$content = file_get_contents(self::$srcDir . '/reusable_fantastico.php');
394-
$this->assertStringContainsString("\$GLOBALS['tf']->ima == 'admin'", $content);
394+
$this->assertStringContainsString("\\MyAdmin\App::ima() == 'admin'", $content);
395395
}
396396

397397
/**

0 commit comments

Comments
 (0)