migrate admin.add/edit
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
112
admin_admins.php
112
admin_admins.php
@@ -22,6 +22,7 @@ require './lib/init.php';
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Admins as Admins;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
@@ -104,7 +105,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
|
||||
|
||||
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("admins/admins_admin") . "\";");
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
|
||||
$admincount = $result['count'] . " / " . $paging->getEntries();
|
||||
@@ -199,39 +200,21 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
));
|
||||
} else {
|
||||
|
||||
$language_options = '';
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1");
|
||||
$ipaddress = [];
|
||||
$ipaddress[-1] = $lng['admin']['allips'];
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
|
||||
");
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id']);
|
||||
$ipaddress[$row['id']] = $row['ip'];
|
||||
}
|
||||
|
||||
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
|
||||
$admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
|
||||
$admin_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_add_data);
|
||||
|
||||
$title = $admin_add_data['admin_add']['title'];
|
||||
$image = $admin_add_data['admin_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_add") . "\";");
|
||||
UI::TwigBuffer('user/form.html.twig', [
|
||||
'formdata' => $admin_add_data['admin_add']
|
||||
]);
|
||||
UI::TwigOutputBuffer();
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
@@ -262,84 +245,23 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
|
||||
$result['email'] = $idna_convert->decode($result['email']);
|
||||
|
||||
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
|
||||
if ($result['customers'] == '-1') {
|
||||
$result['customers'] = '';
|
||||
}
|
||||
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
|
||||
if ($result['diskspace'] == '-1') {
|
||||
$result['diskspace'] = '';
|
||||
}
|
||||
|
||||
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
|
||||
if ($result['traffic'] == '-1') {
|
||||
$result['traffic'] = '';
|
||||
}
|
||||
|
||||
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
|
||||
if ($result['domains'] == '-1') {
|
||||
$result['domains'] = '';
|
||||
}
|
||||
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
|
||||
if ($result['subdomains'] == '-1') {
|
||||
$result['subdomains'] = '';
|
||||
}
|
||||
|
||||
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
|
||||
if ($result['emails'] == '-1') {
|
||||
$result['emails'] = '';
|
||||
}
|
||||
|
||||
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
|
||||
if ($result['email_accounts'] == '-1') {
|
||||
$result['email_accounts'] = '';
|
||||
}
|
||||
|
||||
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
|
||||
if ($result['email_forwarders'] == '-1') {
|
||||
$result['email_forwarders'] = '';
|
||||
}
|
||||
|
||||
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
|
||||
if ($result['email_quota'] == '-1') {
|
||||
$result['email_quota'] = '';
|
||||
}
|
||||
|
||||
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
|
||||
if ($result['ftps'] == '-1') {
|
||||
$result['ftps'] = '';
|
||||
}
|
||||
|
||||
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
|
||||
if ($result['mysqls'] == '-1') {
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$language_options = '';
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1", $result['ip']);
|
||||
$ipaddress = [];
|
||||
$ipaddress[-1] = $lng['admin']['allips'];
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `id`, `ip` ORDER BY `ip`, `port` ASC
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
|
||||
");
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
$ipaddress[$row['id']] = $row['ip'];
|
||||
}
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
|
||||
$admin_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_edit_data);
|
||||
|
||||
$title = $admin_edit_data['admin_edit']['title'];
|
||||
$image = $admin_edit_data['admin_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_edit") . "\";");
|
||||
UI::TwigBuffer('user/form.html.twig', [
|
||||
'formdata' => $admin_edit_data['admin_edit']
|
||||
]);
|
||||
UI::TwigOutputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user