From 61012f6572f3234f718ead33cd26750494d75868 Mon Sep 17 00:00:00 2001 From: duergner Date: Wed, 8 Sep 2004 14:40:25 +0000 Subject: [PATCH] PDF editor bug should be removed --- lam/lib/pdfstruct.inc | 21 +++++++++++++-------- lam/templates/pdfedit/pdfmain.php | 6 +++--- lam/templates/pdfedit/pdfpage.php | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lam/lib/pdfstruct.inc b/lam/lib/pdfstruct.inc index fb75bddb..4e09a1ef 100644 --- a/lam/lib/pdfstruct.inc +++ b/lam/lib/pdfstruct.inc @@ -26,19 +26,23 @@ include_once("ldap.inc"); function getPDFStructureDefinitions($scope = "user") { $return = array(); - $dirHandle = opendir($_SESSION['lampath'] . '/config/pdf/' . $scope . '/'); - while($file = readdir($dirHandle)) { - if(!is_dir($file) && $file != '.' && $file != '..' && $file != 'default.xml') { - array_push($return, substr($file,0,strlen($file)-4)); + $path = $_SESSION['lampath'] . 'config/pdf/' . $scope; + if(is_dir($path)) { + $dirHandle = opendir($path); + while($file = readdir($dirHandle)) { + if(!is_dir($file) && $file != '.' && $file != '..' && $file != 'default.xml') { + array_push($return, substr($file,0,strlen($file)-4)); + } } + sort($return); } - sort($return); return $return; } function loadPDFStructureDefinitions($scope='user', $definition='default.xml') { $parser = new xmlParser(); - $xml = $parser->parse($_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition); + $file = $_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition; + $xml = $parser->parse($file); $border = array(); $structure = array(); @@ -61,7 +65,7 @@ function savePDFStructureDefinitions($scope,$definition) { $handle = fopen($_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition,'w'); $pdf_attributes = ''; foreach($_SESSION['currentPageDefinitions'] as $key => $value) { - if($key != 'TYPE') { + if($key != 'type') { $pdf_attributes .= ' ' . $key . '="' . $value . '"'; } } @@ -98,7 +102,8 @@ function savePDFStructureDefinitions($scope,$definition) { } function deletePDFStructureDefinition($scope,$definition) { - return unlink($_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition . '.xml'); + $file = $_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition; + return unlink($file); } function getAvailableLogos() { diff --git a/lam/templates/pdfedit/pdfmain.php b/lam/templates/pdfedit/pdfmain.php index 74f10e8d..f3b9378a 100644 --- a/lam/templates/pdfedit/pdfmain.php +++ b/lam/templates/pdfedit/pdfmain.php @@ -36,12 +36,12 @@ setlanguage(); // Unset pdf structure definitions in session if set if(isset($_SESSION['currentPDFStructure'])) { - unset($_SESSION['currentPDFStructure']); - unset($_SESSION['availablePDFFields']); - unset($_SESSION['currentPageDefinitions']); session_unregister('currentPDFStructure'); session_unregister('availablePDFFields'); session_unregister('currentPageDefinitions'); + unset($_SESSION['currentPDFStructure']); + unset($_SESSION['availablePDFFields']); + unset($_SESSION['currentPageDefinitions']); } // check if user is logged in, if not go to login diff --git a/lam/templates/pdfedit/pdfpage.php b/lam/templates/pdfedit/pdfpage.php index 6cbf2eec..c865c0fb 100644 --- a/lam/templates/pdfedit/pdfpage.php +++ b/lam/templates/pdfedit/pdfpage.php @@ -319,7 +319,7 @@ elseif(isset($_POST['page'])) { $_SESSION['currentPageDefinitions']['logo-max'] = true; } if($_POST['headline'] != 'LDAP Account Manager' && $_POST['headline'] != $_SESSION['currentPageDefinitions']['headline']) { - $_SESSION['currentPageDefinitions']['headline'] = $_POST['headline']; + $_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_POST['headline'])); } if($_POST['margin-top'] != '10.0' && $_SESSION['currentPageDefinitions']['margin-top'] != $_POST['margin-top']) { $_SESSION['currentPageDefinitions']['margin-top'] = $_POST['margin-top'];