server()) { metaRefresh("../login.php"); exit; } // check if new template should be created if(isset($_POST['createNewTemplate'])) { metaRefresh('pdfpage.php?type=' . htmlspecialchars($_POST['typeId'])); exit(); } $typeManager = new \LAM\TYPES\TypeManager(); $types = $typeManager->getConfiguredTypes(); $sortedTypes = array(); foreach ($types as $type) { if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) { continue; } $sortedTypes[$type->getId()] = $type->getAlias(); } natcasesort($sortedTypes); $container = new htmlTable(); $container->addElement(new htmlTitle(_('PDF editor')), true); if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) { // delete structure if (\LAM\PDF\deletePDFStructure($_POST['profileDeleteType'], $_POST['profileDeleteName'])) { $message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), \LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName'])); $message->colspan = 10; $container->addElement($message, true); } else { $message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), \LAM\TYPES\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['typeId']])) { // check master password if (!$cfg->checkPassword($_POST['passwd_' . $_POST['typeId']])) { $impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); } elseif (\LAM\PDF\copyPdfProfiles($_POST['importProfiles_' . $_POST['typeId']], $_POST['typeId'])) { $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 (\LAM\PDF\copyPdfProfiles($_POST['exportProfiles'], $_POST['typeId'], $_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(\LAM\PDF\uploadPDFLogo($file, $filename), true); } // delete logo file if (isset($_POST['delLogo'])) { $toDel = $_POST['logo']; $container->addElement(\LAM\PDF\deletePDFLogo($toDel), true); } // get list of account types $availableTypes = array(); $templateClasses = array(); foreach ($sortedTypes as $typeId => $title) { $type = $typeManager->getConfiguredType($typeId); $templateClasses[] = array( 'typeId' => $type->getId(), 'scope' => $type->getScope(), 'title' => $title, 'templates' => ""); $availableTypes[$title] = $type->getId(); } // get list of templates for each account type for ($i = 0; $i < sizeof($templateClasses); $i++) { $templateClasses[$i]['templates'] = \LAM\PDF\getPDFStructures($templateClasses[$i]['typeId']); } // check if a template should be edited for ($i = 0; $i < sizeof($templateClasses); $i++) { if (isset($_POST['editTemplate_' . $templateClasses[$i]['typeId']]) || isset($_POST['editTemplate_' . $templateClasses[$i]['typeId'] . '_x'])) { metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClasses[$i]['typeId']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClasses[$i]['typeId']])); exit; } } include '../main_header.php'; ?>