Skip to content

Commit c4ecb6e

Browse files
committed
updates migrating off global tf handler to the MyAdminApp class handler
1 parent 439c7c0 commit c4ecb6e

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Plugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static function getActivate(GenericEvent $event)
8787
if (!is_array($response) || !in_array($event['field1'], array_values($response))) {
8888
$response = $cl->license($serviceClass->getIp(), $event['field1']);
8989
//$serviceExtra = $response['mainKeyNumber'].','.$response['productKey'];
90-
request_log(self::$module, $GLOBALS['tf']->session->account_id, __FUNCTION__, 'cloudlinux', 'license', [$serviceClass->getIp(), $event['field1']], $response, $serviceClass->getId());
90+
request_log(self::$module, \MyAdmin\App::session()->account_id, __FUNCTION__, 'cloudlinux', 'license', [$serviceClass->getIp(), $event['field1']], $response, $serviceClass->getId());
9191
myadmin_log(self::$module, 'info', 'Response: '.json_encode($response), __LINE__, __FILE__, self::$module, $serviceClass->getId());
9292
if ($response === false) {
9393
$event['status'] = 'error';
@@ -164,7 +164,7 @@ public static function getChangeIp(GenericEvent $event)
164164
}
165165
}
166166
if ($event['status'] == 'ok') {
167-
$GLOBALS['tf']->history->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
167+
\MyAdmin\App::history()->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
168168
$serviceClass->set_ip($event['newip'])->save();
169169
}
170170
$event->stopPropagation();
@@ -177,7 +177,7 @@ public static function getChangeIp(GenericEvent $event)
177177
public static function getMenu(GenericEvent $event)
178178
{
179179
$menu = $event->getSubject();
180-
if ($GLOBALS['tf']->ima == 'admin') {
180+
if (\MyAdmin\App::ima() == 'admin') {
181181
$menu->add_link(self::$module.'api', 'choice=none.cloudlinux_licenses_list', '/images/myadmin/list.png', _('List all CloudLinux Licenses'));
182182
}
183183
}

src/cloudlinux_licenses_list.php

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

1515
function cloudlinux_licenses_list()
1616
{
17-
if ($GLOBALS['tf']->ima == 'admin') {
17+
if (\MyAdmin\App::ima() == 'admin') {
1818
$table = new \TFTable();
1919
$table->set_title('CloudLinux License List');
2020
$header = false;

tests/SourceFileAnalysisTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testLicensesListFileDefinesFunction(): void
138138
public function testLicensesListChecksAdminAccess(): void
139139
{
140140
$content = file_get_contents($this->srcDir . '/cloudlinux_licenses_list.php');
141-
$this->assertStringContainsString("\$GLOBALS['tf']->ima == 'admin'", $content);
141+
$this->assertStringContainsString("\\MyAdmin\App::ima() == 'admin'", $content);
142142
}
143143

144144
/**

0 commit comments

Comments
 (0)