diff --git a/doc/config.rst b/doc/config.rst index 408d847178..4d9dee50b3 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -465,7 +465,7 @@ Server connection settings Since release 2.2.4 you can describe, in a special 'relation' table, which column is a key in another table (a foreign key). phpMyAdmin - currently uses this to + currently uses this to: * make clickable, when you browse the master table, the data values that point to the foreign table; diff --git a/doc/setup.rst b/doc/setup.rst index 850d67a2c9..7b57cb9ec1 100644 --- a/doc/setup.rst +++ b/doc/setup.rst @@ -262,9 +262,6 @@ file!** Input these statements from the phpMyAdmin :term:`SQL` Query window or mysql command–line client. Of course you have to replace ``localhost`` with the webserver's host if it's not the same as the MySQL server's one. -If you want to use the many new relation and bookmark features: (this of -course requires that your :ref:`linked-tables` be set up). - .. code-block:: mysql GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass'; @@ -286,8 +283,7 @@ If you want to use the many new relation and bookmark features: GRANT SELECT, INSERT, UPDATE, DELETE ON .* TO 'pma'@'localhost'; -(this of course requires that your phpMyAdmin -configuration storage be set up). +(this of course requires that your :ref:`linked-tables` be set up). Then each of the *true* users should be granted a set of privileges on a set of particular databases. Normally you shouldn't give global diff --git a/libraries/tcpdf/README.TXT b/libraries/tcpdf/README.TXT index 5f0f1e7063..614a68c966 100644 --- a/libraries/tcpdf/README.TXT +++ b/libraries/tcpdf/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.012 -Release date: 2013-04-24 +Version: 6.0.018 +Release date: 2013-05-19 Author: Nicola Asuni Copyright (c) 2002-2013: @@ -18,8 +18,8 @@ Copyright (c) 2002-2013: www.tecnick.com URLs: - http: www.tcpdf.org - http: www.sourceforge.net/projects/tcpdf + http://www.tcpdf.org + http://www.sourceforge.net/projects/tcpdf Description: TCPDF is a PHP class for generating PDF files on-the-fly without requiring external extensions. @@ -86,7 +86,7 @@ License See LICENSE.TXT file for more information. Third party fonts - This library includes third party font files released with different licenses. + This library may include third party font files released with different licenses. These fonts are not required by TCPDF but have been included as you convenience. The original TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files). To get the original distribution archives please check the information on fonts subfolders: diff --git a/libraries/tcpdf/config/tcpdf_config.php b/libraries/tcpdf/config/tcpdf_config.php index bb9dcf78d2..e6c1bf0d17 100644 --- a/libraries/tcpdf/config/tcpdf_config.php +++ b/libraries/tcpdf/config/tcpdf_config.php @@ -2,7 +2,7 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2013-02-06 +// Last Update : 2013-05-16 // // Description : Configuration file for TCPDF. // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com @@ -38,220 +38,181 @@ // If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored. -if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { +/** + * Installation path (/var/www/tcpdf/). + * By default it is automatically calculated but you can also set it as a fixed string to improve performances. + */ +//define ('K_PATH_MAIN', ''); - // DOCUMENT_ROOT fix for IIS Webserver - if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { - if(isset($_SERVER['SCRIPT_FILENAME'])) { - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); - } elseif(isset($_SERVER['PATH_TRANSLATED'])) { - $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); - } else { - // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') - $_SERVER['DOCUMENT_ROOT'] = '/'; - } - } +/** + * URL path to tcpdf installation folder (http://localhost/tcpdf/). + * By default it is automatically set but you can also set it as a fixed string to improve performances. + */ +//define ('K_PATH_URL', ''); - // be sure that the end slash is present - $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/'); +/** + * Path for PDF fonts. + * By default it is automatically set but you can also set it as a fixed string to improve performances. + */ +//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); - // Automatic calculation for the following K_PATH_MAIN constant - $k_path_main = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config')))); - if (substr($k_path_main, -1) != '/') { - $k_path_main .= '/'; - } +/** + * Default images directory. + * By default it is automatically set but you can also set it as a fixed string to improve performances. + */ +//define ('K_PATH_IMAGES', ''); - /** - * Installation path (/var/www/tcpdf/). - * By default it is automatically calculated but you can also set it as a fixed string to improve performances. - */ - define ('K_PATH_MAIN', $k_path_main); +/** + * Deafult image logo used be the default Header() method. + * Please set here your own logo or an empty string to disable it. + */ +//define ('PDF_HEADER_LOGO', ''); - // Automatic calculation for the following K_PATH_URL constant - $k_path_url = $k_path_main; // default value for console mode - if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { - if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { - $k_path_url = 'https://'; - } else { - $k_path_url = 'http://'; - } - $k_path_url .= $_SERVER['HTTP_HOST']; - $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); - } +/** + * Header logo image width in user units. + */ +//define ('PDF_HEADER_LOGO_WIDTH', 0); - /** - * URL path to tcpdf installation folder (http://localhost/tcpdf/). - * By default it is automatically calculated but you can also set it as a fixed string to improve performances. - */ - define ('K_PATH_URL', $k_path_url); +/** + * Cache directory for temporary files (full path). + */ +define ('K_PATH_CACHE', sys_get_temp_dir().'/'); - /** - * path for PDF fonts - * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts - */ - define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); +/** + * Generic name for a blank image. + */ +define ('K_BLANK_IMAGE', '_blank.png'); - /** - * cache directory for temporary files (full path) - */ - define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); +/** + * Page format. + */ +define ('PDF_PAGE_FORMAT', 'A4'); - /** - * cache directory for temporary files (url path) - */ - define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); +/** + * Page orientation (P=portrait, L=landscape). + */ +define ('PDF_PAGE_ORIENTATION', 'P'); - /** - *images directory - */ - define ('K_PATH_IMAGES', K_PATH_MAIN.'images/'); +/** + * Document creator. + */ +define ('PDF_CREATOR', 'TCPDF'); - /** - * blank image - */ - define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); +/** + * Document author. + */ +define ('PDF_AUTHOR', 'TCPDF'); - /** - * page format - */ - define ('PDF_PAGE_FORMAT', 'A4'); +/** + * Header title. + */ +define ('PDF_HEADER_TITLE', 'TCPDF Example'); - /** - * page orientation (P=portrait, L=landscape) - */ - define ('PDF_PAGE_ORIENTATION', 'P'); +/** + * Header description string. + */ +define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); - /** - * document creator - */ - define ('PDF_CREATOR', 'TCPDF'); +/** + * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]. + */ +define ('PDF_UNIT', 'mm'); - /** - * document author - */ - define ('PDF_AUTHOR', 'TCPDF'); +/** + * Header margin. + */ +define ('PDF_MARGIN_HEADER', 5); - /** - * header title - */ - define ('PDF_HEADER_TITLE', 'TCPDF Example'); +/** + * Footer margin. + */ +define ('PDF_MARGIN_FOOTER', 10); - /** - * header description string - */ - define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); +/** + * Top margin. + */ +define ('PDF_MARGIN_TOP', 27); - /** - * image logo - */ - define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg'); +/** + * Bottom margin. + */ +define ('PDF_MARGIN_BOTTOM', 25); - /** - * header logo image width [mm] - */ - define ('PDF_HEADER_LOGO_WIDTH', 30); +/** + * Left margin. + */ +define ('PDF_MARGIN_LEFT', 15); - /** - * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] - */ - define ('PDF_UNIT', 'mm'); +/** + * Right margin. + */ +define ('PDF_MARGIN_RIGHT', 15); - /** - * header margin - */ - define ('PDF_MARGIN_HEADER', 5); +/** + * Default main font name. + */ +define ('PDF_FONT_NAME_MAIN', 'helvetica'); - /** - * footer margin - */ - define ('PDF_MARGIN_FOOTER', 10); +/** + * Default main font size. + */ +define ('PDF_FONT_SIZE_MAIN', 10); - /** - * top margin - */ - define ('PDF_MARGIN_TOP', 27); +/** + * Default data font name. + */ +define ('PDF_FONT_NAME_DATA', 'helvetica'); - /** - * bottom margin - */ - define ('PDF_MARGIN_BOTTOM', 25); +/** + * Default data font size. + */ +define ('PDF_FONT_SIZE_DATA', 8); - /** - * left margin - */ - define ('PDF_MARGIN_LEFT', 15); +/** + * Default monospaced font name. + */ +define ('PDF_FONT_MONOSPACED', 'courier'); - /** - * right margin - */ - define ('PDF_MARGIN_RIGHT', 15); +/** + * Ratio used to adjust the conversion of pixels to user units. + */ +define ('PDF_IMAGE_SCALE_RATIO', 1.25); - /** - * default main font name - */ - define ('PDF_FONT_NAME_MAIN', 'helvetica'); +/** + * Magnification factor for titles. + */ +define('HEAD_MAGNIFICATION', 1.1); - /** - * default main font size - */ - define ('PDF_FONT_SIZE_MAIN', 10); +/** + * Height of cell respect font height. + */ +define('K_CELL_HEIGHT_RATIO', 1.25); - /** - * default data font name - */ - define ('PDF_FONT_NAME_DATA', 'helvetica'); +/** + * Title magnification respect main font size. + */ +define('K_TITLE_MAGNIFICATION', 1.3); - /** - * default data font size - */ - define ('PDF_FONT_SIZE_DATA', 8); +/** + * Reduction factor for small font. + */ +define('K_SMALL_RATIO', 2/3); - /** - * default monospaced font name - */ - define ('PDF_FONT_MONOSPACED', 'courier'); +/** + * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language. + */ +define('K_THAI_TOPCHARS', true); - /** - * ratio used to adjust the conversion of pixels to user units - */ - define ('PDF_IMAGE_SCALE_RATIO', 1.25); +/** + * If true allows to call TCPDF methods using HTML syntax + * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. + */ +define('K_TCPDF_CALLS_IN_HTML', true); - /** - * magnification factor for titles - */ - define('HEAD_MAGNIFICATION', 1.1); - - /** - * height of cell respect font height - */ - define('K_CELL_HEIGHT_RATIO', 1.25); - - /** - * title magnification respect main font size - */ - define('K_TITLE_MAGNIFICATION', 1.3); - - /** - * reduction factor for small font - */ - define('K_SMALL_RATIO', 2/3); - - /** - * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language - */ - define('K_THAI_TOPCHARS', true); - - /** - * if true allows to call TCPDF methods using HTML syntax - * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. - */ - define('K_TCPDF_CALLS_IN_HTML', true); - - /** - * if true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. - */ - define('K_TCPDF_THROW_EXCEPTION_ERROR', false); -} +/** + * If true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. + */ +define('K_TCPDF_THROW_EXCEPTION_ERROR', false); //============================================================+ // END OF FILE diff --git a/libraries/tcpdf/include/tcpdf_fonts.php b/libraries/tcpdf/include/tcpdf_fonts.php index 62953eb35a..48be5f85e0 100644 --- a/libraries/tcpdf/include/tcpdf_fonts.php +++ b/libraries/tcpdf/include/tcpdf_fonts.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.012 + * @version 6.0.018 */ -if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { - // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. - require_once(dirname(__FILE__).'/config/tcpdf_config.php'); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// TCPDF configuration +require_once(__DIR__.'/tcpdf_autoconfig.php'); // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_font_data.php'); +require_once(__DIR__.'/include/tcpdf_font_data.php'); // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_fonts.php'); +require_once(__DIR__.'/include/tcpdf_fonts.php'); // TCPDF static color methods and data -require(dirname(__FILE__).'/include/tcpdf_colors.php'); +require_once(__DIR__.'/include/tcpdf_colors.php'); // TCPDF static image methods and data -require(dirname(__FILE__).'/include/tcpdf_images.php'); +require_once(__DIR__.'/include/tcpdf_images.php'); // TCPDF static methods and data -require_once(dirname(__FILE__).'/include/tcpdf_static.php'); +require_once(__DIR__.'/include/tcpdf_static.php'); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -168,7 +163,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.0.012 + * @version 6.0.018 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -901,7 +896,7 @@ class TCPDF { protected $n_js; /** - * line trough state + * line through state * @protected * @since 2.8.000 (2008-03-19) */ @@ -4013,7 +4008,7 @@ class TCPDF { * Returns the length of a string in user unit. A font must be selected.
* @param $s (string) The string whose length is to be computed * @param $fontname (string) Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. - * @param $fontstyle (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. + * @param $fontstyle (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. * @param $fontsize (float) Font size in points. The default value is the current size. * @param $getarray (boolean) if true returns an array of characters widths, if false returns the total length. * @return mixed int total string length or array of characted widths @@ -4029,7 +4024,7 @@ class TCPDF { * Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
* @param $sa (string) The array of chars whose total length is to be computed * @param $fontname (string) Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. - * @param $fontstyle (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. + * @param $fontstyle (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. * @param $fontsize (float) Font size in points. The default value is the current size. * @param $getarray (boolean) if true returns an array of characters widths, if false returns the total length. * @return mixed int total string length or array of characted widths @@ -4268,12 +4263,6 @@ class TCPDF { } return $fontdata; } - if (isset($type)) { - unset($type); - } - if (isset($cw)) { - unset($cw); - } // get specified font directory (if any) $fontdir = false; if (!TCPDF_STATIC::empty_string($fontfile)) { @@ -4455,7 +4444,7 @@ class TCPDF { * If you just wish to change the current font size, it is simpler to call SetFontSize(). * Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
* @param $family (string) Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive): It is also possible to pass an empty string. In that case, the current family is retained. - * @param $style (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined. + * @param $style (string) Font style. Possible values are (case insensitive): or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined. * @param $size (float) Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 * @param $fontfile (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces. * @param $subset (mixed) if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font. @@ -9624,7 +9613,7 @@ class TCPDF { // if required, add standard sRGB_IEC61966-2.1 blackscaled ICC colour profile if ($this->pdfa_mode OR $this->force_srgb) { $iccobj = $this->_newobj(); - $icc = file_get_contents(dirname(__FILE__).'/include/sRGB.icc'); + $icc = file_get_contents(__DIR__.'/include/sRGB.icc'); $filter = ''; if ($this->compress) { $filter = ' /Filter /FlateDecode'; @@ -10857,7 +10846,7 @@ class TCPDF { * @param $user_pass (String) user password. Empty by default. * @param $owner_pass (String) owner password. If not specified, a random value is used. * @param $mode (int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. - * @param $pubkeys (String) array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../config/cert/tcpdf.crt', 'p' => array('print'))) + * @param $pubkeys (String) array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) * @public * @since 2.0.000 (2008-01-02) * @author Nicola Asuni @@ -13427,8 +13416,7 @@ class TCPDF { ++$this->n; // signature object ($this->sig_obj_id + 1) $this->signature_data = array(); if (strlen($signing_cert) == 0) { - $signing_cert = 'file://'.dirname(__FILE__).'/config/cert/tcpdf.crt'; - $private_key_password = 'tcpdfdemo'; + $this->Error('Please provide a certificate file and password!'); } if (strlen($private_key) == 0) { $private_key = $signing_cert; @@ -15063,7 +15051,7 @@ class TCPDF { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_1d.php'); + require_once(__DIR__.'/tcpdf_barcodes_1d.php'); // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -15379,7 +15367,7 @@ class TCPDF { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_2d.php'); + require_once(__DIR__.'/tcpdf_barcodes_2d.php'); // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -16508,7 +16496,7 @@ class TCPDF { // underline $dom[$key]['fontstyle'] .= 'U'; } elseif ($dec{0} == 'l') { - // line-trough + // line-through $dom[$key]['fontstyle'] .= 'D'; } elseif ($dec{0} == 'o') { // overline @@ -18811,7 +18799,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (isset($tag['attribute']['action'])) { $this->form_action = $tag['attribute']['action']; } else { - $this->form_action = K_PATH_URL.$_SERVER['SCRIPT_NAME']; + $this->Error('Please explicitly set action attribute path!'); } if (isset($tag['attribute']['enctype'])) { $this->form_enctype = $tag['attribute']['enctype']; @@ -21017,7 +21005,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: --$newpage; return "this.addField(\'".$matches[1]."\',\'".$matches[2]."\',".$newpage."";'), $tmpjavascript); // return to last page - $this->lastPage(true); + if ($this->numpages > 0) { + $this->lastPage(true); + } return true; } @@ -23911,6 +23901,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $x = 0; } + if (isset($attribs['dx'])) { + $x += $this->getHTMLUnitToUnits($attribs['dx'], 0, $this->svgunit, false); + } if (isset($attribs['y'])) { $y = $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false); } elseif ($name == 'tspan') { @@ -23918,6 +23911,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $y = 0; } + if (isset($attribs['dy'])) { + $y += $this->getHTMLUnitToUnits($attribs['dy'], 0, $this->svgunit, false); + } $svgstyle['text-color'] = $svgstyle['fill']; $this->svgtext = ''; if (isset($svgstyle['text-anchor'])) { diff --git a/libraries/tcpdf/tcpdf_autoconfig.php b/libraries/tcpdf/tcpdf_autoconfig.php new file mode 100644 index 0000000000..c5e5ab7c30 --- /dev/null +++ b/libraries/tcpdf/tcpdf_autoconfig.php @@ -0,0 +1,233 @@ +. +// +// See LICENSE.TXT file for more information. +// ------------------------------------------------------------------- +// +// Description : Try to automatically configure some TCPDF +// constants if not defined. +// +//============================================================+ + +/** + * @file + * Try to automatically configure some TCPDF constants if not defined. + * @package com.tecnick.tcpdf + * @version 1.0.000 + */ + +// DOCUMENT_ROOT fix for IIS Webserver +if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { + if(isset($_SERVER['SCRIPT_FILENAME'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); + } elseif(isset($_SERVER['PATH_TRANSLATED'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); + } else { + // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') + $_SERVER['DOCUMENT_ROOT'] = '/'; + } +} +$_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']); +if (substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') { + $_SERVER['DOCUMENT_ROOT'] .= '/'; +} + +// Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false. +if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) { + // define a list of default config files in order of priority + $tcpdf_config_files = array(__DIR__.'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php'); + foreach ($tcpdf_config_files as $tcpdf_config) { + if (file_exists($tcpdf_config) AND is_readable($tcpdf_config)) { + require_once($tcpdf_config); + break; + } + } +} + +if (!defined('K_PATH_MAIN')) { + define ('K_PATH_MAIN', __DIR__.'/'); +} + +if (!defined('K_PATH_FONTS')) { + define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); +} + +if (!defined('K_PATH_URL')) { + $k_path_url = K_PATH_MAIN; // default value for console mode + if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { + $k_path_url = 'https://'; + } else { + $k_path_url = 'http://'; + } + $k_path_url .= $_SERVER['HTTP_HOST']; + $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); + } + define ('K_PATH_URL', $k_path_url); +} + +if (!defined('K_PATH_IMAGES')) { + $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', K_PATH_MAIN.'images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN); + foreach ($tcpdf_images_dirs as $tcpdf_images_path) { + if (file_exists($tcpdf_images_path)) { + break; + } + } + define ('K_PATH_IMAGES', $tcpdf_images_path); +} + +if (!defined('PDF_HEADER_LOGO')) { + $tcpdf_header_logo = ''; + if (file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { + $tcpdf_header_logo = 'tcpdf_logo.jpg'; + } + define ('PDF_HEADER_LOGO', $tcpdf_header_logo); +} + +if (!defined('PDF_HEADER_LOGO_WIDTH')) { + if (!empty($tcpdf_header_logo)) { + define ('PDF_HEADER_LOGO_WIDTH', 30); + } else { + define ('PDF_HEADER_LOGO_WIDTH', 0); + } +} + +if (!defined('K_PATH_CACHE')) { + define ('K_PATH_CACHE', sys_get_temp_dir().'/'); +} + +if (!defined('K_BLANK_IMAGE')) { + define ('K_BLANK_IMAGE', '_blank.png'); +} + +if (!defined('PDF_PAGE_FORMAT')) { + define ('PDF_PAGE_FORMAT', 'A4'); +} + +if (!defined('PDF_PAGE_ORIENTATION')) { + define ('PDF_PAGE_ORIENTATION', 'P'); +} + +if (!defined('PDF_CREATOR')) { + define ('PDF_CREATOR', 'TCPDF'); +} + +if (!defined('PDF_AUTHOR')) { + define ('PDF_AUTHOR', 'TCPDF'); +} + +if (!defined('PDF_HEADER_TITLE')) { + define ('PDF_HEADER_TITLE', 'TCPDF Example'); +} + +if (!defined('PDF_HEADER_STRING')) { + define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); +} + +if (!defined('PDF_UNIT')) { + define ('PDF_UNIT', 'mm'); +} + +if (!defined('PDF_MARGIN_HEADER')) { + define ('PDF_MARGIN_HEADER', 5); +} + +if (!defined('PDF_MARGIN_FOOTER')) { + define ('PDF_MARGIN_FOOTER', 10); +} + +if (!defined('PDF_MARGIN_TOP')) { + define ('PDF_MARGIN_TOP', 27); +} + +if (!defined('PDF_MARGIN_BOTTOM')) { + define ('PDF_MARGIN_BOTTOM', 25); +} + +if (!defined('PDF_MARGIN_LEFT')) { + define ('PDF_MARGIN_LEFT', 15); +} + +if (!defined('PDF_MARGIN_RIGHT')) { + define ('PDF_MARGIN_RIGHT', 15); +} + +if (!defined('PDF_FONT_NAME_MAIN')) { + define ('PDF_FONT_NAME_MAIN', 'helvetica'); +} + +if (!defined('PDF_FONT_SIZE_MAIN')) { + define ('PDF_FONT_SIZE_MAIN', 10); +} + +if (!defined('PDF_FONT_NAME_DATA')) { + define ('PDF_FONT_NAME_DATA', 'helvetica'); +} + +if (!defined('PDF_FONT_SIZE_DATA')) { + define ('PDF_FONT_SIZE_DATA', 8); +} + +if (!defined('PDF_FONT_MONOSPACED')) { + define ('PDF_FONT_MONOSPACED', 'courier'); +} + +if (!defined('PDF_IMAGE_SCALE_RATIO')) { + define ('PDF_IMAGE_SCALE_RATIO', 1.25); +} + +if (!defined('HEAD_MAGNIFICATION')) { + define('HEAD_MAGNIFICATION', 1.1); +} + +if (!defined('K_CELL_HEIGHT_RATIO')) { + define('K_CELL_HEIGHT_RATIO', 1.25); +} + +if (!defined('K_TITLE_MAGNIFICATION')) { + define('K_TITLE_MAGNIFICATION', 1.3); +} + +if (!defined('K_SMALL_RATIO')) { + define('K_SMALL_RATIO', 2/3); +} + +if (!defined('K_THAI_TOPCHARS')) { + define('K_THAI_TOPCHARS', true); +} + +if (!defined('K_TCPDF_CALLS_IN_HTML')) { + define('K_TCPDF_CALLS_IN_HTML', true); +} + +if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) { + define('K_TCPDF_THROW_EXCEPTION_ERROR', false); +} + +//============================================================+ +// END OF FILE +//============================================================+