diff --git a/lam/lib/html.inc b/lam/lib/html.inc
index 7e17862f..e7aa321d 100644
--- a/lam/lib/html.inc
+++ b/lam/lib/html.inc
@@ -947,7 +947,7 @@ class htmlSelect extends htmlElement {
$name = ' name="' . $this->name . '" id="' . $this->name . '"';
if ($this->multiSelect) {
$multi = ' multiple';
- $name = ' name="' . $this->name . '[]"';
+ $name = ' name="' . $this->name . '[]" id="' . $this->name . '"';
}
$size = ' size="' . $this->size . '"';
$class = '';
@@ -2514,9 +2514,45 @@ class htmlDiv extends htmlElement {
echo '';
return $return;
}
+}
-
+/**
+ * Creates a JavaScript element.
+ *
+ * @package metaHTML
+ */
+class htmlJavaScript extends htmlElement {
+ /** htmlElement that generates inner content */
+ private $content = null;
+
+ /**
+ * Constructor.
+ *
+ * @param String $content script
+ */
+ function __construct($content) {
+ $this->content = $content;
+ }
+
+ /**
+ * Prints the HTML code for this element.
+ *
+ * @param string $module Name of account module
+ * @param array $input List of meta-HTML elements
+ * @param array $values List of values which override the defaults in $input (name => value)
+ * @param boolean $restricted If true then no buttons will be displayed
+ * @param integer $tabindex Start value of tabulator index for input fields
+ * @param string $scope Account type
+ * @return array List of input field names and their type (name => type)
+ */
+ function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
+ $return = array();
+ echo '';
+ return $return;
+ }
}
diff --git a/lam/lib/lamPDF.inc b/lam/lib/lamPDF.inc
index 31967af8..a5f13d5f 100644
--- a/lam/lib/lamPDF.inc
+++ b/lam/lib/lamPDF.inc
@@ -86,13 +86,13 @@ class lamPDF extends UFPDF {
$this->setMargins('10.0','10.0','10.0');
$this->setAutoPageBreak(true,'20.0');
}
-
+
/**
* Creates the PDF page header.
*/
function header() {
if($this->page_definitions['filename'] != 'none') {
- $imageFile = substr(__FILE__,0,strlen(__FILE__)- 14) . "config/pdf/logos/" . $this->page_definitions['filename'];
+ $imageFile = substr(__FILE__,0,strlen(__FILE__)- 14) . "config/pdf/" . $_SESSION['config']->getName() . "/logos/" . $this->page_definitions['filename'];
$imgProperties = getimagesize($imageFile);
$this->Image($imageFile,10,15,($imgProperties[0] / $this->k) / 5, ($imgProperties[1] / $this->k) / 5,0,"JPG");
}
diff --git a/lam/lib/pdfstruct.inc b/lam/lib/pdfstruct.inc
index ddc2523d..3f0b8b8d 100644
--- a/lam/lib/pdfstruct.inc
+++ b/lam/lib/pdfstruct.inc
@@ -37,22 +37,27 @@ include_once("ldap.inc");
/**
* This function will return all available PDF structure definitions for the submitted
* account scope.
- *
+ *
* @param string $scope The account scope the PDF structure definitions should be
* returned.
- *
+ * @param string $profile server profile name
+ *
* @return array $scope All available PDF structure definitions for the submitted account
- * scope. Each entry is a string being the filename that may be passed to the
+ * scope. Each entry is a string being the filename that may be passed to the
* createModulePDF() function as second argument.
*/
-function getPDFStructureDefinitions($scope = "user") {
+function getPDFStructureDefinitions($scope = "user", $profile = null) {
$return = array();
- $path = dirname(__FILE__) . '/../config/pdf/';
+
+ if (!isset($profile)) {
+ $profile = $_SESSION['config']->getName();
+ }
+ $path = dirname(__FILE__) . '/../config/pdf/' . $profile;
if(is_dir($path)) {
$dirHandle = opendir($path);
while($file = readdir($dirHandle)) {
$struct_file = explode('.',$file);
- if(!is_dir($path.$file) && ($file != '.') && ($file != '..') && ($struct_file[1] == $scope) && ($struct_file[2] == 'xml')) {
+ if(!is_dir($path.$file) && ($file != '.') && ($file != '..') && (sizeof($struct_file) == 3) && ($struct_file[1] == $scope) && ($struct_file[2] == 'xml')) {
array_push($return, $struct_file[0]);
}
}
@@ -67,12 +72,12 @@ function getPDFStructureDefinitions($scope = "user") {
*
* @param string $scope The account scope for wich the PDF structure should be returned.
* @param string $pdf_structure Structure name of selected scope wich should be returned.
- *
+ *
* @return array PDF structure
*/
function loadPDFStructureDefinitions($scope='user',$pdf_structure='default') {
$parser = new xmlParser();
- $file = dirname(__FILE__) . '/../config/pdf/' . $pdf_structure . '.' . $scope . '.xml';
+ $file = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/' . $pdf_structure . '.' . $scope . '.xml';
$xml = $parser->parse($file);
$border = array();
$structure = array();
@@ -101,8 +106,8 @@ function loadPDFStructureDefinitions($scope='user',$pdf_structure='default') {
function savePDFStructureDefinitions($scope,$definition) {
if (!preg_match('/[a-zA-Z0-9\-\_]+/',$definition)) return 'no perms';
if (!preg_match('/[a-zA-Z]+/',$scope)) return 'no perms';
- $struct_file = dirname(__FILE__) . '/../config/pdf/' . $definition . '.' . $scope . '.xml';
- if(!is_writable(dirname(__FILE__) . '/../config/pdf/')) {
+ $struct_file = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/' . $definition . '.' . $scope . '.xml';
+ if(!is_writable(dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName())) {
return 'no perms';
}
else {
@@ -150,33 +155,33 @@ function savePDFStructureDefinitions($scope,$definition) {
/**
* Deletes XML file with PDF structure definitions.
- *
+ *
* @param string $scope account type
* @param string $definition Name of definition to delete
- *
+ *
* @return boolean True if file was deleted or false if a problem occured.
*/
function deletePDFStructureDefinition($scope, $definition) {
if (!preg_match('/[a-zA-Z0-9\-\_]+/',$definition)) return false;
if (!preg_match('/[a-zA-Z]+/',$scope)) return false;
- $file = dirname(__FILE__) . '/../config/pdf/' . $definition . '.' . $scope . '.xml';
+ $file = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/' . $definition . '.' . $scope . '.xml';
if(is_file($file) && is_writable($file)) {
return unlink($file);
}
else {
return false;
}
-
+
}
/**
* This function returns an array with all aviliable logo images.
- *
+ *
* @return array list of logo files
*/
function getAvailableLogos() {
$return = array();
- $dirPath = dirname(__FILE__) . '/../config/pdf/logos/';
+ $dirPath = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/logos/';
$dirHandle = opendir($dirPath);
while($file = readdir($dirHandle)) {
if(!is_dir($file) && $file != '.' && $file != '..' && preg_match('/\\.(jpg|png)$/',$file)) {
@@ -189,4 +194,47 @@ function getAvailableLogos() {
sort($return);
return $return;
}
-?>
\ No newline at end of file
+
+
+/**
+ * Copies PDF profiles to other server profiles.
+ *
+ * @param array $pdfProfiles PDF profile names
+ * @param String $scope account scope
+ * @param array $dests destinations
+ *
+ * @return boolean operation succeeded
+ */
+function copyPdfProfiles($pdfProfiles, $scope, $dests = array()) {
+ $state = true;
+ $profilePath = substr(__FILE__, 0, strlen(__FILE__) - 17) . 'config/pdf/';
+ foreach ($pdfProfiles as $profile) {
+ //part 1: server profile
+ //part 2: account profile
+ $tmpArr = explode('##', $profile);
+ $src = $profilePath . $tmpArr[0] . '/' . $tmpArr[1] . '.' . $scope . '.xml';
+ if (!empty($dests)) {
+ foreach ($dests as $dest) {
+ if ($dest == 'templates*') {
+ $dst = substr(__FILE__, 0, strlen(__FILE__) - 17) . 'config/templates/pdf/' . $tmpArr[1] . '.' . $scope . '.xml';
+ } else {
+ $dst = $profilePath . $dest . '/' . $tmpArr[1] . '.' . $scope . '.xml';
+ }
+ if (!@copy($src, $dst)) {
+ StatusMessage('ERROR', _('Failed to export!'), $tmpArr[1] . '.' . $scope . '.xml');
+ $state = false;
+ }
+ }
+ } else {
+ $dst = $profilePath . $_SESSION['config']->getName() . '/' . $tmpArr[1] . '.' . $scope . '.xml';
+ if (!@copy($src, $dst)) {
+ StatusMessage('ERROR', _('Failed to import!'), $tmpArr[1] . '.' . $scope . '.xml');
+ $state = false;
+ }
+ }
+ }
+
+ return $state;
+}
+
+?>
diff --git a/lam/lib/profiles.inc b/lam/lib/profiles.inc
index d5abe2d6..84b15b29 100644
--- a/lam/lib/profiles.inc
+++ b/lam/lib/profiles.inc
@@ -33,10 +33,16 @@ $Id$
* Returns an array of string with all available profiles for the given account type
*
* @param string $scope account type
+* @param string $profile server profile name
* @return array profile names
*/
-function getAccountProfiles($scope) {
- $dir = @dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles");
+function getAccountProfiles($scope, $profile = null) {
+ if (!isset($profile)) {
+ $profile = $_SESSION['config']->getName();
+ }
+
+ $dir = @dir(substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $profile);
+
$ret = array();
$pos = 0;
if ($dir) {
@@ -56,6 +62,7 @@ function getAccountProfiles($scope) {
return $ret;
}
+
/**
* Loads an profile of the given account type
*
@@ -66,7 +73,7 @@ function getAccountProfiles($scope) {
function loadAccountProfile($profile, $scope) {
if (!preg_match("/^[0-9a-z _-]+$/i", $profile) || !preg_match("/^[a-z]+$/i", $scope)) return false;
$settings = array();
- $file = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $profile . "." . $scope;
+ $file = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $_SESSION['config']->getName() . '/' . $profile . "." . $scope;
if (is_file($file) == True) {
$file = @fopen($file, "r");
if ($file) {
@@ -114,7 +121,7 @@ function saveAccountProfile($attributes, $profile, $scope) {
if (!is_array($attributes)) {
return false;
}
- $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $profile . "." . $scope;
+ $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/" . $_SESSION['config']->getName() . '/' . $profile . "." . $scope;
$file = @fopen($path, "w");
if ($file) {
// write attributes
@@ -147,7 +154,7 @@ function saveAccountProfile($attributes, $profile, $scope) {
function delAccountProfile($file, $scope) {
if (!$_SESSION['loggedIn'] == true) return false;
if (!preg_match("/^[0-9a-z _-]+$/i", $file) || !preg_match("/^[a-z]+$/i", $scope)) return false;
- $prof = substr(__FILE__, 0, strlen(__FILE__) - 16) . "config/profiles/" . $file . "." . $scope;
+ $prof = substr(__FILE__, 0, strlen(__FILE__) - 16) . "config/profiles/". $_SESSION['config']->getName() . '/' . $file . "." . $scope;
if (is_file($prof)) {
return @unlink($prof);
}
@@ -155,4 +162,45 @@ function delAccountProfile($file, $scope) {
}
+/**
+ * Copies account profiles to other server profiles.
+ *
+ * @param array $accountProfiles account profile names
+ * @param String $scope account scope
+ * @param array $dests destinations
+ *
+ * @return boolean operation succeeded
+ */
+function copyAccountProfiles($accountProfiles, $scope, $dests = array()) {
+ $state = true;
+ $profilePath = substr(__FILE__, 0, strlen(__FILE__) - 17) . '/config/profiles/';
+ foreach ($accountProfiles as $profile) {
+ //part 1: server profile
+ //part 2: account profile
+ $tmpArr = explode('##', $profile);
+ $src = $profilePath . $tmpArr[0] . '/' . $tmpArr[1] . '.' . $scope;
+ if (!empty($dests)) {
+ foreach ($dests as $dest) {
+ if ($dest == 'templates*') {
+ $dst = substr(__FILE__, 0, strlen(__FILE__) - 17) . '/config/templates/profiles/' . $tmpArr[1] . '.' . $scope;
+ } else {
+ $dst = $profilePath . $dest . '/' . $tmpArr[1] . '.' . $scope;
+ }
+ if (!@copy($src, $dst)) {
+ StatusMessage('ERROR', _('Failed to export!'), $tmpArr[1] . '.' . $scope);
+ $state = false;
+ }
+ }
+ } else {
+ $dst = $profilePath . $_SESSION['config']->getName() . '/' . $tmpArr[1] . '.' . $scope;
+ if (!@copy($src, $dst)) {
+ StatusMessage('ERROR', _('Failed to import!'), $tmpArr[1] . '.' . $scope);
+ $state = false;
+ }
+ }
+ }
+
+ return $state;
+}
+
?>
diff --git a/lam/lib/upgrade.inc b/lam/lib/upgrade.inc
new file mode 100644
index 00000000..09c6c7b4
--- /dev/null
+++ b/lam/lib/upgrade.inc
@@ -0,0 +1,227 @@
+ value) to an account profile
+ *
+ * @param array $profiles server profiles
+ */
+function upgradeConfigToServerProfileFolders($profiles) {
+ if (!is_writable('../config')) {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The directory \'/config\' has missing write permissions.');
+ return;
+ }
+
+ // copy default configs
+ if (!file_exists('../config/templates')) {
+ @mkdir('../config/templates');
+ recursiveCopy('../config/pdf/', '../config/templates/pdf/', $profiles, 'default.');
+ recursiveCopy('../config/profiles/', '../config/templates/profiles/', $profiles, 'default.');
+ }
+
+ foreach ($profiles as $profile) {
+ // upgrade PDF configs
+ $dir = '../config/pdf/' . $profile;
+ if (!file_exists($dir)) {
+ recursiveCopy('../config/pdf/', $dir, $profiles);
+ }
+
+ // upgrade profiles configs
+ $dir = '../config/profiles/' . $profile;
+ if (!file_exists($dir)) {
+ recursiveCopy('../config/profiles/', $dir, $profiles);
+ }
+ }
+
+ // delete old files
+ recursiveDelete('../config/pdf', $profiles);
+ recursiveDelete('../config/profiles', $profiles);
+}
+
+/**
+ * Saves an hash array (attribute => value) to an account profile
+ *
+ * @param array $profiles server profiles
+ */
+function copyConfigTemplates($profiles) {
+ foreach ($profiles as $profile) {
+ // copy templates but do not override existing files
+ recursiveCopy('../config/templates/pdf/', '../config/pdf/' . $profile, $profiles, null, false);
+ recursiveCopy('../config/templates/profiles/', '../config/profiles/' . $profile, $profiles, null, false);
+ }
+}
+
+/**
+ * Copy a file or recursively copy a directory
+ *
+ * @param string $src - source path to file or directory
+ * @param string $dst - destination path to file or directory
+ * @param array $profiles - server profiles (used to avoid copying of newly created folders)
+ * @param string $fileFilter copy only files that start with the given filter
+ * @param boolean $overwrite overwrite existing files
+ */
+function recursiveCopy($src, $dst, $profiles, $fileFilter = null, $overwrite = true) {
+ $dir = @opendir($src);
+ if (!file_exists($dst)) {
+ $tmpState = @mkdir($dst);
+ if ($tmpState === false) {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The directory \'' . $dst . '\' could not be created.');
+ }
+ }
+ while (false !== ($file = readdir($dir))) {
+ if ($file != '.' && $file != '..' && !in_array($file, $profiles)) {
+ if (is_dir($src . '/' . $file) && ($file == 'logos')) {
+ recursiveCopy($src . '/' . $file, $dst . '/' . $file, $profiles, $fileFilter, $overwrite);
+ }
+ elseif ((isset($fileFilter) && (strpos($file, $fileFilter) === 0 || $file == '.htaccess'))
+ || (!isset($fileFilter)))
+ {
+ if ($overwrite || !file_exists($dst . '/' . $file)) {
+ $tmpState = @copy($src . '/' . $file, $dst . '/' . $file);
+ if ($tmpState === false) {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The file ' . $file . ' could not be copied.');
+ }
+ }
+ }
+ }
+ }
+ closedir($dir);
+}
+
+
+/**
+ * Delete a file or recursively delete a directory
+ *
+ * @param string $src - path to file or directory
+ * @param array $profiles - server profiles (used to avoid copying of newly created folders)
+ */
+function recursiveDelete($src, $profiles) {
+ if (is_file($src)) {
+ $tmpState = @unlink($src);
+ if ($tmpState === false) {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The file ' . $src . ' could not be deleted.');
+ }
+ return;
+ } else if (is_dir($src) && is_writable($src)) {
+ $dir = @opendir($src);
+ while (false !== ($path = readdir($dir))) {
+ if ($path != '.' && $path != '..' && !in_array($path, $profiles)) {
+ recursiveDelete($src . '/' . $path, $profiles);
+ }
+ }
+ @closedir($dir);
+
+ if ($src != '../config/pdf' && $src != '../config/profiles') {
+ $tmpState = @rmdir($src);
+ if ($tmpState === false) {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The directory ' . $src . ' could not be deleted.');
+ }
+ }
+ return;
+ } else {
+ StatusMessage('ERROR', 'Upgrade failed.', 'The directory ' . $src . ' has missing write permissions.');
+ return;
+ }
+}
+
+?>
diff --git a/lam/templates/config/profmanage.php b/lam/templates/config/profmanage.php
index 6d1a4e67..468e4251 100644
--- a/lam/templates/config/profmanage.php
+++ b/lam/templates/config/profmanage.php
@@ -89,6 +89,10 @@ if (isset($_POST['action'])) {
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!");
@@ -102,7 +106,7 @@ if (isset($_POST['action'])) {
}
// delete profile
elseif ($_POST['action'] == "delete") {
- if (preg_match("/^[a-z0-9_-]+$/i", $_POST['delfilename']) && @unlink("../../config/" . $_POST['delfilename'] . ".conf")) {
+ if (deleteConfigProfile($_POST['delfilename']) == null) {
$msg = _("Profile deleted.");
}
else $error = _("Unable to delete profile!");
diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js
index c7c2f76f..a58560fb 100644
--- a/lam/templates/lib/500_lam.js
+++ b/lam/templates/lib/500_lam.js
@@ -320,3 +320,70 @@ function showConfirmationDialog(title, okText, cancelText, dialogDiv, formName,
jQuery('#' + dialogDiv).parent().appendTo(document.forms[formName]);
}
+/**
+ * Alines the elements with the given IDs to the same width.
+ *
+ * @param elementIDs IDs
+ */
+function equalWidth(elementIDs) {
+ var maxWidth = 0;
+ for (var i = 0; i < elementIDs.length; ++i) {
+ if (jQuery(elementIDs[i]).width() > maxWidth) {
+ maxWidth = jQuery(elementIDs[i]).width();
+ };
+ }
+ for (var i = 0; i < elementIDs.length; ++i) {
+ jQuery(elementIDs[i]).css({'width': maxWidth - (jQuery(elementIDs[i]).outerWidth() - jQuery(elementIDs[i]).width())});
+ }
+}
+
+/**
+ * Shows the dialog to change the list settings.
+ *
+ * @param title dialog title
+ * @param okText text for Ok button
+ * @param cancelText text for Cancel button
+ * @param scope account type
+ * @param selectFieldName name of select box with profile name
+ * @param serverProfile profile name
+ */
+function showDistributionDialog(title, okText, cancelText, scope, type, selectFieldName, serverProfile) {
+ // show dialog
+ var buttonList = {};
+ var dialogId = '';
+ buttonList[cancelText] = function() { jQuery(this).dialog("close"); };
+
+ if (type == 'export') {
+ // show structure name to export
+ jQuery('#exportName').text(jQuery('[name=' + selectFieldName + ']').val());
+ dialogId = 'exportDialog';
+ buttonList[okText] = function() { document.forms["exportDialogForm"].submit(); };
+ jQuery('').attr({
+ type: 'hidden',
+ name: 'exportProfiles[]',
+ value: serverProfile + '##' + jQuery('[name=' + selectFieldName + ']').val()
+ }).appendTo('form');
+ jQuery('').attr({
+ type: 'hidden',
+ name: 'scope',
+ value: scope
+ }).appendTo('form');
+ } else if (type == 'import') {
+ dialogId = 'importDialog_' + scope;
+ buttonList[okText] = function() { document.forms["importDialogForm_" + scope].submit(); };
+ }
+
+ jQuery('#' + dialogId).dialog({
+ modal: true,
+ title: title,
+ dialogClass: 'defaultBackground',
+ buttons: buttonList,
+ width: 'auto'
+ });
+ if (type == 'export') {
+ equalWidth(new Array('#passwd', '#destServerProfiles'));
+ } else if (type == 'import') {
+ equalWidth(new Array('#passwd_' + scope, '#importProfiles_' + scope));
+ }
+}
+
diff --git a/lam/templates/login.php b/lam/templates/login.php
index 7f80dfd5..6a89adfb 100644
--- a/lam/templates/login.php
+++ b/lam/templates/login.php
@@ -43,6 +43,9 @@ include_once("../lib/selfService.inc");
/** access to configuration options */
include_once("../lib/config.inc"); // Include config.inc which provides Config class
+/** Upgrade functions */
+include_once("../lib/upgrade.inc");
+
// set session save path
if (strtolower(session_module_name()) == 'files') {
session_save_path(dirname(__FILE__) . '/../sess');
@@ -176,6 +179,20 @@ function display_LoginPage($config_object) {
echo "\n";
}
+ // upgrade if pdf/profiles contain single files
+ if (containsFiles('../config/profiles') || containsFiles('../config/pdf')) {
+ echo 'bla';
+ $result = testPermissions();
+ if (sizeof($result) > 0) {
+ StatusMessage('ERROR', 'Unable to migrate configuration files. Please allow write access to these paths:', implode('
', $result));
+ }
+ else {
+ upgradeConfigToServerProfileFolders(getConfigProfiles());
+ }
+ }
+ // copy any missing default profiles
+ copyConfigTemplates(getConfigProfiles());
+
// set focus on password field
echo "
@@ -560,6 +569,6 @@ if(!empty($_POST['checklogin'])) {
}
}
+//displays the login window
display_LoginPage($_SESSION["config"]);
-
?>
diff --git a/lam/templates/pdfedit/pdfmain.php b/lam/templates/pdfedit/pdfmain.php
index a7cd6045..661bd2e1 100644
--- a/lam/templates/pdfedit/pdfmain.php
+++ b/lam/templates/pdfedit/pdfmain.php
@@ -94,6 +94,32 @@ if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == '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);
+ }
+}
+
// get list of account types
$availableScopes = '';
$templateClasses = array();
@@ -120,14 +146,19 @@ for ($i = 0; $i < sizeof($templateClasses); $i++) {
include '../main_header.php';
?>
-\n";
+ echo "\n";
+
+ for ($i = 0; $i < sizeof($templateClasses); $i++) {
+ $scope = $templateClasses[$i]['scope'];
+ $tmpArr = array();
+ foreach ($configProfiles as $profile) {
+ if ($profile != $_SESSION['config']->getName()) {
+ $accountProfiles = getPDFStructureDefinitions($scope, $profile);
+ for ($p = 0; $p < sizeof($accountProfiles); $p++) {
+ $tmpArr[$profile][$accountProfiles[$p]] = $profile . '##' . $accountProfiles[$p];
+ }
+ }
+ }
+
+ //import dialog
+ echo "\n";
+ echo "';
+ echo "
\n";
+ }
+
+ //export dialog
+ echo "\n";
+ echo "';
+ echo "
\n";
+
// form for delete action
echo '