merge tilman19-master branch (multistack support) - note: this is a very early stage, don't expect everything to work 100%, use at your own risk. Testers are very very welcome (only apache2 and nginx (even more testing) so far)

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-09-19 19:36:06 +02:00
18 changed files with 811 additions and 1369 deletions

View File

@@ -15,7 +15,7 @@
*
*/
class htmlform
class htmlform
{
/**
* internal tmp-variable to store form
@@ -39,7 +39,7 @@ class htmlform
{
/*
* here be section title & image
*/
*/
$title = $section['title'];
$image = $section['image'];
@@ -47,7 +47,7 @@ class htmlform
{
continue;
}
if (!isset($section['nobuttons']) || $section['nobuttons'] == false) {
eval("self::\$_form .= \"" . getTemplate("misc/form/table_section", "1") . "\";");
} else {
@@ -83,9 +83,9 @@ class htmlform
$data_field = str_replace("\t", "", $data_field);
$data_field = $fielddata['next_to_prefix'].$data_field;
self::$_form = str_replace(
'{NEXTTOFIELD_'.$fielddata['next_to'].'}',
$data_field,
self::$_form
'{NEXTTOFIELD_'.$fielddata['next_to'].'}',
$data_field,
self::$_form
);
$nexto = false;
}
@@ -150,8 +150,8 @@ class htmlform
$extras .= ' size="'.$data['size'].'"';
}
if(isset($data['autocomplete'])) {
$extras .= ' autocomplete="'.$data['autocomplete'].'"';
}
$extras .= ' autocomplete="'.$data['autocomplete'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
@@ -161,7 +161,7 @@ class htmlform
} else {
$value = '';
}
$ulfield = ($unlimited == true ? '&nbsp;'.$data['ul_field'] : '');
if(isset($data['display']) && $data['display'] != '')
{
@@ -182,7 +182,7 @@ class htmlform
if(isset($data['rows'])) {
$extras .= ' rows="'.$data['rows'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
$value = $data['value'];
@@ -201,7 +201,7 @@ class htmlform
{
return $data['yesno_var'];
}
private static function _labelField($data = array())
{
return $data['value'];
@@ -217,76 +217,75 @@ class htmlform
} else {
$select_var = '';
}
return '<select
id="'.$fieldname.'"
name="'.$fieldname.'"
'.(isset($data['class']) ? ' class="'.$data['class'] .'" ' : '').'
>'
.$select_var.
'</select>';
return '<select
id="'.$fieldname.'"
name="'.$fieldname.'"
'.(isset($data['class']) ? ' class="'.$data['class'] .'" ' : '').'
>'
.$select_var.
'</select>';
}
/**
* Function to generate checkboxes.
*
*
* <code>
* $data = array(
* 'label' => $lng['customer']['email_imap'],
* 'type' => 'checkbox',
* 'values' => array(
* array( 'label' => 'active',
* 'value' => '1'
* )
* ),
* 'value' => array('1'),
* 'mandatory' => true
* )
* 'label' => $lng['customer']['email_imap'],
* 'type' => 'checkbox',
* 'values' => array(
* array( 'label' => 'active',
* 'value' => '1'
* )
* ),
* 'value' => array('1'),
* 'mandatory' => true
* )
* </code>
*
*
* @param string $fieldname contains the fieldname
* @param array $data contains the data array
*/
public static function _checkbox($fieldname = '', $data = array()) {
// $data['value'] contains checked items
$checked = array();
if (isset($data['value'])) {
$checked = $data['value'];
} else {
$checked = array();
}
if (isset($_SESSION['requestData'])) {
if(isset($_SESSION['requestData'][$fieldname])) {
$checked = array($_SESSION['requestData'][$fieldname]);
} else {
$checked = array();
}
}
// default value is none, so the checkbox isn't an array
$isArray = '';
if (count($data['values']) > 1) {
if (count($data['values']) > 1 || (isset($data['is_array']) && $data['is_array'] == 1)) {
$isArray = '[]';
}
// will contain the output
$output = "";
foreach($data['values'] as $val) {
$key = $val['label'];
// is this box checked?
$isChecked = '';
foreach($checked as $tmp) {
if ($tmp == $val['value']) {
$isChecked = ' checked="checked" ';
break;
if (is_array($checked) && count($checked) > 0) {
foreach($checked as $tmp) {
if ($tmp == $val['value']) {
$isChecked = ' checked="checked" ';
break;
}
}
}
$output .= '<label><input type="checkbox" name="'.$fieldname.$isArray.'" value="'.$val['value'].'" '.$isChecked.'/>'.$key.'</label>';
}
return $output;
}
}

View File

@@ -88,18 +88,18 @@ return array(
),
'ipandport' => array(
'label' => 'IP/Port',
'type' => 'select',
'select_var' => $ipsandports,
'mandatory' => true,
),
'ssl' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL',
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array()
'values' => $ipsandports,
'value' => array($settings['system']['defaultip']),
'is_array' => 1,
'mandatory' => true
),
'ssl_ipandport' => array(
'label' => 'IP/Port (SSL)',
'type' => 'checkbox',
'values' => $ssl_ipsandports,
'value' => '',
'is_array' => 1
),
'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
@@ -110,12 +110,6 @@ return array(
),
'value' => array()
),
'ssl_ipandport' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL IP/Port',
'type' => 'select',
'select_var' => $ssl_ipsandports
),
'no_ssl_available_info' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports == '' ? true : false) : false),
'label' => 'SSL',

