checkPassword($_POST['passwd'])) { $error = _("Master password is wrong!"); } // add new profile elseif ($_POST['action'] == "add") { // check profile password if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) { $result = createConfigProfile($_POST['addprofile'], $_POST['addpassword'], $_POST['addTemplate']); if ($result === true) { $_SESSION['conf_isAuthenticated'] = $_POST['addprofile']; $_SESSION['conf_config'] = new LAMConfig($_POST['addprofile']); $_SESSION['conf_messages'][] = array('INFO', _("Created new profile."), $_POST['addprofile']); metaRefresh('confmain.php'); exit; } else { $error = $result; } } else { $error = _("Profile passwords are different or empty!"); } } // rename profile elseif ($_POST['action'] == "rename") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['oldfilename']) && preg_match("/^[a-z0-9_-]+$/i", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) { if (rename("../../config/" . $_POST['oldfilename'] . ".conf", "../../config/" . $_POST['renfilename'] . ".conf")) { // rename pdf and profiles folder rename("../../config/profiles/" . $_POST['oldfilename'], "../../config/profiles/" . $_POST['renfilename']); rename("../../config/pdf/" . $_POST['oldfilename'], "../../config/pdf/" . $_POST['renfilename']); $msg = _("Renamed profile."); } else $error = _("Could not rename file!"); // update default profile setting if needed if ($cfg->default == $_POST['oldfilename']) { $cfg->default = $_POST['renfilename']; $cfg->save(); } // reread profile list $files = getConfigProfiles(); } else $error = _("Profile name is invalid!"); } // delete profile elseif ($_POST['action'] == "delete") { if (deleteConfigProfile($_POST['delfilename']) == null) { $msg = _("Profile deleted."); // update default profile setting if needed if ($cfg->default == $_POST['delfilename']) { $filesNew = array_delete(array($_POST['delfilename']), $files); if (sizeof($filesNew) > 0) { sort($filesNew); $cfg->default = $filesNew[0]; $cfg->save(); } } // reread profile list $files = getConfigProfiles(); } else $error = _("Unable to delete profile!"); } // set new profile password elseif ($_POST['action'] == "setpass") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['setprofile'])) { if ($_POST['setpassword'] && $_POST['setpassword2'] && ($_POST['setpassword'] == $_POST['setpassword2'])) { $config = new LAMConfig($_POST['setprofile']); $config->set_Passwd($_POST['setpassword']); $config->save(); $config = null; $msg = _("New password set successfully."); } else $error = _("Profile passwords are different or empty!"); } else $error = _("Profile name is invalid!"); } // set default profile elseif ($_POST['action'] == "setdefault") { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['defaultfilename'])) { $configMain = new LAMCfgMain(); $configMain->default = $_POST['defaultfilename']; $configMain->save(); $configMain = null; $msg = _("New default profile set successfully."); } else $error = _("Profile name is invalid!"); } } echo $_SESSION['header']; ?> <?php echo _("Profile management"); ?> read(); while ($cssEntry !== false) { if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') { $cssFiles[] = $cssEntry; } $cssEntry = $cssDir->read(); } sort($cssFiles); foreach ($cssFiles as $cssEntry) { echo "\n"; } ?>
configuration 

