ship with patched version of fpdf

This commit is contained in:
Roland Gruber 2016-05-10 18:37:01 +02:00
parent c4075de648
commit 06e716139a
7 changed files with 36 additions and 38 deletions

View File

@ -8,7 +8,7 @@ Homepage: https://www.ldap-account-manager.org/
Package: ldap-account-manager Package: ldap-account-manager
Architecture: all Architecture: all
Depends: php5 (>= 5.4.26) | php (>= 21), php5-ldap | php-ldap, php5-gd | php-gd, php5-json | php-json , php5-imagick | php-imagick, apache2 | httpd, php-fpdf (>= 1.7), debconf (>= 0.2.26) | debconf-2.0, ${misc:Depends} Depends: php5 (>= 5.4.26) | php (>= 21), php5-ldap | php-ldap, php5-gd | php-gd, php5-json | php-json , php5-imagick | php-imagick, apache2 | httpd, debconf (>= 0.2.26) | debconf-2.0, ${misc:Depends}
Recommends: php-apc Recommends: php-apc
Suggests: ldap-server, php5-mcrypt, ldap-account-manager-lamdaemon, perl Suggests: ldap-server, php5-mcrypt, ldap-account-manager-lamdaemon, perl
Description: webfrontend for managing accounts in an LDAP directory Description: webfrontend for managing accounts in an LDAP directory

View File

@ -145,7 +145,7 @@ C:
For more details on the GNU Lesser General Public License, For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html see http://www.gnu.org/copyleft/lesser.html
See also /usr/share/common-licenses/LGPL-2. See also /usr/share/common-licenses/LGPL-2.
D: D:
@ -173,7 +173,7 @@ D:
Programs and licenses with other licenses and/or authors than the Programs and licenses with other licenses and/or authors than the
main license and authors: main license and authors:
lib/fpdf.php A 2008 Olivier Plathey lib/fpdf-lam.inc A 2008 Olivier Plathey
lib/font/Vera* B 2003 Bitstream, Inc. lib/font/Vera* B 2003 Bitstream, Inc.
templates/lib/*wz_tooltip.js C Walter Zorn templates/lib/*wz_tooltip.js C Walter Zorn
lib/3rdParty/phpseclib D Jim Wigginton lib/3rdParty/phpseclib D Jim Wigginton

View File

@ -24,8 +24,6 @@ files=`ls -a *.jpg`
for file in $files; do for file in $files; do
cp $file /var/lib/ldap-account-manager/config/templates/pdf/logos/$file cp $file /var/lib/ldap-account-manager/config/templates/pdf/logos/$file
done done
if [ ! -h /usr/share/ldap-account-manager/lib/fpdf.php ]; then\
ln -s /usr/share/fpdf/fpdf.php /usr/share/ldap-account-manager/lib/fpdf.php; fi
if [ ! -h /usr/share/ldap-account-manager/config ]; then\ if [ ! -h /usr/share/ldap-account-manager/config ]; then\
ln -s /var/lib/ldap-account-manager/config /usr/share/ldap-account-manager/config; fi ln -s /var/lib/ldap-account-manager/config /usr/share/ldap-account-manager/config; fi
if [ ! -h /usr/share/ldap-account-manager/sess ]; then\ if [ ! -h /usr/share/ldap-account-manager/sess ]; then\

View File

@ -6,7 +6,6 @@ if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ] db_version 2.0 || [ $? -lt 30 ]
rm -f /usr/share/ldap-account-manager/lib/fpdf.php
rm -f /usr/share/ldap-account-manager/sess rm -f /usr/share/ldap-account-manager/sess
rm -f /usr/share/ldap-account-manager/tmp rm -f /usr/share/ldap-account-manager/tmp
rm -f /usr/share/ldap-account-manager/config rm -f /usr/share/ldap-account-manager/config

View File

@ -178,7 +178,7 @@ D:
Programs and licenses with other licenses and/or authors than the Programs and licenses with other licenses and/or authors than the
main license and authors: main license and authors:
lib/fpdf.php A 2008 Olivier Plathey lib/fpdf-lam.inc A 2008 Olivier Plathey
lib/font/Vera* B 2003 Bitstream, Inc. lib/font/Vera* B 2003 Bitstream, Inc.
templates/lib/*wz_tooltip.js C Walter Zorn templates/lib/*wz_tooltip.js C Walter Zorn
lib/3rdParty/phpseclib D Jim Wigginton lib/3rdParty/phpseclib D Jim Wigginton

View File

@ -5,6 +5,7 @@
* Version: 1.7 * * Version: 1.7 *
* Date: 2011-06-18 * * Date: 2011-06-18 *
* Author: Olivier PLATHEY * * Author: Olivier PLATHEY *
* Patched for LAM: PHP 7 support, ufpdf compatibility *
*******************************************************************************/ *******************************************************************************/
define('FPDF_VERSION','1.7'); define('FPDF_VERSION','1.7');

