Compare commits

..

9 Commits

Author SHA1 Message Date
Michael Kaufmann (d00p)
6befe85656 fix add/edit domain due to wrong access to settings; setting version to 0.9.39.4 for bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 12:23:05 +01:00
Michael Kaufmann (d00p)
27f8c8b438 show domains of disabled customers also as disabled
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 11:49:15 +01:00
Michael Kaufmann (d00p)
fc0c796b68 avoid undefined variables/indexes
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 10:58:06 +01:00
Michael Kaufmann (d00p)
482e8c9a11 set version to 0.9.39.3 for maintenance release and upcoming debian package so the new hosting-plan feature is included
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 09:06:49 +01:00
Michael Kaufmann (d00p)
7a664a9990 clean up panel_diskspace/panel_diskspace_admins when removing customer/admin
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 08:21:45 +01:00
Michael Kaufmann (d00p)
372ab5d9c8 add domain flag to avoid generation of nginx try_files directive in webroot which is not suitable for some applications; fixes #461
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 08:12:58 +01:00
Michael Kaufmann (d00p)
de70dbb888 fix checked-property when applying hosting-plan for allowed-phpconfigs
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 14:58:17 +01:00
Michael Kaufmann (d00p)
4d7ceb9efe add missing question-string
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 13:33:29 +01:00
Michael Kaufmann (d00p)
bb792f228f add new hosting-plans feature
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 13:28:13 +01:00
26 changed files with 1006 additions and 11 deletions

View File

@@ -170,6 +170,11 @@ if ($page == 'admins'
");
Database::pexecute($del_stmt, array('adminid' => $id));
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_DISKSPACE_ADMINS . "` WHERE `adminid` = :adminid
");
Database::pexecute($del_stmt, array('adminid' => $id));
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
`adminid` = :userid WHERE `adminid` = :adminid

View File

@@ -307,6 +307,8 @@ if ($page == 'customers'
Database::pexecute($stmt, array('id' => $id));
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = :id");
Database::pexecute($stmt, array('id' => $id));
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :id");
Database::pexecute($stmt, array('id' => $id));
$stmt = Database::prepare("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = :id");
Database::pexecute($stmt, array('id' => $id));
$stmt = Database::prepare("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid` = :id");
@@ -1073,6 +1075,20 @@ if ($page == 'customers'
}
}
// hosting plans
$hosting_plans = "";
$plans = Database::query("
SELECT *
FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC
");
if (Database::num_rows() > 0){
$hosting_plans .= makeoption("---", 0, 0, true, true);
}
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= makeoption($row['name'], $row['id'], 0, true, true);
}
$customer_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_add.php';
$customer_add_form = htmlform::genHTMLForm($customer_add_data);
@@ -1755,6 +1771,20 @@ if ($page == 'customers'
}
}
// hosting plans
$hosting_plans = "";
$plans = Database::query("
SELECT *
FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC
");
if (Database::num_rows() > 0){
$hosting_plans .= makeoption("---", 0, 0, true, true);
}
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= makeoption($row['name'], $row['id'], 0, true, true);
}
$customer_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_edit.php';
$customer_edit_form = htmlform::genHTMLForm($customer_edit_data);

View File

