diff --git a/COPYRIGHT b/COPYRIGHT index 406b936becc..99d5a189f99 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -30,6 +30,7 @@ PHPPrintIPP 1.3 GPL-2+ Yes Restler 3.0 LGPL-3+ Yes Library to develop REST Web services TCPDF 6.2.12 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement +Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP JS libraries: jQuery 1.11.3 MIT License Yes JS library @@ -61,6 +62,8 @@ http://www.gnu.org/licenses/licenses.en.html Copyright --------- +Copyright (C) 2016 + Copyright (C) 2015 - Laurent Destailleur - Marcos García diff --git a/ChangeLog b/ChangeLog index 06310ddce07..a009533f07a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,70 @@ So if you included it into your module, change your code like this to be compati +***** ChangeLog for 3.9.1 compared to 3.9.* ***** +FIX: #3815 Call to undefined function local_by_date() +FIX: #4424 Missing email of user popup in supplier orders area +FIX: #4442 Missing translation in Banks menu +FIX: #4737 Bank transacion type selector translation is cropped +FIX: #4742 Able to delete a supplier invoice with a registered payment +FIX: #4743 UI glitch in project summary page +FIX: #4747 Missing UI background when registering a supplier invoice payment +FIX: #4748 Supplier invoice payment confirmation amount is not translated +FIX: #4766 VAT not shown in supplier invoice popup +FIX: #4784 +FIX: #4809 Duplicate functions with different content +FIX: #4812 +FIX: #4839 +FIX: #4851 Project selector in supplier invoices shows the project label twice +FIX: #4870 +FIX: #4874 SQL error when listing users +FIX: #4880 +FIX: #4961 +FIX: #4989 +FIX: If oauth has never been activated two tables are missing and printing is not working +FIX: A not enabled field for list must not into fields to add +FIX: Bad color of message password changed +FIX: Bad error and style message when changing its own login +FIX: Bad function name call on delete +FIX: Bad include and param for project numbering module call +FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty. +FIX: Bad vat definition when using POS module +FIX: Box disabled because bugged +FIX: Can not select a commercial on the creation of a third +FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12 +FIX: correct display of minimum buying price +FIX: Creation of thumb image for size "small" was not done. +FIX: Damn, where was the project ref ? +FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code. +FIX: dont retrieve new buying price on margin display +FIX: Duplicate records into export +FIX: Each time we edit a line, we loose the unit price. +FIX: Email templates not compatible with Multicompany +FIX: Export must use a left join to not loose lines +FIX: fetchAllEMailTemplate +FIX: Filter/search on extrafields on lists +FIX: finished parameters not used +FIX: Generated thumbs must always use the png format so using thumbs can work. +FIX: Hook resprint be printed +FIX: image extension must be in lower case +FIX: Missing clean of criteria +FIX: Missing database escaping on supplier price insert/update +FIX: Missing function +FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes +FIX: Not removing code into vatrate. +FIX: Not showing sellprice properly on product list +FIX: Parsing of amount to pay vat +FIX: PHPCS +FIX: PMP is deprecated at warehouse level +FIX: real min buying price +FIX: Same term to create than other objects +FIX: Some records were lost into margin per product report +FIX: systematic rounding causes prices to be updated without reason +FIX: Template email must take care of positino column +FIX: VAT rate can be negative. Example spain selling to morroco. +FIX: When cloning an order the order result from clone must be now +FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set. + ***** ChangeLog for 3.9.0 compared to 3.8.* ***** For users: NEW: A new and more modern look for "eldy" theme. @@ -1067,6 +1131,11 @@ Dolibarr better: - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. + +***** ChangeLog for 3.6.7 compared to 3.6.6 ***** +FIX: #4291 Correctly filter external calendar GETPOSTs +FIX: CVE CVE-2015-8685 + ***** ChangeLog for 3.6.6 compared to 3.6.5 ***** FIX: #3734 Do not show empty links of deleted source objects in stock movement list FIX: #4081 Added missing translation @@ -1319,6 +1388,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f - Remove add_photo_web() that is not used anymore by core code. +***** ChangeLog for 3.5.8 compared to 3.5.7 ***** +FIX: #4291 Correctly filter external calendar GETPOSTs +FIX: bad calculation for stock value +FIX: bad stock valo +FIX: change order date on clone (as everywhere else) +FIX: CVE CVE-2015-8685 +FIX: The hours of date filter aren't correct +FIX: #3442 Remove useless syslog +FIX: #3448 Pass expected date format +FIX: #3471 3.5 Rounding issue when dispatching non-integer + ***** ChangeLog for 3.5.7 compared to 3.5.6 ***** Fix: Paypal link were broken due to SSL v3 closed. Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d666aa02165..a7aed128151 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -10,6 +10,16 @@ Replace "& new" by "new" +CKEDITOR: +--------- +* In ckeditor/ckeditor/contents.css +Replace: + margin: 20px; +With + margin: 5px; + + + NUSOAP: ------- * In file nusoap.php, to avoid a warning, @@ -38,6 +48,7 @@ with: } + TCPDF: ------ * To avoid to have QRcode changed because generated with a random mask, replace @@ -45,13 +56,8 @@ define('QR_FIND_FROM_RANDOM', 2); with define('QR_FIND_FROM_RANDOM', false); -* Removed all fonts except - dejavusans* (used by greek, arab, persan, romanian, turkish), - freemono* (russian), - cid*+msungstdlight+stsongstdlight+uni2cid* (chinese), - helvetica* (all other languages), - zapfdingbats.php (for special chars like form checkboxes) * Removed useless directories (examples, tools) + * Fix // initialize subsetchars $subsetchars = array(); @@ -59,13 +65,18 @@ into // initialize subsetchars $subsetchars = array_fill(0, 256, true); -* Made freemono the default monotype font because we removed courier +* Optionnaly, removed all fonts except + dejavusans* (used by greek, arab, persan, romanian, turkish), + freemono* (russian), + cid*+msungstdlight+stsongstdlight+uni2cid* (chinese), + helvetica* (all other languages), + zapfdingbats.php (for special chars like form checkboxes) + +* Optionnaly, made freemono the default monotype font because we removed courier In htdocs/includes/tcpdf/tcpdf.php - protected $default_monospaced_font = 'courier'; + protected $default_monospaced_font = 'freemono'; -* Renamed getmypid into dol_getmypid(). - TCPDI: @@ -80,7 +91,6 @@ require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php') - JSGANTT: -------- * Replace in function JSGantt.taskLink diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index d6f21960a49..80ed3f6fb47 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -263,9 +263,9 @@ if ($result) { print "\n"; - print '
'; + print '
'; - print "
\n"; + print "

\n"; if (! empty($msg)) { print $msg; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index bae064bef34..dbc700a6778 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -153,6 +153,7 @@ if ($action == 'delete' && $user->rights->adherent->configurer) exit; } + /* * View */ @@ -236,7 +237,7 @@ if ($action == 'create') print ''; print ''; - print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; // ID - if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { $var=!$var; $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:''); @@ -456,7 +471,7 @@ if ($action == 'edit') } // PW - if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { $var=!$var; $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); @@ -478,7 +493,7 @@ if ($action == 'edit') // TLS $var=!$var; print ''; } // SMTPS PW $var=!$var; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { print ''; } @@ -596,7 +611,7 @@ else // TLS $var=!$var; print ''; print ''; print ''; print ''; +print $langs->trans("Name").':'; /* // faire une rech dans une sous categorie uniquement print ''; - print ''; + print ''; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { - print ''; + //print ''; + print ''; print '\n"; print ''; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7de088785de..6f20c509fd8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1155,9 +1155,6 @@ class CommandeFournisseur extends CommonOrder dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { - // Add entry into log - $this->log($user, 0, $now); - // Add link with price request and supplier order if ($this->id) { @@ -1353,7 +1350,7 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - if ($fk_product > 0) + if ($fk_prod_fourn_price > 0) { $prod = new Product($this->db, $fk_product); if ($prod->fetch($fk_product) > 0) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 31c2d0aba00..8b9c6267b18 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -344,11 +344,14 @@ if (empty($reshook)) // Ecrase $txtva par celui du produit if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { - $idprod=0; $productsupplier = new ProductFournisseur($db); - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - + if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) + { + $idprod=0; + if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + } + if (GETPOST('idprodfournprice') > 0) { $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b7e22e9e42f..c1346c357d5 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1271,6 +1271,7 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); $bankaccountstatic=new Account($db); +$paymentstatic=new PaiementFourn($db); llxHeader('',$langs->trans('SupplierInvoice'),''); @@ -1871,7 +1872,7 @@ else /* * List of payments */ - $nbrows=9; $nbcols=2; + $nbrows=9; $nbcols=3; if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } if (! empty($conf->incoterm->enabled)) $nbrows++; @@ -1882,10 +1883,10 @@ else print ' - - - - - - - - - - - - -
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("cotisation",1,1); @@ -247,7 +248,7 @@ if ($action == 'create') print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -645,7 +646,7 @@ if ($rowid > 0) print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 52324dc1678..b507ac89a50 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -207,7 +207,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE $msgishtml, $errors_to, '', - $trackid + $trackid ); $result=$mailfile->sendfile(); @@ -259,6 +259,7 @@ $listofmethods=array(); $listofmethods['mail']='PHP mail function'; //$listofmethods['simplemail']='Simplemail class'; $listofmethods['smtps']='SMTP/SMTPS socket library'; +$listofmethods['swiftmailer']='Swift Mailer socket library'; if ($action == 'edit') @@ -313,6 +314,20 @@ if ($action == 'edit') jQuery("#smtp_server_mess").hide(); jQuery("#smtp_port_mess").hide(); } + if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\') + { + jQuery(".drag").show(); + jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.'); + jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled"); + jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.'); + jQuery("#MAIN_MAIL_EMAIL_STARTTLS").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_SERVER").show(); + jQuery("#MAIN_MAIL_SMTP_PORT").show(); + jQuery("#smtp_server_mess").hide(); + jQuery("#smtp_port_mess").hide(); + } } initfields(); jQuery("#MAIN_MAIL_SENDMODE").change(function() { @@ -436,7 +451,7 @@ if ($action == 'edit') print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { @@ -492,7 +507,7 @@ if ($action == 'edit') // STARTTLS $var=!$var; print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { @@ -581,14 +596,14 @@ else // SMTPS ID $var=!$var; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { @@ -610,7 +625,7 @@ else // STARTTLS $var=!$var; print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { @@ -705,9 +720,6 @@ else { print load_fiche_titre($langs->trans("DoTestServerAvailability")); - // If we use SSL/TLS - if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server; - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mail = new CMailFile('','','',''); $result=$mail->check_server_port($server,$port); diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index a8ceef4a232..9d29c60e26a 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -122,7 +122,10 @@ class DolibarrApiAccess implements iAuthenticate $userClass::setCacheIdentifier(static::$role); Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess'; - return in_array(static::$role, (array) static::$requires) || static::$role == 'admin'; + + $requirefortest = static::$requires; + if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest); + return in_array(static::$role, (array) static::$requirefortest) || static::$role == 'admin'; } /** diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 01e969fc927..bd1fb2156c6 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct')) { $producttmp->fetch(GETPOST('productid')); $forbarcode=$producttmp->barcode; - $fk_barcode_type=$thirdpartytmp->barcode_type_code; + $fk_barcode_type=$producttmp->barcode_type; if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e57cd22d5fd..02b83fcaef8 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -79,7 +79,7 @@ print '
'.$langs->trans("Search").'
'; -print $langs->trans("Name").':
'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 621d3ada57a..fa24935316e 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -564,7 +564,7 @@ echo ''; //print "begin_d=".$begin_d." end_d=".$end_d; -echo ''; +echo '
'; echo ''; echo ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index db80893f426..d6fa064df39 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1380,7 +1380,7 @@ if ($action == 'create' && $user->rights->commande->creer) $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); - $soc = $objectsrc->client; + $soc = $objectsrc->thirdparty; $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0)); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8030818d255..c4569418968 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1010,6 +1010,7 @@ class Commande extends CommonOrder $this->user_author_id = $user->id; $this->user_valid = ''; $this->date = dol_now(); + $this->date_commande = dol_now(); $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; @@ -1281,6 +1282,7 @@ class Commande extends CommonOrder $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); + $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1423,9 +1425,10 @@ class Commande extends CommonOrder $tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr); $localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr); - + // multiprix if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) $price = $prod->multiprices[$this->thirdparty->price_level]; @@ -2549,6 +2552,7 @@ class Commande extends CommonOrder $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx); + $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -3002,7 +3006,7 @@ class Commande extends CommonOrder function LibStatut($statut,$billed,$mode,$donotshowbilled=0) { global $langs, $conf; - + $billedtext = ''; if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 8ef53f26203..7a7941da64d 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -325,7 +325,7 @@ else $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; $sql.= " b.fk_bordereau,"; - $sql.= " bc.number,"; + $sql.= " bc.ref,"; $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank as b"; @@ -376,7 +376,7 @@ else $link=''; if ($objp->fk_bordereau>0) { $remisestatic->id = $objp->fk_bordereau; - $remisestatic->ref = $objp->number; + $remisestatic->ref = $objp->ref; $link = ' '.$remisestatic->getNomUrl(1); } print ''; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 1a0760d1fd3..b90e7cac3cb 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -200,7 +200,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $i++; } print ''; - print '"; + print ''; // A total here has no sense print ''; print ''; print ''; @@ -278,7 +278,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $i++; } print ''; - print '"; + print ''; print ''; print ''; print '"; @@ -463,7 +463,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $i++; } print ''; - print '"; + print ''; // A total here has no sense print ''; print ''; print '"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 491c4ca041a..a27f13cbb77 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1127,8 +1127,8 @@ if (empty($reshook)) } // View third's localtaxes for now - $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); - $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty); $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit); @@ -3108,13 +3108,13 @@ else if ($id > 0 || ! empty($ref)) if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1; - $nbrows = 9; - $nbcols = 2; + $nbrows = 8; + $nbcols = 3; if (! empty($conf->projet->enabled)) $nbrows ++; - if (! empty($conf->banque->enabled)) - $nbcols ++; - // if (! empty($soc->outstandingbill)) $nbrows++; + if (! empty($conf->banque->enabled)) { + $nbrows ++; $nbcols++; + } if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $nbrows ++; if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d89871674b7..b7531719646 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2564,7 +2564,7 @@ class Facture extends CommonInvoice $this->line->date_start = $date_start; $this->line->date_end = $date_end; $this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva = $total_tva; + $this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); $this->line->total_localtax1 = $total_localtax1; $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index e8b77636d3f..175ff6cf98f 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier - * Copyright (C) 2014 Rosana Romero + * Copyright (C) 2014-2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,16 +116,11 @@ $product_static=new Product($db); $payment_static=new Paiement($db); $paymentfourn_static=new PaiementFourn($db); -//print load_fiche_titre($langs->trans("VAT"),""); - -//$fsearch.='
'; $fsearch.=' '; $fsearch.=' '; -//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; -//$fsearch.=' '; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; -// Affiche en-tete du rapport + if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services { $nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); @@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice $nextyear=$year_start; $nextquarter=$q; if ($nextquarter < 4) $nextquarter++; else { $nextquarter=1; $nextyear++; } - //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); - //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); + + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; $builddate=time(); - //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); @@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services $nextyear=$year_start; $nextquarter=$q; if ($nextquarter < 4) $nextquarter++; else { $nextquarter=1; $nextyear++; } - //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded"); - //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $builddate=time(); - //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); @@ -203,8 +191,6 @@ if($local==1){ // VAT Received and paid - - $y = $year_current; $total = 0; $i=0; @@ -229,10 +215,10 @@ if (! is_array($x_coll) || ! is_array($x_paye)) else { $x_both = array(); + //now, from these two arrays, get another array with one rate per line foreach(array_keys($x_coll) as $my_coll_rate) { - //foreach($x_coll[$my_coll_rate][localtax1_list]){ $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; $x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local]; $x_both[$my_coll_rate]['paye']['totalht'] = 0; @@ -302,9 +288,6 @@ else } //now we have an array (x_both) indexed by rates for coll and paye - - //print table headers for this quadri - incomes first - $x_coll_sum = 0; $x_coll_ht = 0; $x_paye_sum = 0; @@ -313,8 +296,6 @@ else $span=3; if ($modetax == 0) $span+=2; - //print '
'; - if($conf->global->$calc ==0 || $conf->global->$calc == 2){ // Customers invoices print ''; @@ -344,8 +325,6 @@ else if($rate!=0){ print ""; - //print ''; - /**/ print ''; print ''."\n"; } @@ -399,9 +378,7 @@ else print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; } print ''; } @@ -412,7 +389,6 @@ else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); print ''; @@ -490,7 +466,6 @@ else if($conf->global->$calc ==0 || $conf->global->$calc == 1){ echo '
'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'
'.$langs->trans("Total").''.price($total)."   
'.$langs->trans("Total").''.price($total)."'.price($total).'  '.price($total)."
'.$langs->trans("Total").''."  '.price($total)."
'..')
'.$langs->trans("Rate").': '.vatrate($rate).'%'.$langs->trans("Rate").': '.vatrate($rate).'%
'; - //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; if ($fields['payment_amount'] && $fields['ftotal_ttc']) { $payment_static->id=$fields['payment_id']; @@ -423,7 +399,7 @@ else print $langs->trans("NotUsedForGoods"); } else { - print $fields['payment_amount']; + print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; } print '
'; //print table headers for this quadri - expenses now - //imprime les en-tete de tables pour ce quadri - maintenant les d�penses print ''; print ''; print ''; @@ -584,7 +559,7 @@ else } else { - print $fields['payment_amount']; + print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; } print ''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 4c65b467554..f3d7f09f0b4 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -298,7 +298,7 @@ if ($id > 0) $num = $db->num_rows($result); $i = 0; - $urladd = "&id=".$prev_id; + $urladd = "&id=".$id; print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print"\n\n"; diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 2a9894be87a..abcb5e0ad06 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -39,6 +39,7 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges'); +$object = new ChargeSociales($db); @@ -49,19 +50,32 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges'); /* *************************************************************************** */ // Classify paid -if ($action == 'confirm_paid' && $confirm == 'yes') +if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') { - $chargesociales = new ChargeSociales($db); - $chargesociales->fetch($id); - $result = $chargesociales->set_paid($user); + $object->fetch($id); + $result = $object->set_paid($user); +} + +if ($action == 'reopen' && $user->rights->tax->charges->creer) { + $result = $object->fetch($id); + if ($object->paye) + { + $result = $object->set_unpaid($user); + if ($result > 0) + { + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); + exit(); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } } // Delete social contribution if ($action == 'confirm_delete' && $confirm == 'yes') { - $chargesociales=new ChargeSociales($db); - $chargesociales->fetch($id); - $result=$chargesociales->delete($user); + $object->fetch($id); + $result=$object->delete($user); if ($result > 0) { header("Location: index.php"); @@ -69,7 +83,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') } else { - setEventMessages($chargesociales->error, $chargesociales->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -77,8 +91,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // Add social contribution if ($action == 'add' && $user->rights->tax->charges->creer) { - $dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); - $dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); + $dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); + $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); $amount=price2num(GETPOST('amount')); $actioncode=GETPOST('actioncode'); if (! $dateech) @@ -108,18 +122,16 @@ if ($action == 'add' && $user->rights->tax->charges->creer) } else { - $chargesociales=new ChargeSociales($db); + $object->type=$actioncode; + $object->lib=GETPOST('label'); + $object->date_ech=$dateech; + $object->periode=$dateperiod; + $object->amount=$amount; - $chargesociales->type=$actioncode; - $chargesociales->lib=GETPOST('label'); - $chargesociales->date_ech=$dateech; - $chargesociales->periode=$dateperiod; - $chargesociales->amount=$amount; - - $id=$chargesociales->create($user); + $id=$object->create($user); if ($id <= 0) { - setEventMessages($chargesociales->error, $chargesociales->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action='create'; } } @@ -153,18 +165,17 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr } else { - $chargesociales=new ChargeSociales($db); - $result=$chargesociales->fetch($id); + $result=$object->fetch($id); - $chargesociales->lib=GETPOST('label'); - $chargesociales->date_ech=$dateech; - $chargesociales->periode=$dateperiod; - $chargesociales->amount=price2num($amount); + $object->lib=GETPOST('label'); + $object->date_ech=$dateech; + $object->periode=$dateperiod; + $object->amount=price2num($amount); - $result=$chargesociales->update($user); + $result=$object->update($user); if ($result <= 0) { - setEventMessages($chargesociales->error, $chargesociales->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -178,7 +189,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char $originalId = $id; - $object = new ChargeSociales($db); $object->fetch($id); if ($object->id > 0) @@ -499,6 +509,12 @@ if ($id > 0) { print "
\n"; + // Reopen + if ($object->paye && $user->rights->tax->charges->creer) + { + print "id&action=reopen\">".$langs->trans("ReOpen").""; + } + // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 7712fd09029..1499c79d683 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -339,7 +339,22 @@ class ChargeSociales extends CommonObject if ($return) return 1; else return -1; } - + /** + * Remove tag payed on social contribution + * + * @param User $user Object user making change + * @return int <0 if KO, >0 if OK + */ + function set_unpaid($user) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; + $sql.= " paye = 0"; + $sql.= " WHERE rowid = ".$this->id; + $return = $this->db->query($sql); + if ($return) return 1; + else return -1; + } + /** * Retourne le libelle du statut d'une charge (impaye, payee) * diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5c0dede1bbc..88cd24af359 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -593,8 +593,15 @@ class Contact extends CommonObject $this->canvas = $obj->canvas; $this->import_key = $obj->import_key; + + // Define gender according to civility + if(in_array($this->civility_id, array('MR'))) { + $this->gender = 'man'; + } else if(in_array($this->civility_id, array('MME','MLE'))) { + $this->gender = 'woman'; + } - // Recherche le user Dolibarr lie a ce contact + // Search Dolibarr user linked to this contact $sql = "SELECT u.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.fk_socpeople = ". $this->id; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 702ecb2042f..ac54e1aaa5f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -483,7 +483,7 @@ if ($result) print ''; print ''; } - if (! empty($arrayfields['p.lastname']['checked'])) + if (! empty($arrayfields['p.firstname']['checked'])) { print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index befcf4ef4ff..0634d4c6746 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1874,17 +1874,25 @@ function dol_substr($string,$start,$length,$stringencoding='') * @param int $showpercent Show percent (with type='pie' only) * @param string $url Param to add an url to click values * @param int $combineother 0=No combine, 0.05=Combine if lower than 5% + * @param int $shownographyet Show graph to say there is not enough data * @return void * @deprecated * @see DolGraph */ -function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05) +function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05,$shownographyet=0) { dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); global $conf,$langs; global $theme_datacolor; // To have var kept when function is called several times + if ($shownographyet) + { + print '
'; + print '
'.$langs->trans("NotEnoughDataYet").'
'; + return; + } + if (empty($conf->use_javascript_ajax)) return; $jsgraphlib='flot'; $datacolor=array(); @@ -2031,7 +2039,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie', }); '; } - else print 'BadValueForPArameterType'; + else print 'BadValueForParameterType'; } } @@ -4277,6 +4285,29 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') } +/** + * Return first line of text. Cut will depends if content is HTML or not. + * + * @param string $text Input text + * @return string Output text + * @see dol_nboflines_bis + */ +function dolGetFirstLineOfText($text) +{ + if (dol_textishtml($text)) + { + $firstline=preg_replace('/]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters + $firstline=preg_replace('/]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters + + } + else + { + $firstline=preg_replace('/[\n\r].*/','',$text); + } + return $firstline.((strlen($firstline) != strlen($text))?'...':''); +} + + /** * Replace CRLF in string with a HTML BR tag * @@ -4284,6 +4315,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br * @param bool $forxml false=Use
, true=Use
* @return string String encoded + * @see dol_nboflines, dolGetFirstLineOfText */ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) { @@ -4421,7 +4453,7 @@ function dol_string_is_good_iso($s) * @param string $s String to check * @param int $maxchar Not yet used * @return int Number of lines - * @see dol_nboflines_bis + * @see dol_nboflines_bis, dolGetFirstLineOfText */ function dol_nboflines($s,$maxchar=0) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e9ec126e328..5de04c6718e 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -30,26 +30,6 @@ // Enable this line to trace path when function is called. //print xdebug_print_function_stack('Functions2.lib was called');exit; -/** - * Return first line of text. Cut will depends if content is HTML or not. - * - * @param string $text Input text - * @return string Output text - * @see dol_nboflines_bis - */ -function dolGetFirstLineOfText($text) -{ - if (dol_textishtml($text)) - { - $firstline=preg_replace('/]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters - } - else - { - $firstline=preg_replace('/[\n\r].*/','',$text); - } - return $firstline.((strlen($firstline) != strlen($text))?'...':''); -} - /** * Same function than javascript unescape() function but in PHP. * diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 51cb77ea1a4..6e4c77fe1d2 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -358,7 +358,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali } elseif ($thirdparty instanceof Contact) { $socname = $thirdparty->socname; } else { - throw new InvalidArgumentException(); + throw new InvalidArgumentException('Parameter 1=$thirdparty is not a Societe nor Contact'); } return $outputlangs->convToOutputCharset($socname); diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 8cfd5f202d5..52e0b9b9e96 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -233,7 +233,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $outputlangs = $langs; $newlang=''; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$object->client->default_lang; + if (empty($newlang)) $newlang=$object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 758301c9171..203316ce111 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García @@ -180,7 +180,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction } } - /** * Gets VAT to collect for the given year (and given quarter or month) * The function gets the VAT in split results, as the VAT declaration asks diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 8b9c6c3406f..dd135c10b24 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -479,7 +479,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': 7882aa, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': 515870, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print ''; } @@ -535,6 +535,50 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; } + // Text LinkColor + if ($foruserprofile) + { + /*$var=!$var; + print '
'; + print ''; + print ''; + print ''; + print '';*/ + } + else + { + $var=!$var; + print ''; + print ''; + print ''; + } + // Use Hover $var=!$var; if ($foruserprofile) @@ -579,50 +623,6 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; } - // TopMenuBackgroundColor - if ($foruserprofile) - { - /*$var=!$var; - print ''; - print ''; - print ''; - print ''; - print '';*/ - } - else - { - $var=!$var; - print ''; - print ''; - print ''; - } - print '
'.$elementsup.''.$productsup.''; print ''; diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 29ae4eb3365..9502d723013 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -64,7 +64,7 @@ if ($action == 'builddoc' && $permissioncreate) $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->client->default_lang)) $newlang=$object->client->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ... if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty if (! empty($newlang)) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 5fb15ef1ec1..1db31697bb8 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -352,6 +352,86 @@ class CMailFile $this->phpmailer->setErrorsTo($errors_to); $this->phpmailer->setDeliveryReceipt($deliveryreceipt); } + else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') + { + // Use Swift Mailer library + // ------------------------------------------ + + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; + // Create the message + $this->message = Swift_Message::newInstance(); + + // Adding a trackid header to a message + $headers = $this->message->getHeaders(); + $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER; + $msgid = $headers->get('Message-ID'); + $msgid->setId($headerID); + $headers->addIdHeader('References', $headerID); + + // Give the message a subject + $this->message->setSubject($this->encodetorfc2822($subject)); + + // Set the From address with an associative array + //$this->message->setFrom(array('john@doe.com' => 'John Doe')); + if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from)); + + // Set the To addresses with an associative array + if (! empty($to)) $this->message->setTo($this->getArrayAddress($to)); + + if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from)); + + $this->message->setCharSet($conf->file->character_set_client); + + if (! empty($this->html)) + { + if (!empty($css)) + { + $this->css = $css; + $this->buildCSS(); + } + $msg = $this->html; + $msg = $this->checkIfHTML($msg); + } + + if ($this->atleastoneimage) + { + foreach ($this->images_encoded as $img) + { + //$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid'] + $attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']); + // embed image + $imgcid = $this->message->embed($attachment); + // replace cid by the one created by swiftmail in html message + $msg = str_replace("cid:".$img['cid'], $imgcid, $msg); + } + } + + if ($this->msgishtml) { + $this->message->setBody($msg,'text/html'); + // And optionally an alternative body + //$this->message->addPart('Here is the message itself', 'text/plain'); + } else { + $this->message->setBody($msg,'text/plain'); + // And optionally an alternative body + //$this->message->addPart('Here is the message itself', 'text/html'); + } + + if ($this->atleastonefile) + { + foreach ($filename_list as $i => $val) + { + //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); + $attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]); + $this->message->attach($attachment); + } + } + + if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); + if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); + //if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to); + if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from)); + } else { // Send mail method not correctly defined @@ -392,7 +472,7 @@ class CMailFile return $reshook; } - + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { @@ -427,7 +507,7 @@ class CMailFile if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA - // Le forcage de la valeure grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. + // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. // La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse) $bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); } @@ -527,6 +607,56 @@ class CMailFile } } } + else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') + { + + // Use Swift Mailer library + // ------------------------------------------ + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; + + // Forcage parametres + if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP'); + if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port'); + + // If we use SSL/TLS + $server=$conf->global->MAIN_MAIL_SMTP_SERVER; + $secure=''; + //var_dump(stream_get_transports()); + if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl'; + if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls'; + + $this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure); + + if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID); + if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW); + //$smtps->_msgReplyTo = 'reply@web.com'; + + // Create the Mailer using your created Transport + $this->mailer = Swift_Mailer::newInstance($this->transport); + + if (! empty($conf->global->MAIN_MAIL_DEBUG)) { + // To use the ArrayLogger + $this->logger = new Swift_Plugins_Loggers_ArrayLogger(); + // Or to use the Echo Logger + //$this->logger = new Swift_Plugins_Loggers_EchoLogger(); + $this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger)); + } + // send mail + try { + $result = $this->mailer->send($this->message); + } catch (Exception $e) { + $this->error = $e->getMessage(); + } + if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); + + $res = true; + if (! empty($this->error) && ! $result) { + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); + $res=false; + } else { + $this->error = sprintf ("Sent %d messages\n", $result); + } + } else { @@ -611,6 +741,10 @@ class CMailFile { fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on } + elseif ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') + { + fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on + } fclose($fp); if (! empty($conf->global->MAIN_UMASK)) @@ -915,11 +1049,17 @@ class CMailFile */ function check_server_port($host,$port) { + global $conf; $_retVal=0; $timeout=5; // Timeout in seconds if (function_exists('fsockopen')) { + // If we use SSL/TLS + if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host; + // tls smtp start with no encryption + //if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host; + dol_syslog("Try socket connection to host=".$host." port=".$port); //See if we can connect to the SMTP server if ($socket = @fsockopen( @@ -1047,6 +1187,7 @@ class CMailFile $imgName = $regs[1]; $this->images_encoded[$i]['name'] = $imgName; + $this->images_encoded[$i]['fullpath'] = $fullpath; $this->images_encoded[$i]['content_type'] = $img["content_type"]; $this->images_encoded[$i]['cid'] = $img["cid"]; // Encodage de l'image @@ -1127,5 +1268,39 @@ class CMailFile return $ret; } + + /** + * Return a formatted array of address string for SMTP protocol + * + * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' + * @return array array of email => name + */ + function getArrayAddress($address) + { + global $conf; + + $ret=array(); + + $arrayaddress=explode(',',$address); + + // Boucle sur chaque composant de l'adresse + foreach($arrayaddress as $val) + { + if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs)) + { + $name = trim($regs[1]); + $email = trim($regs[2]); + } + else + { + $name = null; + $email = trim($val); + } + + $ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null; + } + + return $ret; + } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a4dca05ce82..33c70d57ae6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4230,12 +4230,14 @@ abstract class CommonObject } else return 0; } + /** * Update an exta field value for the current object. * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) * This function delte record with all extrafields and insert them again from the array $this->array_options. - * $key key of the extrafield - * @return int -1=error, O=did nothing, 1=OK + * + * @param string $key Key of the extrafield + * @return int -1=error, O=did nothing, 1=OK */ function updateExtraField($key) { @@ -4295,7 +4297,7 @@ abstract class CommonObject } $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key=".$this->array_options["options_$key"]; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key='".$this->db->escape($this->array_options["options_$key"])."'"; $sql .= " WHERE fk_object = ".$this->id; $resql = $this->db->query($sql); if (! $resql) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 0b713de80ff..a4ee48f256b 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -600,7 +600,7 @@ class DolGraph /** - * Build a graph onto disk using Artichow library + * Build a graph onto disk using Artichow library and return img string to it * * @param string $file Image file name to use if we save onto disk * @param string $fileurl Url path to show image if saved onto disk @@ -779,7 +779,7 @@ class DolGraph /** - * Build a graph onto disk using JFlot library. Input when calling this method should be: + * Build a graph using JFlot library. Input when calling this method should be: * $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x @@ -788,9 +788,10 @@ class DolGraph * $this->mode = 'depth' ??? * $this->bgcolorgrid * $this->datacolor + * $this->shownodatagraph * * @param string $file Image file name to use to save onto disk (also used as javascript unique id) - * @param string $fileurl Url path to show image if saved onto disk + * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ private function draw_jflot($file,$fileurl) @@ -849,7 +850,14 @@ class DolGraph $this->stringtoshow =''."\n"; if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; + if (! empty($this->shownographyet)) + { + $this->stringtoshow.='
'; + $this->stringtoshow.='
'.$langs->trans("NotEnoughDataYet").'
'; + return; + } $this->stringtoshow.='
'."\n"; + $this->stringtoshow.=''; + } + print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0); } } diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index b784577bce3..83e30a05413 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1607,14 +1607,17 @@ class SMTPs $_retVal = true; $server_response = ''; + // avoid infinite loop + $limit=0; - while ( substr($server_response,3,1) != ' ' ) + while ( substr($server_response,3,1) != ' ' && $limit<100) { if( !( $server_response = fgets($socket, 256) ) ) { $this->_setErr(121, "Couldn't get mail server response codes"); $_retVal = false; } + $limit++; } if( !( substr($server_response, 0, 3) == $response ) ) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 7e02cbe4679..bfd9314f945 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -76,7 +76,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print $langs->trans("ActionsToDoBy").'   '; print '
'; print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); - if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("Group").'   '; + if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").'   '; print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); print '
'.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); + print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo + print '> '.$langs->trans("UsePersonalValue").''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; + } + else + { + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); + if ($color) print ''; + else print ''; + } + if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '
'.$langs->trans("LinkColor").''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; + } + else + { + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); + if ($color) print ''; + else print $langs->trans("Default"); + } + print '   ('.$langs->trans("Default").': 000078, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '
'.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); - print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo - print '> '.$langs->trans("UsePersonalValue").''; - if ($edit) - { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; - } - else - { - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; - else print ''; - } - if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; - print '
'.$langs->trans("LinkColor").''; - if ($edit) - { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' '; - } - else - { - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); - if ($color) print ''; - else print $langs->trans("Default"); - } - print '   ('.$langs->trans("Default").': 000078, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; - print '
'; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5dfd3a230e9..13af259290c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1324,6 +1324,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // We update newmenu for special dynamic menus if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $sql = "SELECT rowid, label, courant, rappro"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE entity = ".$conf->entity; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 3fc65a8b6a5..6cdb80edaa3 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1261,7 +1261,7 @@ class pdf_einstein extends ModelePDFCommandes if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; @@ -1306,12 +1306,12 @@ class pdf_einstein extends ModelePDFCommandes if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target', $object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target', $object); // Show recipient $widthrecbox=100; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 769b503d8ac..ac3233533c8 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -542,20 +542,20 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetTextColor(0,0,0); // Sender properties - $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); $pdf->SetFont('','', $default_font_size - 3); $pdf->SetXY($blSocX,$blSocY+4); $pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L'); - if ($object->client->code_client) + if ($object->thirdparty->code_client) { $Yoff+=3; $posy=$Yoff; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,0); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Date Expedition @@ -628,12 +628,12 @@ class pdf_merou extends ModelePdfExpedition if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object); $blDestX=$blExpX+55; $blW=54; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 58da00607b8..e493f1ae2f7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -827,12 +827,12 @@ class pdf_rouget extends ModelePdfExpedition $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R'); } - if (! empty($object->client->code_client)) + if (! empty($object->thirdparty->code_client)) { $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } @@ -881,7 +881,7 @@ class pdf_rouget extends ModelePdfExpedition $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; @@ -927,12 +927,12 @@ class pdf_rouget extends ModelePdfExpedition if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object); // Show recipient $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 05fc649453a..e96b9bdc5be 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1554,7 +1554,7 @@ class pdf_crabe extends ModelePDFFactures if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; @@ -1602,12 +1602,12 @@ class pdf_crabe extends ModelePDFFactures if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object); // Show recipient $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 08c08474981..51a3f1fed5f 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -552,12 +552,12 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); - if ($object->client->code_client) + if ($object->thirdparty->code_client) { $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } if ($showaddress) @@ -572,7 +572,7 @@ class pdf_soleil extends ModelePDFFicheinter $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; @@ -615,12 +615,12 @@ class pdf_soleil extends ModelePDFFicheinter if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } - $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object); + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object); // Show recipient $widthrecbox=100; diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 4bb0260ecc8..33ac2cb58c9 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -742,12 +742,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,60); } - if ($object->client->code_client) + if ($object->thirdparty->code_client) { $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $pdf->SetTextColor(0,0,60); @@ -849,12 +849,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object); // Show recipient $widthrecbox=100; diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 61d992b32aa..b9878fd1c83 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -225,14 +225,22 @@ class mailing_contacts3 extends MailingTargets if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) + if ($num) { - $obj = $this->db->fetch_object($resql); - $s.=''; - $i++; + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $s.=''; + $i++; + } + } + else + { + $s.=''; } } + else dol_print_error($this->db); $s.=''; return $s; diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index 631f06ec8f2..421fd2676c8 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -222,16 +222,21 @@ class mailing_contacts4 extends MailingTargets $s=''; $s.=''; return $s; diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index ce4a8b89e09..3db13ac824c 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -26,8 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; /** - * \class mailing_pomme - * \brief Class to offer a selector of emailing targets with Rule 'Peche'. + * Class to offer a selector of emailing targets with Rule 'Peche'. */ class mailing_pomme extends MailingTargets { @@ -112,11 +111,21 @@ class mailing_pomme extends MailingTargets $langs->load("users"); $s=''; + $s.=$langs->trans("Status").': '; $s.=''; + + $s.=' '; + $s.=$langs->trans("Employee").': '; + $s.=''; + return $s; } @@ -142,7 +151,12 @@ class mailing_pomme extends MailingTargets */ function add_to_target($mailing_id,$filtersarray=array()) { - global $conf, $langs; + // Deprecation warning + if ($filtersarray) { + dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING); + } + + global $conf, $langs; $langs->load("companies"); $cibles = array(); @@ -154,11 +168,10 @@ class mailing_pomme extends MailingTargets $sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test $sql.= " AND u.entity IN (0,".$conf->entity.")"; $sql.= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; - foreach($filtersarray as $key) - { - if ($key == '1') $sql.= " AND u.statut=1"; - if ($key == '0') $sql.= " AND u.statut=0"; - } + if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql.= " AND u.statut=1"; + if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND u.statut=0"; + if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql.= " AND u.employee=1"; + if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql.= " AND u.employee=0"; $sql.= " ORDER BY u.email"; // Stocke destinataires dans cibles diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 7e1ce5f8d74..ca4ca787a94 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -63,53 +63,53 @@ class printing_printgcp extends PrintingDriver $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $this->db = $db; - $this->google_id = $conf->global->OAUTH_GOOGLE_ID; - $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; - // Token storage - $storage = new DoliStorage($this->db, $this->conf); - //$storage->clearToken('Google'); - // Setup the credentials for the requests - $credentials = new Credentials( - $this->google_id, - $this->google_secret, - $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' - ); - $access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken'); - $serviceFactory = new \OAuth\ServiceFactory(); - $apiService = $serviceFactory->createService('Google', $credentials, $storage, array()); - $token_ok=true; - try { - $token = $storage->retrieveAccessToken('Google'); - } catch (Exception $e) { - $this->errors[] = $e->getMessage(); - $token_ok = false; - } - //var_dump($this->errors);exit; - $expire = false; - // Is token expired or will token expire in the next 30 seconds - if ($token_ok) { - $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); - } - - // Token expired so we refresh it - if ($token_ok && $expire) { - try { - // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois - $refreshtoken = $token->getRefreshToken(); - $token = $apiService->refreshAccessToken($token); - $token->setRefreshToken($refreshtoken); - $storage->storeAccessToken('Google', $token); - } catch (Exception $e) { - $this->errors[] = $e->getMessage(); - } - } if (!$conf->oauth->enabled) { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'ModuleAuthNotActive', 'type'=>'info'); } else { + $this->google_id = $conf->global->OAUTH_GOOGLE_ID; + $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; + // Token storage + $storage = new DoliStorage($this->db, $this->conf); + //$storage->clearToken('Google'); + // Setup the credentials for the requests + $credentials = new Credentials( + $this->google_id, + $this->google_secret, + $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' + ); + $access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken'); + $serviceFactory = new \OAuth\ServiceFactory(); + $apiService = $serviceFactory->createService('Google', $credentials, $storage, array()); + $token_ok=true; + try { + $token = $storage->retrieveAccessToken('Google'); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + $token_ok = false; + } + //var_dump($this->errors);exit; + + $expire = false; + // Is token expired or will token expire in the next 30 seconds + if ($token_ok) { + $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); + } + + // Token expired so we refresh it + if ($token_ok && $expire) { + try { + // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois + $refreshtoken = $token->getRefreshToken(); + $token = $apiService->refreshAccessToken($token); + $token->setRefreshToken($refreshtoken); + $storage->storeAccessToken('Google', $token); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + } + } if ($this->google_id != '' && $this->google_secret != '') { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):'')); diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 8f8a2edce9b..81439058b38 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -321,14 +321,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->client; + $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } else { - $socobject=$object->client; + $socobject=$object->thirdparty; } // Make substitution $substitutionarray=array( diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3b3bc707ac7..2981eb3bedc 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1442,12 +1442,12 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R'); - if ($object->client->code_client) + if ($object->thirdparty->code_client) { $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $posy+=2; @@ -1467,7 +1467,7 @@ class pdf_azur extends ModelePDFPropales $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; @@ -1511,12 +1511,12 @@ class pdf_azur extends ModelePDFPropales if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { $thirdparty = $object->contact; } else { - $thirdparty = $object->client; + $thirdparty = $object->thirdparty; } $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object); // Show recipient $widthrecbox=100; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 68181831581..62882eecc53 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1271,12 +1271,12 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R'); */ - if ($object->client->code_client) + if ($object->thirdparty->code_client) { $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $posy+=2; @@ -1296,7 +1296,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client); + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; @@ -1340,15 +1340,15 @@ class pdf_aurore extends ModelePDFSupplierProposal { // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; + else $socname = $object->thirdparty->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); } - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object); // Show recipient $widthrecbox=100; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 3a21cee968f..77b58bd83cd 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -183,7 +183,7 @@ else { else { $ajaxoptions=array( - 'update' => array('qty'=>'qty','remise_percent' => 'discount'), // html id tags that will be edited with which ajax json response key + 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key 'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error' ); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index c374a1d9fb0..d3316ad1411 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -882,8 +882,7 @@ if (empty($reshook)) $parameters=array('id'=>$object->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) - { - $result=$object->insertExtraFields(); + { $result=$object->updateExtraField($_POST["attribute"]); if ($result < 0) { $error++; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d86c2b86274..88224a487cf 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -227,10 +227,11 @@ if ($result) $companystatic->client=$objp->client; print $companystatic->getNomUrl(1,'',44); print '
'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_trunc(dolGetFirstLineOfText($objp->description),48).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).''.dolGetFirstLineOfText($objp->descriptiondetail).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).''; - $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; $sql.= ' c.id as paiement_type,'; $sql.= ' pf.amount,'; - $sql.= ' ba.rowid as baid, ba.ref, ba.label'; + $sql.= ' ba.rowid as baid, ba.ref as baref, ba.label'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; @@ -1902,6 +1903,7 @@ else print ''; print ''; print ''; + print ''; print ''; if (! empty($conf->banque->enabled)) print ''; print ''; @@ -1915,16 +1917,23 @@ else { $objp = $db->fetch_object($result); $var=!$var; - print ''; - print '\n"; + print ''; + print ''; print ''; if (! empty($conf->banque->enabled)) { $bankaccountstatic->id=$objp->baid; - $bankaccountstatic->ref=$objp->ref; - $bankaccountstatic->label=$objp->ref; + $bankaccountstatic->ref=$objp->baref; + $bankaccountstatic->label=$objp->baref; print ''; diff --git a/htdocs/includes/ckeditor/ckeditor/contents.css b/htdocs/includes/ckeditor/ckeditor/contents.css index bef3ebc8b1b..7e990756288 100644 --- a/htdocs/includes/ckeditor/ckeditor/contents.css +++ b/htdocs/includes/ckeditor/ckeditor/contents.css @@ -15,7 +15,7 @@ body /* Remove the background color to make it transparent */ background-color: #fff; - margin: 20px; + margin: 5px; } .cke_editable diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift.php b/htdocs/includes/swiftmailer/lib/classes/Swift.php new file mode 100644 index 00000000000..72419b334b7 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift.php @@ -0,0 +1,80 @@ +createDependenciesFor('mime.attachment') + ); + + $this->setBody($data); + $this->setFilename($filename); + if ($contentType) { + $this->setContentType($contentType); + } + } + + /** + * Create a new Attachment. + * + * @param string|Swift_OutputByteStream $data + * @param string $filename + * @param string $contentType + * + * @return Swift_Mime_Attachment + */ + public static function newInstance($data = null, $filename = null, $contentType = null) + { + return new self($data, $filename, $contentType); + } + + /** + * Create a new Attachment from a filesystem path. + * + * @param string $path + * @param string $contentType optional + * + * @return Swift_Mime_Attachment + */ + public static function fromPath($path, $contentType = null) + { + return self::newInstance()->setFile( + new Swift_ByteStream_FileByteStream($path), + $contentType + ); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php new file mode 100644 index 00000000000..a7b0e3a6207 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php @@ -0,0 +1,181 @@ +_filters[$key] = $filter; + } + + /** + * Remove an already present StreamFilter based on its $key. + * + * @param string $key + */ + public function removeFilter($key) + { + unset($this->_filters[$key]); + } + + /** + * Writes $bytes to the end of the stream. + * + * @param string $bytes + * + * @throws Swift_IoException + * + * @return int + */ + public function write($bytes) + { + $this->_writeBuffer .= $bytes; + foreach ($this->_filters as $filter) { + if ($filter->shouldBuffer($this->_writeBuffer)) { + return; + } + } + $this->_doWrite($this->_writeBuffer); + + return ++$this->_sequence; + } + + /** + * For any bytes that are currently buffered inside the stream, force them + * off the buffer. + * + * @throws Swift_IoException + */ + public function commit() + { + $this->_doWrite($this->_writeBuffer); + } + + /** + * Attach $is to this stream. + * + * The stream acts as an observer, receiving all data that is written. + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. + * + * @param Swift_InputByteStream $is + */ + public function bind(Swift_InputByteStream $is) + { + $this->_mirrors[] = $is; + } + + /** + * Remove an already bound stream. + * + * If $is is not bound, no errors will be raised. + * If the stream currently has any buffered data it will be written to $is + * before unbinding occurs. + * + * @param Swift_InputByteStream $is + */ + public function unbind(Swift_InputByteStream $is) + { + foreach ($this->_mirrors as $k => $stream) { + if ($is === $stream) { + if ($this->_writeBuffer !== '') { + $stream->write($this->_writeBuffer); + } + unset($this->_mirrors[$k]); + } + } + } + + /** + * Flush the contents of the stream (empty it) and set the internal pointer + * to the beginning. + * + * @throws Swift_IoException + */ + public function flushBuffers() + { + if ($this->_writeBuffer !== '') { + $this->_doWrite($this->_writeBuffer); + } + $this->_flush(); + + foreach ($this->_mirrors as $stream) { + $stream->flushBuffers(); + } + } + + /** Run $bytes through all filters */ + private function _filter($bytes) + { + foreach ($this->_filters as $filter) { + $bytes = $filter->filter($bytes); + } + + return $bytes; + } + + /** Just write the bytes to the stream */ + private function _doWrite($bytes) + { + $this->_commit($this->_filter($bytes)); + + foreach ($this->_mirrors as $stream) { + $stream->write($bytes); + } + + $this->_writeBuffer = ''; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php new file mode 100644 index 00000000000..ef05a6d5e6e --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php @@ -0,0 +1,182 @@ +_array = $stack; + $this->_arraySize = count($stack); + } elseif (is_string($stack)) { + $this->write($stack); + } else { + $this->_array = array(); + } + } + + /** + * Reads $length bytes from the stream into a string and moves the pointer + * through the stream by $length. + * + * If less bytes exist than are requested the + * remaining bytes are given instead. If no bytes are remaining at all, boolean + * false is returned. + * + * @param int $length + * + * @return string + */ + public function read($length) + { + if ($this->_offset == $this->_arraySize) { + return false; + } + + // Don't use array slice + $end = $length + $this->_offset; + $end = $this->_arraySize < $end ? $this->_arraySize : $end; + $ret = ''; + for (; $this->_offset < $end; ++$this->_offset) { + $ret .= $this->_array[$this->_offset]; + } + + return $ret; + } + + /** + * Writes $bytes to the end of the stream. + * + * @param string $bytes + */ + public function write($bytes) + { + $to_add = str_split($bytes); + foreach ($to_add as $value) { + $this->_array[] = $value; + } + $this->_arraySize = count($this->_array); + + foreach ($this->_mirrors as $stream) { + $stream->write($bytes); + } + } + + /** + * Not used. + */ + public function commit() + { + } + + /** + * Attach $is to this stream. + * + * The stream acts as an observer, receiving all data that is written. + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. + * + * @param Swift_InputByteStream $is + */ + public function bind(Swift_InputByteStream $is) + { + $this->_mirrors[] = $is; + } + + /** + * Remove an already bound stream. + * + * If $is is not bound, no errors will be raised. + * If the stream currently has any buffered data it will be written to $is + * before unbinding occurs. + * + * @param Swift_InputByteStream $is + */ + public function unbind(Swift_InputByteStream $is) + { + foreach ($this->_mirrors as $k => $stream) { + if ($is === $stream) { + unset($this->_mirrors[$k]); + } + } + } + + /** + * Move the internal read pointer to $byteOffset in the stream. + * + * @param int $byteOffset + * + * @return bool + */ + public function setReadPointer($byteOffset) + { + if ($byteOffset > $this->_arraySize) { + $byteOffset = $this->_arraySize; + } elseif ($byteOffset < 0) { + $byteOffset = 0; + } + + $this->_offset = $byteOffset; + } + + /** + * Flush the contents of the stream (empty it) and set the internal pointer + * to the beginning. + */ + public function flushBuffers() + { + $this->_offset = 0; + $this->_array = array(); + $this->_arraySize = 0; + + foreach ($this->_mirrors as $stream) { + $stream->flushBuffers(); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php new file mode 100644 index 00000000000..406104371e8 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php @@ -0,0 +1,229 @@ +_path = $path; + $this->_mode = $writable ? 'w+b' : 'rb'; + + if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) { + $this->_quotes = true; + } + } + + /** + * Get the complete path to the file. + * + * @return string + */ + public function getPath() + { + return $this->_path; + } + + /** + * Reads $length bytes from the stream into a string and moves the pointer + * through the stream by $length. + * + * If less bytes exist than are requested the + * remaining bytes are given instead. If no bytes are remaining at all, boolean + * false is returned. + * + * @param int $length + * + * @throws Swift_IoException + * + * @return string|bool + */ + public function read($length) + { + $fp = $this->_getReadHandle(); + if (!feof($fp)) { + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 0); + } + $bytes = fread($fp, $length); + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 1); + } + $this->_offset = ftell($fp); + + // If we read one byte after reaching the end of the file + // feof() will return false and an empty string is returned + if ($bytes === '' && feof($fp)) { + $this->_resetReadHandle(); + + return false; + } + + return $bytes; + } + + $this->_resetReadHandle(); + + return false; + } + + /** + * Move the internal read pointer to $byteOffset in the stream. + * + * @param int $byteOffset + * + * @return bool + */ + public function setReadPointer($byteOffset) + { + if (isset($this->_reader)) { + $this->_seekReadStreamToPosition($byteOffset); + } + $this->_offset = $byteOffset; + } + + /** Just write the bytes to the file */ + protected function _commit($bytes) + { + fwrite($this->_getWriteHandle(), $bytes); + $this->_resetReadHandle(); + } + + /** Not used */ + protected function _flush() + { + } + + /** Get the resource for reading */ + private function _getReadHandle() + { + if (!isset($this->_reader)) { + if (!$this->_reader = fopen($this->_path, 'rb')) { + throw new Swift_IoException( + 'Unable to open file for reading ['.$this->_path.']' + ); + } + if ($this->_offset != 0) { + $this->_getReadStreamSeekableStatus(); + $this->_seekReadStreamToPosition($this->_offset); + } + } + + return $this->_reader; + } + + /** Get the resource for writing */ + private function _getWriteHandle() + { + if (!isset($this->_writer)) { + if (!$this->_writer = fopen($this->_path, $this->_mode)) { + throw new Swift_IoException( + 'Unable to open file for writing ['.$this->_path.']' + ); + } + } + + return $this->_writer; + } + + /** Force a reload of the resource for reading */ + private function _resetReadHandle() + { + if (isset($this->_reader)) { + fclose($this->_reader); + $this->_reader = null; + } + } + + /** Check if ReadOnly Stream is seekable */ + private function _getReadStreamSeekableStatus() + { + $metas = stream_get_meta_data($this->_reader); + $this->_seekable = $metas['seekable']; + } + + /** Streams in a readOnly stream ensuring copy if needed */ + private function _seekReadStreamToPosition($offset) + { + if ($this->_seekable === null) { + $this->_getReadStreamSeekableStatus(); + } + if ($this->_seekable === false) { + $currentPos = ftell($this->_reader); + if ($currentPos < $offset) { + $toDiscard = $offset - $currentPos; + fread($this->_reader, $toDiscard); + + return; + } + $this->_copyReadStream(); + } + fseek($this->_reader, $offset, SEEK_SET); + } + + /** Copy a readOnly Stream to ensure seekability */ + private function _copyReadStream() + { + if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) { + /* We have opened a php:// Stream Should work without problem */ + } elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) { + /* We have opened a tmpfile */ + } else { + throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available'); + } + $currentPos = ftell($this->_reader); + fclose($this->_reader); + $source = fopen($this->_path, 'rb'); + if (!$source) { + throw new Swift_IoException('Unable to open file for copying ['.$this->_path.']'); + } + fseek($tmpFile, 0, SEEK_SET); + while (!feof($source)) { + fwrite($tmpFile, fread($source, 4096)); + } + fseek($tmpFile, $currentPos, SEEK_SET); + fclose($source); + $this->_reader = $tmpFile; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php new file mode 100644 index 00000000000..1c9a80c0376 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php @@ -0,0 +1,42 @@ +getPath())) === false) { + throw new Swift_IoException('Failed to get temporary file content.'); + } + + return $content; + } + + public function __destruct() + { + if (file_exists($this->getPath())) { + @unlink($this->getPath()); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader.php new file mode 100644 index 00000000000..3d5e854a884 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader.php @@ -0,0 +1,67 @@ + + */ +interface Swift_CharacterReader +{ + const MAP_TYPE_INVALID = 0x01; + const MAP_TYPE_FIXED_LEN = 0x02; + const MAP_TYPE_POSITIONS = 0x03; + + /** + * Returns the complete character map. + * + * @param string $string + * @param int $startOffset + * @param array $currentMap + * @param mixed $ignoredChars + * + * @return int + */ + public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars); + + /** + * Returns the mapType, see constants. + * + * @return int + */ + public function getMapType(); + + /** + * Returns an integer which specifies how many more bytes to read. + * + * A positive integer indicates the number of more bytes to fetch before invoking + * this method again. + * + * A value of zero means this is already a valid character. + * A value of -1 means this cannot possibly be a valid character. + * + * @param integer[] $bytes + * @param int $size + * + * @return int + */ + public function validateByteSequence($bytes, $size); + + /** + * Returns the number of bytes which should be read to start each character. + * + * For fixed width character sets this should be the number of octets-per-character. + * For multibyte character sets this will probably be 1. + * + * @return int + */ + public function getInitialByteSize(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php new file mode 100644 index 00000000000..ab8ebfda708 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php @@ -0,0 +1,97 @@ + + */ +class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader +{ + /** + * The number of bytes in a single character. + * + * @var int + */ + private $_width; + + /** + * Creates a new GenericFixedWidthReader using $width bytes per character. + * + * @param int $width + */ + public function __construct($width) + { + $this->_width = $width; + } + + /** + * Returns the complete character map. + * + * @param string $string + * @param int $startOffset + * @param array $currentMap + * @param mixed $ignoredChars + * + * @return int + */ + public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) + { + $strlen = strlen($string); + // % and / are CPU intensive, so, maybe find a better way + $ignored = $strlen % $this->_width; + $ignoredChars = substr($string, -$ignored); + $currentMap = $this->_width; + + return ($strlen - $ignored) / $this->_width; + } + + /** + * Returns the mapType. + * + * @return int + */ + public function getMapType() + { + return self::MAP_TYPE_FIXED_LEN; + } + + /** + * Returns an integer which specifies how many more bytes to read. + * + * A positive integer indicates the number of more bytes to fetch before invoking + * this method again. + * + * A value of zero means this is already a valid character. + * A value of -1 means this cannot possibly be a valid character. + * + * @param string $bytes + * @param int $size + * + * @return int + */ + public function validateByteSequence($bytes, $size) + { + $needed = $this->_width - $size; + + return $needed > -1 ? $needed : -1; + } + + /** + * Returns the number of bytes which should be read to start each character. + * + * @return int + */ + public function getInitialByteSize() + { + return $this->_width; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php new file mode 100644 index 00000000000..67da48f6cb0 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php @@ -0,0 +1,84 @@ + "\x07F") { + // Invalid char + $currentMap[$i + $startOffset] = $string[$i]; + } + } + + return $strlen; + } + + /** + * Returns mapType. + * + * @return int mapType + */ + public function getMapType() + { + return self::MAP_TYPE_INVALID; + } + + /** + * Returns an integer which specifies how many more bytes to read. + * + * A positive integer indicates the number of more bytes to fetch before invoking + * this method again. + * A value of zero means this is already a valid character. + * A value of -1 means this cannot possibly be a valid character. + * + * @param string $bytes + * @param int $size + * + * @return int + */ + public function validateByteSequence($bytes, $size) + { + $byte = reset($bytes); + if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) { + return 0; + } + + return -1; + } + + /** + * Returns the number of bytes which should be read to start each character. + * + * @return int + */ + public function getInitialByteSize() + { + return 1; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php new file mode 100644 index 00000000000..7379bda258f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php @@ -0,0 +1,176 @@ + + */ +class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader +{ + /** Pre-computed for optimization */ + private static $length_map = array( + // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN + 4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN + ); + + private static $s_length_map = array( + "\x00" => 1, "\x01" => 1, "\x02" => 1, "\x03" => 1, "\x04" => 1, "\x05" => 1, "\x06" => 1, "\x07" => 1, + "\x08" => 1, "\x09" => 1, "\x0a" => 1, "\x0b" => 1, "\x0c" => 1, "\x0d" => 1, "\x0e" => 1, "\x0f" => 1, + "\x10" => 1, "\x11" => 1, "\x12" => 1, "\x13" => 1, "\x14" => 1, "\x15" => 1, "\x16" => 1, "\x17" => 1, + "\x18" => 1, "\x19" => 1, "\x1a" => 1, "\x1b" => 1, "\x1c" => 1, "\x1d" => 1, "\x1e" => 1, "\x1f" => 1, + "\x20" => 1, "\x21" => 1, "\x22" => 1, "\x23" => 1, "\x24" => 1, "\x25" => 1, "\x26" => 1, "\x27" => 1, + "\x28" => 1, "\x29" => 1, "\x2a" => 1, "\x2b" => 1, "\x2c" => 1, "\x2d" => 1, "\x2e" => 1, "\x2f" => 1, + "\x30" => 1, "\x31" => 1, "\x32" => 1, "\x33" => 1, "\x34" => 1, "\x35" => 1, "\x36" => 1, "\x37" => 1, + "\x38" => 1, "\x39" => 1, "\x3a" => 1, "\x3b" => 1, "\x3c" => 1, "\x3d" => 1, "\x3e" => 1, "\x3f" => 1, + "\x40" => 1, "\x41" => 1, "\x42" => 1, "\x43" => 1, "\x44" => 1, "\x45" => 1, "\x46" => 1, "\x47" => 1, + "\x48" => 1, "\x49" => 1, "\x4a" => 1, "\x4b" => 1, "\x4c" => 1, "\x4d" => 1, "\x4e" => 1, "\x4f" => 1, + "\x50" => 1, "\x51" => 1, "\x52" => 1, "\x53" => 1, "\x54" => 1, "\x55" => 1, "\x56" => 1, "\x57" => 1, + "\x58" => 1, "\x59" => 1, "\x5a" => 1, "\x5b" => 1, "\x5c" => 1, "\x5d" => 1, "\x5e" => 1, "\x5f" => 1, + "\x60" => 1, "\x61" => 1, "\x62" => 1, "\x63" => 1, "\x64" => 1, "\x65" => 1, "\x66" => 1, "\x67" => 1, + "\x68" => 1, "\x69" => 1, "\x6a" => 1, "\x6b" => 1, "\x6c" => 1, "\x6d" => 1, "\x6e" => 1, "\x6f" => 1, + "\x70" => 1, "\x71" => 1, "\x72" => 1, "\x73" => 1, "\x74" => 1, "\x75" => 1, "\x76" => 1, "\x77" => 1, + "\x78" => 1, "\x79" => 1, "\x7a" => 1, "\x7b" => 1, "\x7c" => 1, "\x7d" => 1, "\x7e" => 1, "\x7f" => 1, + "\x80" => 0, "\x81" => 0, "\x82" => 0, "\x83" => 0, "\x84" => 0, "\x85" => 0, "\x86" => 0, "\x87" => 0, + "\x88" => 0, "\x89" => 0, "\x8a" => 0, "\x8b" => 0, "\x8c" => 0, "\x8d" => 0, "\x8e" => 0, "\x8f" => 0, + "\x90" => 0, "\x91" => 0, "\x92" => 0, "\x93" => 0, "\x94" => 0, "\x95" => 0, "\x96" => 0, "\x97" => 0, + "\x98" => 0, "\x99" => 0, "\x9a" => 0, "\x9b" => 0, "\x9c" => 0, "\x9d" => 0, "\x9e" => 0, "\x9f" => 0, + "\xa0" => 0, "\xa1" => 0, "\xa2" => 0, "\xa3" => 0, "\xa4" => 0, "\xa5" => 0, "\xa6" => 0, "\xa7" => 0, + "\xa8" => 0, "\xa9" => 0, "\xaa" => 0, "\xab" => 0, "\xac" => 0, "\xad" => 0, "\xae" => 0, "\xaf" => 0, + "\xb0" => 0, "\xb1" => 0, "\xb2" => 0, "\xb3" => 0, "\xb4" => 0, "\xb5" => 0, "\xb6" => 0, "\xb7" => 0, + "\xb8" => 0, "\xb9" => 0, "\xba" => 0, "\xbb" => 0, "\xbc" => 0, "\xbd" => 0, "\xbe" => 0, "\xbf" => 0, + "\xc0" => 2, "\xc1" => 2, "\xc2" => 2, "\xc3" => 2, "\xc4" => 2, "\xc5" => 2, "\xc6" => 2, "\xc7" => 2, + "\xc8" => 2, "\xc9" => 2, "\xca" => 2, "\xcb" => 2, "\xcc" => 2, "\xcd" => 2, "\xce" => 2, "\xcf" => 2, + "\xd0" => 2, "\xd1" => 2, "\xd2" => 2, "\xd3" => 2, "\xd4" => 2, "\xd5" => 2, "\xd6" => 2, "\xd7" => 2, + "\xd8" => 2, "\xd9" => 2, "\xda" => 2, "\xdb" => 2, "\xdc" => 2, "\xdd" => 2, "\xde" => 2, "\xdf" => 2, + "\xe0" => 3, "\xe1" => 3, "\xe2" => 3, "\xe3" => 3, "\xe4" => 3, "\xe5" => 3, "\xe6" => 3, "\xe7" => 3, + "\xe8" => 3, "\xe9" => 3, "\xea" => 3, "\xeb" => 3, "\xec" => 3, "\xed" => 3, "\xee" => 3, "\xef" => 3, + "\xf0" => 4, "\xf1" => 4, "\xf2" => 4, "\xf3" => 4, "\xf4" => 4, "\xf5" => 4, "\xf6" => 4, "\xf7" => 4, + "\xf8" => 5, "\xf9" => 5, "\xfa" => 5, "\xfb" => 5, "\xfc" => 6, "\xfd" => 6, "\xfe" => 0, "\xff" => 0, + ); + + /** + * Returns the complete character map. + * + * @param string $string + * @param int $startOffset + * @param array $currentMap + * @param mixed $ignoredChars + * + * @return int + */ + public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) + { + if (!isset($currentMap['i']) || !isset($currentMap['p'])) { + $currentMap['p'] = $currentMap['i'] = array(); + } + + $strlen = strlen($string); + $charPos = count($currentMap['p']); + $foundChars = 0; + $invalid = false; + for ($i = 0; $i < $strlen; ++$i) { + $char = $string[$i]; + $size = self::$s_length_map[$char]; + if ($size == 0) { + /* char is invalid, we must wait for a resync */ + $invalid = true; + continue; + } else { + if ($invalid == true) { + /* We mark the chars as invalid and start a new char */ + $currentMap['p'][$charPos + $foundChars] = $startOffset + $i; + $currentMap['i'][$charPos + $foundChars] = true; + ++$foundChars; + $invalid = false; + } + if (($i + $size) > $strlen) { + $ignoredChars = substr($string, $i); + break; + } + for ($j = 1; $j < $size; ++$j) { + $char = $string[$i + $j]; + if ($char > "\x7F" && $char < "\xC0") { + // Valid - continue parsing + } else { + /* char is invalid, we must wait for a resync */ + $invalid = true; + continue 2; + } + } + /* Ok we got a complete char here */ + $currentMap['p'][$charPos + $foundChars] = $startOffset + $i + $size; + $i += $j - 1; + ++$foundChars; + } + } + + return $foundChars; + } + + /** + * Returns mapType. + * + * @return int mapType + */ + public function getMapType() + { + return self::MAP_TYPE_POSITIONS; + } + + /** + * Returns an integer which specifies how many more bytes to read. + * + * A positive integer indicates the number of more bytes to fetch before invoking + * this method again. + * A value of zero means this is already a valid character. + * A value of -1 means this cannot possibly be a valid character. + * + * @param string $bytes + * @param int $size + * + * @return int + */ + public function validateByteSequence($bytes, $size) + { + if ($size < 1) { + return -1; + } + $needed = self::$length_map[$bytes[0]] - $size; + + return $needed > -1 ? $needed : -1; + } + + /** + * Returns the number of bytes which should be read to start each character. + * + * @return int + */ + public function getInitialByteSize() + { + return 1; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php new file mode 100644 index 00000000000..15b6c6920f4 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php @@ -0,0 +1,26 @@ +init(); + } + + public function __wakeup() + { + $this->init(); + } + + public function init() + { + if (count(self::$_map) > 0) { + return; + } + + $prefix = 'Swift_CharacterReader_'; + + $singleByte = array( + 'class' => $prefix.'GenericFixedWidthReader', + 'constructor' => array(1), + ); + + $doubleByte = array( + 'class' => $prefix.'GenericFixedWidthReader', + 'constructor' => array(2), + ); + + $fourBytes = array( + 'class' => $prefix.'GenericFixedWidthReader', + 'constructor' => array(4), + ); + + // Utf-8 + self::$_map['utf-?8'] = array( + 'class' => $prefix.'Utf8Reader', + 'constructor' => array(), + ); + + //7-8 bit charsets + self::$_map['(us-)?ascii'] = $singleByte; + self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte; + self::$_map['windows-?125[0-9]'] = $singleByte; + self::$_map['cp-?[0-9]+'] = $singleByte; + self::$_map['ansi'] = $singleByte; + self::$_map['macintosh'] = $singleByte; + self::$_map['koi-?7'] = $singleByte; + self::$_map['koi-?8-?.+'] = $singleByte; + self::$_map['mik'] = $singleByte; + self::$_map['(cork|t1)'] = $singleByte; + self::$_map['v?iscii'] = $singleByte; + + //16 bits + self::$_map['(ucs-?2|utf-?16)'] = $doubleByte; + + //32 bits + self::$_map['(ucs-?4|utf-?32)'] = $fourBytes; + + // Fallback + self::$_map['.*'] = $singleByte; + } + + /** + * Returns a CharacterReader suitable for the charset applied. + * + * @param string $charset + * + * @return Swift_CharacterReader + */ + public function getReaderFor($charset) + { + $charset = trim(strtolower($charset)); + foreach (self::$_map as $pattern => $spec) { + $re = '/^'.$pattern.'$/D'; + if (preg_match($re, $charset)) { + if (!array_key_exists($pattern, self::$_loaded)) { + $reflector = new ReflectionClass($spec['class']); + if ($reflector->getConstructor()) { + $reader = $reflector->newInstanceArgs($spec['constructor']); + } else { + $reader = $reflector->newInstance(); + } + self::$_loaded[$pattern] = $reader; + } + + return self::$_loaded[$pattern]; + } + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php new file mode 100644 index 00000000000..717924f5d63 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php @@ -0,0 +1,89 @@ +setCharacterReaderFactory($factory); + $this->setCharacterSet($charset); + } + + /** + * Set the character set used in this CharacterStream. + * + * @param string $charset + */ + public function setCharacterSet($charset) + { + $this->_charset = $charset; + $this->_charReader = null; + } + + /** + * Set the CharacterReaderFactory for multi charset support. + * + * @param Swift_CharacterReaderFactory $factory + */ + public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory) + { + $this->_charReaderFactory = $factory; + } + + /** + * Overwrite this character stream using the byte sequence in the byte stream. + * + * @param Swift_OutputByteStream $os output stream to read from + */ + public function importByteStream(Swift_OutputByteStream $os) + { + if (!isset($this->_charReader)) { + $this->_charReader = $this->_charReaderFactory + ->getReaderFor($this->_charset); + } + + $startLength = $this->_charReader->getInitialByteSize(); + while (false !== $bytes = $os->read($startLength)) { + $c = array(); + for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) { + $c[] = self::$_byteMap[$bytes[$i]]; + } + $size = count($c); + $need = $this->_charReader + ->validateByteSequence($c, $size); + if ($need > 0 && + false !== $bytes = $os->read($need)) { + for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) { + $c[] = self::$_byteMap[$bytes[$i]]; + } + } + $this->_array[] = $c; + ++$this->_array_size; + } + } + + /** + * Import a string a bytes into this CharacterStream, overwriting any existing + * data in the stream. + * + * @param string $string + */ + public function importString($string) + { + $this->flushContents(); + $this->write($string); + } + + /** + * Read $length characters from the stream and move the internal pointer + * $length further into the stream. + * + * @param int $length + * + * @return string + */ + public function read($length) + { + if ($this->_offset == $this->_array_size) { + return false; + } + + // Don't use array slice + $arrays = array(); + $end = $length + $this->_offset; + for ($i = $this->_offset; $i < $end; ++$i) { + if (!isset($this->_array[$i])) { + break; + } + $arrays[] = $this->_array[$i]; + } + $this->_offset += $i - $this->_offset; // Limit function calls + $chars = false; + foreach ($arrays as $array) { + $chars .= implode('', array_map('chr', $array)); + } + + return $chars; + } + + /** + * Read $length characters from the stream and return a 1-dimensional array + * containing there octet values. + * + * @param int $length + * + * @return integer[] + */ + public function readBytes($length) + { + if ($this->_offset == $this->_array_size) { + return false; + } + $arrays = array(); + $end = $length + $this->_offset; + for ($i = $this->_offset; $i < $end; ++$i) { + if (!isset($this->_array[$i])) { + break; + } + $arrays[] = $this->_array[$i]; + } + $this->_offset += ($i - $this->_offset); // Limit function calls + + return call_user_func_array('array_merge', $arrays); + } + + /** + * Write $chars to the end of the stream. + * + * @param string $chars + */ + public function write($chars) + { + if (!isset($this->_charReader)) { + $this->_charReader = $this->_charReaderFactory->getReaderFor( + $this->_charset); + } + + $startLength = $this->_charReader->getInitialByteSize(); + + $fp = fopen('php://memory', 'w+b'); + fwrite($fp, $chars); + unset($chars); + fseek($fp, 0, SEEK_SET); + + $buffer = array(0); + $buf_pos = 1; + $buf_len = 1; + $has_datas = true; + do { + $bytes = array(); + // Buffer Filing + if ($buf_len - $buf_pos < $startLength) { + $buf = array_splice($buffer, $buf_pos); + $new = $this->_reloadBuffer($fp, 100); + if ($new) { + $buffer = array_merge($buf, $new); + $buf_len = count($buffer); + $buf_pos = 0; + } else { + $has_datas = false; + } + } + if ($buf_len - $buf_pos > 0) { + $size = 0; + for ($i = 0; $i < $startLength && isset($buffer[$buf_pos]); ++$i) { + ++$size; + $bytes[] = $buffer[$buf_pos++]; + } + $need = $this->_charReader->validateByteSequence( + $bytes, $size); + if ($need > 0) { + if ($buf_len - $buf_pos < $need) { + $new = $this->_reloadBuffer($fp, $need); + + if ($new) { + $buffer = array_merge($buffer, $new); + $buf_len = count($buffer); + } + } + for ($i = 0; $i < $need && isset($buffer[$buf_pos]); ++$i) { + $bytes[] = $buffer[$buf_pos++]; + } + } + $this->_array[] = $bytes; + ++$this->_array_size; + } + } while ($has_datas); + + fclose($fp); + } + + /** + * Move the internal pointer to $charOffset in the stream. + * + * @param int $charOffset + */ + public function setPointer($charOffset) + { + if ($charOffset > $this->_array_size) { + $charOffset = $this->_array_size; + } elseif ($charOffset < 0) { + $charOffset = 0; + } + $this->_offset = $charOffset; + } + + /** + * Empty the stream and reset the internal pointer. + */ + public function flushContents() + { + $this->_offset = 0; + $this->_array = array(); + $this->_array_size = 0; + } + + private function _reloadBuffer($fp, $len) + { + if (!feof($fp) && ($bytes = fread($fp, $len)) !== false) { + $buf = array(); + for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) { + $buf[] = self::$_byteMap[$bytes[$i]]; + } + + return $buf; + } + + return false; + } + + private static function _initializeMaps() + { + if (!isset(self::$_charMap)) { + self::$_charMap = array(); + for ($byte = 0; $byte < 256; ++$byte) { + self::$_charMap[$byte] = chr($byte); + } + self::$_byteMap = array_flip(self::$_charMap); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php new file mode 100644 index 00000000000..1e8e2899672 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php @@ -0,0 +1,267 @@ + + */ +class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream +{ + /** + * The char reader (lazy-loaded) for the current charset. + * + * @var Swift_CharacterReader + */ + private $_charReader; + + /** + * A factory for creating CharacterReader instances. + * + * @var Swift_CharacterReaderFactory + */ + private $_charReaderFactory; + + /** + * The character set this stream is using. + * + * @var string + */ + private $_charset; + + /** + * The data's stored as-is. + * + * @var string + */ + private $_datas = ''; + + /** + * Number of bytes in the stream. + * + * @var int + */ + private $_datasSize = 0; + + /** + * Map. + * + * @var mixed + */ + private $_map; + + /** + * Map Type. + * + * @var int + */ + private $_mapType = 0; + + /** + * Number of characters in the stream. + * + * @var int + */ + private $_charCount = 0; + + /** + * Position in the stream. + * + * @var int + */ + private $_currentPos = 0; + + /** + * Constructor. + * + * @param Swift_CharacterReaderFactory $factory + * @param string $charset + */ + public function __construct(Swift_CharacterReaderFactory $factory, $charset) + { + $this->setCharacterReaderFactory($factory); + $this->setCharacterSet($charset); + } + + /* -- Changing parameters of the stream -- */ + + /** + * Set the character set used in this CharacterStream. + * + * @param string $charset + */ + public function setCharacterSet($charset) + { + $this->_charset = $charset; + $this->_charReader = null; + $this->_mapType = 0; + } + + /** + * Set the CharacterReaderFactory for multi charset support. + * + * @param Swift_CharacterReaderFactory $factory + */ + public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory) + { + $this->_charReaderFactory = $factory; + } + + /** + * @see Swift_CharacterStream::flushContents() + */ + public function flushContents() + { + $this->_datas = null; + $this->_map = null; + $this->_charCount = 0; + $this->_currentPos = 0; + $this->_datasSize = 0; + } + + /** + * @see Swift_CharacterStream::importByteStream() + * + * @param Swift_OutputByteStream $os + */ + public function importByteStream(Swift_OutputByteStream $os) + { + $this->flushContents(); + $blocks = 512; + $os->setReadPointer(0); + while (false !== ($read = $os->read($blocks))) { + $this->write($read); + } + } + + /** + * @see Swift_CharacterStream::importString() + * + * @param string $string + */ + public function importString($string) + { + $this->flushContents(); + $this->write($string); + } + + /** + * @see Swift_CharacterStream::read() + * + * @param int $length + * + * @return string + */ + public function read($length) + { + if ($this->_currentPos >= $this->_charCount) { + return false; + } + $ret = false; + $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length; + switch ($this->_mapType) { + case Swift_CharacterReader::MAP_TYPE_FIXED_LEN: + $len = $length * $this->_map; + $ret = substr($this->_datas, + $this->_currentPos * $this->_map, + $len); + $this->_currentPos += $length; + break; + + case Swift_CharacterReader::MAP_TYPE_INVALID: + $ret = ''; + for (; $this->_currentPos < $length; ++$this->_currentPos) { + if (isset($this->_map[$this->_currentPos])) { + $ret .= '?'; + } else { + $ret .= $this->_datas[$this->_currentPos]; + } + } + break; + + case Swift_CharacterReader::MAP_TYPE_POSITIONS: + $end = $this->_currentPos + $length; + $end = $end > $this->_charCount ? $this->_charCount : $end; + $ret = ''; + $start = 0; + if ($this->_currentPos > 0) { + $start = $this->_map['p'][$this->_currentPos - 1]; + } + $to = $start; + for (; $this->_currentPos < $end; ++$this->_currentPos) { + if (isset($this->_map['i'][$this->_currentPos])) { + $ret .= substr($this->_datas, $start, $to - $start).'?'; + $start = $this->_map['p'][$this->_currentPos]; + } else { + $to = $this->_map['p'][$this->_currentPos]; + } + } + $ret .= substr($this->_datas, $start, $to - $start); + break; + } + + return $ret; + } + + /** + * @see Swift_CharacterStream::readBytes() + * + * @param int $length + * + * @return integer[] + */ + public function readBytes($length) + { + $read = $this->read($length); + if ($read !== false) { + $ret = array_map('ord', str_split($read, 1)); + + return $ret; + } + + return false; + } + + /** + * @see Swift_CharacterStream::setPointer() + * + * @param int $charOffset + */ + public function setPointer($charOffset) + { + if ($this->_charCount < $charOffset) { + $charOffset = $this->_charCount; + } + $this->_currentPos = $charOffset; + } + + /** + * @see Swift_CharacterStream::write() + * + * @param string $chars + */ + public function write($chars) + { + if (!isset($this->_charReader)) { + $this->_charReader = $this->_charReaderFactory->getReaderFor( + $this->_charset); + $this->_map = array(); + $this->_mapType = $this->_charReader->getMapType(); + } + $ignored = ''; + $this->_datas .= $chars; + $this->_charCount += $this->_charReader->getCharPositions(substr($this->_datas, $this->_datasSize), $this->_datasSize, $this->_map, $ignored); + if ($ignored !== false) { + $this->_datasSize = strlen($this->_datas) - strlen($ignored); + } else { + $this->_datasSize = strlen($this->_datas); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ConfigurableSpool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ConfigurableSpool.php new file mode 100644 index 00000000000..4ae5bacfc40 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ConfigurableSpool.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Base class for Spools (implements time and message limits). + * + * @author Fabien Potencier + */ +abstract class Swift_ConfigurableSpool implements Swift_Spool +{ + /** The maximum number of messages to send per flush */ + private $_message_limit; + + /** The time limit per flush */ + private $_time_limit; + + /** + * Sets the maximum number of messages to send per flush. + * + * @param int $limit + */ + public function setMessageLimit($limit) + { + $this->_message_limit = (int) $limit; + } + + /** + * Gets the maximum number of messages to send per flush. + * + * @return int The limit + */ + public function getMessageLimit() + { + return $this->_message_limit; + } + + /** + * Sets the time limit (in seconds) per flush. + * + * @param int $limit The limit + */ + public function setTimeLimit($limit) + { + $this->_time_limit = (int) $limit; + } + + /** + * Gets the time limit (in seconds) per flush. + * + * @return int The limit + */ + public function getTimeLimit() + { + return $this->_time_limit; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php new file mode 100644 index 00000000000..8c1074a3a37 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php @@ -0,0 +1,373 @@ +_store); + } + + /** + * Test if an item is registered in this container with the given name. + * + * @see register() + * + * @param string $itemName + * + * @return bool + */ + public function has($itemName) + { + return array_key_exists($itemName, $this->_store) + && isset($this->_store[$itemName]['lookupType']); + } + + /** + * Lookup the item with the given $itemName. + * + * @see register() + * + * @param string $itemName + * + * @throws Swift_DependencyException If the dependency is not found + * + * @return mixed + */ + public function lookup($itemName) + { + if (!$this->has($itemName)) { + throw new Swift_DependencyException( + 'Cannot lookup dependency "'.$itemName.'" since it is not registered.' + ); + } + + switch ($this->_store[$itemName]['lookupType']) { + case self::TYPE_ALIAS: + return $this->_createAlias($itemName); + case self::TYPE_VALUE: + return $this->_getValue($itemName); + case self::TYPE_INSTANCE: + return $this->_createNewInstance($itemName); + case self::TYPE_SHARED: + return $this->_createSharedInstance($itemName); + } + } + + /** + * Create an array of arguments passed to the constructor of $itemName. + * + * @param string $itemName + * + * @return array + */ + public function createDependenciesFor($itemName) + { + $args = array(); + if (isset($this->_store[$itemName]['args'])) { + $args = $this->_resolveArgs($this->_store[$itemName]['args']); + } + + return $args; + } + + /** + * Register a new dependency with $itemName. + * + * This method returns the current DependencyContainer instance because it + * requires the use of the fluid interface to set the specific details for the + * dependency. + * + * @see asNewInstanceOf(), asSharedInstanceOf(), asValue() + * + * @param string $itemName + * + * @return Swift_DependencyContainer + */ + public function register($itemName) + { + $this->_store[$itemName] = array(); + $this->_endPoint = &$this->_store[$itemName]; + + return $this; + } + + /** + * Specify the previously registered item as a literal value. + * + * {@link register()} must be called before this will work. + * + * @param mixed $value + * + * @return Swift_DependencyContainer + */ + public function asValue($value) + { + $endPoint = &$this->_getEndPoint(); + $endPoint['lookupType'] = self::TYPE_VALUE; + $endPoint['value'] = $value; + + return $this; + } + + /** + * Specify the previously registered item as an alias of another item. + * + * @param string $lookup + * + * @return Swift_DependencyContainer + */ + public function asAliasOf($lookup) + { + $endPoint = &$this->_getEndPoint(); + $endPoint['lookupType'] = self::TYPE_ALIAS; + $endPoint['ref'] = $lookup; + + return $this; + } + + /** + * Specify the previously registered item as a new instance of $className. + * + * {@link register()} must be called before this will work. + * Any arguments can be set with {@link withDependencies()}, + * {@link addConstructorValue()} or {@link addConstructorLookup()}. + * + * @see withDependencies(), addConstructorValue(), addConstructorLookup() + * + * @param string $className + * + * @return Swift_DependencyContainer + */ + public function asNewInstanceOf($className) + { + $endPoint = &$this->_getEndPoint(); + $endPoint['lookupType'] = self::TYPE_INSTANCE; + $endPoint['className'] = $className; + + return $this; + } + + /** + * Specify the previously registered item as a shared instance of $className. + * + * {@link register()} must be called before this will work. + * + * @param string $className + * + * @return Swift_DependencyContainer + */ + public function asSharedInstanceOf($className) + { + $endPoint = &$this->_getEndPoint(); + $endPoint['lookupType'] = self::TYPE_SHARED; + $endPoint['className'] = $className; + + return $this; + } + + /** + * Specify a list of injected dependencies for the previously registered item. + * + * This method takes an array of lookup names. + * + * @see addConstructorValue(), addConstructorLookup() + * + * @param array $lookups + * + * @return Swift_DependencyContainer + */ + public function withDependencies(array $lookups) + { + $endPoint = &$this->_getEndPoint(); + $endPoint['args'] = array(); + foreach ($lookups as $lookup) { + $this->addConstructorLookup($lookup); + } + + return $this; + } + + /** + * Specify a literal (non looked up) value for the constructor of the + * previously registered item. + * + * @see withDependencies(), addConstructorLookup() + * + * @param mixed $value + * + * @return Swift_DependencyContainer + */ + public function addConstructorValue($value) + { + $endPoint = &$this->_getEndPoint(); + if (!isset($endPoint['args'])) { + $endPoint['args'] = array(); + } + $endPoint['args'][] = array('type' => 'value', 'item' => $value); + + return $this; + } + + /** + * Specify a dependency lookup for the constructor of the previously + * registered item. + * + * @see withDependencies(), addConstructorValue() + * + * @param string $lookup + * + * @return Swift_DependencyContainer + */ + public function addConstructorLookup($lookup) + { + $endPoint = &$this->_getEndPoint(); + if (!isset($this->_endPoint['args'])) { + $endPoint['args'] = array(); + } + $endPoint['args'][] = array('type' => 'lookup', 'item' => $lookup); + + return $this; + } + + /** Get the literal value with $itemName */ + private function _getValue($itemName) + { + return $this->_store[$itemName]['value']; + } + + /** Resolve an alias to another item */ + private function _createAlias($itemName) + { + return $this->lookup($this->_store[$itemName]['ref']); + } + + /** Create a fresh instance of $itemName */ + private function _createNewInstance($itemName) + { + $reflector = new ReflectionClass($this->_store[$itemName]['className']); + if ($reflector->getConstructor()) { + return $reflector->newInstanceArgs( + $this->createDependenciesFor($itemName) + ); + } + + return $reflector->newInstance(); + } + + /** Create and register a shared instance of $itemName */ + private function _createSharedInstance($itemName) + { + if (!isset($this->_store[$itemName]['instance'])) { + $this->_store[$itemName]['instance'] = $this->_createNewInstance($itemName); + } + + return $this->_store[$itemName]['instance']; + } + + /** Get the current endpoint in the store */ + private function &_getEndPoint() + { + if (!isset($this->_endPoint)) { + throw new BadMethodCallException( + 'Component must first be registered by calling register()' + ); + } + + return $this->_endPoint; + } + + /** Get an argument list with dependencies resolved */ + private function _resolveArgs(array $args) + { + $resolved = array(); + foreach ($args as $argDefinition) { + switch ($argDefinition['type']) { + case 'lookup': + $resolved[] = $this->_lookupRecursive($argDefinition['item']); + break; + case 'value': + $resolved[] = $argDefinition['item']; + break; + } + } + + return $resolved; + } + + /** Resolve a single dependency with an collections */ + private function _lookupRecursive($item) + { + if (is_array($item)) { + $collection = array(); + foreach ($item as $k => $v) { + $collection[$k] = $this->_lookupRecursive($v); + } + + return $collection; + } + + return $this->lookup($item); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyException.php new file mode 100644 index 00000000000..799d38d8334 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyException.php @@ -0,0 +1,27 @@ +createDependenciesFor('mime.embeddedfile') + ); + + $this->setBody($data); + $this->setFilename($filename); + if ($contentType) { + $this->setContentType($contentType); + } + } + + /** + * Create a new EmbeddedFile. + * + * @param string|Swift_OutputByteStream $data + * @param string $filename + * @param string $contentType + * + * @return Swift_Mime_EmbeddedFile + */ + public static function newInstance($data = null, $filename = null, $contentType = null) + { + return new self($data, $filename, $contentType); + } + + /** + * Create a new EmbeddedFile from a filesystem path. + * + * @param string $path + * + * @return Swift_Mime_EmbeddedFile + */ + public static function fromPath($path) + { + return self::newInstance()->setFile( + new Swift_ByteStream_FileByteStream($path) + ); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder.php new file mode 100644 index 00000000000..2073abca1b1 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder.php @@ -0,0 +1,28 @@ += $maxLineLength || 76 < $maxLineLength) { + $maxLineLength = 76; + } + + $encodedString = base64_encode($string); + $firstLine = ''; + + if (0 != $firstLineOffset) { + $firstLine = substr( + $encodedString, 0, $maxLineLength - $firstLineOffset + )."\r\n"; + $encodedString = substr( + $encodedString, $maxLineLength - $firstLineOffset + ); + } + + return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n")); + } + + /** + * Does nothing. + */ + public function charsetChanged($charset) + { + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php new file mode 100644 index 00000000000..8a81fe39709 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php @@ -0,0 +1,300 @@ + '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04', + 5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09', + 10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E', + 15 => '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13', + 20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18', + 25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D', + 30 => '=1E', 31 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22', + 35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27', + 40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C', + 45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', 49 => '=31', + 50 => '=32', 51 => '=33', 52 => '=34', 53 => '=35', 54 => '=36', + 55 => '=37', 56 => '=38', 57 => '=39', 58 => '=3A', 59 => '=3B', + 60 => '=3C', 61 => '=3D', 62 => '=3E', 63 => '=3F', 64 => '=40', + 65 => '=41', 66 => '=42', 67 => '=43', 68 => '=44', 69 => '=45', + 70 => '=46', 71 => '=47', 72 => '=48', 73 => '=49', 74 => '=4A', + 75 => '=4B', 76 => '=4C', 77 => '=4D', 78 => '=4E', 79 => '=4F', + 80 => '=50', 81 => '=51', 82 => '=52', 83 => '=53', 84 => '=54', + 85 => '=55', 86 => '=56', 87 => '=57', 88 => '=58', 89 => '=59', + 90 => '=5A', 91 => '=5B', 92 => '=5C', 93 => '=5D', 94 => '=5E', + 95 => '=5F', 96 => '=60', 97 => '=61', 98 => '=62', 99 => '=63', + 100 => '=64', 101 => '=65', 102 => '=66', 103 => '=67', 104 => '=68', + 105 => '=69', 106 => '=6A', 107 => '=6B', 108 => '=6C', 109 => '=6D', + 110 => '=6E', 111 => '=6F', 112 => '=70', 113 => '=71', 114 => '=72', + 115 => '=73', 116 => '=74', 117 => '=75', 118 => '=76', 119 => '=77', + 120 => '=78', 121 => '=79', 122 => '=7A', 123 => '=7B', 124 => '=7C', + 125 => '=7D', 126 => '=7E', 127 => '=7F', 128 => '=80', 129 => '=81', + 130 => '=82', 131 => '=83', 132 => '=84', 133 => '=85', 134 => '=86', + 135 => '=87', 136 => '=88', 137 => '=89', 138 => '=8A', 139 => '=8B', + 140 => '=8C', 141 => '=8D', 142 => '=8E', 143 => '=8F', 144 => '=90', + 145 => '=91', 146 => '=92', 147 => '=93', 148 => '=94', 149 => '=95', + 150 => '=96', 151 => '=97', 152 => '=98', 153 => '=99', 154 => '=9A', + 155 => '=9B', 156 => '=9C', 157 => '=9D', 158 => '=9E', 159 => '=9F', + 160 => '=A0', 161 => '=A1', 162 => '=A2', 163 => '=A3', 164 => '=A4', + 165 => '=A5', 166 => '=A6', 167 => '=A7', 168 => '=A8', 169 => '=A9', + 170 => '=AA', 171 => '=AB', 172 => '=AC', 173 => '=AD', 174 => '=AE', + 175 => '=AF', 176 => '=B0', 177 => '=B1', 178 => '=B2', 179 => '=B3', + 180 => '=B4', 181 => '=B5', 182 => '=B6', 183 => '=B7', 184 => '=B8', + 185 => '=B9', 186 => '=BA', 187 => '=BB', 188 => '=BC', 189 => '=BD', + 190 => '=BE', 191 => '=BF', 192 => '=C0', 193 => '=C1', 194 => '=C2', + 195 => '=C3', 196 => '=C4', 197 => '=C5', 198 => '=C6', 199 => '=C7', + 200 => '=C8', 201 => '=C9', 202 => '=CA', 203 => '=CB', 204 => '=CC', + 205 => '=CD', 206 => '=CE', 207 => '=CF', 208 => '=D0', 209 => '=D1', + 210 => '=D2', 211 => '=D3', 212 => '=D4', 213 => '=D5', 214 => '=D6', + 215 => '=D7', 216 => '=D8', 217 => '=D9', 218 => '=DA', 219 => '=DB', + 220 => '=DC', 221 => '=DD', 222 => '=DE', 223 => '=DF', 224 => '=E0', + 225 => '=E1', 226 => '=E2', 227 => '=E3', 228 => '=E4', 229 => '=E5', + 230 => '=E6', 231 => '=E7', 232 => '=E8', 233 => '=E9', 234 => '=EA', + 235 => '=EB', 236 => '=EC', 237 => '=ED', 238 => '=EE', 239 => '=EF', + 240 => '=F0', 241 => '=F1', 242 => '=F2', 243 => '=F3', 244 => '=F4', + 245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9', + 250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE', + 255 => '=FF', + ); + + protected static $_safeMapShare = array(); + + /** + * A map of non-encoded ascii characters. + * + * @var string[] + */ + protected $_safeMap = array(); + + /** + * Creates a new QpEncoder for the given CharacterStream. + * + * @param Swift_CharacterStream $charStream to use for reading characters + * @param Swift_StreamFilter $filter if input should be canonicalized + */ + public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null) + { + $this->_charStream = $charStream; + if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) { + $this->initSafeMap(); + self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap; + } else { + $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()]; + } + $this->_filter = $filter; + } + + public function __sleep() + { + return array('_charStream', '_filter'); + } + + public function __wakeup() + { + if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) { + $this->initSafeMap(); + self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap; + } else { + $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()]; + } + } + + protected function getSafeMapShareId() + { + return get_class($this); + } + + protected function initSafeMap() + { + foreach (array_merge( + array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) { + $this->_safeMap[$byte] = chr($byte); + } + } + + /** + * Takes an unencoded string and produces a QP encoded string from it. + * + * QP encoded strings have a maximum line length of 76 characters. + * If the first line needs to be shorter, indicate the difference with + * $firstLineOffset. + * + * @param string $string to encode + * @param int $firstLineOffset, optional + * @param int $maxLineLength, optional 0 indicates the default of 76 chars + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + if ($maxLineLength > 76 || $maxLineLength <= 0) { + $maxLineLength = 76; + } + + $thisLineLength = $maxLineLength - $firstLineOffset; + + $lines = array(); + $lNo = 0; + $lines[$lNo] = ''; + $currentLine = &$lines[$lNo++]; + $size = $lineLen = 0; + + $this->_charStream->flushContents(); + $this->_charStream->importString($string); + + // Fetching more than 4 chars at one is slower, as is fetching fewer bytes + // Conveniently 4 chars is the UTF-8 safe number since UTF-8 has up to 6 + // bytes per char and (6 * 4 * 3 = 72 chars per line) * =NN is 3 bytes + while (false !== $bytes = $this->_nextSequence()) { + // If we're filtering the input + if (isset($this->_filter)) { + // If we can't filter because we need more bytes + while ($this->_filter->shouldBuffer($bytes)) { + // Then collect bytes into the buffer + if (false === $moreBytes = $this->_nextSequence(1)) { + break; + } + + foreach ($moreBytes as $b) { + $bytes[] = $b; + } + } + // And filter them + $bytes = $this->_filter->filter($bytes); + } + + $enc = $this->_encodeByteSequence($bytes, $size); + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { + $lines[$lNo] = ''; + $currentLine = &$lines[$lNo++]; + $thisLineLength = $maxLineLength; + $lineLen = 0; + } + + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } + } + + return $this->_standardize(implode("=\r\n", $lines)); + } + + /** + * Updates the charset used. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->_charStream->setCharacterSet($charset); + } + + /** + * Encode the given byte array into a verbatim QP form. + * + * @param integer[] $bytes + * @param int $size + * + * @return string + */ + protected function _encodeByteSequence(array $bytes, &$size) + { + $ret = ''; + $size = 0; + foreach ($bytes as $b) { + if (isset($this->_safeMap[$b])) { + $ret .= $this->_safeMap[$b]; + ++$size; + } else { + $ret .= self::$_qpMap[$b]; + $size += 3; + } + } + + return $ret; + } + + /** + * Get the next sequence of bytes to read from the char stream. + * + * @param int $size number of bytes to read + * + * @return integer[] + */ + protected function _nextSequence($size = 4) + { + return $this->_charStream->readBytes($size); + } + + /** + * Make sure CRLF is correct and HT/SPACE are in valid places. + * + * @param string $string + * + * @return string + */ + protected function _standardize($string) + { + $string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'), + array("=09\r\n", "=20\r\n", "\r\n"), $string + ); + switch ($end = ord(substr($string, -1))) { + case 0x09: + case 0x20: + $string = substr_replace($string, self::$_qpMap[$end], -1); + } + + return $string; + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->_charStream = clone $this->_charStream; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php new file mode 100644 index 00000000000..b0215e88380 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php @@ -0,0 +1,92 @@ +_charStream = $charStream; + } + + /** + * Takes an unencoded string and produces a string encoded according to + * RFC 2231 from it. + * + * @param string $string + * @param int $firstLineOffset + * @param int $maxLineLength optional, 0 indicates the default of 75 bytes + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + $lines = array(); + $lineCount = 0; + $lines[] = ''; + $currentLine = &$lines[$lineCount++]; + + if (0 >= $maxLineLength) { + $maxLineLength = 75; + } + + $this->_charStream->flushContents(); + $this->_charStream->importString($string); + + $thisLineLength = $maxLineLength - $firstLineOffset; + + while (false !== $char = $this->_charStream->read(4)) { + $encodedChar = rawurlencode($char); + if (0 != strlen($currentLine) + && strlen($currentLine.$encodedChar) > $thisLineLength) { + $lines[] = ''; + $currentLine = &$lines[$lineCount++]; + $thisLineLength = $maxLineLength; + } + $currentLine .= $encodedChar; + } + + return implode("\r\n", $lines); + } + + /** + * Updates the charset used. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->_charStream->setCharacterSet($charset); + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->_charStream = clone $this->_charStream; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoding.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoding.php new file mode 100644 index 00000000000..253977b608e --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoding.php @@ -0,0 +1,64 @@ +lookup($key); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php new file mode 100644 index 00000000000..7dc381d9844 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php @@ -0,0 +1,65 @@ +_command = $command; + $this->_successCodes = $successCodes; + } + + /** + * Get the command which was sent to the server. + * + * @return string + */ + public function getCommand() + { + return $this->_command; + } + + /** + * Get the numeric response codes which indicate success for this command. + * + * @return integer[] + */ + public function getSuccessCodes() + { + return $this->_successCodes; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php new file mode 100644 index 00000000000..7545404e765 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php @@ -0,0 +1,24 @@ +_source = $source; + } + + /** + * Get the source object of this event. + * + * @return object + */ + public function getSource() + { + return $this->_source; + } + + /** + * Prevent this Event from bubbling any further up the stack. + * + * @param bool $cancel, optional + */ + public function cancelBubble($cancel = true) + { + $this->_bubbleCancelled = $cancel; + } + + /** + * Returns true if this Event will not bubble any further up the stack. + * + * @return bool + */ + public function bubbleCancelled() + { + return $this->_bubbleCancelled; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php new file mode 100644 index 00000000000..2e92ba9404f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php @@ -0,0 +1,65 @@ +_response = $response; + $this->_valid = $valid; + } + + /** + * Get the response which was received from the server. + * + * @return string + */ + public function getResponse() + { + return $this->_response; + } + + /** + * Get the success status of this Event. + * + * @return bool + */ + public function isValid() + { + return $this->_valid; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php new file mode 100644 index 00000000000..c40919d210f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php @@ -0,0 +1,24 @@ +_message = $message; + $this->_result = self::RESULT_PENDING; + } + + /** + * Get the Transport used to send the Message. + * + * @return Swift_Transport + */ + public function getTransport() + { + return $this->getSource(); + } + + /** + * Get the Message being sent. + * + * @return Swift_Mime_Message + */ + public function getMessage() + { + return $this->_message; + } + + /** + * Set the array of addresses that failed in sending. + * + * @param array $recipients + */ + public function setFailedRecipients($recipients) + { + $this->_failedRecipients = $recipients; + } + + /** + * Get an recipient addresses which were not accepted for delivery. + * + * @return string[] + */ + public function getFailedRecipients() + { + return $this->_failedRecipients; + } + + /** + * Set the result of sending. + * + * @param int $result + */ + public function setResult($result) + { + $this->_result = $result; + } + + /** + * Get the result of this Event. + * + * The return value is a bitmask from + * {@see RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED} + * + * @return int + */ + public function getResult() + { + return $this->_result; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php new file mode 100644 index 00000000000..d922e1bfa96 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php @@ -0,0 +1,31 @@ +_eventMap = array( + 'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener', + 'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener', + 'Swift_Events_SendEvent' => 'Swift_Events_SendListener', + 'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener', + 'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener', + ); + } + + /** + * Create a new SendEvent for $source and $message. + * + * @param Swift_Transport $source + * @param Swift_Mime_Message + * + * @return Swift_Events_SendEvent + */ + public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message) + { + return new Swift_Events_SendEvent($source, $message); + } + + /** + * Create a new CommandEvent for $source and $command. + * + * @param Swift_Transport $source + * @param string $command That will be executed + * @param array $successCodes That are needed + * + * @return Swift_Events_CommandEvent + */ + public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array()) + { + return new Swift_Events_CommandEvent($source, $command, $successCodes); + } + + /** + * Create a new ResponseEvent for $source and $response. + * + * @param Swift_Transport $source + * @param string $response + * @param bool $valid If the response is valid + * + * @return Swift_Events_ResponseEvent + */ + public function createResponseEvent(Swift_Transport $source, $response, $valid) + { + return new Swift_Events_ResponseEvent($source, $response, $valid); + } + + /** + * Create a new TransportChangeEvent for $source. + * + * @param Swift_Transport $source + * + * @return Swift_Events_TransportChangeEvent + */ + public function createTransportChangeEvent(Swift_Transport $source) + { + return new Swift_Events_TransportChangeEvent($source); + } + + /** + * Create a new TransportExceptionEvent for $source. + * + * @param Swift_Transport $source + * @param Swift_TransportException $ex + * + * @return Swift_Events_TransportExceptionEvent + */ + public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex) + { + return new Swift_Events_TransportExceptionEvent($source, $ex); + } + + /** + * Bind an event listener to this dispatcher. + * + * @param Swift_Events_EventListener $listener + */ + public function bindEventListener(Swift_Events_EventListener $listener) + { + foreach ($this->_listeners as $l) { + // Already loaded + if ($l === $listener) { + return; + } + } + $this->_listeners[] = $listener; + } + + /** + * Dispatch the given Event to all suitable listeners. + * + * @param Swift_Events_EventObject $evt + * @param string $target method + */ + public function dispatchEvent(Swift_Events_EventObject $evt, $target) + { + $this->_prepareBubbleQueue($evt); + $this->_bubble($evt, $target); + } + + /** Queue listeners on a stack ready for $evt to be bubbled up it */ + private function _prepareBubbleQueue(Swift_Events_EventObject $evt) + { + $this->_bubbleQueue = array(); + $evtClass = get_class($evt); + foreach ($this->_listeners as $listener) { + if (array_key_exists($evtClass, $this->_eventMap) + && ($listener instanceof $this->_eventMap[$evtClass])) { + $this->_bubbleQueue[] = $listener; + } + } + } + + /** Bubble $evt up the stack calling $target() on each listener */ + private function _bubble(Swift_Events_EventObject $evt, $target) + { + if (!$evt->bubbleCancelled() && $listener = array_shift($this->_bubbleQueue)) { + $listener->$target($evt); + $this->_bubble($evt, $target); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php new file mode 100644 index 00000000000..a8972fda9a4 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php @@ -0,0 +1,27 @@ +getSource(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php new file mode 100644 index 00000000000..253165de89f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php @@ -0,0 +1,45 @@ +_exception = $ex; + } + + /** + * Get the TransportException thrown. + * + * @return Swift_TransportException + */ + public function getException() + { + return $this->_exception; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php new file mode 100644 index 00000000000..cc3c0993793 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php @@ -0,0 +1,24 @@ +createDependenciesFor('transport.failover') + ); + + $this->setTransports($transports); + } + + /** + * Create a new FailoverTransport instance. + * + * @param Swift_Transport[] $transports + * + * @return Swift_FailoverTransport + */ + public static function newInstance($transports = array()) + { + return new self($transports); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php new file mode 100644 index 00000000000..220853989d3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php @@ -0,0 +1,208 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Stores Messages on the filesystem. + * + * @author Fabien Potencier + * @author Xavier De Cock + */ +class Swift_FileSpool extends Swift_ConfigurableSpool +{ + /** The spool directory */ + private $_path; + + /** + * File WriteRetry Limit. + * + * @var int + */ + private $_retryLimit = 10; + + /** + * Create a new FileSpool. + * + * @param string $path + * + * @throws Swift_IoException + */ + public function __construct($path) + { + $this->_path = $path; + + if (!file_exists($this->_path)) { + if (!mkdir($this->_path, 0777, true)) { + throw new Swift_IoException('Unable to create Path ['.$this->_path.']'); + } + } + } + + /** + * Tests if this Spool mechanism has started. + * + * @return bool + */ + public function isStarted() + { + return true; + } + + /** + * Starts this Spool mechanism. + */ + public function start() + { + } + + /** + * Stops this Spool mechanism. + */ + public function stop() + { + } + + /** + * Allow to manage the enqueuing retry limit. + * + * Default, is ten and allows over 64^20 different fileNames + * + * @param int $limit + */ + public function setRetryLimit($limit) + { + $this->_retryLimit = $limit; + } + + /** + * Queues a message. + * + * @param Swift_Mime_Message $message The message to store + * + * @throws Swift_IoException + * + * @return bool + */ + public function queueMessage(Swift_Mime_Message $message) + { + $ser = serialize($message); + $fileName = $this->_path.'/'.$this->getRandomString(10); + for ($i = 0; $i < $this->_retryLimit; ++$i) { + /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */ + $fp = @fopen($fileName.'.message', 'x'); + if (false !== $fp) { + if (false === fwrite($fp, $ser)) { + return false; + } + + return fclose($fp); + } else { + /* The file already exists, we try a longer fileName */ + $fileName .= $this->getRandomString(1); + } + } + + throw new Swift_IoException('Unable to create a file for enqueuing Message'); + } + + /** + * Execute a recovery if for any reason a process is sending for too long. + * + * @param int $timeout in second Defaults is for very slow smtp responses + */ + public function recover($timeout = 900) + { + foreach (new DirectoryIterator($this->_path) as $file) { + $file = $file->getRealPath(); + + if (substr($file, -16) == '.message.sending') { + $lockedtime = filectime($file); + if ((time() - $lockedtime) > $timeout) { + rename($file, substr($file, 0, -8)); + } + } + } + } + + /** + * Sends messages using the given transport instance. + * + * @param Swift_Transport $transport A transport instance + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int The number of sent e-mail's + */ + public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) + { + $directoryIterator = new DirectoryIterator($this->_path); + + /* Start the transport only if there are queued files to send */ + if (!$transport->isStarted()) { + foreach ($directoryIterator as $file) { + if (substr($file->getRealPath(), -8) == '.message') { + $transport->start(); + break; + } + } + } + + $failedRecipients = (array) $failedRecipients; + $count = 0; + $time = time(); + foreach ($directoryIterator as $file) { + $file = $file->getRealPath(); + + if (substr($file, -8) != '.message') { + continue; + } + + /* We try a rename, it's an atomic operation, and avoid locking the file */ + if (rename($file, $file.'.sending')) { + $message = unserialize(file_get_contents($file.'.sending')); + + $count += $transport->send($message, $failedRecipients); + + unlink($file.'.sending'); + } else { + /* This message has just been catched by another process */ + continue; + } + + if ($this->getMessageLimit() && $count >= $this->getMessageLimit()) { + break; + } + + if ($this->getTimeLimit() && (time() - $time) >= $this->getTimeLimit()) { + break; + } + } + + return $count; + } + + /** + * Returns a random string needed to generate a fileName for the queue. + * + * @param int $count + * + * @return string + */ + protected function getRandomString($count) + { + // This string MUST stay FS safe, avoid special chars + $base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-'; + $ret = ''; + $strlen = strlen($base); + for ($i = 0; $i < $count; ++$i) { + $ret .= $base[((int) rand(0, $strlen - 1))]; + } + + return $ret; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/FileStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/FileStream.php new file mode 100644 index 00000000000..0b24db1ce41 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/FileStream.php @@ -0,0 +1,24 @@ +setFile( + new Swift_ByteStream_FileByteStream($path) + ); + + return $image; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php new file mode 100644 index 00000000000..56efc7593ac --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php @@ -0,0 +1,75 @@ +_stream = $stream; + } + + /** + * Set a string into the cache under $itemKey for the namespace $nsKey. + * + * @see MODE_WRITE, MODE_APPEND + * + * @param string $nsKey + * @param string $itemKey + * @param string $string + * @param int $mode + */ + public function setString($nsKey, $itemKey, $string, $mode) + { + $this->_prepareCache($nsKey); + switch ($mode) { + case self::MODE_WRITE: + $this->_contents[$nsKey][$itemKey] = $string; + break; + case self::MODE_APPEND: + if (!$this->hasKey($nsKey, $itemKey)) { + $this->_contents[$nsKey][$itemKey] = ''; + } + $this->_contents[$nsKey][$itemKey] .= $string; + break; + default: + throw new Swift_SwiftException( + 'Invalid mode ['.$mode.'] used to set nsKey='. + $nsKey.', itemKey='.$itemKey + ); + } + } + + /** + * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. + * + * @see MODE_WRITE, MODE_APPEND + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_OutputByteStream $os + * @param int $mode + */ + public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) + { + $this->_prepareCache($nsKey); + switch ($mode) { + case self::MODE_WRITE: + $this->clearKey($nsKey, $itemKey); + case self::MODE_APPEND: + if (!$this->hasKey($nsKey, $itemKey)) { + $this->_contents[$nsKey][$itemKey] = ''; + } + while (false !== $bytes = $os->read(8192)) { + $this->_contents[$nsKey][$itemKey] .= $bytes; + } + break; + default: + throw new Swift_SwiftException( + 'Invalid mode ['.$mode.'] used to set nsKey='. + $nsKey.', itemKey='.$itemKey + ); + } + } + + /** + * Provides a ByteStream which when written to, writes data to $itemKey. + * + * NOTE: The stream will always write in append mode. + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_InputByteStream $writeThrough + * + * @return Swift_InputByteStream + */ + public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) + { + $is = clone $this->_stream; + $is->setKeyCache($this); + $is->setNsKey($nsKey); + $is->setItemKey($itemKey); + if (isset($writeThrough)) { + $is->setWriteThroughStream($writeThrough); + } + + return $is; + } + + /** + * Get data back out of the cache as a string. + * + * @param string $nsKey + * @param string $itemKey + * + * @return string + */ + public function getString($nsKey, $itemKey) + { + $this->_prepareCache($nsKey); + if ($this->hasKey($nsKey, $itemKey)) { + return $this->_contents[$nsKey][$itemKey]; + } + } + + /** + * Get data back out of the cache as a ByteStream. + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_InputByteStream $is to write the data to + */ + public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) + { + $this->_prepareCache($nsKey); + $is->write($this->getString($nsKey, $itemKey)); + } + + /** + * Check if the given $itemKey exists in the namespace $nsKey. + * + * @param string $nsKey + * @param string $itemKey + * + * @return bool + */ + public function hasKey($nsKey, $itemKey) + { + $this->_prepareCache($nsKey); + + return array_key_exists($itemKey, $this->_contents[$nsKey]); + } + + /** + * Clear data for $itemKey in the namespace $nsKey if it exists. + * + * @param string $nsKey + * @param string $itemKey + */ + public function clearKey($nsKey, $itemKey) + { + unset($this->_contents[$nsKey][$itemKey]); + } + + /** + * Clear all data in the namespace $nsKey if it exists. + * + * @param string $nsKey + */ + public function clearAll($nsKey) + { + unset($this->_contents[$nsKey]); + } + + /** + * Initialize the namespace of $nsKey if needed. + * + * @param string $nsKey + */ + private function _prepareCache($nsKey) + { + if (!array_key_exists($nsKey, $this->_contents)) { + $this->_contents[$nsKey] = array(); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php new file mode 100644 index 00000000000..453f50a15db --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php @@ -0,0 +1,321 @@ +_stream = $stream; + $this->_path = $path; + + if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) { + $this->_quotes = true; + } + } + + /** + * Set a string into the cache under $itemKey for the namespace $nsKey. + * + * @see MODE_WRITE, MODE_APPEND + * + * @param string $nsKey + * @param string $itemKey + * @param string $string + * @param int $mode + * + * @throws Swift_IoException + */ + public function setString($nsKey, $itemKey, $string, $mode) + { + $this->_prepareCache($nsKey); + switch ($mode) { + case self::MODE_WRITE: + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START); + break; + case self::MODE_APPEND: + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END); + break; + default: + throw new Swift_SwiftException( + 'Invalid mode ['.$mode.'] used to set nsKey='. + $nsKey.', itemKey='.$itemKey + ); + break; + } + fwrite($fp, $string); + $this->_freeHandle($nsKey, $itemKey); + } + + /** + * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. + * + * @see MODE_WRITE, MODE_APPEND + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_OutputByteStream $os + * @param int $mode + * + * @throws Swift_IoException + */ + public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) + { + $this->_prepareCache($nsKey); + switch ($mode) { + case self::MODE_WRITE: + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START); + break; + case self::MODE_APPEND: + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END); + break; + default: + throw new Swift_SwiftException( + 'Invalid mode ['.$mode.'] used to set nsKey='. + $nsKey.', itemKey='.$itemKey + ); + break; + } + while (false !== $bytes = $os->read(8192)) { + fwrite($fp, $bytes); + } + $this->_freeHandle($nsKey, $itemKey); + } + + /** + * Provides a ByteStream which when written to, writes data to $itemKey. + * + * NOTE: The stream will always write in append mode. + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_InputByteStream $writeThrough + * + * @return Swift_InputByteStream + */ + public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) + { + $is = clone $this->_stream; + $is->setKeyCache($this); + $is->setNsKey($nsKey); + $is->setItemKey($itemKey); + if (isset($writeThrough)) { + $is->setWriteThroughStream($writeThrough); + } + + return $is; + } + + /** + * Get data back out of the cache as a string. + * + * @param string $nsKey + * @param string $itemKey + * + * @throws Swift_IoException + * + * @return string + */ + public function getString($nsKey, $itemKey) + { + $this->_prepareCache($nsKey); + if ($this->hasKey($nsKey, $itemKey)) { + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START); + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 0); + } + $str = ''; + while (!feof($fp) && false !== $bytes = fread($fp, 8192)) { + $str .= $bytes; + } + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 1); + } + $this->_freeHandle($nsKey, $itemKey); + + return $str; + } + } + + /** + * Get data back out of the cache as a ByteStream. + * + * @param string $nsKey + * @param string $itemKey + * @param Swift_InputByteStream $is to write the data to + */ + public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) + { + if ($this->hasKey($nsKey, $itemKey)) { + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START); + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 0); + } + while (!feof($fp) && false !== $bytes = fread($fp, 8192)) { + $is->write($bytes); + } + if ($this->_quotes) { + ini_set('magic_quotes_runtime', 1); + } + $this->_freeHandle($nsKey, $itemKey); + } + } + + /** + * Check if the given $itemKey exists in the namespace $nsKey. + * + * @param string $nsKey + * @param string $itemKey + * + * @return bool + */ + public function hasKey($nsKey, $itemKey) + { + return is_file($this->_path.'/'.$nsKey.'/'.$itemKey); + } + + /** + * Clear data for $itemKey in the namespace $nsKey if it exists. + * + * @param string $nsKey + * @param string $itemKey + */ + public function clearKey($nsKey, $itemKey) + { + if ($this->hasKey($nsKey, $itemKey)) { + $this->_freeHandle($nsKey, $itemKey); + unlink($this->_path.'/'.$nsKey.'/'.$itemKey); + } + } + + /** + * Clear all data in the namespace $nsKey if it exists. + * + * @param string $nsKey + */ + public function clearAll($nsKey) + { + if (array_key_exists($nsKey, $this->_keys)) { + foreach ($this->_keys[$nsKey] as $itemKey => $null) { + $this->clearKey($nsKey, $itemKey); + } + if (is_dir($this->_path.'/'.$nsKey)) { + rmdir($this->_path.'/'.$nsKey); + } + unset($this->_keys[$nsKey]); + } + } + + /** + * Initialize the namespace of $nsKey if needed. + * + * @param string $nsKey + */ + private function _prepareCache($nsKey) + { + $cacheDir = $this->_path.'/'.$nsKey; + if (!is_dir($cacheDir)) { + if (!mkdir($cacheDir)) { + throw new Swift_IoException('Failed to create cache directory '.$cacheDir); + } + $this->_keys[$nsKey] = array(); + } + } + + /** + * Get a file handle on the cache item. + * + * @param string $nsKey + * @param string $itemKey + * @param int $position + * + * @return resource + */ + private function _getHandle($nsKey, $itemKey, $position) + { + if (!isset($this->_keys[$nsKey][$itemKey])) { + $openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b'; + $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode); + $this->_keys[$nsKey][$itemKey] = $fp; + } + if (self::POSITION_START == $position) { + fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_SET); + } elseif (self::POSITION_END == $position) { + fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_END); + } + + return $this->_keys[$nsKey][$itemKey]; + } + + private function _freeHandle($nsKey, $itemKey) + { + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_CURRENT); + fclose($fp); + $this->_keys[$nsKey][$itemKey] = null; + } + + /** + * Destructor. + */ + public function __destruct() + { + foreach ($this->_keys as $nsKey => $null) { + $this->clearAll($nsKey); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php new file mode 100644 index 00000000000..af80bdca6bf --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php @@ -0,0 +1,51 @@ +_keyCache = $keyCache; + } + + /** + * Specify a stream to write through for each write(). + * + * @param Swift_InputByteStream $is + */ + public function setWriteThroughStream(Swift_InputByteStream $is) + { + $this->_writeThrough = $is; + } + + /** + * Writes $bytes to the end of the stream. + * + * @param string $bytes + * @param Swift_InputByteStream $is optional + */ + public function write($bytes, Swift_InputByteStream $is = null) + { + $this->_keyCache->setString( + $this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND + ); + if (isset($is)) { + $is->write($bytes); + } + if (isset($this->_writeThrough)) { + $this->_writeThrough->write($bytes); + } + } + + /** + * Not used. + */ + public function commit() + { + } + + /** + * Not used. + */ + public function bind(Swift_InputByteStream $is) + { + } + + /** + * Not used. + */ + public function unbind(Swift_InputByteStream $is) + { + } + + /** + * Flush the contents of the stream (empty it) and set the internal pointer + * to the beginning. + */ + public function flushBuffers() + { + $this->_keyCache->clearKey($this->_nsKey, $this->_itemKey); + } + + /** + * Set the nsKey which will be written to. + * + * @param string $nsKey + */ + public function setNsKey($nsKey) + { + $this->_nsKey = $nsKey; + } + + /** + * Set the itemKey which will be written to. + * + * @param string $itemKey + */ + public function setItemKey($itemKey) + { + $this->_itemKey = $itemKey; + } + + /** + * Any implementation should be cloneable, allowing the clone to access a + * separate $nsKey and $itemKey. + */ + public function __clone() + { + $this->_writeThrough = null; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php new file mode 100644 index 00000000000..fdba9df50dc --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php @@ -0,0 +1,45 @@ +createDependenciesFor('transport.loadbalanced') + ); + + $this->setTransports($transports); + } + + /** + * Create a new LoadBalancedTransport instance. + * + * @param array $transports + * + * @return Swift_LoadBalancedTransport + */ + public static function newInstance($transports = array()) + { + return new self($transports); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/MailTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/MailTransport.php new file mode 100644 index 00000000000..858ca814792 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/MailTransport.php @@ -0,0 +1,45 @@ +createDependenciesFor('transport.mail') + ); + + $this->setExtraParams($extraParams); + } + + /** + * Create a new MailTransport instance. + * + * @param string $extraParams To be passed to mail() + * + * @return Swift_MailTransport + */ + public static function newInstance($extraParams = '-f%s') + { + return new self($extraParams); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php new file mode 100644 index 00000000000..34a78d47b54 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php @@ -0,0 +1,114 @@ +_transport = $transport; + } + + /** + * Create a new Mailer instance. + * + * @param Swift_Transport $transport + * + * @return Swift_Mailer + */ + public static function newInstance(Swift_Transport $transport) + { + return new self($transport); + } + + /** + * Create a new class instance of one of the message services. + * + * For example 'mimepart' would create a 'message.mimepart' instance + * + * @param string $service + * + * @return object + */ + public function createMessage($service = 'message') + { + return Swift_DependencyContainer::getInstance() + ->lookup('message.'.$service); + } + + /** + * Send the given Message like it would be sent in a mail client. + * + * All recipients (with the exception of Bcc) will be able to see the other + * recipients this message was sent to. + * + * Recipient/sender data will be retrieved from the Message object. + * + * The return value is the number of recipients who were accepted for + * delivery. + * + * @param Swift_Mime_Message $message + * @param array $failedRecipients An array of failures by-reference + * + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $failedRecipients = (array) $failedRecipients; + + if (!$this->_transport->isStarted()) { + $this->_transport->start(); + } + + $sent = 0; + + try { + $sent = $this->_transport->send($message, $failedRecipients); + } catch (Swift_RfcComplianceException $e) { + foreach ($message->getTo() as $address => $name) { + $failedRecipients[] = $address; + } + } + + return $sent; + } + + /** + * Register a plugin using a known unique key (e.g. myPlugin). + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_transport->registerPlugin($plugin); + } + + /** + * The Transport used to send messages. + * + * @return Swift_Transport + */ + public function getTransport() + { + return $this->_transport; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php new file mode 100644 index 00000000000..e3e6cad05bd --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php @@ -0,0 +1,55 @@ +_recipients = $recipients; + } + + /** + * Returns true only if there are more recipients to send to. + * + * @return bool + */ + public function hasNext() + { + return !empty($this->_recipients); + } + + /** + * Returns an array where the keys are the addresses of recipients and the + * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL). + * + * @return array + */ + public function nextRecipient() + { + return array_splice($this->_recipients, 0, 1); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/RecipientIterator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/RecipientIterator.php new file mode 100644 index 00000000000..650f3ec3df4 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/RecipientIterator.php @@ -0,0 +1,32 @@ + 'Foo') or ('foo@bar' => NULL). + * + * @return array + */ + public function nextRecipient(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php new file mode 100644 index 00000000000..5b239694d81 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Stores Messages in memory. + * + * @author Fabien Potencier + */ +class Swift_MemorySpool implements Swift_Spool +{ + protected $messages = array(); + + /** + * Tests if this Transport mechanism has started. + * + * @return bool + */ + public function isStarted() + { + return true; + } + + /** + * Starts this Transport mechanism. + */ + public function start() + { + } + + /** + * Stops this Transport mechanism. + */ + public function stop() + { + } + + /** + * Stores a message in the queue. + * + * @param Swift_Mime_Message $message The message to store + * + * @return bool Whether the operation has succeeded + */ + public function queueMessage(Swift_Mime_Message $message) + { + //clone the message to make sure it is not changed while in the queue + $this->messages[] = clone $message; + + return true; + } + + /** + * Sends messages using the given transport instance. + * + * @param Swift_Transport $transport A transport instance + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int The number of sent emails + */ + public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) + { + if (!$this->messages) { + return 0; + } + + if (!$transport->isStarted()) { + $transport->start(); + } + + $count = 0; + while ($message = array_pop($this->messages)) { + $count += $transport->send($message, $failedRecipients); + } + + return $count; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php new file mode 100644 index 00000000000..11aa5a9a06a --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php @@ -0,0 +1,291 @@ +createDependenciesFor('mime.message') + ); + + if (!isset($charset)) { + $charset = Swift_DependencyContainer::getInstance() + ->lookup('properties.charset'); + } + $this->setSubject($subject); + $this->setBody($body); + $this->setCharset($charset); + if ($contentType) { + $this->setContentType($contentType); + } + } + + /** + * Create a new Message. + * + * @param string $subject + * @param string $body + * @param string $contentType + * @param string $charset + * + * @return Swift_Message + */ + public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null) + { + return new self($subject, $body, $contentType, $charset); + } + + /** + * Add a MimePart to this Message. + * + * @param string|Swift_OutputByteStream $body + * @param string $contentType + * @param string $charset + * + * @return Swift_Mime_SimpleMessage + */ + public function addPart($body, $contentType = null, $charset = null) + { + return $this->attach(Swift_MimePart::newInstance( + $body, $contentType, $charset + )); + } + + /** + * Attach a new signature handler to the message. + * + * @param Swift_Signer $signer + * + * @return Swift_Message + */ + public function attachSigner(Swift_Signer $signer) + { + if ($signer instanceof Swift_Signers_HeaderSigner) { + $this->headerSigners[] = $signer; + } elseif ($signer instanceof Swift_Signers_BodySigner) { + $this->bodySigners[] = $signer; + } + + return $this; + } + + /** + * Attach a new signature handler to the message. + * + * @param Swift_Signer $signer + * + * @return Swift_Message + */ + public function detachSigner(Swift_Signer $signer) + { + if ($signer instanceof Swift_Signers_HeaderSigner) { + foreach ($this->headerSigners as $k => $headerSigner) { + if ($headerSigner === $signer) { + unset($this->headerSigners[$k]); + + return $this; + } + } + } elseif ($signer instanceof Swift_Signers_BodySigner) { + foreach ($this->bodySigners as $k => $bodySigner) { + if ($bodySigner === $signer) { + unset($this->bodySigners[$k]); + + return $this; + } + } + } + + return $this; + } + + /** + * Get this message as a complete string. + * + * @return string + */ + public function toString() + { + if (empty($this->headerSigners) && empty($this->bodySigners)) { + return parent::toString(); + } + + $this->saveMessage(); + + $this->doSign(); + + $string = parent::toString(); + + $this->restoreMessage(); + + return $string; + } + + /** + * Write this message to a {@link Swift_InputByteStream}. + * + * @param Swift_InputByteStream $is + */ + public function toByteStream(Swift_InputByteStream $is) + { + if (empty($this->headerSigners) && empty($this->bodySigners)) { + parent::toByteStream($is); + + return; + } + + $this->saveMessage(); + + $this->doSign(); + + parent::toByteStream($is); + + $this->restoreMessage(); + } + + public function __wakeup() + { + Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.message'); + } + + /** + * loops through signers and apply the signatures. + */ + protected function doSign() + { + foreach ($this->bodySigners as $signer) { + $altered = $signer->getAlteredHeaders(); + $this->saveHeaders($altered); + $signer->signMessage($this); + } + + foreach ($this->headerSigners as $signer) { + $altered = $signer->getAlteredHeaders(); + $this->saveHeaders($altered); + $signer->reset(); + + $signer->setHeaders($this->getHeaders()); + + $signer->startBody(); + $this->_bodyToByteStream($signer); + $signer->endBody(); + + $signer->addSignature($this->getHeaders()); + } + } + + /** + * save the message before any signature is applied. + */ + protected function saveMessage() + { + $this->savedMessage = array('headers' => array()); + $this->savedMessage['body'] = $this->getBody(); + $this->savedMessage['children'] = $this->getChildren(); + if (count($this->savedMessage['children']) > 0 && $this->getBody() != '') { + $this->setChildren(array_merge(array($this->_becomeMimePart()), $this->savedMessage['children'])); + $this->setBody(''); + } + } + + /** + * save the original headers. + * + * @param array $altered + */ + protected function saveHeaders(array $altered) + { + foreach ($altered as $head) { + $lc = strtolower($head); + + if (!isset($this->savedMessage['headers'][$lc])) { + $this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head); + } + } + } + + /** + * Remove or restore altered headers. + */ + protected function restoreHeaders() + { + foreach ($this->savedMessage['headers'] as $name => $savedValue) { + $headers = $this->getHeaders()->getAll($name); + + foreach ($headers as $key => $value) { + if (!isset($savedValue[$key])) { + $this->getHeaders()->remove($name, $key); + } + } + } + } + + /** + * Restore message body. + */ + protected function restoreMessage() + { + $this->setBody($this->savedMessage['body']); + $this->setChildren($this->savedMessage['children']); + + $this->restoreHeaders(); + $this->savedMessage = array(); + } + + /** + * Clone Message Signers. + * + * @see Swift_Mime_SimpleMimeEntity::__clone() + */ + public function __clone() + { + parent::__clone(); + foreach ($this->bodySigners as $key => $bodySigner) { + $this->bodySigners[$key] = clone($bodySigner); + } + + foreach ($this->headerSigners as $key => $headerSigner) { + $this->headerSigners[$key] = clone($headerSigner); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php new file mode 100644 index 00000000000..46a5e8da946 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php @@ -0,0 +1,149 @@ +setDisposition('attachment'); + $this->setContentType('application/octet-stream'); + $this->_mimeTypes = $mimeTypes; + } + + /** + * Get the nesting level used for this attachment. + * + * Always returns {@link LEVEL_MIXED}. + * + * @return int + */ + public function getNestingLevel() + { + return self::LEVEL_MIXED; + } + + /** + * Get the Content-Disposition of this attachment. + * + * By default attachments have a disposition of "attachment". + * + * @return string + */ + public function getDisposition() + { + return $this->_getHeaderFieldModel('Content-Disposition'); + } + + /** + * Set the Content-Disposition of this attachment. + * + * @param string $disposition + * + * @return Swift_Mime_Attachment + */ + public function setDisposition($disposition) + { + if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) { + $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition); + } + + return $this; + } + + /** + * Get the filename of this attachment when downloaded. + * + * @return string + */ + public function getFilename() + { + return $this->_getHeaderParameter('Content-Disposition', 'filename'); + } + + /** + * Set the filename of this attachment. + * + * @param string $filename + * + * @return Swift_Mime_Attachment + */ + public function setFilename($filename) + { + $this->_setHeaderParameter('Content-Disposition', 'filename', $filename); + $this->_setHeaderParameter('Content-Type', 'name', $filename); + + return $this; + } + + /** + * Get the file size of this attachment. + * + * @return int + */ + public function getSize() + { + return $this->_getHeaderParameter('Content-Disposition', 'size'); + } + + /** + * Set the file size of this attachment. + * + * @param int $size + * + * @return Swift_Mime_Attachment + */ + public function setSize($size) + { + $this->_setHeaderParameter('Content-Disposition', 'size', $size); + + return $this; + } + + /** + * Set the file that this attachment is for. + * + * @param Swift_FileStream $file + * @param string $contentType optional + * + * @return Swift_Mime_Attachment + */ + public function setFile(Swift_FileStream $file, $contentType = null) + { + $this->setFilename(basename($file->getPath())); + $this->setBody($file, $contentType); + if (!isset($contentType)) { + $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1)); + + if (array_key_exists($extension, $this->_mimeTypes)) { + $this->setContentType($this->_mimeTypes[$extension]); + } + } + + return $this; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/CharsetObserver.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/CharsetObserver.php new file mode 100644 index 00000000000..b49c3a873b1 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/CharsetObserver.php @@ -0,0 +1,24 @@ += $maxLineLength || 76 < $maxLineLength) { + $maxLineLength = 76; + } + + $remainder = 0; + $base64ReadBufferRemainderBytes = null; + + // To reduce memory usage, the output buffer is streamed to the input buffer like so: + // Output Stream => base64encode => wrap line length => Input Stream + // HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data) + // otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream. + // We use $base64ReadBufferRemainderBytes to carry over 1-2 "remainder" bytes from the each chunk from OutputStream and pre-pend those onto the + // chunk of bytes read in the next iteration. + // When the OutputStream is empty, we must flush any remainder bytes. + while (true) { + $readBytes = $os->read(8192); + $atEOF = ($readBytes === false); + + if ($atEOF) { + $streamTheseBytes = $base64ReadBufferRemainderBytes; + } else { + $streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes; + } + $base64ReadBufferRemainderBytes = null; + $bytesLength = strlen($streamTheseBytes); + + if ($bytesLength === 0) { // no data left to encode + break; + } + + // if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data + // and carry over remainder 1-2 bytes to the next loop iteration + if (!$atEOF) { + $excessBytes = $bytesLength % 3; + if ($excessBytes !== 0) { + $base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes); + $streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes); + } + } + + $encoded = base64_encode($streamTheseBytes); + $encodedTransformed = ''; + $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset; + + while ($thisMaxLineLength < strlen($encoded)) { + $encodedTransformed .= substr($encoded, 0, $thisMaxLineLength)."\r\n"; + $firstLineOffset = 0; + $encoded = substr($encoded, $thisMaxLineLength); + $thisMaxLineLength = $maxLineLength; + $remainder = 0; + } + + if (0 < $remainingLength = strlen($encoded)) { + $remainder += $remainingLength; + $encodedTransformed .= $encoded; + $encoded = null; + } + + $is->write($encodedTransformed); + + if ($atEOF) { + break; + } + } + } + + /** + * Get the name of this encoding scheme. + * Returns the string 'base64'. + * + * @return string + */ + public function getName() + { + return 'base64'; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php new file mode 100644 index 00000000000..710b5ac9edc --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php @@ -0,0 +1,123 @@ +charset = $charset ? $charset : 'utf-8'; + } + + /** + * Notify this observer that the entity's charset has changed. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->charset = $charset; + } + + /** + * Encode $in to $out. + * + * @param Swift_OutputByteStream $os to read from + * @param Swift_InputByteStream $is to write to + * @param int $firstLineOffset + * @param int $maxLineLength 0 indicates the default length for this encoding + * + * @throws RuntimeException + */ + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) + { + if ($this->charset !== 'utf-8') { + throw new RuntimeException( + sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset)); + } + + $string = ''; + + while (false !== $bytes = $os->read(8192)) { + $string .= $bytes; + } + + $is->write($this->encodeString($string)); + } + + /** + * Get the MIME name of this content encoding scheme. + * + * @return string + */ + public function getName() + { + return 'quoted-printable'; + } + + /** + * Encode a given string to produce an encoded string. + * + * @param string $string + * @param int $firstLineOffset if first line needs to be shorter + * @param int $maxLineLength 0 indicates the default length for this encoding + * + * @throws RuntimeException + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + if ($this->charset !== 'utf-8') { + throw new RuntimeException( + sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset)); + } + + return $this->_standardize(quoted_printable_encode($string)); + } + + /** + * Make sure CRLF is correct and HT/SPACE are in valid places. + * + * @param string $string + * + * @return string + */ + protected function _standardize($string) + { + // transform CR or LF to CRLF + $string = preg_replace('~=0D(?!=0A)|(?_name = $name; + $this->_canonical = $canonical; + } + + /** + * Encode a given string to produce an encoded string. + * + * @param string $string + * @param int $firstLineOffset ignored + * @param int $maxLineLength - 0 means no wrapping will occur + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + if ($this->_canonical) { + $string = $this->_canonicalize($string); + } + + return $this->_safeWordWrap($string, $maxLineLength, "\r\n"); + } + + /** + * Encode stream $in to stream $out. + * + * @param Swift_OutputByteStream $os + * @param Swift_InputByteStream $is + * @param int $firstLineOffset ignored + * @param int $maxLineLength optional, 0 means no wrapping will occur + */ + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) + { + $leftOver = ''; + while (false !== $bytes = $os->read(8192)) { + $toencode = $leftOver.$bytes; + if ($this->_canonical) { + $toencode = $this->_canonicalize($toencode); + } + $wrapped = $this->_safeWordWrap($toencode, $maxLineLength, "\r\n"); + $lastLinePos = strrpos($wrapped, "\r\n"); + $leftOver = substr($wrapped, $lastLinePos); + $wrapped = substr($wrapped, 0, $lastLinePos); + + $is->write($wrapped); + } + if (strlen($leftOver)) { + $is->write($leftOver); + } + } + + /** + * Get the name of this encoding scheme. + * + * @return string + */ + public function getName() + { + return $this->_name; + } + + /** + * Not used. + */ + public function charsetChanged($charset) + { + } + + /** + * A safer (but weaker) wordwrap for unicode. + * + * @param string $string + * @param int $length + * @param string $le + * + * @return string + */ + private function _safeWordwrap($string, $length = 75, $le = "\r\n") + { + if (0 >= $length) { + return $string; + } + + $originalLines = explode($le, $string); + + $lines = array(); + $lineCount = 0; + + foreach ($originalLines as $originalLine) { + $lines[] = ''; + $currentLine = &$lines[$lineCount++]; + + //$chunks = preg_split('/(?<=[\ \t,\.!\?\-&\+\/])/', $originalLine); + $chunks = preg_split('/(?<=\s)/', $originalLine); + + foreach ($chunks as $chunk) { + if (0 != strlen($currentLine) + && strlen($currentLine.$chunk) > $length) { + $lines[] = ''; + $currentLine = &$lines[$lineCount++]; + } + $currentLine .= $chunk; + } + } + + return implode("\r\n", $lines); + } + + /** + * Canonicalize string input (fix CRLF). + * + * @param string $string + * + * @return string + */ + private function _canonicalize($string) + { + return str_replace( + array("\r\n", "\r", "\n"), + array("\n", "\n", "\r\n"), + $string + ); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php new file mode 100644 index 00000000000..5cc907b8e7e --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php @@ -0,0 +1,134 @@ +_dotEscape = $dotEscape; + parent::__construct($charStream, $filter); + } + + public function __sleep() + { + return array('_charStream', '_filter', '_dotEscape'); + } + + protected function getSafeMapShareId() + { + return get_class($this).($this->_dotEscape ? '.dotEscape' : ''); + } + + protected function initSafeMap() + { + parent::initSafeMap(); + if ($this->_dotEscape) { + /* Encode . as =2e for buggy remote servers */ + unset($this->_safeMap[0x2e]); + } + } + + /** + * Encode stream $in to stream $out. + * + * QP encoded strings have a maximum line length of 76 characters. + * If the first line needs to be shorter, indicate the difference with + * $firstLineOffset. + * + * @param Swift_OutputByteStream $os output stream + * @param Swift_InputByteStream $is input stream + * @param int $firstLineOffset + * @param int $maxLineLength + */ + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) + { + if ($maxLineLength > 76 || $maxLineLength <= 0) { + $maxLineLength = 76; + } + + $thisLineLength = $maxLineLength - $firstLineOffset; + + $this->_charStream->flushContents(); + $this->_charStream->importByteStream($os); + + $currentLine = ''; + $prepend = ''; + $size = $lineLen = 0; + + while (false !== $bytes = $this->_nextSequence()) { + // If we're filtering the input + if (isset($this->_filter)) { + // If we can't filter because we need more bytes + while ($this->_filter->shouldBuffer($bytes)) { + // Then collect bytes into the buffer + if (false === $moreBytes = $this->_nextSequence(1)) { + break; + } + + foreach ($moreBytes as $b) { + $bytes[] = $b; + } + } + // And filter them + $bytes = $this->_filter->filter($bytes); + } + + $enc = $this->_encodeByteSequence($bytes, $size); + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { + $is->write($prepend.$this->_standardize($currentLine)); + $currentLine = ''; + $prepend = "=\r\n"; + $thisLineLength = $maxLineLength; + $lineLen = 0; + } + + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } + } + if (strlen($currentLine)) { + $is->write($prepend.$this->_standardize($currentLine)); + } + } + + /** + * Get the name of this encoding scheme. + * Returns the string 'quoted-printable'. + * + * @return string + */ + public function getName() + { + return 'quoted-printable'; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php new file mode 100644 index 00000000000..3214e1cf3fd --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php @@ -0,0 +1,98 @@ + + */ +class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_ContentEncoder +{ + /** + * @var Swift_Mime_ContentEncoder_QpContentEncoder + */ + private $safeEncoder; + + /** + * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder + */ + private $nativeEncoder; + + /** + * @var null|string + */ + private $charset; + + /** + * Constructor. + * + * @param Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder + * @param Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder + * @param string|null $charset + */ + public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset) + { + $this->safeEncoder = $safeEncoder; + $this->nativeEncoder = $nativeEncoder; + $this->charset = $charset; + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->safeEncoder = clone $this->safeEncoder; + $this->nativeEncoder = clone $this->nativeEncoder; + } + + /** + * {@inheritdoc} + */ + public function charsetChanged($charset) + { + $this->charset = $charset; + $this->safeEncoder->charsetChanged($charset); + } + + /** + * {@inheritdoc} + */ + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) + { + $this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'quoted-printable'; + } + + /** + * {@inheritdoc} + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + return $this->getEncoder()->encodeString($string, $firstLineOffset, $maxLineLength); + } + + /** + * @return Swift_Mime_ContentEncoder + */ + private function getEncoder() + { + return 'utf-8' === $this->charset ? $this->nativeEncoder : $this->safeEncoder; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php new file mode 100644 index 00000000000..0b8526e38c3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php @@ -0,0 +1,64 @@ + + */ +class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder +{ + /** + * Encode a given string to produce an encoded string. + * + * @param string $string + * @param int $firstLineOffset ignored + * @param int $maxLineLength ignored + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + return $string; + } + + /** + * Encode stream $in to stream $out. + * + * @param Swift_OutputByteStream $in + * @param Swift_InputByteStream $out + * @param int $firstLineOffset ignored + * @param int $maxLineLength ignored + */ + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0) + { + while (false !== ($bytes = $os->read(8192))) { + $is->write($bytes); + } + } + + /** + * Get the name of this encoding scheme. + * + * @return string + */ + public function getName() + { + return 'raw'; + } + + /** + * Not used. + */ + public function charsetChanged($charset) + { + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php new file mode 100644 index 00000000000..6af757124d3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php @@ -0,0 +1,45 @@ +setDisposition('inline'); + $this->setId($this->getId()); + } + + /** + * Get the nesting level of this EmbeddedFile. + * + * Returns {@see LEVEL_RELATED}. + * + * @return int + */ + public function getNestingLevel() + { + return self::LEVEL_RELATED; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php new file mode 100644 index 00000000000..cc44a6efb97 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php @@ -0,0 +1,24 @@ +init(); + } + + public function __wakeup() + { + $this->init(); + } + + protected function init() + { + if (count(self::$_specials) > 0) { + return; + } + + self::$_specials = array( + '(', ')', '<', '>', '[', ']', + ':', ';', '@', ',', '.', '"', + ); + + /*** Refer to RFC 2822 for ABNF grammar ***/ + + // All basic building blocks + self::$_grammar['NO-WS-CTL'] = '[\x01-\x08\x0B\x0C\x0E-\x19\x7F]'; + self::$_grammar['WSP'] = '[ \t]'; + self::$_grammar['CRLF'] = '(?:\r\n)'; + self::$_grammar['FWS'] = '(?:(?:'.self::$_grammar['WSP'].'*'. + self::$_grammar['CRLF'].')?'.self::$_grammar['WSP'].')'; + self::$_grammar['text'] = '[\x00-\x08\x0B\x0C\x0E-\x7F]'; + self::$_grammar['quoted-pair'] = '(?:\\\\'.self::$_grammar['text'].')'; + self::$_grammar['ctext'] = '(?:'.self::$_grammar['NO-WS-CTL']. + '|[\x21-\x27\x2A-\x5B\x5D-\x7E])'; + // Uses recursive PCRE (?1) -- could be a weak point?? + self::$_grammar['ccontent'] = '(?:'.self::$_grammar['ctext'].'|'. + self::$_grammar['quoted-pair'].'|(?1))'; + self::$_grammar['comment'] = '(\((?:'.self::$_grammar['FWS'].'|'. + self::$_grammar['ccontent'].')*'.self::$_grammar['FWS'].'?\))'; + self::$_grammar['CFWS'] = '(?:(?:'.self::$_grammar['FWS'].'?'. + self::$_grammar['comment'].')*(?:(?:'.self::$_grammar['FWS'].'?'. + self::$_grammar['comment'].')|'.self::$_grammar['FWS'].'))'; + self::$_grammar['qtext'] = '(?:'.self::$_grammar['NO-WS-CTL']. + '|[\x21\x23-\x5B\x5D-\x7E])'; + self::$_grammar['qcontent'] = '(?:'.self::$_grammar['qtext'].'|'. + self::$_grammar['quoted-pair'].')'; + self::$_grammar['quoted-string'] = '(?:'.self::$_grammar['CFWS'].'?"'. + '('.self::$_grammar['FWS'].'?'.self::$_grammar['qcontent'].')*'. + self::$_grammar['FWS'].'?"'.self::$_grammar['CFWS'].'?)'; + self::$_grammar['atext'] = '[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]'; + self::$_grammar['atom'] = '(?:'.self::$_grammar['CFWS'].'?'. + self::$_grammar['atext'].'+'.self::$_grammar['CFWS'].'?)'; + self::$_grammar['dot-atom-text'] = '(?:'.self::$_grammar['atext'].'+'. + '(\.'.self::$_grammar['atext'].'+)*)'; + self::$_grammar['dot-atom'] = '(?:'.self::$_grammar['CFWS'].'?'. + self::$_grammar['dot-atom-text'].'+'.self::$_grammar['CFWS'].'?)'; + self::$_grammar['word'] = '(?:'.self::$_grammar['atom'].'|'. + self::$_grammar['quoted-string'].')'; + self::$_grammar['phrase'] = '(?:'.self::$_grammar['word'].'+?)'; + self::$_grammar['no-fold-quote'] = '(?:"(?:'.self::$_grammar['qtext']. + '|'.self::$_grammar['quoted-pair'].')*")'; + self::$_grammar['dtext'] = '(?:'.self::$_grammar['NO-WS-CTL']. + '|[\x21-\x5A\x5E-\x7E])'; + self::$_grammar['no-fold-literal'] = '(?:\[(?:'.self::$_grammar['dtext']. + '|'.self::$_grammar['quoted-pair'].')*\])'; + + // Message IDs + self::$_grammar['id-left'] = '(?:'.self::$_grammar['dot-atom-text'].'|'. + self::$_grammar['no-fold-quote'].')'; + self::$_grammar['id-right'] = '(?:'.self::$_grammar['dot-atom-text'].'|'. + self::$_grammar['no-fold-literal'].')'; + + // Addresses, mailboxes and paths + self::$_grammar['local-part'] = '(?:'.self::$_grammar['dot-atom'].'|'. + self::$_grammar['quoted-string'].')'; + self::$_grammar['dcontent'] = '(?:'.self::$_grammar['dtext'].'|'. + self::$_grammar['quoted-pair'].')'; + self::$_grammar['domain-literal'] = '(?:'.self::$_grammar['CFWS'].'?\[('. + self::$_grammar['FWS'].'?'.self::$_grammar['dcontent'].')*?'. + self::$_grammar['FWS'].'?\]'.self::$_grammar['CFWS'].'?)'; + self::$_grammar['domain'] = '(?:'.self::$_grammar['dot-atom'].'|'. + self::$_grammar['domain-literal'].')'; + self::$_grammar['addr-spec'] = '(?:'.self::$_grammar['local-part'].'@'. + self::$_grammar['domain'].')'; + } + + /** + * Get the grammar defined for $name token. + * + * @param string $name exactly as written in the RFC + * + * @return string + */ + public function getDefinition($name) + { + if (array_key_exists($name, self::$_grammar)) { + return self::$_grammar[$name]; + } + + throw new Swift_RfcComplianceException( + "No such grammar '".$name."' defined." + ); + } + + /** + * Returns the tokens defined in RFC 2822 (and some related RFCs). + * + * @return array + */ + public function getGrammarDefinitions() + { + return self::$_grammar; + } + + /** + * Returns the current special characters used in the syntax which need to be escaped. + * + * @return array + */ + public function getSpecials() + { + return self::$_specials; + } + + /** + * Escape special characters in a string (convert to quoted-pairs). + * + * @param string $token + * @param string[] $include additional chars to escape + * @param string[] $exclude chars from escaping + * + * @return string + */ + public function escapeSpecials($token, $include = array(), $exclude = array()) + { + foreach (array_merge(array('\\'), array_diff(self::$_specials, $exclude), $include) as $char) { + $token = str_replace($char, '\\'.$char, $token); + } + + return $token; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php new file mode 100644 index 00000000000..a8ddd272165 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php @@ -0,0 +1,93 @@ +getName(), "\r\n"); + mb_internal_encoding($old); + + return $newstring; + } + + return parent::encodeString($string, $firstLineOffset, $maxLineLength); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php new file mode 100644 index 00000000000..510dd6637b3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php @@ -0,0 +1,65 @@ +_safeMap[$byte] = chr($byte); + } + } + + /** + * Get the name of this encoding scheme. + * + * Returns the string 'Q'. + * + * @return string + */ + public function getName() + { + return 'Q'; + } + + /** + * Takes an unencoded string and produces a QP encoded string from it. + * + * @param string $string string to encode + * @param int $firstLineOffset optional + * @param int $maxLineLength optional, 0 indicates the default of 76 chars + * + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) + { + return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"), + parent::encodeString($string, $firstLineOffset, $maxLineLength) + ); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php new file mode 100644 index 00000000000..c65f26d7213 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php @@ -0,0 +1,78 @@ +setGrammar($grammar); + } + + /** + * Set the character set used in this Header. + * + * @param string $charset + */ + public function setCharset($charset) + { + $this->clearCachedValueIf($charset != $this->_charset); + $this->_charset = $charset; + if (isset($this->_encoder)) { + $this->_encoder->charsetChanged($charset); + } + } + + /** + * Get the character set used in this Header. + * + * @return string + */ + public function getCharset() + { + return $this->_charset; + } + + /** + * Set the language used in this Header. + * + * For example, for US English, 'en-us'. + * This can be unspecified. + * + * @param string $lang + */ + public function setLanguage($lang) + { + $this->clearCachedValueIf($this->_lang != $lang); + $this->_lang = $lang; + } + + /** + * Get the language used in this Header. + * + * @return string + */ + public function getLanguage() + { + return $this->_lang; + } + + /** + * Set the encoder used for encoding the header. + * + * @param Swift_Mime_HeaderEncoder $encoder + */ + public function setEncoder(Swift_Mime_HeaderEncoder $encoder) + { + $this->_encoder = $encoder; + $this->setCachedValue(null); + } + + /** + * Get the encoder used for encoding this Header. + * + * @return Swift_Mime_HeaderEncoder + */ + public function getEncoder() + { + return $this->_encoder; + } + + /** + * Set the grammar used for the header. + * + * @param Swift_Mime_Grammar $grammar + */ + public function setGrammar(Swift_Mime_Grammar $grammar) + { + $this->_grammar = $grammar; + $this->setCachedValue(null); + } + + /** + * Get the grammar used for this Header. + * + * @return Swift_Mime_Grammar + */ + public function getGrammar() + { + return $this->_grammar; + } + + /** + * Get the name of this header (e.g. charset). + * + * @return string + */ + public function getFieldName() + { + return $this->_name; + } + + /** + * Set the maximum length of lines in the header (excluding EOL). + * + * @param int $lineLength + */ + public function setMaxLineLength($lineLength) + { + $this->clearCachedValueIf($this->_lineLength != $lineLength); + $this->_lineLength = $lineLength; + } + + /** + * Get the maximum permitted length of lines in this Header. + * + * @return int + */ + public function getMaxLineLength() + { + return $this->_lineLength; + } + + /** + * Get this Header rendered as a RFC 2822 compliant string. + * + * @throws Swift_RfcComplianceException + * + * @return string + */ + public function toString() + { + return $this->_tokensToString($this->toTokens()); + } + + /** + * Returns a string representation of this object. + * + * @return string + * + * @see toString() + */ + public function __toString() + { + return $this->toString(); + } + + // -- Points of extension + + /** + * Set the name of this Header field. + * + * @param string $name + */ + protected function setFieldName($name) + { + $this->_name = $name; + } + + /** + * Produces a compliant, formatted RFC 2822 'phrase' based on the string given. + * + * @param Swift_Mime_Header $header + * @param string $string as displayed + * @param string $charset of the text + * @param Swift_Mime_HeaderEncoder $encoder + * @param bool $shorten the first line to make remove for header name + * + * @return string + */ + protected function createPhrase(Swift_Mime_Header $header, $string, $charset, Swift_Mime_HeaderEncoder $encoder = null, $shorten = false) + { + // Treat token as exactly what was given + $phraseStr = $string; + // If it's not valid + if (!preg_match('/^'.$this->getGrammar()->getDefinition('phrase').'$/D', $phraseStr)) { + // .. but it is just ascii text, try escaping some characters + // and make it a quoted-string + if (preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $phraseStr)) { + $phraseStr = $this->getGrammar()->escapeSpecials( + $phraseStr, array('"'), $this->getGrammar()->getSpecials() + ); + $phraseStr = '"'.$phraseStr.'"'; + } else { + // ... otherwise it needs encoding + // Determine space remaining on line if first line + if ($shorten) { + $usedLength = strlen($header->getFieldName().': '); + } else { + $usedLength = 0; + } + $phraseStr = $this->encodeWords($header, $string, $usedLength); + } + } + + return $phraseStr; + } + + /** + * Encode needed word tokens within a string of input. + * + * @param Swift_Mime_Header $header + * @param string $input + * @param string $usedLength optional + * + * @return string + */ + protected function encodeWords(Swift_Mime_Header $header, $input, $usedLength = -1) + { + $value = ''; + + $tokens = $this->getEncodableWordTokens($input); + + foreach ($tokens as $token) { + // See RFC 2822, Sect 2.2 (really 2.2 ??) + if ($this->tokenNeedsEncoding($token)) { + // Don't encode starting WSP + $firstChar = substr($token, 0, 1); + switch ($firstChar) { + case ' ': + case "\t": + $value .= $firstChar; + $token = substr($token, 1); + } + + if (-1 == $usedLength) { + $usedLength = strlen($header->getFieldName().': ') + strlen($value); + } + $value .= $this->getTokenAsEncodedWord($token, $usedLength); + + $header->setMaxLineLength(76); // Forcefully override + } else { + $value .= $token; + } + } + + return $value; + } + + /** + * Test if a token needs to be encoded or not. + * + * @param string $token + * + * @return bool + */ + protected function tokenNeedsEncoding($token) + { + return preg_match('~[\x00-\x08\x10-\x19\x7F-\xFF\r\n]~', $token); + } + + /** + * Splits a string into tokens in blocks of words which can be encoded quickly. + * + * @param string $string + * + * @return string[] + */ + protected function getEncodableWordTokens($string) + { + $tokens = array(); + + $encodedToken = ''; + // Split at all whitespace boundaries + foreach (preg_split('~(?=[\t ])~', $string) as $token) { + if ($this->tokenNeedsEncoding($token)) { + $encodedToken .= $token; + } else { + if (strlen($encodedToken) > 0) { + $tokens[] = $encodedToken; + $encodedToken = ''; + } + $tokens[] = $token; + } + } + if (strlen($encodedToken)) { + $tokens[] = $encodedToken; + } + + return $tokens; + } + + /** + * Get a token as an encoded word for safe insertion into headers. + * + * @param string $token token to encode + * @param int $firstLineOffset optional + * + * @return string + */ + protected function getTokenAsEncodedWord($token, $firstLineOffset = 0) + { + // Adjust $firstLineOffset to account for space needed for syntax + $charsetDecl = $this->_charset; + if (isset($this->_lang)) { + $charsetDecl .= '*'.$this->_lang; + } + $encodingWrapperLength = strlen( + '=?'.$charsetDecl.'?'.$this->_encoder->getName().'??=' + ); + + if ($firstLineOffset >= 75) { + //Does this logic need to be here? + $firstLineOffset = 0; + } + + $encodedTextLines = explode("\r\n", + $this->_encoder->encodeString( + $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->_charset + ) + ); + + if (strtolower($this->_charset) !== 'iso-2022-jp') { + // special encoding for iso-2022-jp using mb_encode_mimeheader + foreach ($encodedTextLines as $lineNum => $line) { + $encodedTextLines[$lineNum] = '=?'.$charsetDecl. + '?'.$this->_encoder->getName(). + '?'.$line.'?='; + } + } + + return implode("\r\n ", $encodedTextLines); + } + + /** + * Generates tokens from the given string which include CRLF as individual tokens. + * + * @param string $token + * + * @return string[] + */ + protected function generateTokenLines($token) + { + return preg_split('~(\r\n)~', $token, -1, PREG_SPLIT_DELIM_CAPTURE); + } + + /** + * Set a value into the cache. + * + * @param string $value + */ + protected function setCachedValue($value) + { + $this->_cachedValue = $value; + } + + /** + * Get the value in the cache. + * + * @return string + */ + protected function getCachedValue() + { + return $this->_cachedValue; + } + + /** + * Clear the cached value if $condition is met. + * + * @param bool $condition + */ + protected function clearCachedValueIf($condition) + { + if ($condition) { + $this->setCachedValue(null); + } + } + + /** + * Generate a list of all tokens in the final header. + * + * @param string $string The string to tokenize + * + * @return array An array of tokens as strings + */ + protected function toTokens($string = null) + { + if (is_null($string)) { + $string = $this->getFieldBody(); + } + + $tokens = array(); + + // Generate atoms; split at all invisible boundaries followed by WSP + foreach (preg_split('~(?=[ \t])~', $string) as $token) { + $newTokens = $this->generateTokenLines($token); + foreach ($newTokens as $newToken) { + $tokens[] = $newToken; + } + } + + return $tokens; + } + + /** + * Takes an array of tokens which appear in the header and turns them into + * an RFC 2822 compliant string, adding FWSP where needed. + * + * @param string[] $tokens + * + * @return string + */ + private function _tokensToString(array $tokens) + { + $lineCount = 0; + $headerLines = array(); + $headerLines[] = $this->_name.': '; + $currentLine = &$headerLines[$lineCount++]; + + // Build all tokens back into compliant header + foreach ($tokens as $i => $token) { + // Line longer than specified maximum or token was just a new line + if (("\r\n" == $token) || + ($i > 0 && strlen($currentLine.$token) > $this->_lineLength) + && 0 < strlen($currentLine)) { + $headerLines[] = ''; + $currentLine = &$headerLines[$lineCount++]; + } + + // Append token to the line + if ("\r\n" != $token) { + $currentLine .= $token; + } + } + + // Implode with FWS (RFC 2822, 2.2.3) + return implode("\r\n", $headerLines)."\r\n"; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php new file mode 100644 index 00000000000..4fd6674296e --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php @@ -0,0 +1,125 @@ + + * + * + * + * @param string $name of Header + * @param Swift_Mime_Grammar $grammar + */ + public function __construct($name, Swift_Mime_Grammar $grammar) + { + $this->setFieldName($name); + parent::__construct($grammar); + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_DATE; + } + + /** + * Set the model for the field body. + * + * This method takes a UNIX timestamp. + * + * @param int $model + */ + public function setFieldBodyModel($model) + { + $this->setTimestamp($model); + } + + /** + * Get the model for the field body. + * + * This method returns a UNIX timestamp. + * + * @return mixed + */ + public function getFieldBodyModel() + { + return $this->getTimestamp(); + } + + /** + * Get the UNIX timestamp of the Date in this Header. + * + * @return int + */ + public function getTimestamp() + { + return $this->_timestamp; + } + + /** + * Set the UNIX timestamp of the Date in this Header. + * + * @param int $timestamp + */ + public function setTimestamp($timestamp) + { + if (!is_null($timestamp)) { + $timestamp = (int) $timestamp; + } + $this->clearCachedValueIf($this->_timestamp != $timestamp); + $this->_timestamp = $timestamp; + } + + /** + * Get the string value of the body in this Header. + * + * This is not necessarily RFC 2822 compliant since folding white space will + * not be added at this stage (see {@link toString()} for that). + * + * @see toString() + * + * @return string + */ + public function getFieldBody() + { + if (!$this->getCachedValue()) { + if (isset($this->_timestamp)) { + $this->setCachedValue(date('r', $this->_timestamp)); + } + } + + return $this->getCachedValue(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php new file mode 100644 index 00000000000..b114506b4a4 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php @@ -0,0 +1,180 @@ +setFieldName($name); + parent::__construct($grammar); + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_ID; + } + + /** + * Set the model for the field body. + * + * This method takes a string ID, or an array of IDs. + * + * @param mixed $model + * + * @throws Swift_RfcComplianceException + */ + public function setFieldBodyModel($model) + { + $this->setId($model); + } + + /** + * Get the model for the field body. + * + * This method returns an array of IDs + * + * @return array + */ + public function getFieldBodyModel() + { + return $this->getIds(); + } + + /** + * Set the ID used in the value of this header. + * + * @param string|array $id + * + * @throws Swift_RfcComplianceException + */ + public function setId($id) + { + $this->setIds(is_array($id) ? $id : array($id)); + } + + /** + * Get the ID used in the value of this Header. + * + * If multiple IDs are set only the first is returned. + * + * @return string + */ + public function getId() + { + if (count($this->_ids) > 0) { + return $this->_ids[0]; + } + } + + /** + * Set a collection of IDs to use in the value of this Header. + * + * @param string[] $ids + * + * @throws Swift_RfcComplianceException + */ + public function setIds(array $ids) + { + $actualIds = array(); + + foreach ($ids as $id) { + $this->_assertValidId($id); + $actualIds[] = $id; + } + + $this->clearCachedValueIf($this->_ids != $actualIds); + $this->_ids = $actualIds; + } + + /** + * Get the list of IDs used in this Header. + * + * @return string[] + */ + public function getIds() + { + return $this->_ids; + } + + /** + * Get the string value of the body in this Header. + * + * This is not necessarily RFC 2822 compliant since folding white space will + * not be added at this stage (see {@see toString()} for that). + * + * @see toString() + * + * @throws Swift_RfcComplianceException + * + * @return string + */ + public function getFieldBody() + { + if (!$this->getCachedValue()) { + $angleAddrs = array(); + + foreach ($this->_ids as $id) { + $angleAddrs[] = '<'.$id.'>'; + } + + $this->setCachedValue(implode(' ', $angleAddrs)); + } + + return $this->getCachedValue(); + } + + /** + * Throws an Exception if the id passed does not comply with RFC 2822. + * + * @param string $id + * + * @throws Swift_RfcComplianceException + */ + private function _assertValidId($id) + { + if (!preg_match( + '/^'.$this->getGrammar()->getDefinition('id-left').'@'. + $this->getGrammar()->getDefinition('id-right').'$/D', + $id + )) { + throw new Swift_RfcComplianceException( + 'Invalid ID given <'.$id.'>' + ); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php new file mode 100644 index 00000000000..798e7f42ace --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php @@ -0,0 +1,354 @@ +setFieldName($name); + $this->setEncoder($encoder); + parent::__construct($grammar); + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_MAILBOX; + } + + /** + * Set the model for the field body. + * + * This method takes a string, or an array of addresses. + * + * @param mixed $model + * + * @throws Swift_RfcComplianceException + */ + public function setFieldBodyModel($model) + { + $this->setNameAddresses($model); + } + + /** + * Get the model for the field body. + * + * This method returns an associative array like {@link getNameAddresses()} + * + * @throws Swift_RfcComplianceException + * + * @return array + */ + public function getFieldBodyModel() + { + return $this->getNameAddresses(); + } + + /** + * Set a list of mailboxes to be shown in this Header. + * + * The mailboxes can be a simple array of addresses, or an array of + * key=>value pairs where (email => personalName). + * Example: + * + * setNameAddresses(array( + * 'chris@swiftmailer.org' => 'Chris Corbyn', + * 'mark@swiftmailer.org' //No associated personal name + * )); + * ?> + * + * + * @see __construct() + * @see setAddresses() + * @see setValue() + * + * @param string|string[] $mailboxes + * + * @throws Swift_RfcComplianceException + */ + public function setNameAddresses($mailboxes) + { + $this->_mailboxes = $this->normalizeMailboxes((array) $mailboxes); + $this->setCachedValue(null); //Clear any cached value + } + + /** + * Get the full mailbox list of this Header as an array of valid RFC 2822 strings. + * + * Example: + * + * 'Chris Corbyn', + * 'mark@swiftmailer.org' => 'Mark Corbyn') + * ); + * print_r($header->getNameAddressStrings()); + * // array ( + * // 0 => Chris Corbyn , + * // 1 => Mark Corbyn + * // ) + * ?> + * + * + * @see getNameAddresses() + * @see toString() + * + * @throws Swift_RfcComplianceException + * + * @return string[] + */ + public function getNameAddressStrings() + { + return $this->_createNameAddressStrings($this->getNameAddresses()); + } + + /** + * Get all mailboxes in this Header as key=>value pairs. + * + * The key is the address and the value is the name (or null if none set). + * Example: + * + * 'Chris Corbyn', + * 'mark@swiftmailer.org' => 'Mark Corbyn') + * ); + * print_r($header->getNameAddresses()); + * // array ( + * // chris@swiftmailer.org => Chris Corbyn, + * // mark@swiftmailer.org => Mark Corbyn + * // ) + * ?> + * + * + * @see getAddresses() + * @see getNameAddressStrings() + * + * @return string[] + */ + public function getNameAddresses() + { + return $this->_mailboxes; + } + + /** + * Makes this Header represent a list of plain email addresses with no names. + * + * Example: + * + * setAddresses( + * array('one@domain.tld', 'two@domain.tld', 'three@domain.tld') + * ); + * ?> + * + * + * @see setNameAddresses() + * @see setValue() + * + * @param string[] $addresses + * + * @throws Swift_RfcComplianceException + */ + public function setAddresses($addresses) + { + $this->setNameAddresses(array_values((array) $addresses)); + } + + /** + * Get all email addresses in this Header. + * + * @see getNameAddresses() + * + * @return string[] + */ + public function getAddresses() + { + return array_keys($this->_mailboxes); + } + + /** + * Remove one or more addresses from this Header. + * + * @param string|string[] $addresses + */ + public function removeAddresses($addresses) + { + $this->setCachedValue(null); + foreach ((array) $addresses as $address) { + unset($this->_mailboxes[$address]); + } + } + + /** + * Get the string value of the body in this Header. + * + * This is not necessarily RFC 2822 compliant since folding white space will + * not be added at this stage (see {@link toString()} for that). + * + * @see toString() + * + * @throws Swift_RfcComplianceException + * + * @return string + */ + public function getFieldBody() + { + // Compute the string value of the header only if needed + if (is_null($this->getCachedValue())) { + $this->setCachedValue($this->createMailboxListString($this->_mailboxes)); + } + + return $this->getCachedValue(); + } + + // -- Points of extension + + /** + * Normalizes a user-input list of mailboxes into consistent key=>value pairs. + * + * @param string[] $mailboxes + * + * @return string[] + */ + protected function normalizeMailboxes(array $mailboxes) + { + $actualMailboxes = array(); + + foreach ($mailboxes as $key => $value) { + if (is_string($key)) { + //key is email addr + $address = $key; + $name = $value; + } else { + $address = $value; + $name = null; + } + $this->_assertValidAddress($address); + $actualMailboxes[$address] = $name; + } + + return $actualMailboxes; + } + + /** + * Produces a compliant, formatted display-name based on the string given. + * + * @param string $displayName as displayed + * @param bool $shorten the first line to make remove for header name + * + * @return string + */ + protected function createDisplayNameString($displayName, $shorten = false) + { + return $this->createPhrase($this, $displayName, + $this->getCharset(), $this->getEncoder(), $shorten + ); + } + + /** + * Creates a string form of all the mailboxes in the passed array. + * + * @param string[] $mailboxes + * + * @throws Swift_RfcComplianceException + * + * @return string + */ + protected function createMailboxListString(array $mailboxes) + { + return implode(', ', $this->_createNameAddressStrings($mailboxes)); + } + + /** + * Redefine the encoding requirements for mailboxes. + * + * Commas and semicolons are used to separate + * multiple addresses, and should therefore be encoded + * + * @param string $token + * + * @return bool + */ + protected function tokenNeedsEncoding($token) + { + return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token); + } + + /** + * Return an array of strings conforming the the name-addr spec of RFC 2822. + * + * @param string[] $mailboxes + * + * @return string[] + */ + private function _createNameAddressStrings(array $mailboxes) + { + $strings = array(); + + foreach ($mailboxes as $email => $name) { + $mailboxStr = $email; + if (!is_null($name)) { + $nameStr = $this->createDisplayNameString($name, empty($strings)); + $mailboxStr = $nameStr.' <'.$mailboxStr.'>'; + } + $strings[] = $mailboxStr; + } + + return $strings; + } + + /** + * Throws an Exception if the address passed does not comply with RFC 2822. + * + * @param string $address + * + * @throws Swift_RfcComplianceException If invalid. + */ + private function _assertValidAddress($address) + { + if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D', + $address)) { + throw new Swift_RfcComplianceException( + 'Address in mailbox given ['.$address. + '] does not comply with RFC 2822, 3.6.2.' + ); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php new file mode 100644 index 00000000000..b52b964b773 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php @@ -0,0 +1,137 @@ + + */ +class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header +{ + /** + * The value of this Header. + * + * @var string + */ + private $_value; + + /** + * The name of this Header. + * + * @var string + */ + private $_fieldName; + + /** + * Creates a new SimpleHeader with $name. + * + * @param string $name + * @param Swift_Mime_HeaderEncoder $encoder + * @param Swift_Mime_Grammar $grammar + */ + public function __construct($name) + { + $this->_fieldName = $name; + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_TEXT; + } + + /** + * Set the model for the field body. + * + * This method takes a string for the field value. + * + * @param string $model + */ + public function setFieldBodyModel($model) + { + $this->setValue($model); + } + + /** + * Get the model for the field body. + * + * This method returns a string. + * + * @return string + */ + public function getFieldBodyModel() + { + return $this->getValue(); + } + + /** + * Get the (unencoded) value of this header. + * + * @return string + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the (unencoded) value of this header. + * + * @param string $value + */ + public function setValue($value) + { + $this->_value = $value; + } + + /** + * Get the value of this header prepared for rendering. + * + * @return string + */ + public function getFieldBody() + { + return $this->_value; + } + + /** + * Get this Header rendered as a RFC 2822 compliant string. + * + * @return string + */ + public function toString() + { + return $this->_fieldName.': '.$this->_value; + } + + /** + * Set the Header FieldName. + * + * @see Swift_Mime_Header::getFieldName() + */ + public function getFieldName() + { + return $this->_fieldName; + } + + /** + * Ignored. + */ + public function setCharset($charset) + { + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php new file mode 100644 index 00000000000..c506daec146 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php @@ -0,0 +1,258 @@ +_paramEncoder = $paramEncoder; + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_PARAMETERIZED; + } + + /** + * Set the character set used in this Header. + * + * @param string $charset + */ + public function setCharset($charset) + { + parent::setCharset($charset); + if (isset($this->_paramEncoder)) { + $this->_paramEncoder->charsetChanged($charset); + } + } + + /** + * Set the value of $parameter. + * + * @param string $parameter + * @param string $value + */ + public function setParameter($parameter, $value) + { + $this->setParameters(array_merge($this->getParameters(), array($parameter => $value))); + } + + /** + * Get the value of $parameter. + * + * @param string $parameter + * + * @return string + */ + public function getParameter($parameter) + { + $params = $this->getParameters(); + + return array_key_exists($parameter, $params) ? $params[$parameter] : null; + } + + /** + * Set an associative array of parameter names mapped to values. + * + * @param string[] $parameters + */ + public function setParameters(array $parameters) + { + $this->clearCachedValueIf($this->_params != $parameters); + $this->_params = $parameters; + } + + /** + * Returns an associative array of parameter names mapped to values. + * + * @return string[] + */ + public function getParameters() + { + return $this->_params; + } + + /** + * Get the value of this header prepared for rendering. + * + * @return string + */ + public function getFieldBody() //TODO: Check caching here + { + $body = parent::getFieldBody(); + foreach ($this->_params as $name => $value) { + if (!is_null($value)) { + // Add the parameter + $body .= '; '.$this->_createParameter($name, $value); + } + } + + return $body; + } + + /** + * Generate a list of all tokens in the final header. + * + * This doesn't need to be overridden in theory, but it is for implementation + * reasons to prevent potential breakage of attributes. + * + * @param string $string The string to tokenize + * + * @return array An array of tokens as strings + */ + protected function toTokens($string = null) + { + $tokens = parent::toTokens(parent::getFieldBody()); + + // Try creating any parameters + foreach ($this->_params as $name => $value) { + if (!is_null($value)) { + // Add the semi-colon separator + $tokens[count($tokens) - 1] .= ';'; + $tokens = array_merge($tokens, $this->generateTokenLines( + ' '.$this->_createParameter($name, $value) + )); + } + } + + return $tokens; + } + + /** + * Render a RFC 2047 compliant header parameter from the $name and $value. + * + * @param string $name + * @param string $value + * + * @return string + */ + private function _createParameter($name, $value) + { + $origValue = $value; + + $encoded = false; + // Allow room for parameter name, indices, "=" and DQUOTEs + $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1; + $firstLineOffset = 0; + + // If it's not already a valid parameter value... + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { + // TODO: text, or something else?? + // ... and it's not ascii + if (!preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $value)) { + $encoded = true; + // Allow space for the indices, charset and language + $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1; + $firstLineOffset = strlen( + $this->getCharset()."'".$this->getLanguage()."'" + ); + } + } + + // Encode if we need to + if ($encoded || strlen($value) > $maxValueLength) { + if (isset($this->_paramEncoder)) { + $value = $this->_paramEncoder->encodeString( + $origValue, $firstLineOffset, $maxValueLength, $this->getCharset() + ); + } else { + // We have to go against RFC 2183/2231 in some areas for interoperability + $value = $this->getTokenAsEncodedWord($origValue); + $encoded = false; + } + } + + $valueLines = isset($this->_paramEncoder) ? explode("\r\n", $value) : array($value); + + // Need to add indices + if (count($valueLines) > 1) { + $paramLines = array(); + foreach ($valueLines as $i => $line) { + $paramLines[] = $name.'*'.$i. + $this->_getEndOfParameterValue($line, true, $i == 0); + } + + return implode(";\r\n ", $paramLines); + } else { + return $name.$this->_getEndOfParameterValue( + $valueLines[0], $encoded, true + ); + } + } + + /** + * Returns the parameter value from the "=" and beyond. + * + * @param string $value to append + * @param bool $encoded + * @param bool $firstLine + * + * @return string + */ + private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) + { + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { + $value = '"'.$value.'"'; + } + $prepend = '='; + if ($encoded) { + $prepend = '*='; + if ($firstLine) { + $prepend = '*='.$this->getCharset()."'".$this->getLanguage(). + "'"; + } + } + + return $prepend.$value; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php new file mode 100644 index 00000000000..2fffc7b4aac --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php @@ -0,0 +1,143 @@ +setFieldName($name); + parent::__construct($grammar); + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_PATH; + } + + /** + * Set the model for the field body. + * This method takes a string for an address. + * + * @param string $model + * + * @throws Swift_RfcComplianceException + */ + public function setFieldBodyModel($model) + { + $this->setAddress($model); + } + + /** + * Get the model for the field body. + * This method returns a string email address. + * + * @return mixed + */ + public function getFieldBodyModel() + { + return $this->getAddress(); + } + + /** + * Set the Address which should appear in this Header. + * + * @param string $address + * + * @throws Swift_RfcComplianceException + */ + public function setAddress($address) + { + if (is_null($address)) { + $this->_address = null; + } elseif ('' == $address) { + $this->_address = ''; + } else { + $this->_assertValidAddress($address); + $this->_address = $address; + } + $this->setCachedValue(null); + } + + /** + * Get the address which is used in this Header (if any). + * + * Null is returned if no address is set. + * + * @return string + */ + public function getAddress() + { + return $this->_address; + } + + /** + * Get the string value of the body in this Header. + * + * This is not necessarily RFC 2822 compliant since folding white space will + * not be added at this stage (see {@link toString()} for that). + * + * @see toString() + * + * @return string + */ + public function getFieldBody() + { + if (!$this->getCachedValue()) { + if (isset($this->_address)) { + $this->setCachedValue('<'.$this->_address.'>'); + } + } + + return $this->getCachedValue(); + } + + /** + * Throws an Exception if the address passed does not comply with RFC 2822. + * + * @param string $address + * + * @throws Swift_RfcComplianceException If address is invalid + */ + private function _assertValidAddress($address) + { + if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D', + $address)) { + throw new Swift_RfcComplianceException( + 'Address set in PathHeader does not comply with addr-spec of RFC 2822.' + ); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php new file mode 100644 index 00000000000..86177f14a1f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php @@ -0,0 +1,112 @@ +setFieldName($name); + $this->setEncoder($encoder); + parent::__construct($grammar); + } + + /** + * Get the type of Header that this instance represents. + * + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + * + * @return int + */ + public function getFieldType() + { + return self::TYPE_TEXT; + } + + /** + * Set the model for the field body. + * + * This method takes a string for the field value. + * + * @param string $model + */ + public function setFieldBodyModel($model) + { + $this->setValue($model); + } + + /** + * Get the model for the field body. + * + * This method returns a string. + * + * @return string + */ + public function getFieldBodyModel() + { + return $this->getValue(); + } + + /** + * Get the (unencoded) value of this header. + * + * @return string + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the (unencoded) value of this header. + * + * @param string $value + */ + public function setValue($value) + { + $this->clearCachedValueIf($this->_value != $value); + $this->_value = $value; + } + + /** + * Get the value of this header prepared for rendering. + * + * @return string + */ + public function getFieldBody() + { + if (!$this->getCachedValue()) { + $this->setCachedValue( + $this->encodeWords($this, $this->_value) + ); + } + + return $this->getCachedValue(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Message.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Message.php new file mode 100644 index 00000000000..9b36d216271 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Message.php @@ -0,0 +1,223 @@ + 'Real Name'). + * + * If the second parameter is provided and the first is a string, then $name + * is associated with the address. + * + * @param mixed $address + * @param string $name optional + */ + public function setSender($address, $name = null); + + /** + * Get the sender address for this message. + * + * This has a higher significance than the From address. + * + * @return string + */ + public function getSender(); + + /** + * Set the From address of this message. + * + * It is permissible for multiple From addresses to be set using an array. + * + * If multiple From addresses are used, you SHOULD set the Sender address and + * according to RFC 2822, MUST set the sender address. + * + * An array can be used if display names are to be provided: i.e. + * array('email@address.com' => 'Real Name'). + * + * If the second parameter is provided and the first is a string, then $name + * is associated with the address. + * + * @param mixed $addresses + * @param string $name optional + */ + public function setFrom($addresses, $name = null); + + /** + * Get the From address(es) of this message. + * + * This method always returns an associative array where the keys are the + * addresses. + * + * @return string[] + */ + public function getFrom(); + + /** + * Set the Reply-To address(es). + * + * Any replies from the receiver will be sent to this address. + * + * It is permissible for multiple reply-to addresses to be set using an array. + * + * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. + * + * If the second parameter is provided and the first is a string, then $name + * is associated with the address. + * + * @param mixed $addresses + * @param string $name optional + */ + public function setReplyTo($addresses, $name = null); + + /** + * Get the Reply-To addresses for this message. + * + * This method always returns an associative array where the keys provide the + * email addresses. + * + * @return string[] + */ + public function getReplyTo(); + + /** + * Set the To address(es). + * + * Recipients set in this field will receive a copy of this message. + * + * This method has the same synopsis as {@link setFrom()} and {@link setCc()}. + * + * If the second parameter is provided and the first is a string, then $name + * is associated with the address. + * + * @param mixed $addresses + * @param string $name optional + */ + public function setTo($addresses, $name = null); + + /** + * Get the To addresses for this message. + * + * This method always returns an associative array, whereby the keys provide + * the actual email addresses. + * + * @return string[] + */ + public function getTo(); + + /** + * Set the Cc address(es). + * + * Recipients set in this field will receive a 'carbon-copy' of this message. + * + * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. + * + * @param mixed $addresses + * @param string $name optional + */ + public function setCc($addresses, $name = null); + + /** + * Get the Cc addresses for this message. + * + * This method always returns an associative array, whereby the keys provide + * the actual email addresses. + * + * @return string[] + */ + public function getCc(); + + /** + * Set the Bcc address(es). + * + * Recipients set in this field will receive a 'blind-carbon-copy' of this + * message. + * + * In other words, they will get the message, but any other recipients of the + * message will have no such knowledge of their receipt of it. + * + * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. + * + * @param mixed $addresses + * @param string $name optional + */ + public function setBcc($addresses, $name = null); + + /** + * Get the Bcc addresses for this message. + * + * This method always returns an associative array, whereby the keys provide + * the actual email addresses. + * + * @return string[] + */ + public function getBcc(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php new file mode 100644 index 00000000000..30f460cdcdb --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php @@ -0,0 +1,117 @@ +setContentType('text/plain'); + if (!is_null($charset)) { + $this->setCharset($charset); + } + } + + /** + * Set the body of this entity, either as a string, or as an instance of + * {@link Swift_OutputByteStream}. + * + * @param mixed $body + * @param string $contentType optional + * @param string $charset optional + * + * @return Swift_Mime_MimePart + */ + public function setBody($body, $contentType = null, $charset = null) + { + if (isset($charset)) { + $this->setCharset($charset); + } + $body = $this->_convertString($body); + + parent::setBody($body, $contentType); + + return $this; + } + + /** + * Get the character set of this entity. + * + * @return string + */ + public function getCharset() + { + return $this->_getHeaderParameter('Content-Type', 'charset'); + } + + /** + * Set the character set of this entity. + * + * @param string $charset + * + * @return Swift_Mime_MimePart + */ + public function setCharset($charset) + { + $this->_setHeaderParameter('Content-Type', 'charset', $charset); + if ($charset !== $this->_userCharset) { + $this->_clearCache(); + } + $this->_userCharset = $charset; + parent::charsetChanged($charset); + + return $this; + } + + /** + * Get the format of this entity (i.e. flowed or fixed). + * + * @return string + */ + public function getFormat() + { + return $this->_getHeaderParameter('Content-Type', 'format'); + } + + /** + * Set the format of this entity (flowed or fixed). + * + * @param string $format + * + * @return Swift_Mime_MimePart + */ + public function setFormat($format) + { + $this->_setHeaderParameter('Content-Type', 'format', $format); + $this->_userFormat = $format; + + return $this; + } + + /** + * Test if delsp is being used for this entity. + * + * @return bool + */ + public function getDelSp() + { + return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false; + } + + /** + * Turn delsp on or off for this entity. + * + * @param bool $delsp + * + * @return Swift_Mime_MimePart + */ + public function setDelSp($delsp = true) + { + $this->_setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null); + $this->_userDelSp = $delsp; + + return $this; + } + + /** + * Get the nesting level of this entity. + * + * @see LEVEL_TOP, LEVEL_ALTERNATIVE, LEVEL_MIXED, LEVEL_RELATED + * + * @return int + */ + public function getNestingLevel() + { + return $this->_nestingLevel; + } + + /** + * Receive notification that the charset has changed on this document, or a + * parent document. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->setCharset($charset); + } + + /** Fix the content-type and encoding of this entity */ + protected function _fixHeaders() + { + parent::_fixHeaders(); + if (count($this->getChildren())) { + $this->_setHeaderParameter('Content-Type', 'charset', null); + $this->_setHeaderParameter('Content-Type', 'format', null); + $this->_setHeaderParameter('Content-Type', 'delsp', null); + } else { + $this->setCharset($this->_userCharset); + $this->setFormat($this->_userFormat); + $this->setDelSp($this->_userDelSp); + } + } + + /** Set the nesting level of this entity */ + protected function _setNestingLevel($level) + { + $this->_nestingLevel = $level; + } + + /** Encode charset when charset is not utf-8 */ + protected function _convertString($string) + { + $charset = strtolower($this->getCharset()); + if (!in_array($charset, array('utf-8', 'iso-8859-1', ''))) { + // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. + if (function_exists('mb_convert_encoding')) { + $string = mb_convert_encoding($string, $charset, 'utf-8'); + } elseif (function_exists('iconv')) { + $string = iconv('utf-8//TRANSLIT//IGNORE', $charset, $string); + } else { + throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your charset or install the mbstring or iconv extension).'); + } + + return $string; + } + + return $string; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php new file mode 100644 index 00000000000..e15c6ef95b1 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php @@ -0,0 +1,34 @@ +_encoder = $encoder; + $this->_paramEncoder = $paramEncoder; + $this->_grammar = $grammar; + $this->_charset = $charset; + } + + /** + * Create a new Mailbox Header with a list of $addresses. + * + * @param string $name + * @param array|string|null $addresses + * + * @return Swift_Mime_Header + */ + public function createMailboxHeader($name, $addresses = null) + { + $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar); + if (isset($addresses)) { + $header->setFieldBodyModel($addresses); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Create a new Date header using $timestamp (UNIX time). + * + * @param string $name + * @param int|null $timestamp + * + * @return Swift_Mime_Header + */ + public function createDateHeader($name, $timestamp = null) + { + $header = new Swift_Mime_Headers_DateHeader($name, $this->_grammar); + if (isset($timestamp)) { + $header->setFieldBodyModel($timestamp); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Create a new basic text header with $name and $value. + * + * @param string $name + * @param string $value + * + * @return Swift_Mime_Header + */ + public function createTextHeader($name, $value = null) + { + $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder, $this->_grammar); + if (isset($value)) { + $header->setFieldBodyModel($value); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Create a new ParameterizedHeader with $name, $value and $params. + * + * @param string $name + * @param string $value + * @param array $params + * + * @return Swift_Mime_ParameterizedHeader + */ + public function createParameterizedHeader($name, $value = null, + $params = array()) + { + $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar); + if (isset($value)) { + $header->setFieldBodyModel($value); + } + foreach ($params as $k => $v) { + $header->setParameter($k, $v); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Create a new ID header for Message-ID or Content-ID. + * + * @param string $name + * @param string|array $ids + * + * @return Swift_Mime_Header + */ + public function createIdHeader($name, $ids = null) + { + $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->_grammar); + if (isset($ids)) { + $header->setFieldBodyModel($ids); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Create a new Path header with an address (path) in it. + * + * @param string $name + * @param string $path + * + * @return Swift_Mime_Header + */ + public function createPathHeader($name, $path = null) + { + $header = new Swift_Mime_Headers_PathHeader($name, $this->_grammar); + if (isset($path)) { + $header->setFieldBodyModel($path); + } + $this->_setHeaderCharset($header); + + return $header; + } + + /** + * Notify this observer that the entity's charset has changed. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->_charset = $charset; + $this->_encoder->charsetChanged($charset); + $this->_paramEncoder->charsetChanged($charset); + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->_encoder = clone $this->_encoder; + $this->_paramEncoder = clone $this->_paramEncoder; + } + + /** Apply the charset to the Header */ + private function _setHeaderCharset(Swift_Mime_Header $header) + { + if (isset($this->_charset)) { + $header->setCharset($this->_charset); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php new file mode 100644 index 00000000000..cf8bf14a750 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php @@ -0,0 +1,397 @@ +_factory = $factory; + if (isset($charset)) { + $this->setCharset($charset); + } + } + + /** + * Set the charset used by these headers. + * + * @param string $charset + */ + public function setCharset($charset) + { + $this->_charset = $charset; + $this->_factory->charsetChanged($charset); + $this->_notifyHeadersOfCharset($charset); + } + + /** + * Add a new Mailbox Header with a list of $addresses. + * + * @param string $name + * @param array|string $addresses + */ + public function addMailboxHeader($name, $addresses = null) + { + $this->_storeHeader($name, + $this->_factory->createMailboxHeader($name, $addresses)); + } + + /** + * Add a new Date header using $timestamp (UNIX time). + * + * @param string $name + * @param int $timestamp + */ + public function addDateHeader($name, $timestamp = null) + { + $this->_storeHeader($name, + $this->_factory->createDateHeader($name, $timestamp)); + } + + /** + * Add a new basic text header with $name and $value. + * + * @param string $name + * @param string $value + */ + public function addTextHeader($name, $value = null) + { + $this->_storeHeader($name, + $this->_factory->createTextHeader($name, $value)); + } + + /** + * Add a new ParameterizedHeader with $name, $value and $params. + * + * @param string $name + * @param string $value + * @param array $params + */ + public function addParameterizedHeader($name, $value = null, $params = array()) + { + $this->_storeHeader($name, $this->_factory->createParameterizedHeader($name, $value, $params)); + } + + /** + * Add a new ID header for Message-ID or Content-ID. + * + * @param string $name + * @param string|array $ids + */ + public function addIdHeader($name, $ids = null) + { + $this->_storeHeader($name, $this->_factory->createIdHeader($name, $ids)); + } + + /** + * Add a new Path header with an address (path) in it. + * + * @param string $name + * @param string $path + */ + public function addPathHeader($name, $path = null) + { + $this->_storeHeader($name, $this->_factory->createPathHeader($name, $path)); + } + + /** + * Returns true if at least one header with the given $name exists. + * + * If multiple headers match, the actual one may be specified by $index. + * + * @param string $name + * @param int $index + * + * @return bool + */ + public function has($name, $index = 0) + { + $lowerName = strtolower($name); + + return array_key_exists($lowerName, $this->_headers) && array_key_exists($index, $this->_headers[$lowerName]); + } + + /** + * Set a header in the HeaderSet. + * + * The header may be a previously fetched header via {@link get()} or it may + * be one that has been created separately. + * + * If $index is specified, the header will be inserted into the set at this + * offset. + * + * @param Swift_Mime_Header $header + * @param int $index + */ + public function set(Swift_Mime_Header $header, $index = 0) + { + $this->_storeHeader($header->getFieldName(), $header, $index); + } + + /** + * Get the header with the given $name. + * + * If multiple headers match, the actual one may be specified by $index. + * Returns NULL if none present. + * + * @param string $name + * @param int $index + * + * @return Swift_Mime_Header + */ + public function get($name, $index = 0) + { + if ($this->has($name, $index)) { + $lowerName = strtolower($name); + + return $this->_headers[$lowerName][$index]; + } + } + + /** + * Get all headers with the given $name. + * + * @param string $name + * + * @return array + */ + public function getAll($name = null) + { + if (!isset($name)) { + $headers = array(); + foreach ($this->_headers as $collection) { + $headers = array_merge($headers, $collection); + } + + return $headers; + } + + $lowerName = strtolower($name); + if (!array_key_exists($lowerName, $this->_headers)) { + return array(); + } + + return $this->_headers[$lowerName]; + } + + /** + * Return the name of all Headers. + * + * @return array + */ + public function listAll() + { + $headers = $this->_headers; + if ($this->_canSort()) { + uksort($headers, array($this, '_sortHeaders')); + } + + return array_keys($headers); + } + + /** + * Remove the header with the given $name if it's set. + * + * If multiple headers match, the actual one may be specified by $index. + * + * @param string $name + * @param int $index + */ + public function remove($name, $index = 0) + { + $lowerName = strtolower($name); + unset($this->_headers[$lowerName][$index]); + } + + /** + * Remove all headers with the given $name. + * + * @param string $name + */ + public function removeAll($name) + { + $lowerName = strtolower($name); + unset($this->_headers[$lowerName]); + } + + /** + * Create a new instance of this HeaderSet. + * + * @return Swift_Mime_HeaderSet + */ + public function newInstance() + { + return new self($this->_factory); + } + + /** + * Define a list of Header names as an array in the correct order. + * + * These Headers will be output in the given order where present. + * + * @param array $sequence + */ + public function defineOrdering(array $sequence) + { + $this->_order = array_flip(array_map('strtolower', $sequence)); + } + + /** + * Set a list of header names which must always be displayed when set. + * + * Usually headers without a field value won't be output unless set here. + * + * @param array $names + */ + public function setAlwaysDisplayed(array $names) + { + $this->_required = array_flip(array_map('strtolower', $names)); + } + + /** + * Notify this observer that the entity's charset has changed. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->setCharset($charset); + } + + /** + * Returns a string with a representation of all headers. + * + * @return string + */ + public function toString() + { + $string = ''; + $headers = $this->_headers; + if ($this->_canSort()) { + uksort($headers, array($this, '_sortHeaders')); + } + foreach ($headers as $collection) { + foreach ($collection as $header) { + if ($this->_isDisplayed($header) || $header->getFieldBody() != '') { + $string .= $header->toString(); + } + } + } + + return $string; + } + + /** + * Returns a string representation of this object. + * + * @return string + * + * @see toString() + */ + public function __toString() + { + return $this->toString(); + } + + /** Save a Header to the internal collection */ + private function _storeHeader($name, Swift_Mime_Header $header, $offset = null) + { + if (!isset($this->_headers[strtolower($name)])) { + $this->_headers[strtolower($name)] = array(); + } + if (!isset($offset)) { + $this->_headers[strtolower($name)][] = $header; + } else { + $this->_headers[strtolower($name)][$offset] = $header; + } + } + + /** Test if the headers can be sorted */ + private function _canSort() + { + return count($this->_order) > 0; + } + + /** uksort() algorithm for Header ordering */ + private function _sortHeaders($a, $b) + { + $lowerA = strtolower($a); + $lowerB = strtolower($b); + $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1; + $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1; + + if (-1 === $aPos && -1 === $bPos) { + // just be sure to be determinist here + return $a > $b ? -1 : 1; + } + + if ($aPos == -1) { + return 1; + } elseif ($bPos == -1) { + return -1; + } + + return $aPos < $bPos ? -1 : 1; + } + + /** Test if the given Header is always displayed */ + private function _isDisplayed(Swift_Mime_Header $header) + { + return array_key_exists(strtolower($header->getFieldName()), $this->_required); + } + + /** Notify all Headers of the new charset */ + private function _notifyHeadersOfCharset($charset) + { + foreach ($this->_headers as $headerGroup) { + foreach ($headerGroup as $header) { + $header->setCharset($charset); + } + } + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->_factory = clone $this->_factory; + foreach ($this->_headers as $groupKey => $headerGroup) { + foreach ($headerGroup as $key => $header) { + $this->_headers[$groupKey][$key] = clone $header; + } + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php new file mode 100644 index 00000000000..124644b5a93 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php @@ -0,0 +1,649 @@ +getHeaders()->defineOrdering(array( + 'Return-Path', + 'Received', + 'DKIM-Signature', + 'DomainKey-Signature', + 'Sender', + 'Message-ID', + 'Date', + 'Subject', + 'From', + 'Reply-To', + 'To', + 'Cc', + 'Bcc', + 'MIME-Version', + 'Content-Type', + 'Content-Transfer-Encoding', + )); + $this->getHeaders()->setAlwaysDisplayed(array('Date', 'Message-ID', 'From')); + $this->getHeaders()->addTextHeader('MIME-Version', '1.0'); + $this->setDate(time()); + $this->setId($this->getId()); + $this->getHeaders()->addMailboxHeader('From'); + } + + /** + * Always returns {@link LEVEL_TOP} for a message instance. + * + * @return int + */ + public function getNestingLevel() + { + return self::LEVEL_TOP; + } + + /** + * Set the subject of this message. + * + * @param string $subject + * + * @return Swift_Mime_SimpleMessage + */ + public function setSubject($subject) + { + if (!$this->_setHeaderFieldModel('Subject', $subject)) { + $this->getHeaders()->addTextHeader('Subject', $subject); + } + + return $this; + } + + /** + * Get the subject of this message. + * + * @return string + */ + public function getSubject() + { + return $this->_getHeaderFieldModel('Subject'); + } + + /** + * Set the date at which this message was created. + * + * @param int $date + * + * @return Swift_Mime_SimpleMessage + */ + public function setDate($date) + { + if (!$this->_setHeaderFieldModel('Date', $date)) { + $this->getHeaders()->addDateHeader('Date', $date); + } + + return $this; + } + + /** + * Get the date at which this message was created. + * + * @return int + */ + public function getDate() + { + return $this->_getHeaderFieldModel('Date'); + } + + /** + * Set the return-path (the bounce address) of this message. + * + * @param string $address + * + * @return Swift_Mime_SimpleMessage + */ + public function setReturnPath($address) + { + if (!$this->_setHeaderFieldModel('Return-Path', $address)) { + $this->getHeaders()->addPathHeader('Return-Path', $address); + } + + return $this; + } + + /** + * Get the return-path (bounce address) of this message. + * + * @return string + */ + public function getReturnPath() + { + return $this->_getHeaderFieldModel('Return-Path'); + } + + /** + * Set the sender of this message. + * + * This does not override the From field, but it has a higher significance. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setSender($address, $name = null) + { + if (!is_array($address) && isset($name)) { + $address = array($address => $name); + } + + if (!$this->_setHeaderFieldModel('Sender', (array) $address)) { + $this->getHeaders()->addMailboxHeader('Sender', (array) $address); + } + + return $this; + } + + /** + * Get the sender of this message. + * + * @return string + */ + public function getSender() + { + return $this->_getHeaderFieldModel('Sender'); + } + + /** + * Add a From: address to this message. + * + * If $name is passed this name will be associated with the address. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function addFrom($address, $name = null) + { + $current = $this->getFrom(); + $current[$address] = $name; + + return $this->setFrom($current); + } + + /** + * Set the from address of this message. + * + * You may pass an array of addresses if this message is from multiple people. + * + * If $name is passed and the first parameter is a string, this name will be + * associated with the address. + * + * @param string|array $addresses + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setFrom($addresses, $name = null) + { + if (!is_array($addresses) && isset($name)) { + $addresses = array($addresses => $name); + } + + if (!$this->_setHeaderFieldModel('From', (array) $addresses)) { + $this->getHeaders()->addMailboxHeader('From', (array) $addresses); + } + + return $this; + } + + /** + * Get the from address of this message. + * + * @return mixed + */ + public function getFrom() + { + return $this->_getHeaderFieldModel('From'); + } + + /** + * Add a Reply-To: address to this message. + * + * If $name is passed this name will be associated with the address. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function addReplyTo($address, $name = null) + { + $current = $this->getReplyTo(); + $current[$address] = $name; + + return $this->setReplyTo($current); + } + + /** + * Set the reply-to address of this message. + * + * You may pass an array of addresses if replies will go to multiple people. + * + * If $name is passed and the first parameter is a string, this name will be + * associated with the address. + * + * @param mixed $addresses + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setReplyTo($addresses, $name = null) + { + if (!is_array($addresses) && isset($name)) { + $addresses = array($addresses => $name); + } + + if (!$this->_setHeaderFieldModel('Reply-To', (array) $addresses)) { + $this->getHeaders()->addMailboxHeader('Reply-To', (array) $addresses); + } + + return $this; + } + + /** + * Get the reply-to address of this message. + * + * @return string + */ + public function getReplyTo() + { + return $this->_getHeaderFieldModel('Reply-To'); + } + + /** + * Add a To: address to this message. + * + * If $name is passed this name will be associated with the address. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function addTo($address, $name = null) + { + $current = $this->getTo(); + $current[$address] = $name; + + return $this->setTo($current); + } + + /** + * Set the to addresses of this message. + * + * If multiple recipients will receive the message an array should be used. + * Example: array('receiver@domain.org', 'other@domain.org' => 'A name') + * + * If $name is passed and the first parameter is a string, this name will be + * associated with the address. + * + * @param mixed $addresses + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setTo($addresses, $name = null) + { + if (!is_array($addresses) && isset($name)) { + $addresses = array($addresses => $name); + } + + if (!$this->_setHeaderFieldModel('To', (array) $addresses)) { + $this->getHeaders()->addMailboxHeader('To', (array) $addresses); + } + + return $this; + } + + /** + * Get the To addresses of this message. + * + * @return array + */ + public function getTo() + { + return $this->_getHeaderFieldModel('To'); + } + + /** + * Add a Cc: address to this message. + * + * If $name is passed this name will be associated with the address. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function addCc($address, $name = null) + { + $current = $this->getCc(); + $current[$address] = $name; + + return $this->setCc($current); + } + + /** + * Set the Cc addresses of this message. + * + * If $name is passed and the first parameter is a string, this name will be + * associated with the address. + * + * @param mixed $addresses + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setCc($addresses, $name = null) + { + if (!is_array($addresses) && isset($name)) { + $addresses = array($addresses => $name); + } + + if (!$this->_setHeaderFieldModel('Cc', (array) $addresses)) { + $this->getHeaders()->addMailboxHeader('Cc', (array) $addresses); + } + + return $this; + } + + /** + * Get the Cc address of this message. + * + * @return array + */ + public function getCc() + { + return $this->_getHeaderFieldModel('Cc'); + } + + /** + * Add a Bcc: address to this message. + * + * If $name is passed this name will be associated with the address. + * + * @param string $address + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function addBcc($address, $name = null) + { + $current = $this->getBcc(); + $current[$address] = $name; + + return $this->setBcc($current); + } + + /** + * Set the Bcc addresses of this message. + * + * If $name is passed and the first parameter is a string, this name will be + * associated with the address. + * + * @param mixed $addresses + * @param string $name optional + * + * @return Swift_Mime_SimpleMessage + */ + public function setBcc($addresses, $name = null) + { + if (!is_array($addresses) && isset($name)) { + $addresses = array($addresses => $name); + } + + if (!$this->_setHeaderFieldModel('Bcc', (array) $addresses)) { + $this->getHeaders()->addMailboxHeader('Bcc', (array) $addresses); + } + + return $this; + } + + /** + * Get the Bcc addresses of this message. + * + * @return array + */ + public function getBcc() + { + return $this->_getHeaderFieldModel('Bcc'); + } + + /** + * Set the priority of this message. + * + * The value is an integer where 1 is the highest priority and 5 is the lowest. + * + * @param int $priority + * + * @return Swift_Mime_SimpleMessage + */ + public function setPriority($priority) + { + $priorityMap = array( + 1 => 'Highest', + 2 => 'High', + 3 => 'Normal', + 4 => 'Low', + 5 => 'Lowest', + ); + $pMapKeys = array_keys($priorityMap); + if ($priority > max($pMapKeys)) { + $priority = max($pMapKeys); + } elseif ($priority < min($pMapKeys)) { + $priority = min($pMapKeys); + } + if (!$this->_setHeaderFieldModel('X-Priority', + sprintf('%d (%s)', $priority, $priorityMap[$priority]))) { + $this->getHeaders()->addTextHeader('X-Priority', + sprintf('%d (%s)', $priority, $priorityMap[$priority])); + } + + return $this; + } + + /** + * Get the priority of this message. + * + * The returned value is an integer where 1 is the highest priority and 5 + * is the lowest. + * + * @return int + */ + public function getPriority() + { + list($priority) = sscanf($this->_getHeaderFieldModel('X-Priority'), + '%[1-5]' + ); + + return isset($priority) ? $priority : 3; + } + + /** + * Ask for a delivery receipt from the recipient to be sent to $addresses. + * + * @param array $addresses + * + * @return Swift_Mime_SimpleMessage + */ + public function setReadReceiptTo($addresses) + { + if (!$this->_setHeaderFieldModel('Disposition-Notification-To', $addresses)) { + $this->getHeaders() + ->addMailboxHeader('Disposition-Notification-To', $addresses); + } + + return $this; + } + + /** + * Get the addresses to which a read-receipt will be sent. + * + * @return string + */ + public function getReadReceiptTo() + { + return $this->_getHeaderFieldModel('Disposition-Notification-To'); + } + + /** + * Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart. + * + * @param Swift_Mime_MimeEntity $entity + * + * @return Swift_Mime_SimpleMessage + */ + public function attach(Swift_Mime_MimeEntity $entity) + { + $this->setChildren(array_merge($this->getChildren(), array($entity))); + + return $this; + } + + /** + * Remove an already attached entity. + * + * @param Swift_Mime_MimeEntity $entity + * + * @return Swift_Mime_SimpleMessage + */ + public function detach(Swift_Mime_MimeEntity $entity) + { + $newChildren = array(); + foreach ($this->getChildren() as $child) { + if ($entity !== $child) { + $newChildren[] = $child; + } + } + $this->setChildren($newChildren); + + return $this; + } + + /** + * Attach a {@link Swift_Mime_MimeEntity} and return it's CID source. + * This method should be used when embedding images or other data in a message. + * + * @param Swift_Mime_MimeEntity $entity + * + * @return string + */ + public function embed(Swift_Mime_MimeEntity $entity) + { + $this->attach($entity); + + return 'cid:'.$entity->getId(); + } + + /** + * Get this message as a complete string. + * + * @return string + */ + public function toString() + { + if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') { + $this->setChildren(array_merge(array($this->_becomeMimePart()), $children)); + $string = parent::toString(); + $this->setChildren($children); + } else { + $string = parent::toString(); + } + + return $string; + } + + /** + * Returns a string representation of this object. + * + * @see toString() + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Write this message to a {@link Swift_InputByteStream}. + * + * @param Swift_InputByteStream $is + */ + public function toByteStream(Swift_InputByteStream $is) + { + if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') { + $this->setChildren(array_merge(array($this->_becomeMimePart()), $children)); + parent::toByteStream($is); + $this->setChildren($children); + } else { + parent::toByteStream($is); + } + } + + /** @see Swift_Mime_SimpleMimeEntity::_getIdField() */ + protected function _getIdField() + { + return 'Message-ID'; + } + + /** Turn the body of this message into a child of itself if needed */ + protected function _becomeMimePart() + { + $part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(), + $this->_getCache(), $this->_getGrammar(), $this->_userCharset + ); + $part->setContentType($this->_userContentType); + $part->setBody($this->getBody()); + $part->setFormat($this->_userFormat); + $part->setDelSp($this->_userDelSp); + $part->_setNestingLevel($this->_getTopNestingLevel()); + + return $part; + } + + /** Get the highest nesting level nested inside this message */ + private function _getTopNestingLevel() + { + $highestLevel = $this->getNestingLevel(); + foreach ($this->getChildren() as $child) { + $childLevel = $child->getNestingLevel(); + if ($highestLevel < $childLevel) { + $highestLevel = $childLevel; + } + } + + return $highestLevel; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php new file mode 100644 index 00000000000..6b91718fb85 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php @@ -0,0 +1,843 @@ + array(self::LEVEL_TOP, self::LEVEL_MIXED), + 'multipart/alternative' => array(self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE), + 'multipart/related' => array(self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED), + ); + + /** A set of filter rules to define what level an entity should be nested at */ + private $_compoundLevelFilters = array(); + + /** The nesting level of this entity */ + private $_nestingLevel = self::LEVEL_ALTERNATIVE; + + /** A KeyCache instance used during encoding and streaming */ + private $_cache; + + /** Direct descendants of this entity */ + private $_immediateChildren = array(); + + /** All descendants of this entity */ + private $_children = array(); + + /** The maximum line length of the body of this entity */ + private $_maxLineLength = 78; + + /** The order in which alternative mime types should appear */ + private $_alternativePartOrder = array( + 'text/plain' => 1, + 'text/html' => 2, + 'multipart/related' => 3, + ); + + /** The CID of this entity */ + private $_id; + + /** The key used for accessing the cache */ + private $_cacheKey; + + protected $_userContentType; + + /** + * Create a new SimpleMimeEntity with $headers, $encoder and $cache. + * + * @param Swift_Mime_HeaderSet $headers + * @param Swift_Mime_ContentEncoder $encoder + * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar + */ + public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar) + { + $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true)); + $this->_cache = $cache; + $this->_headers = $headers; + $this->_grammar = $grammar; + $this->setEncoder($encoder); + $this->_headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding')); + + // This array specifies that, when the entire MIME document contains + // $compoundLevel, then for each child within $level, if its Content-Type + // is $contentType then it should be treated as if it's level is + // $neededLevel instead. I tried to write that unambiguously! :-\ + // Data Structure: + // array ( + // $compoundLevel => array( + // $level => array( + // $contentType => $neededLevel + // ) + // ) + // ) + + $this->_compoundLevelFilters = array( + (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => array( + self::LEVEL_ALTERNATIVE => array( + 'text/plain' => self::LEVEL_ALTERNATIVE, + 'text/html' => self::LEVEL_RELATED, + ), + ), + ); + + $this->_id = $this->getRandomId(); + } + + /** + * Generate a new Content-ID or Message-ID for this MIME entity. + * + * @return string + */ + public function generateId() + { + $this->setId($this->getRandomId()); + + return $this->_id; + } + + /** + * Get the {@link Swift_Mime_HeaderSet} for this entity. + * + * @return Swift_Mime_HeaderSet + */ + public function getHeaders() + { + return $this->_headers; + } + + /** + * Get the nesting level of this entity. + * + * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE + * + * @return int + */ + public function getNestingLevel() + { + return $this->_nestingLevel; + } + + /** + * Get the Content-type of this entity. + * + * @return string + */ + public function getContentType() + { + return $this->_getHeaderFieldModel('Content-Type'); + } + + /** + * Set the Content-type of this entity. + * + * @param string $type + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setContentType($type) + { + $this->_setContentTypeInHeaders($type); + // Keep track of the value so that if the content-type changes automatically + // due to added child entities, it can be restored if they are later removed + $this->_userContentType = $type; + + return $this; + } + + /** + * Get the CID of this entity. + * + * The CID will only be present in headers if a Content-ID header is present. + * + * @return string + */ + public function getId() + { + $tmp = (array) $this->_getHeaderFieldModel($this->_getIdField()); + + return $this->_headers->has($this->_getIdField()) ? current($tmp) : $this->_id; + } + + /** + * Set the CID of this entity. + * + * @param string $id + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setId($id) + { + if (!$this->_setHeaderFieldModel($this->_getIdField(), $id)) { + $this->_headers->addIdHeader($this->_getIdField(), $id); + } + $this->_id = $id; + + return $this; + } + + /** + * Get the description of this entity. + * + * This value comes from the Content-Description header if set. + * + * @return string + */ + public function getDescription() + { + return $this->_getHeaderFieldModel('Content-Description'); + } + + /** + * Set the description of this entity. + * + * This method sets a value in the Content-ID header. + * + * @param string $description + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setDescription($description) + { + if (!$this->_setHeaderFieldModel('Content-Description', $description)) { + $this->_headers->addTextHeader('Content-Description', $description); + } + + return $this; + } + + /** + * Get the maximum line length of the body of this entity. + * + * @return int + */ + public function getMaxLineLength() + { + return $this->_maxLineLength; + } + + /** + * Set the maximum line length of lines in this body. + * + * Though not enforced by the library, lines should not exceed 1000 chars. + * + * @param int $length + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setMaxLineLength($length) + { + $this->_maxLineLength = $length; + + return $this; + } + + /** + * Get all children added to this entity. + * + * @return Swift_Mime_MimeEntity[] + */ + public function getChildren() + { + return $this->_children; + } + + /** + * Set all children of this entity. + * + * @param Swift_Mime_MimeEntity[] $children + * @param int $compoundLevel For internal use only + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setChildren(array $children, $compoundLevel = null) + { + // TODO: Try to refactor this logic + + $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children); + $immediateChildren = array(); + $grandchildren = array(); + $newContentType = $this->_userContentType; + + foreach ($children as $child) { + $level = $this->_getNeededChildLevel($child, $compoundLevel); + if (empty($immediateChildren)) { + //first iteration + $immediateChildren = array($child); + } else { + $nextLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel); + if ($nextLevel == $level) { + $immediateChildren[] = $child; + } elseif ($level < $nextLevel) { + // Re-assign immediateChildren to grandchildren + $grandchildren = array_merge($grandchildren, $immediateChildren); + // Set new children + $immediateChildren = array($child); + } else { + $grandchildren[] = $child; + } + } + } + + if ($immediateChildren) { + $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel); + + // Determine which composite media type is needed to accommodate the + // immediate children + foreach ($this->_compositeRanges as $mediaType => $range) { + if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) { + $newContentType = $mediaType; + + break; + } + } + + // Put any grandchildren in a subpart + if (!empty($grandchildren)) { + $subentity = $this->_createChild(); + $subentity->_setNestingLevel($lowestLevel); + $subentity->setChildren($grandchildren, $compoundLevel); + array_unshift($immediateChildren, $subentity); + } + } + + $this->_immediateChildren = $immediateChildren; + $this->_children = $children; + $this->_setContentTypeInHeaders($newContentType); + $this->_fixHeaders(); + $this->_sortChildren(); + + return $this; + } + + /** + * Get the body of this entity as a string. + * + * @return string + */ + public function getBody() + { + return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body; + } + + /** + * Set the body of this entity, either as a string, or as an instance of + * {@link Swift_OutputByteStream}. + * + * @param mixed $body + * @param string $contentType optional + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setBody($body, $contentType = null) + { + if ($body !== $this->_body) { + $this->_clearCache(); + } + + $this->_body = $body; + if (isset($contentType)) { + $this->setContentType($contentType); + } + + return $this; + } + + /** + * Get the encoder used for the body of this entity. + * + * @return Swift_Mime_ContentEncoder + */ + public function getEncoder() + { + return $this->_encoder; + } + + /** + * Set the encoder used for the body of this entity. + * + * @param Swift_Mime_ContentEncoder $encoder + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setEncoder(Swift_Mime_ContentEncoder $encoder) + { + if ($encoder !== $this->_encoder) { + $this->_clearCache(); + } + + $this->_encoder = $encoder; + $this->_setEncoding($encoder->getName()); + $this->_notifyEncoderChanged($encoder); + + return $this; + } + + /** + * Get the boundary used to separate children in this entity. + * + * @return string + */ + public function getBoundary() + { + if (!isset($this->_boundary)) { + $this->_boundary = '_=_swift_v4_'.time().'_'.md5(getmypid().mt_rand().uniqid('', true)).'_=_'; + } + + return $this->_boundary; + } + + /** + * Set the boundary used to separate children in this entity. + * + * @param string $boundary + * + * @throws Swift_RfcComplianceException + * + * @return Swift_Mime_SimpleMimeEntity + */ + public function setBoundary($boundary) + { + $this->_assertValidBoundary($boundary); + $this->_boundary = $boundary; + + return $this; + } + + /** + * Receive notification that the charset of this entity, or a parent entity + * has changed. + * + * @param string $charset + */ + public function charsetChanged($charset) + { + $this->_notifyCharsetChanged($charset); + } + + /** + * Receive notification that the encoder of this entity or a parent entity + * has changed. + * + * @param Swift_Mime_ContentEncoder $encoder + */ + public function encoderChanged(Swift_Mime_ContentEncoder $encoder) + { + $this->_notifyEncoderChanged($encoder); + } + + /** + * Get this entire entity as a string. + * + * @return string + */ + public function toString() + { + $string = $this->_headers->toString(); + $string .= $this->_bodyToString(); + + return $string; + } + + /** + * Get this entire entity as a string. + * + * @return string + */ + protected function _bodyToString() + { + $string = ''; + + if (isset($this->_body) && empty($this->_immediateChildren)) { + if ($this->_cache->hasKey($this->_cacheKey, 'body')) { + $body = $this->_cache->getString($this->_cacheKey, 'body'); + } else { + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); + $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); + } + $string .= $body; + } + + if (!empty($this->_immediateChildren)) { + foreach ($this->_immediateChildren as $child) { + $string .= "\r\n\r\n--".$this->getBoundary()."\r\n"; + $string .= $child->toString(); + } + $string .= "\r\n\r\n--".$this->getBoundary()."--\r\n"; + } + + return $string; + } + + /** + * Returns a string representation of this object. + * + * @see toString() + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Write this entire entity to a {@see Swift_InputByteStream}. + * + * @param Swift_InputByteStream + */ + public function toByteStream(Swift_InputByteStream $is) + { + $is->write($this->_headers->toString()); + $is->commit(); + + $this->_bodyToByteStream($is); + } + + /** + * Write this entire entity to a {@link Swift_InputByteStream}. + * + * @param Swift_InputByteStream + */ + protected function _bodyToByteStream(Swift_InputByteStream $is) + { + if (empty($this->_immediateChildren)) { + if (isset($this->_body)) { + if ($this->_cache->hasKey($this->_cacheKey, 'body')) { + $this->_cache->exportToByteStream($this->_cacheKey, 'body', $is); + } else { + $cacheIs = $this->_cache->getInputByteStream($this->_cacheKey, 'body'); + if ($cacheIs) { + $is->bind($cacheIs); + } + + $is->write("\r\n"); + + if ($this->_body instanceof Swift_OutputByteStream) { + $this->_body->setReadPointer(0); + + $this->_encoder->encodeByteStream($this->_body, $is, 0, $this->getMaxLineLength()); + } else { + $is->write($this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength())); + } + + if ($cacheIs) { + $is->unbind($cacheIs); + } + } + } + } + + if (!empty($this->_immediateChildren)) { + foreach ($this->_immediateChildren as $child) { + $is->write("\r\n\r\n--".$this->getBoundary()."\r\n"); + $child->toByteStream($is); + } + $is->write("\r\n\r\n--".$this->getBoundary()."--\r\n"); + } + } + + /** + * Get the name of the header that provides the ID of this entity. + */ + protected function _getIdField() + { + return 'Content-ID'; + } + + /** + * Get the model data (usually an array or a string) for $field. + */ + protected function _getHeaderFieldModel($field) + { + if ($this->_headers->has($field)) { + return $this->_headers->get($field)->getFieldBodyModel(); + } + } + + /** + * Set the model data for $field. + */ + protected function _setHeaderFieldModel($field, $model) + { + if ($this->_headers->has($field)) { + $this->_headers->get($field)->setFieldBodyModel($model); + + return true; + } + + return false; + } + + /** + * Get the parameter value of $parameter on $field header. + */ + protected function _getHeaderParameter($field, $parameter) + { + if ($this->_headers->has($field)) { + return $this->_headers->get($field)->getParameter($parameter); + } + } + + /** + * Set the parameter value of $parameter on $field header. + */ + protected function _setHeaderParameter($field, $parameter, $value) + { + if ($this->_headers->has($field)) { + $this->_headers->get($field)->setParameter($parameter, $value); + + return true; + } + + return false; + } + + /** + * Re-evaluate what content type and encoding should be used on this entity. + */ + protected function _fixHeaders() + { + if (count($this->_immediateChildren)) { + $this->_setHeaderParameter('Content-Type', 'boundary', + $this->getBoundary() + ); + $this->_headers->remove('Content-Transfer-Encoding'); + } else { + $this->_setHeaderParameter('Content-Type', 'boundary', null); + $this->_setEncoding($this->_encoder->getName()); + } + } + + /** + * Get the KeyCache used in this entity. + * + * @return Swift_KeyCache + */ + protected function _getCache() + { + return $this->_cache; + } + + /** + * Get the grammar used for validation. + * + * @return Swift_Mime_Grammar + */ + protected function _getGrammar() + { + return $this->_grammar; + } + + /** + * Empty the KeyCache for this entity. + */ + protected function _clearCache() + { + $this->_cache->clearKey($this->_cacheKey, 'body'); + } + + /** + * Returns a random Content-ID or Message-ID. + * + * @return string + */ + protected function getRandomId() + { + $idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)); + $idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated'; + $id = $idLeft.'@'.$idRight; + + try { + $this->_assertValidId($id); + } catch (Swift_RfcComplianceException $e) { + $id = $idLeft.'@swift.generated'; + } + + return $id; + } + + private function _readStream(Swift_OutputByteStream $os) + { + $string = ''; + while (false !== $bytes = $os->read(8192)) { + $string .= $bytes; + } + + $os->setReadPointer(0); + + return $string; + } + + private function _setEncoding($encoding) + { + if (!$this->_setHeaderFieldModel('Content-Transfer-Encoding', $encoding)) { + $this->_headers->addTextHeader('Content-Transfer-Encoding', $encoding); + } + } + + private function _assertValidBoundary($boundary) + { + if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) { + throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); + } + } + + private function _setContentTypeInHeaders($type) + { + if (!$this->_setHeaderFieldModel('Content-Type', $type)) { + $this->_headers->addParameterizedHeader('Content-Type', $type); + } + } + + private function _setNestingLevel($level) + { + $this->_nestingLevel = $level; + } + + private function _getCompoundLevel($children) + { + $level = 0; + foreach ($children as $child) { + $level |= $child->getNestingLevel(); + } + + return $level; + } + + private function _getNeededChildLevel($child, $compoundLevel) + { + $filter = array(); + foreach ($this->_compoundLevelFilters as $bitmask => $rules) { + if (($compoundLevel & $bitmask) === $bitmask) { + $filter = $rules + $filter; + } + } + + $realLevel = $child->getNestingLevel(); + $lowercaseType = strtolower($child->getContentType()); + + if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { + return $filter[$realLevel][$lowercaseType]; + } + + return $realLevel; + } + + private function _createChild() + { + return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar); + } + + private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) + { + foreach ($this->_immediateChildren as $child) { + $child->encoderChanged($encoder); + } + } + + private function _notifyCharsetChanged($charset) + { + $this->_encoder->charsetChanged($charset); + $this->_headers->charsetChanged($charset); + foreach ($this->_immediateChildren as $child) { + $child->charsetChanged($charset); + } + } + + private function _sortChildren() + { + $shouldSort = false; + foreach ($this->_immediateChildren as $child) { + // NOTE: This include alternative parts moved into a related part + if ($child->getNestingLevel() == self::LEVEL_ALTERNATIVE) { + $shouldSort = true; + break; + } + } + + // Sort in order of preference, if there is one + if ($shouldSort) { + usort($this->_immediateChildren, array($this, '_childSortAlgorithm')); + } + } + + private function _childSortAlgorithm($a, $b) + { + $typePrefs = array(); + $types = array(strtolower($a->getContentType()), strtolower($b->getContentType())); + + foreach ($types as $type) { + $typePrefs[] = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; + } + + return $typePrefs[0] >= $typePrefs[1] ? 1 : -1; + } + + // -- Destructor + + /** + * Empties it's own contents from the cache. + */ + public function __destruct() + { + $this->_cache->clearAll($this->_cacheKey); + } + + /** + * Throws an Exception if the id passed does not comply with RFC 2822. + * + * @param string $id + * + * @throws Swift_RfcComplianceException + */ + private function _assertValidId($id) + { + if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) { + throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>'); + } + } + + /** + * Make a deep copy of object. + */ + public function __clone() + { + $this->_headers = clone $this->_headers; + $this->_encoder = clone $this->_encoder; + $this->_cacheKey = uniqid(); + $children = array(); + foreach ($this->_children as $pos => $child) { + $children[$pos] = clone $child; + } + $this->setChildren($children); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php b/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php new file mode 100644 index 00000000000..215f8db348a --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php @@ -0,0 +1,59 @@ +createDependenciesFor('mime.part') + ); + + if (!isset($charset)) { + $charset = Swift_DependencyContainer::getInstance() + ->lookup('properties.charset'); + } + $this->setBody($body); + $this->setCharset($charset); + if ($contentType) { + $this->setContentType($contentType); + } + } + + /** + * Create a new MimePart. + * + * @param string $body + * @param string $contentType + * @param string $charset + * + * @return Swift_Mime_MimePart + */ + public static function newInstance($body = null, $contentType = null, $charset = null) + { + return new self($body, $contentType, $charset); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php new file mode 100644 index 00000000000..b38e1cf7697 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Pretends messages have been sent, but just ignores them. + * + * @author Fabien Potencier + */ +class Swift_NullTransport extends Swift_Transport_NullTransport +{ + /** + * Create a new NullTransport. + */ + public function __construct() + { + call_user_func_array( + array($this, 'Swift_Transport_NullTransport::__construct'), + Swift_DependencyContainer::getInstance() + ->createDependenciesFor('transport.null') + ); + } + + /** + * Create a new NullTransport instance. + * + * @return Swift_NullTransport + */ + public static function newInstance() + { + return new self(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/OutputByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/OutputByteStream.php new file mode 100644 index 00000000000..1f26f9be529 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/OutputByteStream.php @@ -0,0 +1,46 @@ +setThreshold($threshold); + $this->setSleepTime($sleep); + $this->_sleeper = $sleeper; + } + + /** + * Set the number of emails to send before restarting. + * + * @param int $threshold + */ + public function setThreshold($threshold) + { + $this->_threshold = $threshold; + } + + /** + * Get the number of emails to send before restarting. + * + * @return int + */ + public function getThreshold() + { + return $this->_threshold; + } + + /** + * Set the number of seconds to sleep for during a restart. + * + * @param int $sleep time + */ + public function setSleepTime($sleep) + { + $this->_sleep = $sleep; + } + + /** + * Get the number of seconds to sleep for during a restart. + * + * @return int + */ + public function getSleepTime() + { + return $this->_sleep; + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + ++$this->_counter; + if ($this->_counter >= $this->_threshold) { + $transport = $evt->getTransport(); + $transport->stop(); + if ($this->_sleep) { + $this->sleep($this->_sleep); + } + $transport->start(); + $this->_counter = 0; + } + } + + /** + * Sleep for $seconds. + * + * @param int $seconds + */ + public function sleep($seconds) + { + if (isset($this->_sleeper)) { + $this->_sleeper->sleep($seconds); + } else { + sleep($seconds); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php new file mode 100644 index 00000000000..f7e18d0ebea --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php @@ -0,0 +1,164 @@ +getMessage(); + $message->toByteStream($this); + } + + /** + * Invoked immediately following a command being sent. + * + * @param Swift_Events_CommandEvent $evt + */ + public function commandSent(Swift_Events_CommandEvent $evt) + { + $command = $evt->getCommand(); + $this->_out += strlen($command); + } + + /** + * Invoked immediately following a response coming back. + * + * @param Swift_Events_ResponseEvent $evt + */ + public function responseReceived(Swift_Events_ResponseEvent $evt) + { + $response = $evt->getResponse(); + $this->_in += strlen($response); + } + + /** + * Called when a message is sent so that the outgoing counter can be increased. + * + * @param string $bytes + */ + public function write($bytes) + { + $this->_out += strlen($bytes); + foreach ($this->_mirrors as $stream) { + $stream->write($bytes); + } + } + + /** + * Not used. + */ + public function commit() + { + } + + /** + * Attach $is to this stream. + * + * The stream acts as an observer, receiving all data that is written. + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. + * + * @param Swift_InputByteStream $is + */ + public function bind(Swift_InputByteStream $is) + { + $this->_mirrors[] = $is; + } + + /** + * Remove an already bound stream. + * + * If $is is not bound, no errors will be raised. + * If the stream currently has any buffered data it will be written to $is + * before unbinding occurs. + * + * @param Swift_InputByteStream $is + */ + public function unbind(Swift_InputByteStream $is) + { + foreach ($this->_mirrors as $k => $stream) { + if ($is === $stream) { + unset($this->_mirrors[$k]); + } + } + } + + /** + * Not used. + */ + public function flushBuffers() + { + foreach ($this->_mirrors as $stream) { + $stream->flushBuffers(); + } + } + + /** + * Get the total number of bytes sent to the server. + * + * @return int + */ + public function getBytesOut() + { + return $this->_out; + } + + /** + * Get the total number of bytes received from the server. + * + * @return int + */ + public function getBytesIn() + { + return $this->_in; + } + + /** + * Reset the internal counters to zero. + */ + public function reset() + { + $this->_out = 0; + $this->_in = 0; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php new file mode 100644 index 00000000000..9f9f08b5674 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php @@ -0,0 +1,31 @@ + + * $replacements = array( + * "address1@domain.tld" => array("{a}" => "b", "{c}" => "d"), + * "address2@domain.tld" => array("{a}" => "x", "{c}" => "y") + * ) + * + * + * When using an instance of {@link Swift_Plugins_Decorator_Replacements}, + * the object should return just the array of replacements for the address + * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}. + * + * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements + */ + public function __construct($replacements) + { + $this->setReplacements($replacements); + } + + /** + * Sets replacements. + * + * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements + * + * @see __construct() + */ + public function setReplacements($replacements) + { + if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) { + $this->_replacements = (array) $replacements; + } else { + $this->_replacements = $replacements; + } + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + $this->_restoreMessage($message); + $to = array_keys($message->getTo()); + $address = array_shift($to); + if ($replacements = $this->getReplacementsFor($address)) { + $body = $message->getBody(); + $search = array_keys($replacements); + $replace = array_values($replacements); + $bodyReplaced = str_replace( + $search, $replace, $body + ); + if ($body != $bodyReplaced) { + $this->_originalBody = $body; + $message->setBody($bodyReplaced); + } + + foreach ($message->getHeaders()->getAll() as $header) { + $body = $header->getFieldBodyModel(); + $count = 0; + if (is_array($body)) { + $bodyReplaced = array(); + foreach ($body as $key => $value) { + $count1 = 0; + $count2 = 0; + $key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key; + $value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value; + $bodyReplaced[$key] = $value; + + if (!$count && ($count1 || $count2)) { + $count = 1; + } + } + } else { + $bodyReplaced = str_replace($search, $replace, $body, $count); + } + + if ($count) { + $this->_originalHeaders[$header->getFieldName()] = $body; + $header->setFieldBodyModel($bodyReplaced); + } + } + + $children = (array) $message->getChildren(); + foreach ($children as $child) { + list($type) = sscanf($child->getContentType(), '%[^/]/%s'); + if ('text' == $type) { + $body = $child->getBody(); + $bodyReplaced = str_replace( + $search, $replace, $body + ); + if ($body != $bodyReplaced) { + $child->setBody($bodyReplaced); + $this->_originalChildBodies[$child->getId()] = $body; + } + } + } + $this->_lastMessage = $message; + } + } + + /** + * Find a map of replacements for the address. + * + * If this plugin was provided with a delegate instance of + * {@link Swift_Plugins_Decorator_Replacements} then the call will be + * delegated to it. Otherwise, it will attempt to find the replacements + * from the array provided in the constructor. + * + * If no replacements can be found, an empty value (NULL) is returned. + * + * @param string $address + * + * @return array + */ + public function getReplacementsFor($address) + { + if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) { + return $this->_replacements->getReplacementsFor($address); + } + + return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null; + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + $this->_restoreMessage($evt->getMessage()); + } + + /** Restore a changed message back to its original state */ + private function _restoreMessage(Swift_Mime_Message $message) + { + if ($this->_lastMessage === $message) { + if (isset($this->_originalBody)) { + $message->setBody($this->_originalBody); + $this->_originalBody = null; + } + if (!empty($this->_originalHeaders)) { + foreach ($message->getHeaders()->getAll() as $header) { + if (array_key_exists($header->getFieldName(), $this->_originalHeaders)) { + $header->setFieldBodyModel($this->_originalHeaders[$header->getFieldName()]); + } + } + $this->_originalHeaders = array(); + } + if (!empty($this->_originalChildBodies)) { + $children = (array) $message->getChildren(); + foreach ($children as $child) { + $id = $child->getId(); + if (array_key_exists($id, $this->_originalChildBodies)) { + $child->setBody($this->_originalChildBodies[$id]); + } + } + $this->_originalChildBodies = array(); + } + $this->_lastMessage = null; + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php new file mode 100644 index 00000000000..7552b67a2f7 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php @@ -0,0 +1,69 @@ +_sender = $sender; + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + $headers = $message->getHeaders(); + + // save current recipients + $headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath()); + + // replace them with the one to send to + $message->setReturnPath($this->_sender); + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + + // restore original headers + $headers = $message->getHeaders(); + + if ($headers->has('X-Swift-Return-Path')) { + $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress()); + $headers->removeAll('X-Swift-Return-Path'); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Logger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Logger.php new file mode 100644 index 00000000000..d9bce8935d5 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Logger.php @@ -0,0 +1,36 @@ +_logger = $logger; + } + + /** + * Add a log entry. + * + * @param string $entry + */ + public function add($entry) + { + $this->_logger->add($entry); + } + + /** + * Clear the log contents. + */ + public function clear() + { + $this->_logger->clear(); + } + + /** + * Get this log as a string. + * + * @return string + */ + public function dump() + { + return $this->_logger->dump(); + } + + /** + * Invoked immediately following a command being sent. + * + * @param Swift_Events_CommandEvent $evt + */ + public function commandSent(Swift_Events_CommandEvent $evt) + { + $command = $evt->getCommand(); + $this->_logger->add(sprintf('>> %s', $command)); + } + + /** + * Invoked immediately following a response coming back. + * + * @param Swift_Events_ResponseEvent $evt + */ + public function responseReceived(Swift_Events_ResponseEvent $evt) + { + $response = $evt->getResponse(); + $this->_logger->add(sprintf('<< %s', $response)); + } + + /** + * Invoked just before a Transport is started. + * + * @param Swift_Events_TransportChangeEvent $evt + */ + public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) + { + $transportName = get_class($evt->getSource()); + $this->_logger->add(sprintf('++ Starting %s', $transportName)); + } + + /** + * Invoked immediately after the Transport is started. + * + * @param Swift_Events_TransportChangeEvent $evt + */ + public function transportStarted(Swift_Events_TransportChangeEvent $evt) + { + $transportName = get_class($evt->getSource()); + $this->_logger->add(sprintf('++ %s started', $transportName)); + } + + /** + * Invoked just before a Transport is stopped. + * + * @param Swift_Events_TransportChangeEvent $evt + */ + public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) + { + $transportName = get_class($evt->getSource()); + $this->_logger->add(sprintf('++ Stopping %s', $transportName)); + } + + /** + * Invoked immediately after the Transport is stopped. + * + * @param Swift_Events_TransportChangeEvent $evt + */ + public function transportStopped(Swift_Events_TransportChangeEvent $evt) + { + $transportName = get_class($evt->getSource()); + $this->_logger->add(sprintf('++ %s stopped', $transportName)); + } + + /** + * Invoked as a TransportException is thrown in the Transport system. + * + * @param Swift_Events_TransportExceptionEvent $evt + */ + public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt) + { + $e = $evt->getException(); + $message = $e->getMessage(); + $code = $e->getCode(); + $this->_logger->add(sprintf('!! %s (code: %s)', $message, $code)); + $message .= PHP_EOL; + $message .= 'Log data:'.PHP_EOL; + $message .= $this->_logger->dump(); + $evt->cancelBubble(); + throw new Swift_TransportException($message, $code, $e->getPrevious()); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php new file mode 100644 index 00000000000..865bb0aa3b9 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php @@ -0,0 +1,72 @@ +_size = $size; + } + + /** + * Add a log entry. + * + * @param string $entry + */ + public function add($entry) + { + $this->_log[] = $entry; + while (count($this->_log) > $this->_size) { + array_shift($this->_log); + } + } + + /** + * Clear the log contents. + */ + public function clear() + { + $this->_log = array(); + } + + /** + * Get this log as a string. + * + * @return string + */ + public function dump() + { + return implode(PHP_EOL, $this->_log); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php new file mode 100644 index 00000000000..3583297ab10 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php @@ -0,0 +1,58 @@ +_isHtml = $isHtml; + } + + /** + * Add a log entry. + * + * @param string $entry + */ + public function add($entry) + { + if ($this->_isHtml) { + printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '
', PHP_EOL); + } else { + printf('%s%s', $entry, PHP_EOL); + } + } + + /** + * Not implemented. + */ + public function clear() + { + } + + /** + * Not implemented. + */ + public function dump() + { + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php new file mode 100644 index 00000000000..e622cb37d16 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php @@ -0,0 +1,74 @@ +messages = array(); + } + + /** + * Get the message list. + * + * @return array + */ + public function getMessages() + { + return $this->messages; + } + + /** + * Get the message count. + * + * @return int count + */ + public function countMessages() + { + return count($this->messages); + } + + /** + * Empty the message list. + */ + public function clear() + { + $this->messages = array(); + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $this->messages[] = clone $evt->getMessage(); + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php new file mode 100644 index 00000000000..fb99e4c942b --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php @@ -0,0 +1,31 @@ +_host = $host; + $this->_port = $port; + $this->_crypto = $crypto; + } + + /** + * Create a new PopBeforeSmtpPlugin for $host and $port. + * + * @param string $host + * @param int $port + * @param string $crypto as "tls" or "ssl" + * + * @return Swift_Plugins_PopBeforeSmtpPlugin + */ + public static function newInstance($host, $port = 110, $crypto = null) + { + return new self($host, $port, $crypto); + } + + /** + * Set a Pop3Connection to delegate to instead of connecting directly. + * + * @param Swift_Plugins_Pop_Pop3Connection $connection + * + * @return Swift_Plugins_PopBeforeSmtpPlugin + */ + public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) + { + $this->_connection = $connection; + + return $this; + } + + /** + * Bind this plugin to a specific SMTP transport instance. + * + * @param Swift_Transport + */ + public function bindSmtp(Swift_Transport $smtp) + { + $this->_transport = $smtp; + } + + /** + * Set the connection timeout in seconds (default 10). + * + * @param int $timeout + * + * @return Swift_Plugins_PopBeforeSmtpPlugin + */ + public function setTimeout($timeout) + { + $this->_timeout = (int) $timeout; + + return $this; + } + + /** + * Set the username to use when connecting (if needed). + * + * @param string $username + * + * @return Swift_Plugins_PopBeforeSmtpPlugin + */ + public function setUsername($username) + { + $this->_username = $username; + + return $this; + } + + /** + * Set the password to use when connecting (if needed). + * + * @param string $password + * + * @return Swift_Plugins_PopBeforeSmtpPlugin + */ + public function setPassword($password) + { + $this->_password = $password; + + return $this; + } + + /** + * Connect to the POP3 host and authenticate. + * + * @throws Swift_Plugins_Pop_Pop3Exception if connection fails + */ + public function connect() + { + if (isset($this->_connection)) { + $this->_connection->connect(); + } else { + if (!isset($this->_socket)) { + if (!$socket = fsockopen( + $this->_getHostString(), $this->_port, $errno, $errstr, $this->_timeout)) { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('Failed to connect to POP3 host [%s]: %s', $this->_host, $errstr) + ); + } + $this->_socket = $socket; + + if (false === $greeting = fgets($this->_socket)) { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('Failed to connect to POP3 host [%s]', trim($greeting)) + ); + } + + $this->_assertOk($greeting); + + if ($this->_username) { + $this->_command(sprintf("USER %s\r\n", $this->_username)); + $this->_command(sprintf("PASS %s\r\n", $this->_password)); + } + } + } + } + + /** + * Disconnect from the POP3 host. + */ + public function disconnect() + { + if (isset($this->_connection)) { + $this->_connection->disconnect(); + } else { + $this->_command("QUIT\r\n"); + if (!fclose($this->_socket)) { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('POP3 host [%s] connection could not be stopped', $this->_host) + ); + } + $this->_socket = null; + } + } + + /** + * Invoked just before a Transport is started. + * + * @param Swift_Events_TransportChangeEvent $evt + */ + public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) + { + if (isset($this->_transport)) { + if ($this->_transport !== $evt->getTransport()) { + return; + } + } + + $this->connect(); + $this->disconnect(); + } + + /** + * Not used. + */ + public function transportStarted(Swift_Events_TransportChangeEvent $evt) + { + } + + /** + * Not used. + */ + public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) + { + } + + /** + * Not used. + */ + public function transportStopped(Swift_Events_TransportChangeEvent $evt) + { + } + + private function _command($command) + { + if (!fwrite($this->_socket, $command)) { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('Failed to write command [%s] to POP3 host', trim($command)) + ); + } + + if (false === $response = fgets($this->_socket)) { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('Failed to read from POP3 host after command [%s]', trim($command)) + ); + } + + $this->_assertOk($response); + + return $response; + } + + private function _assertOk($response) + { + if (substr($response, 0, 3) != '+OK') { + throw new Swift_Plugins_Pop_Pop3Exception( + sprintf('POP3 command failed [%s]', trim($response)) + ); + } + } + + private function _getHostString() + { + $host = $this->_host; + switch (strtolower($this->_crypto)) { + case 'ssl': + $host = 'ssl://'.$host; + break; + + case 'tls': + $host = 'tls://'.$host; + break; + } + + return $host; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php new file mode 100644 index 00000000000..c3a1f868544 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php @@ -0,0 +1,213 @@ +_recipient = $recipient; + $this->_whitelist = $whitelist; + } + + /** + * Set the recipient of all messages. + * + * @param mixed $recipient + */ + public function setRecipient($recipient) + { + $this->_recipient = $recipient; + } + + /** + * Get the recipient of all messages. + * + * @return mixed + */ + public function getRecipient() + { + return $this->_recipient; + } + + /** + * Set a list of regular expressions to whitelist certain recipients. + * + * @param array $whitelist + */ + public function setWhitelist(array $whitelist) + { + $this->_whitelist = $whitelist; + } + + /** + * Get the whitelist. + * + * @return array + */ + public function getWhitelist() + { + return $this->_whitelist; + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + $headers = $message->getHeaders(); + + // conditionally save current recipients + + if ($headers->has('to')) { + $headers->addMailboxHeader('X-Swift-To', $message->getTo()); + } + + if ($headers->has('cc')) { + $headers->addMailboxHeader('X-Swift-Cc', $message->getCc()); + } + + if ($headers->has('bcc')) { + $headers->addMailboxHeader('X-Swift-Bcc', $message->getBcc()); + } + + // Filter remaining headers against whitelist + $this->_filterHeaderSet($headers, 'To'); + $this->_filterHeaderSet($headers, 'Cc'); + $this->_filterHeaderSet($headers, 'Bcc'); + + // Add each hard coded recipient + $to = $message->getTo(); + if (null === $to) { + $to = array(); + } + + foreach ((array) $this->_recipient as $recipient) { + if (!array_key_exists($recipient, $to)) { + $message->addTo($recipient); + } + } + } + + /** + * Filter header set against a whitelist of regular expressions. + * + * @param Swift_Mime_HeaderSet $headerSet + * @param string $type + */ + private function _filterHeaderSet(Swift_Mime_HeaderSet $headerSet, $type) + { + foreach ($headerSet->getAll($type) as $headers) { + $headers->setNameAddresses($this->_filterNameAddresses($headers->getNameAddresses())); + } + } + + /** + * Filtered list of addresses => name pairs. + * + * @param array $recipients + * + * @return array + */ + private function _filterNameAddresses(array $recipients) + { + $filtered = array(); + + foreach ($recipients as $address => $name) { + if ($this->_isWhitelisted($address)) { + $filtered[$address] = $name; + } + } + + return $filtered; + } + + /** + * Matches address against whitelist of regular expressions. + * + * @param $recipient + * + * @return bool + */ + protected function _isWhitelisted($recipient) + { + if (in_array($recipient, (array) $this->_recipient)) { + return true; + } + + foreach ($this->_whitelist as $pattern) { + if (preg_match($pattern, $recipient)) { + return true; + } + } + + return false; + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + $this->_restoreMessage($evt->getMessage()); + } + + private function _restoreMessage(Swift_Mime_Message $message) + { + // restore original headers + $headers = $message->getHeaders(); + + if ($headers->has('X-Swift-To')) { + $message->setTo($headers->get('X-Swift-To')->getNameAddresses()); + $headers->removeAll('X-Swift-To'); + } else { + $message->setTo(null); + } + + if ($headers->has('X-Swift-Cc')) { + $message->setCc($headers->get('X-Swift-Cc')->getNameAddresses()); + $headers->removeAll('X-Swift-Cc'); + } + + if ($headers->has('X-Swift-Bcc')) { + $message->setBcc($headers->get('X-Swift-Bcc')->getNameAddresses()); + $headers->removeAll('X-Swift-Bcc'); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php new file mode 100644 index 00000000000..0f21b7d6052 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php @@ -0,0 +1,32 @@ +_reporter = $reporter; + } + + /** + * Not used. + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + $failures = array_flip($evt->getFailedRecipients()); + foreach ((array) $message->getTo() as $address => $null) { + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); + } + foreach ((array) $message->getCc() as $address => $null) { + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); + } + foreach ((array) $message->getBcc() as $address => $null) { + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php new file mode 100644 index 00000000000..cad9d168ef2 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php @@ -0,0 +1,59 @@ +_failures_cache[$address])) { + $this->_failures[] = $address; + $this->_failures_cache[$address] = true; + } + } + + /** + * Get an array of addresses for which delivery failed. + * + * @return array + */ + public function getFailedRecipients() + { + return $this->_failures; + } + + /** + * Clear the buffer (empty the list). + */ + public function clear() + { + $this->_failures = $this->_failures_cache = array(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php new file mode 100644 index 00000000000..c62593557e3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php @@ -0,0 +1,39 @@ +'.PHP_EOL; + echo 'PASS '.$address.PHP_EOL; + echo ''.PHP_EOL; + flush(); + } else { + echo '
'.PHP_EOL; + echo 'FAIL '.$address.PHP_EOL; + echo '
'.PHP_EOL; + flush(); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php new file mode 100644 index 00000000000..595c0f603b0 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php @@ -0,0 +1,24 @@ +_rate = $rate; + $this->_mode = $mode; + $this->_sleeper = $sleeper; + $this->_timer = $timer; + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $time = $this->getTimestamp(); + if (!isset($this->_start)) { + $this->_start = $time; + } + $duration = $time - $this->_start; + + switch ($this->_mode) { + case self::BYTES_PER_MINUTE : + $sleep = $this->_throttleBytesPerMinute($duration); + break; + case self::MESSAGES_PER_SECOND : + $sleep = $this->_throttleMessagesPerSecond($duration); + break; + case self::MESSAGES_PER_MINUTE : + $sleep = $this->_throttleMessagesPerMinute($duration); + break; + default : + $sleep = 0; + break; + } + + if ($sleep > 0) { + $this->sleep($sleep); + } + } + + /** + * Invoked when a Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + parent::sendPerformed($evt); + ++$this->_messages; + } + + /** + * Sleep for $seconds. + * + * @param int $seconds + */ + public function sleep($seconds) + { + if (isset($this->_sleeper)) { + $this->_sleeper->sleep($seconds); + } else { + sleep($seconds); + } + } + + /** + * Get the current UNIX timestamp. + * + * @return int + */ + public function getTimestamp() + { + if (isset($this->_timer)) { + return $this->_timer->getTimestamp(); + } + + return time(); + } + + /** + * Get a number of seconds to sleep for. + * + * @param int $timePassed + * + * @return int + */ + private function _throttleBytesPerMinute($timePassed) + { + $expectedDuration = $this->getBytesOut() / ($this->_rate / 60); + + return (int) ceil($expectedDuration - $timePassed); + } + + /** + * Get a number of seconds to sleep for. + * + * @param int $timePassed + * + * @return int + */ + private function _throttleMessagesPerSecond($timePassed) + { + $expectedDuration = $this->_messages / ($this->_rate); + + return (int) ceil($expectedDuration - $timePassed); + } + + /** + * Get a number of seconds to sleep for. + * + * @param int $timePassed + * + * @return int + */ + private function _throttleMessagesPerMinute($timePassed) + { + $expectedDuration = $this->_messages / ($this->_rate / 60); + + return (int) ceil($expectedDuration - $timePassed); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Timer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Timer.php new file mode 100644 index 00000000000..9c8deb38ac4 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Timer.php @@ -0,0 +1,24 @@ +register('properties.charset')->asValue($charset); + + return $this; + } + + /** + * Set the directory where temporary files can be saved. + * + * @param string $dir + * + * @return Swift_Preferences + */ + public function setTempDir($dir) + { + Swift_DependencyContainer::getInstance() + ->register('tempdir')->asValue($dir); + + return $this; + } + + /** + * Set the type of cache to use (i.e. "disk" or "array"). + * + * @param string $type + * + * @return Swift_Preferences + */ + public function setCacheType($type) + { + Swift_DependencyContainer::getInstance() + ->register('cache')->asAliasOf(sprintf('cache.%s', $type)); + + return $this; + } + + /** + * Set the QuotedPrintable dot escaper preference. + * + * @param bool $dotEscape + * + * @return Swift_Preferences + */ + public function setQPDotEscape($dotEscape) + { + $dotEscape = !empty($dotEscape); + Swift_DependencyContainer::getInstance() + ->register('mime.qpcontentencoder') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') + ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer')) + ->addConstructorValue($dotEscape); + + return $this; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ReplacementFilterFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ReplacementFilterFactory.php new file mode 100644 index 00000000000..2897474e7b3 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ReplacementFilterFactory.php @@ -0,0 +1,27 @@ +createDependenciesFor('transport.sendmail') + ); + + $this->setCommand($command); + } + + /** + * Create a new SendmailTransport instance. + * + * @param string $command + * + * @return Swift_SendmailTransport + */ + public static function newInstance($command = '/usr/sbin/sendmail -bs') + { + return new self($command); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SignedMessage.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SignedMessage.php new file mode 100644 index 00000000000..2e7a8726d21 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SignedMessage.php @@ -0,0 +1,23 @@ + + * + * @deprecated + */ +class Swift_SignedMessage extends Swift_Message +{ +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php new file mode 100644 index 00000000000..2d8176d905c --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php @@ -0,0 +1,20 @@ + + */ +interface Swift_Signer +{ + public function reset(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php new file mode 100644 index 00000000000..9ffcef39c9f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php @@ -0,0 +1,33 @@ + + */ +interface Swift_Signers_BodySigner extends Swift_Signer +{ + /** + * Change the Swift_Signed_Message to apply the singing. + * + * @param Swift_Message $message + * + * @return Swift_Signers_BodySigner + */ + public function signMessage(Swift_Message $message); + + /** + * Return the list of header a signer might tamper. + * + * @return array + */ + public function getAlteredHeaders(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php new file mode 100644 index 00000000000..6040b2856f2 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php @@ -0,0 +1,698 @@ + + */ +class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner +{ + /** + * PrivateKey. + * + * @var string + */ + protected $_privateKey; + + /** + * DomainName. + * + * @var string + */ + protected $_domainName; + + /** + * Selector. + * + * @var string + */ + protected $_selector; + + /** + * Hash algorithm used. + * + * @var string + */ + protected $_hashAlgorithm = 'rsa-sha1'; + + /** + * Body canon method. + * + * @var string + */ + protected $_bodyCanon = 'simple'; + + /** + * Header canon method. + * + * @var string + */ + protected $_headerCanon = 'simple'; + + /** + * Headers not being signed. + * + * @var array + */ + protected $_ignoredHeaders = array('return-path' => true); + + /** + * Signer identity. + * + * @var string + */ + protected $_signerIdentity; + + /** + * BodyLength. + * + * @var int + */ + protected $_bodyLen = 0; + + /** + * Maximum signedLen. + * + * @var int + */ + protected $_maxLen = PHP_INT_MAX; + + /** + * Embbed bodyLen in signature. + * + * @var bool + */ + protected $_showLen = false; + + /** + * When the signature has been applied (true means time()), false means not embedded. + * + * @var mixed + */ + protected $_signatureTimestamp = true; + + /** + * When will the signature expires false means not embedded, if sigTimestamp is auto + * Expiration is relative, otherwhise it's absolute. + * + * @var int + */ + protected $_signatureExpiration = false; + + /** + * Must we embed signed headers? + * + * @var bool + */ + protected $_debugHeaders = false; + + // work variables + /** + * Headers used to generate hash. + * + * @var array + */ + protected $_signedHeaders = array(); + + /** + * If debugHeaders is set store debugDatas here. + * + * @var string + */ + private $_debugHeadersData = ''; + + /** + * Stores the bodyHash. + * + * @var string + */ + private $_bodyHash = ''; + + /** + * Stores the signature header. + * + * @var Swift_Mime_Headers_ParameterizedHeader + */ + protected $_dkimHeader; + + private $_bodyHashHandler; + + private $_headerHash; + + private $_headerCanonData = ''; + + private $_bodyCanonEmptyCounter = 0; + + private $_bodyCanonIgnoreStart = 2; + + private $_bodyCanonSpace = false; + + private $_bodyCanonLastChar = null; + + private $_bodyCanonLine = ''; + + private $_bound = array(); + + /** + * Constructor. + * + * @param string $privateKey + * @param string $domainName + * @param string $selector + */ + public function __construct($privateKey, $domainName, $selector) + { + $this->_privateKey = $privateKey; + $this->_domainName = $domainName; + $this->_signerIdentity = '@'.$domainName; + $this->_selector = $selector; + } + + /** + * Instanciate DKIMSigner. + * + * @param string $privateKey + * @param string $domainName + * @param string $selector + * + * @return Swift_Signers_DKIMSigner + */ + public static function newInstance($privateKey, $domainName, $selector) + { + return new static($privateKey, $domainName, $selector); + } + + /** + * Reset the Signer. + * + * @see Swift_Signer::reset() + */ + public function reset() + { + $this->_headerHash = null; + $this->_signedHeaders = array(); + $this->_bodyHash = null; + $this->_bodyHashHandler = null; + $this->_bodyCanonIgnoreStart = 2; + $this->_bodyCanonEmptyCounter = 0; + $this->_bodyCanonLastChar = null; + $this->_bodyCanonSpace = false; + } + + /** + * Writes $bytes to the end of the stream. + * + * Writing may not happen immediately if the stream chooses to buffer. If + * you want to write these bytes with immediate effect, call {@link commit()} + * after calling write(). + * + * This method returns the sequence ID of the write (i.e. 1 for first, 2 for + * second, etc etc). + * + * @param string $bytes + * + * @throws Swift_IoException + * + * @return int + */ + public function write($bytes) + { + $this->_canonicalizeBody($bytes); + foreach ($this->_bound as $is) { + $is->write($bytes); + } + } + + /** + * For any bytes that are currently buffered inside the stream, force them + * off the buffer. + * + * @throws Swift_IoException + */ + public function commit() + { + // Nothing to do + return; + } + + /** + * Attach $is to this stream. + * The stream acts as an observer, receiving all data that is written. + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. + * + * @param Swift_InputByteStream $is + */ + public function bind(Swift_InputByteStream $is) + { + // Don't have to mirror anything + $this->_bound[] = $is; + + return; + } + + /** + * Remove an already bound stream. + * If $is is not bound, no errors will be raised. + * If the stream currently has any buffered data it will be written to $is + * before unbinding occurs. + * + * @param Swift_InputByteStream $is + */ + public function unbind(Swift_InputByteStream $is) + { + // Don't have to mirror anything + foreach ($this->_bound as $k => $stream) { + if ($stream === $is) { + unset($this->_bound[$k]); + + return; + } + } + + return; + } + + /** + * Flush the contents of the stream (empty it) and set the internal pointer + * to the beginning. + * + * @throws Swift_IoException + */ + public function flushBuffers() + { + $this->reset(); + } + + /** + * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256. + * + * @param string $hash + * + * @return Swift_Signers_DKIMSigner + */ + public function setHashAlgorithm($hash) + { + // Unable to sign with rsa-sha256 + if ($hash == 'rsa-sha1') { + $this->_hashAlgorithm = 'rsa-sha1'; + } else { + $this->_hashAlgorithm = 'rsa-sha256'; + } + + return $this; + } + + /** + * Set the body canonicalization algorithm. + * + * @param string $canon + * + * @return Swift_Signers_DKIMSigner + */ + public function setBodyCanon($canon) + { + if ($canon == 'relaxed') { + $this->_bodyCanon = 'relaxed'; + } else { + $this->_bodyCanon = 'simple'; + } + + return $this; + } + + /** + * Set the header canonicalization algorithm. + * + * @param string $canon + * + * @return Swift_Signers_DKIMSigner + */ + public function setHeaderCanon($canon) + { + if ($canon == 'relaxed') { + $this->_headerCanon = 'relaxed'; + } else { + $this->_headerCanon = 'simple'; + } + + return $this; + } + + /** + * Set the signer identity. + * + * @param string $identity + * + * @return Swift_Signers_DKIMSigner + */ + public function setSignerIdentity($identity) + { + $this->_signerIdentity = $identity; + + return $this; + } + + /** + * Set the length of the body to sign. + * + * @param mixed $len (bool or int) + * + * @return Swift_Signers_DKIMSigner + */ + public function setBodySignedLen($len) + { + if ($len === true) { + $this->_showLen = true; + $this->_maxLen = PHP_INT_MAX; + } elseif ($len === false) { + $this->showLen = false; + $this->_maxLen = PHP_INT_MAX; + } else { + $this->_showLen = true; + $this->_maxLen = (int) $len; + } + + return $this; + } + + /** + * Set the signature timestamp. + * + * @param int $time A timestamp + * + * @return Swift_Signers_DKIMSigner + */ + public function setSignatureTimestamp($time) + { + $this->_signatureTimestamp = $time; + + return $this; + } + + /** + * Set the signature expiration timestamp. + * + * @param int $time A timestamp + * + * @return Swift_Signers_DKIMSigner + */ + public function setSignatureExpiration($time) + { + $this->_signatureExpiration = $time; + + return $this; + } + + /** + * Enable / disable the DebugHeaders. + * + * @param bool $debug + * + * @return Swift_Signers_DKIMSigner + */ + public function setDebugHeaders($debug) + { + $this->_debugHeaders = (bool) $debug; + + return $this; + } + + /** + * Start Body. + */ + public function startBody() + { + // Init + switch ($this->_hashAlgorithm) { + case 'rsa-sha256' : + $this->_bodyHashHandler = hash_init('sha256'); + break; + case 'rsa-sha1' : + $this->_bodyHashHandler = hash_init('sha1'); + break; + } + $this->_bodyCanonLine = ''; + } + + /** + * End Body. + */ + public function endBody() + { + $this->_endOfBody(); + } + + /** + * Returns the list of Headers Tampered by this plugin. + * + * @return array + */ + public function getAlteredHeaders() + { + if ($this->_debugHeaders) { + return array('DKIM-Signature', 'X-DebugHash'); + } else { + return array('DKIM-Signature'); + } + } + + /** + * Adds an ignored Header. + * + * @param string $header_name + * + * @return Swift_Signers_DKIMSigner + */ + public function ignoreHeader($header_name) + { + $this->_ignoredHeaders[strtolower($header_name)] = true; + + return $this; + } + + /** + * Set the headers to sign. + * + * @param Swift_Mime_HeaderSet $headers + * + * @return Swift_Signers_DKIMSigner + */ + public function setHeaders(Swift_Mime_HeaderSet $headers) + { + $this->_headerCanonData = ''; + // Loop through Headers + $listHeaders = $headers->listAll(); + foreach ($listHeaders as $hName) { + // Check if we need to ignore Header + if (!isset($this->_ignoredHeaders[strtolower($hName)])) { + if ($headers->has($hName)) { + $tmp = $headers->getAll($hName); + foreach ($tmp as $header) { + if ($header->getFieldBody() != '') { + $this->_addHeader($header->toString()); + $this->_signedHeaders[] = $header->getFieldName(); + } + } + } + } + } + + return $this; + } + + /** + * Add the signature to the given Headers. + * + * @param Swift_Mime_HeaderSet $headers + * + * @return Swift_Signers_DKIMSigner + */ + public function addSignature(Swift_Mime_HeaderSet $headers) + { + // Prepare the DKIM-Signature + $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector); + if ($this->_bodyCanon != 'simple') { + $params['c'] = $this->_headerCanon.'/'.$this->_bodyCanon; + } elseif ($this->_headerCanon != 'simple') { + $params['c'] = $this->_headerCanon; + } + if ($this->_showLen) { + $params['l'] = $this->_bodyLen; + } + if ($this->_signatureTimestamp === true) { + $params['t'] = time(); + if ($this->_signatureExpiration !== false) { + $params['x'] = $params['t'] + $this->_signatureExpiration; + } + } else { + if ($this->_signatureTimestamp !== false) { + $params['t'] = $this->_signatureTimestamp; + } + if ($this->_signatureExpiration !== false) { + $params['x'] = $this->_signatureExpiration; + } + } + if ($this->_debugHeaders) { + $params['z'] = implode('|', $this->_debugHeadersData); + } + $string = ''; + foreach ($params as $k => $v) { + $string .= $k.'='.$v.'; '; + } + $string = trim($string); + $headers->addTextHeader('DKIM-Signature', $string); + // Add the last DKIM-Signature + $tmp = $headers->getAll('DKIM-Signature'); + $this->_dkimHeader = end($tmp); + $this->_addHeader(trim($this->_dkimHeader->toString())."\r\n b=", true); + $this->_endOfHeaders(); + if ($this->_debugHeaders) { + $headers->addTextHeader('X-DebugHash', base64_encode($this->_headerHash)); + } + $this->_dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '))); + + return $this; + } + + /* Private helpers */ + + protected function _addHeader($header, $is_sig = false) + { + switch ($this->_headerCanon) { + case 'relaxed' : + // Prepare Header and cascade + $exploded = explode(':', $header, 2); + $name = strtolower(trim($exploded[0])); + $value = str_replace("\r\n", '', $exploded[1]); + $value = preg_replace("/[ \t][ \t]+/", ' ', $value); + $header = $name.':'.trim($value).($is_sig ? '' : "\r\n"); + case 'simple' : + // Nothing to do + } + $this->_addToHeaderHash($header); + } + + /** + * @deprecated This method is currently useless in this class but it must be + * kept for BC reasons due to its "protected" scope. This method + * might be overriden by custom client code. + */ + protected function _endOfHeaders() + { + } + + protected function _canonicalizeBody($string) + { + $len = strlen($string); + $canon = ''; + $method = ($this->_bodyCanon == 'relaxed'); + for ($i = 0; $i < $len; ++$i) { + if ($this->_bodyCanonIgnoreStart > 0) { + --$this->_bodyCanonIgnoreStart; + continue; + } + switch ($string[$i]) { + case "\r" : + $this->_bodyCanonLastChar = "\r"; + break; + case "\n" : + if ($this->_bodyCanonLastChar == "\r") { + if ($method) { + $this->_bodyCanonSpace = false; + } + if ($this->_bodyCanonLine == '') { + ++$this->_bodyCanonEmptyCounter; + } else { + $this->_bodyCanonLine = ''; + $canon .= "\r\n"; + } + } else { + // Wooops Error + // todo handle it but should never happen + } + break; + case ' ' : + case "\t" : + if ($method) { + $this->_bodyCanonSpace = true; + break; + } + default : + if ($this->_bodyCanonEmptyCounter > 0) { + $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); + $this->_bodyCanonEmptyCounter = 0; + } + if ($this->_bodyCanonSpace) { + $this->_bodyCanonLine .= ' '; + $canon .= ' '; + $this->_bodyCanonSpace = false; + } + $this->_bodyCanonLine .= $string[$i]; + $canon .= $string[$i]; + } + } + $this->_addToBodyHash($canon); + } + + protected function _endOfBody() + { + // Add trailing Line return if last line is non empty + if (strlen($this->_bodyCanonLine) > 0) { + $this->_addToBodyHash("\r\n"); + } + $this->_bodyHash = hash_final($this->_bodyHashHandler, true); + } + + private function _addToBodyHash($string) + { + $len = strlen($string); + if ($len > ($new_len = ($this->_maxLen - $this->_bodyLen))) { + $string = substr($string, 0, $new_len); + $len = $new_len; + } + hash_update($this->_bodyHashHandler, $string); + $this->_bodyLen += $len; + } + + private function _addToHeaderHash($header) + { + if ($this->_debugHeaders) { + $this->_debugHeadersData[] = trim($header); + } + $this->_headerCanonData .= $header; + } + + /** + * @throws Swift_SwiftException + * + * @return string + */ + private function _getEncryptedHash() + { + $signature = ''; + switch ($this->_hashAlgorithm) { + case 'rsa-sha1': + $algorithm = OPENSSL_ALGO_SHA1; + break; + case 'rsa-sha256': + $algorithm = OPENSSL_ALGO_SHA256; + break; + } + $pkeyId = openssl_get_privatekey($this->_privateKey); + if (!$pkeyId) { + throw new Swift_SwiftException('Unable to load DKIM Private Key ['.openssl_error_string().']'); + } + if (openssl_sign($this->_headerCanonData, $signature, $pkeyId, $algorithm)) { + return $signature; + } + throw new Swift_SwiftException('Unable to sign DKIM Hash ['.openssl_error_string().']'); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php new file mode 100644 index 00000000000..3f42d3f6e90 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php @@ -0,0 +1,525 @@ + + */ +class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner +{ + /** + * PrivateKey. + * + * @var string + */ + protected $_privateKey; + + /** + * DomainName. + * + * @var string + */ + protected $_domainName; + + /** + * Selector. + * + * @var string + */ + protected $_selector; + + /** + * Hash algorithm used. + * + * @var string + */ + protected $_hashAlgorithm = 'rsa-sha1'; + + /** + * Canonisation method. + * + * @var string + */ + protected $_canon = 'simple'; + + /** + * Headers not being signed. + * + * @var array + */ + protected $_ignoredHeaders = array(); + + /** + * Signer identity. + * + * @var string + */ + protected $_signerIdentity; + + /** + * Must we embed signed headers? + * + * @var bool + */ + protected $_debugHeaders = false; + + // work variables + /** + * Headers used to generate hash. + * + * @var array + */ + private $_signedHeaders = array(); + + /** + * Stores the signature header. + * + * @var Swift_Mime_Headers_ParameterizedHeader + */ + protected $_domainKeyHeader; + + /** + * Hash Handler. + * + * @var resource|null + */ + private $_hashHandler; + + private $_hash; + + private $_canonData = ''; + + private $_bodyCanonEmptyCounter = 0; + + private $_bodyCanonIgnoreStart = 2; + + private $_bodyCanonSpace = false; + + private $_bodyCanonLastChar = null; + + private $_bodyCanonLine = ''; + + private $_bound = array(); + + /** + * Constructor. + * + * @param string $privateKey + * @param string $domainName + * @param string $selector + */ + public function __construct($privateKey, $domainName, $selector) + { + $this->_privateKey = $privateKey; + $this->_domainName = $domainName; + $this->_signerIdentity = '@'.$domainName; + $this->_selector = $selector; + } + + /** + * Instanciate DomainKeySigner. + * + * @param string $privateKey + * @param string $domainName + * @param string $selector + * + * @return Swift_Signers_DomainKeySigner + */ + public static function newInstance($privateKey, $domainName, $selector) + { + return new static($privateKey, $domainName, $selector); + } + + /** + * Resets internal states. + * + * @return Swift_Signers_DomainKeySigner + */ + public function reset() + { + $this->_hash = null; + $this->_hashHandler = null; + $this->_bodyCanonIgnoreStart = 2; + $this->_bodyCanonEmptyCounter = 0; + $this->_bodyCanonLastChar = null; + $this->_bodyCanonSpace = false; + + return $this; + } + + /** + * Writes $bytes to the end of the stream. + * + * Writing may not happen immediately if the stream chooses to buffer. If + * you want to write these bytes with immediate effect, call {@link commit()} + * after calling write(). + * + * This method returns the sequence ID of the write (i.e. 1 for first, 2 for + * second, etc etc). + * + * @param string $bytes + * + * @throws Swift_IoException + * + * @return int + * @return Swift_Signers_DomainKeySigner + */ + public function write($bytes) + { + $this->_canonicalizeBody($bytes); + foreach ($this->_bound as $is) { + $is->write($bytes); + } + + return $this; + } + + /** + * For any bytes that are currently buffered inside the stream, force them + * off the buffer. + * + * @throws Swift_IoException + * + * @return Swift_Signers_DomainKeySigner + */ + public function commit() + { + // Nothing to do + return $this; + } + + /** + * Attach $is to this stream. + * The stream acts as an observer, receiving all data that is written. + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. + * + * @param Swift_InputByteStream $is + * + * @return Swift_Signers_DomainKeySigner + */ + public function bind(Swift_InputByteStream $is) + { + // Don't have to mirror anything + $this->_bound[] = $is; + + return $this; + } + + /** + * Remove an already bound stream. + * If $is is not bound, no errors will be raised. + * If the stream currently has any buffered data it will be written to $is + * before unbinding occurs. + * + * @param Swift_InputByteStream $is + * + * @return Swift_Signers_DomainKeySigner + */ + public function unbind(Swift_InputByteStream $is) + { + // Don't have to mirror anything + foreach ($this->_bound as $k => $stream) { + if ($stream === $is) { + unset($this->_bound[$k]); + + return; + } + } + + return $this; + } + + /** + * Flush the contents of the stream (empty it) and set the internal pointer + * to the beginning. + * + * @throws Swift_IoException + * + * @return Swift_Signers_DomainKeySigner + */ + public function flushBuffers() + { + $this->reset(); + + return $this; + } + + /** + * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256. + * + * @param string $hash + * + * @return Swift_Signers_DomainKeySigner + */ + public function setHashAlgorithm($hash) + { + $this->_hashAlgorithm = 'rsa-sha1'; + + return $this; + } + + /** + * Set the canonicalization algorithm. + * + * @param string $canon simple | nofws defaults to simple + * + * @return Swift_Signers_DomainKeySigner + */ + public function setCanon($canon) + { + if ($canon == 'nofws') { + $this->_canon = 'nofws'; + } else { + $this->_canon = 'simple'; + } + + return $this; + } + + /** + * Set the signer identity. + * + * @param string $identity + * + * @return Swift_Signers_DomainKeySigner + */ + public function setSignerIdentity($identity) + { + $this->_signerIdentity = $identity; + + return $this; + } + + /** + * Enable / disable the DebugHeaders. + * + * @param bool $debug + * + * @return Swift_Signers_DomainKeySigner + */ + public function setDebugHeaders($debug) + { + $this->_debugHeaders = (bool) $debug; + + return $this; + } + + /** + * Start Body. + */ + public function startBody() + { + } + + /** + * End Body. + */ + public function endBody() + { + $this->_endOfBody(); + } + + /** + * Returns the list of Headers Tampered by this plugin. + * + * @return array + */ + public function getAlteredHeaders() + { + if ($this->_debugHeaders) { + return array('DomainKey-Signature', 'X-DebugHash'); + } + + return array('DomainKey-Signature'); + } + + /** + * Adds an ignored Header. + * + * @param string $header_name + * + * @return Swift_Signers_DomainKeySigner + */ + public function ignoreHeader($header_name) + { + $this->_ignoredHeaders[strtolower($header_name)] = true; + + return $this; + } + + /** + * Set the headers to sign. + * + * @param Swift_Mime_HeaderSet $headers + * + * @return Swift_Signers_DomainKeySigner + */ + public function setHeaders(Swift_Mime_HeaderSet $headers) + { + $this->_startHash(); + $this->_canonData = ''; + // Loop through Headers + $listHeaders = $headers->listAll(); + foreach ($listHeaders as $hName) { + // Check if we need to ignore Header + if (!isset($this->_ignoredHeaders[strtolower($hName)])) { + if ($headers->has($hName)) { + $tmp = $headers->getAll($hName); + foreach ($tmp as $header) { + if ($header->getFieldBody() != '') { + $this->_addHeader($header->toString()); + $this->_signedHeaders[] = $header->getFieldName(); + } + } + } + } + } + $this->_endOfHeaders(); + + return $this; + } + + /** + * Add the signature to the given Headers. + * + * @param Swift_Mime_HeaderSet $headers + * + * @return Swift_Signers_DomainKeySigner + */ + public function addSignature(Swift_Mime_HeaderSet $headers) + { + // Prepare the DomainKey-Signature Header + $params = array('a' => $this->_hashAlgorithm, 'b' => chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '), 'c' => $this->_canon, 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'q' => 'dns', 's' => $this->_selector); + $string = ''; + foreach ($params as $k => $v) { + $string .= $k.'='.$v.'; '; + } + $string = trim($string); + $headers->addTextHeader('DomainKey-Signature', $string); + + return $this; + } + + /* Private helpers */ + + protected function _addHeader($header) + { + switch ($this->_canon) { + case 'nofws' : + // Prepare Header and cascade + $exploded = explode(':', $header, 2); + $name = strtolower(trim($exploded[0])); + $value = str_replace("\r\n", '', $exploded[1]); + $value = preg_replace("/[ \t][ \t]+/", ' ', $value); + $header = $name.':'.trim($value)."\r\n"; + case 'simple' : + // Nothing to do + } + $this->_addToHash($header); + } + + protected function _endOfHeaders() + { + $this->_bodyCanonEmptyCounter = 1; + } + + protected function _canonicalizeBody($string) + { + $len = strlen($string); + $canon = ''; + $nofws = ($this->_canon == 'nofws'); + for ($i = 0; $i < $len; ++$i) { + if ($this->_bodyCanonIgnoreStart > 0) { + --$this->_bodyCanonIgnoreStart; + continue; + } + switch ($string[$i]) { + case "\r" : + $this->_bodyCanonLastChar = "\r"; + break; + case "\n" : + if ($this->_bodyCanonLastChar == "\r") { + if ($nofws) { + $this->_bodyCanonSpace = false; + } + if ($this->_bodyCanonLine == '') { + ++$this->_bodyCanonEmptyCounter; + } else { + $this->_bodyCanonLine = ''; + $canon .= "\r\n"; + } + } else { + // Wooops Error + throw new Swift_SwiftException('Invalid new line sequence in mail found \n without preceding \r'); + } + break; + case ' ' : + case "\t" : + case "\x09": //HTAB + if ($nofws) { + $this->_bodyCanonSpace = true; + break; + } + default : + if ($this->_bodyCanonEmptyCounter > 0) { + $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); + $this->_bodyCanonEmptyCounter = 0; + } + $this->_bodyCanonLine .= $string[$i]; + $canon .= $string[$i]; + } + } + $this->_addToHash($canon); + } + + protected function _endOfBody() + { + if (strlen($this->_bodyCanonLine) > 0) { + $this->_addToHash("\r\n"); + } + $this->_hash = hash_final($this->_hashHandler, true); + } + + private function _addToHash($string) + { + $this->_canonData .= $string; + hash_update($this->_hashHandler, $string); + } + + private function _startHash() + { + // Init + switch ($this->_hashAlgorithm) { + case 'rsa-sha1' : + $this->_hashHandler = hash_init('sha1'); + break; + } + $this->_canonLine = ''; + } + + /** + * @throws Swift_SwiftException + * + * @return string + */ + private function _getEncryptedHash() + { + $signature = ''; + $pkeyId = openssl_get_privatekey($this->_privateKey); + if (!$pkeyId) { + throw new Swift_SwiftException('Unable to load DomainKey Private Key ['.openssl_error_string().']'); + } + if (openssl_sign($this->_canonData, $signature, $pkeyId, OPENSSL_ALGO_SHA1)) { + return $signature; + } + throw new Swift_SwiftException('Unable to sign DomainKey Hash ['.openssl_error_string().']'); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php new file mode 100644 index 00000000000..c75cb08a518 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php @@ -0,0 +1,65 @@ + + */ +interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream +{ + /** + * Exclude an header from the signed headers. + * + * @param string $header_name + * + * @return Swift_Signers_HeaderSigner + */ + public function ignoreHeader($header_name); + + /** + * Prepare the Signer to get a new Body. + * + * @return Swift_Signers_HeaderSigner + */ + public function startBody(); + + /** + * Give the signal that the body has finished streaming. + * + * @return Swift_Signers_HeaderSigner + */ + public function endBody(); + + /** + * Give the headers already given. + * + * @param Swift_Mime_SimpleHeaderSet $headers + * + * @return Swift_Signers_HeaderSigner + */ + public function setHeaders(Swift_Mime_HeaderSet $headers); + + /** + * Add the header(s) to the headerSet. + * + * @param Swift_Mime_HeaderSet $headers + * + * @return Swift_Signers_HeaderSigner + */ + public function addSignature(Swift_Mime_HeaderSet $headers); + + /** + * Return the list of header a signer might tamper. + * + * @return array + */ + public function getAlteredHeaders(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php new file mode 100644 index 00000000000..3a35ad55d07 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php @@ -0,0 +1,190 @@ + + */ +class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner +{ + private $_peclLoaded = false; + + private $_dkimHandler = null; + + private $dropFirstLF = true; + + const CANON_RELAXED = 1; + const CANON_SIMPLE = 2; + const SIG_RSA_SHA1 = 3; + const SIG_RSA_SHA256 = 4; + + public function __construct($privateKey, $domainName, $selector) + { + if (!extension_loaded('opendkim')) { + throw new Swift_SwiftException('php-opendkim extension not found'); + } + + $this->_peclLoaded = true; + + parent::__construct($privateKey, $domainName, $selector); + } + + public static function newInstance($privateKey, $domainName, $selector) + { + return new static($privateKey, $domainName, $selector); + } + + public function addSignature(Swift_Mime_HeaderSet $headers) + { + $header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature'); + $headerVal = $this->_dkimHandler->getSignatureHeader(); + if (!$headerVal) { + throw new Swift_SwiftException('OpenDKIM Error: '.$this->_dkimHandler->getError()); + } + $header->setValue($headerVal); + $headers->set($header); + + return $this; + } + + public function setHeaders(Swift_Mime_HeaderSet $headers) + { + $bodyLen = $this->_bodyLen; + if (is_bool($bodyLen)) { + $bodyLen = -1; + } + $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; + $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen); + // Hardcode signature Margin for now + $this->_dkimHandler->setMargin(78); + + if (!is_numeric($this->_signatureTimestamp)) { + OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time()); + } else { + if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->_signatureTimestamp)) { + throw new Swift_SwiftException('Unable to force signature timestamp ['.openssl_error_string().']'); + } + } + if (isset($this->_signerIdentity)) { + $this->_dkimHandler->setSigner($this->_signerIdentity); + } + $listHeaders = $headers->listAll(); + foreach ($listHeaders as $hName) { + // Check if we need to ignore Header + if (!isset($this->_ignoredHeaders[strtolower($hName)])) { + $tmp = $headers->getAll($hName); + if ($headers->has($hName)) { + foreach ($tmp as $header) { + if ($header->getFieldBody() != '') { + $htosign = $header->toString(); + $this->_dkimHandler->header($htosign); + $this->_signedHeaders[] = $header->getFieldName(); + } + } + } + } + } + + return $this; + } + + public function startBody() + { + if (!$this->_peclLoaded) { + return parent::startBody(); + } + $this->dropFirstLF = true; + $this->_dkimHandler->eoh(); + + return $this; + } + + public function endBody() + { + if (!$this->_peclLoaded) { + return parent::endBody(); + } + $this->_dkimHandler->eom(); + + return $this; + } + + public function reset() + { + $this->_dkimHandler = null; + parent::reset(); + + return $this; + } + + /** + * Set the signature timestamp. + * + * @param int $time + * + * @return Swift_Signers_DKIMSigner + */ + public function setSignatureTimestamp($time) + { + $this->_signatureTimestamp = $time; + + return $this; + } + + /** + * Set the signature expiration timestamp. + * + * @param int $time + * + * @return Swift_Signers_DKIMSigner + */ + public function setSignatureExpiration($time) + { + $this->_signatureExpiration = $time; + + return $this; + } + + /** + * Enable / disable the DebugHeaders. + * + * @param bool $debug + * + * @return Swift_Signers_DKIMSigner + */ + public function setDebugHeaders($debug) + { + $this->_debugHeaders = (bool) $debug; + + return $this; + } + + // Protected + + protected function _canonicalizeBody($string) + { + if (!$this->_peclLoaded) { + return parent::_canonicalizeBody($string); + } + if (false && $this->dropFirstLF === true) { + if ($string[0] == "\r" && $string[1] == "\n") { + $string = substr($string, 2); + } + } + $this->dropFirstLF = false; + if (strlen($string)) { + $this->_dkimHandler->body($string); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php new file mode 100644 index 00000000000..b267099a860 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php @@ -0,0 +1,436 @@ + + */ +class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner +{ + protected $signCertificate; + protected $signPrivateKey; + protected $encryptCert; + protected $signThenEncrypt = true; + protected $signLevel; + protected $encryptLevel; + protected $signOptions; + protected $encryptOptions; + protected $encryptCipher; + protected $extraCerts = null; + + /** + * @var Swift_StreamFilters_StringReplacementFilterFactory + */ + protected $replacementFactory; + + /** + * @var Swift_Mime_HeaderFactory + */ + protected $headerFactory; + + /** + * Constructor. + * + * @param string|null $signCertificate + * @param string|null $signPrivateKey + * @param string|null $encryptCertificate + */ + public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null) + { + if (null !== $signPrivateKey) { + $this->setSignCertificate($signCertificate, $signPrivateKey); + } + + if (null !== $encryptCertificate) { + $this->setEncryptCertificate($encryptCertificate); + } + + $this->replacementFactory = Swift_DependencyContainer::getInstance() + ->lookup('transport.replacementfactory'); + + $this->signOptions = PKCS7_DETACHED; + + // Supported since php5.4 + if (defined('OPENSSL_CIPHER_AES_128_CBC')) { + $this->encryptCipher = OPENSSL_CIPHER_AES_128_CBC; + } else { + $this->encryptCipher = OPENSSL_CIPHER_RC2_128; + } + } + + /** + * Returns an new Swift_Signers_SMimeSigner instance. + * + * @param string $certificate + * @param string $privateKey + * + * @return Swift_Signers_SMimeSigner + */ + public static function newInstance($certificate = null, $privateKey = null) + { + return new self($certificate, $privateKey); + } + + /** + * Set the certificate location to use for signing. + * + * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php + * + * @param string $certificate + * @param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead + * @param int $signOptions Bitwise operator options for openssl_pkcs7_sign() + * @param string $extraCerts A file containing intermediate certificates needed by the signing certificate + * + * @return Swift_Signers_SMimeSigner + */ + public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) + { + $this->signCertificate = 'file://'.str_replace('\\', '/', realpath($certificate)); + + if (null !== $privateKey) { + if (is_array($privateKey)) { + $this->signPrivateKey = $privateKey; + $this->signPrivateKey[0] = 'file://'.str_replace('\\', '/', realpath($privateKey[0])); + } else { + $this->signPrivateKey = 'file://'.str_replace('\\', '/', realpath($privateKey)); + } + } + + $this->signOptions = $signOptions; + if (null !== $extraCerts) { + $this->extraCerts = str_replace('\\', '/', realpath($extraCerts)); + } + + return $this; + } + + /** + * Set the certificate location to use for encryption. + * + * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php + * @link http://nl3.php.net/manual/en/openssl.ciphers.php + * + * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates. + * @param int $cipher + * + * @return Swift_Signers_SMimeSigner + */ + public function setEncryptCertificate($recipientCerts, $cipher = null) + { + if (is_array($recipientCerts)) { + $this->encryptCert = array(); + + foreach ($recipientCerts as $cert) { + $this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert)); + } + } else { + $this->encryptCert = 'file://'.str_replace('\\', '/', realpath($recipientCerts)); + } + + if (null !== $cipher) { + $this->encryptCipher = $cipher; + } + + return $this; + } + + /** + * @return string + */ + public function getSignCertificate() + { + return $this->signCertificate; + } + + /** + * @return string + */ + public function getSignPrivateKey() + { + return $this->signPrivateKey; + } + + /** + * Set perform signing before encryption. + * + * The default is to first sign the message and then encrypt. + * But some older mail clients, namely Microsoft Outlook 2000 will work when the message first encrypted. + * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients. + * + * @param bool $signThenEncrypt + * + * @return Swift_Signers_SMimeSigner + */ + public function setSignThenEncrypt($signThenEncrypt = true) + { + $this->signThenEncrypt = $signThenEncrypt; + + return $this; + } + + /** + * @return bool + */ + public function isSignThenEncrypt() + { + return $this->signThenEncrypt; + } + + /** + * Resets internal states. + * + * @return Swift_Signers_SMimeSigner + */ + public function reset() + { + return $this; + } + + /** + * Change the Swift_Message to apply the signing. + * + * @param Swift_Message $message + * + * @return Swift_Signers_SMimeSigner + */ + public function signMessage(Swift_Message $message) + { + if (null === $this->signCertificate && null === $this->encryptCert) { + return $this; + } + + // Store the message using ByteStream to a file{1} + // Remove all Children + // Sign file{1}, parse the new MIME headers and set them on the primary MimeEntity + // Set the singed-body as the new body (without boundary) + + $messageStream = new Swift_ByteStream_TemporaryFileByteStream(); + $this->toSMimeByteStream($messageStream, $message); + $message->setEncoder(Swift_DependencyContainer::getInstance()->lookup('mime.rawcontentencoder')); + + $message->setChildren(array()); + $this->streamToMime($messageStream, $message); + } + + /** + * Return the list of header a signer might tamper. + * + * @return array + */ + public function getAlteredHeaders() + { + return array('Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition'); + } + + /** + * @param Swift_InputByteStream $inputStream + * @param Swift_Message $mimeEntity + */ + protected function toSMimeByteStream(Swift_InputByteStream $inputStream, Swift_Message $message) + { + $mimeEntity = $this->createMessage($message); + $messageStream = new Swift_ByteStream_TemporaryFileByteStream(); + + $mimeEntity->toByteStream($messageStream); + $messageStream->commit(); + + if (null !== $this->signCertificate && null !== $this->encryptCert) { + $temporaryStream = new Swift_ByteStream_TemporaryFileByteStream(); + + if ($this->signThenEncrypt) { + $this->messageStreamToSignedByteStream($messageStream, $temporaryStream); + $this->messageStreamToEncryptedByteStream($temporaryStream, $inputStream); + } else { + $this->messageStreamToEncryptedByteStream($messageStream, $temporaryStream); + $this->messageStreamToSignedByteStream($temporaryStream, $inputStream); + } + } elseif ($this->signCertificate !== null) { + $this->messageStreamToSignedByteStream($messageStream, $inputStream); + } else { + $this->messageStreamToEncryptedByteStream($messageStream, $inputStream); + } + } + + /** + * @param Swift_Message $message + * + * @return Swift_Message + */ + protected function createMessage(Swift_Message $message) + { + $mimeEntity = new Swift_Message('', $message->getBody(), $message->getContentType(), $message->getCharset()); + $mimeEntity->setChildren($message->getChildren()); + + $messageHeaders = $mimeEntity->getHeaders(); + $messageHeaders->remove('Message-ID'); + $messageHeaders->remove('Date'); + $messageHeaders->remove('Subject'); + $messageHeaders->remove('MIME-Version'); + $messageHeaders->remove('To'); + $messageHeaders->remove('From'); + + return $mimeEntity; + } + + /** + * @param Swift_FileStream $outputStream + * @param Swift_InputByteStream $inputStream + * + * @throws Swift_IoException + */ + protected function messageStreamToSignedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $inputStream) + { + $signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream(); + + $args = array($outputStream->getPath(), $signedMessageStream->getPath(), $this->signCertificate, $this->signPrivateKey, array(), $this->signOptions); + if (null !== $this->extraCerts) { + $args[] = $this->extraCerts; + } + + if (!call_user_func_array('openssl_pkcs7_sign', $args)) { + throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string())); + } + + $this->copyFromOpenSSLOutput($signedMessageStream, $inputStream); + } + + /** + * @param Swift_FileStream $outputStream + * @param Swift_InputByteStream $is + * + * @throws Swift_IoException + */ + protected function messageStreamToEncryptedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $is) + { + $encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream(); + + if (!openssl_pkcs7_encrypt($outputStream->getPath(), $encryptedMessageStream->getPath(), $this->encryptCert, array(), 0, $this->encryptCipher)) { + throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string())); + } + + $this->copyFromOpenSSLOutput($encryptedMessageStream, $is); + } + + /** + * @param Swift_OutputByteStream $fromStream + * @param Swift_InputByteStream $toStream + */ + protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream) + { + $bufferLength = 4096; + $filteredStream = new Swift_ByteStream_TemporaryFileByteStream(); + $filteredStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF'); + $filteredStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF'); + + while (false !== ($buffer = $fromStream->read($bufferLength))) { + $filteredStream->write($buffer); + } + + $filteredStream->flushBuffers(); + + while (false !== ($buffer = $filteredStream->read($bufferLength))) { + $toStream->write($buffer); + } + + $toStream->commit(); + } + + /** + * Merges an OutputByteStream to Swift_Message. + * + * @param Swift_OutputByteStream $fromStream + * @param Swift_Message $message + */ + protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message) + { + $bufferLength = 78; + $headerData = ''; + + $fromStream->setReadPointer(0); + + while (($buffer = $fromStream->read($bufferLength)) !== false) { + $headerData .= $buffer; + + if (false !== strpos($buffer, "\r\n\r\n")) { + break; + } + } + + $headersPosEnd = strpos($headerData, "\r\n\r\n"); + $headerData = trim($headerData); + $headerData = substr($headerData, 0, $headersPosEnd); + $headerLines = explode("\r\n", $headerData); + unset($headerData); + + $headers = array(); + $currentHeaderName = ''; + + foreach ($headerLines as $headerLine) { + // Line separated + if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) { + $headers[$currentHeaderName] .= ' '.trim($headerLine); + continue; + } + + $header = explode(':', $headerLine, 2); + $currentHeaderName = strtolower($header[0]); + $headers[$currentHeaderName] = trim($header[1]); + } + + $messageStream = new Swift_ByteStream_TemporaryFileByteStream(); + $messageStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF'); + $messageStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF'); + + $messageHeaders = $message->getHeaders(); + + // No need to check for 'application/pkcs7-mime', as this is always base64 + if ('multipart/signed;' === substr($headers['content-type'], 0, 17)) { + if (!preg_match('/boundary=("[^"]+"|(?:[^\s]+|$))/is', $headers['content-type'], $contentTypeData)) { + throw new Swift_SwiftException('Failed to find Boundary parameter'); + } + + $boundary = trim($contentTypeData['1'], '"'); + + // Skip the header and CRLF CRLF + $fromStream->setReadPointer($headersPosEnd + 4); + + while (false !== ($buffer = $fromStream->read($bufferLength))) { + $messageStream->write($buffer); + } + + $messageStream->commit(); + + $messageHeaders->remove('Content-Transfer-Encoding'); + $message->setContentType($headers['content-type']); + $message->setBoundary($boundary); + $message->setBody($messageStream); + } else { + $fromStream->setReadPointer($headersPosEnd + 4); + + if (null === $this->headerFactory) { + $this->headerFactory = Swift_DependencyContainer::getInstance()->lookup('mime.headerfactory'); + } + + $message->setContentType($headers['content-type']); + $messageHeaders->set($this->headerFactory->createTextHeader('Content-Transfer-Encoding', $headers['content-transfer-encoding'])); + $messageHeaders->set($this->headerFactory->createTextHeader('Content-Disposition', $headers['content-disposition'])); + + while (false !== ($buffer = $fromStream->read($bufferLength))) { + $messageStream->write($buffer); + } + + $messageStream->commit(); + $message->setBody($messageStream); + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php new file mode 100644 index 00000000000..62516114019 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php @@ -0,0 +1,58 @@ +createDependenciesFor('transport.smtp') + ); + + $this->setHost($host); + $this->setPort($port); + $this->setEncryption($security); + } + + /** + * Create a new SmtpTransport instance. + * + * @param string $host + * @param int $port + * @param string $security + * + * @return Swift_SmtpTransport + */ + public static function newInstance($host = 'localhost', $port = 25, $security = null) + { + return new self($host, $port, $security); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Spool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Spool.php new file mode 100644 index 00000000000..c16ab4b38eb --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Spool.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Interface for spools. + * + * @author Fabien Potencier + */ +interface Swift_Spool +{ + /** + * Starts this Spool mechanism. + */ + public function start(); + + /** + * Stops this Spool mechanism. + */ + public function stop(); + + /** + * Tests if this Spool mechanism has started. + * + * @return bool + */ + public function isStarted(); + + /** + * Queues a message. + * + * @param Swift_Mime_Message $message The message to store + * + * @return bool Whether the operation has succeeded + */ + public function queueMessage(Swift_Mime_Message $message); + + /** + * Sends messages using the given transport instance. + * + * @param Swift_Transport $transport A transport instance + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int The number of sent emails + */ + public function flushQueue(Swift_Transport $transport, &$failedRecipients = null); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php new file mode 100644 index 00000000000..cf9bf78fb8f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Stores Messages in a queue. + * + * @author Fabien Potencier + */ +class Swift_SpoolTransport extends Swift_Transport_SpoolTransport +{ + /** + * Create a new SpoolTransport. + * + * @param Swift_Spool $spool + */ + public function __construct(Swift_Spool $spool) + { + $arguments = Swift_DependencyContainer::getInstance() + ->createDependenciesFor('transport.spool'); + + $arguments[] = $spool; + + call_user_func_array( + array($this, 'Swift_Transport_SpoolTransport::__construct'), + $arguments + ); + } + + /** + * Create a new SpoolTransport instance. + * + * @param Swift_Spool $spool + * + * @return Swift_SpoolTransport + */ + public static function newInstance(Swift_Spool $spool) + { + return new self($spool); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilter.php new file mode 100644 index 00000000000..362be2e8d47 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilter.php @@ -0,0 +1,35 @@ +_search = $search; + $this->_index = array(); + $this->_tree = array(); + $this->_replace = array(); + $this->_repSize = array(); + + $tree = null; + $i = null; + $last_size = $size = 0; + foreach ($search as $i => $search_element) { + if ($tree !== null) { + $tree[-1] = min(count($replace) - 1, $i - 1); + $tree[-2] = $last_size; + } + $tree = &$this->_tree; + if (is_array($search_element)) { + foreach ($search_element as $k => $char) { + $this->_index[$char] = true; + if (!isset($tree[$char])) { + $tree[$char] = array(); + } + $tree = &$tree[$char]; + } + $last_size = $k + 1; + $size = max($size, $last_size); + } else { + $last_size = 1; + if (!isset($tree[$search_element])) { + $tree[$search_element] = array(); + } + $tree = &$tree[$search_element]; + $size = max($last_size, $size); + $this->_index[$search_element] = true; + } + } + if ($i !== null) { + $tree[-1] = min(count($replace) - 1, $i); + $tree[-2] = $last_size; + $this->_treeMaxLen = $size; + } + foreach ($replace as $rep) { + if (!is_array($rep)) { + $rep = array($rep); + } + $this->_replace[] = $rep; + } + for ($i = count($this->_replace) - 1; $i >= 0; --$i) { + $this->_replace[$i] = $rep = $this->filter($this->_replace[$i], $i); + $this->_repSize[$i] = count($rep); + } + } + + /** + * Returns true if based on the buffer passed more bytes should be buffered. + * + * @param array $buffer + * + * @return bool + */ + public function shouldBuffer($buffer) + { + $endOfBuffer = end($buffer); + + return isset($this->_index[$endOfBuffer]); + } + + /** + * Perform the actual replacements on $buffer and return the result. + * + * @param array $buffer + * @param int $_minReplaces + * + * @return array + */ + public function filter($buffer, $_minReplaces = -1) + { + if ($this->_treeMaxLen == 0) { + return $buffer; + } + + $newBuffer = array(); + $buf_size = count($buffer); + for ($i = 0; $i < $buf_size; ++$i) { + $search_pos = $this->_tree; + $last_found = PHP_INT_MAX; + // We try to find if the next byte is part of a search pattern + for ($j = 0; $j <= $this->_treeMaxLen; ++$j) { + // We have a new byte for a search pattern + if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) { + $search_pos = $search_pos[$buffer[$p]]; + // We have a complete pattern, save, in case we don't find a better match later + if (isset($search_pos[-1]) && $search_pos[-1] < $last_found + && $search_pos[-1] > $_minReplaces) { + $last_found = $search_pos[-1]; + $last_size = $search_pos[-2]; + } + } + // We got a complete pattern + elseif ($last_found !== PHP_INT_MAX) { + // Adding replacement datas to output buffer + $rep_size = $this->_repSize[$last_found]; + for ($j = 0; $j < $rep_size; ++$j) { + $newBuffer[] = $this->_replace[$last_found][$j]; + } + // We Move cursor forward + $i += $last_size - 1; + // Edge Case, last position in buffer + if ($i >= $buf_size) { + $newBuffer[] = $buffer[$i]; + } + + // We start the next loop + continue 2; + } else { + // this byte is not in a pattern and we haven't found another pattern + break; + } + } + // Normal byte, move it to output buffer + $newBuffer[] = $buffer[$i]; + } + + return $newBuffer; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php new file mode 100644 index 00000000000..d0db8b96197 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php @@ -0,0 +1,66 @@ +_search = $search; + $this->_replace = $replace; + } + + /** + * Returns true if based on the buffer passed more bytes should be buffered. + * + * @param string $buffer + * + * @return bool + */ + public function shouldBuffer($buffer) + { + $endOfBuffer = substr($buffer, -1); + foreach ((array) $this->_search as $needle) { + if (false !== strpos($needle, $endOfBuffer)) { + return true; + } + } + + return false; + } + + /** + * Perform the actual replacements on $buffer and return the result. + * + * @param string $buffer + * + * @return string + */ + public function filter($buffer) + { + return str_replace($this->_search, $this->_replace, $buffer); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php new file mode 100644 index 00000000000..e98240b5bc5 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php @@ -0,0 +1,45 @@ +_filters[$search][$replace])) { + if (!isset($this->_filters[$search])) { + $this->_filters[$search] = array(); + } + + if (!isset($this->_filters[$search][$replace])) { + $this->_filters[$search][$replace] = array(); + } + + $this->_filters[$search][$replace] = new Swift_StreamFilters_StringReplacementFilter($search, $replace); + } + + return $this->_filters[$search][$replace]; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php new file mode 100644 index 00000000000..db3d31093ef --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php @@ -0,0 +1,29 @@ +_eventDispatcher = $dispatcher; + $this->_buffer = $buf; + $this->_lookupHostname(); + } + + /** + * Set the name of the local domain which Swift will identify itself as. + * + * This should be a fully-qualified domain name and should be truly the domain + * you're using. + * + * If your server doesn't have a domain name, use the IP in square + * brackets (i.e. [127.0.0.1]). + * + * @param string $domain + * + * @return Swift_Transport_AbstractSmtpTransport + */ + public function setLocalDomain($domain) + { + $this->_domain = $domain; + + return $this; + } + + /** + * Get the name of the domain Swift will identify as. + * + * @return string + */ + public function getLocalDomain() + { + return $this->_domain; + } + + /** + * Sets the source IP. + * + * @param string $source + */ + public function setSourceIp($source) + { + $this->_sourceIp = $source; + } + + /** + * Returns the IP used to connect to the destination. + * + * @return string + */ + public function getSourceIp() + { + return $this->_sourceIp; + } + + /** + * Start the SMTP connection. + */ + public function start() + { + if (!$this->_started) { + if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted'); + if ($evt->bubbleCancelled()) { + return; + } + } + + try { + $this->_buffer->initialize($this->_getBufferParams()); + } catch (Swift_TransportException $e) { + $this->_throwException($e); + } + $this->_readGreeting(); + $this->_doHeloCommand(); + + if ($evt) { + $this->_eventDispatcher->dispatchEvent($evt, 'transportStarted'); + } + + $this->_started = true; + } + } + + /** + * Test if an SMTP connection has been established. + * + * @return bool + */ + public function isStarted() + { + return $this->_started; + } + + /** + * Send the given Message. + * + * Recipient/sender data will be retrieved from the Message API. + * The return value is the number of recipients who were accepted for delivery. + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $sent = 0; + $failedRecipients = (array) $failedRecipients; + + if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); + if ($evt->bubbleCancelled()) { + return 0; + } + } + + if (!$reversePath = $this->_getReversePath($message)) { + $this->_throwException(new Swift_TransportException( + 'Cannot send message without a sender address' + ) + ); + } + + $to = (array) $message->getTo(); + $cc = (array) $message->getCc(); + $tos = array_merge($to, $cc); + $bcc = (array) $message->getBcc(); + + $message->setBcc(array()); + + try { + $sent += $this->_sendTo($message, $reversePath, $tos, $failedRecipients); + $sent += $this->_sendBcc($message, $reversePath, $bcc, $failedRecipients); + } catch (Exception $e) { + $message->setBcc($bcc); + throw $e; + } + + $message->setBcc($bcc); + + if ($evt) { + if ($sent == count($to) + count($cc) + count($bcc)) { + $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); + } elseif ($sent > 0) { + $evt->setResult(Swift_Events_SendEvent::RESULT_TENTATIVE); + } else { + $evt->setResult(Swift_Events_SendEvent::RESULT_FAILED); + } + $evt->setFailedRecipients($failedRecipients); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + $message->generateId(); //Make sure a new Message ID is used + + return $sent; + } + + /** + * Stop the SMTP connection. + */ + public function stop() + { + if ($this->_started) { + if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped'); + if ($evt->bubbleCancelled()) { + return; + } + } + + try { + $this->executeCommand("QUIT\r\n", array(221)); + } catch (Swift_TransportException $e) { + } + + try { + $this->_buffer->terminate(); + + if ($evt) { + $this->_eventDispatcher->dispatchEvent($evt, 'transportStopped'); + } + } catch (Swift_TransportException $e) { + $this->_throwException($e); + } + } + $this->_started = false; + } + + /** + * Register a plugin. + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_eventDispatcher->bindEventListener($plugin); + } + + /** + * Reset the current mail transaction. + */ + public function reset() + { + $this->executeCommand("RSET\r\n", array(250)); + } + + /** + * Get the IoBuffer where read/writes are occurring. + * + * @return Swift_Transport_IoBuffer + */ + public function getBuffer() + { + return $this->_buffer; + } + + /** + * Run a command against the buffer, expecting the given response codes. + * + * If no response codes are given, the response will not be validated. + * If codes are given, an exception will be thrown on an invalid response. + * + * @param string $command + * @param int[] $codes + * @param string[] $failures An array of failures by-reference + * + * @return string + */ + public function executeCommand($command, $codes = array(), &$failures = null) + { + $failures = (array) $failures; + $seq = $this->_buffer->write($command); + $response = $this->_getFullResponse($seq); + if ($evt = $this->_eventDispatcher->createCommandEvent($this, $command, $codes)) { + $this->_eventDispatcher->dispatchEvent($evt, 'commandSent'); + } + $this->_assertResponseCode($response, $codes); + + return $response; + } + + /** Read the opening SMTP greeting */ + protected function _readGreeting() + { + $this->_assertResponseCode($this->_getFullResponse(0), array(220)); + } + + /** Send the HELO welcome */ + protected function _doHeloCommand() + { + $this->executeCommand( + sprintf("HELO %s\r\n", $this->_domain), array(250) + ); + } + + /** Send the MAIL FROM command */ + protected function _doMailFromCommand($address) + { + $this->executeCommand( + sprintf("MAIL FROM:<%s>\r\n", $address), array(250) + ); + } + + /** Send the RCPT TO command */ + protected function _doRcptToCommand($address) + { + $this->executeCommand( + sprintf("RCPT TO:<%s>\r\n", $address), array(250, 251, 252) + ); + } + + /** Send the DATA command */ + protected function _doDataCommand() + { + $this->executeCommand("DATA\r\n", array(354)); + } + + /** Stream the contents of the message over the buffer */ + protected function _streamMessage(Swift_Mime_Message $message) + { + $this->_buffer->setWriteTranslations(array("\r\n." => "\r\n..")); + try { + $message->toByteStream($this->_buffer); + $this->_buffer->flushBuffers(); + } catch (Swift_TransportException $e) { + $this->_throwException($e); + } + $this->_buffer->setWriteTranslations(array()); + $this->executeCommand("\r\n.\r\n", array(250)); + } + + /** Determine the best-use reverse path for this message */ + protected function _getReversePath(Swift_Mime_Message $message) + { + $return = $message->getReturnPath(); + $sender = $message->getSender(); + $from = $message->getFrom(); + $path = null; + if (!empty($return)) { + $path = $return; + } elseif (!empty($sender)) { + // Don't use array_keys + reset($sender); // Reset Pointer to first pos + $path = key($sender); // Get key + } elseif (!empty($from)) { + reset($from); // Reset Pointer to first pos + $path = key($from); // Get key + } + + return $path; + } + + /** Throw a TransportException, first sending it to any listeners */ + protected function _throwException(Swift_TransportException $e) + { + if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) { + $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown'); + if (!$evt->bubbleCancelled()) { + throw $e; + } + } else { + throw $e; + } + } + + /** Throws an Exception if a response code is incorrect */ + protected function _assertResponseCode($response, $wanted) + { + list($code) = sscanf($response, '%3d'); + $valid = (empty($wanted) || in_array($code, $wanted)); + + if ($evt = $this->_eventDispatcher->createResponseEvent($this, $response, + $valid)) { + $this->_eventDispatcher->dispatchEvent($evt, 'responseReceived'); + } + + if (!$valid) { + $this->_throwException( + new Swift_TransportException( + 'Expected response code '.implode('/', $wanted).' but got code '. + '"'.$code.'", with message "'.$response.'"', + $code) + ); + } + } + + /** Get an entire multi-line response using its sequence number */ + protected function _getFullResponse($seq) + { + $response = ''; + try { + do { + $line = $this->_buffer->readLine($seq); + $response .= $line; + } while (null !== $line && false !== $line && ' ' != $line{3}); + } catch (Swift_TransportException $e) { + $this->_throwException($e); + } catch (Swift_IoException $e) { + $this->_throwException( + new Swift_TransportException( + $e->getMessage()) + ); + } + + return $response; + } + + /** Send an email to the given recipients from the given reverse path */ + private function _doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients) + { + $sent = 0; + $this->_doMailFromCommand($reversePath); + foreach ($recipients as $forwardPath) { + try { + $this->_doRcptToCommand($forwardPath); + ++$sent; + } catch (Swift_TransportException $e) { + $failedRecipients[] = $forwardPath; + } + } + + if ($sent != 0) { + $this->_doDataCommand(); + $this->_streamMessage($message); + } else { + $this->reset(); + } + + return $sent; + } + + /** Send a message to the given To: recipients */ + private function _sendTo(Swift_Mime_Message $message, $reversePath, array $to, array &$failedRecipients) + { + if (empty($to)) { + return 0; + } + + return $this->_doMailTransaction($message, $reversePath, array_keys($to), + $failedRecipients); + } + + /** Send a message to all Bcc: recipients */ + private function _sendBcc(Swift_Mime_Message $message, $reversePath, array $bcc, array &$failedRecipients) + { + $sent = 0; + foreach ($bcc as $forwardPath => $name) { + $message->setBcc(array($forwardPath => $name)); + $sent += $this->_doMailTransaction( + $message, $reversePath, array($forwardPath), $failedRecipients + ); + } + + return $sent; + } + + /** Try to determine the hostname of the server this is run on */ + private function _lookupHostname() + { + if (!empty($_SERVER['SERVER_NAME']) + && $this->_isFqdn($_SERVER['SERVER_NAME'])) { + $this->_domain = $_SERVER['SERVER_NAME']; + } elseif (!empty($_SERVER['SERVER_ADDR'])) { + $this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']); + } + } + + /** Determine is the $hostname is a fully-qualified name */ + private function _isFqdn($hostname) + { + // We could do a really thorough check, but there's really no point + if (false !== $dotPos = strpos($hostname, '.')) { + return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1); + } + + return false; + } + + /** + * Destructor. + */ + public function __destruct() + { + $this->stop(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php new file mode 100644 index 00000000000..53f721d03c6 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php @@ -0,0 +1,81 @@ +executeCommand("AUTH CRAM-MD5\r\n", array(334)); + $challenge = base64_decode(substr($challenge, 4)); + $message = base64_encode( + $username.' '.$this->_getResponse($password, $challenge) + ); + $agent->executeCommand(sprintf("%s\r\n", $message), array(235)); + + return true; + } catch (Swift_TransportException $e) { + $agent->executeCommand("RSET\r\n", array(250)); + + return false; + } + } + + /** + * Generate a CRAM-MD5 response from a server challenge. + * + * @param string $secret + * @param string $challenge + * + * @return string + */ + private function _getResponse($secret, $challenge) + { + if (strlen($secret) > 64) { + $secret = pack('H32', md5($secret)); + } + + if (strlen($secret) < 64) { + $secret = str_pad($secret, 64, chr(0)); + } + + $k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64); + $k_opad = substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64); + + $inner = pack('H32', md5($k_ipad.$challenge)); + $digest = md5($k_opad.$inner); + + return $digest; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php new file mode 100644 index 00000000000..6ab6e3337e2 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php @@ -0,0 +1,51 @@ +executeCommand("AUTH LOGIN\r\n", array(334)); + $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), array(334)); + $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), array(235)); + + return true; + } catch (Swift_TransportException $e) { + $agent->executeCommand("RSET\r\n", array(250)); + + return false; + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php new file mode 100644 index 00000000000..d8331316963 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php @@ -0,0 +1,726 @@ + + */ +class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Esmtp_Authenticator +{ + const NTLMSIG = "NTLMSSP\x00"; + const DESCONST = 'KGS!@#$%'; + + /** + * Get the name of the AUTH mechanism this Authenticator handles. + * + * @return string + */ + public function getAuthKeyword() + { + return 'NTLM'; + } + + /** + * Try to authenticate the user with $username and $password. + * + * @param Swift_Transport_SmtpAgent $agent + * @param string $username + * @param string $password + * + * @return bool + */ + public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) + { + if (!function_exists('mcrypt_module_open')) { + throw new LogicException('The mcrypt functions need to be enabled to use the NTLM authenticator.'); + } + + if (!function_exists('openssl_random_pseudo_bytes')) { + throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.'); + } + + if (!function_exists('bcmul')) { + throw new LogicException('The BCMatch functions must be enabled to use the NTLM authenticator.'); + } + + try { + // execute AUTH command and filter out the code at the beginning + // AUTH NTLM xxxx + $response = base64_decode(substr(trim($this->sendMessage1($agent)), 4)); + + // extra parameters for our unit cases + $timestamp = func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000')); + $client = func_num_args() > 4 ? func_get_arg(4) : $this->getRandomBytes(8); + + // Message 3 response + $this->sendMessage3($response, $username, $password, $timestamp, $client, $agent); + + return true; + } catch (Swift_TransportException $e) { + $agent->executeCommand("RSET\r\n", array(250)); + + return false; + } + } + + protected function si2bin($si, $bits = 32) + { + $bin = null; + if ($si >= -pow(2, $bits - 1) && ($si <= pow(2, $bits - 1))) { + // positive or zero + if ($si >= 0) { + $bin = base_convert($si, 10, 2); + // pad to $bits bit + $bin_length = strlen($bin); + if ($bin_length < $bits) { + $bin = str_repeat('0', $bits - $bin_length).$bin; + } + } else { + // negative + $si = -$si - pow(2, $bits); + $bin = base_convert($si, 10, 2); + $bin_length = strlen($bin); + if ($bin_length > $bits) { + $bin = str_repeat('1', $bits - $bin_length).$bin; + } + } + } + + return $bin; + } + + /** + * Send our auth message and returns the response. + * + * @param Swift_Transport_SmtpAgent $agent + * + * @return string SMTP Response + */ + protected function sendMessage1(Swift_Transport_SmtpAgent $agent) + { + $message = $this->createMessage1(); + + return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), array(334)); + } + + /** + * Fetch all details of our response (message 2). + * + * @param string $response + * + * @return array our response parsed + */ + protected function parseMessage2($response) + { + $responseHex = bin2hex($response); + $length = floor(hexdec(substr($responseHex, 28, 4)) / 256) * 2; + $offset = floor(hexdec(substr($responseHex, 32, 4)) / 256) * 2; + $challenge = $this->hex2bin(substr($responseHex, 48, 16)); + $context = $this->hex2bin(substr($responseHex, 64, 16)); + $targetInfoH = $this->hex2bin(substr($responseHex, 80, 16)); + $targetName = $this->hex2bin(substr($responseHex, $offset, $length)); + $offset = floor(hexdec(substr($responseHex, 88, 4)) / 256) * 2; + $targetInfoBlock = substr($responseHex, $offset); + list($domainName, $serverName, $DNSDomainName, $DNSServerName, $terminatorByte) = $this->readSubBlock($targetInfoBlock); + + return array( + $challenge, + $context, + $targetInfoH, + $targetName, + $domainName, + $serverName, + $DNSDomainName, + $DNSServerName, + $this->hex2bin($targetInfoBlock), + $terminatorByte, + ); + } + + /** + * Read the blob information in from message2. + * + * @param $block + * + * @return array + */ + protected function readSubBlock($block) + { + // remove terminatorByte cause it's always the same + $block = substr($block, 0, -8); + + $length = strlen($block); + $offset = 0; + $data = array(); + while ($offset < $length) { + $blockLength = hexdec(substr(substr($block, $offset, 8), -4)) / 256; + $offset += 8; + $data[] = $this->hex2bin(substr($block, $offset, $blockLength * 2)); + $offset += $blockLength * 2; + } + + if (count($data) == 3) { + $data[] = $data[2]; + $data[2] = ''; + } + + $data[] = $this->createByte('00'); + + return $data; + } + + /** + * Send our final message with all our data. + * + * @param string $response Message 1 response (message 2) + * @param string $username + * @param string $password + * @param string $timestamp + * @param string $client + * @param Swift_Transport_SmtpAgent $agent + * @param bool $v2 Use version2 of the protocol + * + * @return string + */ + protected function sendMessage3($response, $username, $password, $timestamp, $client, Swift_Transport_SmtpAgent $agent, $v2 = true) + { + list($domain, $username) = $this->getDomainAndUsername($username); + //$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSServerName, $blob, $ter + list($challenge, , , , , $workstation, , , $blob) = $this->parseMessage2($response); + + if (!$v2) { + // LMv1 + $lmResponse = $this->createLMPassword($password, $challenge); + // NTLMv1 + $ntlmResponse = $this->createNTLMPassword($password, $challenge); + } else { + // LMv2 + $lmResponse = $this->createLMv2Password($password, $username, $domain, $challenge, $client); + // NTLMv2 + $ntlmResponse = $this->createNTLMv2Hash($password, $username, $domain, $challenge, $blob, $timestamp, $client); + } + + $message = $this->createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse); + + return $agent->executeCommand(sprintf("%s\r\n", base64_encode($message)), array(235)); + } + + /** + * Create our message 1. + * + * @return string + */ + protected function createMessage1() + { + return self::NTLMSIG + .$this->createByte('01') // Message 1 +.$this->createByte('0702'); // Flags + } + + /** + * Create our message 3. + * + * @param string $domain + * @param string $username + * @param string $workstation + * @param string $lmResponse + * @param string $ntlmResponse + * + * @return string + */ + protected function createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse) + { + // Create security buffers + $domainSec = $this->createSecurityBuffer($domain, 64); + $domainInfo = $this->readSecurityBuffer(bin2hex($domainSec)); + $userSec = $this->createSecurityBuffer($username, ($domainInfo[0] + $domainInfo[1]) / 2); + $userInfo = $this->readSecurityBuffer(bin2hex($userSec)); + $workSec = $this->createSecurityBuffer($workstation, ($userInfo[0] + $userInfo[1]) / 2); + $workInfo = $this->readSecurityBuffer(bin2hex($workSec)); + $lmSec = $this->createSecurityBuffer($lmResponse, ($workInfo[0] + $workInfo[1]) / 2, true); + $lmInfo = $this->readSecurityBuffer(bin2hex($lmSec)); + $ntlmSec = $this->createSecurityBuffer($ntlmResponse, ($lmInfo[0] + $lmInfo[1]) / 2, true); + + return self::NTLMSIG + .$this->createByte('03') // TYPE 3 message +.$lmSec // LM response header +.$ntlmSec // NTLM response header +.$domainSec // Domain header +.$userSec // User header +.$workSec // Workstation header +.$this->createByte('000000009a', 8) // session key header (empty) +.$this->createByte('01020000') // FLAGS +.$this->convertTo16bit($domain) // domain name +.$this->convertTo16bit($username) // username +.$this->convertTo16bit($workstation) // workstation +.$lmResponse + .$ntlmResponse; + } + + /** + * @param string $timestamp Epoch timestamp in microseconds + * @param string $client Random bytes + * @param string $targetInfo + * + * @return string + */ + protected function createBlob($timestamp, $client, $targetInfo) + { + return $this->createByte('0101') + .$this->createByte('00') + .$timestamp + .$client + .$this->createByte('00') + .$targetInfo + .$this->createByte('00'); + } + + /** + * Get domain and username from our username. + * + * @example DOMAIN\username + * + * @param string $name + * + * @return array + */ + protected function getDomainAndUsername($name) + { + if (strpos($name, '\\') !== false) { + return explode('\\', $name); + } + + list($user, $domain) = explode('@', $name); + + return array($domain, $user); + } + + /** + * Create LMv1 response. + * + * @param string $password + * @param string $challenge + * + * @return string + */ + protected function createLMPassword($password, $challenge) + { + // FIRST PART + $password = $this->createByte(strtoupper($password), 14, false); + list($key1, $key2) = str_split($password, 7); + + $desKey1 = $this->createDesKey($key1); + $desKey2 = $this->createDesKey($key2); + + $constantDecrypt = $this->createByte($this->desEncrypt(self::DESCONST, $desKey1).$this->desEncrypt(self::DESCONST, $desKey2), 21, false); + + // SECOND PART + list($key1, $key2, $key3) = str_split($constantDecrypt, 7); + + $desKey1 = $this->createDesKey($key1); + $desKey2 = $this->createDesKey($key2); + $desKey3 = $this->createDesKey($key3); + + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); + } + + /** + * Create NTLMv1 response. + * + * @param string $password + * @param string $challenge + * + * @return string + */ + protected function createNTLMPassword($password, $challenge) + { + // FIRST PART + $ntlmHash = $this->createByte($this->md4Encrypt($password), 21, false); + list($key1, $key2, $key3) = str_split($ntlmHash, 7); + + $desKey1 = $this->createDesKey($key1); + $desKey2 = $this->createDesKey($key2); + $desKey3 = $this->createDesKey($key3); + + return $this->desEncrypt($challenge, $desKey1).$this->desEncrypt($challenge, $desKey2).$this->desEncrypt($challenge, $desKey3); + } + + /** + * Convert a normal timestamp to a tenth of a microtime epoch time. + * + * @param string $time + * + * @return string + */ + protected function getCorrectTimestamp($time) + { + // Get our timestamp (tricky!) + bcscale(0); + + $time = number_format($time, 0, '.', ''); // save microtime to string + $time = bcadd($time, '11644473600000'); // add epoch time + $time = bcmul($time, 10000); // tenths of a microsecond. + + $binary = $this->si2bin($time, 64); // create 64 bit binary string + $timestamp = ''; + for ($i = 0; $i < 8; ++$i) { + $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8))); + } + + return $timestamp; + } + + /** + * Create LMv2 response. + * + * @param string $password + * @param string $username + * @param string $domain + * @param string $challenge NTLM Challenge + * @param string $client Random string + * + * @return string + */ + protected function createLMv2Password($password, $username, $domain, $challenge, $client) + { + $lmPass = '00'; // by default 00 + // if $password > 15 than we can't use this method + if (strlen($password) <= 15) { + $ntlmHash = $this->md4Encrypt($password); + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); + + $lmPass = bin2hex($this->md5Encrypt($ntml2Hash, $challenge.$client).$client); + } + + return $this->createByte($lmPass, 24); + } + + /** + * Create NTLMv2 response. + * + * @param string $password + * @param string $username + * @param string $domain + * @param string $challenge Hex values + * @param string $targetInfo Hex values + * @param string $timestamp + * @param string $client Random bytes + * + * @return string + * + * @see http://davenport.sourceforge.net/ntlm.html#theNtlmResponse + */ + protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client) + { + $ntlmHash = $this->md4Encrypt($password); + $ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain)); + + // create blob + $blob = $this->createBlob($timestamp, $client, $targetInfo); + + $ntlmv2Response = $this->md5Encrypt($ntml2Hash, $challenge.$blob); + + return $ntlmv2Response.$blob; + } + + protected function createDesKey($key) + { + $material = array(bin2hex($key[0])); + $len = strlen($key); + for ($i = 1; $i < $len; ++$i) { + list($high, $low) = str_split(bin2hex($key[$i])); + $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); + $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte + } + $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0'); + + // odd parity + foreach ($material as $k => $v) { + $b = $this->castToByte(hexdec($v)); + $needsParity = (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5) + ^ $this->uRShift($b, 4) ^ $this->uRShift($b, 3) ^ $this->uRShift($b, 2) + ^ $this->uRShift($b, 1)) & 0x01) == 0; + + list($high, $low) = str_split($v); + if ($needsParity) { + $material[$k] = dechex(hexdec($high) | 0x0).dechex(hexdec($low) | 0x1); + } else { + $material[$k] = dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xe); + } + } + + return $this->hex2bin(implode('', $material)); + } + + /** HELPER FUNCTIONS */ + /** + * Create our security buffer depending on length and offset. + * + * @param string $value Value we want to put in + * @param int $offset start of value + * @param bool $is16 Do we 16bit string or not? + * + * @return string + */ + protected function createSecurityBuffer($value, $offset, $is16 = false) + { + $length = strlen(bin2hex($value)); + $length = $is16 ? $length / 2 : $length; + $length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2); + + return $length.$length.$this->createByte(dechex($offset), 4); + } + + /** + * Read our security buffer to fetch length and offset of our value. + * + * @param string $value Securitybuffer in hex + * + * @return array array with length and offset + */ + protected function readSecurityBuffer($value) + { + $length = floor(hexdec(substr($value, 0, 4)) / 256) * 2; + $offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2; + + return array($length, $offset); + } + + /** + * Cast to byte java equivalent to (byte). + * + * @param int $v + * + * @return int + */ + protected function castToByte($v) + { + return (($v + 128) % 256) - 128; + } + + /** + * Java unsigned right bitwise + * $a >>> $b. + * + * @param int $a + * @param int $b + * + * @return int + */ + protected function uRShift($a, $b) + { + if ($b == 0) { + return $a; + } + + return ($a >> $b) & ~(1 << (8 * PHP_INT_SIZE - 1) >> ($b - 1)); + } + + /** + * Right padding with 0 to certain length. + * + * @param string $input + * @param int $bytes Length of bytes + * @param bool $isHex Did we provided hex value + * + * @return string + */ + protected function createByte($input, $bytes = 4, $isHex = true) + { + if ($isHex) { + $byte = $this->hex2bin(str_pad($input, $bytes * 2, '00')); + } else { + $byte = str_pad($input, $bytes, "\x00"); + } + + return $byte; + } + + /** + * Create random bytes. + * + * @param $length + * + * @return string + */ + protected function getRandomBytes($length) + { + $bytes = openssl_random_pseudo_bytes($length, $strong); + + if (false !== $bytes && true === $strong) { + return $bytes; + } + + throw new RuntimeException('OpenSSL did not produce a secure random number.'); + } + + /** ENCRYPTION ALGORITHMS */ + /** + * DES Encryption. + * + * @param string $value + * @param string $key + * + * @return string + */ + protected function desEncrypt($value, $key) + { + $cipher = mcrypt_module_open(MCRYPT_DES, '', 'ecb', ''); + mcrypt_generic_init($cipher, $key, mcrypt_create_iv(mcrypt_enc_get_iv_size($cipher), MCRYPT_DEV_RANDOM)); + + return mcrypt_generic($cipher, $value); + } + + /** + * MD5 Encryption. + * + * @param string $key Encryption key + * @param string $msg Message to encrypt + * + * @return string + */ + protected function md5Encrypt($key, $msg) + { + $blocksize = 64; + if (strlen($key) > $blocksize) { + $key = pack('H*', md5($key)); + } + + $key = str_pad($key, $blocksize, "\0"); + $ipadk = $key ^ str_repeat("\x36", $blocksize); + $opadk = $key ^ str_repeat("\x5c", $blocksize); + + return pack('H*', md5($opadk.pack('H*', md5($ipadk.$msg)))); + } + + /** + * MD4 Encryption. + * + * @param string $input + * + * @return string + * + * @see http://php.net/manual/en/ref.hash.php + */ + protected function md4Encrypt($input) + { + $input = $this->convertTo16bit($input); + + return function_exists('hash') ? $this->hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input); + } + + /** + * Convert UTF-8 to UTF-16. + * + * @param string $input + * + * @return string + */ + protected function convertTo16bit($input) + { + return iconv('UTF-8', 'UTF-16LE', $input); + } + + /** + * Hex2bin replacement for < PHP 5.4. + * + * @param string $hex + * + * @return string Binary + */ + protected function hex2bin($hex) + { + if (function_exists('hex2bin')) { + return hex2bin($hex); + } else { + return pack('H*', $hex); + } + } + + /** + * @param string $message + */ + protected function debug($message) + { + $message = bin2hex($message); + $messageId = substr($message, 16, 8); + echo substr($message, 0, 16)." NTLMSSP Signature
\n"; + echo $messageId." Type Indicator
\n"; + + if ($messageId == '02000000') { + $map = array( + 'Challenge', + 'Context', + 'Target Information Security Buffer', + 'Target Name Data', + 'NetBIOS Domain Name', + 'NetBIOS Server Name', + 'DNS Domain Name', + 'DNS Server Name', + 'BLOB', + 'Target Information Terminator', + ); + + $data = $this->parseMessage2($this->hex2bin($message)); + + foreach ($map as $key => $value) { + echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value."
\n"; + } + } elseif ($messageId == '03000000') { + $i = 0; + $data[$i++] = substr($message, 24, 16); + list($lmLength, $lmOffset) = $this->readSecurityBuffer($data[$i - 1]); + + $data[$i++] = substr($message, 40, 16); + list($ntmlLength, $ntmlOffset) = $this->readSecurityBuffer($data[$i - 1]); + + $data[$i++] = substr($message, 56, 16); + list($targetLength, $targetOffset) = $this->readSecurityBuffer($data[$i - 1]); + + $data[$i++] = substr($message, 72, 16); + list($userLength, $userOffset) = $this->readSecurityBuffer($data[$i - 1]); + + $data[$i++] = substr($message, 88, 16); + list($workLength, $workOffset) = $this->readSecurityBuffer($data[$i - 1]); + + $data[$i++] = substr($message, 104, 16); + $data[$i++] = substr($message, 120, 8); + $data[$i++] = substr($message, $targetOffset, $targetLength); + $data[$i++] = substr($message, $userOffset, $userLength); + $data[$i++] = substr($message, $workOffset, $workLength); + $data[$i++] = substr($message, $lmOffset, $lmLength); + $data[$i] = substr($message, $ntmlOffset, $ntmlLength); + + $map = array( + 'LM Response Security Buffer', + 'NTLM Response Security Buffer', + 'Target Name Security Buffer', + 'User Name Security Buffer', + 'Workstation Name Security Buffer', + 'Session Key Security Buffer', + 'Flags', + 'Target Name Data', + 'User Name Data', + 'Workstation Name Data', + 'LM Response Data', + 'NTLM Response Data', + ); + + foreach ($map as $key => $value) { + echo $data[$key].' - '.$this->hex2bin($data[$key]).' ||| '.$value."
\n"; + } + } + + echo '

'; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php new file mode 100644 index 00000000000..43219f93445 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php @@ -0,0 +1,50 @@ +executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), array(235)); + + return true; + } catch (Swift_TransportException $e) { + $agent->executeCommand("RSET\r\n", array(250)); + + return false; + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php new file mode 100644 index 00000000000..ca35e7b83ad --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php @@ -0,0 +1,70 @@ + + * $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls') + * ->setAuthMode('XOAUTH2') + * ->setUsername('YOUR_EMAIL_ADDRESS') + * ->setPassword('YOUR_ACCESS_TOKEN'); + * + * + * @author xu.li + * + * @see https://developers.google.com/google-apps/gmail/xoauth2_protocol + */ +class Swift_Transport_Esmtp_Auth_XOAuth2Authenticator implements Swift_Transport_Esmtp_Authenticator +{ + /** + * Get the name of the AUTH mechanism this Authenticator handles. + * + * @return string + */ + public function getAuthKeyword() + { + return 'XOAUTH2'; + } + + /** + * Try to authenticate the user with $email and $token. + * + * @param Swift_Transport_SmtpAgent $agent + * @param string $email + * @param string $token + * + * @return bool + */ + public function authenticate(Swift_Transport_SmtpAgent $agent, $email, $token) + { + try { + $param = $this->constructXOAuth2Params($email, $token); + $agent->executeCommand('AUTH XOAUTH2 '.$param."\r\n", array(235)); + + return true; + } catch (Swift_TransportException $e) { + $agent->executeCommand("RSET\r\n", array(250)); + + return false; + } + } + + /** + * Construct the auth parameter. + * + * @see https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism + */ + protected function constructXOAuth2Params($email, $token) + { + return base64_encode("user=$email\1auth=Bearer $token\1\1"); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php new file mode 100644 index 00000000000..cb36133c94d --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php @@ -0,0 +1,263 @@ +setAuthenticators($authenticators); + } + + /** + * Set the Authenticators which can process a login request. + * + * @param Swift_Transport_Esmtp_Authenticator[] $authenticators + */ + public function setAuthenticators(array $authenticators) + { + $this->_authenticators = $authenticators; + } + + /** + * Get the Authenticators which can process a login request. + * + * @return Swift_Transport_Esmtp_Authenticator[] + */ + public function getAuthenticators() + { + return $this->_authenticators; + } + + /** + * Set the username to authenticate with. + * + * @param string $username + */ + public function setUsername($username) + { + $this->_username = $username; + } + + /** + * Get the username to authenticate with. + * + * @return string + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Set the password to authenticate with. + * + * @param string $password + */ + public function setPassword($password) + { + $this->_password = $password; + } + + /** + * Get the password to authenticate with. + * + * @return string + */ + public function getPassword() + { + return $this->_password; + } + + /** + * Set the auth mode to use to authenticate. + * + * @param string $mode + */ + public function setAuthMode($mode) + { + $this->_auth_mode = $mode; + } + + /** + * Get the auth mode to use to authenticate. + * + * @return string + */ + public function getAuthMode() + { + return $this->_auth_mode; + } + + /** + * Get the name of the ESMTP extension this handles. + * + * @return bool + */ + public function getHandledKeyword() + { + return 'AUTH'; + } + + /** + * Set the parameters which the EHLO greeting indicated. + * + * @param string[] $parameters + */ + public function setKeywordParams(array $parameters) + { + $this->_esmtpParams = $parameters; + } + + /** + * Runs immediately after a EHLO has been issued. + * + * @param Swift_Transport_SmtpAgent $agent to read/write + */ + public function afterEhlo(Swift_Transport_SmtpAgent $agent) + { + if ($this->_username) { + $count = 0; + foreach ($this->_getAuthenticatorsForAgent() as $authenticator) { + if (in_array(strtolower($authenticator->getAuthKeyword()), + array_map('strtolower', $this->_esmtpParams))) { + ++$count; + if ($authenticator->authenticate($agent, $this->_username, $this->_password)) { + return; + } + } + } + throw new Swift_TransportException( + 'Failed to authenticate on SMTP server with username "'. + $this->_username.'" using '.$count.' possible authenticators' + ); + } + } + + /** + * Not used. + */ + public function getMailParams() + { + return array(); + } + + /** + * Not used. + */ + public function getRcptParams() + { + return array(); + } + + /** + * Not used. + */ + public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false) + { + } + + /** + * Returns +1, -1 or 0 according to the rules for usort(). + * + * This method is called to ensure extensions can be execute in an appropriate order. + * + * @param string $esmtpKeyword to compare with + * + * @return int + */ + public function getPriorityOver($esmtpKeyword) + { + return 0; + } + + /** + * Returns an array of method names which are exposed to the Esmtp class. + * + * @return string[] + */ + public function exposeMixinMethods() + { + return array('setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode'); + } + + /** + * Not used. + */ + public function resetState() + { + } + + /** + * Returns the authenticator list for the given agent. + * + * @param Swift_Transport_SmtpAgent $agent + * + * @return array + */ + protected function _getAuthenticatorsForAgent() + { + if (!$mode = strtolower($this->_auth_mode)) { + return $this->_authenticators; + } + + foreach ($this->_authenticators as $authenticator) { + if (strtolower($authenticator->getAuthKeyword()) == $mode) { + return array($authenticator); + } + } + + throw new Swift_TransportException('Auth mode '.$mode.' is invalid'); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php new file mode 100644 index 00000000000..12a9abf8199 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php @@ -0,0 +1,35 @@ +. + * + * @return string[] + */ + public function getMailParams(); + + /** + * Get params which are appended to RCPT TO:<>. + * + * @return string[] + */ + public function getRcptParams(); + + /** + * Runs when a command is due to be sent. + * + * @param Swift_Transport_SmtpAgent $agent to read/write + * @param string $command to send + * @param int[] $codes expected in response + * @param string[] $failedRecipients to collect failures + * @param bool $stop to be set true by-reference if the command is now sent + */ + public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false); + + /** + * Returns +1, -1 or 0 according to the rules for usort(). + * + * This method is called to ensure extensions can be execute in an appropriate order. + * + * @param string $esmtpKeyword to compare with + * + * @return int + */ + public function getPriorityOver($esmtpKeyword); + + /** + * Returns an array of method names which are exposed to the Esmtp class. + * + * @return string[] + */ + public function exposeMixinMethods(); + + /** + * Tells this handler to clear any buffers and reset its state. + */ + public function resetState(); +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php new file mode 100644 index 00000000000..a1cd0dcd1de --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php @@ -0,0 +1,412 @@ + 'tcp', + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + 'blocking' => 1, + 'tls' => false, + 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'stream_context_options' => array(), + ); + + /** + * Creates a new EsmtpTransport using the given I/O buffer. + * + * @param Swift_Transport_IoBuffer $buf + * @param Swift_Transport_EsmtpHandler[] $extensionHandlers + * @param Swift_Events_EventDispatcher $dispatcher + */ + public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher) + { + parent::__construct($buf, $dispatcher); + $this->setExtensionHandlers($extensionHandlers); + } + + /** + * Set the host to connect to. + * + * @param string $host + * + * @return Swift_Transport_EsmtpTransport + */ + public function setHost($host) + { + $this->_params['host'] = $host; + + return $this; + } + + /** + * Get the host to connect to. + * + * @return string + */ + public function getHost() + { + return $this->_params['host']; + } + + /** + * Set the port to connect to. + * + * @param int $port + * + * @return Swift_Transport_EsmtpTransport + */ + public function setPort($port) + { + $this->_params['port'] = (int) $port; + + return $this; + } + + /** + * Get the port to connect to. + * + * @return int + */ + public function getPort() + { + return $this->_params['port']; + } + + /** + * Set the connection timeout. + * + * @param int $timeout seconds + * + * @return Swift_Transport_EsmtpTransport + */ + public function setTimeout($timeout) + { + $this->_params['timeout'] = (int) $timeout; + $this->_buffer->setParam('timeout', (int) $timeout); + + return $this; + } + + /** + * Get the connection timeout. + * + * @return int + */ + public function getTimeout() + { + return $this->_params['timeout']; + } + + /** + * Set the encryption type (tls or ssl). + * + * @param string $encryption + * + * @return Swift_Transport_EsmtpTransport + */ + public function setEncryption($encryption) + { + if ('tls' == $encryption) { + $this->_params['protocol'] = 'tcp'; + $this->_params['tls'] = true; + } else { + $this->_params['protocol'] = $encryption; + $this->_params['tls'] = false; + } + + return $this; + } + + /** + * Get the encryption type. + * + * @return string + */ + public function getEncryption() + { + return $this->_params['tls'] ? 'tls' : $this->_params['protocol']; + } + + /** + * Sets the stream context options. + * + * @param array $options + * + * @return Swift_Transport_EsmtpTransport + */ + public function setStreamOptions($options) + { + $this->_params['stream_context_options'] = $options; + + return $this; + } + + /** + * Returns the stream context options. + * + * @return array + */ + public function getStreamOptions() + { + return $this->_params['stream_context_options']; + } + + /** + * Sets the source IP. + * + * @param string $source + * + * @return Swift_Transport_EsmtpTransport + */ + public function setSourceIp($source) + { + $this->_params['sourceIp'] = $source; + + return $this; + } + + /** + * Returns the IP used to connect to the destination. + * + * @return string + */ + public function getSourceIp() + { + return isset($this->_params['sourceIp']) ? $this->_params['sourceIp'] : null; + } + + /** + * Set ESMTP extension handlers. + * + * @param Swift_Transport_EsmtpHandler[] $handlers + * + * @return Swift_Transport_EsmtpTransport + */ + public function setExtensionHandlers(array $handlers) + { + $assoc = array(); + foreach ($handlers as $handler) { + $assoc[$handler->getHandledKeyword()] = $handler; + } + + @uasort($assoc, array($this, '_sortHandlers')); + $this->_handlers = $assoc; + $this->_setHandlerParams(); + + return $this; + } + + /** + * Get ESMTP extension handlers. + * + * @return Swift_Transport_EsmtpHandler[] + */ + public function getExtensionHandlers() + { + return array_values($this->_handlers); + } + + /** + * Run a command against the buffer, expecting the given response codes. + * + * If no response codes are given, the response will not be validated. + * If codes are given, an exception will be thrown on an invalid response. + * + * @param string $command + * @param int[] $codes + * @param string[] $failures An array of failures by-reference + * + * @return string + */ + public function executeCommand($command, $codes = array(), &$failures = null) + { + $failures = (array) $failures; + $stopSignal = false; + $response = null; + foreach ($this->_getActiveHandlers() as $handler) { + $response = $handler->onCommand( + $this, $command, $codes, $failures, $stopSignal + ); + if ($stopSignal) { + return $response; + } + } + + return parent::executeCommand($command, $codes, $failures); + } + + // -- Mixin invocation code + + /** Mixin handling method for ESMTP handlers */ + public function __call($method, $args) + { + foreach ($this->_handlers as $handler) { + if (in_array(strtolower($method), + array_map('strtolower', (array) $handler->exposeMixinMethods()) + )) { + $return = call_user_func_array(array($handler, $method), $args); + // Allow fluid method calls + if (is_null($return) && substr($method, 0, 3) == 'set') { + return $this; + } else { + return $return; + } + } + } + trigger_error('Call to undefined method '.$method, E_USER_ERROR); + } + + /** Get the params to initialize the buffer */ + protected function _getBufferParams() + { + return $this->_params; + } + + /** Overridden to perform EHLO instead */ + protected function _doHeloCommand() + { + try { + $response = $this->executeCommand( + sprintf("EHLO %s\r\n", $this->_domain), array(250) + ); + } catch (Swift_TransportException $e) { + return parent::_doHeloCommand(); + } + + if ($this->_params['tls']) { + try { + $this->executeCommand("STARTTLS\r\n", array(220)); + + if (!$this->_buffer->startTLS()) { + throw new Swift_TransportException('Unable to connect with TLS encryption'); + } + + try { + $response = $this->executeCommand( + sprintf("EHLO %s\r\n", $this->_domain), array(250) + ); + } catch (Swift_TransportException $e) { + return parent::_doHeloCommand(); + } + } catch (Swift_TransportException $e) { + $this->_throwException($e); + } + } + + $this->_capabilities = $this->_getCapabilities($response); + $this->_setHandlerParams(); + foreach ($this->_getActiveHandlers() as $handler) { + $handler->afterEhlo($this); + } + } + + /** Overridden to add Extension support */ + protected function _doMailFromCommand($address) + { + $handlers = $this->_getActiveHandlers(); + $params = array(); + foreach ($handlers as $handler) { + $params = array_merge($params, (array) $handler->getMailParams()); + } + $paramStr = !empty($params) ? ' '.implode(' ', $params) : ''; + $this->executeCommand( + sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), array(250) + ); + } + + /** Overridden to add Extension support */ + protected function _doRcptToCommand($address) + { + $handlers = $this->_getActiveHandlers(); + $params = array(); + foreach ($handlers as $handler) { + $params = array_merge($params, (array) $handler->getRcptParams()); + } + $paramStr = !empty($params) ? ' '.implode(' ', $params) : ''; + $this->executeCommand( + sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), array(250, 251, 252) + ); + } + + /** Determine ESMTP capabilities by function group */ + private function _getCapabilities($ehloResponse) + { + $capabilities = array(); + $ehloResponse = trim($ehloResponse); + $lines = explode("\r\n", $ehloResponse); + array_shift($lines); + foreach ($lines as $line) { + if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches)) { + $keyword = strtoupper($matches[1]); + $paramStr = strtoupper(ltrim($matches[2], ' =')); + $params = !empty($paramStr) ? explode(' ', $paramStr) : array(); + $capabilities[$keyword] = $params; + } + } + + return $capabilities; + } + + /** Set parameters which are used by each extension handler */ + private function _setHandlerParams() + { + foreach ($this->_handlers as $keyword => $handler) { + if (array_key_exists($keyword, $this->_capabilities)) { + $handler->setKeywordParams($this->_capabilities[$keyword]); + } + } + } + + /** Get ESMTP handlers which are currently ok to use */ + private function _getActiveHandlers() + { + $handlers = array(); + foreach ($this->_handlers as $keyword => $handler) { + if (array_key_exists($keyword, $this->_capabilities)) { + $handlers[] = $handler; + } + } + + return $handlers; + } + + /** Custom sort for extension handler ordering */ + private function _sortHandlers($a, $b) + { + return $a->getPriorityOver($b->getHandledKeyword()); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php new file mode 100644 index 00000000000..c039f3beccf --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php @@ -0,0 +1,82 @@ +_transports); + $sent = 0; + $this->_lastUsedTransport = null; + + for ($i = 0; $i < $maxTransports + && $transport = $this->_getNextTransport(); ++$i) { + try { + if (!$transport->isStarted()) { + $transport->start(); + } + + if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; + + return $sent; + } + } catch (Swift_TransportException $e) { + $this->_killCurrentTransport(); + } + } + + if (count($this->_transports) == 0) { + throw new Swift_TransportException( + 'All Transports in FailoverTransport failed, or no Transports available' + ); + } + + return $sent; + } + + protected function _getNextTransport() + { + if (!isset($this->_currentTransport)) { + $this->_currentTransport = parent::_getNextTransport(); + } + + return $this->_currentTransport; + } + + protected function _killCurrentTransport() + { + $this->_currentTransport = null; + parent::_killCurrentTransport(); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php new file mode 100644 index 00000000000..af97adf1f8f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php @@ -0,0 +1,67 @@ +_transports = $transports; + $this->_deadTransports = array(); + } + + /** + * Get $transports to delegate to. + * + * @return Swift_Transport[] + */ + public function getTransports() + { + return array_merge($this->_transports, $this->_deadTransports); + } + + /** + * Get the Transport used in the last successful send operation. + * + * @return Swift_Transport + */ + public function getLastUsedTransport() + { + return $this->_lastUsedTransport; + } + + /** + * Test if this Transport mechanism has started. + * + * @return bool + */ + public function isStarted() + { + return count($this->_transports) > 0; + } + + /** + * Start this Transport mechanism. + */ + public function start() + { + $this->_transports = array_merge($this->_transports, $this->_deadTransports); + } + + /** + * Stop this Transport mechanism. + */ + public function stop() + { + foreach ($this->_transports as $transport) { + $transport->stop(); + } + } + + /** + * Send the given Message. + * + * Recipient/sender data will be retrieved from the Message API. + * The return value is the number of recipients who were accepted for delivery. + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $maxTransports = count($this->_transports); + $sent = 0; + $this->_lastUsedTransport = null; + + for ($i = 0; $i < $maxTransports + && $transport = $this->_getNextTransport(); ++$i) { + try { + if (!$transport->isStarted()) { + $transport->start(); + } + if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; + break; + } + } catch (Swift_TransportException $e) { + $this->_killCurrentTransport(); + } + } + + if (count($this->_transports) == 0) { + throw new Swift_TransportException( + 'All Transports in LoadBalancedTransport failed, or no Transports available' + ); + } + + return $sent; + } + + /** + * Register a plugin. + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + foreach ($this->_transports as $transport) { + $transport->registerPlugin($plugin); + } + } + + /** + * Rotates the transport list around and returns the first instance. + * + * @return Swift_Transport + */ + protected function _getNextTransport() + { + if ($next = array_shift($this->_transports)) { + $this->_transports[] = $next; + } + + return $next; + } + + /** + * Tag the currently used (top of stack) transport as dead/useless. + */ + protected function _killCurrentTransport() + { + if ($transport = array_pop($this->_transports)) { + try { + $transport->stop(); + } catch (Exception $e) { + } + $this->_deadTransports[] = $transport; + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php new file mode 100644 index 00000000000..77489cedc68 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php @@ -0,0 +1,32 @@ +_invoker = $invoker; + $this->_eventDispatcher = $eventDispatcher; + } + + /** + * Not used. + */ + public function isStarted() + { + return false; + } + + /** + * Not used. + */ + public function start() + { + } + + /** + * Not used. + */ + public function stop() + { + } + + /** + * Set the additional parameters used on the mail() function. + * + * This string is formatted for sprintf() where %s is the sender address. + * + * @param string $params + * + * @return Swift_Transport_MailTransport + */ + public function setExtraParams($params) + { + $this->_extraParams = $params; + + return $this; + } + + /** + * Get the additional parameters used on the mail() function. + * + * This string is formatted for sprintf() where %s is the sender address. + * + * @return string + */ + public function getExtraParams() + { + return $this->_extraParams; + } + + /** + * Send the given Message. + * + * Recipient/sender data will be retrieved from the Message API. + * The return value is the number of recipients who were accepted for delivery. + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $failedRecipients = (array) $failedRecipients; + + if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); + if ($evt->bubbleCancelled()) { + return 0; + } + } + + $count = ( + count((array) $message->getTo()) + + count((array) $message->getCc()) + + count((array) $message->getBcc()) + ); + + $toHeader = $message->getHeaders()->get('To'); + $subjectHeader = $message->getHeaders()->get('Subject'); + + if (!$toHeader) { + $this->_throwException(new Swift_TransportException('Cannot send message without a recipient')); + } + $to = $toHeader->getFieldBody(); + $subject = $subjectHeader ? $subjectHeader->getFieldBody() : ''; + + $reversePath = $this->_getReversePath($message); + + // Remove headers that would otherwise be duplicated + $message->getHeaders()->remove('To'); + $message->getHeaders()->remove('Subject'); + + $messageStr = $message->toString(); + + $message->getHeaders()->set($toHeader); + $message->getHeaders()->set($subjectHeader); + + // Separate headers from body + if (false !== $endHeaders = strpos($messageStr, "\r\n\r\n")) { + $headers = substr($messageStr, 0, $endHeaders)."\r\n"; //Keep last EOL + $body = substr($messageStr, $endHeaders + 4); + } else { + $headers = $messageStr."\r\n"; + $body = ''; + } + + unset($messageStr); + + if ("\r\n" != PHP_EOL) { + // Non-windows (not using SMTP) + $headers = str_replace("\r\n", PHP_EOL, $headers); + $subject = str_replace("\r\n", PHP_EOL, $subject); + $body = str_replace("\r\n", PHP_EOL, $body); + } else { + // Windows, using SMTP + $headers = str_replace("\r\n.", "\r\n..", $headers); + $subject = str_replace("\r\n.", "\r\n..", $subject); + $body = str_replace("\r\n.", "\r\n..", $body); + } + + if ($this->_invoker->mail($to, $subject, $body, $headers, + sprintf($this->_extraParams, escapeshellarg($reversePath)))) { + if ($evt) { + $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); + $evt->setFailedRecipients($failedRecipients); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + } else { + $failedRecipients = array_merge( + $failedRecipients, + array_keys((array) $message->getTo()), + array_keys((array) $message->getCc()), + array_keys((array) $message->getBcc()) + ); + + if ($evt) { + $evt->setResult(Swift_Events_SendEvent::RESULT_FAILED); + $evt->setFailedRecipients($failedRecipients); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + $message->generateId(); + + $count = 0; + } + + return $count; + } + + /** + * Register a plugin. + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_eventDispatcher->bindEventListener($plugin); + } + + /** Throw a TransportException, first sending it to any listeners */ + protected function _throwException(Swift_TransportException $e) + { + if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) { + $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown'); + if (!$evt->bubbleCancelled()) { + throw $e; + } + } else { + throw $e; + } + } + + /** Determine the best-use reverse path for this message */ + private function _getReversePath(Swift_Mime_Message $message) + { + $return = $message->getReturnPath(); + $sender = $message->getSender(); + $from = $message->getFrom(); + $path = null; + if (!empty($return)) { + $path = $return; + } elseif (!empty($sender)) { + $keys = array_keys($sender); + $path = array_shift($keys); + } elseif (!empty($from)) { + $keys = array_keys($from); + $path = array_shift($keys); + } + + return $path; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php new file mode 100644 index 00000000000..ad20e0e535f --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Pretends messages have been sent, but just ignores them. + * + * @author Fabien Potencier + */ +class Swift_Transport_NullTransport implements Swift_Transport +{ + /** The event dispatcher from the plugin API */ + private $_eventDispatcher; + + /** + * Constructor. + */ + public function __construct(Swift_Events_EventDispatcher $eventDispatcher) + { + $this->_eventDispatcher = $eventDispatcher; + } + + /** + * Tests if this Transport mechanism has started. + * + * @return bool + */ + public function isStarted() + { + return true; + } + + /** + * Starts this Transport mechanism. + */ + public function start() + { + } + + /** + * Stops this Transport mechanism. + */ + public function stop() + { + } + + /** + * Sends the given message. + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int The number of sent emails + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); + if ($evt->bubbleCancelled()) { + return 0; + } + } + + if ($evt) { + $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + $count = ( + count((array) $message->getTo()) + + count((array) $message->getCc()) + + count((array) $message->getBcc()) + ); + + return $count; + } + + /** + * Register a plugin. + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_eventDispatcher->bindEventListener($plugin); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php new file mode 100644 index 00000000000..34ac4ce3af8 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php @@ -0,0 +1,160 @@ + 30, + 'blocking' => 1, + 'command' => '/usr/sbin/sendmail -bs', + 'type' => Swift_Transport_IoBuffer::TYPE_PROCESS, + ); + + /** + * Create a new SendmailTransport with $buf for I/O. + * + * @param Swift_Transport_IoBuffer $buf + * @param Swift_Events_EventDispatcher $dispatcher + */ + public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher) + { + parent::__construct($buf, $dispatcher); + } + + /** + * Start the standalone SMTP session if running in -bs mode. + */ + public function start() + { + if (false !== strpos($this->getCommand(), ' -bs')) { + parent::start(); + } + } + + /** + * Set the command to invoke. + * + * If using -t mode you are strongly advised to include -oi or -i in the flags. + * For example: /usr/sbin/sendmail -oi -t + * Swift will append a -f flag if one is not present. + * + * The recommended mode is "-bs" since it is interactive and failure notifications + * are hence possible. + * + * @param string $command + * + * @return Swift_Transport_SendmailTransport + */ + public function setCommand($command) + { + $this->_params['command'] = $command; + + return $this; + } + + /** + * Get the sendmail command which will be invoked. + * + * @return string + */ + public function getCommand() + { + return $this->_params['command']; + } + + /** + * Send the given Message. + * + * Recipient/sender data will be retrieved from the Message API. + * + * The return value is the number of recipients who were accepted for delivery. + * NOTE: If using 'sendmail -t' you will not be aware of any failures until + * they bounce (i.e. send() will always return 100% success). + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $failedRecipients = (array) $failedRecipients; + $command = $this->getCommand(); + $buffer = $this->getBuffer(); + $count = 0; + + if (false !== strpos($command, ' -t')) { + if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); + if ($evt->bubbleCancelled()) { + return 0; + } + } + + if (false === strpos($command, ' -f')) { + $command .= ' -f'.escapeshellarg($this->_getReversePath($message)); + } + + $buffer->initialize(array_merge($this->_params, array('command' => $command))); + + if (false === strpos($command, ' -i') && false === strpos($command, ' -oi')) { + $buffer->setWriteTranslations(array("\r\n" => "\n", "\n." => "\n..")); + } else { + $buffer->setWriteTranslations(array("\r\n" => "\n")); + } + + $count = count((array) $message->getTo()) + + count((array) $message->getCc()) + + count((array) $message->getBcc()) + ; + $message->toByteStream($buffer); + $buffer->flushBuffers(); + $buffer->setWriteTranslations(array()); + $buffer->terminate(); + + if ($evt) { + $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); + $evt->setFailedRecipients($failedRecipients); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + $message->generateId(); + } elseif (false !== strpos($command, ' -bs')) { + $count = parent::send($message, $failedRecipients); + } else { + $this->_throwException(new Swift_TransportException( + 'Unsupported sendmail command flags ['.$command.']. '. + 'Must be one of "-bs" or "-t" but can include additional flags.' + )); + } + + return $count; + } + + /** Get the params to initialize the buffer */ + protected function _getBufferParams() + { + return $this->_params; + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php new file mode 100644 index 00000000000..4cab66bd6bf --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Stores Messages in a queue. + * + * @author Fabien Potencier + */ +class Swift_Transport_SpoolTransport implements Swift_Transport +{ + /** The spool instance */ + private $_spool; + + /** The event dispatcher from the plugin API */ + private $_eventDispatcher; + + /** + * Constructor. + */ + public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift_Spool $spool = null) + { + $this->_eventDispatcher = $eventDispatcher; + $this->_spool = $spool; + } + + /** + * Sets the spool object. + * + * @param Swift_Spool $spool + * + * @return Swift_Transport_SpoolTransport + */ + public function setSpool(Swift_Spool $spool) + { + $this->_spool = $spool; + + return $this; + } + + /** + * Get the spool object. + * + * @return Swift_Spool + */ + public function getSpool() + { + return $this->_spool; + } + + /** + * Tests if this Transport mechanism has started. + * + * @return bool + */ + public function isStarted() + { + return true; + } + + /** + * Starts this Transport mechanism. + */ + public function start() + { + } + + /** + * Stops this Transport mechanism. + */ + public function stop() + { + } + + /** + * Sends the given message. + * + * @param Swift_Mime_Message $message + * @param string[] $failedRecipients An array of failures by-reference + * + * @return int The number of sent e-mail's + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { + $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); + if ($evt->bubbleCancelled()) { + return 0; + } + } + + $success = $this->_spool->queueMessage($message); + + if ($evt) { + $evt->setResult($success ? Swift_Events_SendEvent::RESULT_SPOOLED : Swift_Events_SendEvent::RESULT_FAILED); + $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + return 1; + } + + /** + * Register a plugin. + * + * @param Swift_Events_EventListener $plugin + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_eventDispatcher->bindEventListener($plugin); + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php new file mode 100644 index 00000000000..5134ea48a45 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php @@ -0,0 +1,325 @@ +_replacementFactory = $replacementFactory; + } + + /** + * Perform any initialization needed, using the given $params. + * + * Parameters will vary depending upon the type of IoBuffer used. + * + * @param array $params + */ + public function initialize(array $params) + { + $this->_params = $params; + switch ($params['type']) { + case self::TYPE_PROCESS: + $this->_establishProcessConnection(); + break; + case self::TYPE_SOCKET: + default: + $this->_establishSocketConnection(); + break; + } + } + + /** + * Set an individual param on the buffer (e.g. switching to SSL). + * + * @param string $param + * @param mixed $value + */ + public function setParam($param, $value) + { + if (isset($this->_stream)) { + switch ($param) { + case 'timeout': + if ($this->_stream) { + stream_set_timeout($this->_stream, $value); + } + break; + + case 'blocking': + if ($this->_stream) { + stream_set_blocking($this->_stream, 1); + } + + } + } + $this->_params[$param] = $value; + } + + public function startTLS() + { + return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + } + + /** + * Perform any shutdown logic needed. + */ + public function terminate() + { + if (isset($this->_stream)) { + switch ($this->_params['type']) { + case self::TYPE_PROCESS: + fclose($this->_in); + fclose($this->_out); + proc_close($this->_stream); + break; + case self::TYPE_SOCKET: + default: + fclose($this->_stream); + break; + } + } + $this->_stream = null; + $this->_out = null; + $this->_in = null; + } + + /** + * Set an array of string replacements which should be made on data written + * to the buffer. + * + * This could replace LF with CRLF for example. + * + * @param string[] $replacements + */ + public function setWriteTranslations(array $replacements) + { + foreach ($this->_translations as $search => $replace) { + if (!isset($replacements[$search])) { + $this->removeFilter($search); + unset($this->_translations[$search]); + } + } + + foreach ($replacements as $search => $replace) { + if (!isset($this->_translations[$search])) { + $this->addFilter( + $this->_replacementFactory->createFilter($search, $replace), $search + ); + $this->_translations[$search] = true; + } + } + } + + /** + * Get a line of output (including any CRLF). + * + * The $sequence number comes from any writes and may or may not be used + * depending upon the implementation. + * + * @param int $sequence of last write to scan from + * + * @throws Swift_IoException + * + * @return string + */ + public function readLine($sequence) + { + if (isset($this->_out) && !feof($this->_out)) { + $line = fgets($this->_out); + if (strlen($line) == 0) { + $metas = stream_get_meta_data($this->_out); + if ($metas['timed_out']) { + throw new Swift_IoException( + 'Connection to '. + $this->_getReadConnectionDescription(). + ' Timed Out' + ); + } + } + + return $line; + } + } + + /** + * Reads $length bytes from the stream into a string and moves the pointer + * through the stream by $length. + * + * If less bytes exist than are requested the remaining bytes are given instead. + * If no bytes are remaining at all, boolean false is returned. + * + * @param int $length + * + * @throws Swift_IoException + * + * @return string|bool + */ + public function read($length) + { + if (isset($this->_out) && !feof($this->_out)) { + $ret = fread($this->_out, $length); + if (strlen($ret) == 0) { + $metas = stream_get_meta_data($this->_out); + if ($metas['timed_out']) { + throw new Swift_IoException( + 'Connection to '. + $this->_getReadConnectionDescription(). + ' Timed Out' + ); + } + } + + return $ret; + } + } + + /** Not implemented */ + public function setReadPointer($byteOffset) + { + } + + /** Flush the stream contents */ + protected function _flush() + { + if (isset($this->_in)) { + fflush($this->_in); + } + } + + /** Write this bytes to the stream */ + protected function _commit($bytes) + { + if (isset($this->_in)) { + $bytesToWrite = strlen($bytes); + $totalBytesWritten = 0; + + while ($totalBytesWritten < $bytesToWrite) { + $bytesWritten = fwrite($this->_in, substr($bytes, $totalBytesWritten)); + if (false === $bytesWritten || 0 === $bytesWritten) { + break; + } + + $totalBytesWritten += $bytesWritten; + } + + if ($totalBytesWritten > 0) { + return ++$this->_sequence; + } + } + } + + /** + * Establishes a connection to a remote server. + */ + private function _establishSocketConnection() + { + $host = $this->_params['host']; + if (!empty($this->_params['protocol'])) { + $host = $this->_params['protocol'].'://'.$host; + } + $timeout = 15; + if (!empty($this->_params['timeout'])) { + $timeout = $this->_params['timeout']; + } + $options = array(); + if (!empty($this->_params['sourceIp'])) { + $options['socket']['bindto'] = $this->_params['sourceIp'].':0'; + } + if (isset($this->_params['stream_context_options'])) { + $options = array_merge($options, $this->_params['stream_context_options']); + } + $streamContext = stream_context_create($options); + $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext); + if (false === $this->_stream) { + throw new Swift_TransportException( + 'Connection could not be established with host '.$this->_params['host']. + ' ['.$errstr.' #'.$errno.']' + ); + } + if (!empty($this->_params['blocking'])) { + stream_set_blocking($this->_stream, 1); + } else { + stream_set_blocking($this->_stream, 0); + } + stream_set_timeout($this->_stream, $timeout); + $this->_in = &$this->_stream; + $this->_out = &$this->_stream; + } + + /** + * Opens a process for input/output. + */ + private function _establishProcessConnection() + { + $command = $this->_params['command']; + $descriptorSpec = array( + 0 => array('pipe', 'r'), + 1 => array('pipe', 'w'), + 2 => array('pipe', 'w'), + ); + $this->_stream = proc_open($command, $descriptorSpec, $pipes); + stream_set_blocking($pipes[2], 0); + if ($err = stream_get_contents($pipes[2])) { + throw new Swift_TransportException( + 'Process could not be started ['.$err.']' + ); + } + $this->_in = &$pipes[0]; + $this->_out = &$pipes[1]; + } + + private function _getReadConnectionDescription() + { + switch ($this->_params['type']) { + case self::TYPE_PROCESS: + return 'Process '.$this->_params['command']; + break; + + case self::TYPE_SOCKET: + default: + $host = $this->_params['host']; + if (!empty($this->_params['protocol'])) { + $host = $this->_params['protocol'].'://'.$host; + } + $host .= ':'.$this->_params['port']; + + return $host; + break; + } + } +} diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php new file mode 100644 index 00000000000..4ae2412e62a --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php @@ -0,0 +1,29 @@ + + */ +class Swift_Validate +{ + /** + * Grammar Object. + * + * @var Swift_Mime_Grammar + */ + private static $grammar = null; + + /** + * Checks if an e-mail address matches the current grammars. + * + * @param string $email + * + * @return bool + */ + public static function email($email) + { + if (self::$grammar === null) { + self::$grammar = Swift_DependencyContainer::getInstance() + ->lookup('mime.grammar'); + } + + return (bool) preg_match( + '/^'.self::$grammar->getDefinition('addr-spec').'$/D', + $email + ); + } +} diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php new file mode 100644 index 00000000000..6023448e85e --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php @@ -0,0 +1,23 @@ +register('cache') + ->asAliasOf('cache.array') + + ->register('tempdir') + ->asValue('/tmp') + + ->register('cache.null') + ->asSharedInstanceOf('Swift_KeyCache_NullKeyCache') + + ->register('cache.array') + ->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache') + ->withDependencies(array('cache.inputstream')) + + ->register('cache.disk') + ->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache') + ->withDependencies(array('cache.inputstream', 'tempdir')) + + ->register('cache.inputstream') + ->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream') +; diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/message_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/message_deps.php new file mode 100644 index 00000000000..64d69d21591 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/dependency_maps/message_deps.php @@ -0,0 +1,9 @@ +register('message.message') + ->asNewInstanceOf('Swift_Message') + + ->register('message.mimepart') + ->asNewInstanceOf('Swift_MimePart') +; diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php new file mode 100644 index 00000000000..04f394b3267 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php @@ -0,0 +1,123 @@ +register('properties.charset') + ->asValue('utf-8') + + ->register('mime.grammar') + ->asSharedInstanceOf('Swift_Mime_Grammar') + + ->register('mime.message') + ->asNewInstanceOf('Swift_Mime_SimpleMessage') + ->withDependencies(array( + 'mime.headerset', + 'mime.qpcontentencoder', + 'cache', + 'mime.grammar', + 'properties.charset', + )) + + ->register('mime.part') + ->asNewInstanceOf('Swift_Mime_MimePart') + ->withDependencies(array( + 'mime.headerset', + 'mime.qpcontentencoder', + 'cache', + 'mime.grammar', + 'properties.charset', + )) + + ->register('mime.attachment') + ->asNewInstanceOf('Swift_Mime_Attachment') + ->withDependencies(array( + 'mime.headerset', + 'mime.base64contentencoder', + 'cache', + 'mime.grammar', + )) + ->addConstructorValue($swift_mime_types) + + ->register('mime.embeddedfile') + ->asNewInstanceOf('Swift_Mime_EmbeddedFile') + ->withDependencies(array( + 'mime.headerset', + 'mime.base64contentencoder', + 'cache', + 'mime.grammar', + )) + ->addConstructorValue($swift_mime_types) + + ->register('mime.headerfactory') + ->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory') + ->withDependencies(array( + 'mime.qpheaderencoder', + 'mime.rfc2231encoder', + 'mime.grammar', + 'properties.charset', + )) + + ->register('mime.headerset') + ->asNewInstanceOf('Swift_Mime_SimpleHeaderSet') + ->withDependencies(array('mime.headerfactory', 'properties.charset')) + + ->register('mime.qpheaderencoder') + ->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder') + ->withDependencies(array('mime.charstream')) + + ->register('mime.base64headerencoder') + ->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder') + ->withDependencies(array('mime.charstream')) + + ->register('mime.charstream') + ->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream') + ->withDependencies(array('mime.characterreaderfactory', 'properties.charset')) + + ->register('mime.bytecanonicalizer') + ->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter') + ->addConstructorValue(array(array(0x0D, 0x0A), array(0x0D), array(0x0A))) + ->addConstructorValue(array(array(0x0A), array(0x0A), array(0x0D, 0x0A))) + + ->register('mime.characterreaderfactory') + ->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory') + + ->register('mime.safeqpcontentencoder') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') + ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer')) + + ->register('mime.rawcontentencoder') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder') + + ->register('mime.nativeqpcontentencoder') + ->withDependencies(array('properties.charset')) + ->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder') + + ->register('mime.qpcontentencoderproxy') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy') + ->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset')) + + ->register('mime.7bitcontentencoder') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') + ->addConstructorValue('7bit') + ->addConstructorValue(true) + + ->register('mime.8bitcontentencoder') + ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') + ->addConstructorValue('8bit') + ->addConstructorValue(true) + + ->register('mime.base64contentencoder') + ->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder') + + ->register('mime.rfc2231encoder') + ->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder') + ->withDependencies(array('mime.charstream')) + + // As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly. + // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629 + ->register('mime.qpcontentencoder') + ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') +; + +unset($swift_mime_types); diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php new file mode 100644 index 00000000000..77e432cfac0 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php @@ -0,0 +1,76 @@ +register('transport.smtp') + ->asNewInstanceOf('Swift_Transport_EsmtpTransport') + ->withDependencies(array( + 'transport.buffer', + array('transport.authhandler'), + 'transport.eventdispatcher', + )) + + ->register('transport.sendmail') + ->asNewInstanceOf('Swift_Transport_SendmailTransport') + ->withDependencies(array( + 'transport.buffer', + 'transport.eventdispatcher', + )) + + ->register('transport.mail') + ->asNewInstanceOf('Swift_Transport_MailTransport') + ->withDependencies(array('transport.mailinvoker', 'transport.eventdispatcher')) + + ->register('transport.loadbalanced') + ->asNewInstanceOf('Swift_Transport_LoadBalancedTransport') + + ->register('transport.failover') + ->asNewInstanceOf('Swift_Transport_FailoverTransport') + + ->register('transport.spool') + ->asNewInstanceOf('Swift_Transport_SpoolTransport') + ->withDependencies(array('transport.eventdispatcher')) + + ->register('transport.null') + ->asNewInstanceOf('Swift_Transport_NullTransport') + ->withDependencies(array('transport.eventdispatcher')) + + ->register('transport.mailinvoker') + ->asSharedInstanceOf('Swift_Transport_SimpleMailInvoker') + + ->register('transport.buffer') + ->asNewInstanceOf('Swift_Transport_StreamBuffer') + ->withDependencies(array('transport.replacementfactory')) + + ->register('transport.authhandler') + ->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler') + ->withDependencies(array( + array( + 'transport.crammd5auth', + 'transport.loginauth', + 'transport.plainauth', + 'transport.ntlmauth', + 'transport.xoauth2auth', + ), + )) + + ->register('transport.crammd5auth') + ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator') + + ->register('transport.loginauth') + ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_LoginAuthenticator') + + ->register('transport.plainauth') + ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_PlainAuthenticator') + + ->register('transport.xoauth2auth') + ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_XOAuth2Authenticator') + + ->register('transport.ntlmauth') + ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_NTLMAuthenticator') + + ->register('transport.eventdispatcher') + ->asNewInstanceOf('Swift_Events_SimpleEventDispatcher') + + ->register('transport.replacementfactory') + ->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory') +; diff --git a/htdocs/includes/swiftmailer/lib/mime_types.php b/htdocs/includes/swiftmailer/lib/mime_types.php new file mode 100644 index 00000000000..2d7b98dc1aa --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/mime_types.php @@ -0,0 +1,1007 @@ + 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/x-aac', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/pkix-attr-cert', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'apk' => 'application/vnd.android.package-archive', + 'appcache' => 'text/cache-manifest', + 'apr' => 'application/vnd.lotus-approach', + 'aps' => 'application/postscript', + 'arc' => 'application/x-freearc', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/basic', + 'avi' => 'video/x-msvideo', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azw' => 'application/vnd.amazon.ebook', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'btif' => 'image/prs.btif', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/java-vm', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'csh' => 'application/x-csh', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/x-msdownload', + 'dmg' => 'application/x-apple-diskimage', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.document.macroenabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dra' => 'audio/vnd.dra', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'application/x-msmetafile', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/x-msdownload', + 'exi' => 'application/exi', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/x-f4v', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'geo' => 'application/vnd.dynageo', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'gz' => 'application/x-gzip', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hdf' => 'application/x-hdf', + 'hh' => 'text/x-c', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'java' => 'text/x-java-source', + 'jisp' => 'application/vnd.jisp', + 'jlt' => 'application/vnd.hp-jlyt', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jpm' => 'video/jpm', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'jsonml' => 'application/jsonml+json', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'lha' => 'application/x-lzh-compressed', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/x-lzh-compressed', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm1v' => 'video/mpeg', + 'm21' => 'application/mp21', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'audio/x-mpegurl', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/mp4', + 'm4u' => 'video/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'mar' => 'application/octet-stream', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp21' => 'application/mp21', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msl' => 'application/vnd.mobius.msl', + 'msty' => 'application/vnd.muvee.style', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'ntf' => 'application/vnd.nitf', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obj' => 'application/x-tgif', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'org' => 'application/vnd.lotus-organizer', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'application/x-font-otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p10' => 'application/pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/vnd.palm', + 'pdf' => 'application/pdf', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp-encrypted', + 'php' => 'application/x-php', + 'php3' => 'application/x-php', + 'php4' => 'application/x-php', + 'php5' => 'application/x-php', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'application/x-mobipocket-ebook', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'image/vnd.adobe.photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-pn-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'application/vnd.rn-realmedia', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsd' => 'application/rsd+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'rtx' => 'text/richtext', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shf' => 'application/shf+xml', + 'sid' => 'image/x-mrsid-image', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil+xml', + 'smil' => 'application/smil+xml', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'application/vnd.ms-pki.stl', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tga' => 'image/x-tga', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tmo' => 'application/vnd.tmobile-livetv', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trm' => 'application/x-msterminal', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'application/x-font-ttf', + 'ttf' => 'application/x-font-ttf', + 'ttl' => 'text/turtle', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u32' => 'application/x-authorware-bin', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webm' => 'video/webm', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgt' => 'application/widget', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'application/x-msmetafile', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'application/font-woff', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x32' => 'application/x-authorware-bin', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+binary', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d+vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/x-xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + '123' => 'application/vnd.lotus-1-2-3', +); diff --git a/htdocs/includes/swiftmailer/lib/preferences.php b/htdocs/includes/swiftmailer/lib/preferences.php new file mode 100644 index 00000000000..e5195014824 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/preferences.php @@ -0,0 +1,25 @@ +setCharset('utf-8'); + +// Without these lines the default caching mechanism is "array" but this uses a lot of memory. +// If possible, use a disk cache to enable attaching large attachments etc. +// You can override the default temporary directory by setting the TMPDIR environment variable. +if (@is_writable($tmpDir = sys_get_temp_dir())) { + $preferences->setTempDir($tmpDir)->setCacheType('disk'); +} + +// this should only be done when Swiftmailer won't use the native QP content encoder +// see mime_deps.php +if (version_compare(phpversion(), '5.4.7', '<')) { + $preferences->setQPDotEscape(false); +} diff --git a/htdocs/includes/swiftmailer/lib/swift_init.php b/htdocs/includes/swiftmailer/lib/swift_init.php new file mode 100644 index 00000000000..5c4bae4f4f1 --- /dev/null +++ b/htdocs/includes/swiftmailer/lib/swift_init.php @@ -0,0 +1,28 @@ + 'application/x-php', + 'php3' => 'application/x-php', + 'php4' => 'application/x-php', + 'php5' => 'application/x-php', + 'zip' => 'application/zip', + 'gif' => 'image/gif', + 'png' => 'image/png', + 'css' => 'text/css', + 'js' => 'text/javascript', + 'txt' => 'text/plain', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'avi' => 'video/avi', + 'bmp' => 'image/bmp', + 'bz2' => 'application/x-bz2', + 'csv' => 'text/csv', + 'dmg' => 'application/x-apple-diskimage', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'eml' => 'message/rfc822', + 'aps' => 'application/postscript', + 'exe' => 'application/x-ms-dos-executable', + 'flv' => 'video/x-flv', + 'gz' => 'application/x-gzip', + 'hqx' => 'application/stuffit', + 'htm' => 'text/html', + 'html' => 'text/html', + 'jar' => 'application/x-java-archive', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'm3u' => 'audio/x-mpegurl', + 'm4a' => 'audio/mp4', + 'mdb' => 'application/x-msaccess', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mov' => 'video/quicktime', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'odg' => 'vnd.oasis.opendocument.graphics', + 'odp' => 'vnd.oasis.opendocument.presentation', + 'odt' => 'vnd.oasis.opendocument.text', + 'ods' => 'vnd.oasis.opendocument.spreadsheet', + 'ogg' => 'audio/ogg', + 'pdf' => 'application/pdf', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'ps' => 'application/postscript', + 'rar' => 'application/x-rar-compressed', + 'rtf' => 'application/rtf', + 'tar' => 'application/x-tar', + 'sit' => 'application/x-stuffit', + 'svg' => 'image/svg+xml', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'ttf' => 'application/x-font-truetype', + 'vcf' => 'text/x-vcard', + 'wav' => 'audio/wav', + 'wma' => 'audio/x-ms-wma', + 'wmv' => 'audio/x-ms-wmv', + 'xls' => 'application/excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + ); + + // wrap array for generating file + foreach ($valid_mime_types_preset as $extension => $mime_type) { + // generate array for mimetype to extension resolver (only first match) + $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; + } + + // collect extensions + $valid_extensions = array(); + + // all extensions from second match + foreach ($matches[2] as $i => $extensions) { + // explode multiple extensions from string + $extensions = explode(' ', strtolower($extensions)); + + // force array for foreach + if (!is_array($extensions)) { + $extensions = array($extensions); + } + + foreach ($extensions as $extension) { + // get mime type + $mime_type = $matches[1][$i]; + + // check if string length lower than 10 + if (strlen($extension) < 10) { + // add extension + $valid_extensions[] = $extension; + + if (!isset($valid_mime_types[$mime_type])) { + // generate array for mimetype to extension resolver (only first match) + $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; + } + } + } + } + } + + $xml = simplexml_load_string($mime_xml); + + foreach ($xml as $node) { + // check if there is no pattern + if (!isset($node->glob['pattern'])) { + continue; + } + + // get all matching extensions from match + foreach ((array) $node->glob['pattern'] as $extension) { + // skip none glob extensions + if (strpos($extension, '.') === false) { + continue; + } + + // remove get only last part + $extension = explode('.', strtolower($extension)); + $extension = end($extension); + + // maximum length in database column + if (strlen($extension) <= 9) { + $valid_extensions[] = $extension; + } + } + + if (isset($node->glob['pattern'][0])) { + // mime type + $mime_type = strtolower((string) $node['type']); + + // get first extension + $extension = strtolower(trim($node->glob['ddpattern'][0], '*.')); + + // skip none glob extensions and check if string length between 1 and 10 + if (strpos($extension, '.') !== false || strlen($extension) < 1 || strlen($extension) > 9) { + continue; + } + + // check if string length lower than 10 + if (!isset($valid_mime_types[$mime_type])) { + // generate array for mimetype to extension resolver (only first match) + $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; + } + } + } + + // full list of valid extensions only + $valid_mime_types = array_unique($valid_mime_types); + ksort($valid_mime_types); + + // combine mime types and extensions array + $output = "$preamble\$swift_mime_types = array(\n ".implode($valid_mime_types, ",\n ")."\n);"; + + // write mime_types.php config file + @file_put_contents('./mime_types.php', $output); +} + +generateUpToDateMimeArray(); diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php deleted file mode 100644 index 67d22e72594..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(2, 30, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php deleted file mode 100644 index 9e44909f4f0..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(2, 30, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php deleted file mode 100644 index f7b585acfec..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(2, 30, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php deleted file mode 100644 index a74a30460e7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(2, 40, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php deleted file mode 100644 index dc7bab324e6..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php deleted file mode 100644 index 87b7a33064e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(6, 6, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php deleted file mode 100644 index 523ebfa3ca9..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php deleted file mode 100644 index 4470981e656..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php deleted file mode 100644 index 4c4e9ee748e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php deleted file mode 100644 index df939bb11a7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(4, 4, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php deleted file mode 100644 index fb29ea2493d..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php deleted file mode 100644 index 94e1c71c5e1..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php deleted file mode 100644 index ac828f7d3e5..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php deleted file mode 100644 index 71f87101540..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(6, 6, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php deleted file mode 100644 index 1baa43dec29..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php deleted file mode 100644 index 99d65908f47..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php +++ /dev/null @@ -1,53 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php b/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php deleted file mode 100644 index a0bde57e04c..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php +++ /dev/null @@ -1,37 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -//============================================================+ - -/** - * Example of alternative configuration file for TCPDF. - * @author Nicola Asuni - * @package com.tecnick.tcpdf - * @version 4.9.005 - * @since 2004-10-27 - */ - -/** - * Define the following constant to ignore the default configuration file. - */ -define ('K_TCPDF_EXTERNAL_CONFIG', true); - -/** - * 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', ''); - -/** - * 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', ''); - -/** - * 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/'); - -/** - * 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', dirname(__FILE__).'/../images/'); - -/** - * 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', 'tcpdf_logo.jpg'); - -/** - * Header logo image width in user units. - */ -define ('PDF_HEADER_LOGO_WIDTH', 30); - -/** - * Cache directory for temporary files (full path). - */ -define ('K_PATH_CACHE', sys_get_temp_dir().'/'); - -/** - * Generic name for a blank image. - */ -define ('K_BLANK_IMAGE', '_blank.png'); - -/** - * Page format. - */ -define ('PDF_PAGE_FORMAT', 'A4'); - -/** - * Page orientation (P=portrait, L=landscape). - */ -define ('PDF_PAGE_ORIENTATION', 'P'); - -/** - * Document creator. - */ -define ('PDF_CREATOR', 'TCPDF'); - -/** - * Document author. - */ -define ('PDF_AUTHOR', 'TCPDF'); - -/** - * Header title. - */ -define ('PDF_HEADER_TITLE', 'TCPDF Example'); - -/** - * Header description string. - */ -define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); - -/** - * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]. - */ -define ('PDF_UNIT', 'mm'); - -/** - * Header margin. - */ -define ('PDF_MARGIN_HEADER', 5); - -/** - * Footer margin. - */ -define ('PDF_MARGIN_FOOTER', 10); - -/** - * Top margin. - */ -define ('PDF_MARGIN_TOP', 27); - -/** - * Bottom margin. - */ -define ('PDF_MARGIN_BOTTOM', 25); - -/** - * Left margin. - */ -define ('PDF_MARGIN_LEFT', 15); - -/** - * Right margin. - */ -define ('PDF_MARGIN_RIGHT', 15); - -/** - * Default main font name. - */ -define ('PDF_FONT_NAME_MAIN', 'helvetica'); - -/** - * Default main font size. - */ -define ('PDF_FONT_SIZE_MAIN', 10); - -/** - * Default data font name. - */ -define ('PDF_FONT_NAME_DATA', 'helvetica'); - -/** - * Default data font size. - */ -define ('PDF_FONT_SIZE_DATA', 8); - -/** - * Default monospaced font name. - */ -define ('PDF_FONT_MONOSPACED', 'courier'); - -/** - * Ratio used to adjust the conversion of pixels to user units. - */ -define ('PDF_IMAGE_SCALE_RATIO', 1.25); - -/** - * 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 and 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/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt b/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt deleted file mode 100644 index f0491391cf0..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt +++ /dev/null @@ -1,40 +0,0 @@ -Bag Attributes - localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C -subject=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT -issuer=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT ------BEGIN CERTIFICATE----- -MIIC1TCCAj6gAwIBAgIKkehOL/XGkB5cjjANBgkqhkiG9w0BAQUFADBhMRMwEQYD -VQQDEwpUQ1BERiBERU1PMQ4wDAYDVQQKEwVUQ1BERjENMAsGA1UECxMEREVNTzEe -MBwGCSqGSIb3DQEJARYPeW91QGV4YW1wbGUuY29tMQswCQYDVQQGEwJJVDAeFw0w -OTA4MjExMjU0NDhaFw0xNDA4MjExMjU0NDhaMGExEzARBgNVBAMTClRDUERGIERF -TU8xDjAMBgNVBAoTBVRDUERGMQ0wCwYDVQQLEwRERU1PMR4wHAYJKoZIhvcNAQkB -Fg95b3VAZXhhbXBsZS5jb20xCzAJBgNVBAYTAklUMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H -XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0 -Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB -o4GTMIGQMDcGA1UdEgQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwGA1UECgwFVENQ -REagCwYDVQQLDARERU1PMDcGA1UdEQQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwG -A1UECgwFVENQREagCwYDVQQLDARERU1PMA8GCSqGSIb3LwEBCgQCBQAwCwYDVR0P -BAQDAgSQMA0GCSqGSIb3DQEBBQUAA4GBAEhTQfqX3ZNdHmpTLDbIj22RHXii2roE -OavCbu9WsHoWpva0qSd+yIoD594VHvYAd29sfzDfiN+7W0aiZfDhq5jpaSQMVlN8 -RGYMupbHY/+a9Gz1wqxnR84mlTtIkZVRYAhsfPwy6M1BEjdMqfdh9h40JIdkdjtb -8faTCfXPePWQ ------END CERTIFICATE----- -Bag Attributes - localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C -Key Attributes: ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H -XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0 -Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB -AoGAXc+wNMmz/5Z+RlIKYia44klmqbplEx+0JULqXI4BQsrqvs67i+I4bJkznoL+ -rEIRYSuQ3sCRKFsFtckjTGpxadnxkB+uwGKc6pZChv99BFX6HFR4hgBlT/BBRAQA -hMDlM2JIRr4S4SMVXR7MHwGMUf9mUeanGLR3ZWtU3aXJrIECQQD7OaYUVYNEEnM9 -uXyjm22CuHyqyEf5gb13sK0uQty67547yJTMUQZd/sQc9KGwhzBbhrob2LO2jAhh -S+f+NSRnAkEAxFHm3fMI5RgXmswxlGm4QW07a/Ueo7ZJG6xjTkFXluJhd+XHswRD -dQIO3zG9nGjNUoeMrPhXhPvKqFc2F9RDuQJAQBEGin74N77gxqfr4ik79y8nE8J5 -oGZ2s/RJZdfFRKLg3mwbjjNHhWb4Ck5UgZkoOt8TzRApXG8/n9hktE5HFwJBALur -M5AueO1Pl5kB489lNJ9OxUQRYUXMxpxuscuoCQwSwmv0O2+0/qtG2WKhUQnI4aYo -L+FV0YwtivBb1jj3T/kCQQDIWOxq8eRowdaMzvJpRUHFgMcf1AVZExKyrugwYOWd -KNsDxC4KaQOsPt8iT/Ulo4g/MJC0HolCOhWibKmR9Ayl ------END RSA PRIVATE KEY----- diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf b/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf deleted file mode 100644 index a8f7c35d9af..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 b/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 deleted file mode 100644 index 611f0dfb179..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt b/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt deleted file mode 100644 index 4025de9303f..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt +++ /dev/null @@ -1,19 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. - -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. - -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. - -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. - -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. - -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. - -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat. diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt b/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt deleted file mode 100644 index a0210ff020e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt +++ /dev/null @@ -1,23 +0,0 @@ -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

- - - -

Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

- -

Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.

- -

Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.

- -

Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

- -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

- - - -

Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

- -

Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.

- -

Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.

- -

Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/table_data_demo.txt b/htdocs/includes/tecnickcom/tcpdf/examples/data/table_data_demo.txt deleted file mode 100644 index 5a48a42e77b..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/data/table_data_demo.txt +++ /dev/null @@ -1,15 +0,0 @@ -Austria;Vienna;83859;8075 -Belgium;Brussels;30518;10192 -Denmark;Copenhagen;43094;5295 -Finland;Helsinki;304529;5147 -France;Paris;543965;58728 -Germany;Berlin;357022;82057 -Greece;Athens;131625;10511 -Ireland;Dublin;70723;3694 -Italy;Roma;301316;57563 -Luxembourg;Luxembourg;2586;424 -Netherlands;Amsterdam;41526;15654 -Portugal;Lisbon;91906;9957 -Spain;Madrid;504790;39348 -Sweden;Stockholm;410934;8839 -United Kingdom;London;243820;58862 diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/data/utf8test.txt b/htdocs/includes/tecnickcom/tcpdf/examples/data/utf8test.txt deleted file mode 100644 index 291d4e73554..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/data/utf8test.txt +++ /dev/null @@ -1,128 +0,0 @@ -Sentences that contain all letters commonly used in a language --------------------------------------------------------------- - -This file is UTF-8 encoded. - -Czech (cz) ---------- - - Příšerně žluťoučký kůň úpěl ďábelské ódy. - Hleď, toť přízračný kůň v mátožné póze šíleně úpí. - Zvlášť zákeřný učeň s ďolíčky běží podél zóny úlů. - Loď čeří kýlem tůň obzvlášť v Grónské úžině. - Ó, náhlý déšť již zvířil prach a čilá laň teď běží s houfcem gazel k úkrytům. - -Danish (da) ---------- - - Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen - Wolther spillede på xylofon. - (= Quiz contestants were eating strawbery with cream while Wolther - the circus clown played on xylophone.) - -German (de) ------------ - - Falsches Üben von Xylophonmusik quält jeden größeren Zwerg - (= Wrongful practicing of xylophone music tortures every larger dwarf) - - Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich - (= Twelve boxing fighters hunted Eva across the dike of Sylt) - - Heizölrückstoßabdämpfung - (= fuel oil recoil absorber) - (jqvwxy missing, but all non-ASCII letters in one word) - -English (en) ------------- - - The quick brown fox jumps over the lazy dog - -Spanish (es) ------------- - - El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y - frío, añoraba a su querido cachorro. - (Contains every letter and every accent, but not every combination - of vowel + acute.) - -French (fr) ------------ - - Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à - côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce - qui lui permet de penser à la cænogenèse de l'être dont il est question - dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui, - pense-t-il, diminue çà et là la qualité de son œuvre. - - l'île exiguë - Où l'obèse jury mûr - Fête l'haï volapük, - Âne ex aéquo au whist, - Ôtez ce vœu déçu. - - Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en - canoë au delà des îles, près du mälström où brûlent les novæ. - -Irish Gaelic (ga) ------------------ - - D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh - -Hungarian (hu) --------------- - - Árvíztűrő tükörfúrógép - (= flood-proof mirror-drilling machine, only all non-ASCII letters) - -Icelandic (is) --------------- - - Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa - - Sævör grét áðan því úlpan var ónýt - (some ASCII letters missing) - -Greek (el) -------------- - - Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο - (= No more shall I see acacias or myrtles in the golden clearing) - - Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία - (= I uncover the soul-destroying abhorrence) - -Hebrew (iw) ------------ - - ? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה - -Polish (pl) ------------ - - Pchnąć w tę łódź jeża lub osiem skrzyń fig - (= To push a hedgehog or eight bins of figs in this boat) - - Zażółć gęślą jaźń - -Russian (ru) ------------- - - В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! - (= Would a citrus live in the bushes of south? Yes, but only a fake one!) - -Thai (th) ---------- - - [--------------------------|------------------------] - ๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน - จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร - ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย - ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ - - [The copyright for the Thai example is owned by The Computer - Association of Thailand under the Royal Patronage of His Majesty the - King.] - -Please let me know if you find others! Special thanks to the people -from all over the world who contributed these sentences. diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_001.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_001.php deleted file mode 100644 index 055c66af98d..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_001.php +++ /dev/null @@ -1,106 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 001'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128)); -$pdf->setFooterData(array(0,64,0), array(0,64,128)); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// Set font -// dejavusans is a UTF-8 Unicode font, if you only need to -// print standard ASCII chars, you can use core fonts like -// helvetica or times to reduce file size. -$pdf->SetFont('dejavusans', '', 14, '', true); - -// Add a page -// This method has several options, check the source code documentation for more information. -$pdf->AddPage(); - -// set text shadow effect -$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); - -// Set some content to print -$html = <<Welcome to  TCPDF ! -This is the first example of TCPDF library. -

This text is printed using the writeHTMLCell() method but you can also use: Multicell(), writeHTML(), Write(), Cell() and Text().

-

Please check the source code documentation and other examples for further information.

-

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

-EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -// --------------------------------------------------------- - -// Close and output PDF document -// This method has several options, check the source code documentation for more information. -$pdf->Output('example_001.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_002.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_002.php deleted file mode 100644 index 020dd299063..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_002.php +++ /dev/null @@ -1,87 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 002'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// remove default header/footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', 'BI', 20); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'C', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_002.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_003.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_003.php deleted file mode 100644 index 73a0e8c1a7a..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_003.php +++ /dev/null @@ -1,118 +0,0 @@ -Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false); - // Set font - $this->SetFont('helvetica', 'B', 20); - // Title - $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M'); - } - - // Page footer - public function Footer() { - // Position at 15 mm from bottom - $this->SetY(-15); - // Set font - $this->SetFont('helvetica', 'I', 8); - // Page number - $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 003'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', 'BI', 12); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'C', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_003.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_004.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_004.php deleted file mode 100644 index 88e08c1b7e7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_004.php +++ /dev/null @@ -1,121 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 004'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 004', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 11); - -// add a page -$pdf->AddPage(); - -//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') - -// test Cell stretching -$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); - -$pdf->Ln(5); - -$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); - -$pdf->AddPage(); - -// example using general stretching and spacing - -for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - - // set general stretching (scaling) value - $pdf->setFontStretching($stretching); - - // set general spacing value - $pdf->setFontSpacing($spacing); - - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4); - - $pdf->Ln(2); - } -} - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_004.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_005.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_005.php deleted file mode 100644 index 5a592d16876..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_005.php +++ /dev/null @@ -1,158 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 005'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 10); - -// add a page -$pdf->AddPage(); - -// set cell padding -$pdf->setCellPaddings(1, 1, 1, 1); - -// set cell margins -$pdf->setCellMargins(1, 1, 1, 1); - -// set color for background -$pdf->SetFillColor(255, 255, 127); - -// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) - -// set some text for example -$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; - -// Multicell test -$pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true); -$pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true); -$pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true); -$pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true); -$pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true); - -$pdf->Ln(4); - -// set color for background -$pdf->SetFillColor(220, 255, 220); - -// Vertical alignment -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T'); -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M'); -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] '.$txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B'); - -$pdf->Ln(4); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set color for background -$pdf->SetFillColor(215, 235, 255); - -// set some text for example -$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; - -// print a blox of text using multicell() -$pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// AUTO-FITTING - -// set color for background -$pdf->SetFillColor(255, 235, 235); - -// Fit text on cell by reducing font size -$pdf->MultiCell(55, 60, '[FIT CELL] '.$txt."\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// CUSTOM PADDING - -// set color for background -$pdf->SetFillColor(255, 255, 215); - -// set font -$pdf->SetFont('helvetica', '', 8); - -// set cell padding -$pdf->setCellPaddings(2, 4, 6, 8); - -$txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n"; - -$pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true); - -// move pointer to last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_005.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_006.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_006.php deleted file mode 100644 index 481f70e5478..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_006.php +++ /dev/null @@ -1,330 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 006'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('dejavusans', '', 10); - -// add a page -$pdf->AddPage(); - -// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') -// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) - -// create some HTML content -$html = '

HTML Example

-Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash -

List

-List example: -
    -
  1. test alt attribute test image
  2. -
  3. bold text
  4. -
  5. italic text
  6. -
  7. underlined text
  8. -
  9. bbibiubib
  10. -
  11. link to http://www.tecnick.com
  12. -
  13. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
    Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
  14. -
  15. SUBLIST -
      -
    1. row one -
        -
      • sublist
      • -
      -
    2. -
    3. row two
    4. -
    -
  16. -
  17. TEST line through
  18. -
  19. font + 3
  20. -
  21. small text normal small text normal subscript normal superscript normal
  22. -
-
-
Coffee
-
Black hot drink
-
Milk
-
White cold drink
-
-
IMAGES
-test alt attributetest alt attributetest alt attribute -
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - - -// output some RTL HTML content -$html = '
The words “מזל [mazel] טוב [tov]” mean “Congratulations!”
'; -$pdf->writeHTML($html, true, false, true, false, ''); - -// test some inline CSS -$html = '

This is just an example of html code to demonstrate some supported CSS inline styles. -bold text -line-trough -underline and line-trough -color -background color -bold -xx-small -x-small -small -medium -large -x-large -xx-large -

'; - -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print a table - -// add a page -$pdf->AddPage(); - -// create some HTML content -$subtable = '
'.$langs->trans('Payments').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').'
'.img_object($langs->trans('ShowPayment'),'payment').' '.dol_print_date($db->jdate($objp->dp),'day')."
'; + $paymentstatic->id=$objp->rowid; + $paymentstatic->datepaye=$db->jdate($objp->dp); + $paymentstatic->ref=$objp->ref; + $paymentstatic->num_paiement=$objp->num_paiement; + $paymentstatic->payment_code=$objp->payment_code; + print $paymentstatic->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->dp), 'day') . ''; print $form->form_modes_reglement(null, $objp->paiement_type,'none').' '.$objp->num_paiement; print ''; if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions'); print '
ab
cd
'; - -$html = '

HTML TABLE:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#RIGHT alignLEFT align4A
1A1 example link column span. One two tree four five six seven eight nine ten.
line after br
small text normal subscript normal superscript normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
  1. first
    1. sublist
    2. sublist
  2. second
small small small small small small small small small small small small small small small small small small small small
4B
'.$subtable.'A2 € € € & è è
A2 € € € & è è
Red Yellow BG4C
1A2AA
2AB
2AC
4D
1B4E
1C2C3C4F
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// Print some HTML Cells - -$html = 'red green blue
red green blue'; - -$pdf->SetFillColor(255,255,0); - -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true); -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true); -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print a table - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = '

Image alignments on HTML table

- - - - - - - - -
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print all HTML colors - -// add a page -$pdf->AddPage(); - -$textcolors = '

HTML Text Colors

'; -$bgcolors = '

HTML Background Colors

'; - -foreach(TCPDF_COLORS::$webcolor as $k => $v) { - $textcolors .= ''.$v.' '; - $bgcolors .= ''.$v.' '; -} - -// output the HTML content -$pdf->writeHTML($textcolors, true, false, true, false, ''); -$pdf->writeHTML($bgcolors, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Test word-wrap - -// create some HTML content -$html = '
-

Various tests

-link to page 2
-thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// Test fonts nesting -$html1 = 'Default Courier Helvetica Times dejavusans Times Helvetica Courier Default'; -$html2 = 'small text normal small text normal subscript normal superscript normal'; -$html3 = 'The quick brown fox jumps over the lazy dog.'; - -$html = $html1.'
'.$html2.'
'.$html3.'
'.$html3.'
'.$html2; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test pre tag - -// add a page -$pdf->AddPage(); - -$html = << -Hello World!
-Hello - -
-int main() {
-    printf("HelloWorld");
-    return 0;
-}
-
-Monospace font, normal font, monospace font, normal font. -
-
DIV LEVEL 1
DIV LEVEL 2
DIV LEVEL 1
-
-SPAN LEVEL 1 SPAN LEVEL 2 SPAN LEVEL 1 -EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test custom bullet points for list - -// add a page -$pdf->AddPage(); - -$html = <<Test custom bullet image for list items -
    -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
      -EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_006.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_007.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_007.php deleted file mode 100644 index 97ebecb2e1c..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_007.php +++ /dev/null @@ -1,113 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 007'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 007', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 12); - -// add a page -$pdf->AddPage(); - -// create columns content -$left_column = 'LEFT COLUMN left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'; - -$right_column = 'RIGHT COLUMN right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'; - -// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) - -// get current vertical position -$y = $pdf->getY(); - -// set color for background -$pdf->SetFillColor(255, 255, 200); - -// set color for text -$pdf->SetTextColor(0, 63, 127); - -// write the first column -$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true); - -// set color for background -$pdf->SetFillColor(215, 235, 255); - -// set color for text -$pdf->SetTextColor(127, 31, 0); - -// write the second column -$pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_007.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_008.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_008.php deleted file mode 100644 index 4349c3861de..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_008.php +++ /dev/null @@ -1,97 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 008'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 008', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// set font -$pdf->SetFont('freeserif', '', 12); - -// add a page -$pdf->AddPage(); - -// get esternal file content -$utf8text = file_get_contents('data/utf8test.txt', false); - -// set color for text -$pdf->SetTextColor(0, 63, 127); - -//Write($h, $txt, $link='', $fill=0, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0) - -// write the text -$pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_008.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_009.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_009.php deleted file mode 100644 index 235dd721d84..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_009.php +++ /dev/null @@ -1,146 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 009'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// ------------------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set JPEG quality -$pdf->setJPEGQuality(75); - -// Image method signature: -// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false) - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Example of Image from data stream ('PHP rules') -$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='); - -// The '@' character is used to indicate that follows an image data stream and not an image file name -$pdf->Image('@'.$imgdata); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Image example with resizing -$pdf->Image('images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test fitbox with all alignment combinations - -$horizontal_alignments = array('L', 'C', 'R'); -$vertical_alignments = array('T', 'M', 'B'); - -$x = 15; -$y = 35; -$w = 30; -$h = 30; -// test all combinations of alignments -for ($i = 0; $i < 3; ++$i) { - $fitbox = $horizontal_alignments[$i].' '; - $x = 15; - for ($j = 0; $j < 3; ++$j) { - $fitbox[1] = $vertical_alignments[$j]; - $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,128)); - $pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false); - $x += 32; // new column - } - $y += 32; // new row -} - -$x = 115; -$y = 35; -$w = 25; -$h = 50; -for ($i = 0; $i < 3; ++$i) { - $fitbox = $horizontal_alignments[$i].' '; - $x = 115; - for ($j = 0; $j < 3; ++$j) { - $fitbox[1] = $vertical_alignments[$j]; - $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,255)); - $pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false); - $x += 27; // new column - } - $y += 52; // new row -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Stretching, position and alignment example - -$pdf->SetXY(110, 200); -$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false); -$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false); - -// ------------------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_009.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_010.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_010.php deleted file mode 100644 index 5b980b04d6e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_010.php +++ /dev/null @@ -1,150 +0,0 @@ -AddPage(); - // disable existing columns - $this->resetColumns(); - // print chapter title - $this->ChapterTitle($num, $title); - // set columns - $this->setEqualColumns(3, 57); - // print chapter body - $this->ChapterBody($file, $mode); - } - - /** - * Set chapter title - * @param $num (int) chapter number - * @param $title (string) chapter title - * @public - */ - public function ChapterTitle($num, $title) { - $this->SetFont('helvetica', '', 14); - $this->SetFillColor(200, 220, 255); - $this->Cell(180, 6, 'Chapter '.$num.' : '.$title, 0, 1, '', 1); - $this->Ln(4); - } - - /** - * Print chapter body - * @param $file (string) name of the file containing the chapter body - * @param $mode (boolean) if true the chapter body is in HTML, otherwise in simple text. - * @public - */ - public function ChapterBody($file, $mode=false) { - $this->selectColumn(); - // get esternal file content - $content = file_get_contents($file, false); - // set font - $this->SetFont('times', '', 9); - $this->SetTextColor(50, 50, 50); - // print content - if ($mode) { - // ------ HTML MODE ------ - $this->writeHTML($content, true, false, true, false, 'J'); - } else { - // ------ TEXT MODE ------ - $this->Write(0, $content, '', 0, 'J', true, 0, false, true, 0); - } - $this->Ln(); - } -} // end of extended class - -// --------------------------------------------------------- -// EXAMPLE -// --------------------------------------------------------- -// create new PDF document -$pdf = new MC_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 010'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 010', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// print TEXT -$pdf->PrintChapter(1, 'LOREM IPSUM [TEXT]', 'data/chapter_demo_1.txt', false); - -// print HTML -$pdf->PrintChapter(2, 'LOREM IPSUM [HTML]', 'data/chapter_demo_2.txt', true); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_010.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_011.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_011.php deleted file mode 100644 index 623ba3b8699..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_011.php +++ /dev/null @@ -1,138 +0,0 @@ -SetFillColor(255, 0, 0); - $this->SetTextColor(255); - $this->SetDrawColor(128, 0, 0); - $this->SetLineWidth(0.3); - $this->SetFont('', 'B'); - // Header - $w = array(40, 35, 40, 45); - $num_headers = count($header); - for($i = 0; $i < $num_headers; ++$i) { - $this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); - } - $this->Ln(); - // Color and font restoration - $this->SetFillColor(224, 235, 255); - $this->SetTextColor(0); - $this->SetFont(''); - // Data - $fill = 0; - foreach($data as $row) { - $this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill); - $this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill); - $this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill); - $this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill); - $this->Ln(); - $fill=!$fill; - } - $this->Cell(array_sum($w), 0, '', 'T'); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 011'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 011', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// column titles -$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)'); - -// data loading -$data = $pdf->LoadData('data/table_data_demo.txt'); - -// print colored table -$pdf->ColoredTable($header, $data); - -// --------------------------------------------------------- - -// close and output PDF document -$pdf->Output('example_011.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_012.pdf b/htdocs/includes/tecnickcom/tcpdf/examples/example_012.pdf deleted file mode 100644 index eec8ee0cd91..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/example_012.pdf and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_012.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_012.php deleted file mode 100644 index aaa196b7a7d..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_012.php +++ /dev/null @@ -1,205 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 012'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// disable header and footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,20,5,10', 'phase' => 10, 'color' => array(255, 0, 0)); -$style2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)); -$style3 = array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0)); -$style4 = array('L' => 0, - 'T' => array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => '20,10', 'phase' => 10, 'color' => array(100, 100, 255)), - 'R' => array('width' => 0.50, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(50, 50, 127)), - 'B' => array('width' => 0.75, 'cap' => 'square', 'join' => 'miter', 'dash' => '30,10,5,10')); -$style5 = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 64, 128)); -$style6 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,10', 'color' => array(0, 128, 0)); -$style7 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 128, 0)); - -// Line -$pdf->Text(5, 4, 'Line examples'); -$pdf->Line(5, 10, 80, 30, $style); -$pdf->Line(5, 10, 5, 30, $style2); -$pdf->Line(5, 10, 80, 10, $style3); - -// Rect -$pdf->Text(100, 4, 'Rectangle examples'); -$pdf->Rect(100, 10, 40, 20, 'DF', $style4, array(220, 220, 200)); -$pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3)); - -// Curve -$pdf->Text(5, 34, 'Curve examples'); -$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, null, $style6); -$pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6); -$pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200)); - -// Circle and ellipse -$pdf->Text(5, 79, 'Circle and ellipse examples'); -$pdf->SetLineStyle($style5); -$pdf->Circle(25,105,20); -$pdf->Circle(25,105,10, 90, 180, null, $style6); -$pdf->Circle(25,105,10, 270, 360, 'F'); -$pdf->Circle(25,105,10, 270, 360, 'C', $style6); - -$pdf->SetLineStyle($style5); -$pdf->Ellipse(100,103,40,20); -$pdf->Ellipse(100,105,20,10, 0, 90, 180, null, $style6); -$pdf->Ellipse(100,105,20,10, 0, 270, 360, 'DF', $style6); - -$pdf->SetLineStyle($style5); -$pdf->Ellipse(175,103,30,15,45); -$pdf->Ellipse(175,105,15,7.50, 45, 90, 180, null, $style6); -$pdf->Ellipse(175,105,15,7.50, 45, 270, 360, 'F', $style6, array(220, 200, 200)); - -// Polygon -$pdf->Text(5, 129, 'Polygon examples'); -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Polygon(array(5,135,45,135,15,165)); -$pdf->Polygon(array(60,135,80,135,80,155,70,165,50,155), 'DF', array($style6, $style7, $style7, 0, $style6), array(220, 200, 200)); -$pdf->Polygon(array(120,135,140,135,150,155,110,155), 'D', array($style6, 0, $style7, $style6)); -$pdf->Polygon(array(160,135,190,155,170,155,200,160,160,165), 'DF', array('all' => $style6), array(220, 220, 220)); - -// Polygonal Line -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 164))); -$pdf->PolyLine(array(80,165,90,160,100,165,110,160,120,165,130,160,140,165), 'D', array(), array()); - -// Regular polygon -$pdf->Text(5, 169, 'Regular polygon examples'); -$pdf->SetLineStyle($style5); -$pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F'); -$pdf->RegularPolygon(55, 190, 15, 6); -$pdf->RegularPolygon(55, 190, 10, 6, 45, 0, 'DF', array($style6, 0, $style7, 0, $style7, $style7)); -$pdf->RegularPolygon(90, 190, 15, 3, 0, 1, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200)); -$pdf->RegularPolygon(125, 190, 15, 4, 30, 1, null, array('all' => $style5), null, null, $style6); -$pdf->RegularPolygon(160, 190, 15, 10); - -// Star polygon -$pdf->Text(5, 209, 'Star polygon examples'); -$pdf->SetLineStyle($style5); -$pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F'); -$pdf->StarPolygon(55, 230, 15, 12, 5); -$pdf->StarPolygon(55, 230, 7, 12, 5, 45, 0, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(90, 230, 15, 20, 6, 0, 1, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(125, 230, 15, 5, 2, 30, 1, null, array('all' => $style5), null, null, $style6); -$pdf->StarPolygon(160, 230, 15, 10, 3); -$pdf->StarPolygon(160, 230, 7, 50, 26); - -// Rounded rectangle -$pdf->Text(5, 249, 'Rounded rectangle examples'); -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF'); -$pdf->RoundedRect(50, 255, 40, 30, 6.50, '1000'); -$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', null, $style6); -$pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200)); - -// Arrows -$pdf->Text(185, 249, 'Arrows'); -$pdf->SetLineStyle($style5); -$pdf->SetFillColor(255, 0, 0); -$pdf->Arrow(200, 280, 185, 266, 0, 5, 15); -$pdf->Arrow(200, 280, 190, 263, 1, 5, 15); -$pdf->Arrow(200, 280, 195, 261, 2, 5, 15); -$pdf->Arrow(200, 280, 200, 260, 3, 5, 15); - -// - . - . - . - . - . - . - . - . - . - . - . - . - . - . - - -// ellipse - -// add a page -$pdf->AddPage(); - -$pdf->Cell(0, 0, 'Arc of Ellipse'); - -// center of ellipse -$xc=100; -$yc=100; - -// X Y axis -$pdf->SetDrawColor(200, 200, 200); -$pdf->Line($xc-50, $yc, $xc+50, $yc); -$pdf->Line($xc, $yc-50, $xc, $yc+50); - -// ellipse axis -$pdf->SetDrawColor(200, 220, 255); -$pdf->Line($xc-50, $yc-50, $xc+50, $yc+50); -$pdf->Line($xc-50, $yc+50, $xc+50, $yc-50); - -// ellipse -$pdf->SetDrawColor(200, 255, 200); -$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2); - -// ellipse arc -$pdf->SetDrawColor(255, 0, 0); -$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_012.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_013.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_013.php deleted file mode 100644 index a472760c1c8..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_013.php +++ /dev/null @@ -1,229 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 013'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0); - -// set font -$pdf->SetFont('helvetica', '', 10); - -// --- Scaling --------------------------------------------- -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(50, 70, 40, 10, 'D'); -$pdf->Text(50, 66, 'Scale'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle -$pdf->ScaleXY(150, 50, 80); -$pdf->Rect(50, 70, 40, 10, 'D'); -$pdf->Text(50, 66, 'Scale'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Translation ----------------------------------------- -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(125, 70, 40, 10, 'D'); -$pdf->Text(125, 66, 'Translate'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Translate 7 to the right, 5 to the bottom -$pdf->Translate(7, 5); -$pdf->Rect(125, 70, 40, 10, 'D'); -$pdf->Text(125, 66, 'Translate'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Rotation -------------------------------------------- -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(70, 100, 40, 10, 'D'); -$pdf->Text(70, 96, 'Rotate'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle -$pdf->Rotate(20, 70, 110); -$pdf->Rect(70, 100, 40, 10, 'D'); -$pdf->Text(70, 96, 'Rotate'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Skewing --------------------------------------------- -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(125, 100, 40, 10, 'D'); -$pdf->Text(125, 96, 'Skew'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle -$pdf->SkewX(30, 125, 110); -$pdf->Rect(125, 100, 40, 10, 'D'); -$pdf->Text(125, 96, 'Skew'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring horizontally ------------------------------ -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(70, 130, 40, 10, 'D'); -$pdf->Text(70, 126, 'MirrorH'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle) -$pdf->MirrorH(70); -$pdf->Rect(70, 130, 40, 10, 'D'); -$pdf->Text(70, 126, 'MirrorH'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring vertically -------------------------------- -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(125, 130, 40, 10, 'D'); -$pdf->Text(125, 126, 'MirrorV'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle) -$pdf->MirrorV(140); -$pdf->Rect(125, 130, 40, 10, 'D'); -$pdf->Text(125, 126, 'MirrorV'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Point reflection ------------------------------------ -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(70, 160, 40, 10, 'D'); -$pdf->Text(70, 156, 'MirrorP'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// point reflection at the lower left point of rectangle -$pdf->MirrorP(70,170); -$pdf->Rect(70, 160, 40, 10, 'D'); -$pdf->Text(70, 156, 'MirrorP'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring against a straigth line described by a point (120, 120) and an angle -20° -$angle=-20; -$px=120; -$py=170; - -// just for visualisation: the straight line to mirror against - -$pdf->SetDrawColor(200); -$pdf->Line($px-1,$py-1,$px+1,$py+1); -$pdf->Line($px-1,$py+1,$px+1,$py-1); -$pdf->StartTransform(); -$pdf->Rotate($angle, $px, $py); -$pdf->Line($px-5, $py, $px+60, $py); -$pdf->StopTransform(); - -$pdf->SetDrawColor(200); -$pdf->SetTextColor(200); -$pdf->Rect(125, 160, 40, 10, 'D'); -$pdf->Text(125, 156, 'MirrorL'); -$pdf->SetDrawColor(0); -$pdf->SetTextColor(0); -//Start Transformation -$pdf->StartTransform(); -//mirror against the straight line -$pdf->MirrorL($angle, $px, $py); -$pdf->Rect(125, 160, 40, 10, 'D'); -$pdf->Text(125, 156, 'MirrorL'); -//Stop Transformation -$pdf->StopTransform(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_013.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_014.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_014.php deleted file mode 100644 index 27e4efc460c..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_014.php +++ /dev/null @@ -1,194 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 014'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 014', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// IMPORTANT: disable font subsetting to allow users editing the document -$pdf->setFontSubsetting(false); - -// set font -$pdf->SetFont('helvetica', '', 10, '', false); - -// add a page -$pdf->AddPage(); - -/* -It is possible to create text fields, combo boxes, check boxes and buttons. -Fields are created at the current position and are given a name. -This name allows to manipulate them via JavaScript in order to perform some validation for instance. -*/ - -// set default form properties -$pdf->setFormDefaultProp(array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 200), 'strokeColor'=>array(255, 128, 128))); - -$pdf->SetFont('helvetica', 'BI', 18); -$pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C'); -$pdf->Ln(10); - -$pdf->SetFont('helvetica', '', 12); - -// First name -$pdf->Cell(35, 5, 'First name:'); -$pdf->TextField('firstname', 50, 5); -$pdf->Ln(6); - -// Last name -$pdf->Cell(35, 5, 'Last name:'); -$pdf->TextField('lastname', 50, 5); -$pdf->Ln(6); - -// Gender -$pdf->Cell(35, 5, 'Gender:'); -$pdf->ComboBox('gender', 30, 5, array(array('', '-'), array('M', 'Male'), array('F', 'Female'))); -$pdf->Ln(6); - -// Drink -$pdf->Cell(35, 5, 'Drink:'); -//$pdf->RadioButton('drink', 5, array('readonly' => 'true'), array(), 'Water'); -$pdf->RadioButton('drink', 5, array(), array(), 'Water'); -$pdf->Cell(35, 5, 'Water'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Beer', true); -$pdf->Cell(35, 5, 'Beer'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Wine'); -$pdf->Cell(35, 5, 'Wine'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Milk'); -$pdf->Cell(35, 5, 'Milk'); -$pdf->Ln(10); - -// Newsletter -$pdf->Cell(35, 5, 'Newsletter:'); -$pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK'); - -$pdf->Ln(10); -// Address -$pdf->Cell(35, 5, 'Address:'); -$pdf->TextField('address', 60, 18, array('multiline'=>true, 'lineWidth'=>0, 'borderStyle'=>'none'), array('v'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'dv'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.')); -$pdf->Ln(19); - -// Listbox -$pdf->Cell(35, 5, 'List:'); -$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection'=>'true')); -$pdf->Ln(20); - -// E-mail -$pdf->Cell(35, 5, 'E-mail:'); -$pdf->TextField('email', 50, 5); -$pdf->Ln(6); - -// Date of the day -$pdf->Cell(35, 5, 'Date:'); -$pdf->TextField('date', 30, 5, array(), array('v'=>date('Y-m-d'), 'dv'=>date('Y-m-d'))); -$pdf->Ln(10); - -$pdf->SetX(50); - -// Button to validate and print -$pdf->Button('print', 30, 10, 'Print', 'Print()', array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Reset Button -$pdf->Button('reset', 30, 10, 'Reset', array('S'=>'ResetForm'), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Submit Button -$pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'http://localhost/printvars.php', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Form validation functions -$js = <<IncludeJS($js); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_014.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_015.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_015.php deleted file mode 100644 index 4cc03cabe20..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_015.php +++ /dev/null @@ -1,161 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 015'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 015', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0)) - -// set font -$pdf->SetFont('times', 'B', 20); - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -$pdf->SetFont('times', 'I', 14); -$pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method. -You can set PDF Named Destinations using the setDestination() method.'); - -$pdf->SetFont('times', 'B', 20); - -// add other pages and bookmarks - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,0,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -$pdf->AddPage(); -// add a named destination so you can open this document at this page using the link: "example_015.pdf#chapter2" -$pdf->setDestination('chapter2', 0, ''); -// add a bookmark that points to a named destination -$pdf->Bookmark('Chapter 2', 0, 0, '', 'BI', array(128,0,0), -1, '#chapter2'); -$pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L'); -$pdf->SetFont('times', 'I', 14); -$pdf->Write(0, 'Once saved, you can open this document at this page using the link: "example_015.pdf#chapter2".'); - -$pdf->AddPage(); -$pdf->setDestination('chapter3', 0, ''); -$pdf->SetFont('times', 'B', 20); -$pdf->Bookmark('Chapter 3', 0, 0, '', 'B', array(0,64,128)); -$pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->setDestination('chapter4', 0, ''); -$pdf->SetFont('times', 'B', 20); -$pdf->Bookmark('Chapter 4', 0, 0, '', 'B', array(0,64,128)); -$pdf->Cell(0, 10, 'Chapter 4', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Chapter 5', 0, 0, '', 'B', array(0,128,0)); -$pdf->Cell(0, 10, 'Chapter 5', 0, 1, 'L'); -$txt = 'Example of File Attachment. -Double click on the icon to open the attached file.'; -$pdf->SetFont('helvetica', '', 10); -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// attach an external file TXT file -$pdf->Annotation(20, 50, 5, 5, 'TXT file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'data/utf8test.txt')); - -// attach an external file -$pdf->Annotation(50, 50, 5, 5, 'PDF file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'example_012.pdf')); - -// add a bookmark that points to an embedded file -// NOTE: prefix the file name with the * character for generic file and with % character for PDF file -$pdf->Bookmark('TXT file', 0, 0, '', 'B', array(128,0,255), -1, '*utf8test.txt'); - -// add a bookmark that points to an embedded file -// NOTE: prefix the file name with the * character for generic file and with % character for PDF file -$pdf->Bookmark('PDF file', 0, 0, '', 'B', array(128,0,255), -1, '%example_012.pdf'); - -// add a bookmark that points to an external URL -$pdf->Bookmark('External URL', 0, 0, '', 'B', array(0,0,255), -1, 'http://www.tcpdf.org'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_015.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_016.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_016.php deleted file mode 100644 index 34284f20fb3..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_016.php +++ /dev/null @@ -1,134 +0,0 @@ -SetProtection(array('print', 'copy'), '', null, 0, null); - -// Example with public-key -// To open the document you need to install the private key (tcpdf.p12) on the Acrobat Reader. The password is: 1234 -//$pdf->SetProtection($permissions=array('print', 'copy'), $user_pass='', $owner_pass=null, $mode=1, $pubkeys=array(array('c' => 'file://../config/cert/tcpdf.crt', 'p' => array('print')))); - -// ********************************************************* - - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 016'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 016', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array('helvetica', '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 16); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_016.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_017.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_017.php deleted file mode 100644 index 1324091c872..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_017.php +++ /dev/null @@ -1,117 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 017'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 017', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of independent Multicell() columns', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->SetFont('times', '', 12); - -// create columns content -// create columns content -$left_column = '[LEFT COLUMN] left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'."\n"; - -$right_column = '[RIGHT COLUMN] right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'."\n"; - -// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) - -// set color for background -$pdf->SetFillColor(255, 255, 200); - -// set color for text -$pdf->SetTextColor(0, 63, 127); - -// write the first column -$pdf->MultiCell(80, 0, $left_column, 1, 'J', 1, 0, '', '', true, 0, false, true, 0); - -// set color for background -$pdf->SetFillColor(215, 235, 255); - -// set color for text -$pdf->SetTextColor(127, 31, 0); - -// write the second column -$pdf->MultiCell(80, 0, $right_column, 1, 'J', 1, 1, '', '', true, 0, false, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_017.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_018.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_018.php deleted file mode 100644 index a97a44ac86a..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_018.php +++ /dev/null @@ -1,128 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 018'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language dependent data: -$lg = Array(); -$lg['a_meta_charset'] = 'UTF-8'; -$lg['a_meta_dir'] = 'rtl'; -$lg['a_meta_language'] = 'fa'; -$lg['w_page'] = 'page'; - -// set some language-dependent strings (optional) -$pdf->setLanguageArray($lg); - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('dejavusans', '', 12); - -// add a page -$pdf->AddPage(); - -// Persian and English content -$htmlpersian = 'Persian example:
      سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.
      مشکل حرف \"ژ\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.
      نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.
      با تشکر از "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.'; -$pdf->WriteHTML($htmlpersian, true, 0, true, 0); - -// set LTR direction for english translation -$pdf->setRTL(false); - -$pdf->SetFontSize(10); - -// print newline -$pdf->Ln(); - -// Persian and English content -$htmlpersiantranslation = 'Hi, At last Problem of Persian PDF Solved completely. This is a example for it.
      Problem of "jeh" letter in some word like "ویژه" (=special) fix too.
      The joining of laa and alf letter fix now.
      Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.
      '; -$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0); - -// Restore RTL direction -$pdf->setRTL(true); - -// set font -$pdf->SetFont('aefurat', '', 18); - -// print newline -$pdf->Ln(); - -// Arabic and English content -$pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C'); -$htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـPDF مع دعم الكتابة من اليمين إلى اليسار والحركَات .
      تم الحل بواسطة صالح المطرفي و Asuni Nicola . '; -$pdf->WriteHTML($htmlcontent, true, 0, true, 0); - -// set LTR direction for english translation -$pdf->setRTL(false); - -// print newline -$pdf->Ln(); - -$pdf->SetFont('aealarabiya', '', 18); - -// Arabic and English content -$htmlcontent2 = 'This is Arabic "العربية" Example With TCPDF.'; -$pdf->WriteHTML($htmlcontent2, true, 0, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_018.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_019.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_019.php deleted file mode 100644 index a1d5f08ab69..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_019.php +++ /dev/null @@ -1,98 +0,0 @@ -SetDocInfoUnicode(true); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni [€]'); -$pdf->SetTitle('TCPDF Example 019'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language dependent data: -$lg = Array(); -$lg['a_meta_charset'] = 'ISO-8859-1'; -$lg['a_meta_dir'] = 'ltr'; -$lg['a_meta_language'] = 'en'; -$lg['w_page'] = 'page'; - -// set some language-dependent strings (optional) -$pdf->setLanguageArray($lg); - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// set color for background -$pdf->SetFillColor(200, 255, 200); - -$txt = 'An alternative configuration file is used on this example. -Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.'; - -// print some text -$pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_019.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_020.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_020.php deleted file mode 100644 index 6204f746184..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_020.php +++ /dev/null @@ -1,146 +0,0 @@ -getPage(); - $y_start = $this->GetY(); - - // write the left cell - $this->MultiCell(40, 0, $left, 1, 'R', 1, 2, '', '', true, 0); - - $page_end_1 = $this->getPage(); - $y_end_1 = $this->GetY(); - - $this->setPage($page_start); - - // write the right cell - $this->MultiCell(0, 0, $right, 1, 'J', 0, 1, $this->GetX() ,$y_start, true, 0); - - $page_end_2 = $this->getPage(); - $y_end_2 = $this->GetY(); - - // set the new row position by case - if (max($page_end_1,$page_end_2) == $page_start) { - $ynew = max($y_end_1, $y_end_2); - } elseif ($page_end_1 == $page_end_2) { - $ynew = max($y_end_1, $y_end_2); - } elseif ($page_end_1 > $page_end_2) { - $ynew = $y_end_1; - } else { - $ynew = $y_end_2; - } - - $this->setPage(max($page_end_1,$page_end_2)); - $this->SetXY($this->GetX(),$ynew); - } - -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 020'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 020', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 20); -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of text layout using Multicell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->SetFont('times', '', 9); - -//$pdf->SetCellPadding(0); -//$pdf->SetLineWidth(2); - -// set color for background -$pdf->SetFillColor(255, 255, 200); - -$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; - -// print some rows just as example -for ($i = 0; $i < 10; ++$i) { - $pdf->MultiRow('Row '.($i+1), $text."\n"); -} - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_020.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_021.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_021.php deleted file mode 100644 index 65e39fbf0d0..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_021.php +++ /dev/null @@ -1,91 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 021'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 021', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 9); - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = '

      Example of HTML text flow

      Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

      A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B    ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B

      BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined'; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_021.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_022.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_022.php deleted file mode 100644 index ca35d68a439..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_022.php +++ /dev/null @@ -1,146 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 022'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 022', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// check also the following methods: -// SetDrawColorArray() -// SetFillColorArray() -// SetTextColorArray() - -// set font -$pdf->SetFont('helvetica', 'B', 18); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0); - -// define style for border -$border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0)); - -// --- CMYK ------------------------------------------------ - -$pdf->SetDrawColor(50, 0, 0, 0); -$pdf->SetFillColor(100, 0, 0, 0); -$pdf->SetTextColor(100, 0, 0, 0); -$pdf->Rect(30, 60, 30, 30, 'DF', $border_style); -$pdf->Text(30, 92, 'Cyan'); - -$pdf->SetDrawColor(0, 50, 0, 0); -$pdf->SetFillColor(0, 100, 0, 0); -$pdf->SetTextColor(0, 100, 0, 0); -$pdf->Rect(70, 60, 30, 30, 'DF', $border_style); -$pdf->Text(70, 92, 'Magenta'); - -$pdf->SetDrawColor(0, 0, 50, 0); -$pdf->SetFillColor(0, 0, 100, 0); -$pdf->SetTextColor(0, 0, 100, 0); -$pdf->Rect(110, 60, 30, 30, 'DF', $border_style); -$pdf->Text(110, 92, 'Yellow'); - -$pdf->SetDrawColor(0, 0, 0, 50); -$pdf->SetFillColor(0, 0, 0, 100); -$pdf->SetTextColor(0, 0, 0, 100); -$pdf->Rect(150, 60, 30, 30, 'DF', $border_style); -$pdf->Text(150, 92, 'Black'); - -// --- RGB ------------------------------------------------- - -$pdf->SetDrawColor(255, 127, 127); -$pdf->SetFillColor(255, 0, 0); -$pdf->SetTextColor(255, 0, 0); -$pdf->Rect(30, 110, 30, 30, 'DF', $border_style); -$pdf->Text(30, 142, 'Red'); - -$pdf->SetDrawColor(127, 255, 127); -$pdf->SetFillColor(0, 255, 0); -$pdf->SetTextColor(0, 255, 0); -$pdf->Rect(70, 110, 30, 30, 'DF', $border_style); -$pdf->Text(70, 142, 'Green'); - -$pdf->SetDrawColor(127, 127, 255); -$pdf->SetFillColor(0, 0, 255); -$pdf->SetTextColor(0, 0, 255); -$pdf->Rect(110, 110, 30, 30, 'DF', $border_style); -$pdf->Text(110, 142, 'Blue'); - -// --- GRAY ------------------------------------------------ - -$pdf->SetDrawColor(191); -$pdf->SetFillColor(127); -$pdf->SetTextColor(127); -$pdf->Rect(30, 160, 30, 30, 'DF', $border_style); -$pdf->Text(30, 192, 'Gray'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_022.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_023.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_023.php deleted file mode 100644 index dbb8b9831f8..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_023.php +++ /dev/null @@ -1,113 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 023'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 023', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', 'BI', 14); - -// Start First Page Group -$pdf->startPageGroup(); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// add second page -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the second page of group 1', 0, 1, 'L'); - -// Start Second Page Group -$pdf->startPageGroup(); - -// add some pages -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the first page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the second page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the third page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the fourth page of group 2', 0, 1, 'L'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_023.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_024.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_024.php deleted file mode 100644 index b60d12dc736..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_024.php +++ /dev/null @@ -1,140 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 024'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 024', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 18); - -// add a page -$pdf->AddPage(); - -/* - * setVisibility() allows to restrict the rendering of some - * elements to screen or printout. This can be useful, for - * instance, to put a background image or color that will - * show on screen but won't print. - */ - -$txt = 'You can limit the visibility of PDF objects to screen or printer by using the setVisibility() method. -Check the print preview of this document to display the alternative text.'; - -$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0); - -// change font size -$pdf->SetFontSize(40); - -// change text color -$pdf->SetTextColor(0,63,127); - -// set visibility only for screen -$pdf->setVisibility('screen'); - -// write something only for screen -$pdf->Write(0, '[This line is for display]', '', 0, 'C', true, 0, false, false, 0); - -// set visibility only for print -$pdf->setVisibility('print'); - -// change text color -$pdf->SetTextColor(127,0,0); - -// write something only for print -$pdf->Write(0, '[This line is for printout]', '', 0, 'C', true, 0, false, false, 0); - -// restore visibility -$pdf->setVisibility('all'); - -// --------------------------------------------------------- - -// LAYERS - -// start a new layer -$pdf->startLayer('layer1', true, true); - -// change font size -$pdf->SetFontSize(18); - -// change text color -$pdf->SetTextColor(0,127,0); - -$txt = 'Using the startLayer() method you can group PDF objects into layers. -This text is on "layer1".'; - -// write something -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// close the current layer -$pdf->endLayer(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_024.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_025.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_025.php deleted file mode 100644 index 1260d6207e5..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_025.php +++ /dev/null @@ -1,118 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 025'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 025', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -$txt = 'You can set the transparency of PDF objects using the setAlpha() method.'; -$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0); - -/* - * setAlpha() gives transparency support. You can set the - * alpha channel from 0 (fully transparent) to 1 (fully - * opaque). It applies to all elements (text, drawings, - * images). - */ - -$pdf->SetLineWidth(2); - -// draw opaque red square -$pdf->SetFillColor(255, 0, 0); -$pdf->SetDrawColor(127, 0, 0); -$pdf->Rect(30, 40, 60, 60, 'DF'); - -// set alpha to semi-transparency -$pdf->SetAlpha(0.5); - -// draw green square -$pdf->SetFillColor(0, 255, 0); -$pdf->SetDrawColor(0, 127, 0); -$pdf->Rect(50, 60, 60, 60, 'DF'); - -// draw blue square -$pdf->SetFillColor(0, 0, 255); -$pdf->SetDrawColor(0, 0, 127); -$pdf->Rect(70, 80, 60, 60, 'DF'); - -// draw jpeg image -$pdf->Image('images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72); - -// restore full opacity -$pdf->SetAlpha(1); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_025.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_026.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_026.php deleted file mode 100644 index 5646e9151a0..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_026.php +++ /dev/null @@ -1,145 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 026'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 026', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 22); - -// add a page -$pdf->AddPage(); - -// set color for text stroke -$pdf->SetDrawColor(255,0,0); - - -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=false); -$pdf->Write(0, 'Fill text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0.2, $fill=false, $clip=false); -$pdf->Write(0, 'Stroke text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0.2, $fill=true, $clip=false); -$pdf->Write(0, 'Fill, then stroke text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0, $fill=false, $clip=false); -$pdf->Write(0, 'Neither fill nor stroke text (invisible)', '', 0, '', true, 0, false, false, 0); - - -// * * * CLIPPING MODES * * * * * * * * * * * * * * * * * * - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=true); -$pdf->Write(0, 'Fill text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 65, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0.3, $fill=false, $clip=true); -$pdf->Write(0, 'Stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 75, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0.3, $fill=true, $clip=true); -$pdf->Write(0, 'Fill, then stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 85, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0, $fill=false, $clip=true); -$pdf->Write(0, 'Add text to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 95, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -// reset text rendering mode -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=false); - -// * * * HTML MODE * * * * * * * * * * * * * * * * * * * * * - -// The following attributes were added to HTML: -// stroke : stroke width -// strokecolor : stroke color -// fill : true (default) to fill the font, false otherwise - - -// create some HTML content with text rendering modes -$html = 'HTML Fill text
      '; -$html .= 'HTML Stroke text
      '; -$html .= 'HTML Fill, then stroke text
      '; -$html .= 'HTML Neither fill nor stroke text (invisible)
      '; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_026.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_027.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_027.php deleted file mode 100644 index a23707451a8..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_027.php +++ /dev/null @@ -1,418 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 027'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set a barcode on the page footer -$pdf->setBarcode(date('Y-m-d H:i:s')); - -// set font -$pdf->SetFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -// print a message -$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n"; -$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false); -$pdf->SetY(30); - -// ----------------------------------------------------------------------------- - -$pdf->SetFont('helvetica', '', 10); - -// define barcode style -$style = array( - 'position' => '', - 'align' => 'C', - 'stretch' => false, - 'fitwidth' => true, - 'cellfitalign' => '', - 'border' => true, - 'hpadding' => 'auto', - 'vpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255), - 'text' => true, - 'font' => 'helvetica', - 'fontsize' => 8, - 'stretchtext' => 4 -); - -// PRINT VARIOUS 1D BARCODES - -// CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9. -$pdf->Cell(0, 0, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1); -$pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 EXTENDED -$pdf->Cell(0, 0, 'CODE 39 EXTENDED', 0, 1); -$pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 EXTENDED + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1); -$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 93 - USS-93 -$pdf->Cell(0, 0, 'CODE 93 - USS-93', 0, 1); -$pdf->write1DBarcode('TEST93', 'C93', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Standard 2 of 5 -$pdf->Cell(0, 0, 'Standard 2 of 5', 0, 1); -$pdf->write1DBarcode('1234567', 'S25', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Standard 2 of 5 + CHECKSUM -$pdf->Cell(0, 0, 'Standard 2 of 5 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('1234567', 'S25+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Interleaved 2 of 5 -$pdf->Cell(0, 0, 'Interleaved 2 of 5', 0, 1); -$pdf->write1DBarcode('1234567', 'I25', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Interleaved 2 of 5 + CHECKSUM -$pdf->Cell(0, 0, 'Interleaved 2 of 5 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('1234567', 'I25+', '', '', '', 18, 0.4, $style, 'N'); - - -// add a page ---------- -$pdf->AddPage(); - -// CODE 128 AUTO -$pdf->Cell(0, 0, 'CODE 128 AUTO', 0, 1); -$pdf->write1DBarcode('CODE 128 AUTO', 'C128', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 A -$pdf->Cell(0, 0, 'CODE 128 A', 0, 1); -$pdf->write1DBarcode('CODE 128 A', 'C128A', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 B -$pdf->Cell(0, 0, 'CODE 128 B', 0, 1); -$pdf->write1DBarcode('CODE 128 B', 'C128B', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 C -$pdf->Cell(0, 0, 'CODE 128 C', 0, 1); -$pdf->write1DBarcode('0123456789', 'C128C', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// EAN 8 -$pdf->Cell(0, 0, 'EAN 8', 0, 1); -$pdf->write1DBarcode('1234567', 'EAN8', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// EAN 13 -$pdf->Cell(0, 0, 'EAN 13', 0, 1); -$pdf->write1DBarcode('1234567890128', 'EAN13', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// UPC-A -$pdf->Cell(0, 0, 'UPC-A', 0, 1); -$pdf->write1DBarcode('12345678901', 'UPCA', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// UPC-E -$pdf->Cell(0, 0, 'UPC-E', 0, 1); -$pdf->write1DBarcode('04210000526', 'UPCE', '', '', '', 18, 0.4, $style, 'N'); - -// add a page ---------- -$pdf->AddPage(); - -// 5-Digits UPC-Based Extension -$pdf->Cell(0, 0, '5-Digits UPC-Based Extension', 0, 1); -$pdf->write1DBarcode('51234', 'EAN5', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// 2-Digits UPC-Based Extension -$pdf->Cell(0, 0, '2-Digits UPC-Based Extension', 0, 1); -$pdf->write1DBarcode('34', 'EAN2', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// MSI -$pdf->Cell(0, 0, 'MSI', 0, 1); -$pdf->write1DBarcode('80523', 'MSI', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// MSI + CHECKSUM (module 11) -$pdf->Cell(0, 0, 'MSI + CHECKSUM (module 11)', 0, 1); -$pdf->write1DBarcode('80523', 'MSI+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODABAR -$pdf->Cell(0, 0, 'CODABAR', 0, 1); -$pdf->write1DBarcode('123456789', 'CODABAR', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 11 -$pdf->Cell(0, 0, 'CODE 11', 0, 1); -$pdf->write1DBarcode('123-456-789', 'CODE11', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// PHARMACODE -$pdf->Cell(0, 0, 'PHARMACODE', 0, 1); -$pdf->write1DBarcode('789', 'PHARMA', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// PHARMACODE TWO-TRACKS -$pdf->Cell(0, 0, 'PHARMACODE TWO-TRACKS', 0, 1); -$pdf->write1DBarcode('105', 'PHARMA2T', '', '', '', 18, 2, $style, 'N'); - -// add a page ---------- -$pdf->AddPage(); - -// IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 -$pdf->Cell(0, 0, 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 0, 1); -$pdf->write1DBarcode('01234567094987654321-01234567891', 'IMB', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// POSTNET -$pdf->Cell(0, 0, 'POSTNET', 0, 1); -$pdf->write1DBarcode('98000', 'POSTNET', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// PLANET -$pdf->Cell(0, 0, 'PLANET', 0, 1); -$pdf->write1DBarcode('98000', 'PLANET', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) -$pdf->Cell(0, 0, 'RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)', 0, 1); -$pdf->write1DBarcode('SN34RD1A', 'RMS4CC', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// KIX (Klant index - Customer index) -$pdf->Cell(0, 0, 'KIX (Klant index - Customer index)', 0, 1); -$pdf->write1DBarcode('SN34RDX1A', 'KIX', '', '', '', 15, 0.6, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TEST BARCODE ALIGNMENTS - -// add a page -$pdf->AddPage(); - -// set a background color -$style['bgcolor'] = array(255,255,240); -$style['fgcolor'] = array(127,0,0); - -// Left position -$style['position'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center position -$style['position'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right position -$style['position'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(0,127,0); -$style['position'] = ''; -$style['stretch'] = false; // disable stretch -$style['fitwidth'] = false; // disable fitwidth - -// Left alignment -$style['align'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['align'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['align'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(0,64,127); -$style['position'] = ''; -$style['stretch'] = false; // disable stretch -$style['fitwidth'] = true; // disable fitwidth - -// Left alignment -$style['cellfitalign'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['cellfitalign'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['cellfitalign'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(127,0,127); - -// Left alignment -$style['position'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['position'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['position'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TEST BARCODE STYLE - -// define barcode style -$style = array( - 'position' => '', - 'align' => '', - 'stretch' => true, - 'fitwidth' => false, - 'cellfitalign' => '', - 'border' => true, - 'hpadding' => 'auto', - 'vpadding' => 'auto', - 'fgcolor' => array(0,0,128), - 'bgcolor' => array(255,255,128), - 'text' => true, - 'label' => 'CUSTOM LABEL', - 'font' => 'helvetica', - 'fontsize' => 8, - 'stretchtext' => 4 -); - -// CODE 39 EXTENDED + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1); -$pdf->SetLineStyle(array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 120, 25, 0.4, $style, 'N'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_027.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_028.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_028.php deleted file mode 100644 index f250ac58970..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_028.php +++ /dev/null @@ -1,138 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 028'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// remove default header/footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(10, PDF_MARGIN_TOP, 10); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -$pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone'); - -// set font -$pdf->SetFont('times', 'B', 20); - -$pdf->AddPage('P', 'A4'); -$pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A4'); -$pdf->Cell(0, 0, 'A4 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A5'); -$pdf->Cell(0, 0, 'A5 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A5'); -$pdf->Cell(0, 0, 'A5 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A6'); -$pdf->Cell(0, 0, 'A6 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A6'); -$pdf->Cell(0, 0, 'A6 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A7'); -$pdf->Cell(0, 0, 'A7 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A7'); -$pdf->Cell(0, 0, 'A7 LANDSCAPE', 1, 1, 'C'); - - -// --- test backward editing --- - - -$pdf->setPage(1, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C'); - -$pdf->setPage(2, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C'); - -$pdf->setPage(3, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C'); - -$pdf->setPage(4, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C'); - -$pdf->setPage(5, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C'); - -$pdf->setPage(6, true); -$pdf->SetY(50); -$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C'); - -$pdf->setPage(7, true); -$pdf->SetY(40); -$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C'); - -$pdf->setPage(8, true); -$pdf->SetY(40); -$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C'); - -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_028.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_029.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_029.php deleted file mode 100644 index 33be97ecf76..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_029.php +++ /dev/null @@ -1,124 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 029'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 029', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set array for viewer preferences -$preferences = array( - 'HideToolbar' => true, - 'HideMenubar' => true, - 'HideWindowUI' => true, - 'FitWindow' => true, - 'CenterWindow' => true, - 'DisplayDocTitle' => true, - 'NonFullScreenPageMode' => 'UseNone', // UseNone, UseOutlines, UseThumbs, UseOC - 'ViewArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'ViewClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintScaling' => 'AppDefault', // None, AppDefault - 'Duplex' => 'DuplexFlipLongEdge', // Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge - 'PickTrayByPDFSize' => true, - 'PrintPageRange' => array(1,1,2,3), - 'NumCopies' => 2 -); - -// Check the example n. 60 for advanced page settings - -// set pdf viewer preferences -$pdf->setViewerPreferences($preferences); - -// set font -$pdf->SetFont('times', '', 14); - -// add a page -$pdf->AddPage(); - -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C'); - -$pdf->Ln(5); - -$pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0); - -// add a page -$pdf->AddPage(); -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C'); - -// add a page -$pdf->AddPage(); -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_029.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_030.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_030.php deleted file mode 100644 index ed4e799d16e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_030.php +++ /dev/null @@ -1,188 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 030'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 030', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// --- first page ------------------------------------------ - -// add a page -$pdf->AddPage(); - -$pdf->Cell(0, 0, 'TCPDF Gradients', 0, 1, 'C', 0, '', 0, false, 'T', 'M'); - -// set colors for gradients (r,g,b) or (grey 0-255) -$red = array(255, 0, 0); -$blue = array(0, 0, 200); -$yellow = array(255, 255, 0); -$green = array(0, 255, 0); -$white = array(255); -$black = array(0); - -// set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg) -$coords = array(0, 0, 1, 0); - -// paint a linear gradient -$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords); - -// write label -$pdf->Text(20, 130, 'LinearGradient()'); - -// set the coordinates fx,fy,cx,cy,r of the gradient (see radial_gradient_coords.jpg) -$coords = array(0.5, 0.5, 1, 1, 1.2); - -// paint a radial gradient -$pdf->RadialGradient(110, 45, 80, 80, $white, $black, $coords); - -// write label -$pdf->Text(110, 130, 'RadialGradient()'); - -// paint a coons patch mesh with default coordinates -$pdf->CoonsPatchMesh(20, 155, 80, 80, $yellow, $blue, $green, $red); - -// write label -$pdf->Text(20, 240, 'CoonsPatchMesh()'); - -// set the coordinates for the cubic Bézier points x1,y1 ... x12, y12 of the patch (see coons_patch_mesh_coords.jpg) -$coords = array( - 0.00,0.00, 0.33,0.20, //lower left - 0.67,0.00, 1.00,0.00, 0.80,0.33, //lower right - 0.80,0.67, 1.00,1.00, 0.67,0.80, //upper right - 0.33,1.00, 0.00,1.00, 0.20,0.67, //upper left - 0.00,0.33); //lower left -$coords_min = 0; //minimum value of the coordinates -$coords_max = 1; //maximum value of the coordinates - -// paint a coons patch gradient with the above coordinates -$pdf->CoonsPatchMesh(110, 155, 80, 80, $yellow, $blue, $green, $red, $coords, $coords_min, $coords_max); - -// write label -$pdf->Text(110, 240, 'CoonsPatchMesh()'); - -// --- second page ----------------------------------------- -$pdf->AddPage(); - -// first patch: f = 0 -$patch_array[0]['f'] = 0; -$patch_array[0]['points'] = array( - 0.00,0.00, 0.33,0.00, - 0.67,0.00, 1.00,0.00, 1.00,0.33, - 0.8,0.67, 1.00,1.00, 0.67,0.8, - 0.33,1.80, 0.00,1.00, 0.00,0.67, - 0.00,0.33); -$patch_array[0]['colors'][0] = array('r' => 255, 'g' => 255, 'b' => 0); -$patch_array[0]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255); -$patch_array[0]['colors'][2] = array('r' => 0, 'g' => 255,'b' => 0); -$patch_array[0]['colors'][3] = array('r' => 255, 'g' => 0,'b' => 0); - -// second patch - above the other: f = 2 -$patch_array[1]['f'] = 2; -$patch_array[1]['points'] = array( - 0.00,1.33, - 0.00,1.67, 0.00,2.00, 0.33,2.00, - 0.67,2.00, 1.00,2.00, 1.00,1.67, - 1.5,1.33); -$patch_array[1]['colors'][0]=array('r' => 0, 'g' => 0, 'b' => 0); -$patch_array[1]['colors'][1]=array('r' => 255, 'g' => 0, 'b' => 255); - -// third patch - right of the above: f = 3 -$patch_array[2]['f'] = 3; -$patch_array[2]['points'] = array( - 1.33,0.80, - 1.67,1.50, 2.00,1.00, 2.00,1.33, - 2.00,1.67, 2.00,2.00, 1.67,2.00, - 1.33,2.00); -$patch_array[2]['colors'][0] = array('r' => 0, 'g' => 255, 'b' => 255); -$patch_array[2]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 0); - -// fourth patch - below the above, which means left(?) of the above: f = 1 -$patch_array[3]['f'] = 1; -$patch_array[3]['points'] = array( - 2.00,0.67, - 2.00,0.33, 2.00,0.00, 1.67,0.00, - 1.33,0.00, 1.00,0.00, 1.00,0.33, - 0.8,0.67); -$patch_array[3]['colors'][0] = array('r' => 0, 'g' => 0, 'b' => 0); -$patch_array[3]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255); - -$coords_min = 0; -$coords_max = 2; - -$pdf->CoonsPatchMesh(10, 45, 190, 200, '', '', '', '', $patch_array, $coords_min, $coords_max); - -// write label -$pdf->Text(10, 250, 'CoonsPatchMesh()'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_030.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_031.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_031.php deleted file mode 100644 index 160d162ee6f..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_031.php +++ /dev/null @@ -1,103 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 031'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 031', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of PieSector() method.'); - -$xc = 105; -$yc = 100; -$r = 50; - -$pdf->SetFillColor(0, 0, 255); -$pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2); - -$pdf->SetFillColor(0, 255, 0); -$pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2); - -$pdf->SetFillColor(255, 0, 0); -$pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2); - -// write labels -$pdf->SetTextColor(255,255,255); -$pdf->Text(105, 65, 'BLUE'); -$pdf->Text(60, 95, 'GREEN'); -$pdf->Text(120, 115, 'RED'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_031.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_032.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_032.php deleted file mode 100644 index b38f5ae0a7d..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_032.php +++ /dev/null @@ -1,91 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 032'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 032', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 12); - -$pdf->AddPage(); - -$html = << -NOTE: Please use SVG format for a better vector support. -EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -$pdf->ImageEps('images/tcpdf_box.ai', 10, 40, 150, '', 'http://www.tcpdf.org', true, '', '', 0, false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_032.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_033.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_033.php deleted file mode 100644 index 4f95e409a16..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_033.php +++ /dev/null @@ -1,105 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 033'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 033', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set default font subsetting mode -$pdf->setFontSubsetting(false); - -$pdf->SetFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Font Types', '', 0, 'C', 1, 0, false, false, 0); - -$pdf->Ln(10); - -$pdf->SetFont('times', '', 10); - -$pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - -$pdf->Ln(2); - -$pdf->SetFont('dejavusans', '', 10); - -$pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - -$pdf->Ln(2); - -$pdf->SetFont('cid0jp', '', 9); - -$pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_033.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_034.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_034.php deleted file mode 100644 index bb15902f323..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_034.php +++ /dev/null @@ -1,96 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 034'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 034', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Image Clipping using geometric functions', '', 0, 'C', 1, 0, false, false, 0); - -//Start Graphic Transformation -$pdf->StartTransform(); - -// set clipping mask -$pdf->StarPolygon(105, 100, 30, 10, 3, 0, 1, 'CNZ'); - -// draw jpeg image to be clipped -$pdf->Image('images/image_demo.jpg', 75, 70, 60, 60, '', 'http://www.tcpdf.org', '', true, 72); - -//Stop Graphic Transformation -$pdf->StopTransform(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_034.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_035.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_035.php deleted file mode 100644 index 0e5280c2724..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_035.php +++ /dev/null @@ -1,111 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 035'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 035', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', 'BI', 16); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(); - -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0))); -$pdf->SetFillColor(255,255,128); -$pdf->SetTextColor(0,0,128); - -$text="DUMMY"; - -$pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0); - -$pdf->Ln(); - -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); -$pdf->SetFillColor(255,255,0); -$pdf->SetTextColor(0,0,255); -$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0); - -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0))); -$pdf->SetFillColor(0,0,255); -$pdf->SetTextColor(255,255,0); -$pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0); - -$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255))); -$pdf->SetFillColor(0,255,0); -$pdf->SetTextColor(255,0,255); -$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_035.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_036.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_036.php deleted file mode 100644 index 262549741ca..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_036.php +++ /dev/null @@ -1,89 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 036'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 036', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 16); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of Text Annotation. -Move your mouse over the yellow box or double click on it to display the annotation text.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// text annotation -$pdf->Annotation(83, 27, 10, 10, "Text annotation example\naccented letters test: àèéìòù", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'title example', 'Subj' => 'example', 'C' => array(255, 255, 0))); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_036.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_037.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_037.php deleted file mode 100644 index deb7d92a2f7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_037.php +++ /dev/null @@ -1,147 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 037'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 037', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -$html = '

      Example of Spot Colors

      Spot colors are single ink colors, rather than colors produced by four (CMYK), six (CMYKOG) or more inks in the printing process (process colors). They can be obtained by special vendors, but often the printers have found their own way of mixing inks to match defined colors.

      As long as no open standard for spot colours exists, TCPDF users will have to buy a colour book by one of the colour manufacturers and insert the values and names of spot colours directly into the $spotcolor array in include/tcpdf_colors.php file, or define them using the AddSpotColor() method.

      Common industry standard spot colors are:
      ANPA-COLOR, DIC, FOCOLTONE, GCMI, HKS, PANTONE, TOYO, TRUMATCH.'; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, 'J', true); - - -$pdf->SetFont('helvetica', '', 10); - -// Define some new spot colors -// $c, $m, $y and $k (2nd, 3rd, 4th and 5th parameter) are the CMYK color components. -// AddSpotColor($name, $c, $m, $y, $k) - -$pdf->AddSpotColor('My TCPDF Dark Green', 100, 50, 80, 45); -$pdf->AddSpotColor('My TCPDF Light Yellow', 0, 0, 55, 0); -$pdf->AddSpotColor('My TCPDF Black', 0, 0, 0, 100); -$pdf->AddSpotColor('My TCPDF Red', 30, 100, 90, 10); -$pdf->AddSpotColor('My TCPDF Green', 100, 30, 100, 0); -$pdf->AddSpotColor('My TCPDF Blue', 100, 60, 10, 5); -$pdf->AddSpotColor('My TCPDF Yellow', 0, 20, 100, 0); - -// Select the spot color -// $tint (the second parameter) is the intensity of the color (0-100). -// SetTextSpotColor($name, $tint=100) -// SetDrawSpotColor($name, $tint=100) -// SetFillSpotColor($name, $tint=100) - -$pdf->SetTextSpotColor('My TCPDF Black', 100); -$pdf->SetDrawSpotColor('My TCPDF Black', 100); - -$starty = 100; - -// print some spot colors - -$pdf->SetFillSpotColor('My TCPDF Dark Green', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Dark Green'); - -$starty += 24; -$pdf->SetFillSpotColor('My TCPDF Light Yellow', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Light Yellow'); - - -// --- default values defined on spotcolors.php --- - -$starty += 24; -$pdf->SetFillSpotColor('My TCPDF Red', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Red'); - -$starty += 24; -$pdf->SetFillSpotColor('My TCPDF Green', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Green'); - -$starty += 24; -$pdf->SetFillSpotColor('My TCPDF Blue', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Blue'); - -$starty += 24; -$pdf->SetFillSpotColor('My TCPDF Yellow', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Yellow'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_037.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_038.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_038.php deleted file mode 100644 index a1e57e20695..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_038.php +++ /dev/null @@ -1,92 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 038'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 038', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 20); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of CID-0 CJK unembedded font. -To display extended text you must have CJK fonts installed for your PDF reader:'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// set font -$pdf->SetFont('cid0jp', '', 40); - -$txt = 'こんにちは世界'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_038.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_039.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_039.php deleted file mode 100644 index 4a8775c19e2..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_039.php +++ /dev/null @@ -1,104 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 039'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 039', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0); - -// create some HTML content -$html = 'a abc abcdefghijkl (abcdef) abcdefg abcdefghi a ((abc)) abcd test alt attribute abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc \(abcd\) abcdef abcdefg abcdefghi a abc \\\(abcd\\\) abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg start a abc before yellow color after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi
      abcd abcdef abcdefg abcdefghi
      abcd abcde abcdef
      '; - -// set core font -$pdf->SetFont('helvetica', '', 10); - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, true); - -$pdf->Ln(); - -// set UTF-8 Unicode font -$pdf->SetFont('dejavusans', '', 10); - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, true); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_039.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_040.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_040.php deleted file mode 100644 index c1d90917263..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_040.php +++ /dev/null @@ -1,116 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 040'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 040', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set display mode -$pdf->SetDisplayMode($zoom='fullpage', $layout='TwoColumnRight', $mode='UseNone'); - -// set pdf viewer preferences -$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge')); - -// set booklet mode -$pdf->SetBooklet(true, 10, 30); - -// set core font -$pdf->SetFont('helvetica', '', 18); - -// add a page (left page) -$pdf->AddPage(); - -$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C'); - - -// add a page (right page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C'); - - -// add a page (left page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 3', 1, 1, 'C'); - -// add a page (right page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 4', 1, 1, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_040.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_041.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_041.php deleted file mode 100644 index 973bdf99af0..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_041.php +++ /dev/null @@ -1,90 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 041'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 041', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 16); - -// add a page -$pdf->AddPage(); - - -$txt = 'Example of File Attachment. -Double click on the icon to open the attached file.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// attach an external file -$pdf->Annotation(85, 27, 5, 5, 'text file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'data/utf8test.txt')); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_041.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_042.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_042.php deleted file mode 100644 index 14c9fd0a759..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_042.php +++ /dev/null @@ -1,102 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 042'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 042', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set JPEG quality -//$pdf->setJPEGQuality(75); - -$pdf->SetFont('helvetica', '', 18); - -// add a page -$pdf->AddPage(); - -// create background text -$background_text = str_repeat('TCPDF test PNG Alpha Channel ', 50); -$pdf->MultiCell(0, 5, $background_text, 0, 'J', 0, 2, '', '', true, 0, false); - -// --- Method (A) ------------------------------------------ -// the Image() method recognizes the alpha channel embedded on the image: - -$pdf->Image('images/image_with_alpha.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300); - -// --- Method (B) ------------------------------------------ -// provide image + separate 8-bit mask - -// first embed mask image (w, h, x and y will be ignored, the image will be scaled to the target image's size) -$mask = $pdf->Image('images/alpha.png', 50, 140, 100, '', '', '', '', false, 300, '', true); - -// embed image, masked with previously embedded mask -$pdf->Image('images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '', false, 300, '', false, $mask); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_042.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_043.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_043.php deleted file mode 100644 index 116827e8545..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_043.php +++ /dev/null @@ -1,85 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 043'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 043', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 16); - -// add a page -$pdf->AddPage(); - -// Multicell test -$pdf->MultiCell(0, 0, 'DISK CACHING TEST: check the parameters of the class constructor.', 1, 'L', 0, 0, '', '', true); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_043.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_044.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_044.php deleted file mode 100644 index 949270cca6c..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_044.php +++ /dev/null @@ -1,128 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 044'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 044', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 40); - -// print a line using Cell() -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: A', 0, 1, 'L'); - -// add some vertical space -$pdf->Ln(10); - -// print some text -$pdf->SetFont('times', 'I', 16); -$txt = 'TCPDF allows you to Copy, Move and Delete pages.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -$pdf->SetFont('helvetica', 'B', 40); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: B', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: D', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: E', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: E-2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: F', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: C', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: G', 0, 1, 'L'); - -// Move page 7 to page 3 -$pdf->movePage(7, 3); - -// Delete page 6 -$pdf->deletePage(6); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: H', 0, 1, 'L'); - -// copy the second page -$pdf->copyPage(2); - -// NOTE: to insert a page to a previous position, you can add a new page to the end of document and then move it using movePage(). - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_044.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_045.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_045.php deleted file mode 100644 index 0f49abca4da..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_045.php +++ /dev/null @@ -1,140 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 045'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 045', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', 'B', 20); - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -// Create a fixed link to the first page using the * character -$index_link = $pdf->AddLink(); -$pdf->SetLink($index_link, 0, '*1'); -$pdf->Cell(0, 10, 'Link to INDEX', 0, 1, 'R', false, $index_link); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -// fixed link to the first page using the * character -$html = 'link to INDEX (page 1)'; -$pdf->writeHTML($html, true, false, true, false, ''); - - -// add some pages and bookmarks -for ($i = 2; $i < 12; $i++) { - $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); - $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); -} - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -// add a new page for TOC -$pdf->addTOCPage(); - -// write the TOC title -$pdf->SetFont('times', 'B', 16); -$pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0); -$pdf->Ln(); - -$pdf->SetFont('dejavusans', '', 12); - -// add a simple Table Of Content at first page -// (check the example n. 59 for the HTML version) -$pdf->addTOC(1, 'courier', '.', 'INDEX', 'B', array(128,0,0)); - -// end of TOC page -$pdf->endTOCPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_045.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_046.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_046.php deleted file mode 100644 index 70d11d3be20..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_046.php +++ /dev/null @@ -1,123 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 046'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 046', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Text Hyphenation', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(10); - -/* -Unicode Data for SHY: - Name : SOFT HYPHEN, commonly abbreviated as SHY - HTML Entity (decimal): ­ - HTML Entity (hex): ­ - HTML Entity (named): ­ - How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173] - UTF-8 (hex): 0xC2 0xAD (c2ad) -*/ - -/* -// You can automatically add SOFT HYPHENS to your text using -// the hyphenateText() method, but this requires either an -// hyphenation pattern array of a hyphenation pattern TEX file. -// You can download hyphenation TEX patterns from: -// http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ - -// EXAMPLE: - -$html = 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.'; - -$hyphen_patterns = $pdf->getHyphenPatternsFromTEX('hyphens/hyph-en-gb.tex'); - -$html = $pdf->hyphenateText($html, $hyphen_patterns, array(), 1, 2, 1, 8); -*/ - - -// HTML text with soft hyphens (­) -$html = 'On the other hand, we de­nounce with righ­teous in­dig­na­tion and dis­like men who are so be­guiled and de­mo­r­al­ized by the charms of plea­sure of the mo­ment, so blind­ed by de­sire, that they can­not fore­see the pain and trou­ble that are bound to en­sue; and equal blame be­longs to those who fail in their du­ty through weak­ness of will, which is the same as say­ing through shrink­ing from toil and pain. Th­ese cas­es are per­fect­ly sim­ple and easy to distin­guish. In a free hour, when our pow­er of choice is un­tram­melled and when noth­ing pre­vents our be­ing able to do what we like best, ev­ery plea­sure is to be wel­comed and ev­ery pain avoid­ed. But in cer­tain cir­cum­s­tances and ow­ing to the claims of du­ty or the obli­ga­tions of busi­ness it will fre­quent­ly oc­cur that plea­sures have to be re­pu­di­at­ed and an­noy­ances ac­cept­ed. The wise man there­fore al­ways holds in th­ese mat­ters to this prin­ci­ple of se­lec­tion: he re­jects plea­sures to se­cure other greater plea­sures, or else he en­dures pains to avoid worse pains.'; - -$pdf->SetFont('times', '', 10); -$pdf->SetDrawColor(255,0,0); -$pdf->SetTextColor(0,63,127); - -// print a cell -$pdf->writeHTMLCell(50, 0, '', '', $html, 1, 1, 0, true, 'J'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_046.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_047.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_047.php deleted file mode 100644 index a26ae5d5ce7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_047.php +++ /dev/null @@ -1,117 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 047'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 047', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 16); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of Transactions. -TCPDF allows you to undo some operations using the Transactions. -Check the source code for further information.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->SetFont('times', '', 12); - -// start transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 1\n"); -$pdf->Write(0, "LINE 2\n"); - -// restarts transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 3\n"); -$pdf->Write(0, "LINE 4\n"); - -// rolls back to the last (re)start -$pdf = $pdf->rollbackTransaction(); - -$pdf->Write(0, "LINE 5\n"); -$pdf->Write(0, "LINE 6\n"); - -// start transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 7\n"); - -// commit transaction (actually just frees memory) -$pdf->commitTransaction(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_047.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_048.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_048.php deleted file mode 100644 index ca88a148e7e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_048.php +++ /dev/null @@ -1,313 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 048'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); - -$pdf->SetFont('helvetica', '', 8); - -// ----------------------------------------------------------------------------- - -$tbl = << -
COL 1 - ROW 1
COLSPAN 3
COL 2 - ROW 1COL 3 - ROW 1
COL 2 - ROW 2 - COLSPAN 2
text line
text line
text line
text line
COL 3 - ROW 2
COL 3 - ROW 3
-EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
COLSPAN 3
text line
text line
text line
text line
text line
text line - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
text line
text line
text line
text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
COLSPAN 3
text line
text line
text line
text line
text line
text line - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
text line
text line
text line
text line - COL 3 - ROW 2
text line
text line - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - -Left column -Heading Column Span 5 -Heading Column Span 9 - - -Rowspan 2
This is some text that fills the table cell. -span 2 -span 2 -2 rows -Colspan 8 - - -1a -2a -1b -2b -1 -2 -3 -4 -5 -6 -7 -8 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// Table with rowspans and THEAD -$tbl = << - - - A - XXXX - XXXX - XXXX - XXXX - XXXX - - - B - XXXX - XXXX - XXXX - XXXX - XXXX - - - - 1. - XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - XXXX - XXXX
XXXX - - - 2. - XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - - - XXXX
XXXX
XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - - - RRRRRR
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - - - 3. - XXXX1
XXXX - XXXX
XXXX - XXXX
XXXX - - - 4. - XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - XXXX
XXXX - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// NON-BREAKING TABLE (nobr="true") - -$tbl = << - - NON-BREAKING TABLE - - - 1-1 - 1-2 - 1-3 - - - 2-1 - 3-2 - 3-3 - - - 3-1 - 3-2 - 3-3 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// NON-BREAKING ROWS (nobr="true") - -$tbl = << - - NON-BREAKING ROWS - - - ROW 1
COLUMN 1 - ROW 1
COLUMN 2 - ROW 1
COLUMN 3 - - - ROW 2
COLUMN 1 - ROW 2
COLUMN 2 - ROW 2
COLUMN 3 - - - ROW 3
COLUMN 1 - ROW 3
COLUMN 2 - ROW 3
COLUMN 3 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_048.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_049.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_049.php deleted file mode 100644 index 7a764fbc60f..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_049.php +++ /dev/null @@ -1,126 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 049'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 049', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -IMPORTANT: -If you are printing user-generated content, tcpdf tag can be unsafe. -You can disable this tag by setting to false the K_TCPDF_CALLS_IN_HTML -constant on TCPDF configuration file. - -For security reasons, the parameters for the 'params' attribute of TCPDF -tag must be prepared as an array and encoded with the -serializeTCPDFtagParameters() method (see the example below). - - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -$html = '

Test TCPDF Methods in HTML

-

IMPORTANT:

-If you are using user-generated content, the tcpdf tag can be unsafe.
-You can disable this tag by setting to false the K_TCPDF_CALLS_IN_HTML constant on TCPDF configuration file.
-

write1DBarcode method in HTML

'; - -$params = $pdf->serializeTCPDFtagParameters(array('CODE 39', 'C39', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); -$html .= ''; - -$params = $pdf->serializeTCPDFtagParameters(array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); -$html .= ''; - -$html .= '

Graphic Functions

'; - -$params = $pdf->serializeTCPDFtagParameters(array(0)); -$html .= ''; - -$params = $pdf->serializeTCPDFtagParameters(array(50, 50, 40, 10, 'DF', array(), array(0,128,255))); -$html .= ''; - - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_049.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_050.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_050.php deleted file mode 100644 index 5ccae31a9cf..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_050.php +++ /dev/null @@ -1,210 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 050'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 050', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file. - -// set font -$pdf->SetFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -// print a message -$txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcode directory.\n"; -$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false); - - -$pdf->SetFont('helvetica', '', 10); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set style for barcode -$style = array( - 'border' => true, - 'vpadding' => 'auto', - 'hpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255) - 'module_width' => 1, // width of a single module in points - 'module_height' => 1 // height of a single module in points -); - -// write RAW 2D Barcode - -$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010'; -$pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N'); - -// write RAW2 2D Barcode -$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]'; -$pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set style for barcode -$style = array( - 'border' => 2, - 'vpadding' => 'auto', - 'hpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255) - 'module_width' => 1, // width of a single module in points - 'module_height' => 1 // height of a single module in points -); - -// QRCODE,L : QR-CODE Low error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', 20, 30, 50, 50, $style, 'N'); -$pdf->Text(20, 25, 'QRCODE L'); - -// QRCODE,M : QR-CODE Medium error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N'); -$pdf->Text(20, 85, 'QRCODE M'); - -// QRCODE,Q : QR-CODE Better error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N'); -$pdf->Text(20, 145, 'QRCODE Q'); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N'); -$pdf->Text(20, 205, 'QRCODE H'); - -// ------------------------------------------------------------------- -// PDF417 (ISO/IEC 15438:2006) - -/* - - The $type parameter can be simple 'PDF417' or 'PDF417' followed by a - number of comma-separated options: - - 'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6' - - Possible options are: - - a = aspect ratio (width/height); - e = error correction level (0-8); - - Macro Control Block options: - - t = total number of macro segments; - s = macro segment index (0-99998); - f = file ID; - o0 = File Name (text); - o1 = Segment Count (numeric); - o2 = Time Stamp (numeric); - o3 = Sender (text); - o4 = Addressee (text); - o5 = File Size (numeric); - o6 = Checksum (numeric). - - Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. - To use a comma character ',' on text options, replace it with the character 255: "\xff". - -*/ - -$pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N'); -$pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)'); - -// ------------------------------------------------------------------- -// DATAMATRIX (ISO/IEC 16022:2006) - -$pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N'); -$pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)'); - -// ------------------------------------------------------------------- - -// new style -$style = array( - 'border' => 2, - 'padding' => 'auto', - 'fgcolor' => array(0,0,255), - 'bgcolor' => array(255,255,64) -); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N'); -$pdf->Text(80, 205, 'QRCODE H - COLORED'); - -// new style -$style = array( - 'border' => false, - 'padding' => 0, - 'fgcolor' => array(128,0,0), - 'bgcolor' => false -); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N'); -$pdf->Text(140, 205, 'QRCODE H - NO PADDING'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_050.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_051.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_051.php deleted file mode 100644 index dc2d94ec51f..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_051.php +++ /dev/null @@ -1,145 +0,0 @@ -getBreakMargin(); - // get current auto-page-break mode - $auto_page_break = $this->AutoPageBreak; - // disable auto-page-break - $this->SetAutoPageBreak(false, 0); - // set bacground image - $img_file = K_PATH_IMAGES.'image_demo.jpg'; - $this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); - // restore auto-page-break status - $this->SetAutoPageBreak($auto_page_break, $bMargin); - // set the starting point for the page content - $this->setPageMark(); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 051'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(0); -$pdf->SetFooterMargin(0); - -// remove default footer -$pdf->setPrintFooter(false); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 48); - -// add a page -$pdf->AddPage(); - -// Print a text -$html = ' PAGE 1  -

You can set a full page background.

'; -$pdf->writeHTML($html, true, false, true, false, ''); - - -// add a page -$pdf->AddPage(); - -// Print a text -$html = ' PAGE 2 '; -$pdf->writeHTML($html, true, false, true, false, ''); - -// --- example with background set on page --- - -// remove default header -$pdf->setPrintHeader(false); - -// add a page -$pdf->AddPage(); - - -// -- set new background --- - -// get the current page break margin -$bMargin = $pdf->getBreakMargin(); -// get current auto-page-break mode -$auto_page_break = $pdf->getAutoPageBreak(); -// disable auto-page-break -$pdf->SetAutoPageBreak(false, 0); -// set bacground image -$img_file = K_PATH_IMAGES.'image_demo.jpg'; -$pdf->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); -// restore auto-page-break status -$pdf->SetAutoPageBreak($auto_page_break, $bMargin); -// set the starting point for the page content -$pdf->setPageMark(); - - -// Print a text -$html = 'PAGE 3'; -$pdf->writeHTML($html, true, false, true, false, ''); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_051.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_052.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_052.php deleted file mode 100644 index 2af27f08ad2..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_052.php +++ /dev/null @@ -1,121 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 052'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 052', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -/* -NOTES: - - To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt - - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 - - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes -*/ - -// set certificate file -$certificate = 'file://data/cert/tcpdf.crt'; - -// set additional information -$info = array( - 'Name' => 'TCPDF', - 'Location' => 'Office', - 'Reason' => 'Testing TCPDF', - 'ContactInfo' => 'http://www.tcpdf.org', - ); - -// set document signature -$pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info); - -// set font -$pdf->SetFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// print a line of text -$text = 'This is a digitally signed document using the default (example) tcpdf.crt certificate.
To validate this signature you have to load the tcpdf.fdf on the Arobat Reader to add the certificate to List of Trusted Identities.

For more information check the source code of this example and the source code documentation for the setSignature() method.

www.tcpdf.org'; -$pdf->writeHTML($text, true, 0, true, 0); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// *** set signature appearance *** - -// create content for signature (image and/or text) -$pdf->Image('images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG'); - -// define active area for signature appearance -$pdf->setSignatureAppearance(180, 60, 15, 15); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// *** set an empty signature appearance *** -$pdf->addEmptySignatureAppearance(180, 80, 15, 15); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_052.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_053.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_053.php deleted file mode 100644 index 8c784d5f025..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_053.php +++ /dev/null @@ -1,108 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 053'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 053', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('times', '', 14); - -// add a page -$pdf->AddPage(); - -// print a some of text -$text = 'This is an example of JavaScript usage on PDF documents.

For more information check the source code of this example, the source code documentation for the IncludeJS() method and the JavaScript for Acrobat API Reference guide.

www.tcpdf.org'; -$pdf->writeHTML($text, true, 0, true, 0); - -// write some JavaScript code -$js = <<IncludeJS($js); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_053.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_054.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_054.php deleted file mode 100644 index af4545df243..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_054.php +++ /dev/null @@ -1,128 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 054'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 054', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// IMPORTANT: disable font subsetting to allow users editing the document -$pdf->setFontSubsetting(false); - -// set font -$pdf->SetFont('helvetica', '', 10, '', false); - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = <<XHTML Form Example -
-
-

-

-

-
-
-

- -

- -


-
-
-


- - - - -
-
-EOD; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_054.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_055.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_055.php deleted file mode 100644 index a825966e250..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_055.php +++ /dev/null @@ -1,115 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 055'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 055', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 14); - -// array of font names -$core_fonts = array('courier', 'courierB', 'courierI', 'courierBI', 'helvetica', 'helveticaB', 'helveticaI', 'helveticaBI', 'times', 'timesB', 'timesI', 'timesBI', 'symbol', 'zapfdingbats'); - -// set fill color -$pdf->SetFillColor(221,238,255); - -// create one HTML table for each core font -foreach($core_fonts as $font) { - // add a page - $pdf->AddPage(); - - // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') - - // set font for title - $pdf->SetFont('helvetica', 'B', 16); - - // print font name - $pdf->Cell(0, 10, 'FONT: '.$font, 1, 1, 'C', true, '', 0, false, 'T', 'M'); - - // set font for chars - $pdf->SetFont($font, '', 16); - - // print each character - for ($i = 0; $i < 256; ++$i) { - if (($i > 0) AND (($i % 16) == 0)) { - $pdf->Ln(); - } - $pdf->Cell(11.25, 11.25, TCPDF_FONTS::unichr($i), 1, 0, 'C', false, '', 0, false, 'T', 'M'); - } - - $pdf->Ln(20); - - // print a pangram - $pdf->Cell(0, 0, 'The quick brown fox jumps over the lazy dog', 0, 1, 'C', false, '', 0, false, 'T', 'M'); -} - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_055.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_056.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_056.php deleted file mode 100644 index c3dfe25562c..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_056.php +++ /dev/null @@ -1,133 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 056'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 056', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 18); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Registration Marks, Crop Marks and Color Bars', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -// color registration bars - -// A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT, -$pdf->colorRegistrationBar(50, 70, 40, 40, true, false, 'A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar(90, 70, 40, 40, true, true, 'A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar(50, 115, 80, 5, false, true, 'A,W,R,G,B,C,M,Y,K,ALL'); -$pdf->colorRegistrationBar(135, 70, 5, 50, false, false, 'A,W,R,G,B,C,M,Y,K,ALL'); - -// corner crop marks - -$pdf->cropMark(50, 70, 10, 10, 'TL'); -$pdf->cropMark(140, 70, 10, 10, 'TR'); -$pdf->cropMark(50, 120, 10, 10, 'BL'); -$pdf->cropMark(140, 120, 10, 10, 'BR'); - -// various crop marks - -$pdf->cropMark(95, 65, 5, 5, 'LEFT,TOP,RIGHT', array(255,0,0)); -$pdf->cropMark(95, 125, 5, 5, 'LEFT,BOTTOM,RIGHT', array(255,0,0)); - -$pdf->cropMark(45, 95, 5, 5, 'TL,BL', array(0,255,0)); -$pdf->cropMark(145, 95, 5, 5, 'TR,BR', array(0,255,0)); - -$pdf->cropMark(95, 140, 5, 5, 'A,D', array(0,0,255)); - -// registration marks - -$pdf->registrationMark(40, 60, 5, false); -$pdf->registrationMark(150, 60, 5, true, array(0,0,0), array(255,255,0)); -$pdf->registrationMark(40, 130, 5, true, array(0,0,0), array(255,255,0)); -$pdf->registrationMark(150, 130, 5, false, array(100,100,100,100,'All'), array(0,0,0,0,'None')); - -// test registration bar with spot colors - -$pdf->AddSpotColor('My TCPDF Dark Green', 100, 50, 80, 45); -$pdf->AddSpotColor('My TCPDF Light Yellow', 0, 0, 55, 0); -$pdf->AddSpotColor('My TCPDF Black', 0, 0, 0, 100); -$pdf->AddSpotColor('My TCPDF Red', 30, 100, 90, 10); -$pdf->AddSpotColor('My TCPDF Green', 100, 30, 100, 0); -$pdf->AddSpotColor('My TCPDF Blue', 100, 60, 10, 5); -$pdf->AddSpotColor('My TCPDF Yellow', 0, 20, 100, 0); - -$pdf->colorRegistrationBar(50, 150, 80, 10, false, true, 'ALLSPOT'); - -// CMYK registration mark -$pdf->registrationMarkCMYK(150, 155, 8); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_056.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_057.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_057.php deleted file mode 100644 index 9714b40b1bc..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_057.php +++ /dev/null @@ -1,268 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 057'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 057', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->SetFont('helvetica', '', 11); - -// set border width -$pdf->SetLineWidth(0.7); - -// set color for cell border -$pdf->SetDrawColor(0,128,255); - -$pdf->setCellHeightRatio(3); - -$pdf->SetXY(15, 60); - -// text on center -$pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'C'); -$pdf->Cell(30, 0, 'Center-Center', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'C'); -$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'C'); -$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'C'); -$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'C'); -$pdf->Cell(30, 0, 'Descent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'C'); - - -$pdf->SetXY(15, 90); - -// text on top -$pdf->Cell(30, 0, 'Top-Top', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'T'); -$pdf->Cell(30, 0, 'Center-Top', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'T'); -$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'T'); -$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'T'); -$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'T'); -$pdf->Cell(30, 0, 'Descent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'T'); - - -$pdf->SetXY(15, 120); - -// text on bottom -$pdf->Cell(30, 0, 'Top-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'B'); -$pdf->Cell(30, 0, 'Center-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'B'); -$pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'B'); -$pdf->Cell(30, 0, 'Ascent-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'B'); -$pdf->Cell(30, 0, 'Baseline-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'B'); -$pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'B'); - - -// draw some reference lines -$linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0)); -$pdf->Line(15, 60, 195, 60, $linestyle); -$pdf->Line(15, 90, 195, 90, $linestyle); -$pdf->Line(15, 120, 195, 120, $linestyle); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print an image to explain cell measures - -$pdf->Image('images/tcpdf_cell.png', 15, 160, 100, 100, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false); -$legend = 'LEGEND: - -X: cell x top-left origin (top-right for RTL) -Y: cell y top-left origin (top-right for RTL) -CW: cell width -CH: cell height -LW: line width -NRL: normal line position -EXT: external line position -INT: internal line position -ML: margin left -MR: margin right -MT: margin top -MB: margin bottom -PL: padding left -PR: padding right -PT: padding top -PB: padding bottom -TW: text width -FA: font ascent -FB: font baseline -FD: font descent'; -$pdf->SetFont('helvetica', '', 10); -$pdf->setCellHeightRatio(1.25); -$pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// CELL BORDERS - -// add a page -$pdf->AddPage(); - -$pdf->SetFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of borders for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->SetFont('helvetica', '', 11); - -// set border width -$pdf->SetLineWidth(0.508); - -// set color for cell border -$pdf->SetDrawColor(0,128,255); - -// set filling color -$pdf->SetFillColor(255,255,128); - -// set cell height ratio -$pdf->setCellHeightRatio(3); - -$pdf->Cell(30, 0, '1', 1, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTRB', 'LTRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTR', 'LTR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TRB', 'TRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LRB', 'LRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTB', 'LTB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LT', 'LT', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TR', 'TR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'RB', 'RB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LB', 'LB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LR', 'LR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TB', 'TB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'L', 'L', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'T', 'T', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'R', 'R', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'B', 'B', 1, 'C', 1, '', 0, false, 'T', 'C'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ADVANCED SETTINGS FOR CELL BORDERS - -// add a page -$pdf->AddPage(); - -$pdf->SetFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of advanced border settings for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->SetFont('helvetica', '', 11); - -// set border width -$pdf->SetLineWidth(1); - -// set color for cell border -$pdf->SetDrawColor(0,128,255); - -// set filling color -$pdf->SetFillColor(255,255,128); - -$border = array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array( -'L' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)), -'R' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)), -'T' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 255, 0)), -'B' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); -$pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array('mode' => 'ext', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB EXT', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array('mode' => 'int', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB INT', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_057.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_058.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_058.php deleted file mode 100644 index 1e472fbcb28..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_058.php +++ /dev/null @@ -1,94 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 058'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -// NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library. -//$pdf->setRasterizeVectorImages(true); - -$pdf->ImageSVG($file='images/testsvg.svg', $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false); - -$pdf->ImageSVG($file='images/tux.svg', $x=30, $y=100, $w='', $h=100, $link='', $align='', $palign='', $border=0, $fitonpage=false); - -$pdf->SetFont('helvetica', '', 8); -$pdf->SetY(195); -$txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_058.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_059.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_059.php deleted file mode 100644 index 9396784da29..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_059.php +++ /dev/null @@ -1,190 +0,0 @@ -tocpage) { - // *** replace the following parent::Header() with your code for TOC page - parent::Header(); - } else { - // *** replace the following parent::Header() with your code for normal pages - parent::Header(); - } - } - - /** - * Overwrite Footer() method. - * @public - */ - public function Footer() { - if ($this->tocpage) { - // *** replace the following parent::Footer() with your code for TOC page - parent::Footer(); - } else { - // *** replace the following parent::Footer() with your code for normal pages - parent::Footer(); - } - } - -} // end of class - -// create new PDF document -$pdf = new TOC_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 059'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 059', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// set font -$pdf->SetFont('helvetica', '', 10); - -// --------------------------------------------------------- - -// create some content ... - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -// add some pages and bookmarks -for ($i = 2; $i < 12; $i++) { - $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); - $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); -} - - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - -// add a new page for TOC -$pdf->addTOCPage(); - -// write the TOC title and/or other elements on the TOC page -$pdf->SetFont('times', 'B', 16); -$pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0); -$pdf->Ln(); -$pdf->SetFont('helvetica', '', 10); - -// define styles for various bookmark levels -$bookmark_templates = array(); - -/* - * The key of the $bookmark_templates array represent the bookmark level (from 0 to n). - * The following templates will be replaced with proper content: - * #TOC_DESCRIPTION# this will be replaced with the bookmark description; - * #TOC_PAGE_NUMBER# this will be replaced with page number. - * - * NOTES: - * If you want to align the page number on the right you have to use a monospaced font like courier, otherwise you can left align using any font type. - * The following is just an example, you can get various styles by combining various HTML elements. - */ - -// A monospaced font for the page number is mandatory to get the right alignment -$bookmark_templates[0] = '
#TOC_DESCRIPTION##TOC_PAGE_NUMBER#
'; -$bookmark_templates[1] = '
 #TOC_DESCRIPTION##TOC_PAGE_NUMBER#
'; -$bookmark_templates[2] = '
 #TOC_DESCRIPTION##TOC_PAGE_NUMBER#
'; -// add other bookmark level templates here ... - -// add table of content at page 1 -// (check the example n. 45 for a text-only TOC -$pdf->addHTMLTOC(1, 'INDEX', $bookmark_templates, true, 'B', array(128,0,0)); - -// end of TOC page -$pdf->endTOCPage(); - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_059.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_060.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_060.php deleted file mode 100644 index 03bad28a841..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_060.php +++ /dev/null @@ -1,108 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 060'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 060', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// set font -$pdf->SetFont('helvetica', '', 20); - -// --------------------------------------------------------- - -// set page format (read source code documentation for further information) -$page_format = array( - 'MediaBox' => array ('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), - 'CropBox' => array ('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), - 'BleedBox' => array ('llx' => 5, 'lly' => 5, 'urx' => 205, 'ury' => 292), - 'TrimBox' => array ('llx' => 10, 'lly' => 10, 'urx' => 200, 'ury' => 287), - 'ArtBox' => array ('llx' => 15, 'lly' => 15, 'urx' => 195, 'ury' => 282), - 'Dur' => 3, - 'trans' => array( - 'D' => 1.5, - 'S' => 'Split', - 'Dm' => 'V', - 'M' => 'O' - ), - 'Rotate' => 90, - 'PZ' => 1, -); - -// Check the example n. 29 for viewer preferences - -// add first page --- -$pdf->AddPage('P', $page_format, false, false); -$pdf->Cell(0, 12, 'First Page', 1, 1, 'C'); - -// add second page --- -$page_format['Rotate'] = 270; -$pdf->AddPage('P', $page_format, false, false); -$pdf->Cell(0, 12, 'Second Page', 1, 1, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_060.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_061.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_061.php deleted file mode 100644 index 13e18c22eab..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_061.php +++ /dev/null @@ -1,264 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 061'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -/* NOTE: - * ********************************************************* - * You can load external XHTML using : - * - * $html = file_get_contents('/path/to/your/file.html'); - * - * External CSS files will be automatically loaded. - * Sometimes you need to fix the path of the external CSS. - * ********************************************************* - */ - -// define some HTML content with style -$html = << - - -

Example of XHTML + CSS

- -

Example of paragraph with class selector. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

- -

Example of paragraph with ID selector. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

- -
example of DIV with border and fill. -
Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
text-transform LOWERCASE Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
text-transform uppercase Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
text-transform cAPITALIZE Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
No.XXXXXXXX XXXXXXXXXXXX
1.XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXXXXXX
XXXX
2.XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
3.XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
4.XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
XXXX
-EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// add a page -$pdf->AddPage(); - -$html = ' -

HTML TIPS & TRICKS

- -

REMOVE CELL PADDING

-
$pdf->SetCellPadding(0);
-This is used to remove any additional vertical space inside a single cell of text. - -

REMOVE TAG TOP AND BOTTOM MARGINS

-
$tagvs = array(\'p\' => array(0 => array(\'h\' => 0, \'n\' => 0), 1 => array(\'h\' => 0, \'n\' => 0)));
-$pdf->setHtmlVSpace($tagvs);
-Since the CSS margin command is not yet implemented on TCPDF, you need to set the spacing of block tags using the following method. - -

SET LINE HEIGHT

-
$pdf->setCellHeightRatio(1.25);
-You can use the following method to fine tune the line height (the number is a percentage relative to font height). - -

CHANGE THE PIXEL CONVERSION RATIO

-
$pdf->setImageScale(0.47);
-This is used to adjust the conversion ratio between pixels and document units. Increase the value to get smaller objects.
-Since you are using pixel unit, this method is important to set theright zoom factor.

-Suppose that you want to print a web page larger 1024 pixels to fill all the available page width.
-An A4 page is larger 210mm equivalent to 8.268 inches, if you subtract 13mm (0.512") of margins for each side, the remaining space is 184mm (7.244 inches).
-The default resolution for a PDF document is 300 DPI (dots per inch), so you have 7.244 * 300 = 2173.2 dots (this is the maximum number of points you can print at 300 DPI for the given width).
-The conversion ratio is approximatively 1024 / 2173.2 = 0.47 px/dots
-If the web page is larger 1280 pixels, on the same A4 page the conversion ratio to use is 1280 / 2173.2 = 0.59 pixels/dots'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_061.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_062.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_062.php deleted file mode 100644 index 45fc25dad18..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_062.php +++ /dev/null @@ -1,140 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 062'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 062', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'XObject Templates', '', 0, 'C', 1, 0, false, false, 0); - -/* - * An XObject Template is a PDF block that is a self-contained - * description of any sequence of graphics objects (including path - * objects, text objects, and sampled images). - * An XObject Template may be painted multiple times, either on - * several pages or at several locations on the same page and produces - * the same results each time, subject only to the graphics state at - * the time it is invoked. - */ - - -// start a new XObject Template and set transparency group option -$template_id = $pdf->startTemplate(60, 60, true); - -// create Template content -// ................................................................... -//Start Graphic Transformation -$pdf->StartTransform(); - -// set clipping mask -$pdf->StarPolygon(30, 30, 29, 10, 3, 0, 1, 'CNZ'); - -// draw jpeg image to be clipped -$pdf->Image('images/image_demo.jpg', 0, 0, 60, 60, '', '', '', true, 72, '', false, false, 0, false, false, false); - -//Stop Graphic Transformation -$pdf->StopTransform(); - -$pdf->SetXY(0, 0); - -$pdf->SetFont('times', '', 40); - -$pdf->SetTextColor(255, 0, 0); - -// print a text -$pdf->Cell(60, 60, 'Template', 0, 0, 'C', false, '', 0, false, 'T', 'M'); -// ................................................................... - -// end the current Template -$pdf->endTemplate(); - - -// print the selected Template various times using various transparencies - -$pdf->SetAlpha(0.4); -$pdf->printTemplate($template_id, 15, 50, 20, 20, '', '', false); - -$pdf->SetAlpha(0.6); -$pdf->printTemplate($template_id, 27, 62, 40, 40, '', '', false); - -$pdf->SetAlpha(0.8); -$pdf->printTemplate($template_id, 55, 85, 60, 60, '', '', false); - -$pdf->SetAlpha(1); -$pdf->printTemplate($template_id, 95, 125, 80, 80, '', '', false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_062.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_063.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_063.php deleted file mode 100644 index de13515c7c4..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_063.php +++ /dev/null @@ -1,131 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 063'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 063', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', 'B', 16); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Text Stretching and Spacing (tracking)', '', 0, 'L', true, 0, false, false, 0); -$pdf->Ln(5); - -// create several cells to display all cases of stretching and spacing combinations. - -$fonts = array('times', 'dejavuserif'); -$alignments = array('L' => 'LEFT', 'C' => 'CENTER', 'R' => 'RIGHT', 'J' => 'JUSTIFY'); - - -// Test all cases using direct stretching/spacing methods -foreach ($fonts as $fkey => $font) { - $pdf->SetFont($font, '', 14); - foreach ($alignments as $align_mode => $align_name) { - for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - $pdf->setFontStretching($stretching); - $pdf->setFontSpacing($spacing); - $txt = $align_name.' | Stretching = '.$stretching.'% | Spacing = '.sprintf('%+.3F', $spacing).'mm'; - $pdf->Cell(0, 0, $txt, 1, 1, $align_mode); - } - } - } - $pdf->AddPage(); -} - - -// Test all cases using CSS stretching/spacing properties -foreach ($fonts as $fkey => $font) { - $pdf->SetFont($font, '', 11); - foreach ($alignments as $align_mode => $align_name) { - for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - $html = ''.$align_name.' | Stretching = '.$stretching.'% | Spacing = '.sprintf('%+.3F', $spacing).'mm
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
'; - $pdf->writeHTMLCell(0, 0, '', '', $html, 1, 1, false, true, $align_mode, false); - } - } - if (!(($fkey == 1) AND ($align_mode == 'J'))) { - $pdf->AddPage(); - } - } -} - - -// reset font stretching -$pdf->setFontStretching(100); - -// reset font spacing -$pdf->setFontSpacing(0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_063.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_064.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_064.php deleted file mode 100644 index 39da07139a7..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_064.php +++ /dev/null @@ -1,176 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 064'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 064', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->SetFont('helvetica', '', 8); - - -// define some html content for testing -$txt = '

TEST PAGE REGIONS: A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page. You can combine several adjacent regions to approximate curved shapes. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

'; - - -// add a page -$pdf->AddPage(); - -// print some graphic content -$pdf->Image('images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true); -$pdf->Image('images/image_demo.jpg', 15, 230, 40, 40, 'JPG', '', '', true); - -// define some graphic styles -$styleA = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)); -$styleB = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 3, 'color' => array(127, 127, 127)); -$pdf->SetFillColor(220, 255, 220); - -// write a trapezoid with some information about no-write page regions -$pdf->Polygon(array(15,90, 57,90, 67,140, 15,140), 'DF', array($styleB, $styleA, $styleB, $styleB)); -$pdf->SetXY(15, 90); -$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'R', false, '', 0, false, 'T', 'T'); -$pdf->SetXY(15, 140); -$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'R', false, '', 0, false, 'B', 'B'); -$pdf->SetXY(15, 115); -$pdf->Cell(40, 0, 'side', 0, 0, 'R', false, '', 0, false, 'B', 'B'); -$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Arrow(60, 115, 35, 115, 2, 5, 15); - -// write a trapezoid with some information about no-write page regions -$pdf->Polygon(array(145,130, 195,130, 195,180, 155,180), 'DF', array($styleB, $styleB, $styleB, $styleA)); -$pdf->SetXY(145, 130); -$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'L', false, '', 0, false, 'T', 'T'); -$pdf->SetXY(155, 180); -$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'L', false, '', 0, false, 'B', 'B'); -$pdf->SetXY(160, 155); -$pdf->Cell(30, 0, 'side', 0, 0, 'L', false, '', 0, false, 'B', 'B'); -$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Arrow(155, 155, 180, 155, 2, 5, 15); - -// reset x,y position -$pdf->SetXY(15, 30); - - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// define no-write page regions to avoid text overlapping images -/* - 'page' => page number or empy for current page - 'xt' => X top - 'yt' => Y top - 'yb' => Y bottom - 'side' => page side ('L' = left or 'R' = right) -*/ -$regions = array( -array('page' => '', 'xt' => 153, 'yt' => 30, 'xb' => 153, 'yb' => 70, 'side' => 'R'), -array('page' => '', 'xt' => 60, 'yt' => 90, 'xb' => 70, 'yb' => 140, 'side' => 'L'), -array('page' => '', 'xt' => 143, 'yt' => 130, 'xb' => 153, 'yb' => 180, 'side' => 'R'), -array('page' => '', 'xt' => 58, 'yt' => 230, 'xb' => 58, 'yb' => 270, 'side' => 'L') -); - -// set page regions, check also getPageRegions(), addPageRegion() and removePageRegion() -$pdf->setPageRegions($regions); - -// write html text -$pdf->writeHTML($txt, true, false, true, false, ''); - - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set a circular no-write region on the second page -$regions = array( -array('page' => 2, 'xt' => 195, 'yt' => 110, 'xb' => 179.693, 'yb' => 113.045, 'side' => 'R'), -array('page' => 2, 'xt' => 179.693, 'yt' => 113.045, 'xb' => 166.716, 'yb' => 121.716, 'side' => 'R'), -array('page' => 2, 'xt' => 166.716, 'yt' => 121.716, 'xb' => 158.045, 'yb' => 134.693, 'side' => 'R'), -array('page' => 2, 'xt' => 158.045, 'yt' => 134.693, 'xb' => 155, 'yb' => 150, 'side' => 'R'), -array('page' => 2, 'xt' => 155, 'yt' => 150, 'xb' => 158.045, 'yb' => 165.307, 'side' => 'R'), -array('page' => 2, 'xt' => 158.045, 'yt' => 165.307, 'xb' => 166.716, 'yb' => 178.284, 'side' => 'R'), -array('page' => 2, 'xt' => 166.716, 'yt' => 178.284, 'xb' => 179.693, 'yb' => 186.955, 'side' => 'R'), -array('page' => 2, 'xt' => 179.693, 'yt' => 186.955, 'xb' => 195, 'yb' => 190, 'side' => 'R') -); -$pdf->setPageRegions($regions); - -$pdf->Polygon(array(195,110, 179.693,113.045, 166.716,121.716, 158.045,134.693, 155,150, 158.045,165.307, 166.716,178.284, 179.693,186.955, 195,190), 'DF'); - -$pdf->Ln(15); - -// define some html content for testing -$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.'."\n"; - -// write text -$pdf->MultiCell(0, 0, $txt, 0, 'J', false, 1, '', '', true, 0, false, true, 0, 'T', false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_064.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/example_065.php b/htdocs/includes/tecnickcom/tcpdf/examples/example_065.php deleted file mode 100644 index f1bbcbe9dfa..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/example_065.php +++ /dev/null @@ -1,98 +0,0 @@ -SetCreator(PDF_CREATOR); -$pdf->SetAuthor('Nicola Asuni'); -$pdf->SetTitle('TCPDF Example 065'); -$pdf->SetSubject('TCPDF Tutorial'); -$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 065', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); -$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// Set font -$pdf->SetFont('helvetica', '', 14, '', true); - -// Add a page -// This method has several options, check the source code documentation for more information. -$pdf->AddPage(); - -// Set some content to print -$html = <<Example of  TCPDF  document in PDF/A-1b mode. -This document conforms to the standard PDF/A-1b (ISO 19005-1:2005). -

Please check the source code documentation and other examples for further information (http://www.tcpdf.org).

-

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

-EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -// --------------------------------------------------------- - -// Close and output PDF document -// This method has several options, check the source code documentation for more information. -$pdf->Output('example_065.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/_blank.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/_blank.png deleted file mode 100644 index 38f7b2fa56a..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/_blank.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/alpha.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/alpha.png deleted file mode 100644 index 5447918606d..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/alpha.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/image_demo.jpg b/htdocs/includes/tecnickcom/tcpdf/examples/images/image_demo.jpg deleted file mode 100644 index 262bce272c8..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/image_demo.jpg and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/image_with_alpha.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/image_with_alpha.png deleted file mode 100644 index 3011618ded0..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/image_with_alpha.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/img.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/img.png deleted file mode 100644 index 9c1a07544a3..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/img.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.gif b/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.gif deleted file mode 100644 index 010b487d938..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.gif and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.jpg b/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.jpg deleted file mode 100644 index 6d9b8fd8076..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.jpg and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.png deleted file mode 100644 index 13799452be3..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/logo_example.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.ai b/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.ai deleted file mode 100644 index 0c14846142e..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.ai +++ /dev/null @@ -1,214 +0,0 @@ -%!PS-Adobe-3.0 EPSF -%%Creator: Adobe Illustrator -%%BoundingBox: -7 0 487 327 -%%HiResBoundingBox: -6.66162 2.44007e-05 486.662 326.648 -%AI5_FileFormat 3 -%%EndComments -%%BeginProlog -%%EndProlog -%%BeginSetup -%%EndSetup -1 XR -%AI5_BeginLayer -1 1 1 1 0 0 -1 49 80 161 Lb -(New Layer) Ln -0.620000 0.580000 0.435000 0.996000 K -[] 0 d -1.402287 w -0 j -0 J -0.263000 0.290000 0.898000 0.263000 k -72.7885 255.643 m -277.08 286.778 L -425.478 260.993 L -408.269 190.301 L -113.504 181.247 L -113.504 181.247 72.9813 241.769 72.7885 255.643 C -b -0.620000 0.580000 0.435000 0.996000 K -1 j -0.094000 0.102000 0.369000 0.016000 k -423.247 259.914 m -240.217 207.097 L -240.635 0.701168 L -397.776 116.053 L -423.247 259.914 L -b -0.620000 0.580000 0.435000 0.996000 K -0.133000 0.141000 0.541000 0.035000 k -72.1745 254.207 m -240.217 207.097 L -240.561 0.783816 L -101.054 87.946 L -72.1745 254.207 L -b -0.047000 0.059000 0.184000 0.004000 k -423.247 259.914 m -308.187 51.1553 L -396.862 116.972 L -423.247 259.914 L -f -0.620000 0.580000 0.435000 0.996000 K -0 j -0.047000 0.059000 0.184000 0.004000 k -479.312 250.415 m -423.613 260.243 L -240.385 206.966 L -314.061 186.394 L -479.312 250.415 L -b -0.620000 0.580000 0.435000 0.996000 K -0.047000 0.059000 0.184000 0.004000 k -69.9121 254.273 m -237.965 207.131 L -163.618 164.537 L -0.687544 234.686 L -69.9121 254.273 L -b -0.620000 0.580000 0.435000 0.996000 K -0.047000 0.059000 0.184000 0.004000 k -242.971 319.299 m -275.613 286.233 L -72.5703 254.295 L -16.555 296.161 L -242.971 319.299 L -b -0.620000 0.580000 0.435000 0.996000 K -0.133000 0.141000 0.541000 0.035000 k -423.496 260.684 m -275.426 286.441 L -307.326 316.69 L -462.053 292.606 L -423.496 260.684 L -b -0.196000 0.227000 0.871000 0.106000 k -75.26 254.037 m -274.806 285.371 L -227.928 211.257 L -163.396 228.836 130.937 238.701 75.26 254.037 C -f -0.620000 0.580000 0.435000 0.996000 K -1 j -0.169000 0.314000 0.424000 0.094000 k -275.528 286.329 m -274.75 216.78 L -275.528 286.329 L -b -0.031000 0.949000 0.745000 0.729000 k -285.929 160.982 m -285.929 160.982 285.078 139.734 285.078 139.734 C -285.078 139.734 275.378 135.096 275.378 135.096 C -275.378 135.096 273.058 57.6061 273.058 57.6061 C -273.058 57.6061 257.133 47.3536 257.133 47.3536 C -257.133 47.3536 258.059 126.816 258.059 126.816 C -258.059 126.816 247.186 121.618 247.186 121.618 C -247.186 121.618 247.186 144.26 247.186 144.26 C -247.186 144.26 285.929 160.982 285.929 160.982 C -F -0.031000 0.949000 0.745000 0.729000 k -320.884 135.342 m -320.884 135.342 307.279 128.129 307.279 128.129 C -307.279 128.129 308.36 144.944 308.36 144.944 C -308.681 149.948 308.724 153.011 308.483 154.097 C -308.268 155.24 307.632 155.567 306.572 155.073 C -305.368 154.512 304.553 153.381 304.135 151.687 C -303.718 149.995 303.36 146.608 303.063 141.565 C -303.063 141.565 300.477 97.6864 300.477 97.6864 C -300.22 93.3298 300.208 90.6032 300.439 89.4791 C -300.668 88.3599 301.318 88.1316 302.385 88.7881 C -303.403 89.4149 304.103 90.4684 304.487 91.9528 C -304.894 93.4524 305.253 96.6211 305.567 101.497 C -305.567 101.497 306.297 112.86 306.297 112.86 C -306.297 112.86 319.718 120.438 319.718 120.438 C -319.718 120.438 319.446 116.964 319.446 116.964 C -318.734 107.862 317.873 101.293 316.856 97.1389 C -315.864 93.0164 314.026 88.8059 311.329 84.474 C -308.636 80.1307 305.421 76.743 301.646 74.2975 C -297.651 71.7096 294.365 70.7251 291.812 71.3887 C -289.213 72.064 287.545 74.2699 286.838 78.0362 C -286.121 81.8925 285.954 88.3297 286.349 97.4441 C -286.349 97.4441 287.575 125.751 287.575 125.751 C -287.89 133.007 288.277 138.586 288.737 142.421 C -289.202 146.323 290.251 150.369 291.883 154.544 C -293.54 158.732 295.716 162.4 298.394 165.529 C -301.078 168.689 304.052 170.959 307.296 172.342 C -311.621 174.188 315.02 174.154 317.521 172.296 C -319.974 170.473 321.427 167.541 321.911 163.514 C -322.39 159.578 322.275 153.119 321.579 144.225 C -321.579 144.225 320.884 135.342 320.884 135.342 C -F -0.031000 0.949000 0.745000 0.729000 k -*u -329.084 179.607 m -329.084 179.607 342.074 185.214 342.074 185.214 C -345.446 186.669 347.94 187.235 349.586 186.932 C -351.233 186.642 352.374 185.695 353.019 184.1 C -353.677 182.527 353.999 180.418 353.991 177.777 C -354.005 175.2 353.703 171.072 353.088 165.429 C -353.088 165.429 352.244 157.683 352.244 157.683 C -351.634 152.084 350.908 147.89 350.063 145.056 C -349.22 142.228 347.957 139.718 346.265 137.514 C -344.583 135.308 342.474 133.487 339.919 132.046 C -339.919 132.046 336.736 130.25 336.736 130.25 C -336.736 130.25 333.512 96.527 333.512 96.527 C -333.512 96.527 321.545 88.8222 321.545 88.8222 C -321.545 88.8222 329.084 179.607 329.084 179.607 C -F -340.42 168.795 m -340.42 168.795 338.184 145.407 338.184 145.407 C -338.526 145.552 338.82 145.69 339.068 145.822 C -340.172 146.404 340.98 147.319 341.498 148.568 C -342.038 149.863 342.473 152.174 342.805 155.518 C -342.805 155.518 343.55 163.014 343.55 163.014 C -343.863 166.167 343.82 168.111 343.416 168.832 C -343.011 169.557 342.015 169.547 340.42 168.795 C -F -*U -0.031000 0.949000 0.745000 0.729000 k -*u -359.204 192.607 m -359.204 192.607 367.556 196.212 367.556 196.212 C -372.753 198.454 376.114 199.414 377.734 199.14 C -379.351 198.877 380.446 197.777 381.03 195.854 C -381.608 193.948 381.815 191.642 381.655 188.934 C -381.502 186.28 380.88 180.934 379.804 172.981 C -379.804 172.981 375.968 144.653 375.968 144.653 C -375.021 137.654 374.236 132.926 373.604 130.399 C -372.993 127.921 372.216 125.786 371.268 123.986 C -370.323 122.215 369.243 120.698 368.023 119.43 C -366.801 118.187 365.012 116.807 362.638 115.279 C -362.638 115.279 349.593 106.88 349.593 106.88 C -349.593 106.88 359.204 192.607 359.204 192.607 C -F -368.395 181.985 m -368.395 181.985 361.644 126.918 361.644 126.918 C -363.113 127.815 364.084 128.947 364.566 130.32 C -365.053 131.727 365.629 135.077 366.301 140.416 C -366.301 140.416 370.368 172.752 370.368 172.752 C -370.86 176.666 371.12 179.163 371.145 180.223 C -371.168 181.285 371.006 181.972 370.654 182.282 C -370.306 182.629 369.555 182.531 368.395 181.985 C -F -*U -0.031000 0.949000 0.745000 0.729000 k -387.58 204.854 m -387.58 204.854 403.348 211.659 403.348 211.659 C -403.348 211.659 400.803 195.062 400.803 195.062 C -400.803 195.062 394.579 192.087 394.579 192.087 C -394.579 192.087 392.296 176.619 392.296 176.619 C -392.296 176.619 397.801 179.482 397.801 179.482 C -397.801 179.482 395.533 164.634 395.533 164.634 C -395.533 164.634 390.075 161.574 390.075 161.574 C -390.075 161.574 385.406 129.937 385.406 129.937 C -385.406 129.937 376.374 124.122 376.374 124.122 C -376.374 124.122 387.58 204.854 387.58 204.854 C -F -LB -%AI5_EndLayer-- -%AI5_BeginLayer -1 1 1 1 0 0 -1 49 80 161 Lb -(MasterLayer 1) Ln -LB -%AI5_EndLayer-- -%%Trailer -%%EOF diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.svg b/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.svg deleted file mode 100644 index 8c29e64abe2..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_box.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_cell.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_cell.png deleted file mode 100644 index 98a1553a82e..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_cell.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_logo.jpg b/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_logo.jpg deleted file mode 100644 index 257f8fb6d93..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_logo.jpg and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_signature.png b/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_signature.png deleted file mode 100644 index a4f06372511..00000000000 Binary files a/htdocs/includes/tecnickcom/tcpdf/examples/images/tcpdf_signature.png and /dev/null differ diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/testsvg.svg b/htdocs/includes/tecnickcom/tcpdf/examples/images/testsvg.svg deleted file mode 100644 index fd8314e3484..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/images/testsvg.svg +++ /dev/null @@ -1,328 +0,0 @@ - - - - - TCPDF SVG EXAMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - www.tcpdf.org - - - - - - - - SVG - diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/images/tux.svg b/htdocs/includes/tecnickcom/tcpdf/examples/images/tux.svg deleted file mode 100644 index de8c8696886..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/images/tux.svg +++ /dev/null @@ -1,1487 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/index.php b/htdocs/includes/tecnickcom/tcpdf/examples/index.php deleted file mode 100644 index 75125235e72..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/index.php +++ /dev/null @@ -1,115 +0,0 @@ -'; -?> - - - - - -TCPDF Examples - - - - - - - - -

TCPDF Examples

- -

PDF

- -
    -
  1. Simple PDF with default Header and Footer: [PDF]
  2. -
  3. Simple PDF without Header and Footer: [PDF]
  4. -
  5. Custom Header and Footer: [PDF]
  6. -
  7. Cell stretching: [PDF]
  8. -
  9. Multicell: [PDF]
  10. -
  11. WriteHTML and RTL support: [PDF]
  12. -
  13. Independent columns with WriteHTMLCell: [PDF]
  14. -
  15. External UTF-8 text file: [PDF]
  16. -
  17. Image: [PDF]
  18. -
  19. Multiple columns: [PDF]
  20. -
  21. Colored Tables: [PDF]
  22. -
  23. Graphic Functions: [PDF]
  24. -
  25. Graphic Transformations: [PDF]
  26. -
  27. Javascript and Forms: [PDF]
  28. -
  29. Bookmarks (Table of Content): [PDF]
  30. -
  31. Document Encryption: [PDF]
  32. -
  33. Independent columns with MultiCell: [PDF]
  34. -
  35. Persian and Arabic language on RTL document: [PDF]
  36. -
  37. Non unicode / Alternative config file: [PDF]
  38. -
  39. Multicell complex alignment: [PDF]
  40. -
  41. writeHTML alignment: [PDF]
  42. -
  43. CMYK colors: [PDF]
  44. -
  45. Page Groups: [PDF]
  46. -
  47. Object Visibility and Layers: [PDF]
  48. -
  49. Object Transparency: [PDF]
  50. -
  51. Text Rendering Modes and Text Clipping: [PDF]
  52. -
  53. 1D Barcodes: [PDF]
  54. -
  55. Multiple page formats: [PDF]
  56. -
  57. Set PDF viewer display preferences: [PDF]
  58. -
  59. Colour gradients: [PDF]
  60. -
  61. Pie Chart Graphic: [PDF]
  62. -
  63. EPS/AI vectorial image: [PDF]
  64. -
  65. Mixed font types (TrueType Unicode, core, CID-0): [PDF]
  66. -
  67. Clipping masks: [PDF]
  68. -
  69. Line styles with cells and multicells: [PDF]
  70. -
  71. Text Annotations: [PDF]
  72. -
  73. Spot Colors: [PDF]
  74. -
  75. NON-embedded CID-0 CJK font: [PDF]
  76. -
  77. HTML Justification: [PDF]
  78. -
  79. Booklet (double-sided pages): [PDF]
  80. -
  81. File attachment: [PDF]
  82. -
  83. Image with Alpha Channel Transparency: [PDF]
  84. -
  85. Disk caching: [PDF]
  86. -
  87. Move, Copy and Delete page: [PDF]
  88. -
  89. Table Of Content with Bookmarks: [PDF]
  90. -
  91. Text hyphenation: [PDF]
  92. -
  93. Transactions and UNDO: [PDF]
  94. -
  95. Table header and rowspan: [PDF]
  96. -
  97. TCPDF methods in HTML: [PDF]
  98. -
  99. 2D Barcode (QR-Code, Datamatrix ECC200 and PDF417): [PDF]
  100. -
  101. Full page background: [PDF]
  102. -
  103. Digital Signature Certification: [PDF]
  104. -
  105. Javascript functions: [PDF]
  106. -
  107. XHTML Form: [PDF]
  108. -
  109. Font Dump: [PDF]
  110. -
  111. Crop Marks and Registration Marks: [PDF]
  112. -
  113. Cell vertical alignments and borders: [PDF]
  114. -
  115. SVG Image: [PDF]
  116. -
  117. Table Of Content with HTML templates: [PDF]
  118. -
  119. Advanced page settings: [PDF]
  120. -
  121. XHTML + CSS: [PDF]
  122. -
  123. XObject Templates: [PDF]
  124. -
  125. Text stretching and spacing (tracking/kerning): [PDF]
  126. -
  127. No-write page regions: [PDF]
  128. -
  129. PDF/A-1b (ISO 19005-1:2005) document: [PDF]
  130. -
- -

Barcodes

- -
    -
  1. 1D barcode HTML format [HTML]
  2. -
  3. 1D barcode PNG format [PNG]
  4. -
  5. 1D barcode SVG format [SVG]
  6. -
  7. 1D barcode SVG INLINE format [SVG INLINE]
  8. - -
  9. 2D datamatrix barcode HTML format [HTML]
  10. -
  11. 2D datamatrix barcode PNG format [PNG]
  12. -
  13. 2D datamatrix barcode SVG format [SVG]
  14. -
  15. 2D datamatrix barcode SVG INLINE format [SVG INLINE]
  16. - -
  17. 2D pdf417 barcode HTML format [HTML]
  18. -
  19. 2D pdf417 barcode PNG format [PNG]
  20. -
  21. 2D pdf417 barcode SVG format [SVG]
  22. -
  23. 2D pdf417 barcode SVG INLINE format [SVG INLINE]
  24. - -
  25. 2D qrcode barcode HTML format [HTML]
  26. -
  27. 2D qrcode barcode PNG format [PNG]
  28. -
  29. 2D qrcode barcode SVG format [SVG]
  30. -
  31. 2D qrcode barcode SVG INLINE format [SVG INLINE]
  32. -
- - - diff --git a/htdocs/includes/tecnickcom/tcpdf/examples/lang/afr.php b/htdocs/includes/tecnickcom/tcpdf/examples/lang/afr.php deleted file mode 100644 index 367b7e87f0b..00000000000 --- a/htdocs/includes/tecnickcom/tcpdf/examples/lang/afr.php +++ /dev/null @@ -1,44 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : This is a command line script to generate TCPDF fonts. -// -//============================================================+ - -/** - * @file - * This is a command line script to generate TCPDF fonts.
- * @package com.tecnick.tcpdf - * @version 1.0.000 - */ - -if (php_sapi_name() != 'cli') { - echo 'You need to run this command from console.'; - exit(1); -} - -$tcpdf_include_dirs = array(realpath(dirname(__FILE__).'/../tcpdf.php'), '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', '/var/www/tcpdf/tcpdf.php', '/var/www/html/tcpdf/tcpdf.php', '/usr/local/apache2/htdocs/tcpdf/tcpdf.php'); -foreach ($tcpdf_include_dirs as $tcpdf_include_path) { - if (@file_exists($tcpdf_include_path)) { - require_once($tcpdf_include_path); - break; - } -} - -/** - * Display help guide for this command. - */ -function showHelp() { - $help = <<'', 'enc'=>'', 'flags'=>32, 'outpath'=>K_PATH_FONTS, 'platid'=>3, 'encid'=>1, 'addcbbox'=>false, 'link'=>false); - -// short input options -$sopt = ''; -$sopt .= 't:'; -$sopt .= 'e:'; -$sopt .= 'f:'; -$sopt .= 'o:'; -$sopt .= 'p:'; -$sopt .= 'n:'; -$sopt .= 'b'; -$sopt .= 'l'; -$sopt .= 'i:'; -$sopt .= 'h'; - -// long input options -$lopt = array(); -$lopt[] = 'type:'; -$lopt[] = 'enc:'; -$lopt[] = 'flags:'; -$lopt[] = 'outpath:'; -$lopt[] = 'platid:'; -$lopt[] = 'encid:'; -$lopt[] = 'addcbbox'; -$lopt[] = 'link'; -$lopt[] = 'fonts:'; -$lopt[] = 'help'; - -// parse input options -$inopt = getopt($sopt, $lopt); - -// import options (with some sanitization) -foreach ($inopt as $opt => $val) { - switch ($opt) { - case 't': - case 'type': { - if (in_array($val, array('TrueTypeUnicode', 'TrueType', 'Type1', 'CID0JP', 'CID0KR', 'CID0CS', 'CID0CT'))) { - $options['type'] = $val; - } - break; - } - case 'e': - case 'enc': { - $options['enc'] = $val; - break; - } - case 'f': - case 'flags': { - $options['flags'] = intval($val); - break; - } - case 'o': - case 'outpath': { - $options['outpath'] = realpath($val); - if (substr($options['outpath'], -1) != '/') { - $options['outpath'] .= '/'; - } - break; - } - case 'p': - case 'platid': { - $options['platid'] = min(max(1, intval($val)), 3); - break; - } - case 'n': - case 'encid': { - $options['encid'] = min(max(0, intval($val)), 10); - break; - } - case 'b': - case 'addcbbox': { - $options['addcbbox'] = true; - break; - } - case 'l': - case 'link': { - $options['link'] = true; - break; - } - case 'i': - case 'fonts': { - $options['fonts'] = explode(',', $val); - break; - } - case 'h': - case 'help': - default: { - showHelp(); - break; - } - } // end of switch -} // end of while loop - -if (empty($options['fonts'])) { - echo "ERROR: missing input fonts (try --help for usage)\n\n"; - exit(2); -} - -// check the output path -if (!is_dir($options['outpath']) OR !is_writable($options['outpath'])) { - echo "ERROR: Can't write to ".$options['outpath']."\n\n"; - exit(3); -} - -echo "\n>>> Converting fonts for TCPDF:\n"; - -echo '*** Output dir set to '.$options['outpath']."\n"; - -// check if there are conversion errors -$errors = false; - -foreach ($options['fonts'] as $font) { - $fontfile = realpath($font); - $fontname = TCPDF_FONTS::addTTFfont($fontfile, $options['type'], $options['enc'], $options['flags'], $options['outpath'], $options['platid'], $options['encid'], $options['addcbbox'], $options['link']); - if ($fontname === false) { - $errors = true; - echo "--- ERROR: can't add ".$font."\n"; - } else { - echo "+++ OK : ".$fontfile.' added as '.$fontname."\n"; - } -} - -if ($errors) { - echo "--- Process completed with ERRORS!\n\n"; - exit(4); -} - -echo ">>> Process successfully completed!\n\n"; -exit(0); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index f793a6b471a..002930c276c 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -385,5 +385,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value ALTER TABLE llx_product_fournisseur_price ADD supplier_reputation varchar(10) NULL; +ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price; + -- Delete old deprecated field ALTER TABLE llx_product_stock DROP COLUMN pmp; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 760fde2686d..a01e0c6c412 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -17,6 +17,7 @@ MyEvents=My events OtherEvents=Other events ListOfActions=List of events Location=Location +ToUserOfGroup=To any user in group EventOnFullDay=Event on all day(s) SearchAnAction= Search an event/task MenuToDoActions=All incomplete events diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a3376a336bb..56e136f5e52 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -6,6 +6,7 @@ NoErrorCommitIsDone=No error, we commit ErrorButCommitIsDone=Errors found but we validate despite this ErrorBadEMail=EMail %s is wrong ErrorBadUrl=Url %s is wrong +ErrorBadValueForParamNotAString=Bad value for your parameter. It appends generally when translation is missing. ErrorLoginAlreadyExists=Login %s already exists. ErrorGroupAlreadyExists=Group %s already exists. ErrorRecordNotFound=Record not found. diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 2d3a1d5a4a3..cf93bd3d2b1 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -52,7 +52,7 @@ ArcticNumRefModelDesc1=Generic number model ArcticNumRefModelError=Failed to activate PacificNumRefModelDesc1=Return numero with format %syymm-nnnn where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 PacificNumRefModelError=An intervention card starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. -PrintProductsOnFichinter=Print products on intervention card +PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card PrintProductsOnFichinterDetails=interventions generated from orders InterventionStatistics=Statistics of interventions NbOfinterventions=Nb of intervention cards diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index adae0e1800e..4b69e2c0dde 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -28,6 +28,7 @@ NoTemplateDefined=No template defined for this email type AvailableVariables=Available substitution variables NoTranslation=No translation NoRecordFound=No record found +NotEnoughDataYet=Not enough data NoError=No error Error=Error Errors=Errors diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 688866a4e5b..13659bc5954 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -10,4 +10,5 @@ EditPageMeta=Edit Meta EditPageContent=Edit Content Website=Web site AddPage=Add page -Page=Page \ No newline at end of file +Page=Page +PreviewOfSiteNotYetAvailable=Preview of your website %s not yet available. You must first add a page. \ No newline at end of file diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index b59d725fecd..9f9dbc3bd2c 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -454,7 +454,7 @@ if ($action == 'create' && $user->rights->projet->creer) // Ref $suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; @@ -532,7 +532,7 @@ if ($action == 'create' && $user->rights->projet->creer) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; // Other options @@ -650,7 +650,7 @@ else // Ref $suggestedref=$object->ref; - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; @@ -721,7 +721,7 @@ else // Description print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; // Other options diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 558bd7307ee..199840bb1c6 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -16,6 +16,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $i = 0; $totalnb=0; + $totaloppnb=0; $totalamount=0; $ponderated_opp_amount=0; $valsnb=array(); @@ -32,6 +33,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsnb[$obj->opp_status]=$obj->nb; $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; + if ($obj->opp_status) $totaloppnb+=$obj->nb; $totalamount+=$obj->opp_amount; $ponderated_opp_amount+=$obj->ponderated_opp_amount; } @@ -71,8 +73,8 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if ($conf->use_javascript_ajax) { print ''; - $data=array('series'=>$dataseries); - dol_print_graph('stats',400,180,$data,1,'pie',0,'',0); + $data=array('series'=>$dataseries); + dol_print_graph('stats',400,180,$data,1,'pie',0,'',0,$totaloppnb?0:1); print ''; } //if ($totalinprocess != $total) diff --git a/htdocs/theme/eldy/img/nographyet.svg b/htdocs/theme/eldy/img/nographyet.svg new file mode 100644 index 00000000000..ba3b9faf92a --- /dev/null +++ b/htdocs/theme/eldy/img/nographyet.svg @@ -0,0 +1,875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Icon Set Graph + 2012-09-06T20:29:21 + Check others icons on my "Minimal Icon Set" collection.\nSet of simple icons useful for gui design and applications use interface. Icons representing various graph and plotting + https://openclipart.org/detail/172197/icon-set-graph-by-mi_brami-172197 + + + mi_brami + + + + + Icon + area + b&w + barcode + bars + black + data + graph + gray + icon + pie + plot + round + scatter + table + transparent + white + xy + + + + + + + + + + + diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e7fe3a14952..173f5a7fd1e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -79,9 +79,10 @@ $dol_use_jmobile=$conf->dol_use_jmobile; //var_dump($user->conf->THEME_ELDY_RGB); // Colors -$colorbackhmenu1='120,130,170'; // topmenu +$colorbackhmenu1='110,120,160'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu -$colorbacktitle1='230,230,230'; // title of array +$colortopbordertitle1='40,40,40'; // top border of title +$colorbacktitle1='230,230,230'; // title of tables,list $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; $colorbacklineimpair1='255,255,255'; // line impair @@ -96,14 +97,15 @@ $colortext='0,0,0'; $colortextlink='0,0,120'; $fontsize='13'; $fontsizesmaller='11'; -$usegradient=1; -$useboldtitle=1; +$usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); +$usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); +$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1='120,130,170'; +if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; -if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=='238,246,252'; +if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover; if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; @@ -345,7 +347,7 @@ input:-moz-placeholder { color:#ccc; } legend { margin-bottom: 8px; } -fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #DDD; } +fieldset { border: 1px solid #AAAAAA !important; } .button, input[name="sbmtConnexion"] { @@ -802,7 +804,7 @@ div#id-top { display:none; background: rgb(); - + background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); @@ -881,7 +883,7 @@ ul.tmenu { /* t r b l */ } ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */ background: rgb(); - + background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); @@ -1720,11 +1722,11 @@ div.tabBar { background: rgb(); - + /* -moz-box-shadow: 3px 3px 4px #DDD; -webkit-box-shadow: 3px 3px 4px #DDD; box-shadow: 3px 3px 4px #DDD; - + */ } div.popuptabset { padding: 6px; @@ -2177,17 +2179,17 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-spacing: 0px; border-top-width: 1px; - border-top-color: #BBB; + border-top-color: rgb(); border-top-style: solid; - border-right-width: 1px; +/* border-right-width: 1px; border-right-color: #BBB; border-right-style: solid; border-left-width: 1px; border-left-color: #BBB; border-left-style: solid; - +*/ border-bottom-width: 1px; border-bottom-color: #BBB; border-bottom-style: solid; @@ -2204,17 +2206,8 @@ table.liste, table.noborder, table.formdoc, div.noborder { } table.liste tr, table.noborder tr, div.noborder form { border-top-color: #FEFEFE; - - border-right-width: 1px; - border-right-color: #BBB; - border-right-style: solid; - - border-left-width: 1px; - border-left-color: #BBB; - border-left-style: solid; min-height: 20px; } - table.liste th, table.noborder th { padding: 10px 2px 10px 3px; /* t r b l */ } @@ -2525,19 +2518,23 @@ div.liste_titre { padding-top: 2px; padding-bottom: 2px; - border-right-width: 1px; + /*border-right-width: 1px; border-right-color: #BBB; border-right-style: solid; border-left-width: 1px; border-left-color: #BBB; - border-left-style: solid; + border-left-style: solid;*/ border-top-width: 1px; border-top-color: #BBB; border-top-style: solid; } div.liste_titre_bydiv { + border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid; + border-collapse: collapse; display: table; padding: 2px 0px 2px 0; @@ -2555,13 +2552,14 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list color: #000 !important;*/ /* TO MATCH ELDY */ + + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background: rgb(); - - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); font-weight: ; @@ -2707,13 +2705,14 @@ tr.box_titre { color: #000 !important;*/ /* TO MATCH ELDY */ + + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background: rgb(); - - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); color: rgb(); @@ -2873,9 +2872,20 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } .logo_setup { - content:url(); + content:url(); /* content is used to best fit the container */ display: inline-block; } +.nographyet +{ + content:url(); + display: inline-block; + opacity: 0.1; + background-repeat: no-repeat; +} +.nographyettext +{ + opacity: 0.5; +} div.titre { font-family: ; diff --git a/htdocs/theme/md/img/nographyet.svg b/htdocs/theme/md/img/nographyet.svg new file mode 100644 index 00000000000..ba3b9faf92a --- /dev/null +++ b/htdocs/theme/md/img/nographyet.svg @@ -0,0 +1,875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Icon Set Graph + 2012-09-06T20:29:21 + Check others icons on my "Minimal Icon Set" collection.\nSet of simple icons useful for gui design and applications use interface. Icons representing various graph and plotting + https://openclipart.org/detail/172197/icon-set-graph-by-mi_brami-172197 + + + mi_brami + + + + + Icon + area + b&w + barcode + bars + black + data + graph + gray + icon + pie + plot + round + scatter + table + transparent + white + xy + + + + + + + + + + + diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9b5bbc5966e..b79b5c2404a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -82,7 +82,8 @@ $dol_use_jmobile=$conf->dol_use_jmobile; // Colors $colorbackhmenu1='0,0,80'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu -$colorbacktitle1='230,230,230'; // title of array +$colortopbordertitle1='40,40,40'; // top border of tables-lists title +$colorbacktitle1='230,230,230'; // title of tables-lists $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; $colorbacklineimpair1='255,255,255'; // line impair @@ -97,8 +98,8 @@ $colortext='0,0,0'; $colortextlink='0,0,120'; $fontsize='13'; $fontsizesmaller='11'; -$usegradient=1; -$useboldtitle=1; +$usegradient=0; +$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -343,7 +344,7 @@ input:-moz-placeholder { color:#ccc; } legend { margin-bottom: 8px; } -fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #f4f4f4; } +fieldset { border: 1px solid #AAAAAA !important; } .button, sbmtConnexion { @@ -1714,11 +1715,13 @@ div.tabBar { background: rgb(); + /* -moz-box-shadow: 3px 3px 4px #f4f4f4; -webkit-box-shadow: 3px 3px 4px #f4f4f4; box-shadow: 3px 3px 4px #f4f4f4; + */ } div.tabsAction { @@ -2043,17 +2046,29 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-collapse: separate !important; border-spacing: 0px; - border-width: 1px; - border-color: #BBB; - border-style: solid; + border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid; +/* border-right-width: 1px; + border-right-color: #BBB; + border-right-style: solid; + + border-left-width: 1px; + border-left-color: #BBB; + border-left-style: solid; +*/ + border-bottom-width: 1px; + border-bottom-color: #BBB; + border-bottom-style: solid; + margin: 0px 0px 8px 0px; /* -moz-box-shadow: 2px 2px 4px #CCC; -webkit-box-shadow: 2px 2px 4px #CCC; box-shadow: 2px 2px 4px #CCC; */ - box-shadow: 0 0 3px rgba(0,0,0,0.16); + /* box-shadow: 0 0 3px rgba(0,0,0,0.16); */ -moz-border-radius: 0.1em; -webkit-border-radius: 0.1em; @@ -2350,24 +2365,28 @@ div.liste_titre { padding-top: 2px; padding-bottom: 2px; - border-right-width: 1px; + /*border-right-width: 1px; border-right-color: #BBB; border-right-style: solid; border-left-width: 1px; border-left-color: #BBB; - border-left-style: solid; + border-left-style: solid;*/ border-top-width: 1px; border-top-color: #BBB; border-top-style: solid; } div.liste_titre_bydiv { + border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid; + box-shadow: none; border-collapse: collapse; display: table; padding: 2px 0px 2px 0; - width: calc(100% - 1px); /* 1px more, i don't know why */ + width: 100%; /* 1px more, i don't know why */ } tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr { @@ -2376,20 +2395,19 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { /* TO MATCH BOOTSTRAP */ - background: #ddd; + /* background: #ddd; */ /* TO MATCH ELDY */ - /* - background: rgb(); - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + + background: rgb(); font-weight: ; - */ color: rgb(); font-family: ; @@ -2495,7 +2513,7 @@ div.tabBar .noborder { } span.boxstatstext { - opacity: 0.8; + opacity: 0.9; line-height: 18px; } span.boxstatsindicator { @@ -2525,27 +2543,26 @@ span.dashboardlineko { .box { padding-right: 0px; padding-left: 0px; - padding-bottom: 4px; + padding-bottom: 12px; } tr.box_titre { height: 26px !important; /* TO MATCH BOOTSTRAP */ - background: #ddd; - color: #000 !important; + /*background: #ddd; + color: #000 !important; */ /* TO MATCH ELDY */ - /* - background: rgb(); - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%); + + background: rgb(); - */ background-repeat: repeat-x; color: rgb(); @@ -2707,9 +2724,20 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } .logo_setup { - content:url(); + content:url(); /* content is used to best fit the container */ display: inline-block; } +.nographyet +{ + content:url(); + display: inline-block; + opacity: 0.1; + background-repeat: no-repeat; +} +.nographyettext +{ + opacity: 0.5; +} div.titre { font-family: ; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index dc1cb5ebf34..2e4f2a7351a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -207,7 +207,10 @@ class User extends CommonObject } else // The fetch was forced on an entity { - $sql.= " WHERE u.entity IN (0, ".$conf->entity.")"; + if (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode)) + $sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + else + $sql.= " WHERE u.entity IN (0, ".$conf->entity.")"; } if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index bfcdb9e0c85..ba2a4466b4d 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -334,7 +334,8 @@ print ''; if ($action == 'preview') { - print '
Preview TO DO'; + print '

'.$langs->trans("PreviewOfSiteNotYetAvailable", $website).'


'; + print '
'; }