View File

@ -25,7 +25,7 @@ $Id$
* LDAP Account Manager PDF printing library. It consists of lamPDF class, * LDAP Account Manager PDF printing library. It consists of lamPDF class,
* the createModulePDF() function that may be called by other pages * the createModulePDF() function that may be called by other pages
* and furthermore some helper functions. * and furthermore some helper functions.
* *
* @author Michael Duergner * @author Michael Duergner
* @author Roland Gruber * @author Roland Gruber
* @package PDF * @package PDF
@ -45,7 +45,7 @@ $line_width = LAMPDF_LINEWIDTH;
/** /**
* This function creates the PDF output of one or more accounts. * This function creates the PDF output of one or more accounts.
* *
* @param array $accounts A numbered array containing all accounts the PDF page should * @param array $accounts A numbered array containing all accounts the PDF page should
* be created for. The entries of the array must be AccountContainer objects. * be created for. The entries of the array must be AccountContainer objects.
* @param string $pdf_structure The filename of the structure definition that should be used * @param string $pdf_structure The filename of the structure definition that should be used
@ -55,16 +55,16 @@ $line_width = LAMPDF_LINEWIDTH;
* @return String PDF file name * @return String PDF file name
*/ */
function createModulePDF($accounts, $pdf_structure="default", $returnAsString = false) { function createModulePDF($accounts, $pdf_structure="default", $returnAsString = false) {
/** PDF generator class */ /** PDF generator class */
include_once("fpdf.php"); include_once("fpdf-lam.inc");
/** Unicode support for FPDF */ /** Unicode support for FPDF */
include_once("ufpdf.php"); include_once("ufpdf.php");
/** LAM PDF generator class */ /** LAM PDF generator class */
include_once("lamPDF.inc"); include_once("lamPDF.inc");
global $key; global $key;
$account_type = $accounts[0]->get_type(); $account_type = $accounts[0]->get_type();
// Get PDF structure from xml file // Get PDF structure from xml file
$load = loadPDFStructureDefinitions($account_type,$pdf_structure); $load = loadPDFStructureDefinitions($account_type,$pdf_structure);
@ -74,7 +74,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
foreach($structure as $entry) { foreach($structure as $entry) {
if ($entry['tag'] == "SECTION" && $entry['type'] == "open") { if ($entry['tag'] == "SECTION" && $entry['type'] == "open") {
$key = $entry['attributes']['NAME']; $key = $entry['attributes']['NAME'];
// only values with a starting "_" are keys // only values with a starting "_" are keys
if (strpos($key, '_') === 0) { if (strpos($key, '_') === 0) {
$pdfKeys[] = substr($key, 1); $pdfKeys[] = substr($key, 1);
} }
@ -84,25 +84,25 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
} }
} }
$pdfKeys = array_unique($pdfKeys); $pdfKeys = array_unique($pdfKeys);
// The decimal separator must be a dot in order to write pdf-files // The decimal separator must be a dot in order to write pdf-files
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
$fontName = "BitstreamVeraSans-Roman"; $fontName = "BitstreamVeraSans-Roman";
// Create a new PDF file acording to the account type // Create a new PDF file acording to the account type
$pdf = new lamPDF($load['page_definitions'],$fontName); $pdf = new lamPDF($load['page_definitions'],$fontName);
// Loop over each account and add a new page in the PDF file for it // Loop over each account and add a new page in the PDF file for it
foreach($accounts as $account) { foreach($accounts as $account) {
// Start a new page for each account // Start a new page for each account
$pdf->AddPage(); $pdf->AddPage();
// Get PDF entries for the current account // Get PDF entries for the current account
$entries = $account->get_pdfEntries($pdfKeys); $entries = $account->get_pdfEntries($pdfKeys);
// Now create the PDF file acording to the structure with the submitted values // Now create the PDF file acording to the structure with the submitted values
foreach($structure as $entry) { foreach($structure as $entry) {
// We have a new section to start // We have a new section to start
if($entry['tag'] == "SECTION" && $entry['type'] == "open") { if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
@ -139,7 +139,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
if (isset($entries[$name])) { if (isset($entries[$name])) {
// Get current entry // Get current entry
$value_entry = $entries[$name]; $value_entry = $entries[$name];
// Print entry only when module sumitted values for it // Print entry only when module sumitted values for it
if(is_array($value_entry)) { if(is_array($value_entry)) {
// Loop over all rows of this entry (most of the time this will be just one) // Loop over all rows of this entry (most of the time this will be just one)
@ -157,7 +157,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
} }
} }
} }
// Close PDF // Close PDF
$pdf->Close(); $pdf->Close();
if (!$returnAsString) { if (!$returnAsString) {
@ -176,9 +176,9 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
/** /**
* Creates a section headline. * Creates a section headline.
* *
* @param string $line section name * @param string $line section name
* *
* @return string XML code for headline * @return string XML code for headline
*/ */
function getSectionHeadline($line) { function getSectionHeadline($line) {
@ -194,16 +194,16 @@ function getSectionHeadline($line) {
/** /**
* Creates the XML code for an PDF entry. * Creates the XML code for an PDF entry.
* *
* @param string $line XML code of PDF entry * @param string $line XML code of PDF entry
* @param boolean $first_td True if this is the first column * @param boolean $first_td True if this is the first column
* @param String $fontName font name * @param String $fontName font name
* *
* @return array XML codes * @return array XML codes
*/ */
function processLine($line, $first_td = true, $fontName) { function processLine($line, $first_td = true, $fontName) {
global $key, $line_width; global $key, $line_width;
// PCRE matching <block> tag // PCRE matching <block> tag
$block_pattern = '/<block><\/block>/'; $block_pattern = '/<block><\/block>/';
// PCRE matching a <key> tag // PCRE matching a <key> tag
@ -219,7 +219,7 @@ function processLine($line, $first_td = true, $fontName) {
$p_pattern = '/(<block>.*)<p>(.+)<\/p>(.*<\/block>)/'; $p_pattern = '/(<block>.*)<p>(.+)<\/p>(.*<\/block>)/';
// PCRE matching a <br> tag // PCRE matching a <br> tag
$br_pattern = '/<br \/>/'; $br_pattern = '/<br \/>/';
$return = array(); $return = array();
if(preg_match($key_pattern,$line,$matches)) { if(preg_match($key_pattern,$line,$matches)) {
$key = true; $key = true;
@ -271,10 +271,10 @@ function processLine($line, $first_td = true, $fontName) {
/** /**
* Formats the XML code. * Formats the XML code.
* *
* @param string $line XML code of PDF entry * @param string $line XML code of PDF entry
* @param string $style style commands * @param string $style style commands
* *
* @return array XML code * @return array XML code
*/ */
function processFormatTags($line,$style) { function processFormatTags($line,$style) {
@ -286,7 +286,7 @@ function processFormatTags($line,$style) {
$u_pattern = '/(.*)<u>(.+)<\/u>(.*)/'; $u_pattern = '/(.*)<u>(.+)<\/u>(.*)/';
// Replacement pattern when one of the above pattern matched // Replacement pattern when one of the above pattern matched
$replace = "\$1\$2\$3"; $replace = "\$1\$2\$3";
if(preg_match($i_pattern,$line,$matches)) { if(preg_match($i_pattern,$line,$matches)) {
$style .= "I"; $style .= "I";
$line = preg_replace($i_pattern,$replace,$line); $line = preg_replace($i_pattern,$replace,$line);
@ -304,25 +304,25 @@ function processFormatTags($line,$style) {
/** /**
* Processes width, height and alignment attributes. * Processes width, height and alignment attributes.
* *
* @param string $attrs attributes * @param string $attrs attributes
* @param array $return XML code * @param array $return XML code
* *
* @return array XML code * @return array XML code
*/ */
function processAttributes($attrs,$return = array()) { function processAttributes($attrs,$return = array()) {
global $line_width; global $line_width;
// PCRE matching width attribute // PCRE matching width attribute
$width_pattern = '/(.*)width\=\"(\\d+)(\%?)\"(.*)/'; $width_pattern = '/(.*)width\=\"(\\d+)(\%?)\"(.*)/';
// PCRE matching height attribute // PCRE matching height attribute
$height_pattern = '/(.*)height\=\"(\\d+)\"(.*)/'; $height_pattern = '/(.*)height\=\"(\\d+)\"(.*)/';
// PCRE matching align attribute // PCRE matching align attribute
$align_pattern = '/(.*)align\=\"(L|R|C)\"(.*)/'; $align_pattern = '/(.*)align\=\"(L|R|C)\"(.*)/';
// Remove leading and trailing whitespaces // Remove leading and trailing whitespaces
$attrs = trim($attrs); $attrs = trim($attrs);
if(preg_match($width_pattern,$attrs,$matches)) { if(preg_match($width_pattern,$attrs,$matches)) {
if($matches[3] == '%') { if($matches[3] == '%') {
$return['width'] = ceil($line_width * $matches[2] / 100); $return['width'] = ceil($line_width * $matches[2] / 100);