Example #1
0
        // save configuration
        $retval = 0;
        write_config();
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= restartSyslog($config);
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
    }
} else {
    // prepare the configuration form
    $form->startFieldSet('fset_local', _('Local log'));
    if (($logPath = getSvcState($config, 'systemlog')) == !false) {
        $form->startBlock('rw_localmode');
        $form->setLabel(null, _('Mode'), 'mode', 'class=labelcol');
        $form->startBlock('rw_localmode', 'right');
        $form->setField('mode', 'select', 'name=mode');
        //
        $modeOptions = array('membuffer' => _('Shared memory circular buffer'), 'disk' => _('Disk') . " ({$logPath}/messages)");
        $form->setSelectOptFill('mode', $modeOptions);
        $form->setFieldOptionsState('mode', $cfgPtr['mode'], 'membuffer');
        $form->setBlockHint('hint-syslogmode', _('Choose where log application writes the log messages it receives.') . '<br>' . _('Messages written to shared memory will not survive across reboots.'));
        //
        $form->exitBlock();
    }
    $form->startBlock('rw_buffer');
    $form->setLabel(null, _('Buffer size'), 'buffer', 'class=labelcol');
    $form->startBlock('rw_buffer', 'right');
    $form->setField('buffer', 'select', 'name=buffer');
    //
Example #2
0
$cfgPtr['dyndnsenable'] =& $config['dyndns']['enable'];
$cfgPtr['dyndnswildcard'] =& $config['dyndns']['wildcard'];
// static routes
$cfgPtr['route'] =& $config['system']['staticroutes']['route'];
// get ethernet interfaces list
$netInterfaces = network_get_interfaces();
// temporary variable to check later if static ip address is changed
$oldIpaddr = $netInterfaces[$cfgPtr['if']]['ipaddr'];
// instantiate the config form object
$form = new cfgForm('sys_network.php', 'method=post|name=iform|id=iform');
// initialize form
$form->startWrapper('tab-1');
$form->startFieldset('fset_lanport', _('Port') . " {$cfgPtr['if']} ({$netInterfaces[$cfgPtr['if']]['mac']})");
// if address mode selector
$form->startBlock('rw_usedhcp');
$form->setLabel(null, _('Settings'), 'dhcp', 'class=labelcol');
$form->startBlock('rw_usedhcp', 'right');
$form->setField('dhcp', 'select', 'name=dhcp', false, 'yes');
$selectOpts['yes'] = _('configured via DHCP client');
$selectOpts['no'] = _('configured manually');
$form->setSelectOptFill('dhcp', $selectOpts);
$form->setFieldOptionsState('dhcp', $cfgPtr['dhcp']);
unset($selectOpts);
//
$form->exitBlock();
// static ip address and netmask
$form->startBlock('rw_ipaddr');
$form->setLabel(null, _('IP Address'), 'ipaddr', 'class=labelcol');
$form->startBlock('rw_ipaddr', 'right');
$form->setField('ipaddr', 'text', 'size=15|maxlength=15', false, '192.168.1.222');
$form->setInputText('ipaddr', $cfgPtr['ipaddr']);
Example #3
0
$initForm->startWrapper('initstart');
$initForm->setField('allowinit', 'checkbox', 'onclick=jQuery(\'#startdiskinit\').attr(\'disabled\', !jQuery(this).attr(\'checked\'));');
$initForm->setCbItems('allowinit', 'yes=' . _('I know, thanks for the warning.'), true);
$initForm->setCbState('allowinit', 'yes', 0);
$initClick = 'onclick=callInit(\'' . escapeStr($_POST['dev']) . "', '{$_POST['act']}', '{$_POST['par']}', '{$_POST['start']}', '{$_POST['stk']}'\n\t\t\t\t)";
$initForm->setField('startdiskinit', 'button', $initClick . '|class=startjob|disabled=disabled|value=' . _('Format'), false);
$initForm->exitWrapper();
//
$initForm->exitBlock();
$initForm->exitFieldSet();
// service configuration UI
$confForm->startFieldset('fset_conf', _('General Settings'), 'disabled=disabled');
$svcAvail = getAvailServices();
foreach (array_keys($svcAvail) as $svc) {
    $confForm->startBlock("rw_{$svc}");
    $confForm->setLabel(null, $svcAvail[$svc]['fld_label_se'], null, 'class=labelcol');
    $confForm->startBlock("rw_{$svc}", 'right');
    $svcAttrib = null;
    $cbState = 0;
    if (isset($cfgPtr['services'][$svc]['fsmount'], $cfgPtr['services'][$svc]['active'])) {
        if ($cfgPtr['services'][$svc]['active'] == 1) {
            if ($cfgPtr['services'][$svc]['fsmount'] != $mntDir) {
                $svcAttrib = 'disabled=disabled';
            } elseif ($cfgPtr['services'][$svc]['fsmount'] == $mntDir) {
                $cbState = 1;
            }
        }
    }
    $confForm->setField($svc, 'checkbox', $svcAttrib);
    $confForm->setCbItems($svc, "yes={$svcAvail[$svc]['fld_desc_se']}", true);
    $confForm->setCbState($svc, 'yes', $cbState);
Example #4
0
                    }
                    $input_errors[] = $errstr;
                }
            } else {
                $input_errors[] = _('The configuration could not be restored (file upload error).');
            }
        }
    }
}
$form = new cfgForm('maint_backup.php', 'enctype=multipart/form-data|method=post|name=iform|id=iform');
// initialize form
$form->startWrapper('tab-1');
// let user choose the task
$form->startFieldset('fset_task', _('Task selection'));
$form->startBlock('rw_task');
$form->setLabel(null, _('Task'), 'bck_task', 'class=labelcol');
$form->startBlock('rw_task', 'right');
$form->setField('bck_task', 'select', 'name=task');
$taskOpts['backup'] = _('Backup');
$taskOpts['restore'] = _('Restore');
$form->setSelectOptFill('bck_task', $taskOpts);
$form->setFieldOptionsState('bck_task', 'backup');
//
$form->exitBlock();
$form->startBlock('rw_file');
$form->setLabel(null, _('Backup file'), 'restore_file', 'class=labelcol');
$form->startBlock('rw_file', 'right');
$form->startWrapper('loadfile');
$form->setField('restore_file', 'file', 'name=restore_file');
$form->setField('doload', 'button', 'class=startjob|disabled=disabled|value=' . _('Load'), false);
$form->setBlockHint('hint-file', _('Select a backup file, then click the above Load button to check the file content.'));