server()) { metaRefresh("../login.php"); exit; } // check if new template should be created if(isset($_POST['createNewTemplate'])) { metaRefresh('pdfpage.php?type=' . htmlspecialchars($_POST['scope'])); exit(); } $scopes = $_SESSION['config']->get_ActiveTypes(); $sortedScopes = array(); for ($i = 0; $i < sizeof($scopes); $i++) { if (isAccountTypeHidden($scopes[$i])) { continue; } $sortedScopes[$scopes[$i]] = getTypeAlias($scopes[$i]); } natcasesort($sortedScopes); $container = new htmlTable(); $container->addElement(new htmlTitle(_('PDF editor')), true); if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) { // delete structure if (deletePDFStructureDefinition($_POST['profileDeleteType'], $_POST['profileDeleteName'])) { $message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName'])); $message->colspan = 10; $container->addElement($message, true); } else { $message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName'])); $message->colspan = 10; $container->addElement($message, true); } } if (isset($_POST['importexport']) && ($_POST['importexport'] === '1')) { $cfg = new LAMCfgMain(); $impExpMessage = null; if (isset($_POST['importProfiles_' . $_POST['scope']])) { // check master password if (!$cfg->checkPassword($_POST['passwd_' . $_POST['scope']])) { $impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); } elseif (copyPdfProfiles($_POST['importProfiles_' . $_POST['scope']], $_POST['scope'])) { $impExpMessage = new htmlStatusMessage('INFO', _('Import successful')); } } else if (isset($_POST['exportProfiles'])) { // check master password if (!$cfg->checkPassword($_POST['passwd'])) { $impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); } elseif (copyPdfProfiles($_POST['exportProfiles'], $_POST['scope'], $_POST['destServerProfiles'])) { $impExpMessage = new htmlStatusMessage('INFO', _('Export successful')); } } if ($impExpMessage != null) { $impExpMessage->colspan = 10; $container->addElement($impExpMessage, true); } } // upload logo file if (isset($_POST['uploadLogo']) && !empty($_FILES['logoUpload']) && !empty($_FILES['logoUpload']['size'])) { $file = $_FILES['logoUpload']['tmp_name']; $filename = $_FILES['logoUpload']['name']; $container->addElement(uploadPDFLogo($file, $filename), true); } // delete logo file if (isset($_POST['delLogo'])) { $toDel = $_POST['logo']; $container->addElement(deletePDFLogo($toDel), true); } // get list of account types $availableScopes = ''; $templateClasses = array(); foreach ($sortedScopes as $scope => $title) { $templateClasses[] = array( 'scope' => $scope, 'title' => $title, 'templates' => ""); $availableScopes[$title] = $scope; } // get list of templates for each account type for ($i = 0; $i < sizeof($templateClasses); $i++) { $templateClasses[$i]['templates'] = getPDFStructureDefinitions($templateClasses[$i]['scope']); } // check if a template should be edited for ($i = 0; $i < sizeof($templateClasses); $i++) { if (isset($_POST['editTemplate_' . $templateClasses[$i]['scope']]) || isset($_POST['editTemplate_' . $templateClasses[$i]['scope'] . '_x'])) { metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClasses[$i]['scope']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClasses[$i]['scope']])); exit; } } include '../main_header.php'; ?>