Skip to content

Commit 78400c9

Browse files
committed
fixed a bunch of problems in unbilled_cpanel so it works in php8 without notices/errors/etc and improved whitelist handling
1 parent dc22526 commit 78400c9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/unbilled_cpanel.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function_requirements('has_acl');
3737
$outType = 'text';
3838
}
3939
//209.159.155.230,4893465,Printnow.Gr,Linux,centos enterprise 5.8,11.32.3.19,virtuozzo,2.6.18-238.19.1.el5.028stab092.2PAE,INTERSERVER-INTERNAL-VZZO,1
40-
$whitelist = explode("\n", trim(`cat /home/interser/public_html/misha/cpanel_whitelist.txt`));
40+
$whitelist = file_exists('/home/interser/public_html/misha/cpanel_whitelist.txt') ? explode("\n", trim(`cat /home/interser/public_html/misha/cpanel_whitelist.txt`)) : [];
4141
$licenses = [];
4242
$tocheck = [];
4343
$goodIps = [];
@@ -99,6 +99,8 @@ function_requirements('has_acl');
9999
// $db->query("update licenses set license_type=$license_type where license_id='{$db->Record['license_id']}'");
100100
} elseif ($db->Record['license_status'] == 'active' && $db->Record['services_field1'] != $license['package']) {
101101
$ipOutput[$license['ip']][] = 'CPanelDirect License '.'<a href="'.$GLOBALS['tf']->link('index.php', 'choice=none.view_license&id='.$db->Record['license_id']).'" target=_blank>'.$db->Record['license_id'].'</a>'.' Found but type is '.str_replace('INTERSERVER-', '', $db->Record['services_name']).' instead of '.str_replace('INTERSERVER-', '', $services[$license['package']]);
102+
} elseif (!isset($services[$license['package']])) {
103+
$ipOutput[$license['ip']][] = 'CPanelDirect License '.'<a href="'.$GLOBALS['tf']->link('index.php', 'choice=none.view_license&id='.$db->Record['license_id']).'" target=_blank>'.$db->Record['license_id'].'</a>'.' Found but status is '.$db->Record['license_status'].' and type is '.$db->Record['services_name'].' with no local package matching the '.$license['package'].' type';
102104
} else {
103105
$ipOutput[$license['ip']][] = 'CPanelDirect License '.'<a href="'.$GLOBALS['tf']->link('index.php', 'choice=none.view_license&id='.$db->Record['license_id']).'" target=_blank>'.$db->Record['license_id'].'</a>'.' Found but status is '.$db->Record['license_status'].' and type is '.str_replace('INTERSERVER-', '', $db->Record['services_name']).' instead of '.str_replace('INTERSERVER-', '', $services[$license['package']]);
104106
}
@@ -189,7 +191,7 @@ function_requirements('has_acl');
189191
// $table->set_col_options('style="width: 225px;"');
190192
$table->add_field($license['hostname'], 'r');
191193
$table->set_col_options('style="min-width: 135px; max-width: 150px;"');
192-
$table->add_field(str_replace(['INTERSERVER-', ' License'], ['', ''], $services[$license['package']]), 'r');
194+
$table->add_field(isset($services[$license['package']]) ? str_replace(['INTERSERVER-', ' License'], ['', ''], $services[$license['package']]) : 'No Package Matching '.$license['package'], 'r');
193195
$table->set_col_options('style="min-width: 350px;"');
194196
} else {
195197
echo "$ipAddress ".$license['hostname'].' '.str_replace(['INTERSERVER-', ' License'], ['', ''], $services[$license['package']]).' ';

0 commit comments

Comments
 (0)