View File

@@ -99,18 +99,18 @@ return array(
),
'ipandport' => array(
'label' => 'IP/Port',
'type' => 'select',
'select_var' => $ipsandports,
'mandatory' => true,
),
'ssl' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL',
'type' => 'checkbox',
'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1')
),
'value' => array($result['ssl'])
'values' => $ipsandports,
'value' => $usedips,
'is_array' => 1,
'mandatory' => true
),
'ssl_ipandport' => array(
'label' => 'IP/Port (SSL)',
'type' => 'checkbox',
'values' => $ssl_ipsandports,
'value' => $usedips,
'is_array' => 1
),
'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
@@ -121,12 +121,6 @@ return array(
),
'value' => array($result['ssl_redirect'])
),
'ssl_ipandport' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL IP/Port',
'type' => 'select',
'select_var' => $ssl_ipsandports
),
'no_ssl_available_info' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports == '' ? true : false) : false),
'label' => 'SSL',

View File

@@ -17,7 +17,7 @@
*
*/
function getIpPortCombinations($ssl = null)
function getIpPortCombinations($ssl = false)
{
global $db, $theme;

View File

@@ -16,30 +16,34 @@
* @package Functions
*
*/
function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue) {
function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue)
{
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'defaultip')
{
if ($returnvalue !== false
&& is_array($fielddata)
&& isset($fielddata['settinggroup'])
&& $fielddata['settinggroup'] == 'system'
&& isset($fielddata['varname'])
&& $fielddata['varname'] == 'defaultip'
) {
global $db, $theme;
$customerstddomains_result = $db->query('SELECT `standardsubdomain` FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `standardsubdomain` <> \'0\'');
$customerstddomains_result = $db->query("SELECT `standardsubdomain` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `standardsubdomain` <> '0'");
$ids = array();
while($customerstddomains_row = $db->fetch_array($customerstddomains_result))
{
while($customerstddomains_row = $db->fetch_array($customerstddomains_result)) {
$ids[] = (int)$customerstddomains_row['standardsubdomain'];
}
if(count($ids) > 0)
{
$db->query('UPDATE `' . TABLE_PANEL_DOMAINS . '` SET `ipandport`=\'' . (int)$newfieldvalue . '\' WHERE `id` IN (\'' . implode('\',\'', $ids) . '\') AND `ipandport` = \'' . $db->escape(getSetting('system', 'defaultip')) . '\'');
if(count($ids) > 0) {
$db->query("UPDATE `" . TABLE_DOMAINTOIP . "` SET
`id_ipandports`='" . (int)$newfieldvalue . "'
WHERE `id_domain` IN ('" . implode(', ', $ids) . "')
AND `id_ipandports` = '" . $db->escape(getSetting('system', 'defaultip')) . "'"
);
}
}
return $returnvalue;
}
?>

View File

@@ -55,6 +55,7 @@ define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes');
define('TABLE_PANEL_IPDOCROOTSETTINGS', 'ipsandports_docrootsettings');
define('TABLE_PANEL_DOMDOCROOTSETTINGS', 'domain_docrootsettings');
define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
// APS constants
@@ -73,7 +74,6 @@ define('PACKAGE_LOCKED', 1);
define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.29';
$version = '0.9.29.1-dev1';
$dbversion = '2';
$branding = '';