ship with patched version of fpdf
This commit is contained in:
parent
c4075de648
commit
06e716139a
|
@ -8,7 +8,7 @@ Homepage: https://www.ldap-account-manager.org/
|
|||
|
||||
Package: ldap-account-manager
|
||||
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
|
||||
Suggests: ldap-server, php5-mcrypt, ldap-account-manager-lamdaemon, perl
|
||||
Description: webfrontend for managing accounts in an LDAP directory
|
||||
|
|
|
@ -145,7 +145,7 @@ C:
|
|||
For more details on the GNU Lesser General Public License,
|
||||
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:
|
||||
|
@ -173,7 +173,7 @@ D:
|
|||
Programs and licenses with other licenses and/or authors than the
|
||||
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.
|
||||
templates/lib/*wz_tooltip.js C Walter Zorn
|
||||
lib/3rdParty/phpseclib D Jim Wigginton
|
||||
|
|
|
@ -24,8 +24,6 @@ files=`ls -a *.jpg`
|
|||
for file in $files; do
|
||||
cp $file /var/lib/ldap-account-manager/config/templates/pdf/logos/$file
|
||||
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\
|
||||
ln -s /var/lib/ldap-account-manager/config /usr/share/ldap-account-manager/config; fi
|
||||
if [ ! -h /usr/share/ldap-account-manager/sess ]; then\
|
||||
|
|
|
@ -6,7 +6,6 @@ if [ -f /usr/share/debconf/confmodule ]; then
|
|||
. /usr/share/debconf/confmodule
|
||||
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/tmp
|
||||
rm -f /usr/share/ldap-account-manager/config
|
||||
|
|
|
@ -178,7 +178,7 @@ D:
|
|||
Programs and licenses with other licenses and/or authors than the
|
||||
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.
|
||||
templates/lib/*wz_tooltip.js C Walter Zorn
|
||||
lib/3rdParty/phpseclib D Jim Wigginton
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* Version: 1.7 *
|
||||
* Date: 2011-06-18 *
|
||||
* Author: Olivier PLATHEY *
|
||||
* Patched for LAM: PHP 7 support, ufpdf compatibility *
|
||||
*******************************************************************************/
|
||||
|
||||
define('FPDF_VERSION','1.7');
|
|
@ -25,7 +25,7 @@ $Id$
|
|||
* LDAP Account Manager PDF printing library. It consists of lamPDF class,
|
||||
* the createModulePDF() function that may be called by other pages
|
||||
* and furthermore some helper functions.
|
||||
*
|
||||
*
|
||||
* @author Michael Duergner
|
||||
* @author Roland Gruber
|
||||
* @package PDF
|
||||
|
@ -45,7 +45,7 @@ $line_width = LAMPDF_LINEWIDTH;
|
|||
|
||||
/**
|
||||
* This function creates the PDF output of one or more accounts.
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
* @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
|
||||
*/
|
||||
function createModulePDF($accounts, $pdf_structure="default", $returnAsString = false) {
|
||||
|
||||
|
||||
/** PDF generator class */
|
||||
include_once("fpdf.php");
|
||||
include_once("fpdf-lam.inc");
|
||||
/** Unicode support for FPDF */
|
||||
include_once("ufpdf.php");
|
||||
/** LAM PDF generator class */
|
||||
include_once("lamPDF.inc");
|
||||
|
||||
global $key;
|
||||
|
||||
|
||||
$account_type = $accounts[0]->get_type();
|
||||
// Get PDF structure from xml file
|
||||
$load = loadPDFStructureDefinitions($account_type,$pdf_structure);
|
||||
|
@ -74,7 +74,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
|
|||
foreach($structure as $entry) {
|
||||
if ($entry['tag'] == "SECTION" && $entry['type'] == "open") {
|
||||
$key = $entry['attributes']['NAME'];
|
||||
// only values with a starting "_" are keys
|
||||
// only values with a starting "_" are keys
|
||||
if (strpos($key, '_') === 0) {
|
||||
$pdfKeys[] = substr($key, 1);
|
||||
}
|
||||
|
@ -84,25 +84,25 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
|
|||
}
|
||||
}
|
||||
$pdfKeys = array_unique($pdfKeys);
|
||||
|
||||
|
||||
// The decimal separator must be a dot in order to write pdf-files
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
|
||||
$fontName = "BitstreamVeraSans-Roman";
|
||||
|
||||
|
||||
// Create a new PDF file acording to the account type
|
||||
$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) {
|
||||
|
||||
|
||||
// Start a new page for each account
|
||||
$pdf->AddPage();
|
||||
|
||||
|
||||
// Get PDF entries for the current account
|
||||
$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) {
|
||||
// We have a new section to start
|
||||
if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
|
||||
|
@ -139,7 +139,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
|
|||
if (isset($entries[$name])) {
|
||||
// Get current entry
|
||||
$value_entry = $entries[$name];
|
||||
|
||||
|
||||
// Print entry only when module sumitted values for it
|
||||
if(is_array($value_entry)) {
|
||||
// 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
|
||||
$pdf->Close();
|
||||
if (!$returnAsString) {
|
||||
|
@ -176,9 +176,9 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
|
|||
|
||||
/**
|
||||
* Creates a section headline.
|
||||
*
|
||||
*
|
||||
* @param string $line section name
|
||||
*
|
||||
*
|
||||
* @return string XML code for headline
|
||||
*/
|
||||
function getSectionHeadline($line) {
|
||||
|
@ -194,16 +194,16 @@ function getSectionHeadline($line) {
|
|||
|
||||
/**
|
||||
* Creates the XML code for an PDF entry.
|
||||
*
|
||||
*
|
||||
* @param string $line XML code of PDF entry
|
||||
* @param boolean $first_td True if this is the first column
|
||||
* @param String $fontName font name
|
||||
*
|
||||
*
|
||||
* @return array XML codes
|
||||
*/
|
||||
function processLine($line, $first_td = true, $fontName) {
|
||||
global $key, $line_width;
|
||||
|
||||
|
||||
// PCRE matching <block> tag
|
||||
$block_pattern = '/<block><\/block>/';
|
||||
// PCRE matching a <key> tag
|
||||
|
@ -219,7 +219,7 @@ function processLine($line, $first_td = true, $fontName) {
|
|||
$p_pattern = '/(<block>.*)<p>(.+)<\/p>(.*<\/block>)/';
|
||||
// PCRE matching a <br> tag
|
||||
$br_pattern = '/<br \/>/';
|
||||
|
||||
|
||||
$return = array();
|
||||
if(preg_match($key_pattern,$line,$matches)) {
|
||||
$key = true;
|
||||
|
@ -271,10 +271,10 @@ function processLine($line, $first_td = true, $fontName) {
|
|||
|
||||
/**
|
||||
* Formats the XML code.
|
||||
*
|
||||
*
|
||||
* @param string $line XML code of PDF entry
|
||||
* @param string $style style commands
|
||||
*
|
||||
*
|
||||
* @return array XML code
|
||||
*/
|
||||
function processFormatTags($line,$style) {
|
||||
|
@ -286,7 +286,7 @@ function processFormatTags($line,$style) {
|
|||
$u_pattern = '/(.*)<u>(.+)<\/u>(.*)/';
|
||||
// Replacement pattern when one of the above pattern matched
|
||||
$replace = "\$1\$2\$3";
|
||||
|
||||
|
||||
if(preg_match($i_pattern,$line,$matches)) {
|
||||
$style .= "I";
|
||||
$line = preg_replace($i_pattern,$replace,$line);
|
||||
|
@ -304,25 +304,25 @@ function processFormatTags($line,$style) {
|
|||
|
||||
/**
|
||||
* Processes width, height and alignment attributes.
|
||||
*
|
||||
*
|
||||
* @param string $attrs attributes
|
||||
* @param array $return XML code
|
||||
*
|
||||
*
|
||||
* @return array XML code
|
||||
*/
|
||||
function processAttributes($attrs,$return = array()) {
|
||||
global $line_width;
|
||||
|
||||
|
||||
// PCRE matching width attribute
|
||||
$width_pattern = '/(.*)width\=\"(\\d+)(\%?)\"(.*)/';
|
||||
// PCRE matching height attribute
|
||||
$height_pattern = '/(.*)height\=\"(\\d+)\"(.*)/';
|
||||
// PCRE matching align attribute
|
||||
$align_pattern = '/(.*)align\=\"(L|R|C)\"(.*)/';
|
||||
|
||||
|
||||
// Remove leading and trailing whitespaces
|
||||
$attrs = trim($attrs);
|
||||
|
||||
|
||||
if(preg_match($width_pattern,$attrs,$matches)) {
|
||||
if($matches[3] == '%') {
|
||||
$return['width'] = ceil($line_width * $matches[2] / 100);
|
||||
|
|
Loading…
Reference in New Issue