@@ -55,7 +55,7 @@ if ($page == 'domains' || $page == 'overview') {
$syshostname = "AND `d`.`id` <> " . Settings::Get('system.hostname_id');
}
$result_stmt = Database::prepare("
SELECT `d`.*, `c`.`loginname`, `c`.`name`, `c`.`firstname`, `c`.`company`, `c`.`standardsubdomain`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`
SELECT `d`.*, `c`.`loginname`, `c`.`deactivated`, `c`.`name`, `c`.`firstname`, `c`.`company`, `c`.`standardsubdomain`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
@@ -429,6 +429,7 @@ if ($page == 'domains' || $page == 'overview') {
}
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$notryfiles = isset($_POST['notryfiles']) && (int)$_POST['notryfiles'] == 1 ? 1 : 0;
validate($_POST['documentroot'], 'documentroot');
// If path is empty and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
@@ -451,6 +452,7 @@ if ($page == 'domains' || $page == 'overview') {
$zonefile = '';
$dkim = '1';
$specialsettings = '';
$notryfiles = '0';
}
if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') {
@@ -801,6 +803,7 @@ if ($page == 'domains' || $page == 'overview') {
'mod_fcgid_starter' => $mod_fcgid_starter,
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
'specialsettings' => $specialsettings,
'notryfiles' => $notryfiles,
'registration_date' => $registration_date,
'termination_date' => $termination_date,
'issubof' => $issubof,
@@ -850,6 +853,7 @@ if ($page == 'domains' || $page == 'overview') {
'openbasedir' => $openbasedir,
'speciallogfile' => $speciallogfile,
'specialsettings' => $specialsettings,
'notryfiles' => $notryfiles,
'ssl_redirect' => $ssl_redirect,
'add_date' => time(),
'registration_date' => $registration_date,
@@ -889,6 +893,7 @@ if ($page == 'domains' || $page == 'overview') {
`openbasedir` = :openbasedir,
`speciallogfile` = :speciallogfile,
`specialsettings` = :specialsettings,
`notryfiles` = :notryfiles,
`ssl_redirect` = :ssl_redirect,
`add_date` = :add_date,
`registration_date` = :registration_date,
@@ -1338,6 +1343,7 @@ if ($page == 'domains' || $page == 'overview') {
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$ssfs = (isset($_POST['specialsettingsforsubdomains']) && intval($_POST['specialsettingsforsubdomains']) == 1) ? 1 : 0;
$notryfiles = isset($_POST['notryfiles']) && (int)$_POST['notryfiles'] == 1 ? 1 : 0;
$documentroot = validate($_POST['documentroot'], 'documentroot');
if ($documentroot == '') {
@@ -1359,6 +1365,7 @@ if ($page == 'domains' || $page == 'overview') {
$dkim = $result['dkim'];
$specialsettings = $result['specialsettings'];
$ssfs = (empty($specialsettings) ? 0 : 1);
$notryfiles = $result['notryfiles'];
$documentroot = $result['documentroot'];
}
@@ -1655,6 +1662,7 @@ if ($page == 'domains' || $page == 'overview') {
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
'specialsettings' => $specialsettings,
'specialsettingsforsubdomains' => $ssfs,
'notryfiles' => $notryfiles,
'registration_date' => $registration_date,
'termination_date' => $termination_date,
'issubof' => $issubof,
@@ -1697,6 +1705,7 @@ if ($page == 'domains' || $page == 'overview') {
$mod_fcgid_starter != $result['mod_fcgid_starter'] ||
$mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] ||
$specialsettings != $result['specialsettings'] ||
$notryfiles != $result['notryfiles'] ||
$aliasdomain != $result['aliasdomain'] ||
$issubof != $result['ismainbutsubto'] ||
$email_only != $result['email_only'] ||
@@ -1855,6 +1864,7 @@ if ($page == 'domains' || $page == 'overview') {
$update_data['mod_fcgid_starter'] = $mod_fcgid_starter;
$update_data['mod_fcgid_maxrequests'] = $mod_fcgid_maxrequests;
$update_data['specialsettings'] = $specialsettings;
$update_data['notryfiles'] = $notryfiles;
$update_data['registration_date'] = $registration_date;
$update_data['termination_date'] = $termination_date;
$update_data['ismainbutsubto'] = $issubof;
@@ -1889,6 +1899,7 @@ if ($page == 'domains' || $page == 'overview') {
`mod_fcgid_starter` = :mod_fcgid_starter,
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests,
`specialsettings` = :specialsettings,
`notryfiles` = :notryfiles,
`registration_date` = :registration_date,
`termination_date` = :termination_date,
`ismainbutsubto` = :ismainbutsubto,

521
admin_plans.php Normal file
View File

@@ -0,0 +1,521 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == '' || $page == 'overview') {
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_plans");
$fields = array(
'p.name' => $lng['admin']['plans']['name'],
'p.description' => $lng['admin']['plans']['description'],
'adminname' => $lng['admin']['admin'],
'p.ts' => $lng['admin']['plans']['last_update']
);
$paging = new paging($userinfo, TABLE_PANEL_PLANS, $fields);
$plans = '';
$result_stmt = Database::prepare("
SELECT p.*, a.loginname as adminname
FROM `" . TABLE_PANEL_PLANS . "` p, `" . TABLE_PANEL_ADMINS . "` a
WHERE " . ($userinfo['customers_see_all'] ? '' : " `p`.`adminid` = :adminid AND ") . "
`p`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
eval("\$plans.=\"" . getTemplate("plans/plans_plan") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("plans/plans") . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array(
'id' => $id
));
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['adminid'] == $result['adminid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
Database::pexecute($del_stmt, array(
'id' => $id
));
$log->logAction(ADM_ACTION, LOG_INFO, "Plan '" . $result['name'] . "' has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('plan_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['name']);
}
} else {
standard_error('nopermissionsorinvalidid');
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$name = validate($_POST['name'], 'name');
$description = validate(str_replace("\r\n", "\n", $_POST['description']), 'description', '/^[^\0]*$/');
$value_arr = array();
$value_arr['diskspace'] = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$value_arr['diskspace'] = - 1;
}
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$value_arr['traffic'] = - 1;
}
$value_arr['subdomains'] = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$value_arr['subdomains'] = - 1;
}
$value_arr['emails'] = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$value_arr['emails'] = - 1;
}
$value_arr['email_accounts'] = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$value_arr['email_accounts'] = - 1;
}
$value_arr['email_forwarders'] = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$value_arr['email_forwarders'] = - 1;
}
if (Settings::Get('system.mail_quota_enabled') == '1') {
$value_arr['email_quota'] = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array(
'0',
''
));
if (isset($_POST['email_quota_ul'])) {
$value_arr['email_quota'] = - 1;
}
} else {
$value_arr['email_quota'] = - 1;
}
$value_arr['email_imap'] = 0;
if (isset($_POST['email_imap'])) {
$value_arr['email_imap'] = intval_ressource($_POST['email_imap']);
}
$value_arr['email_pop3'] = 0;
if (isset($_POST['email_pop3'])) {
$value_arr['email_pop3'] = intval_ressource($_POST['email_pop3']);
}
$value_arr['ftps'] = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$value_arr['ftps'] = - 1;
}
$value_arr['tickets'] = (Settings::Get('ticket.enabled') == 1 ? intval_ressource($_POST['tickets']) : 0);
if (isset($_POST['tickets_ul']) && Settings::Get('ticket.enabled') == '1') {
$value_arr['tickets'] = - 1;
}
$value_arr['mysqls'] = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$value_arr['mysqls'] = - 1;
}
$value_arr['phpenabled'] = 0;
if (isset($_POST['phpenabled'])) {
$value_arr['phpenabled'] = intval($_POST['phpenabled']);
}
$value_arr['allowed_phpconfigs'] = array();
if (isset($_POST['allowed_phpconfigs']) && is_array($_POST['allowed_phpconfigs'])) {
foreach ($_POST['allowed_phpconfigs'] as $allowed_phpconfig) {
$allowed_phpconfig = intval($allowed_phpconfig);
$value_arr['allowed_phpconfigs'][] = $allowed_phpconfig;
}
}
$value_arr['perlenabled'] = 0;
if (isset($_POST['perlenabled'])) {
$value_arr['perlenabled'] = intval($_POST['perlenabled']);
}
$value_arr['dnsenabled'] = 0;
if (isset($_POST['dnsenabled'])) {
$value_arr['dnsenabled'] = intval($_POST['dnsenabled']);
}
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_PLANS . "`
SET `adminid` = :adminid, `name` = :name, `description` = :desc, `value` = :valuearr, `ts` = UNIX_TIMESTAMP();
");
$ins_data = array(
'adminid' => $userinfo['adminid'],
'name' => $name,
'desc' => $description,
'valuearr' => json_encode($value_arr)
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "added plan '" . $name . "'");
redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$phpconfigs = array();
$configs = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
'label' => $row['description'] . "<br />",
'value' => $row['id']
);
}
}
// dummy to avoid unknown variables
$language_options = null;
$gender_options = null;
$hosting_plans = null;
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
// unset unneeded stuff
unset($cust_add_data['customer_add']['sections']['section_a']);
unset($cust_add_data['customer_add']['sections']['section_b']);
unset($cust_add_data['customer_add']['sections']['section_cpre']);
// merge
$plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']);
$plans_add_form = htmlform::genHTMLForm($plans_add_data);
$title = $plans_add_data['plans_add']['title'];
$image = $plans_add_data['plans_add']['image'];
eval("echo \"" . getTemplate("plans/plans_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array(
'id' => $id
));
if ($result['name'] != '') {
$result['value'] = json_decode($result['value'], true);
$result = htmlentities_array($result);
foreach ($result['value'] as $index => $value) {
$result[$index] = $value;
}
$result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$name = validate($_POST['name'], 'name');
$description = validate(str_replace("\r\n", "\n", $_POST['description']), 'description', '/^[^\0]*$/');
$value_arr = array();
$value_arr['diskspace'] = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$value_arr['diskspace'] = - 1;
}
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$value_arr['traffic'] = - 1;
}
$value_arr['subdomains'] = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$value_arr['subdomains'] = - 1;
}
$value_arr['emails'] = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$value_arr['emails'] = - 1;
}
$value_arr['email_accounts'] = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$value_arr['email_accounts'] = - 1;
}
$value_arr['email_forwarders'] = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$value_arr['email_forwarders'] = - 1;
}
if (Settings::Get('system.mail_quota_enabled') == '1') {
$value_arr['email_quota'] = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array(
'0',
''
));
if (isset($_POST['email_quota_ul'])) {
$value_arr['email_quota'] = - 1;
}
} else {
$value_arr['email_quota'] = - 1;
}
$value_arr['email_imap'] = 0;
if (isset($_POST['email_imap'])) {
$value_arr['email_imap'] = intval_ressource($_POST['email_imap']);
}
$value_arr['email_pop3'] = 0;
if (isset($_POST['email_pop3'])) {
$value_arr['email_pop3'] = intval_ressource($_POST['email_pop3']);
}
$value_arr['ftps'] = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$value_arr['ftps'] = - 1;
}
$value_arr['tickets'] = (Settings::Get('ticket.enabled') == 1 ? intval_ressource($_POST['tickets']) : 0);
if (isset($_POST['tickets_ul']) && Settings::Get('ticket.enabled') == '1') {
$value_arr['tickets'] = - 1;
}
$value_arr['mysqls'] = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$value_arr['mysqls'] = - 1;
}
$value_arr['phpenabled'] = 0;
if (isset($_POST['phpenabled'])) {
$value_arr['phpenabled'] = intval($_POST['phpenabled']);
}
$value_arr['allowed_phpconfigs'] = array();
if (isset($_POST['allowed_phpconfigs']) && is_array($_POST['allowed_phpconfigs'])) {
foreach ($_POST['allowed_phpconfigs'] as $allowed_phpconfig) {
$allowed_phpconfig = intval($allowed_phpconfig);
$value_arr['allowed_phpconfigs'][] = $allowed_phpconfig;
}
}
$value_arr['perlenabled'] = 0;
if (isset($_POST['perlenabled'])) {
$value_arr['perlenabled'] = intval($_POST['perlenabled']);
}
$value_arr['dnsenabled'] = 0;
if (isset($_POST['dnsenabled'])) {
$value_arr['dnsenabled'] = intval($_POST['dnsenabled']);
}
$ins_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_PLANS . "`
SET `name` = :name, `description` = :desc, `value` = :valuearr, `ts` = UNIX_TIMESTAMP()
WHERE `id` = :id
");
$ins_data = array(
'name' => $name,
'desc' => $description,
'valuearr' => json_encode($value_arr),
'id' => $id
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "updated plan '" . $name . "'");
redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
if ($result['diskspace'] == '-1') {
$result['diskspace'] = '';
}
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
if ($result['traffic'] == '-1') {
$result['traffic'] = '';
}
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
if ($result['subdomains'] == '-1') {
$result['subdomains'] = '';
}
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
if ($result['emails'] == '-1') {
$result['emails'] = '';
}
$email_accounts_ul = 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 = 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 = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
if ($result['email_quota'] == '-1') {
$result['email_quota'] = '';
}
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, $result['tickets'], true, true);
if ($result['tickets'] == '-1') {
$result['tickets'] = '';
}
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
if ($result['mysqls'] == '-1') {
$result['mysqls'] = '';
}
$phpconfigs = array();
$configs = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
'label' => $row['description'] . "<br />",
'value' => $row['id']
);
}
}
// dummy to avoid unknown variables
$result['loginname'] = null;
$result['documentroot'] = null;
$result['standardsubdomain'] = null;
$result['deactivated'] = null;
$language_options = null;
$result['firstname'] = null;
$gender_options = null;
$result['company'] = null;
$result['street'] = null;
$result['zipcode'] = null;
$result['city'] = null;
$result['phone'] = null;
$result['fax'] = null;
$result['email'] = null;
$result['customernumber'] = null;
$result['custom_notes'] = null;
$result['custom_notes_show'] = null;
$hosting_plans = null;
$result['imap'] = null;
$result['pop3'] = null;
$admin_select_cnt = null;
$admin_select = null;
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
// unset unneeded stuff
unset($cust_edit_data['customer_edit']['sections']['section_a']);
unset($cust_edit_data['customer_edit']['sections']['section_b']);
unset($cust_edit_data['customer_edit']['sections']['section_cpre']);
// merge
$plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']);
$plans_edit_form = htmlform::genHTMLForm($plans_edit_data);
$title = $plans_edit_data['plans_edit']['title'];
$image = $plans_edit_data['plans_edit']['image'];
eval("echo \"" . getTemplate("plans/plans_edit") . "\";");
}
}
} elseif ($action == 'jqGetPlanValues') {
$planid = isset($_POST['planid']) ? (int)$_POST['planid'] : 0;
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array(
'id' => $planid
));
echo $result['value'];
exit;
}
}

