Exemple #1
0
- look at TeeBX website [http://www.teebx.com] to get details about license.
*/
session_start();
require 'guiconfig.inc';
require 'appliancebone.lib.php';
require 'libs-php/cfgform.class.php';
define('INCLUDE_FORMSTYLE', true);
$form = new cfgForm('sys_logs.php', 'method=post|name=iform|id=iform');
// set a pointer to the actual configuration variables
$cfgPtr =& $config['system']['syslog'];
// set session name
$sessionName = 'frmSyslogCfg';
if ($_POST) {
    $form->wake($_SESSION[$sessionName]);
    $form->validForm();
    $input_errors = $form->get_errQueue();
    if (count($input_errors) == 0) {
        $cfgPtr['mode'] = $form->getFieldSelectedOpts('mode');
        $cfgPtr['buffer'] = $form->getFieldSelectedOpts('buffer');
        $host = $form->getTextFld('remotehost');
        unset($cfgPtr['remotehost'], $cfgPtr['remoteport']);
        if ($host != '') {
            $cfgPtr['remotehost'] = $form->getTextFld('remotehost');
            $cfgPtr['remoteport'] = $form->getTextFld('remoteport');
        }
        // save configuration
        $retval = 0;
        write_config();
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= restartSyslog($config);
$cfgSvcName = 'frmSvcCfg';
// json return data
$data = array();
$data['retval'] = 1;
$data['errors'] = array();
// basics checks
if (!isset($_POST)) {
    $data['errors'][] = _('Missing parameters, process aborted!');
}
// instantiate the service binding configuration form object
$confForm = new cfgForm('sys_storage_edit.php', 'method=post|name=confform|id=confform');
// get back the form object state and update it according to user input
$confForm->wake($_SESSION[$cfgSvcName]);
// validate user input
$confForm->validForm();
$data['errors'] = $confForm->get_errQueue();
// something failed?
if (count($data['errors']) > 0) {
    exit(json_encode($data));
}
$svcMount = $confForm->getFldValue('fsmount');
$cfgPtr['fsmounts'][$svcMount]['uuid'] = $confForm->getFldValue('uuid');
$cfgPtr['fsmounts'][$svcMount]['label'] = $confForm->getFldValue('label');
$cfgPtr['fsmounts'][$svcMount]['filesystem'] = $confForm->getFldValue('filesystem');
$cfgPtr['fsmounts'][$svcMount]['comment'] = $confForm->getFldValue('desc');
$cfgPtr['fsmounts'][$svcMount]['active'] = $confForm->getFldValue('active');
$svcAvail = getAvailServices();
$svcSetNow = null;
foreach (array_keys($svcAvail) as $svc) {
    $svcActive = $confForm->getCbState($svc, 'yes', 'int');
    if ($svcActive === 1) {