Skip to content

Commit 17bae33

Browse files
committed
updates migrating off global tf handler to the MyAdminApp class handler
1 parent 7eb298b commit 17bae33

17 files changed

Lines changed: 84 additions & 84 deletions

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function getHooks()
4141
public static function getMenu(GenericEvent $event)
4242
{
4343
$menu = $event->getSubject();
44-
if ($GLOBALS['tf']->ima == 'admin') {
44+
if (\MyAdmin\App::ima() == 'admin') {
4545
function_requirements('has_acl');
4646
if (has_acl('client_billing')) {
4747
}

src/webuzo.functions.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function webuzo_add_backup($host, $user, $pass, $install_id)
2525
{
2626
include_once __DIR__.'/webuzo_sdk.php';
2727
add_output('<h2>Create Backup</h2>');
28-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
28+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
2929
$act = 'backup';
3030
$last_params = "&insid=$install_id";
3131
$post = [
@@ -54,7 +54,7 @@ function webuzo_add_backup($host, $user, $pass, $install_id)
5454
function webuzo_download_backup($host, $user, $pass, $back_up_name)
5555
{
5656
include_once __DIR__.'/webuzo_sdk.php';
57-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
57+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
5858
$new = new Webuzo_API($user, $pass, $host);
5959
$new->download_backup($back_up_name, '/home/my/public_html/webuzo_file_downloads/');
6060
$file = "/home/my/public_html/webuzo_file_downloads/$back_up_name";
@@ -80,7 +80,7 @@ function webuzo_download_backup($host, $user, $pass, $back_up_name)
8080
function webuzo_remove_backup($host, $user, $pass, $back_up_name)
8181
{
8282
include_once __DIR__.'/webuzo_sdk.php';
83-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
83+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
8484
$act = 'backups';
8585
$last_params = "&remove=$back_up_name";
8686
$post = [
@@ -109,7 +109,7 @@ function webuzo_remove_backup($host, $user, $pass, $back_up_name)
109109
function webuzo_restore_backup($host, $user, $pass, $back_up_name)
110110
{
111111
include_once __DIR__.'/webuzo_sdk.php';
112-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
112+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
113113
$act = 'restore';
114114
$last_params = "&restore=$back_up_name";
115115
$post = [

src/webuzo_add_domain.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ function webuzo_add_domain($host=null, $user=null, $pass=null)
1111
{
1212
include_once __DIR__.'/webuzo_sdk.php';
1313
add_output('<h2>Add Domain</h2>');
14-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
15-
if (isset($GLOBALS['tf']->variables->request['domain']) && verify_csrf_referrer(__LINE__, __FILE__)) {
14+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
15+
if (isset(\MyAdmin\App::variables()->request['domain']) && verify_csrf_referrer(__LINE__, __FILE__)) {
1616
$service = get_service($vps_id, 'vps');
1717
$db = get_module_db('vps');
1818
$query = "select * from history_log where history_owner = '{$service['vps_custid']}' and history_old_value = 'Webuzo Details'";
@@ -24,8 +24,8 @@ function webuzo_add_domain($host=null, $user=null, $pass=null)
2424
$pass = $db->Record['history_new_value'];
2525
}
2626
}
27-
$domain = $GLOBALS['tf']->variables->request['domain'];
28-
$domain_path = $GLOBALS['tf']->variables->request['domain_path'];
27+
$domain = \MyAdmin\App::variables()->request['domain'];
28+
$domain_path = \MyAdmin\App::variables()->request['domain_path'];
2929
$new = new Webuzo_API($user, $pass, $host);
3030
$res = $new->add_domain($domain, $domain_path);
3131
$res = myadmin_unstringify($res);

src/webuzo_configure.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
function webuzo_configure($id)
88
{
99
include_once __DIR__.'/webuzo_sdk.php';
10-
if (isset($GLOBALS['tf']->variables->request['vps_id'])) {
11-
$id = $GLOBALS['tf']->variables->request['vps_id'];
10+
if (isset(\MyAdmin\App::variables()->request['vps_id'])) {
11+
$id = \MyAdmin\App::variables()->request['vps_id'];
1212
}
1313
$service = get_service($id, 'vps');
1414
if (!$id) {
@@ -19,7 +19,7 @@ function_requirements('webuzo_update_logo');
1919
$logo_update_resp = webuzo_update_logo($service['vps_ip']);
2020
$msg = (!empty($logo_update_resp)) ? 'Title change is completed successfully!' : 'Failed! Title change is not completed failed';
2121
myadmin_log('vps', 'info', $msg, __LINE__, __FILE__);
22-
$email = $GLOBALS['tf']->accounts->cross_reference($service['vps_custid']);
22+
$email = \MyAdmin\App::accounts()->cross_reference($service['vps_custid']);
2323
$ns1 = 'cdns1.interserver.net';
2424
$ns2 = 'cdns2.interserver.net';
2525

@@ -62,17 +62,17 @@ function_requirements('webuzo_randomPassword');
6262

6363
if (isset($res['done'])) {
6464
if ($db->num_rows() == 0) {
65-
$GLOBALS['tf']->history->add('vps', 'webuzo_pass', $pass, 'Webuzo Details');
65+
\MyAdmin\App::history()->add('vps', 'webuzo_pass', $pass, 'Webuzo Details');
6666
myadmin_log('vps', 'info', "Webuzo password added to history_log successfully! for {$email} for vps id {$service['vps_ip']}", __LINE__, __FILE__);
6767
} else {
6868
$data['history_new_value'] = $pass;
6969
$db->next_record(MYSQL_ASSOC);
7070
$history_id = $db->Record['history_id'];
71-
$GLOBALS['tf']->history->update($history_id, $data);
71+
\MyAdmin\App::history()->update($history_id, $data);
7272
myadmin_log('vps', 'info', "Webuzo password updated to history_log id - {$history_id} successfully! for {$email} for vps id {$service['vps_ip']}", __LINE__, __FILE__);
7373
}
7474
$url = 'https://my.interserver.net/index.php?choice=none.view_vps&id='.$id;
75-
$data = $GLOBALS['tf']->accounts->read($service['vps_custid']);
75+
$data = \MyAdmin\App::accounts()->read($service['vps_custid']);
7676
$smartyE = new TFSmarty();
7777
$smartyE->assign('name', $data['name']);
7878
$smartyE->assign('vps_url', $url);

src/webuzo_edit_installation.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
function webuzo_edit_installation($host, $user, $pass, $installation_id)
1212
{
1313
include_once __DIR__.'/webuzo_sdk.php';
14-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
15-
if (isset($GLOBALS['tf']->variables->request['installation_id'])) {
16-
$installation_id = $GLOBALS['tf']->variables->request['installation_id'];
14+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
15+
if (isset(\MyAdmin\App::variables()->request['installation_id'])) {
16+
$installation_id = \MyAdmin\App::variables()->request['installation_id'];
1717
}
1818
$act = 'editdetail';
1919
$last_params = "&insid=$installation_id";
2020
function_requirements('webuzo_api_call');
2121
$response = webuzo_api_call($host, $user, $pass, $act, $last_params);
2222
$response = myadmin_unstringify($response);
2323
add_output('<h2>Edit Installation Details</h2>');
24-
if (isset($GLOBALS['tf']->variables->request['editins']) && verify_csrf_referrer(__LINE__, __FILE__)) {
24+
if (isset(\MyAdmin\App::variables()->request['editins']) && verify_csrf_referrer(__LINE__, __FILE__)) {
2525
$service = get_service($vps_id, 'vps');
2626
$db = get_module_db('vps');
2727
$query = "select * from history_log where history_owner = '{$service['vps_custid']}' and history_old_value = 'Webuzo Details'";
@@ -34,13 +34,13 @@ function_requirements('webuzo_api_call');
3434
}
3535
}
3636
$post = [
37-
'editins' => $GLOBALS['tf']->variables->request['editins'],
38-
'edit_dir' => $GLOBALS['tf']->variables->request['edit_dir'], // Must be the path to installation
39-
'edit_url' => $GLOBALS['tf']->variables->request['edit_url'], // Must be the URL to installation
40-
'edit_dbname' => $GLOBALS['tf']->variables->request['edit_dbname'],
41-
'edit_dbuser' => $GLOBALS['tf']->variables->request['edit_dbuser'],
42-
'edit_dbpass' => $GLOBALS['tf']->variables->request['edit_dbpass'],
43-
'edit_dbhost' => $GLOBALS['tf']->variables->request['edit_dbhost']
37+
'editins' => \MyAdmin\App::variables()->request['editins'],
38+
'edit_dir' => \MyAdmin\App::variables()->request['edit_dir'], // Must be the path to installation
39+
'edit_url' => \MyAdmin\App::variables()->request['edit_url'], // Must be the URL to installation
40+
'edit_dbname' => \MyAdmin\App::variables()->request['edit_dbname'],
41+
'edit_dbuser' => \MyAdmin\App::variables()->request['edit_dbuser'],
42+
'edit_dbpass' => \MyAdmin\App::variables()->request['edit_dbpass'],
43+
'edit_dbhost' => \MyAdmin\App::variables()->request['edit_dbhost']
4444
];
4545

4646
$response_update = webuzo_api_call($host, $user, $pass, $act, $last_params, $post);

src/webuzo_import_script.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
function webuzo_import_script($host, $user, $pass, $script_id)
1010
{
1111
include_once __DIR__.'/webuzo_sdk.php';
12-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
13-
if (isset($GLOBALS['tf']->variables->request['soft'])) {
14-
$host = $GLOBALS['tf']->variables->request['host'] ?? '';
15-
$user = $GLOBALS['tf']->variables->request['user'] ?? '';
16-
$pass = $GLOBALS['tf']->variables->request['pass'] ?? '';
17-
$script_id = $GLOBALS['tf']->variables->request['soft'];
12+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
13+
if (isset(\MyAdmin\App::variables()->request['soft'])) {
14+
$host = \MyAdmin\App::variables()->request['host'] ?? '';
15+
$user = \MyAdmin\App::variables()->request['user'] ?? '';
16+
$pass = \MyAdmin\App::variables()->request['pass'] ?? '';
17+
$script_id = \MyAdmin\App::variables()->request['soft'];
1818
$act = 'import';
1919
$last_params = "&soft=$script_id";
2020
$post = [
21-
'softsubmit' => $GLOBALS['tf']->variables->request['softsubmit'],
22-
'softdomain' =>$GLOBALS['tf']->variables->request['softdomain'],
23-
'softdirectory' =>$GLOBALS['tf']->variables->request['softdirectory']
21+
'softsubmit' => \MyAdmin\App::variables()->request['softsubmit'],
22+
'softdomain' =>\MyAdmin\App::variables()->request['softdomain'],
23+
'softdirectory' =>\MyAdmin\App::variables()->request['softdirectory']
2424
];
2525
function_requirements('webuzo_api_call');
2626
$response = webuzo_api_call($host, $user, $pass, $act, $last_params, $post);

src/webuzo_install_sysapp.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
function webuzo_install_sysapp($host, $user, $pass, $app_id)
1010
{
1111
include_once __DIR__.'/webuzo_sdk.php';
12-
if (isset($GLOBALS['tf']->variables->request['submitbutton']) || $app_id) {
13-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'];
12+
if (isset(\MyAdmin\App::variables()->request['submitbutton']) || $app_id) {
13+
$vps_id = \MyAdmin\App::variables()->request['vps_id'];
1414
if (!$app_id) {
1515
$service = get_service($vps_id, 'vps');
1616
$db = get_module_db('vps');
@@ -27,18 +27,18 @@ function webuzo_install_sysapp($host, $user, $pass, $app_id)
2727
add_output('<h2>Application Details</h2>');
2828
include_once __DIR__.'/webuzo_sdk.php';
2929
if (isset($app_id)) {
30-
$GLOBALS['tf']->variables->request['submitbutton'] = 'Remove';
30+
\MyAdmin\App::variables()->request['submitbutton'] = 'Remove';
3131
}
32-
$app_id ??= $GLOBALS['tf']->variables->request['soft'];
32+
$app_id ??= \MyAdmin\App::variables()->request['soft'];
3333
$new = new Webuzo_API($user, $pass, $host);
34-
if ($GLOBALS['tf']->variables->request['submitbutton'] === 'Install') {
34+
if (\MyAdmin\App::variables()->request['submitbutton'] === 'Install') {
3535
$res = $new->install_app($app_id);
3636
} else {
3737
$res = $new->remove_app($app_id);
3838
}
3939
$result = myadmin_unstringify($res);
40-
if (($GLOBALS['tf']->variables->request['submitbutton'] === 'Install' && $result['done']) || ($GLOBALS['tf']->variables->request['submitbutton'] === 'Remove' && !isset($result['error']))) {
41-
$Outputstring = ($GLOBALS['tf']->variables->request['submitbutton'] === 'Install') ? 'Application is installed successfully!' : 'Application is removed successfully!';
40+
if ((\MyAdmin\App::variables()->request['submitbutton'] === 'Install' && $result['done']) || (\MyAdmin\App::variables()->request['submitbutton'] === 'Remove' && !isset($result['error']))) {
41+
$Outputstring = (\MyAdmin\App::variables()->request['submitbutton'] === 'Install') ? 'Application is installed successfully!' : 'Application is removed successfully!';
4242
add_output($Outputstring);
4343
} else {
4444
add_output('Error occurred!');

src/webuzo_list_backups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
function webuzo_list_backups($host, $user, $pass)
99
{
1010
include_once __DIR__.'/webuzo_sdk.php';
11-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
11+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
1212
$act = 'backups';
1313
function_requirements('webuzo_api_call');
1414
function_requirements('webuzo_format_units_size');

src/webuzo_list_domains.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
function webuzo_list_domains($host = null, $user = null, $pass = null)
99
{
1010
include_once __DIR__.'/webuzo_sdk.php';
11-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
11+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
1212
$new = new Webuzo_API($user, $pass, $host);
1313
$result = $new->list_domains();
1414
$response = (!empty($result)) ? myadmin_unstringify($result) : '';

src/webuzo_list_installed_scripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
function webuzo_list_installed_scripts($host, $user, $pass)
99
{
1010
include_once __DIR__.'/webuzo_sdk.php';
11-
$vps_id = $GLOBALS['tf']->variables->request['vps_id'] ?? '';
11+
$vps_id = \MyAdmin\App::variables()->request['vps_id'] ?? '';
1212
$act = 'installations';
1313
function_requirements('webuzo_api_call');
1414
function_requirements('webuzo_get_all_scripts');

0 commit comments

Comments
 (0)