View File

@@ -260,6 +260,7 @@ CREATE TABLE `panel_domains` (
`hsts_preload` tinyint(1) NOT NULL default '0',
`ocsp_stapling` tinyint(1) DEFAULT '0',
`http2` tinyint(1) DEFAULT '0',
`notryfiles` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`),
@@ -686,8 +687,8 @@ opcache.interned_strings_buffer'),
('panel', 'password_special_char_required', '0'),
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''),
('panel', 'version', '0.9.39.2'),
('panel', 'db_version', '201801260');
('panel', 'version', '0.9.39.4'),
('panel', 'db_version', '201802130');
DROP TABLE IF EXISTS `panel_tasks`;
@@ -1028,3 +1029,16 @@ CREATE TABLE `domain_dns_entries` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_plans`;
CREATE TABLE `panel_plans` (
`id` int(11) NOT NULL auto_increment,
`adminid` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL,
`value` longtext NOT NULL,
`ts` int(15) NOT NULL default '0',
PRIMARY KEY (id),
KEY adminid (adminid)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;

View File

@@ -3892,3 +3892,44 @@ if (isFroxlorVersion('0.9.39.1')) {
showUpdateStep("Updating from 0.9.39.1 to 0.9.39.2", false);
updateToVersion('0.9.39.2');
}
if (isDatabaseVersion('201801260')) {
showUpdateStep("Adding new plans table");
Database::query("DROP TABLE IF EXISTS `panel_plans`;");
$sql = "CREATE TABLE `panel_plans` (
`id` int(11) NOT NULL auto_increment,
`adminid` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL,
`value` longtext NOT NULL,
`ts` int(15) NOT NULL default '0',
PRIMARY KEY (id),
KEY adminid (adminid)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;";
Database::query($sql);
lastStepStatus(0);
updateToDbVersion('201802120');
}
if (isDatabaseVersion('201802120')) {
showUpdateStep("Adding domain field for try_files flag");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `notryfiles` tinyint(1) DEFAULT '0';");
lastStepStatus(0);
updateToDbVersion('201802130');
}
if (isFroxlorVersion('0.9.39.2')) {
showUpdateStep("Updating from 0.9.39.2 to 0.9.39.3", false);
updateToVersion('0.9.39.3');
}
if (isFroxlorVersion('0.9.39.3')) {
showUpdateStep("Updating from 0.9.39.3 to 0.9.39.4", false);
updateToVersion('0.9.39.4');
}

View File

@@ -158,6 +158,18 @@ return array(
)
)
),
'section_cpre' => array(
'visible' => !empty($hosting_plans),
'title' => $lng['admin']['plans']['use_plan'],
'image' => 'icons/user_add.png',
'fields' => array(
'use_plan' => array(
'label' => $lng['admin']['plans']['use_plan'],
'type' => 'select',
'select_var' => $hosting_plans
)
)
),
'section_c' => array(
'title' => $lng['admin']['servicedata'],
'image' => 'icons/user_add.png',
@@ -290,9 +302,9 @@ return array(
'values' => $phpconfigs,
'value' => ((int) Settings::Get('system.mod_fcgid') == 1 ? array(
Settings::Get('system.mod_fcgid_defaultini')
) : (int) Settings::Get('phpfpm.enabled') == 1) ? array(
) : (int) Settings::Get('phpfpm.enabled') == 1 ? array(
Settings::Get('phpfpm.defaultini')
) : array(),
) : array()),
'is_array' => 1
),
'perlenabled' => array(

View File

@@ -150,6 +150,18 @@ return array(
)
)
),
'section_cpre' => array(
'visible' => !empty($hosting_plans),
'title' => $lng['admin']['plans']['use_plan'],
'image' => 'icons/user_add.png',
'fields' => array(
'use_plan' => array(
'label' => $lng['admin']['plans']['use_plan'],
'type' => 'select',
'select_var' => $hosting_plans
)
)
),
'section_c' => array(
'title' => $lng['admin']['servicedata'],
'image' => 'icons/user_edit.png',

View File

@@ -131,6 +131,19 @@ return array(
'type' => 'textarea',
'cols' => 60,
'rows' => 12
),
'notryfiles' => array(
'visible' => (Settings::Get('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
'label' => $lng['admin']['notryfiles']['title'],
'desc' => $lng['admin']['notryfiles']['description'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array()
)
)
),

View File

@@ -161,6 +161,21 @@ return array(
'value' => array(
'1'
)
),
'notryfiles' => array(
'visible' => (Settings::Get('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
'label' => $lng['admin']['notryfiles']['title'],
'desc' => $lng['admin']['notryfiles']['description'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['notryfiles']
)
)
)
),

View File

@@ -0,0 +1,41 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Formfields
*
*/
return array(
'plans_add' => array(
'title' => $lng['admin']['plans']['add'],
'image' => 'icons/templates_add_big.png',
'sections' => array(
'section_a' => array(
'title' => $lng['admin']['plans']['plan_details'],
'image' => 'icons/templates_add_big.png',
'fields' => array(
'name' => array(
'label' => $lng['admin']['plans']['name'],
'type' => 'text'
),
'description' => array(
'label' => $lng['admin']['plans']['description'],
'type' => 'textarea',
'cols' => 60,
'rows' => 12
)
)
)
)
)
);

View File

@@ -0,0 +1,43 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Formfields
*
*/
return array(
'plans_edit' => array(
'title' => $lng['admin']['plans']['edit'],
'image' => 'icons/templates_edit_big.png',
'sections' => array(
'section_a' => array(
'title' => $lng['admin']['plans']['plan_details'],
'image' => 'icons/templates_edit_big.png',
'fields' => array(
'name' => array(
'label' => $lng['admin']['plans']['name'],
'type' => 'text',
'value' => $result['name']
),
'description' => array(
'label' => $lng['admin']['plans']['description'],
'type' => 'textarea',
'cols' => 60,
'rows' => 12,
'value' => $result['description']
)
)
)
)
)
);

View File

@@ -214,6 +214,11 @@ return array(
'label' => $lng['admin']['ipsandports']['ipsandports'],
'required_resources' => 'change_serversettings'
),
array(
'url' => 'admin_plans.php?page=overview',
'label' => $lng['admin']['plans']['plans'],
'required_resources' => 'customers'
),
array(
'url' => 'admin_settings.php?page=updatecounters',
'label' => $lng['admin']['updatecounters'],

View File

@@ -52,5 +52,6 @@ define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
define('TABLE_DOMAIN_DNS', 'domain_dns_entries');
define('TABLE_PANEL_FPMDAEMONS', 'panel_fpmdaemons');
define('TABLE_PANEL_PLANS', 'panel_plans');
require dirname(__FILE__).'/version.inc.php';

View File

@@ -16,10 +16,10 @@
*/
// Main version variable
$version = '0.9.39.2';
$version = '0.9.39.4';
// Database version (YYYYMMDDC where C is a daily counter)
$dbversion = '201801260';
$dbversion = '201802130';
// Distribution branding-tag (used for Debian etc.)
$branding = '';

View File

@@ -2104,3 +2104,16 @@ $lng['serversettings']['phpfpm_settings']['envpath'] = 'Paths to add to the PATH
$lng['admin']['configfiles']['importexport'] = 'Import/Export';
$lng['success']['settingsimported'] = 'Settings imported successfully';
$lng['error']['jsonextensionnotfound'] = 'This feature requires the php json-extension.';
// added in froxlor 0.9.39
$lng['admin']['plans']['name'] = 'Plan name';
$lng['admin']['plans']['description'] = 'Description';
$lng['admin']['plans']['last_update'] = 'Last updated';
$lng['admin']['plans']['plans'] = 'Hosting plans';
$lng['admin']['plans']['plan_details'] = 'Plan details';
$lng['admin']['plans']['add'] = 'Add new plan';
$lng['admin']['plans']['edit'] = 'Edit plan';
$lng['admin']['plans']['use_plan'] = 'Apply plan';
$lng['question']['plan_reallydelete'] = 'Do you really want to delete the hosting plan %s?';
$lng['admin']['notryfiles']['title'] = 'No autogenerated try_files';
$lng['admin']['notryfiles']['description'] = 'Say yes here if you want to specify a custom try_files directive in specialsettings (needed for some wordpress plugins for example).';

View File

@@ -1754,3 +1754,16 @@ $lng['phpfpm']['ini_admin_values'] = 'Mögliche <strong>php_admin_value</strong>
$lng['serversettings']['phpfpm_settings']['envpath'] = 'Pfade für die PATH Umgebungsvariable. Leerlassen, um keine PATH Umgebungsvariable zu setzen.';
$lng['success']['settingsimported'] = 'Einstellungnen erfolgreich importiert';
$lng['error']['jsonextensionnotfound'] = 'Diese Funktion benötigt die PHP json-Erweiterung.';
// added in froxlor 0.9.39
$lng['admin']['plans']['name'] = 'Plan Name';
$lng['admin']['plans']['description'] = 'Beschreibung';
$lng['admin']['plans']['last_update'] = 'Zuletzt aktualisiert';
$lng['admin']['plans']['plans'] = 'Hosting Pläne';
$lng['admin']['plans']['plan_details'] = 'Plan Details';
$lng['admin']['plans']['add'] = 'Neuen Plan anlegen';
$lng['admin']['plans']['edit'] = 'Plan editieren';
$lng['admin']['plans']['use_plan'] = 'Plan übernehmen';
$lng['question']['plan_reallydelete'] = 'Wollen Sie den Hosting-Plan "%s" wirklich löschen?';
$lng['admin']['notryfiles']['title'] = 'Keine generierte try_files Anweisung';
$lng['admin']['notryfiles']['description'] = 'Wähle "Ja", wenn eine eigene try_files Direktive in den "eigenen Vhost Einstellungen" angegeben werden soll (z.B. nötig für manche Wordpress Plugins).';

View File

@@ -916,7 +916,9 @@ class nginx extends HttpConfigBase
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
$webroot_text .= "\t" . 'index index.php index.html index.htm;' . "\n";
$webroot_text .= "\t\t" . 'try_files $uri $uri/ @rewrites;' . "\n";
if ($domain['notryfiles'] != 1) {
$webroot_text .= "\t\t" . 'try_files $uri $uri/ @rewrites;' . "\n";
}
} else {
$webroot_text .= "\t" . 'index index.html index.htm;' . "\n";
}
@@ -927,7 +929,7 @@ class nginx extends HttpConfigBase
}
$webroot_text .= "\t" . '}' . "\n\n";
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1' && $domain['notryfiles'] != 1) {
$webroot_text .= "\tlocation @rewrites {\n";
$webroot_text .= "\t\trewrite ^ /index.php last;\n";
$webroot_text .= "\t}\n\n";

View File

@@ -6,6 +6,7 @@ $header
{$title}
</h2>
</header>
<script type="text/javascript" src="templates/{$theme}/assets/js/customers.js"></script>
<section>

View File

@@ -6,6 +6,7 @@ $header
{$title}
</h2>
</header>
<script type="text/javascript" src="templates/{$theme}/assets/js/customers.js"></script>
<section>

View File

@@ -1,8 +1,8 @@
<if $row['termination_css'] != ''>
<tr class="{$row['termination_css']}">
<tr class="{$row['termination_css']}<if $row['deactivated'] == 1> disabled</if>">
</if>
<if $row['termination_css'] == ''>
<tr>
<tr <if $row['deactivated'] == 1>class="disabled"</if>>
</if>
<td>{$row['domain']}
<if (isset($row['standardsubdomain']) && $row['standardsubdomain'] == $row['id'])>

59
templates/Sparkle/admin/plans/plans.tpl vendored Normal file
View File

@@ -0,0 +1,59 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/icons/templates_big.png" alt="" />&nbsp;
{$lng['admin']['plans']['plans']}
</h2>
</header>
<section>
<form action="{$linker->getLink(array('section' => 'plans'))}" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="s" value="$s"/>
<input type="hidden" name="page" value="$page"/>
<div class="overviewsearch">
{$searchcode}
</div>
<div class="overviewadd">
<img src="templates/{$theme}/assets/img/icons/add.png" alt="" />&nbsp;
<a href="{$linker->getLink(array('section' => 'plans', 'page' => $page, 'action' => 'add'))}">{$lng['admin']['plans']['add']}</a>
</div>
<table class="full hl">
<thead>
<tr>
<th>{$lng['admin']['plans']['name']}&nbsp;{$arrowcode['p.name']}</th>
<th>{$lng['admin']['plans']['description']}&nbsp;{$arrowcode['p.description']}</th>
<th>{$lng['admin']['admin']}&nbsp;{$arrowcode['adminname']}</th>
<th>{$lng['admin']['plans']['last_update']}&nbsp;{$arrowcode['p.ts']}</th>
<th>{$lng['panel']['options']}</th>
</tr>
</thead>
<if $pagingcode != ''>
<tfoot>
<tr>
<td colspan="5">{$pagingcode}</td>
</tr>
</tfoot>
</if>
<tbody>
$plans
</tbody>
</table>
</form>
<if 15 < $count>
<div class="overviewadd">
<img src="templates/{$theme}/assets/img/icons/add.png" alt="" />&nbsp;
<a href="{$linker->getLink(array('section' => 'plans', 'page' => $page, 'action' => 'add'))}">{$lng['admin']['plans']['add']}</a>
</div>
</if>
</section>
</article>
$footer

View File

@@ -0,0 +1,26 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/{$image}" alt="{$title}" />&nbsp;
{$title}
</h2>
</header>
<section>
<form action="{$linker->getLink(array('section' => 'plans'))}" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="s" value="$s" />
<input type="hidden" name="page" value="$page" />
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="send" value="send" />
<table class="full">
{$plans_add_form}
</table>
</form>
</section>
</article>
$footer

View File

@@ -0,0 +1,27 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/{$image}" alt="{$title}" />&nbsp;
{$title}
</h2>
</header>
<section>
<form action="{$linker->getLink(array('section' => 'plans'))}" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="s" value="$s" />
<input type="hidden" name="page" value="$page" />
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="id" value="$id" />
<input type="hidden" name="send" value="send" />
<table class="full">
{$plans_edit_form}
</table>
</form>
</section>
</article>
$footer

View File

@@ -0,0 +1,14 @@
<tr>
<td>{$row['name']}</td>
<td>{$row['description']}</td>
<td>{$row['adminname']}</td>
<td>{$row['ts_format']}</td>
<td>
<a href="{$linker->getLink(array('section' => 'plans', 'page' => $page, 'action' => 'edit', 'id' => $row['id']))}">
<img src="templates/{$theme}/assets/img/icons/edit.png" alt="{$lng['panel']['edit']}" title="{$lng['panel']['edit']}" />
</a>&nbsp;
<a href="{$linker->getLink(array('section' => 'plans', 'page' => $page, 'action' => 'delete', 'id' => $row['id']))}">
<img src="templates/{$theme}/assets/img/icons/delete.png" alt="{$lng['panel']['delete']}" title="{$lng['panel']['delete']}" />
</a>
</td>
</tr>

View File

@@ -0,0 +1,75 @@
$(document).ready(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
/**
* disable unusable php-configuration by customer settings
*/
$('#use_plan').change(function() {
var pid = $(this).val();
if (pid > 0) {
var sid = getUrlParameter('s');
$.ajax({
url: "admin_plans.php?s="+sid+"&page=overview&action=jqGetPlanValues",
type: "POST",
data: {
planid: pid
},
dataType: "json",
success: function(json) {
for (i in json) {
if (i == 'email_imap' || i == 'email_pop3' || i == 'perlenabled' || i == 'phpenabled' || i == 'dnsenabled') {
/** handle checkboxes **/
if (json[i] == 1) {
$("input[name='"+i+"']").prop('checked', true);
} else {
$("input[name='"+i+"']").prop('checked', false);
}
} else if (i == 'allowed_phpconfigs') {
/** handle array of values **/
$("input[name='allowed_phpconfigs[]']").each(function(index) {
$(this).prop('checked', false);
for (j in json[i]) {
if ($(this).val() == json[i][j]) {
$(this).prop('checked', true);
break;
}
}
});
} else if (json[i] == -1) {
/** handle unlimited checkboxes **/
$("input[name='" + i + "_ul']").attr('checked', 'checked');
$("input[name='"+i+"']").prop({
readonly: true
});
} else {
/** handle normal value **/
$("input[name='"+i+"']").val(json[i]);
$("input[name='"+i+"']").prop({
readonly: false
});
$("input[name='" + i + "_ul']").prop('checked', false);
}
}
},
error: function(a, b) {
console.log(a, b);
}
});
}
});
});