read()) { if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue; $jsFiles[] = $jsEntry; } sort($jsFiles); foreach ($jsFiles as $jsEntry) { echo "\n"; } // print messages if (isset($error) || isset($msg)) { if (isset($error)) { StatusMessage("ERROR", $error); } if (isset($msg)) { StatusMessage("INFO", $msg); } } // check if config.cfg is valid if (!isset($cfg->default)) { StatusMessage("ERROR", _("Please set up your master configuration file (config/config.cfg) first!"), ""); echo "\n\n"; die(); } ?>
addElement(new htmlTitle(_("Profile management")), true); // new profile $container->addElement(new htmlSubTitle(_("Add profile")), true); $newProfileInput = new htmlTableExtendedInputField(_("Profile name"), 'addprofile', null, '230'); $newProfileInput->setFieldSize(15); $container->addElement($newProfileInput, true); $profileNewPwd1 = new htmlTableExtendedInputField(_("Profile password"), 'addpassword'); $profileNewPwd1->setIsPassword(true); $profileNewPwd1->setFieldSize(15); $container->addElement($profileNewPwd1, true); $profileNewPwd2 = new htmlTableExtendedInputField(_("Reenter password"), 'addpassword2'); $profileNewPwd2->setIsPassword(true); $profileNewPwd2->setFieldSize(15); $profileNewPwd2->setSameValueFieldID('addpassword'); $container->addElement($profileNewPwd2, true); $existing = array(); foreach ($files as $file) { $existing[$file] = $file . '.conf'; } $builtIn = array(); foreach (getConfigTemplates() as $file) { $builtIn[$file] = $file . '.conf.sample'; } $templates = array( _('Built-in templates') => $builtIn, _('Existing server profiles') => $existing, ); $addTemplateSelect = new htmlTableExtendedSelect('addTemplate', $templates, array('unix.conf.sample'), _('Template'), '267'); $addTemplateSelect->setContainsOptgroups(true); $addTemplateSelect->setHasDescriptiveElements(true); $container->addElement($addTemplateSelect, true); $newProfileButton = new htmlButton('btnAddProfile', _('Add')); $newProfileButton->setOnClick("jQuery('#action').val('add');showConfirmationDialog('" . _("Add profile") . "', '" . _('Ok') . "', '" . _('Cancel') . "', 'passwordDialogDiv', 'profileForm', null); document.getElementById('passwd').focus();"); $container->addElement($newProfileButton, true); $container->addElement($topicSpacer, true); // rename profile $container->addElement(new htmlSubTitle(_("Rename profile")), true); $container->addElement(new htmlTableExtendedSelect('oldfilename', $files, array(), _('Profile name'), '231'), true); $oldProfileInput = new htmlTableExtendedInputField(_('New profile name'), 'renfilename'); $oldProfileInput->setFieldSize(15); $container->addElement($oldProfileInput, true); $renameProfileButton = new htmlButton('btnRenameProfile', _('Rename')); $renameProfileButton->setOnClick("jQuery('#action').val('rename');showConfirmationDialog('" . _("Rename profile") . "', '" . _('Ok') . "', '" . _('Cancel') . "', 'passwordDialogDiv', 'profileForm', null); document.getElementById('passwd').focus();"); $container->addElement($renameProfileButton, true); $container->addElement($topicSpacer, true); // delete profile $container->addElement(new htmlSubTitle(_("Delete profile")), true); $container->addElement(new htmlTableExtendedSelect('delfilename', $files, array(), _('Profile name'), '232'), true); $deleteProfileButton = new htmlButton('btnDeleteProfile', _('Delete')); $deleteProfileButton->setOnClick("jQuery('#action').val('delete');showConfirmationDialog('" . _("Delete profile") . "', '" . _('Ok') . "', '" . _('Cancel') . "', 'passwordDialogDiv', 'profileForm', null); document.getElementById('passwd').focus();"); $container->addElement($deleteProfileButton, true); $container->addElement($topicSpacer, true); // set password $container->addElement(new htmlSubTitle(_("Set profile password")), true); $container->addElement(new htmlTableExtendedSelect('setprofile', $files, array(), _('Profile name'), '233'), true); $profileSetPwd1 = new htmlTableExtendedInputField(_("Profile password"), 'setpassword'); $profileSetPwd1->setIsPassword(true); $profileSetPwd1->setFieldSize(15); $container->addElement($profileSetPwd1, true); $profileSetPwd2 = new htmlTableExtendedInputField(_("Reenter password"), 'setpassword2'); $profileSetPwd2->setIsPassword(true); $profileSetPwd2->setFieldSize(15); $profileSetPwd2->setSameValueFieldID('setpassword'); $container->addElement($profileSetPwd2, true); $setPasswordProfileButton = new htmlButton('btnSetPasswordProfile', _('Set profile password')); $setPasswordProfileButton->setOnClick("jQuery('#action').val('setpass');showConfirmationDialog('" . _("Set profile password") . "', '" . _('Ok') . "', '" . _('Cancel') . "', 'passwordDialogDiv', 'profileForm', null); document.getElementById('passwd').focus();"); $container->addElement($setPasswordProfileButton, true); $container->addElement($topicSpacer, true); // set default profile $conf = new LAMCfgMain(); $defaultprofile = $conf->default; $container->addElement(new htmlSubTitle(_("Change default profile")), true); $container->addElement(new htmlTableExtendedSelect('defaultfilename', $files, array($defaultprofile), _('Profile name'), '234'), true); $defaultProfileButton = new htmlButton('btnDefaultProfile', _('Ok')); $defaultProfileButton->setOnClick("jQuery('#action').val('setdefault');showConfirmationDialog('" . _("Change default profile") . "', '" . _('Ok') . "', '" . _('Cancel') . "', 'passwordDialogDiv', 'profileForm', null); document.getElementById('passwd').focus();"); $container->addElement($defaultProfileButton, true); $container->addElement($topicSpacer, true); $container->addElement(new htmlHiddenInput('action', 'none'), true); $dialogDivContent = new htmlTable(); $dialogDivContent->addElement(new htmlOutputText(_("Master password"))); $masterPassword = new htmlInputField('passwd'); $masterPassword->setIsPassword(true); $dialogDivContent->addElement($masterPassword); $dialogDivContent->addElement(new htmlHelpLink('236')); $dialogDiv = new htmlDiv('passwordDialogDiv', $dialogDivContent); $dialogDiv->setCSSClasses(array('hidden')); $container->addElement($dialogDiv, true); $mainDiv = new htmlDiv('mainDiv', $container); $mainDiv->setCSSClasses(array('filled', 'ui-corner-all')); $mainContainer = new htmlGroup(); $mainContainer->addElement($mainDiv); $mainContainer->addElement(new htmlOutputText('
', false)); $mainContainer->addElement(new htmlLink(_("Back to profile login"), 'conflogin.php')); parseHtml('', $mainContainer, array(), false, $tabindex, 'user'); ?>