diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d4a9b725524..204988c5442 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -111,6 +111,10 @@ with // DOL CHANGE If we keep this, the image is not visible on pages after the first one. //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); //return false; + $tfile = str_replace(' ', '%20', $file); + if (@TCPDF_STATIC::file_exists($tfile)) { + $file = $tfile; + } } * Replace in tcpdf.php diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json index a9d519dec69..8852928771f 100644 --- a/dev/examples/zapier/package.json +++ b/dev/examples/zapier/package.json @@ -15,7 +15,7 @@ "npm": ">=5.6.0" }, "dependencies": { - "zapier-platform-core": "11.0.1" + "zapier-platform-core": "11.3.1" }, "devDependencies": { "mocha": "^5.2.0", diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 29c2b7d5510..fd0ff2e72da 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -185,11 +185,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $ok = 0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ } if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { $ok = 0; @@ -228,17 +223,17 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $i = 0; foreach ($listfieldinsert as $f => $value) { if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); + $_POST[$listfieldvalue[$i]] = price2num(GETPOST($listfieldvalue[$i]), 'MU'); } elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } @@ -276,7 +271,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $i = 0; foreach ($listfieldmodify as $field) { if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); + $_POST[$listfieldvalue[$i]] = price2num(GETPOST($listfieldvalue[$i]), 'MU'); } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } @@ -284,10 +279,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $sql .= ","; } $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index bb629577ab6..c0439445261 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -148,10 +148,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($value == 'formula' && !GETPOST('formula')) { continue; } - if ($value == 'range_account' && empty($_POST['range_account'])) { + if ($value == 'range_account' && !GETPOST('range_account')) { continue; } - if (($value == 'country' || $value == 'country_id') && (!empty($_POST['country_id']))) { + if (($value == 'country' || $value == 'country_id') && GETPOST('country_id')) { continue; } if (!GETPOSTISSET($value) || GETPOST($value) == '') { @@ -195,17 +195,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors'); } - // Clean some parameters - if ($_POST["accountancy_code"] <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_sell"] <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_buy"] <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { if ($tabrowid[$id]) { @@ -243,7 +232,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'formula') { + if (GETPOST($listfieldvalue[$i]) == '' && !$listfieldvalue[$i] == 'formula') { $sql .= "null"; // For vat, we want/accept code = '' } else { $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; @@ -283,8 +272,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'fk_country' && $_POST['country'] > 0) { - $_POST[$listfieldvalue[$i]] = $_POST['country']; + if ($field == 'fk_country' && GETPOST('country') > 0) { + $_POST[$listfieldvalue[$i]] = GETPOST('country'); } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } @@ -292,10 +281,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $sql .= ","; } $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'range_account') { + if (GETPOST($listfieldvalue[$i]) == '' && !$listfieldvalue[$i] == 'range_account') { $sql .= "null"; // For range_account, we want/accept code = '' } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 7f000290e1c..de6b8374c2a 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -165,45 +165,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { // Check that all fields are filled $ok = 1; - foreach ($listfield as $f => $value) { - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'nature') { - $fieldnamekey = 'NatureOfJournal'; - } - } + // Other checks if (GETPOSTISSET("code")) { if (GETPOST("code") == '0') { $ok = 0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ } if (!GETPOST('label', 'alpha')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); $ok = 0; } - // Clean some parameters - if ($_POST["accountancy_code"] <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_sell"] <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_buy"] <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { if ($tabrowid[$id]) { @@ -235,16 +209,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; - } if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; // For vat, we want/accept code = '' } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } @@ -254,7 +225,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $result = $db->query($sql); if ($result) { // Add is ok setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST = array('id'=>$id); // Clean $_POST array, we keep only + $_POST = array('id'=>$id); // Clean $_POST array, we keep only id } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); @@ -281,24 +252,15 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); - } elseif ($field == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; - } if ($i) { $sql .= ","; } - $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; - } + $sql .= $field." = "; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; $i++; } $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); dol_syslog("actionmodify", LOG_DEBUG); //print $sql; @@ -323,7 +285,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); dol_syslog("delete", LOG_DEBUG); $result = $db->query($sql); @@ -410,7 +372,7 @@ if ($action == 'delete') { if ($id) { // Complete requete recherche valeurs avec critere de tri $sql = $tabsql[$id]; - $sql .= " WHERE a.entity = ".$conf->entity; + $sql .= " WHERE a.entity = ".((int) $conf->entity); // If sort order is "country", we use country_code instead if ($sortfield == 'country') { @@ -510,7 +472,7 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $param = '&id='.$id; + $param = '&id='.((int) $id); if ($search_country_id > 0) { $param .= '&search_country_id='.urlencode($search_country_id); } @@ -635,7 +597,7 @@ if ($id) { $class = 'tddict'; // Show value for field if ($showfield) { - print ''.$valuetoshow.''; + print ''.dol_escape_htmltag($valuetoshow).''; } } } diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index fb3bf1a6e04..ff7b9295693 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -26,8 +26,8 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -49,9 +49,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -61,9 +66,9 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa if (empty($page) || $page < 0) { $page = 0; } +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$offset = $limit * $page; if (!$sortfield) { $sortfield = "erd.date, erd.rowid"; } @@ -101,9 +106,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; } if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { @@ -204,7 +214,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); @@ -222,9 +237,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/lines.php::list'); +dol_syslog("accountancy/expensereport/lines.php", LOG_DEBUG); $result = $db->query($sql); - if ($result) { $num_lines = $db->num_rows($result); $i = 0; @@ -254,14 +268,23 @@ if ($result) { if ($search_vat) { $param .= "&search_vat=".urlencode($search_vat); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } print '
'."\n"; @@ -276,12 +299,11 @@ if ($result) { print ''; print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneExpenseReport").'
'; - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '
'; + print '
'; $moreforfilter = ''; @@ -296,11 +318,12 @@ if ($result) { print ''; } print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; print ''; print ''; @@ -394,12 +417,11 @@ if ($result) { print ''.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).''; // Accounting account affected - print ''; + print ''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print ' '; print img_edit(); print ''; - print ''; print ""; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 863001c3bc0..d95f4ff67b9 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -30,9 +30,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page @@ -59,9 +59,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -83,6 +88,9 @@ if (!$sortorder) { } } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('accountancyexpensereportlist')); + $formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); @@ -101,7 +109,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { /* - * Action + * Actions */ if (GETPOST('cancel', 'alpha')) { @@ -111,30 +119,47 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -// Purge search criteria -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers - $search_login = ''; - $search_expensereport = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + $search_login = ''; + $search_expensereport = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_country = ''; + $search_tvaintra = ''; + } + + // Mass actions + $objectclass = 'ExpenseReport'; + $objectlabel = 'ExpenseReport'; + $permissiontoread = $user->rights->expensereport->read; + $permissiontodelete = $user->rights->expensereport->delete; + $uploaddir = $conf->expensereport->dir_output; + include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; } -// Mass actions -$objectclass = 'ExpenseReport'; -$objectlabel = 'ExpenseReport'; -$permissiontoread = $user->rights->expensereport->read; -$permissiontodelete = $user->rights->expensereport->delete; -$uploaddir = $conf->expensereport->dir_output; -include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $msg = ''; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; @@ -159,7 +184,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, '', 1); - dol_syslog('accountancy/expensereport/list.php', LOG_DEBUG); + dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG); if ($db->query($sql)) { $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; @@ -201,6 +226,9 @@ $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, er $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " u.rowid as userid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,"; $sql .= " aa.rowid as aarowid"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; @@ -233,9 +261,19 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", $search_vat, 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -251,7 +289,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/list.php'); +dol_syslog("accountancy/expensereport/list.php", LOG_DEBUG); +// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso) +// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=1"); +} + $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); @@ -272,14 +316,23 @@ if ($result) { if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } if ($search_expensereport) { $param .= '&search_expensereport='.urlencode($search_expensereport); @@ -302,7 +355,6 @@ if ($result) { ); $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1); - print ''."\n"; print ''; if ($optioncss != '') { @@ -335,20 +387,21 @@ if ($result) { if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { print ''; } - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; @@ -468,6 +521,9 @@ if ($result) { } else { print $db->error(); } +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation +} // Add code to auto check the box when we select an account print ''."\n"; - } + if (!empty($conf->use_javascript_ajax)) { + $out .= ''."\n"; + $out .= ''."\n"; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 68fe5152407..1bdd1161770 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -141,7 +141,7 @@ class Form } } } else { - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; } if ($fieldrequired) { @@ -158,10 +158,10 @@ class Form if (!empty($notabletag)) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { @@ -173,10 +173,10 @@ class Form if (!empty($notabletag) && $notabletag == 3) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; } } @@ -1599,7 +1599,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -1609,10 +1609,10 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprecated You can use selectcontacts directly (warning order of param was changed) */ - public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') + public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') { // phpcs:enable - print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); + print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); return $this->num; } @@ -1629,7 +1629,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param bool $options_only Return options only (for ajax treatment) * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box (so no ajax beautify effect) @@ -1640,7 +1640,7 @@ class Form * @param integer $disableifempty Set tag 'disabled' on select if there is no choice * @return int|string <0 if KO, HTML with select string if OK. */ - public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) + public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { global $conf, $langs, $hookmanager, $action; @@ -1687,7 +1687,7 @@ class Form $num = $this->db->num_rows($resql); if ($htmlname != 'none' && !$options_only) { - $out .= ''; } if ($showempty && ! is_numeric($showempty)) { @@ -2085,7 +2085,7 @@ class Form if ($num) { // Enhance with select2 include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out = ajax_combobox($htmlname).$out; + $out .= ajax_combobox($htmlname); } } else { dol_print_error($this->db); @@ -2094,6 +2094,7 @@ class Form if ($outputmode) { return $outarray; } + return $out; } diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 518a8f93290..1a2c02deb54 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -49,13 +49,13 @@ class FormCategory extends Form $categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1); $categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -"; - $tmptitle = $langs->trans("Category"); + $tmptitle = $langs->transnoentitiesnoconv("Category"); $filter = ''; $filter .= '
'; $filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); //$filter .= $langs->trans('Categories').": "; - $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle); + $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300 widthcentpercentminusx", 0, 0, '', '', $tmptitle); $filter .= "
"; return $filter; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 0c55a1fd853..f1f0a846f93 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -473,15 +473,6 @@ class FormOther $langs->load('users'); $out = ''; - // Enhance with select2 - if ($conf->use_javascript_ajax) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - - $comboenhancement = ajax_combobox($htmlname); - if ($comboenhancement) { - $out .= $comboenhancement; - } - } $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectSalesRep', array(), $this, $action); @@ -622,6 +613,16 @@ class FormOther $out .= ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + + $comboenhancement = ajax_combobox($htmlname); + if ($comboenhancement) { + $out .= $comboenhancement; + } + } + return $out; } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index ad83c706c12..aba62587fa1 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1364,7 +1364,7 @@ class FormTicket } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } - if (GETPOSTISSET("message") && !$_POST['modelselected']) { + if (GETPOSTISSET("message") && !GETPOST('modelselected')) { $defaultmessage = GETPOST('message', 'restricthtml'); } else { $defaultmessage = make_substitutions($defaultmessage, $this->substit); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index a068f5fb5f5..6054b05aab3 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -320,6 +320,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle // Loop on each request to execute request $cursorinsert = 0; $listofinsertedrowid = array(); + $keyforsql = md5($sqlfile); foreach ($arraysql as $i => $sql) { if ($sql) { // Replace the prefix tables @@ -335,7 +336,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle // Add log of request if (!$silent) { - print ''.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'\n"; + print ''.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'\n"; } dol_syslog('Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG); $sqlmodified = 0; @@ -454,18 +455,18 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle //if (!empty($conf->use_javascript_ajax)) { // use_javascript_ajax is not defined print ''; - print ' - '.$langs->trans("ShowHideDetails").''; + print ' - '.$langs->trans("ShowHideDetails").''; //} print ''."\n"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0a4455239bb..efde963d077 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -987,7 +987,7 @@ function dol_unescapefile($filename) */ function dolCheckVirus($src_file) { - global $conf; + global $conf, $db; if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { if (!class_exists('AntiVir')) { @@ -2374,6 +2374,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->user->dir_output.'/'.$original_file; + } elseif (($modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) { + // Wrapping for users logos + $accessallowed = 1; + $original_file = $conf->mycompany->dir_output.'/logos/'.$original_file; } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { // Wrapping for members photos $accessallowed = 0; @@ -2430,10 +2434,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; } elseif (($modulepart == 'holiday') && !empty($conf->holiday->dir_output)) { - if ($fuser->rights->holiday->{$read} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->holiday->{$read} || !empty($fuser->rights->holiday->readall) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; // If we known $id of holiday, call checkUserAccessToObject to check permission on properties and hierarchy of leave request - if ($refname && !preg_match('/^specimen/i', $original_file)) { + if ($refname && empty($fuser->rights->holiday->readall) && !preg_match('/^specimen/i', $original_file)) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $tmpholiday = new Holiday($db); $tmpholiday->fetch('', $refname); @@ -2442,10 +2446,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->holiday->dir_output.'/'.$original_file; } elseif (($modulepart == 'expensereport') && !empty($conf->expensereport->dir_output)) { - if ($fuser->rights->expensereport->{$lire} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->expensereport->{$lire} || !empty($fuser->rights->expensereport->readall) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; // If we known $id of expensereport, call checkUserAccessToObject to check permission on properties and hierarchy of expense report - if ($refname && !preg_match('/^specimen/i', $original_file)) { + if ($refname && empty($fuser->rights->expensereport->readall) && !preg_match('/^specimen/i', $original_file)) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $tmpexpensereport = new ExpenseReport($db); $tmpexpensereport->fetch('', $refname); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 24f36d61404..3b0e90c9013 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -713,11 +713,11 @@ function GETPOSTINT($paramname, $method = 0) /** * Return a value after checking on a rule. A sanitization may also have been done. * - * @param string $out Value to check/clear. - * @param string $check Type of check/sanitizing - * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) - * @param mixed $options Options to pass to filter_var when $check is set to 'custom' - * @return string|array Value sanitized (string or array). It may be '' if format check fails. + * @param string|array $out Value to check/clear. + * @param string $check Type of check/sanitizing + * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) + * @param mixed $options Options to pass to filter_var when $check is set to 'custom' + * @return string|array Value sanitized (string or array). It may be '' if format check fails. */ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null) { @@ -6582,16 +6582,18 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes } elseif (in_array($attrs->item($ii)->name, array('style'))) { $valuetoclean = $attrs->item($ii)->value; - do { - $oldvaluetoclean = $valuetoclean; - $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments - $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); - if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. - $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); - } - } while ($oldvaluetoclean != $valuetoclean); + if (isset($valuetoclean)) { + do { + $oldvaluetoclean = $valuetoclean; + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments + $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); + if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. + $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); + } + } while ($oldvaluetoclean != $valuetoclean); + } $attrs->item($ii)->value = $valuetoclean; } @@ -8799,7 +8801,7 @@ function printCommonFooter($zone = 'private') // A div to store page_y POST parameter so we can read it using javascript print "\n\n"; - print ''."\n"; + print ''."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a0c6bcfd054..ea8c6c2ce23 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1393,7 +1393,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $note = $prodser->multilangs[$outputlangs->defaultlang]["other"]; } } - } elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + } elseif (($object->element == 'facture' || $object->element == 'facturefourn') && preg_match('/^\(DEPOSIT\).+/', $desc)) { // We must not replace '(DEPOSIT)' when it is alone, it will be translated and detailed later $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index ea40cb2dd7e..138be225166 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -31,6 +31,8 @@ */ function dolStripPhpCode($str, $replacewith = '') { + $str = str_replace('trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors'); + } if (!$error && empty($user->rights->website->writephp)) { if ($phpfullcodestringold != $phpfullcodestring) { diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php index 0fce5d50587..9e4bbe72c19 100644 --- a/htdocs/core/login/functions_googleoauth.php +++ b/htdocs/core/login/functions_googleoauth.php @@ -50,7 +50,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto // Get identity from user and redirect browser to Google OAuth Server if (GETPOSTISSET('username')) { /*$openid = new SimpleOpenID(); - $openid->SetIdentity($_POST['username']); + $openid->SetIdentity(GETPOST('username')); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); $openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]); $openid->SetRequiredFields(array('email','fullname')); diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 8550440d5d1..23aaf6bcd59 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -72,7 +72,7 @@ class mailing_thirdparties extends MailingTargets $addDescription = ""; // Select the third parties from category - if (empty($_POST['filter'])) { + if (!GETPOST('filter')) { $sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, null as label"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index e5c652d7d51..65a3275dab7 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -413,7 +413,6 @@ if ($action == 'confirm_crop') { $fullpath = $dir."/".$original_file; - //var_dump($fullpath.' '.$_POST['w'].'x'.$_POST['h'].'-'.$_POST['x'].'x'.$_POST['y']);exit; $result = dol_imageResizeOrCrop($fullpath, 1, GETPOST('w', 'int'), GETPOST('h', 'int'), GETPOST('x', 'int'), GETPOST('y', 'int')); if ($result == $fullpath) { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b5656c89339..8afa9a16ff0 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -125,14 +125,19 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $lastseparatorkeyfound = $tmpkeyextra; } else { - print 'attributes[$object->table_element]['label'])) { print ' trextrafields_collapse_last'; } - print '">'; + print '"'; + if (empty($extrafields->expand_display[$collapse_group])) { + print ' style="display: none;"'; + } + print '>'; $extrafields_collapse_num_old = $extrafields_collapse_num; print ''; print ''; diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index e81a4a30af5..5128509c88c 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -78,7 +78,7 @@ if ($action == 'add_payment') { foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num($_POST[$key]); + $amounts[$other_chid] = price2num(GETPOST($key)); } } @@ -110,7 +110,7 @@ if ($action == 'add_payment') { } if (!$error) { - $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', ''); + $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', GETPOST('accountid', 'int'), '', ''); if (!$result > 0) { $errmsg = $payment->error; setEventMessages($errmsg, null, 'errors'); diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index afdee363f24..cda9274e6d6 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -111,7 +111,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $massaction = 'presend_attendees'; } - $receiver = $_POST['receiver']; + $receiver = GETPOST('receiver', 'alphawithlgt'); if (!is_array($receiver)) { if (empty($receiver) || $receiver == '-1') { $receiver = array(); @@ -143,7 +143,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $sendto = $attendees->thirdparty->name . '<' . trim($attendees->email) . '>'; // Define $sendtocc - $receivercc = $_POST['receivercc']; + $receivercc = GETPOST('receivercc', 'alphawithlgt'); if (!is_array($receivercc)) { if ($receivercc == '-1') { $receivercc = array(); @@ -153,7 +153,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { } $tmparray = array(); if (trim($_POST['sendtocc'])) { - $tmparray[] = trim($_POST['sendtocc']); + $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt')); } $sendtocc = implode(',', $tmparray); @@ -177,17 +177,17 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { - $from = $obj->label . ' <' . $obj->email . '>'; + $from = dol_string_nospecial($obj->label, ' ', array(",")) . ' <' . $obj->email . '>'; } } else { - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; + $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")) . ' <' . GETPOST('frommail') . '>'; } $replyto = $from; $subject = GETPOST('subject', 'restricthtml'); $message = GETPOST('message', 'restricthtml'); - $sendtobcc = GETPOST('sendtoccc'); + $sendtobcc = GETPOST('sendtoccc', 'alphawithlgt'); // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object // Make substitution in email content diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f835e293f5f..00693469948 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -304,7 +304,6 @@ if (empty($reshook)) { $qty = "qtyl".$i.'_'.$j; } } else { - //var_dump(GETPOST($qty,'alpha')); var_dump($_POST); var_dump($batch);exit; //shipment line for product with no batch management and no multiple stock location if (GETPOST($qty, 'int') > 0) { $totalqty += price2num(GETPOST($qty, 'alpha'), 'MS'); @@ -473,7 +472,6 @@ if (empty($reshook)) { // } //} } elseif ($action == 'setdate_livraison' && $user->rights->expedition->creer) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index bfa48e9aa0f..2919a42bdb7 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -112,7 +112,6 @@ if (empty($reshook)) { } if ($action == 'setdatedelivery' && $user->rights->commande->creer) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 845b8852cc1..ee80c9bc24a 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -87,8 +87,8 @@ if ($action == 'add_payment') { // Read possible payments foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { - $amounts[$expensereport->fk_user_author] = price2num($_POST[$key]); - $total += price2num($_POST[$key]); + $amounts[$expensereport->fk_user_author] = price2num(GETPOST($key)); + $total += price2num(GETPOST($key)); } } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ae5629b733b..b07d68f8591 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -388,7 +388,7 @@ if ($step == 4 && $action == 'submitFormField') { $_SESSION["export_filtered_fields"] = array(); foreach ($objexport->array_export_TypeFields[0] as $code => $type) { // $code: s.fieldname $value: Text|Boolean|List:ccc $newcode = (string) preg_replace('/\./', '_', $code); - //print 'xxx '.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n
"; + //print 'xxx '.$code."=".$newcode."=".$type."=".GETPOST($newcode)."\n
"; $check = 'alphanohtml'; $filterqualified = 1; if (!GETPOSTISSET($newcode) || GETPOST($newcode, $check) == '') { @@ -1212,7 +1212,7 @@ if ($step == 5 && $datatoexport) { // Show existing generated documents // NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste - print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); + print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (GETPOST('model') ? GETPOST('model') : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); } llxFooter(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a58a62b5ffd..a99a858adaf 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -265,9 +265,9 @@ if (empty($reshook)) { $error++; $action = 'create'; } - $array_options = $extrafields->getOptionalsFromPost($object->table_element); + //$array_options = $extrafields->getOptionalsFromPost($object->table_element); - $object->array_options = $array_options; + //$object->array_options = $array_options; $id = $object->create($user); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 35e5257fce0..c7a937518d7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1707,12 +1707,12 @@ if ($action == 'create') { // Payment term print ''; // Payment mode print ''; // Planned delivery date diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f93e51dc850..ca9bd1b3065 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -305,8 +305,8 @@ if ($action == 'dispatch' && $permissiontoreceive) { $pu = 'pu_'.$reg[1].'_'.$reg[2]; $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4b052981955..d384f3f90d2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -990,7 +990,7 @@ if (empty($reshook)) { if (!$error && GETPOST('origin', 'alpha') && GETPOST('originid')) { // Parse element/subelement (ex: project_task) $element = $subelement = GETPOST('origin', 'alpha'); - /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) + /*if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'),$regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -1954,7 +1954,7 @@ if ($action == 'create') { $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); - $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); $datedue = ($datetmp == '' ?-1 : $datetmp); // Replicate extrafields @@ -1967,7 +1967,7 @@ if ($action == 'create') { $fk_account = $societe->fk_account; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); - $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); $datedue = ($datetmp == '' ?-1 : $datetmp); if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { @@ -2110,7 +2110,7 @@ if ($action == 'create') { } // Ref supplier - print ''; } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 927cc5f36b9..387e3fc39b8 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -46,6 +46,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercardcontact')); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 34255541c01..e08449b376b 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -51,6 +51,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercarddocument')); // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index f17d3c3e127..42031bc7fd9 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -44,6 +44,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercardinfo')); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index d59aefe7831..3b14dfeaf28 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -69,7 +69,7 @@ if (empty($reshook)) { // Set label if ($action == 'setlabel' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - $object->label = $_POST['label']; + $object->label = GETPOST('label'); $result = $object->update($user); if ($result < 0) { dol_print_error($db); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6dc609041c8..4b6e5bf151c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -187,7 +187,7 @@ if (empty($reshook)) { } } - $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => $_POST[$key]); + $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key)); } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { $cursorfacid = substr($key, 21); $multicurrency_amounts[$cursorfacid] = (GETPOST($key) ? price2num(GETPOST($key)) : 0); @@ -219,7 +219,7 @@ if (empty($reshook)) { } // Check parameters - if ($_POST['paiementid'] <= 0) { + if (GETPOST('paiementid') <= 0) { setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('PaymentMode')), null, 'errors'); $error++; } @@ -494,7 +494,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print $form->selectDate($dateinvoice, '', '', '', 0, "addpaiement", 1, 1, 0, '', '', $object->date); print ''; print ''; if (!empty($conf->banque->enabled)) { print ''; } - print ''; + print ''; print ''; print ''; + print ''; print '
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); + $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id'); print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); print '
'.$langs->trans('RefSupplier').''.$langs->trans('RefSupplier').'id > 0) { print ' autofocus'; } @@ -2203,8 +2203,9 @@ if ($action == 'create') { foreach ($facids as $facparam) { $options .= ''; @@ -2446,7 +2447,7 @@ if ($action == 'create') { if (!empty($conf->intracommreport->enabled)) { $langs->loadLangs(array("intracommreport")); print '
'.$langs->trans('IntracommReportTransportMode').''; - $form->selectTransportMode(isset($_POST['transport_mode_id']) ? $_POST['transport_mode_id'] : $transport_mode_id, 'transport_mode_id'); + $form->selectTransportMode(GETPOSTISSET('transport_mode_id') ? GETPOST('transport_mode_id') : $transport_mode_id, 'transport_mode_id'); print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements(empty($_POST['paiementid']) ? $obj->fk_mode_reglement : $_POST['paiementid'], 'paiementid'); + $form->select_types_paiements(!GETPOST('paiementid') ? $obj->fk_mode_reglement : GETPOST('paiementid'), 'paiementid'); print '
'.$langs->trans('Account').''; @@ -504,10 +504,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { print '
 
'.$langs->trans('Numero').'
'.$langs->trans('Numero').'
'.$langs->trans('Comments').''; - print '
'; print dol_get_fiche_end(); @@ -683,10 +683,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); } print ''; - print ''; + print ''; } else { - print ''; - print ''; + print ''; + print ''; } } print ""; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index f8f484f0cc9..1f421230bbb 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -108,9 +108,9 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && } } -if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) { +if ($action == 'setnum_paiement' && GETPOST('num_paiement')) { $object->fetch($id); - $res = $object->update_num($_POST['num_paiement']); + $res = $object->update_num(GETPOST('num_paiement')); if ($res === 0) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); } else { @@ -118,7 +118,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) { } } -if ($action == 'setdatep' && !empty($_POST['datepday'])) { +if ($action == 'setdatep' && GETPOST('datepday')) { $object->fetch($id); $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); $res = $object->update_date($datepaye); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index fb53811aeaf..d8643c0783b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -112,7 +112,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'holiday', $object->id, 'holiday'); +$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut); /* @@ -654,7 +654,7 @@ if (empty($reshook)) { } if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes') { - if (!empty($_POST['detail_refuse'])) { + if (GETPOST('detail_refuse')) { $object->fetch($id); // If status pending validation and validator = user @@ -1414,7 +1414,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { // Confirmation messages if ($action == 'delete') { - if ($user->rights->holiday->delete) { + if ($candelete) { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1); } } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 621443fb408..12a32ba3f50 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -145,7 +145,8 @@ if (empty($reshook)) { } //If the user set a comment, we add it to the log comment - $comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : ''); + $note_holiday = GETPOST('note_holiday'); + $comment = ((isset($note_holiday[$userID]) && !empty($note_holiday[$userID])) ? ' ('.$note_holiday[$userID].')' : ''); //print 'holiday: '.$val['rowid'].'-'.$userValue; if ($userValue != '') { diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 0ce7d793003..1fe67dd0bd1 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -135,14 +135,14 @@ if ($action == 'confirm_delete' && $confirm == "yes") { $result = $object->update($user); if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); } } } else { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } } diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 8aeadeaa18c..7b0b7bcfd7d 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -269,9 +269,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print ''."\n"; // Common attributes diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index d4501c8e685..906eb83b945 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -195,9 +195,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index d36d352e895..19749d94c19 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -915,9 +915,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index a06cf40952a..45e2bfea16a 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -196,9 +196,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index 7e12c501403..5fc00e57f75 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -108,17 +108,17 @@ */ // TCPDF configuration -require_once(dirname(__FILE__).'/tcpdf_autoconfig.php'); +require_once dirname(__FILE__).'/tcpdf_autoconfig.php'; // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_font_data.php'); +require_once dirname(__FILE__).'/include/tcpdf_font_data.php'; // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_fonts.php'); +require_once dirname(__FILE__).'/include/tcpdf_fonts.php'; // TCPDF static color methods and data -require_once(dirname(__FILE__).'/include/tcpdf_colors.php'); +require_once dirname(__FILE__).'/include/tcpdf_colors.php'; // TCPDF static image methods and data -require_once(dirname(__FILE__).'/include/tcpdf_images.php'); +require_once dirname(__FILE__).'/include/tcpdf_images.php'; // TCPDF static methods and data -require_once(dirname(__FILE__).'/include/tcpdf_static.php'); +require_once dirname(__FILE__).'/include/tcpdf_static.php'; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -134,7 +134,8 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * @IgnoreAnnotation("public") * @IgnoreAnnotation("pre") */ -class TCPDF { +class TCPDF +{ // Protected properties @@ -1852,7 +1853,8 @@ class TCPDF { * @public * @see getPageSizeFromFormat(), setPageFormat() */ - public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false) { + public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false) + { /* Set internal character encoding to ASCII */ if (function_exists('mb_internal_encoding') AND mb_internal_encoding()) { $this->internal_encoding = mb_internal_encoding(); @@ -1869,8 +1871,7 @@ class TCPDF { if ($pdfa != false) { $this->pdfa_mode = true; $this->pdfa_version = $pdfa; // 1 or 3 - } else - $this->pdfa_mode = false; + } else $this->pdfa_mode = false; $this->force_srgb = false; // set language direction @@ -2017,7 +2018,8 @@ class TCPDF { * @public * @since 1.53.0.TC016 */ - public function __destruct() { + public function __destruct() + { // cleanup $this->_destroy(true); } @@ -2028,7 +2030,8 @@ class TCPDF { * @public * @since 3.0.015 (2008-06-06) */ - public function setPageUnit($unit) { + public function setPageUnit($unit) + { $unit = strtolower($unit); //Set scale factor switch ($unit) { @@ -2068,59 +2071,60 @@ class TCPDF { /** * Change the format of the current page * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:
    - *
  • ['format'] = page format name (one of the above);
  • - *
  • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • - *
  • ['PZ'] : The page's preferred zoom (magnification) factor.
  • - *
  • ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
  • - *
  • ['MediaBox']['llx'] : lower-left x coordinate
  • - *
  • ['MediaBox']['lly'] : lower-left y coordinate
  • - *
  • ['MediaBox']['urx'] : upper-right x coordinate
  • - *
  • ['MediaBox']['ury'] : upper-right y coordinate
  • - *
  • ['CropBox'] : the visible region of default user space:
  • - *
  • ['CropBox']['llx'] : lower-left x coordinate
  • - *
  • ['CropBox']['lly'] : lower-left y coordinate
  • - *
  • ['CropBox']['urx'] : upper-right x coordinate
  • - *
  • ['CropBox']['ury'] : upper-right y coordinate
  • - *
  • ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
  • - *
  • ['BleedBox']['llx'] : lower-left x coordinate
  • - *
  • ['BleedBox']['lly'] : lower-left y coordinate
  • - *
  • ['BleedBox']['urx'] : upper-right x coordinate
  • - *
  • ['BleedBox']['ury'] : upper-right y coordinate
  • - *
  • ['TrimBox'] : the intended dimensions of the finished page after trimming:
  • - *
  • ['TrimBox']['llx'] : lower-left x coordinate
  • - *
  • ['TrimBox']['lly'] : lower-left y coordinate
  • - *
  • ['TrimBox']['urx'] : upper-right x coordinate
  • - *
  • ['TrimBox']['ury'] : upper-right y coordinate
  • - *
  • ['ArtBox'] : the extent of the page's meaningful content:
  • - *
  • ['ArtBox']['llx'] : lower-left x coordinate
  • - *
  • ['ArtBox']['lly'] : lower-left y coordinate
  • - *
  • ['ArtBox']['urx'] : upper-right x coordinate
  • - *
  • ['ArtBox']['ury'] : upper-right y coordinate
  • - *
  • ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
  • - *
  • ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
  • - *
  • ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
  • - *
  • ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
  • - *
  • ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
  • - *
  • ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
  • - *
  • ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
  • - *
  • ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
  • - *
  • ['trans']['D'] : The duration of the transition effect, in seconds.
  • - *
  • ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
  • - *
  • ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
  • - *
  • ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
  • - *
  • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
  • - *
  • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • - *
+ *
  • ['format'] = page format name (one of the above);
  • + *
  • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • + *
  • ['PZ'] : The page's preferred zoom (magnification) factor.
  • + *
  • ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
  • + *
  • ['MediaBox']['llx'] : lower-left x coordinate
  • + *
  • ['MediaBox']['lly'] : lower-left y coordinate
  • + *
  • ['MediaBox']['urx'] : upper-right x coordinate
  • + *
  • ['MediaBox']['ury'] : upper-right y coordinate
  • + *
  • ['CropBox'] : the visible region of default user space:
  • + *
  • ['CropBox']['llx'] : lower-left x coordinate
  • + *
  • ['CropBox']['lly'] : lower-left y coordinate
  • + *
  • ['CropBox']['urx'] : upper-right x coordinate
  • + *
  • ['CropBox']['ury'] : upper-right y coordinate
  • + *
  • ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
  • + *
  • ['BleedBox']['llx'] : lower-left x coordinate
  • + *
  • ['BleedBox']['lly'] : lower-left y coordinate
  • + *
  • ['BleedBox']['urx'] : upper-right x coordinate
  • + *
  • ['BleedBox']['ury'] : upper-right y coordinate
  • + *
  • ['TrimBox'] : the intended dimensions of the finished page after trimming:
  • + *
  • ['TrimBox']['llx'] : lower-left x coordinate
  • + *
  • ['TrimBox']['lly'] : lower-left y coordinate
  • + *
  • ['TrimBox']['urx'] : upper-right x coordinate
  • + *
  • ['TrimBox']['ury'] : upper-right y coordinate
  • + *
  • ['ArtBox'] : the extent of the page's meaningful content:
  • + *
  • ['ArtBox']['llx'] : lower-left x coordinate
  • + *
  • ['ArtBox']['lly'] : lower-left y coordinate
  • + *
  • ['ArtBox']['urx'] : upper-right x coordinate
  • + *
  • ['ArtBox']['ury'] : upper-right y coordinate
  • + *
  • ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
  • + *
  • ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
  • + *
  • ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
  • + *
  • ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
  • + *
  • ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
  • + *
  • ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
  • + *
  • ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
  • + *
  • ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
  • + *
  • ['trans']['D'] : The duration of the transition effect, in seconds.
  • + *
  • ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
  • + *
  • ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
  • + *
  • ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
  • + *
  • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
  • + *
  • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • + * * @param $orientation (string) page orientation. Possible values are (case insensitive):
      - *
    • P or Portrait (default)
    • - *
    • L or Landscape
    • - *
    • '' (empty string) for automatic orientation
    • - *
    + *
  • P or Portrait (default)
  • + *
  • L or Landscape
  • + *
  • '' (empty string) for automatic orientation
  • + * * @protected * @since 3.0.015 (2008-06-06) * @see getPageSizeFromFormat() */ - protected function setPageFormat($format, $orientation='P') { + protected function setPageFormat($format, $orientation = 'P') + { if (!empty($format) AND isset($this->pagedim[$this->page])) { // remove inherited values unset($this->pagedim[$this->page]); @@ -2234,7 +2238,8 @@ class TCPDF { * @public * @since 3.0.015 (2008-06-06) */ - public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') { + public function setPageOrientation($orientation, $autopagebreak = '', $bottommargin = '') + { if (!isset($this->pagedim[$this->page]['MediaBox'])) { // the boundaries of the physical medium on which the page shall be displayed or printed $this->pagedim = TCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', 0, 0, $this->fwPt, $this->fhPt, true, $this->k, $this->pagedim); @@ -2285,7 +2290,7 @@ class TCPDF { $this->wPt = $this->fwPt; $this->hPt = $this->fhPt; } - if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)){ + if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)) { // swap X and Y coordinates (change page orientation) $this->pagedim = TCPDF_STATIC::swapPageBoxCoordinates($this->page, $this->pagedim); } @@ -2340,7 +2345,8 @@ class TCPDF { * @public * @since 4.6.016 (2009-06-15) */ - public function setSpacesRE($re='/[^\S\xa0]/') { + public function setSpacesRE($re = '/[^\S\xa0]/') + { $this->re_spaces = $re; $re_parts = explode('/', $re); // get pattern parts @@ -2365,7 +2371,8 @@ class TCPDF { * @public * @since 2.0.000 (2008-01-03) */ - public function setRTL($enable, $resetx=true) { + public function setRTL($enable, $resetx = true) + { $enable = $enable ? true : false; $resetx = ($resetx AND ($enable != $this->rtl)); $this->rtl = $enable; @@ -2381,7 +2388,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getRTL() { + public function getRTL() + { return $this->rtl; } @@ -2391,7 +2399,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-09) */ - public function setTempRTL($mode) { + public function setTempRTL($mode) + { $newmode = false; switch (strtoupper($mode)) { case 'LTR': @@ -2423,7 +2432,8 @@ class TCPDF { * @public * @since 4.8.014 (2009-11-04) */ - public function isRTLTextDir() { + public function isRTLTextDir() + { return ($this->rtl OR ($this->tmprtl == 'R')); } @@ -2434,7 +2444,8 @@ class TCPDF { * @public * @since 1.53.0.TC034 */ - public function setLastH($h) { + public function setLastH($h) + { $this->lasth = $h; } @@ -2444,7 +2455,8 @@ class TCPDF { * @param $padding (boolean) If true add cell padding * @public */ - public function getCellHeight($fontsize, $padding=TRUE) { + public function getCellHeight($fontsize, $padding = true) + { $height = ($fontsize * $this->cell_height_ratio); if ($padding) { $height += ($this->cell_padding['T'] + $this->cell_padding['B']); @@ -2457,7 +2469,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-03) */ - public function resetLastH() { + public function resetLastH() + { $this->lasth = $this->getCellHeight($this->FontSize); } @@ -2467,7 +2480,8 @@ class TCPDF { * @public * @since 4.0.017 (2008-08-05) */ - public function getLastH() { + public function getLastH() + { return $this->lasth; } @@ -2478,7 +2492,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function setImageScale($scale) { + public function setImageScale($scale) + { $this->imgscale = $scale; } @@ -2489,7 +2504,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function getImageScale() { + public function getImageScale() + { return $this->imgscale; } @@ -2502,7 +2518,8 @@ class TCPDF { * @public * @since 4.5.027 (2009-03-16) */ - public function getPageDimensions($pagenum='') { + public function getPageDimensions($pagenum = '') + { if (empty($pagenum)) { $pagenum = $this->page; } @@ -2518,7 +2535,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getPageWidth($pagenum='') { + public function getPageWidth($pagenum = '') + { if (empty($pagenum)) { return $this->w; } @@ -2534,7 +2552,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getPageHeight($pagenum='') { + public function getPageHeight($pagenum = '') + { if (empty($pagenum)) { return $this->h; } @@ -2550,7 +2569,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getBreakMargin($pagenum='') { + public function getBreakMargin($pagenum = '') + { if (empty($pagenum)) { return $this->bMargin; } @@ -2564,7 +2584,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function getScaleFactor() { + public function getScaleFactor() + { return $this->k; } @@ -2578,7 +2599,8 @@ class TCPDF { * @since 1.0 * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() */ - public function SetMargins($left, $top, $right=-1, $keepmargins=false) { + public function SetMargins($left, $top, $right = -1, $keepmargins = false) + { //Set left, top and right margins $this->lMargin = $left; $this->tMargin = $top; @@ -2600,7 +2622,8 @@ class TCPDF { * @since 1.4 * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetLeftMargin($margin) { + public function SetLeftMargin($margin) + { //Set left margin $this->lMargin = $margin; if (($this->page > 0) AND ($this->x < $margin)) { @@ -2615,7 +2638,8 @@ class TCPDF { * @since 1.5 * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetTopMargin($margin) { + public function SetTopMargin($margin) + { //Set top margin $this->tMargin = $margin; if (($this->page > 0) AND ($this->y < $margin)) { @@ -2630,7 +2654,8 @@ class TCPDF { * @since 1.5 * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetRightMargin($margin) { + public function SetRightMargin($margin) + { $this->rMargin = $margin; if (($this->page > 0) AND ($this->x > ($this->w - $margin))) { $this->x = $this->w - $margin; @@ -2644,7 +2669,8 @@ class TCPDF { * @since 2.1.000 (2008-01-09) * @see getCellPaddings(), setCellPaddings() */ - public function SetCellPadding($pad) { + public function SetCellPadding($pad) + { if ($pad >= 0) { $this->cell_padding['L'] = $pad; $this->cell_padding['T'] = $pad; @@ -2663,7 +2689,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see getCellPaddings(), SetCellPadding() */ - public function setCellPaddings($left='', $top='', $right='', $bottom='') { + public function setCellPaddings($left = '', $top = '', $right = '', $bottom = '') + { if (($left !== '') AND ($left >= 0)) { $this->cell_padding['L'] = $left; } @@ -2685,7 +2712,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see setCellPaddings(), SetCellPadding() */ - public function getCellPaddings() { + public function getCellPaddings() + { return $this->cell_padding; } @@ -2699,7 +2727,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see getCellMargins() */ - public function setCellMargins($left='', $top='', $right='', $bottom='') { + public function setCellMargins($left = '', $top = '', $right = '', $bottom = '') + { if (($left !== '') AND ($left >= 0)) { $this->cell_margin['L'] = $left; } @@ -2721,7 +2750,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see setCellMargins() */ - public function getCellMargins() { + public function getCellMargins() + { return $this->cell_margin; } @@ -2732,7 +2762,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-03) */ - protected function adjustCellPadding($brd=0) { + protected function adjustCellPadding($brd = 0) + { if (empty($brd)) { return; } @@ -2783,16 +2814,16 @@ class TCPDF { } } // correct internal cell padding if required to avoid overlap between text and lines - if ((strpos($border,'T') !== false) AND ($this->cell_padding['T'] < $adj)) { + if ((strpos($border, 'T') !== false) AND ($this->cell_padding['T'] < $adj)) { $this->cell_padding['T'] = $adj; } - if ((strpos($border,'R') !== false) AND ($this->cell_padding['R'] < $adj)) { + if ((strpos($border, 'R') !== false) AND ($this->cell_padding['R'] < $adj)) { $this->cell_padding['R'] = $adj; } - if ((strpos($border,'B') !== false) AND ($this->cell_padding['B'] < $adj)) { + if ((strpos($border, 'B') !== false) AND ($this->cell_padding['B'] < $adj)) { $this->cell_padding['B'] = $adj; } - if ((strpos($border,'L') !== false) AND ($this->cell_padding['L'] < $adj)) { + if ((strpos($border, 'L') !== false) AND ($this->cell_padding['L'] < $adj)) { $this->cell_padding['L'] = $adj; } } @@ -2807,7 +2838,8 @@ class TCPDF { * @since 1.0 * @see Cell(), MultiCell(), AcceptPageBreak() */ - public function SetAutoPageBreak($auto, $margin=0) { + public function SetAutoPageBreak($auto, $margin = 0) + { $this->AutoPageBreak = $auto ? true : false; $this->bMargin = $margin; $this->PageBreakTrigger = $this->h - $margin; @@ -2819,7 +2851,8 @@ class TCPDF { * @public * @since 5.9.088 */ - public function getAutoPageBreak() { + public function getAutoPageBreak() + { return $this->AutoPageBreak; } @@ -2831,7 +2864,8 @@ class TCPDF { * @public * @since 1.2 */ - public function SetDisplayMode($zoom, $layout='SinglePage', $mode='UseNone') { + public function SetDisplayMode($zoom, $layout = 'SinglePage', $mode = 'UseNone') + { if (($zoom == 'fullpage') OR ($zoom == 'fullwidth') OR ($zoom == 'real') OR ($zoom == 'default') OR (!is_string($zoom))) { $this->ZoomMode = $zoom; } else { @@ -2848,7 +2882,8 @@ class TCPDF { * @public * @since 1.4 */ - public function SetCompression($compress=true) { + public function SetCompression($compress = true) + { $this->compress = false; if (function_exists('gzcompress')) { if ($compress) { @@ -2865,7 +2900,8 @@ class TCPDF { * @public * @since 5.9.121 (2011-09-28) */ - public function setSRGBmode($mode=false) { + public function setSRGBmode($mode = false) + { $this->force_srgb = $mode ? true : false; } @@ -2876,7 +2912,8 @@ class TCPDF { * @since 5.9.027 (2010-12-01) * @public */ - public function SetDocInfoUnicode($unicode=true) { + public function SetDocInfoUnicode($unicode = true) + { $this->docinfounicode = $unicode ? true : false; } @@ -2887,7 +2924,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() */ - public function SetTitle($title) { + public function SetTitle($title) + { $this->title = $title; } @@ -2898,7 +2936,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() */ - public function SetSubject($subject) { + public function SetSubject($subject) + { $this->subject = $subject; } @@ -2909,7 +2948,8 @@ class TCPDF { * @since 1.2 * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetAuthor($author) { + public function SetAuthor($author) + { $this->author = $author; } @@ -2920,7 +2960,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle() */ - public function SetKeywords($keywords) { + public function SetKeywords($keywords) + { $this->keywords = $keywords; } @@ -2931,7 +2972,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetCreator($creator) { + public function SetCreator($creator) + { $this->creator = $creator; } @@ -2941,7 +2983,8 @@ class TCPDF { * @public * @since 1.0 */ - public function Error($msg) { + public function Error($msg) + { // unset all class variables $this->_destroy(true); if (defined('K_TCPDF_THROW_EXCEPTION_ERROR') AND !K_TCPDF_THROW_EXCEPTION_ERROR) { @@ -2959,7 +3002,8 @@ class TCPDF { * @since 1.0 * @see AddPage(), Close() */ - public function Open() { + public function Open() + { $this->state = 1; } @@ -2971,7 +3015,8 @@ class TCPDF { * @since 1.0 * @see Open(), Output() */ - public function Close() { + public function Close() + { if ($this->state == 3) { return; } @@ -3015,7 +3060,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see getPage(), lastpage(), getNumPages() */ - public function setPage($pnum, $resetmargins=false) { + public function setPage($pnum, $resetmargins = false) + { if (($pnum == $this->page) AND ($this->state == 2)) { return; } @@ -3062,7 +3108,8 @@ class TCPDF { * @since 2.0.000 (2008-01-04) * @see setPage(), getPage(), getNumPages() */ - public function lastPage($resetmargins=false) { + public function lastPage($resetmargins = false) + { $this->setPage($this->getNumPages(), $resetmargins); } @@ -3073,7 +3120,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see setPage(), lastpage(), getNumPages() */ - public function getPage() { + public function getPage() + { return $this->page; } @@ -3084,7 +3132,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see setPage(), getPage(), lastpage() */ - public function getNumPages() { + public function getNumPages() + { return $this->numpages; } @@ -3097,7 +3146,8 @@ class TCPDF { * @since 5.0.001 (2010-05-06) * @see AddPage(), startPage(), endPage(), endTOCPage() */ - public function addTOCPage($orientation='', $format='', $keepmargins=false) { + public function addTOCPage($orientation = '', $format = '', $keepmargins = false) + { $this->AddPage($orientation, $format, $keepmargins, true); } @@ -3107,7 +3157,8 @@ class TCPDF { * @since 5.0.001 (2010-05-06) * @see AddPage(), startPage(), endPage(), addTOCPage() */ - public function endTOCPage() { + public function endTOCPage() + { $this->endPage(true); } @@ -3122,7 +3173,8 @@ class TCPDF { * @since 1.0 * @see startPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() */ - public function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) { + public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) + { if ($this->inxobj) { // we are inside an XObject template return; @@ -3146,7 +3198,8 @@ class TCPDF { * @since 4.2.010 (2008-11-14) * @see AddPage(), startPage(), addTOCPage(), endTOCPage() */ - public function endPage($tocpage=false) { + public function endPage($tocpage = false) + { // check if page is already closed if (($this->page == 0) OR ($this->numpages > $this->page) OR (!$this->pageopen[$this->page])) { return; @@ -3172,7 +3225,8 @@ class TCPDF { * @see AddPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() * @public */ - public function startPage($orientation='', $format='', $tocpage=false) { + public function startPage($orientation = '', $format = '', $tocpage = false) + { if ($tocpage) { $this->tocpage = true; } @@ -3243,7 +3297,8 @@ class TCPDF { * @public * @since 4.0.016 (2008-07-30) */ - public function setPageMark() { + public function setPageMark() + { $this->intmrk[$this->page] = $this->pagelen[$this->page]; $this->bordermrk[$this->page] = $this->intmrk[$this->page]; $this->setContentMark(); @@ -3256,7 +3311,8 @@ class TCPDF { * @protected * @since 4.6.021 (2009-07-20) */ - protected function setContentMark($page=0) { + protected function setContentMark($page = 0) + { if ($page <= 0) { $page = $this->page; } @@ -3277,7 +3333,8 @@ class TCPDF { * @param $lc (array) RGB array color for line. * @public */ - public function setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0,0,0), $lc=array(0,0,0)) { + public function setHeaderData($ln = '', $lw = 0, $ht = '', $hs = '', $tc = array(0,0,0), $lc = array(0,0,0)) + { $this->header_logo = $ln; $this->header_logo_width = $lw; $this->header_title = $ht; @@ -3292,7 +3349,8 @@ class TCPDF { * @param $lc (array) RGB array color for line. * @public */ - public function setFooterData($tc=array(0,0,0), $lc=array(0,0,0)) { + public function setFooterData($tc = array(0,0,0), $lc = array(0,0,0)) + { $this->footer_text_color = $tc; $this->footer_line_color = $lc; } @@ -3304,7 +3362,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getHeaderData() { + public function getHeaderData() + { $ret = array(); $ret['logo'] = $this->header_logo; $ret['logo_width'] = $this->header_logo_width; @@ -3321,7 +3380,8 @@ class TCPDF { * @param $hm (int) distance in user units * @public */ - public function setHeaderMargin($hm=10) { + public function setHeaderMargin($hm = 10) + { $this->header_margin = $hm; } @@ -3331,7 +3391,8 @@ class TCPDF { * @since 4.0.012 (2008-07-24) * @public */ - public function getHeaderMargin() { + public function getHeaderMargin() + { return $this->header_margin; } @@ -3341,7 +3402,8 @@ class TCPDF { * @param $fm (int) distance in user units * @public */ - public function setFooterMargin($fm=10) { + public function setFooterMargin($fm = 10) + { $this->footer_margin = $fm; } @@ -3351,7 +3413,8 @@ class TCPDF { * @since 4.0.012 (2008-07-24) * @public */ - public function getFooterMargin() { + public function getFooterMargin() + { return $this->footer_margin; } /** @@ -3359,7 +3422,8 @@ class TCPDF { * @param $val (boolean) set to true to print the page header (default), false otherwise. * @public */ - public function setPrintHeader($val=true) { + public function setPrintHeader($val = true) + { $this->print_header = $val ? true : false; } @@ -3368,7 +3432,8 @@ class TCPDF { * @param $val (boolean) set to true to print the page footer (default), false otherwise. * @public */ - public function setPrintFooter($val=true) { + public function setPrintFooter($val = true) + { $this->print_footer = $val ? true : false; } @@ -3377,7 +3442,8 @@ class TCPDF { * @return float * @public */ - public function getImageRBX() { + public function getImageRBX() + { return $this->img_rb_x; } @@ -3386,7 +3452,8 @@ class TCPDF { * @return float * @public */ - public function getImageRBY() { + public function getImageRBY() + { return $this->img_rb_y; } @@ -3394,7 +3461,8 @@ class TCPDF { * Reset the xobject template used by Header() method. * @public */ - public function resetHeaderTemplate() { + public function resetHeaderTemplate() + { $this->header_xobjid = false; } @@ -3403,7 +3471,8 @@ class TCPDF { * @param $val (boolean) set to true to reset Header xobject template at each page, false otherwise. * @public */ - public function setHeaderTemplateAutoreset($val=true) { + public function setHeaderTemplateAutoreset($val = true) + { $this->header_xobj_autoreset = $val ? true : false; } @@ -3412,7 +3481,8 @@ class TCPDF { * It is automatically called by AddPage() and could be overwritten in your own inherited class. * @public */ - public function Header() { + public function Header() + { if ($this->header_xobjid === false) { // start a new XObject Template $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin); @@ -3489,7 +3559,8 @@ class TCPDF { * It is automatically called by AddPage() and could be overwritten in your own inherited class. * @public */ - public function Footer() { + public function Footer() + { $cur_y = $this->y; $this->SetTextColorArray($this->footer_text_color); //set style for cell border @@ -3536,7 +3607,8 @@ class TCPDF { * @protected * @since 4.0.012 (2008-07-24) */ - protected function setHeader() { + protected function setHeader() + { if (!$this->print_header OR ($this->state != 2)) { return; } @@ -3577,7 +3649,8 @@ class TCPDF { * @protected * @since 4.0.012 (2008-07-24) */ - protected function setFooter() { + protected function setFooter() + { if ($this->state != 2) { return; } @@ -3633,7 +3706,8 @@ class TCPDF { * @protected * @since 5.9.091 (2011-06-15) */ - protected function inPageBody() { + protected function inPageBody() + { return (($this->InHeader === false) AND ($this->InFooter === false)); } @@ -3642,7 +3716,8 @@ class TCPDF { * @protected * @since 4.5.030 (2009-03-25) */ - protected function setTableHeader() { + protected function setTableHeader() + { if ($this->num_columns > 1) { // multi column mode return; @@ -3709,7 +3784,8 @@ class TCPDF { * @since 1.0 * @see getAliasNbPages() */ - public function PageNo() { + public function PageNo() + { return $this->page; } @@ -3719,7 +3795,8 @@ class TCPDF { * @public * @since 6.0.038 (2013-09-30) */ - public function getAllSpotColors() { + public function getAllSpotColors() + { return $this->spot_colors; } @@ -3736,7 +3813,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see SetDrawSpotColor(), SetFillSpotColor(), SetTextSpotColor() */ - public function AddSpotColor($name, $c, $m, $y, $k) { + public function AddSpotColor($name, $c, $m, $y, $k) + { if (!isset($this->spot_colors[$name])) { $i = (1 + count($this->spot_colors)); $this->spot_colors[$name] = array('C' => $c, 'M' => $m, 'Y' => $y, 'K' => $k, 'name' => $name, 'i' => $i); @@ -3752,7 +3830,8 @@ class TCPDF { * @public * @since 5.9.125 (2011-10-03) */ - public function setSpotColor($type, $name, $tint=100) { + public function setSpotColor($type, $name, $tint = 100) + { $spotcolor = TCPDF_COLORS::getSpotColor($name, $this->spot_colors); if ($spotcolor === false) { $this->Error('Undefined spot color: '.$name.', you must add it using the AddSpotColor() method.'); @@ -3798,7 +3877,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetFillSpotColor(), SetTextSpotColor() */ - public function SetDrawSpotColor($name, $tint=100) { + public function SetDrawSpotColor($name, $tint = 100) + { $this->setSpotColor('draw', $name, $tint); } @@ -3810,7 +3890,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetTextSpotColor() */ - public function SetFillSpotColor($name, $tint=100) { + public function SetFillSpotColor($name, $tint = 100) + { $this->setSpotColor('fill', $name, $tint); } @@ -3822,7 +3903,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetFillSpotColor() */ - public function SetTextSpotColor($name, $tint=100) { + public function SetTextSpotColor($name, $tint = 100) + { $this->setSpotColor('text', $name, $tint); } @@ -3837,7 +3919,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-11) */ - public function setColorArray($type, $color, $ret=false) { + public function setColorArray($type, $color, $ret = false) + { if (is_array($color)) { $color = array_values($color); // component: grey, RGB red or CMYK cyan @@ -3868,7 +3951,8 @@ class TCPDF { * @since 3.1.000 (2008-06-11) * @see SetDrawColor() */ - public function SetDrawColorArray($color, $ret=false) { + public function SetDrawColorArray($color, $ret = false) + { return $this->setColorArray('draw', $color, $ret); } @@ -3882,7 +3966,8 @@ class TCPDF { * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetFillColorArray($color, $ret=false) { + public function SetFillColorArray($color, $ret = false) + { return $this->setColorArray('fill', $color, $ret); } @@ -3895,7 +3980,8 @@ class TCPDF { * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetTextColorArray($color, $ret=false) { + public function SetTextColorArray($color, $ret = false) + { return $this->setColorArray('text', $color, $ret); } @@ -3912,7 +3998,8 @@ class TCPDF { * @public * @since 5.9.125 (2011-10-03) */ - public function setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function setColor($type, $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { // set default values if (!is_numeric($col1)) { $col1 = 0; @@ -4002,7 +4089,8 @@ class TCPDF { * @since 1.3 * @see SetDrawColorArray(), SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() */ - public function SetDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetDrawColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('draw', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4019,7 +4107,8 @@ class TCPDF { * @since 1.3 * @see SetFillColorArray(), SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() */ - public function SetFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetFillColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('fill', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4036,7 +4125,8 @@ class TCPDF { * @since 1.3 * @see SetTextColorArray(), SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() */ - public function SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetTextColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('text', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4052,7 +4142,8 @@ class TCPDF { * @public * @since 1.2 */ - public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) { + public function GetStringWidth($s, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false) + { return $this->GetArrStringWidth(TCPDF_FONTS::utf8Bidi(TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont), $s, $this->tmprtl, $this->isunicode, $this->CurrentFont), $fontname, $fontstyle, $fontsize, $getarray); } @@ -4068,7 +4159,8 @@ class TCPDF { * @public * @since 2.4.000 (2008-03-06) */ - public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) { + public function GetArrStringWidth($sa, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false) + { // store current values if (!TCPDF_STATIC::empty_string($fontname)) { $prev_FontFamily = $this->FontFamily; @@ -4107,7 +4199,8 @@ class TCPDF { * @public * @since 2.4.000 (2008-03-06) */ - public function GetCharWidth($char, $notlast=true) { + public function GetCharWidth($char, $notlast = true) + { // get raw width $chw = $this->getRawCharWidth($char); if (($this->font_spacing < 0) OR (($this->font_spacing > 0) AND $notlast)) { @@ -4129,7 +4222,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-09-28) */ - public function getRawCharWidth($char) { + public function getRawCharWidth($char) + { if ($char == 173) { // SHY character will not be printed return (0); @@ -4155,7 +4249,8 @@ class TCPDF { * @public * @since 2.0.0001 (2008-01-07) */ - public function GetNumChars($s) { + public function GetNumChars($s) + { if ($this->isUnicodeFont()) { return count(TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont)); } @@ -4167,7 +4262,8 @@ class TCPDF { * @protected * @since 4.0.013 (2008-07-28) */ - protected function getFontsList() { + protected function getFontsList() + { if (($fontsdir = opendir(TCPDF_FONTS::_getfontpath())) !== false) { while (($file = readdir($fontsdir)) !== false) { if (substr($file, -4) == '.php') { @@ -4191,7 +4287,8 @@ class TCPDF { * @since 1.5 * @see SetFont(), setFontSubsetting() */ - public function AddFont($family, $style='', $fontfile='', $subset='default') { + public function AddFont($family, $style = '', $fontfile = '', $subset = 'default') + { if ($subset === 'default') { $subset = $this->font_subsetting; } @@ -4293,7 +4390,7 @@ class TCPDF { } // include font file if (!TCPDF_STATIC::empty_string($fontfile) AND (@TCPDF_STATIC::file_exists($fontfile))) { - include($fontfile); + include $fontfile; } else { $this->Error('Could not include font definition file: '.$family.''); } @@ -4414,7 +4511,7 @@ class TCPDF { } if (!TCPDF_STATIC::empty_string($file)) { if (!isset($this->FontFiles[$file])) { - if ((strcasecmp($type,'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) { + if ((strcasecmp($type, 'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) { $this->FontFiles[$file] = array('length1' => $originalsize, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey)); } elseif ($type != 'core') { $this->FontFiles[$file] = array('length1' => $size1, 'length2' => $size2, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey)); @@ -4447,7 +4544,8 @@ class TCPDF { * @since 1.0 * @see AddFont(), SetFontSize() */ - public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { + public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true) + { //Select a font; size given in points if ($size === null) { $size = $this->FontSizePt; @@ -4475,8 +4573,9 @@ class TCPDF { * @since 1.0 * @see SetFont() */ - public function SetFontSize($size, $out=true) { - $size = (float)$size; + public function SetFontSize($size, $out = true) + { + $size = (float) $size; // font size in points $this->FontSizePt = $size; // font size in user units @@ -4516,7 +4615,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getFontBBox() { + public function getFontBBox() + { $fbbox = array(); if (isset($this->CurrentFont['desc']['FontBBox'])) { $tmpbbox = explode(' ', substr($this->CurrentFont['desc']['FontBBox'], 1, -1)); @@ -4555,7 +4655,8 @@ class TCPDF { * @return float Absolute measure. * @since 5.9.186 (2012-09-13) */ - public function getAbsFontMeasure($s) { + public function getAbsFontMeasure($s) + { return ($s * $this->FontSize / 1000); } @@ -4565,7 +4666,8 @@ class TCPDF { * @return mixed array(xMin, yMin, xMax, yMax) or FALSE if not defined. * @since 5.9.186 (2012-09-13) */ - public function getCharBBox($char) { + public function getCharBBox($char) + { $c = intval($char); if (isset($this->CurrentFont['cw'][$c])) { // glyph is defined ... use zero width & height for glyphs without outlines @@ -4588,7 +4690,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.9.003 (2010-03-30) */ - public function getFontDescent($font, $style='', $size=0) { + public function getFontDescent($font, $style = '', $size = 0) + { $fontdata = $this->AddFont($font, $style); $fontinfo = $this->getFontBuffer($fontdata['fontkey']); if (isset($fontinfo['desc']['Descent']) AND ($fontinfo['desc']['Descent'] <= 0)) { @@ -4609,7 +4712,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.9.003 (2010-03-30) */ - public function getFontAscent($font, $style='', $size=0) { + public function getFontAscent($font, $style = '', $size = 0) + { $fontdata = $this->AddFont($font, $style); $fontinfo = $this->getFontBuffer($fontdata['fontkey']); if (isset($fontinfo['desc']['Ascent']) AND ($fontinfo['desc']['Ascent'] > 0)) { @@ -4629,7 +4733,8 @@ class TCPDF { * @public * @since 5.9.153 (2012-03-28) */ - public function isCharDefined($char, $font='', $style='') { + public function isCharDefined($char, $font = '', $style = '') + { if (is_string($char)) { // get character code $char = TCPDF_FONTS::UTF8StringToArray($char, $this->isunicode, $this->CurrentFont); @@ -4656,7 +4761,8 @@ class TCPDF { * @public * @since 5.9.153 (2012-03-28) */ - public function replaceMissingChars($text, $font='', $style='', $subs=array()) { + public function replaceMissingChars($text, $font = '', $style = '', $subs = array()) + { if (empty($subs)) { return $text; } @@ -4672,7 +4778,7 @@ class TCPDF { if (isset($subs[$chr])) { // we have available substitutions if (is_array($subs[$chr])) { - foreach($subs[$chr] as $s) { + foreach ($subs[$chr] as $s) { if (isset($fontinfo['cw'][$s])) { $uniarr[$k] = $s; break; @@ -4693,7 +4799,8 @@ class TCPDF { * @public * @since 4.5.025 */ - public function SetDefaultMonospacedFont($font) { + public function SetDefaultMonospacedFont($font) + { $this->default_monospaced_font = $font; } @@ -4704,7 +4811,8 @@ class TCPDF { * @since 1.5 * @see Cell(), Write(), Image(), Link(), SetLink() */ - public function AddLink() { + public function AddLink() + { // create a new internal link $n = count($this->links) + 1; $this->links[$n] = array('p' => 0, 'y' => 0, 'f' => false); @@ -4720,7 +4828,8 @@ class TCPDF { * @since 1.5 * @see AddLink() */ - public function SetLink($link, $y=0, $page=-1) { + public function SetLink($link, $y = 0, $page = -1) + { $fixed = false; if (!empty($page) AND ($page[0] == '*')) { $page = intval(substr($page, 1)); @@ -4749,7 +4858,8 @@ class TCPDF { * @since 1.5 * @see AddLink(), Annotation(), Cell(), Write(), Image() */ - public function Link($x, $y, $w, $h, $link, $spaces=0) { + public function Link($x, $y, $w, $h, $link, $spaces = 0) + { $this->Annotation($x, $y, $w, $h, $link, array('Subtype'=>'Link'), $spaces); } @@ -4766,7 +4876,8 @@ class TCPDF { * @public * @since 4.0.018 (2008-08-06) */ - public function Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), $spaces=0) { + public function Annotation($x, $y, $w, $h, $text, $opt = array('Subtype'=>'Text'), $spaces = 0) + { if ($this->inxobj) { // store parameters for later use on template $this->xobjects[$this->xobjid]['annotations'][] = array('x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'text' => $text, 'opt' => $opt, 'spaces' => $spaces); @@ -4856,15 +4967,16 @@ class TCPDF { * @protected * @see Annotation() */ - protected function _putEmbeddedFiles() { - if ($this->pdfa_mode && $this->pdfa_version != 3) { + protected function _putEmbeddedFiles() + { + if ($this->pdfa_mode && $this->pdfa_version != 3) { // embedded files are not allowed in PDF/A mode version 1 and 2 return; } reset($this->embeddedfiles); foreach ($this->embeddedfiles as $filename => $filedata) { $data = TCPDF_STATIC::fileGetContents($filedata['file']); - if ($data !== FALSE) { + if ($data !== false) { $rawsize = strlen($data); if ($rawsize > 0) { // update name tree @@ -4922,7 +5034,8 @@ class TCPDF { * @since 1.0 * @see Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell() */ - public function Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false) { + public function Text($x, $y, $txt, $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false) + { $textrendermode = $this->textrendermode; $textstrokewidth = $this->textstrokewidth; $this->setTextRenderingMode($fstroke, $ffill, $fclip); @@ -4942,7 +5055,8 @@ class TCPDF { * @since 1.4 * @see SetAutoPageBreak() */ - public function AcceptPageBreak() { + public function AcceptPageBreak() + { if ($this->num_columns > 1) { // multi column mode if ($this->current_column < ($this->num_columns - 1)) { @@ -4969,7 +5083,8 @@ class TCPDF { * @since 3.2.000 (2008-07-01) * @protected */ - protected function checkPageBreak($h=0, $y='', $addpage=true) { + protected function checkPageBreak($h = 0, $y = '', $addpage = true) + { if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } @@ -5023,7 +5138,8 @@ class TCPDF { * @since 1.0 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() */ - public function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') { + public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M') + { $prev_cell_margin = $this->cell_margin; $prev_cell_padding = $this->cell_padding; $this->adjustCellPadding($border); @@ -5092,7 +5208,8 @@ class TCPDF { * @since 1.0 * @see Cell() */ - protected function getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') { + protected function getCellCode($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M') + { // replace 'NO-BREAK SPACE' (U+00A0) character with a simple space $txt = str_replace(TCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt); $prev_cell_margin = $this->cell_margin; @@ -5560,7 +5677,8 @@ class TCPDF { * @protected * @since 5.9.167 (2012-06-22) */ - protected function replaceChar($oldchar, $newchar) { + protected function replaceChar($oldchar, $newchar) + { if ($this->isCharDefined($newchar)) { // add the new char on the subset list $this->CurrentFont['subsetchars'][$newchar] = true; @@ -5583,7 +5701,8 @@ class TCPDF { * @see SetLineStyle() * @since 5.7.000 (2010-08-02) */ - protected function getCellBorder($x, $y, $w, $h, $brd) { + protected function getCellBorder($x, $y, $w, $h, $brd) + { $s = ''; // string to be returned if (empty($brd)) { return $s; @@ -5673,25 +5792,25 @@ class TCPDF { if (strlen($border) == 4) { $s .= sprintf('%F %F %F %F re S ', $xT, $yT, ($w * $k), (-$h * $k)); } elseif (strlen($border) == 3) { - if (strpos($border,'B') === false) { // LTR + if (strpos($border, 'B') === false) { // LTR $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif (strpos($border,'L') === false) { // TRB + } elseif (strpos($border, 'L') === false) { // TRB $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; - } elseif (strpos($border,'T') === false) { // RBL + } elseif (strpos($border, 'T') === false) { // RBL $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif (strpos($border,'R') === false) { // BLT + } elseif (strpos($border, 'R') === false) { // BLT $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); @@ -5699,34 +5818,34 @@ class TCPDF { $s .= 'S '; } } elseif (strlen($border) == 2) { - if ((strpos($border,'L') !== false) AND (strpos($border,'T') !== false)) { // LT + if ((strpos($border, 'L') !== false) AND (strpos($border, 'T') !== false)) { // LT $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - } elseif ((strpos($border,'T') !== false) AND (strpos($border,'R') !== false)) { // TR + } elseif ((strpos($border, 'T') !== false) AND (strpos($border, 'R') !== false)) { // TR $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif ((strpos($border,'R') !== false) AND (strpos($border,'B') !== false)) { // RB + } elseif ((strpos($border, 'R') !== false) AND (strpos($border, 'B') !== false)) { // RB $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; - } elseif ((strpos($border,'B') !== false) AND (strpos($border,'L') !== false)) { // BL + } elseif ((strpos($border, 'B') !== false) AND (strpos($border, 'L') !== false)) { // BL $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif ((strpos($border,'L') !== false) AND (strpos($border,'R') !== false)) { // LR + } elseif ((strpos($border, 'L') !== false) AND (strpos($border, 'R') !== false)) { // LR $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif ((strpos($border,'T') !== false) AND (strpos($border,'B') !== false)) { // TB + } elseif ((strpos($border, 'T') !== false) AND (strpos($border, 'B') !== false)) { // TB $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; @@ -5735,19 +5854,19 @@ class TCPDF { $s .= 'S '; } } else { // strlen($border) == 1 - if (strpos($border,'L') !== false) { // L + if (strpos($border, 'L') !== false) { // L $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif (strpos($border,'T') !== false) { // T + } elseif (strpos($border, 'T') !== false) { // T $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - } elseif (strpos($border,'R') !== false) { // R + } elseif (strpos($border, 'R') !== false) { // R $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif (strpos($border,'B') !== false) { // B + } elseif (strpos($border, 'B') !== false) { // B $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; @@ -5786,7 +5905,8 @@ class TCPDF { * @since 1.3 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() */ - public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { + public function MultiCell($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $ln = 1, $x = '', $y = '', $reseth = true, $stretch = 0, $ishtml = false, $autopadding = true, $maxh = 0, $valign = 'T', $fitcell = false) + { $prev_cell_margin = $this->cell_margin; $prev_cell_padding = $this->cell_padding; // adjust internal padding @@ -6154,8 +6274,9 @@ class TCPDF { * @public * @since 4.5.011 */ - public function getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { - if ($txt === NULL) { + public function getNumLines($txt, $w = 0, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0) + { + if ($txt === null) { return 0; } if ($txt === '') { @@ -6273,7 +6394,8 @@ class TCPDF { * @author Nicola Asuni, Alexander Escalona Fern\E1ndez * @public */ - public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { + public function getStringHeight($w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0) + { // adjust internal padding $prev_cell_padding = $this->cell_padding; $prev_lasth = $this->lasth; @@ -6306,7 +6428,8 @@ class TCPDF { * @public * @since 1.5 */ - public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin='') { + public function Write($h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0, $wadj = 0, $margin = '') + { // check page for no-write regions and adapt page margins if necessary list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y); if (strlen($txt) == 0) { @@ -6737,7 +6860,8 @@ class TCPDF { * @return int Return the remaining width * @protected */ - protected function getRemainingWidth() { + protected function getRemainingWidth() + { list($this->x, $this->y) = $this->checkPageRegions(0, $this->x, $this->y); if ($this->rtl) { return ($this->x - $this->lMargin); @@ -6757,7 +6881,8 @@ class TCPDF { * @protected * @since 5.5.009 (2010-07-05) */ - protected function fitBlock($w, $h, $x, $y, $fitonpage=false) { + protected function fitBlock($w, $h, $x, $y, $fitonpage = false) + { if ($w <= 0) { // set maximum width $w = ($this->w - $this->lMargin - $this->rMargin); @@ -6852,7 +6977,8 @@ class TCPDF { * @public * @since 1.1 */ - public function 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, $alt=false, $altimgs=array()) { + public function 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, $alt = false, $altimgs = array()) + { if ($this->state != 2) { return; } @@ -6865,7 +6991,7 @@ class TCPDF { // check page for no-write regions and adapt page margins if necessary list($x, $y) = $this->checkPageRegions($h, $x, $y); $exurl = ''; // external streams - $imsize = FALSE; + $imsize = false; // check if we are passing an image as file or string if ($file[0] === '@') { // image from string @@ -6881,13 +7007,18 @@ class TCPDF { // DOL CHANGE If we keep this, the image is not visible on pages after the first one. //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); //return false; + // try to encode spaces on filename + $tfile = str_replace(' ', '%20', $file); + if (@TCPDF_STATIC::file_exists($tfile)) { + $file = $tfile; + } } - if (($imsize = @getimagesize($file)) === FALSE) { + if (($imsize = @getimagesize($file)) === false) { if (in_array($file, $this->imagekeys)) { // get existing image data $info = $this->getImageBuffer($file); $imsize = array($info['w'], $info['h']); - } elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) { + } elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === false) { $imgdata = TCPDF_STATIC::fileGetContents($file); } } @@ -6904,12 +7035,12 @@ class TCPDF { fclose($fp); unset($imgdata); $imsize = @getimagesize($file); - if ($imsize === FALSE) { + if ($imsize === false) { unlink($file); $file = $original_file; } } - if ($imsize === FALSE) { + if ($imsize === false) { if (($w > 0) AND ($h > 0)) { // get measures from specified data $pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k; @@ -7010,14 +7141,14 @@ class TCPDF { $newimage = false; // get existing image data $info = $this->getImageBuffer($file); - if (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE) { + if (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false) { // check if the newer image is larger $oldsize = ($info['w'] * $info['h']); if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) { $newimage = true; } } - } elseif (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE)) { + } elseif (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false)) { // create temp image file (without alpha channel) $tempfile_plain = K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_imgmask_plain_'.$filehash; // create temp alpha file @@ -7057,7 +7188,7 @@ class TCPDF { if ((method_exists('TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded('imagick'))))) { // TCPDF image functions $info = TCPDF_IMAGES::$mtd($file); - if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE) + if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false) AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) { return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash); } @@ -7081,7 +7212,7 @@ class TCPDF { $info = TCPDF_IMAGES::_toJPEG($img, $this->jpeg_quality, TCPDF_STATIC::getObjFilename('img', $this->file_id)); } } - } catch(Exception $e) { + } catch (Exception $e) { $info = false; } } @@ -7097,7 +7228,7 @@ class TCPDF { // get SVG file content $svgimg = TCPDF_STATIC::fileGetContents($file); } - if ($svgimg !== FALSE) { + if ($svgimg !== false) { // get width and height $regs = array(); if (preg_match('/]*)>/si', $svgimg, $regs)) { @@ -7142,7 +7273,7 @@ class TCPDF { $info = TCPDF_IMAGES::_parsejpeg($tempname); unlink($tempname); $img->destroy(); - } catch(Exception $e) { + } catch (Exception $e) { $info = false; } } @@ -7217,7 +7348,7 @@ class TCPDF { $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T': { $this->y = $y; $this->x = $this->img_rb_x; @@ -7270,7 +7401,8 @@ class TCPDF { * @since 4.3.007 (2008-12-04) * @see Image() */ - protected function ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash='') { + protected function ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash = '') + { // create temp images if (empty($filehash)) { $filehash = md5($file); @@ -7364,7 +7496,8 @@ class TCPDF { * @protected * @since 4.3.007 (2008-12-04) */ - protected function getGDgamma($img, $c) { + protected function getGDgamma($img, $c) + { if (!isset($this->gdgammacache['#'.$c])) { $colors = imagecolorsforindex($img, $c); // GD alpha is only 7 bit (0 -> 127) @@ -7389,7 +7522,8 @@ class TCPDF { * @since 1.0 * @see Cell() */ - public function Ln($h='', $cell=false) { + public function Ln($h = '', $cell = false) + { if (($this->num_columns > 1) AND ($this->y == $this->columns[$this->current_column]['y']) AND isset($this->columns[$this->current_column]['x']) AND ($this->x == $this->columns[$this->current_column]['x'])) { // revove vertical space from the top of the column return; @@ -7423,7 +7557,8 @@ class TCPDF { * @since 1.2 * @see SetX(), GetY(), SetY() */ - public function GetX() { + public function GetX() + { //Get x position if ($this->rtl) { return ($this->w - $this->x); @@ -7439,7 +7574,8 @@ class TCPDF { * @since 1.2 * @see SetX(), GetY(), SetY() */ - public function GetAbsX() { + public function GetAbsX() + { return $this->x; } @@ -7450,7 +7586,8 @@ class TCPDF { * @since 1.0 * @see SetY(), GetX(), SetX() */ - public function GetY() { + public function GetY() + { return $this->y; } @@ -7463,7 +7600,8 @@ class TCPDF { * @since 1.2 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetX($x, $rtloff=false) { + public function SetX($x, $rtloff = false) + { $x = floatval($x); if (!$rtloff AND $this->rtl) { if ($x >= 0) { @@ -7496,7 +7634,8 @@ class TCPDF { * @since 1.0 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetY($y, $resetx=true, $rtloff=false) { + public function SetY($y, $resetx = true, $rtloff = false) + { $y = floatval($y); if ($resetx) { //reset x @@ -7529,7 +7668,8 @@ class TCPDF { * @since 1.2 * @see SetX(), SetY() */ - public function SetXY($x, $y, $rtloff=false) { + public function SetXY($x, $y, $rtloff = false) + { $this->SetY($y, false, $rtloff); $this->SetX($x, $rtloff); } @@ -7541,7 +7681,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsX($x) { + public function SetAbsX($x) + { $this->x = floatval($x); } @@ -7552,7 +7693,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsY($y) { + public function SetAbsY($y) + { $this->y = floatval($y); } @@ -7564,7 +7706,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsXY($x, $y) { + public function SetAbsXY($x, $y) + { $this->SetAbsX($x); $this->SetAbsY($y); } @@ -7580,7 +7723,8 @@ class TCPDF { * @since 1.0 * @see Close() */ - public function Output($name='doc.pdf', $dest='I') { + public function Output($name = 'doc.pdf', $dest = 'I') + { //Output PDF to some destination //Finish document if necessary if ($this->state < 3) { @@ -7648,7 +7792,7 @@ class TCPDF { $this->buffer = substr($pdfdoc, 0, $byte_range[1]).'<'.$signature.'>'.substr($pdfdoc, $byte_range[1]); $this->bufferlen = strlen($this->buffer); } - switch($dest) { + switch ($dest) { case 'I': { // Send PDF to the standard output if (ob_get_contents()) { @@ -7779,7 +7923,8 @@ class TCPDF { * @public * @since 4.5.016 (2009-02-24) */ - public function _destroy($destroyall=false, $preserve_objcopy=false) { + public function _destroy($destroyall = false, $preserve_objcopy = false) + { // restore internal encoding if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { mb_internal_encoding($this->internal_encoding); @@ -7791,7 +7936,7 @@ class TCPDF { self::$cleaned_ids[$this->file_id] = true; // remove all temporary files if ($handle = opendir(K_PATH_CACHE)) { - while ( false !== ( $file_name = readdir( $handle ) ) ) { + while ( false !== ( $file_name = readdir($handle) ) ) { if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) { unlink(K_PATH_CACHE.$file_name); } @@ -7799,9 +7944,9 @@ class TCPDF { closedir($handle); } if (isset($this->imagekeys)) { - foreach($this->imagekeys as $file) { -// @CHANGE DOL -// unlink($file); + foreach ($this->imagekeys as $file) { + // @CHANGE DOL + // unlink($file); } } } @@ -7812,8 +7957,8 @@ class TCPDF { 'bufferlen', 'buffer', 'cached_files', -// @CHANGE DOL -// 'imagekeys', + // @CHANGE DOL + // 'imagekeys', 'sign', 'signature_data', 'signature_max_length', @@ -7834,7 +7979,8 @@ class TCPDF { * Check for locale-related bug * @protected */ - protected function _dochecks() { + protected function _dochecks() + { //Check for locale-related bug if (1.1 == 1) { $this->Error('Don\'t alter the locale before including class file'); @@ -7851,7 +7997,8 @@ class TCPDF { * @return array of page number aliases * @protected */ - protected function getInternalPageNumberAliases($a= '') { + protected function getInternalPageNumberAliases($a = '') + { $alias = array(); // build array of Unicode + ASCII variants (the order is important) $alias = array('u' => array(), 'a' => array()); @@ -7872,10 +8019,11 @@ class TCPDF { * @return array of page number aliases * @protected */ - protected function getAllInternalPageNumberAliases() { + protected function getAllInternalPageNumberAliases() + { $basic_alias = array(TCPDF_STATIC::$alias_tot_pages, TCPDF_STATIC::$alias_num_page, TCPDF_STATIC::$alias_group_tot_pages, TCPDF_STATIC::$alias_group_num_page, TCPDF_STATIC::$alias_right_shift); $pnalias = array(); - foreach($basic_alias as $k => $a) { + foreach ($basic_alias as $k => $a) { $pnalias[$k] = $this->getInternalPageNumberAliases($a); } return $pnalias; @@ -7890,7 +8038,8 @@ class TCPDF { * @return replaced page content. * @protected */ - protected function replaceRightShiftPageNumAliases($page, $aliases, $diff) { + protected function replaceRightShiftPageNumAliases($page, $aliases, $diff) + { foreach ($aliases as $type => $alias) { foreach ($alias as $a) { // find position of compensation factor @@ -7925,7 +8074,8 @@ class TCPDF { * @param $boxes (array) Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). * @protected */ - protected function setPageBoxTypes($boxes) { + protected function setPageBoxTypes($boxes) + { $this->page_boxes = array(); foreach ($boxes as $box) { if (in_array($box, TCPDF_STATIC::$pageboxes)) { @@ -7938,7 +8088,8 @@ class TCPDF { * Output pages (and replace page number aliases). * @protected */ - protected function _putpages() { + protected function _putpages() + { $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; // get internal aliases for page numbers $pnalias = $this->getAllInternalPageNumberAliases(); @@ -8084,7 +8235,7 @@ class TCPDF { //Pages root $out = $this->_getobj(1)."\n"; $out .= '<< /Type /Pages /Kids ['; - foreach($this->page_obj_id as $page_obj) { + foreach ($this->page_obj_id as $page_obj) { $out .= ' '.$page_obj.' 0 R'; } $out .= ' ] /Count '.$num_pages.' >>'; @@ -8100,7 +8251,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.0.010 (2010-05-17) */ - protected function _getannotsrefs($n) { + protected function _getannotsrefs($n) + { if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) { return ''; } @@ -8144,7 +8296,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.0.018 (2008-08-06) */ - protected function _putannotsobjs() { + protected function _putannotsobjs() + { // reset object counter for ($n=1; $n <= $this->numpages; ++$n) { if (isset($this->PageAnnots[$n])) { @@ -8664,7 +8817,7 @@ class TCPDF { if (is_array($pl['opt']['ff'])) { // array of bit settings $flag = 0; - foreach($pl['opt']['ff'] as $val) { + foreach ($pl['opt']['ff'] as $val) { $flag += 1 << ($val - 1); } } else { @@ -8728,7 +8881,7 @@ class TCPDF { } if (isset($pl['opt']['opt']) AND (is_array($pl['opt']['opt'])) AND !empty($pl['opt']['opt'])) { $annots .= ' /Opt ['; - foreach($pl['opt']['opt'] AS $copt) { + foreach ($pl['opt']['opt'] AS $copt) { if (is_array($copt)) { $annots .= ' ['.$this->_textstring($copt[0], $annot_obj_id).' '.$this->_textstring($copt[1], $annot_obj_id).']'; } else { @@ -8742,7 +8895,7 @@ class TCPDF { } if (isset($pl['opt']['i']) AND (is_array($pl['opt']['i'])) AND !empty($pl['opt']['i'])) { $annots .= ' /I ['; - foreach($pl['opt']['i'] AS $copt) { + foreach ($pl['opt']['i'] AS $copt) { $annots .= intval($copt).' '; } $annots .= ']'; @@ -8789,7 +8942,8 @@ class TCPDF { * @protected * @since 4.8.001 (2009-09-09) */ - protected function _putAPXObject($w=0, $h=0, $stream='') { + protected function _putAPXObject($w = 0, $h = 0, $stream = '') + { $stream = trim($stream); $out = $this->_getobj()."\n"; $this->xobjects['AX'.$this->n] = array('n' => $this->n); @@ -8819,7 +8973,8 @@ class TCPDF { * @author Nicola Asuni * @protected */ - protected function _putfonts() { + protected function _putfonts() + { $nf = $this->n; foreach ($this->diffs as $diff) { //Encodings @@ -8971,7 +9126,8 @@ class TCPDF { * @author Nicola Asuni * @since 1.52.0.TC005 (2005-01-05) */ - protected function _puttruetypeunicode($font) { + protected function _puttruetypeunicode($font) + { $fontname = ''; if ($font['subset']) { // change name for font subsetting @@ -9075,7 +9231,8 @@ class TCPDF { * @author Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira * @since 3.2.000 (2008-06-23) */ - protected function _putcidfont0($font) { + protected function _putcidfont0($font) + { $cidoffset = 0; if (!isset($font['cw'][1])) { $cidoffset = 31; @@ -9145,7 +9302,8 @@ class TCPDF { * Output images. * @protected */ - protected function _putimages() { + protected function _putimages() + { $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; foreach ($this->imagekeys as $file) { $info = $this->getImageBuffer($file); @@ -9274,7 +9432,8 @@ class TCPDF { * @protected * @see startTemplate(), endTemplate(), printTemplate() */ - protected function _putxobjects() { + protected function _putxobjects() + { foreach ($this->xobjects as $key => $data) { if (isset($data['outdata'])) { $stream = str_replace($this->epsmarker, '', trim($data['outdata'])); @@ -9377,7 +9536,8 @@ class TCPDF { * @protected * @since 4.0.024 (2008-09-12) */ - protected function _putspotcolors() { + protected function _putspotcolors() + { foreach ($this->spot_colors as $name => $color) { $this->_newobj(); $this->spot_colors[$name]['n'] = $this->n; @@ -9397,7 +9557,8 @@ class TCPDF { * @protected * @since 5.8.014 (2010-08-23) */ - protected function _getxobjectdict() { + protected function _getxobjectdict() + { $out = ''; foreach ($this->xobjects as $id => $objid) { $out .= ' /'.$id.' '.$objid['n'].' 0 R'; @@ -9409,7 +9570,8 @@ class TCPDF { * Output Resources Dictionary. * @protected */ - protected function _putresourcedict() { + protected function _putresourcedict() + { $out = $this->_getobj(2)."\n"; $out .= '<< /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'; $out .= ' /Font <<'; @@ -9473,7 +9635,8 @@ class TCPDF { * Output Resources. * @protected */ - protected function _putresources() { + protected function _putresources() + { $this->_putextgstates(); $this->_putocg(); $this->_putfonts(); @@ -9496,7 +9659,8 @@ class TCPDF { * @return int object id * @protected */ - protected function _putinfo() { + protected function _putinfo() + { $oid = $this->_newobj(); $out = '<<'; // store current isunicode value @@ -9547,7 +9711,8 @@ class TCPDF { * @since 5.9.128 (2011-10-06) * @public */ - public function setExtraXMP($xmp) { + public function setExtraXMP($xmp) + { $this->custom_xmp = $xmp; } @@ -9558,7 +9723,8 @@ class TCPDF { * @since 6.3.0 (2019-09-19) * @public */ - public function setExtraXMPRDF($xmp) { + public function setExtraXMPRDF($xmp) + { $this->custom_xmp_rdf = $xmp; } @@ -9568,7 +9734,8 @@ class TCPDF { * @since 5.9.121 (2011-09-28) * @protected */ - protected function _putXMP() { + protected function _putXMP() + { $oid = $this->_newobj(); // store current isunicode value $prev_isunicode = $this->isunicode; @@ -9707,7 +9874,8 @@ class TCPDF { * @return int object id * @protected */ - protected function _putcatalog() { + protected function _putcatalog() + { // put XMP $xmpobj = $this->_putXMP(); // if required, add standard sRGB ICC colour profile @@ -9837,7 +10005,7 @@ class TCPDF { } } if (!empty($this->form_obj_id)) { - foreach($this->form_obj_id as $objid) { + foreach ($this->form_obj_id as $objid) { $objrefs .= ' '.$objid.' 0 R'; } } @@ -9894,7 +10062,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - protected function _putviewerpreferences() { + protected function _putviewerpreferences() + { $vp = $this->viewer_preferences; $out = ' /ViewerPreferences <<'; if ($this->rtl) { @@ -9953,7 +10122,7 @@ class TCPDF { foreach ($vp['PrintPageRange'] as $k => $v) { $PrintPageRangeNum .= ' '.($v - 1).''; } - $out .= ' /PrintPageRange ['.substr($PrintPageRangeNum,1).']'; + $out .= ' /PrintPageRange ['.substr($PrintPageRangeNum, 1).']'; } if (isset($vp['NumCopies'])) { $out .= ' /NumCopies '.intval($vp['NumCopies']); @@ -9966,7 +10135,8 @@ class TCPDF { * Output PDF File Header (7.5.2). * @protected */ - protected function _putheader() { + protected function _putheader() + { $this->_out('%PDF-'.$this->PDFVersion); $this->_out('%'.chr(0xe2).chr(0xe3).chr(0xcf).chr(0xd3)); } @@ -9975,7 +10145,8 @@ class TCPDF { * Output end of document (EOF). * @protected */ - protected function _enddoc() { + protected function _enddoc() + { if (isset($this->CurrentFont['fontkey']) AND isset($this->CurrentFont['subsetchars'])) { // save subset chars of the previous font $this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']); @@ -10066,7 +10237,8 @@ class TCPDF { * @protected * @see getPageSizeFromFormat(), setPageFormat() */ - protected function _beginpage($orientation='', $format='') { + protected function _beginpage($orientation = '', $format = '') + { ++$this->page; $this->pageobjects[$this->page] = array(); $this->setPageBuffer($this->page, ''); @@ -10109,7 +10281,8 @@ class TCPDF { * Mark end of page. * @protected */ - protected function _endpage() { + protected function _endpage() + { $this->setVisibility('all'); $this->state = 1; } @@ -10119,7 +10292,8 @@ class TCPDF { * @return int object number * @protected */ - protected function _newobj() { + protected function _newobj() + { $this->_out($this->_getobj()); return $this->n; } @@ -10131,7 +10305,8 @@ class TCPDF { * @protected * @since 5.8.009 (2010-08-20) */ - protected function _getobj($objid='') { + protected function _getobj($objid = '') + { if ($objid === '') { ++$this->n; $objid = $this->n; @@ -10148,7 +10323,8 @@ class TCPDF { * @param $txt (string) text to underline * @protected */ - protected function _dounderline($x, $y, $txt) { + protected function _dounderline($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dounderlinew($x, $y, $w); } @@ -10161,7 +10337,8 @@ class TCPDF { * @protected * @since 4.8.008 (2009-09-29) */ - protected function _dounderlinew($x, $y, $w) { + protected function _dounderlinew($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew), $w * $this->k, $linew); } @@ -10173,7 +10350,8 @@ class TCPDF { * @param $txt (string) text to linethrough * @protected */ - protected function _dolinethrough($x, $y, $txt) { + protected function _dolinethrough($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dolinethroughw($x, $y, $w); } @@ -10186,7 +10364,8 @@ class TCPDF { * @protected * @since 4.9.008 (2009-09-29) */ - protected function _dolinethroughw($x, $y, $w) { + protected function _dolinethroughw($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew + ($this->FontSizePt / 3)), $w * $this->k, $linew); } @@ -10199,7 +10378,8 @@ class TCPDF { * @protected * @since 4.9.015 (2010-04-19) */ - protected function _dooverline($x, $y, $txt) { + protected function _dooverline($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dooverlinew($x, $y, $w); } @@ -10212,10 +10392,10 @@ class TCPDF { * @protected * @since 4.9.015 (2010-04-19) */ - protected function _dooverlinew($x, $y, $w) { + protected function _dooverlinew($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, (($this->h - $y + $this->FontAscent) * $this->k) - $linew, $w * $this->k, $linew); - } /** @@ -10225,7 +10405,8 @@ class TCPDF { * @return string escaped string. * @protected */ - protected function _datastring($s, $n=0) { + protected function _datastring($s, $n = 0) + { if ($n == 0) { $n = $this->n; } @@ -10239,7 +10420,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setDocCreationTimestamp($time) { + public function setDocCreationTimestamp($time) + { if (is_string($time)) { $time = TCPDF_STATIC::getTimestamp($time); } @@ -10252,7 +10434,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setDocModificationTimestamp($time) { + public function setDocModificationTimestamp($time) + { if (is_string($time)) { $time = TCPDF_STATIC::getTimestamp($time); } @@ -10265,7 +10448,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getDocCreationTimestamp() { + public function getDocCreationTimestamp() + { return $this->doc_creation_timestamp; } @@ -10275,7 +10459,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getDocModificationTimestamp() { + public function getDocModificationTimestamp() + { return $this->doc_modification_timestamp; } @@ -10287,7 +10472,8 @@ class TCPDF { * @protected * @since 4.6.028 (2009-08-25) */ - protected function _datestring($n=0, $timestamp=0) { + protected function _datestring($n = 0, $timestamp = 0) + { if ((empty($timestamp)) OR ($timestamp < 0)) { $timestamp = $this->doc_creation_timestamp; } @@ -10301,7 +10487,8 @@ class TCPDF { * @return string escaped string. * @protected */ - protected function _textstring($s, $n=0) { + protected function _textstring($s, $n = 0) + { if ($this->isunicode) { //Convert string to UTF-16BE $s = TCPDF_FONTS::UTF8ToUTF16BE($s, true, $this->isunicode, $this->CurrentFont); @@ -10317,7 +10504,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.5.000 (2010-06-22) */ - protected function _getrawstream($s, $n=0) { + protected function _getrawstream($s, $n = 0) + { if ($n <= 0) { // default to current object $n = $this->n; @@ -10330,7 +10518,8 @@ class TCPDF { * @param $s (string) string to output. * @protected */ - protected function _out($s) { + protected function _out($s) + { if ($this->state == 2) { if ($this->inxobj) { // we are inside an XObject template @@ -10359,7 +10548,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setHeaderFont($font) { + public function setHeaderFont($font) + { $this->header_font = $font; } @@ -10369,7 +10559,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getHeaderFont() { + public function getHeaderFont() + { return $this->header_font; } @@ -10379,7 +10570,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setFooterFont($font) { + public function setFooterFont($font) + { $this->footer_font = $font; } @@ -10389,7 +10581,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getFooterFont() { + public function getFooterFont() + { return $this->footer_font; } @@ -10399,7 +10592,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setLanguageArray($language) { + public function setLanguageArray($language) + { $this->l = $language; if (isset($this->l['a_meta_dir'])) { $this->rtl = $this->l['a_meta_dir']=='rtl' ? true : false; @@ -10412,7 +10606,8 @@ class TCPDF { * Returns the PDF data. * @public */ - public function getPDFData() { + public function getPDFData() + { if ($this->state < 3) { $this->Close(); } @@ -10431,7 +10626,8 @@ class TCPDF { * @return the number of cells used or the remaining text if $firstline = true; * @public */ - public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) { + public function addHtmlLink($url, $name, $fill = false, $firstline = false, $color = '', $style = -1, $firstblock = false) + { if (isset($url[1]) AND ($url[0] == '#') AND is_numeric($url[1])) { // convert url to internal link $lnkdata = explode(',', $url); @@ -10473,7 +10669,8 @@ class TCPDF { * @public * @see setImageScale(), getImageScale() */ - public function pixelsToUnits($px) { + public function pixelsToUnits($px) + { return ($px / ($this->imgscale * $this->k)); } @@ -10484,7 +10681,8 @@ class TCPDF { * @return string converted text string * @public */ - public function unhtmlentities($text_to_convert) { + public function unhtmlentities($text_to_convert) + { return @html_entity_decode($text_to_convert, ENT_QUOTES, $this->encoding); } @@ -10499,7 +10697,8 @@ class TCPDF { * @author Nicola Asuni * @since 2.0.000 (2008-01-02) */ - protected function _objectkey($n) { + protected function _objectkey($n) + { $objkey = $this->encryptdata['key'].pack('VXxx', $n); if ($this->encryptdata['mode'] == 2) { // AES-128 // AES padding @@ -10519,7 +10718,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.0.005 (2010-05-11) */ - protected function _encrypt_data($n, $s) { + protected function _encrypt_data($n, $s) + { if (!$this->encrypted) { return $s; } @@ -10547,7 +10747,8 @@ class TCPDF { * @author Nicola Asuni * @since 2.0.000 (2008-01-02) */ - protected function _putencryption() { + protected function _putencryption() + { if (!$this->encrypted) { return; } @@ -10667,7 +10868,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _Uvalue() { + protected function _Uvalue() + { if ($this->encryptdata['mode'] == 0) { // RC4-40 return TCPDF_STATIC::_RC4($this->encryptdata['key'], TCPDF_STATIC::$enc_padding, $this->last_enc_key, $this->last_enc_key_c); } elseif ($this->encryptdata['mode'] < 3) { // RC4-128, AES-128 @@ -10700,7 +10902,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _UEvalue() { + protected function _UEvalue() + { $hashkey = hash('sha256', $this->encryptdata['user_password'].$this->encryptdata['UKS'], true); return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']); } @@ -10712,7 +10915,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _Ovalue() { + protected function _Ovalue() + { if ($this->encryptdata['mode'] < 3) { // RC4-40, RC4-128, AES-128 $tmp = TCPDF_STATIC::_md5_16($this->encryptdata['owner_password']); if ($this->encryptdata['mode'] > 0) { @@ -10750,7 +10954,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _OEvalue() { + protected function _OEvalue() + { $hashkey = hash('sha256', $this->encryptdata['owner_password'].$this->encryptdata['OKS'].$this->encryptdata['U'], true); return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']); } @@ -10763,7 +10968,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _fixAES256Password($password) { + protected function _fixAES256Password($password) + { $psw = ''; // password to be returned $psw_array = TCPDF_FONTS::utf8Bidi(TCPDF_FONTS::UTF8StringToArray($password, $this->isunicode, $this->CurrentFont), $password, $this->rtl, $this->isunicode, $this->CurrentFont); foreach ($psw_array as $c) { @@ -10778,7 +10984,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _generateencryptionkey() { + protected function _generateencryptionkey() + { $keybytelen = ($this->encryptdata['Length'] / 8); if (!$this->encryptdata['pubkey']) { // standard mode if ($this->encryptdata['mode'] == 3) { // AES-256 @@ -10896,7 +11103,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - public function SetProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null) { + public function SetProtection($permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass = '', $owner_pass = null, $mode = 0, $pubkeys = null) + { if ($this->pdfa_mode) { // encryption is not allowed in PDF/A mode return; @@ -11002,7 +11210,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function StartTransform() { + public function StartTransform() + { if ($this->state != 2) { return; } @@ -11025,7 +11234,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function StopTransform() { + public function StopTransform() + { if ($this->state != 2) { return; } @@ -11050,7 +11260,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleX($s_x, $x='', $y='') { + public function ScaleX($s_x, $x = '', $y = '') + { $this->Scale($s_x, 100, $x, $y); } @@ -11063,7 +11274,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleY($s_y, $x='', $y='') { + public function ScaleY($s_y, $x = '', $y = '') + { $this->Scale(100, $s_y, $x, $y); } @@ -11076,7 +11288,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleXY($s, $x='', $y='') { + public function ScaleXY($s, $x = '', $y = '') + { $this->Scale($s, $s, $x, $y); } @@ -11090,7 +11303,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Scale($s_x, $s_y, $x='', $y='') { + public function Scale($s_x, $s_y, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11123,7 +11337,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorH($x='') { + public function MirrorH($x = '') + { $this->Scale(-100, 100, $x); } @@ -11134,7 +11349,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorV($y='') { + public function MirrorV($y = '') + { $this->Scale(100, -100, '', $y); } @@ -11146,7 +11362,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorP($x='',$y='') { + public function MirrorP($x = '', $y = '') + { $this->Scale(-100, -100, $x, $y); } @@ -11159,7 +11376,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorL($angle=0, $x='',$y='') { + public function MirrorL($angle = 0, $x = '', $y = '') + { $this->Scale(-100, 100, $x, $y); $this->Rotate(-2*($angle-90), $x, $y); } @@ -11171,7 +11389,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function TranslateX($t_x) { + public function TranslateX($t_x) + { $this->Translate($t_x, 0); } @@ -11182,7 +11401,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function TranslateY($t_y) { + public function TranslateY($t_y) + { $this->Translate(0, $t_y); } @@ -11194,7 +11414,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Translate($t_x, $t_y) { + public function Translate($t_x, $t_y) + { //calculate elements of transformation matrix $tm = array(); $tm[0] = 1; @@ -11216,7 +11437,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Rotate($angle, $x='', $y='') { + public function Rotate($angle, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11246,7 +11468,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewX($angle_x, $x='', $y='') { + public function SkewX($angle_x, $x = '', $y = '') + { $this->Skew($angle_x, 0, $x, $y); } @@ -11259,7 +11482,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewY($angle_y, $x='', $y='') { + public function SkewY($angle_y, $x = '', $y = '') + { $this->Skew(0, $angle_y, $x, $y); } @@ -11273,7 +11497,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Skew($angle_x, $angle_y, $x='', $y='') { + public function Skew($angle_x, $angle_y, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11304,7 +11529,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - protected function Transform($tm) { + protected function Transform($tm) + { if ($this->state != 2) { return; } @@ -11336,7 +11562,8 @@ class TCPDF { * @since 1.0 * @see Line(), Rect(), Cell(), MultiCell() */ - public function SetLineWidth($width) { + public function SetLineWidth($width) + { //Set line width $this->LineWidth = $width; $this->linestyleWidth = sprintf('%F w', ($width * $this->k)); @@ -11352,34 +11579,36 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see Line(), SetLineWidth() */ - public function GetLineWidth() { + public function GetLineWidth() + { return $this->LineWidth; } /** * Set line style. * @param $style (array) Line style. Array with keys among the following: - *
      - *
    • width (float): Width of the line in user units.
    • - *
    • cap (string): Type of cap to put on the line. Possible values are: - * butt, round, square. The difference between "square" and "butt" is that - * "square" projects a flat end past the end of the line.
    • - *
    • join (string): Type of join. Possible values are: miter, round, - * bevel.
    • - *
    • dash (mixed): Dash pattern. Is 0 (without dash) or string with - * series of length values, which are the lengths of the on and off dashes. - * For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on, - * 1 off, 2 on, 1 off, ...
    • - *
    • phase (integer): Modifier on the dash pattern which is used to shift - * the point at which the pattern starts.
    • - *
    • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
    • - *
    + *
      + *
    • width (float): Width of the line in user units.
    • + *
    • cap (string): Type of cap to put on the line. Possible values are: + * butt, round, square. The difference between "square" and "butt" is that + * "square" projects a flat end past the end of the line.
    • + *
    • join (string): Type of join. Possible values are: miter, round, + * bevel.
    • + *
    • dash (mixed): Dash pattern. Is 0 (without dash) or string with + * series of length values, which are the lengths of the on and off dashes. + * For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on, + * 1 off, 2 on, 1 off, ...
    • + *
    • phase (integer): Modifier on the dash pattern which is used to shift + * the point at which the pattern starts.
    • + *
    • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
    • + *
    * @param $ret (boolean) if true do not send the command. * @return string the PDF command * @public * @since 2.1.000 (2008-01-08) */ - public function SetLineStyle($style, $ret=false) { + public function SetLineStyle($style, $ret = false) + { $s = ''; // string to be returned if (!is_array($style)) { return; @@ -11441,7 +11670,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outPoint($x, $y) { + protected function _outPoint($x, $y) + { if ($this->state == 2) { $this->_out(sprintf('%F %F m', ($x * $this->k), (($this->h - $y) * $this->k))); } @@ -11455,7 +11685,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outLine($x, $y) { + protected function _outLine($x, $y) + { if ($this->state == 2) { $this->_out(sprintf('%F %F l', ($x * $this->k), (($this->h - $y) * $this->k))); } @@ -11471,7 +11702,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outRect($x, $y, $w, $h, $op) { + protected function _outRect($x, $y, $w, $h, $op) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F re %s', ($x * $this->k), (($this->h - $y) * $this->k), ($w * $this->k), (-$h * $this->k), $op)); } @@ -11489,7 +11721,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outCurve($x1, $y1, $x2, $y2, $x3, $y3) { + protected function _outCurve($x1, $y1, $x2, $y2, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F %F %F c', ($x1 * $this->k), (($this->h - $y1) * $this->k), ($x2 * $this->k), (($this->h - $y2) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11505,7 +11738,8 @@ class TCPDF { * @protected * @since 4.9.019 (2010-04-26) */ - protected function _outCurveV($x2, $y2, $x3, $y3) { + protected function _outCurveV($x2, $y2, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F v', ($x2 * $this->k), (($this->h - $y2) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11521,7 +11755,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outCurveY($x1, $y1, $x3, $y3) { + protected function _outCurveY($x1, $y1, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F y', ($x1 * $this->k), (($this->h - $y1) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11538,7 +11773,8 @@ class TCPDF { * @since 1.0 * @see SetLineWidth(), SetDrawColor(), SetLineStyle() */ - public function Line($x1, $y1, $x2, $y2, $style=array()) { + public function Line($x1, $y1, $x2, $y2, $style = array()) + { if ($this->state != 2) { return; } @@ -11558,17 +11794,18 @@ class TCPDF { * @param $h (float) Height. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $border_style (array) Border style of rectangle. Array with keys among the following: - *
      - *
    • all: Line style of all borders. Array like for SetLineStyle().
    • - *
    • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). + *
      + *
    • all: Line style of all borders. Array like for SetLineStyle().
    • + *
    • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @since 1.0 * @see SetLineStyle() */ - public function Rect($x, $y, $w, $h, $style='', $border_style=array(), $fill_color=array()) { + public function Rect($x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11639,7 +11876,8 @@ class TCPDF { * @see SetLineStyle() * @since 2.1.000 (2008-01-08) */ - public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style='', $line_style=array(), $fill_color=array()) { + public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style = '', $line_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11669,7 +11907,8 @@ class TCPDF { * @see SetLineStyle() * @since 3.0008 (2008-05-12) */ - public function Polycurve($x0, $y0, $segments, $style='', $line_style=array(), $fill_color=array()) { + public function Polycurve($x0, $y0, $segments, $style = '', $line_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11709,7 +11948,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function Ellipse($x0, $y0, $rx, $ry='', $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { + public function Ellipse($x0, $y0, $rx, $ry = '', $angle = 0, $astart = 0, $afinish = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2) + { if ($this->state != 2) { return; } @@ -11750,7 +11990,8 @@ class TCPDF { * @protected * @since 4.9.019 (2010-04-26) */ - protected function _outellipticalarc($xc, $yc, $rx, $ry, $xang=0, $angs=0, $angf=360, $pie=false, $nc=2, $startpoint=true, $ccw=true, $svg=false) { + protected function _outellipticalarc($xc, $yc, $rx, $ry, $xang = 0, $angs = 0, $angf = 360, $pie = false, $nc = 2, $startpoint = true, $ccw = true, $svg = false) + { if (($rx <= 0) OR ($ry < 0)) { return; } @@ -11881,7 +12122,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function Circle($x0, $y0, $r, $angstr=0, $angend=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { + public function Circle($x0, $y0, $r, $angstr = 0, $angend = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2) + { $this->Ellipse($x0, $y0, $r, $r, 0, $angstr, $angend, $style, $line_style, $fill_color, $nc); } @@ -11890,16 +12132,17 @@ class TCPDF { * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon. Array with keys among the following: - *
      - *
    • all: Line style of all lines. Array like for SetLineStyle().
    • - *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the line. Default value is default line style (empty array). + *
      + *
    • all: Line style of all lines. Array like for SetLineStyle().
    • + *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the line. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @since 4.8.003 (2009-09-15) * @public */ - public function PolyLine($p, $style='', $line_style=array(), $fill_color=array()) { + public function PolyLine($p, $style = '', $line_style = array(), $fill_color = array()) + { $this->Polygon($p, $style, $line_style, $fill_color, false); } @@ -11908,17 +12151,18 @@ class TCPDF { * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon. Array with keys among the following: - *
      - *
    • all: Line style of all lines. Array like for SetLineStyle().
    • - *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the line. Default value is default line style (empty array). + *
      + *
    • all: Line style of all lines. Array like for SetLineStyle().
    • + *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the line. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @param $closed (boolean) if true the polygon is closes, otherwise will remain open * @public * @since 2.1.000 (2008-01-08) */ - public function Polygon($p, $style='', $line_style=array(), $fill_color=array(), $closed=true) { + public function Polygon($p, $style = '', $line_style = array(), $fill_color = array(), $closed = true) + { if ($this->state != 2) { return; } @@ -12000,26 +12244,27 @@ class TCPDF { * @param $draw_circle (boolean) Draw inscribed circle or not. Default value: false. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon sides. Array with keys among the following: - *
      - *
    • all: Line style of all sides. Array like for SetLineStyle().
    • - *
    • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the side. Default value is default line style (empty array). + *
      + *
    • all: Line style of all sides. Array like for SetLineStyle().
    • + *
    • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the side. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: - *
      - *
    • D or empty string: Draw (default).
    • - *
    • F: Fill.
    • - *
    • DF or FD: Draw and fill.
    • - *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • - *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • - *
    + *
      + *
    • D or empty string: Draw (default).
    • + *
    • F: Fill.
    • + *
    • DF or FD: Draw and fill.
    • + *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • + *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • + *
    * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ - public function RegularPolygon($x0, $y0, $r, $ns, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array()) { + public function RegularPolygon($x0, $y0, $r, $ns, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array()) + { if (3 > $ns) { $ns = 3; } @@ -12047,27 +12292,28 @@ class TCPDF { * @param $draw_circle: (boolean) Draw inscribed circle or not. Default value is false. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon sides. Array with keys among the following: - *
      - *
    • all: Line style of all sides. Array like for - * SetLineStyle().
    • - *
    • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the side. Default value is default line style (empty array). + *
      + *
    • all: Line style of all sides. Array like for + * SetLineStyle().
    • + *
    • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the side. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: - *
      - *
    • D or empty string: Draw (default).
    • - *
    • F: Fill.
    • - *
    • DF or FD: Draw and fill.
    • - *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • - *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • - *
    + *
      + *
    • D or empty string: Draw (default).
    • + *
    • F: Fill.
    • + *
    • DF or FD: Draw and fill.
    • + *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • + *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • + *
    * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ - public function StarPolygon($x0, $y0, $r, $nv, $ng, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array()) { + public function StarPolygon($x0, $y0, $r, $nv, $ng, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array()) + { if ($nv < 2) { $nv = 2; } @@ -12109,7 +12355,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function RoundedRect($x, $y, $w, $h, $r, $round_corner='1111', $style='', $border_style=array(), $fill_color=array()) { + public function RoundedRect($x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array()) + { $this->RoundedRectXY($x, $y, $w, $h, $r, $r, $round_corner, $style, $border_style, $fill_color); } @@ -12128,7 +12375,8 @@ class TCPDF { * @public * @since 4.9.019 (2010-04-22) */ - public function RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner='1111', $style='', $border_style=array(), $fill_color=array()) { + public function RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -12198,7 +12446,8 @@ class TCPDF { * @author Piotr Galecki, Nicola Asuni, Andy Meier * @since 4.6.018 (2009-07-10) */ - public function Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15) { + public function Arrow($x0, $y0, $x1, $y1, $head_style = 0, $arm_size = 5, $arm_angle = 15) + { // getting arrow direction angle // 0 deg angle is when both arms go along X axis. angle grows clockwise. $dir_angle = atan2(($y0 - $y1), ($x0 - $x1)); @@ -12263,7 +12512,8 @@ class TCPDF { * @author Christian Deligant, Nicola Asuni * @since 5.9.097 (2011-06-23) */ - public function setDestination($name, $y=-1, $page='', $x=-1) { + public function setDestination($name, $y = -1, $page = '', $x = -1) + { // remove unsupported characters $name = TCPDF_STATIC::encodeNameObject($name); if (TCPDF_STATIC::empty_string($name)) { @@ -12306,7 +12556,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.097 (2011-06-23) */ - public function getDestination() { + public function getDestination() + { return $this->dests; } @@ -12316,13 +12567,14 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 5.9.098 (2011-06-23) */ - protected function _putdests() { + protected function _putdests() + { if (empty($this->dests)) { return; } $this->n_dests = $this->_newobj(); $out = ' <<'; - foreach($this->dests as $name => $o) { + foreach ($this->dests as $name => $o) { $out .= ' /'.$name.' '.sprintf('[%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o['p'])], ($o['x'] * $this->k), ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); } $out .= ' >>'; @@ -12342,7 +12594,8 @@ class TCPDF { * @param $link (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). * @public */ - public function setBookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1, $link='') { + public function setBookmark($txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '') + { $this->Bookmark($txt, $level, $y, $page, $style, $color, $x, $link); } @@ -12359,7 +12612,8 @@ class TCPDF { * @public * @since 2.1.002 (2008-02-12) */ - public function Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1, $link='') { + public function Bookmark($txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '') + { if ($level < 0) { $level = 0; } @@ -12406,7 +12660,8 @@ class TCPDF { * @protected * @since 5.9.119 (2011-09-19) */ - protected function sortBookmarks() { + protected function sortBookmarks() + { // get sorting columns $outline_p = array(); $outline_y = array(); @@ -12424,7 +12679,8 @@ class TCPDF { * @author Olivier Plathey, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _putbookmarks() { + protected function _putbookmarks() + { $nb = count($this->outlines); if ($nb == 0) { return; @@ -12550,7 +12806,8 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - public function IncludeJS($script) { + public function IncludeJS($script) + { $this->javascript .= $script; } @@ -12563,7 +12820,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function addJavascriptObject($script, $onload=false) { + public function addJavascriptObject($script, $onload = false) + { if ($this->pdfa_mode) { // javascript is not allowed in PDF/A mode return false; @@ -12579,7 +12837,8 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _putjavascript() { + protected function _putjavascript() + { if ($this->pdfa_mode OR (empty($this->javascript) AND empty($this->js_objects))) { return; } @@ -12637,7 +12896,8 @@ class TCPDF { * @author Denis Van Nuffelen, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _addfield($type, $name, $x, $y, $w, $h, $prop) { + protected function _addfield($type, $name, $x, $y, $w, $h, $prop) + { if ($this->rtl) { $x = $x - $w; } @@ -12646,7 +12906,7 @@ class TCPDF { $k = $this->k; $this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n"; $this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n"; - foreach($prop as $key => $val) { + foreach ($prop as $key => $val) { if (strcmp(substr($key, -5), 'Color') == 0) { $val = TCPDF_COLORS::_JScolor($val); } else { @@ -12673,7 +12933,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-06) */ - public function setFormDefaultProp($prop=array()) { + public function setFormDefaultProp($prop = array()) + { $this->default_form_prop = $prop; } @@ -12684,7 +12945,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-06) */ - public function getFormDefaultProp() { + public function getFormDefaultProp() + { return $this->default_form_prop; } @@ -12702,7 +12964,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function TextField($name, $w, $h, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function TextField($name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12823,7 +13086,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x='', $y='', $js=false) { + public function RadioButton($name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12926,7 +13190,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function ListBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12960,7 +13225,7 @@ class TCPDF { $popt['ap'] = array(); $popt['ap']['n'] = '/Tx BMC q '.$fontstyle.' '; $text = ''; - foreach($values as $item) { + foreach ($values as $item) { if (is_array($item)) { $text .= $item[1]."\n"; } else { @@ -13012,7 +13277,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function ComboBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13047,7 +13313,7 @@ class TCPDF { $popt['ap'] = array(); $popt['ap']['n'] = '/Tx BMC q '.$fontstyle.' '; $text = ''; - foreach($values as $item) { + foreach ($values as $item) { if (is_array($item)) { $text .= $item[1]."\n"; } else { @@ -13099,7 +13365,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $x='', $y='', $js=false) { + public function CheckBox($name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13179,7 +13446,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function Button($name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13346,7 +13614,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.6.008 (2009-05-07) */ - protected function _putsignature() { + protected function _putsignature() + { if ((!$this->sign) OR (!isset($this->signature_data['cert_type']))) { return; } @@ -13428,20 +13697,21 @@ class TCPDF { * @param $form (string) Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate * @param $signature (string) Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field. * @param $ef (string) Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files - Names specifying additional embedded-files-related usage rights for the document. + Names specifying additional embedded-files-related usage rights for the document. * @param $formex (string) Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode. * @public * @author Nicola Asuni * @since 2.9.000 (2008-03-26) */ public function setUserRights( - $enable=true, - $document='/FullSave', - $annots='/Create/Delete/Modify/Copy/Import/Export', - $form='/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', - $signature='/Modify', - $ef='/Create/Delete/Modify/Import', - $formex='') { + $enable = true, + $document = '/FullSave', + $annots = '/Create/Delete/Modify/Copy/Import/Export', + $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', + $signature = '/Modify', + $ef = '/Create/Delete/Modify/Import', + $formex = '' + ) { $this->ur['enabled'] = $enable; $this->ur['document'] = $document; $this->ur['annots'] = $annots; @@ -13471,7 +13741,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.6.005 (2009-04-24) */ - public function setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array(), $approval='') { + public function setSignature($signing_cert = '', $private_key = '', $private_key_password = '', $extracerts = '', $cert_type = 2, $info = array(), $approval = '') + { // 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 @@ -13508,7 +13779,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.3.011 (2010-06-17) */ - public function setSignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + public function setSignatureAppearance($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { $this->signature_appearance = $this->getSignatureAppearanceArray($x, $y, $w, $h, $page, $name); } @@ -13524,7 +13796,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.101 (2011-07-06) */ - public function addEmptySignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + public function addEmptySignatureAppearance($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { ++$this->n; $this->empty_signature_appearance[] = array('objid' => $this->n) + $this->getSignatureAppearanceArray($x, $y, $w, $h, $page, $name); } @@ -13542,7 +13815,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.101 (2011-07-06) */ - protected function getSignatureAppearanceArray($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + protected function getSignatureAppearanceArray($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { $sigapp = array(); if (($page < 1) OR ($page > $this->numpages)) { $sigapp['page'] = $this->page; @@ -13574,7 +13848,8 @@ class TCPDF { * @author Richard Stockinger * @since 6.0.090 (2014-06-16) */ - public function setTimeStamp($tsa_host='', $tsa_username='', $tsa_password='', $tsa_cert='') { + public function setTimeStamp($tsa_host = '', $tsa_username = '', $tsa_password = '', $tsa_cert = '') + { $this->tsa_data = array(); if (!function_exists('curl_init')) { $this->Error('Please enable cURL PHP extension!'); @@ -13602,7 +13877,8 @@ class TCPDF { * @author Richard Stockinger * @since 6.0.090 (2014-06-16) */ - protected function applyTSA($signature) { + protected function applyTSA($signature) + { if (!$this->tsa_timestamp) { return $signature; } @@ -13617,7 +13893,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function startPageGroup($page='') { + public function startPageGroup($page = '') + { if (empty($page)) { $page = $this->page + 1; } @@ -13630,7 +13907,8 @@ class TCPDF { * @since 5.9.093 (2011-06-16) * @public */ - public function setStartingPageNumber($num=1) { + public function setStartingPageNumber($num = 1) + { $this->starting_page_number = max(0, intval($num)); } @@ -13641,7 +13919,8 @@ class TCPDF { * @since 5.9.099 (2011-06-27) * @public */ - public function getAliasRightShift() { + public function getAliasRightShift() + { // calculate aproximatively the ratio between widths of aliases and replacements. $ref = '{'.TCPDF_STATIC::$alias_right_shift.'}{'.TCPDF_STATIC::$alias_tot_pages.'}{'.TCPDF_STATIC::$alias_num_page.'}'; $rep = str_repeat(' ', $this->GetNumChars($ref)); @@ -13667,7 +13946,8 @@ class TCPDF { * @since 4.0.018 (2008-08-08) * @public */ - public function getAliasNbPages() { + public function getAliasNbPages() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_tot_pages.'}'; } @@ -13682,7 +13962,8 @@ class TCPDF { * @since 4.5.000 (2009-01-02) * @public */ - public function getAliasNumPage() { + public function getAliasNumPage() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_num_page.'}'; } @@ -13697,7 +13978,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function getPageGroupAlias() { + public function getPageGroupAlias() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_group_tot_pages.'}'; } @@ -13712,7 +13994,8 @@ class TCPDF { * @public * @since 4.5.000 (2009-01-02) */ - public function getPageNumGroupAlias() { + public function getPageNumGroupAlias() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_group_num_page.'}'; } @@ -13725,7 +14008,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function getGroupPageNo() { + public function getGroupPageNo() + { return $this->pagegroups[$this->currpagegroup]; } @@ -13735,7 +14019,8 @@ class TCPDF { * @since 4.3.003 (2008-11-18) * @see PaneNo(), formatPageNumber() */ - public function getGroupPageNoFormatted() { + public function getGroupPageNoFormatted() + { return TCPDF_STATIC::formatPageNumber($this->getGroupPageNo()); } @@ -13745,7 +14030,8 @@ class TCPDF { * @since 4.2.005 (2008-11-06) * @see PaneNo(), formatPageNumber() */ - public function PageNoFormatted() { + public function PageNoFormatted() + { return TCPDF_STATIC::formatPageNumber($this->PageNo()); } @@ -13754,7 +14040,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function _putocg() { + protected function _putocg() + { if (empty($this->pdflayers)) { return; } @@ -13763,9 +14050,9 @@ class TCPDF { $out = '<< /Type /OCG'; $out .= ' /Name '.$this->_textstring($layer['name'], $this->pdflayers[$key]['objid']); $out .= ' /Usage <<'; - if (isset($layer['print']) AND ($layer['print'] !== NULL)) { + if (isset($layer['print']) AND ($layer['print'] !== null)) { $out .= ' /Print <>'; - } + } $out .= ' /View <>'; $out .= ' >> >>'; $out .= "\n".'endobj'; @@ -13782,7 +14069,8 @@ class TCPDF { * @public * @since 5.9.102 (2011-07-13) */ - public function startLayer($name='', $print=true, $view=true, $lock=true) { + public function startLayer($name = '', $print = true, $view = true, $lock = true) + { if ($this->state != 2) { return; } @@ -13802,7 +14090,8 @@ class TCPDF { * @public * @since 5.9.102 (2011-07-13) */ - public function endLayer() { + public function endLayer() + { if ($this->state != 2) { return; } @@ -13821,12 +14110,13 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setVisibility($v) { + public function setVisibility($v) + { if ($this->state != 2) { return; } $this->endLayer(); - switch($v) { + switch ($v) { case 'print': { $this->startLayer('Print', true, false); break; @@ -13854,7 +14144,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function addExtGState($parms) { + protected function addExtGState($parms) + { if ($this->pdfa_mode) { // transparencies are not allowed in PDF/A mode return; @@ -13885,7 +14176,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function setExtGState($gs) { + protected function setExtGState($gs) + { if ($this->pdfa_mode OR ($this->state != 2)) { // transparency is not allowed in PDF/A mode return; @@ -13898,7 +14190,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function _putextgstates() { + protected function _putextgstates() + { foreach ($this->extgstates as $i => $ext) { $this->extgstates[$i]['n'] = $this->_newobj(); $out = '<< /Type /ExtGState'; @@ -13927,7 +14220,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setOverprint($stroking=true, $nonstroking='', $mode=0) { + public function setOverprint($stroking = true, $nonstroking = '', $mode = 0) + { if ($this->state != 2) { return; } @@ -13953,7 +14247,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getOverprint() { + public function getOverprint() + { return $this->overprint; } @@ -13966,7 +14261,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setAlpha($stroking=1, $bm='Normal', $nonstroking='', $ais=false) { + public function setAlpha($stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false) + { if ($this->pdfa_mode) { // transparency is not allowed in PDF/A mode return; @@ -13998,7 +14294,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getAlpha() { + public function getAlpha() + { return $this->alpha; } @@ -14008,7 +14305,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setJPEGQuality($quality) { + public function setJPEGQuality($quality) + { if (($quality < 1) OR ($quality > 100)) { $quality = 75; } @@ -14021,7 +14319,8 @@ class TCPDF { * @public * @since 3.0.014 (2008-06-04) */ - public function setDefaultTableColumns($cols=4) { + public function setDefaultTableColumns($cols = 4) + { $this->default_table_columns = intval($cols); } @@ -14031,7 +14330,8 @@ class TCPDF { * @public * @since 3.0.014 (2008-06-04) */ - public function setCellHeightRatio($h) { + public function setCellHeightRatio($h) + { $this->cell_height_ratio = $h; } @@ -14040,7 +14340,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getCellHeightRatio() { + public function getCellHeightRatio() + { return $this->cell_height_ratio; } @@ -14050,7 +14351,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-09) */ - public function setPDFVersion($version='1.7') { + public function setPDFVersion($version = '1.7') + { if ($this->pdfa_mode && $this->pdfa_version == 1 ) { // PDF/A mode $this->PDFVersion = '1.4'; @@ -14068,7 +14370,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-09) */ - public function setViewerPreferences($preferences) { + public function setViewerPreferences($preferences) + { $this->viewer_preferences = $preferences; } @@ -14085,7 +14388,8 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function colorRegistrationBar($x, $y, $w, $h, $transition=true, $vertical=false, $colors='A,R,G,B,C,M,Y,K') { + public function colorRegistrationBar($x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K') + { if (strpos($colors, 'ALLSPOT') !== false) { // expand spot colors $spot_colors = ''; @@ -14225,7 +14529,8 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function cropMark($x, $y, $w, $h, $type='T,R,B,L', $color=array(100,100,100,100,'All')) { + public function cropMark($x, $y, $w, $h, $type = 'T,R,B,L', $color = array(100,100,100,100,'All')) + { $this->SetLineStyle(array('width' => (0.5 / $this->k), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $color)); $type = strtoupper($type); $type = preg_replace('/[^A-Z\-\,]*/', '', $type); @@ -14296,8 +14601,9 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function registrationMark($x, $y, $r, $double=false, $cola=array(100,100,100,100,'All'), $colb=array(0,0,0,0,'None')) { - $line_style = array('width' => max((0.5 / $this->k),($r / 30)), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $cola); + public function registrationMark($x, $y, $r, $double = false, $cola = array(100,100,100,100,'All'), $colb = array(0,0,0,0,'None')) + { + $line_style = array('width' => max((0.5 / $this->k), ($r / 30)), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $cola); $this->SetFillColorArray($cola); $this->PieSector($x, $y, $r, 90, 180, 'F'); $this->PieSector($x, $y, $r, 270, 360, 'F'); @@ -14323,9 +14629,10 @@ class TCPDF { * @since 6.0.038 (2013-09-30) * @public */ - public function registrationMarkCMYK($x, $y, $r) { + public function registrationMarkCMYK($x, $y, $r) + { // line width - $lw = max((0.5 / $this->k),($r / 8)); + $lw = max((0.5 / $this->k), ($r / 8)); // internal radius $ri = ($r * 0.6); // external radius @@ -14367,7 +14674,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function LinearGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0,0,1,0)) { + public function LinearGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0,0,1,0)) + { $this->Clip($x, $y, $w, $h); $this->Gradient(2, $coords, array(array('color' => $col1, 'offset' => 0, 'exponent' => 1), array('color' => $col2, 'offset' => 1, 'exponent' => 1)), array(), false); } @@ -14385,7 +14693,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function RadialGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0.5,0.5,0.5,0.5,1)) { + public function RadialGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0.5,0.5,0.5,0.5,1)) + { $this->Clip($x, $y, $w, $h); $this->Gradient(3, $coords, array(array('color' => $col1, 'offset' => 0, 'exponent' => 1), array('color' => $col2, 'offset' => 1, 'exponent' => 1)), array(), false); } @@ -14408,7 +14717,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function CoonsPatchMesh($x, $y, $w, $h, $col1=array(), $col2=array(), $col3=array(), $col4=array(), $coords=array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min=0, $coords_max=1, $antialias=false) { + public function CoonsPatchMesh($x, $y, $w, $h, $col1 = array(), $col2 = array(), $col3 = array(), $col4 = array(), $coords = array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min = 0, $coords_max = 1, $antialias = false) + { if ($this->pdfa_mode OR ($this->state != 2)) { return; } @@ -14500,7 +14810,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - protected function Clip($x, $y, $w, $h) { + protected function Clip($x, $y, $w, $h) + { if ($this->state != 2) { return; } @@ -14527,7 +14838,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function Gradient($type, $coords, $stops, $background=array(), $antialias=false) { + public function Gradient($type, $coords, $stops, $background = array(), $antialias = false) + { if ($this->pdfa_mode OR ($this->state != 2)) { return; } @@ -14541,7 +14853,7 @@ class TCPDF { // color space $numcolspace = count($stops[0]['color']); $bcolor = array_values($background); - switch($numcolspace) { + switch ($numcolspace) { case 5: // SPOT case 4: { // CMYK $this->gradients[$n]['colspace'] = 'DeviceCMYK'; @@ -14598,7 +14910,7 @@ class TCPDF { } // set colors $color = array_values($stop['color']); - switch($numcolspace) { + switch ($numcolspace) { case 5: // SPOT case 4: { // CMYK $this->gradients[$n]['colors'][$key]['color'] = sprintf('%F %F %F %F', $color[0]/100, $color[1]/100, $color[2]/100, $color[3]/100); @@ -14634,7 +14946,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - function _putshaders() { + function _putshaders() + { if ($this->pdfa_mode) { return; } @@ -14826,7 +15139,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function PieSector($xc, $yc, $r, $a, $b, $style='FD', $cw=true, $o=90) { + public function PieSector($xc, $yc, $r, $a, $b, $style = 'FD', $cw = true, $o = 90) + { $this->PieSectorXY($xc, $yc, $r, $r, $a, $b, $style, $cw, $o); } @@ -14847,7 +15161,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style='FD', $cw=false, $o=0, $nc=2) { + public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style = 'FD', $cw = false, $o = 0, $nc = 2) + { if ($this->state != 2) { return; } @@ -14891,7 +15206,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function ImageEps($file, $x='', $y='', $w=0, $h=0, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false, $fixoutvals=false) { + public function ImageEps($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $useBoundingBox = true, $align = '', $palign = '', $border = 0, $fitonpage = false, $fixoutvals = false) + { if ($this->state != 2) { return; } @@ -14913,17 +15229,17 @@ class TCPDF { } else { // EPS/AI file $data = TCPDF_STATIC::fileGetContents($file); } - if ($data === FALSE) { + if ($data === false) { $this->Error('EPS file not found: '.$file); } $regs = array(); // EPS/AI compatibility check (only checks files created by Adobe Illustrator!) - preg_match("/%%Creator:([^\r\n]+)/", $data, $regs); # find Creator + preg_match("/%%Creator:([^\r\n]+)/", $data, $regs); // find Creator if (count($regs) > 1) { - $version_str = trim($regs[1]); # e.g. "Adobe Illustrator(R) 8.0" + $version_str = trim($regs[1]); // e.g. "Adobe Illustrator(R) 8.0" if (strpos($version_str, 'Adobe Illustrator') !== false) { $versexp = explode(' ', $version_str); - $version = (float)array_pop($versexp); + $version = (float) array_pop($versexp); if ($version >= 9) { $this->Error('This version of Adobe Illustrator file is not supported: '.$file); } @@ -15178,7 +15494,7 @@ class TCPDF { $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15210,7 +15526,8 @@ class TCPDF { * @param $bc (string) barcode * @public */ - public function setBarcode($bc='') { + public function setBarcode($bc = '') + { $this->barcode = $bc; } @@ -15220,7 +15537,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getBarcode() { + public function getBarcode() + { return $this->barcode; } @@ -15234,31 +15552,32 @@ class TCPDF { * @param $h (int) height in user units (empty string = remaining page height) * @param $xres (float) width of the smallest bar in user units (empty string = default value = 0.4mm) * @param $style (array) array of options:
      - *
    • boolean $style['border'] if true prints a border
    • - *
    • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
    • - *
    • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
    • - *
    • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
    • - *
    • array $style['fgcolor'] color array for bars and text
    • - *
    • mixed $style['bgcolor'] color array for background (set to false for transparent)
    • - *
    • boolean $style['text'] if true prints text below the barcode
    • - *
    • string $style['label'] override default label
    • - *
    • string $style['font'] font name for text
    • int $style['fontsize'] font size for text
    • - *
    • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
    • - *
    • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
    • - *
    • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
    • - *
    • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
    • - *
    • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
    • - *
    • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
    + *
  • boolean $style['border'] if true prints a border
  • + *
  • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
  • + *
  • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
  • + *
  • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
  • + *
  • array $style['fgcolor'] color array for bars and text
  • + *
  • mixed $style['bgcolor'] color array for background (set to false for transparent)
  • + *
  • boolean $style['text'] if true prints text below the barcode
  • + *
  • string $style['label'] override default label
  • + *
  • string $style['font'] font name for text
  • int $style['fontsize'] font size for text
  • + *
  • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
  • + *
  • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
  • + *
  • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
  • + *
  • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
  • + *
  • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
  • + *
  • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
  • * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
    • T: top-right for LTR or top-left for RTL
    • M: middle-right for LTR or middle-left for RTL
    • B: bottom-right for LTR or bottom-left for RTL
    • N: next line
    * @author Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ - public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') { + public function write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = array(), $align = '') + { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_1d.php'); + require_once dirname(__FILE__).'/tcpdf_barcodes_1d.php'; // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -15521,7 +15840,7 @@ class TCPDF { // restore previous settings $this->setGraphicVars($gvars); // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15557,26 +15876,27 @@ class TCPDF { * @param $w (int) width in user units * @param $h (int) height in user units * @param $style (array) array of options:
      - *
    • boolean $style['border'] if true prints a border around the barcode
    • - *
    • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['module_width'] width of a single module in points
    • - *
    • int $style['module_height'] height of a single module in points
    • - *
    • array $style['fgcolor'] color array for bars and text
    • - *
    • mixed $style['bgcolor'] color array for background or false for transparent
    • - *
    • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
    • + *
    • boolean $style['border'] if true prints a border around the barcode
    • + *
    • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['module_width'] width of a single module in points
    • + *
    • int $style['module_height'] height of a single module in points
    • + *
    • array $style['fgcolor'] color array for bars and text
    • + *
    • mixed $style['bgcolor'] color array for background or false for transparent
    • + *
    • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
    • * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
      • T: top-right for LTR or top-left for RTL
      • M: middle-right for LTR or middle-left for RTL
      • B: bottom-right for LTR or bottom-left for RTL
      • N: next line
      * @param $distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio * @author Nicola Asuni * @since 4.5.037 (2009-04-07) * @public */ - public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) { + public function write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = array(), $align = '', $distort = false) + { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_2d.php'); + require_once dirname(__FILE__).'/tcpdf_barcodes_2d.php'; // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -15634,7 +15954,7 @@ class TCPDF { // number of barcode columns and rows $rows = $arrcode['num_rows']; $cols = $arrcode['num_cols']; - if (($rows <= 0) || ($cols <= 0)){ + if (($rows <= 0) || ($cols <= 0)) { $this->Error('Error in 2D barcode string'); } // module width and height @@ -15755,7 +16075,7 @@ class TCPDF { // restore previous settings $this->setGraphicVars($gvars); // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15801,7 +16121,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getMargins() { + public function getMargins() + { $ret = array( 'left' => $this->lMargin, 'right' => $this->rMargin, @@ -15828,7 +16149,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getOriginalMargins() { + public function getOriginalMargins() + { $ret = array( 'left' => $this->original_lMargin, 'right' => $this->original_rMargin @@ -15842,7 +16164,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getFontSize() { + public function getFontSize() + { return $this->FontSize; } @@ -15852,7 +16175,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getFontSizePt() { + public function getFontSizePt() + { return $this->FontSizePt; } @@ -15862,7 +16186,8 @@ class TCPDF { * @public * @since 4.3.008 (2008-12-05) */ - public function getFontFamily() { + public function getFontFamily() + { return $this->FontFamily; } @@ -15872,7 +16197,8 @@ class TCPDF { * @public * @since 4.3.008 (2008-12-05) */ - public function getFontStyle() { + public function getFontStyle() + { return $this->FontStyle; } @@ -15888,7 +16214,8 @@ class TCPDF { * @since 5.9.017 (2010-11-16) * @see setHtmlVSpace() */ - public function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='') { + public function fixHTMLCode($html, $default_css = '', $tagvs = '', $tidy_options = '') + { return TCPDF_STATIC::fixHTMLCode($html, $default_css, $tagvs, $tidy_options, $this->tagvspaces); } @@ -15899,7 +16226,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderWidth($width) { + protected function getCSSBorderWidth($width) + { if ($width == 'thin') { $width = (2 / $this->k); } elseif ($width == 'medium') { @@ -15919,7 +16247,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderDashStyle($style) { + protected function getCSSBorderDashStyle($style) + { switch (strtolower($style)) { case 'none': case 'hidden': { @@ -15955,7 +16284,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderStyle($cssborder) { + protected function getCSSBorderStyle($cssborder) + { $bprop = preg_split('/[\s]+/', trim($cssborder)); $border = array(); // value to be returned switch (count($bprop)) { @@ -16006,7 +16336,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-04) */ - public function getCSSPadding($csspadding, $width=0) { + public function getCSSPadding($csspadding, $width = 0) + { $padding = preg_split('/[\s]+/', trim($csspadding)); $cell_padding = array(); // value to be returned switch (count($padding)) { @@ -16060,7 +16391,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-04) */ - public function getCSSMargin($cssmargin, $width=0) { + public function getCSSMargin($cssmargin, $width = 0) + { $margin = preg_split('/[\s]+/', trim($cssmargin)); $cell_margin = array(); // value to be returned switch (count($margin)) { @@ -16114,7 +16446,8 @@ class TCPDF { * @public * @since 5.9.010 (2010-10-27) */ - public function getCSSBorderMargin($cssbspace, $width=0) { + public function getCSSBorderMargin($cssbspace, $width = 0) + { $space = preg_split('/[\s]+/', trim($cssbspace)); $border_spacing = array(); // value to be returned switch (count($space)) { @@ -16148,7 +16481,8 @@ class TCPDF { * @protected * @since 5.9.000 (2010-10-02) */ - protected function getCSSFontSpacing($spacing, $parent=0) { + protected function getCSSFontSpacing($spacing, $parent = 0) + { $val = 0; // value to be returned $spacing = trim($spacing); switch ($spacing) { @@ -16179,7 +16513,8 @@ class TCPDF { * @protected * @since 5.9.000 (2010-10-02) */ - protected function getCSSFontStretching($stretch, $parent=100) { + protected function getCSSFontStretching($stretch, $parent = 100) + { $val = 100; // value to be returned $stretch = trim($stretch); switch ($stretch) { @@ -16251,7 +16586,8 @@ class TCPDF { * @return float value in points * @public */ - public function getHTMLFontUnits($val, $refsize=12, $parent_size=12, $defaultunit='pt') { + public function getHTMLFontUnits($val, $refsize = 12, $parent_size = 12, $defaultunit = 'pt') + { $refsize = TCPDF_FONTS::getFontRefSize($refsize); $parent_size = TCPDF_FONTS::getFontRefSize($parent_size, $refsize); switch ($val) { @@ -16305,7 +16641,8 @@ class TCPDF { * @protected * @since 3.2.000 (2008-06-20) */ - protected function getHtmlDomArray($html) { + protected function getHtmlDomArray($html) + { // array of CSS styles ( selector => properties). $css = array(); // get CSS array defined at previous call @@ -16331,7 +16668,7 @@ class TCPDF { if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) { // read CSS data file $cssdata = TCPDF_STATIC::fileGetContents(trim($type[1])); - if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) { + if (($cssdata !== false) AND (strlen($cssdata) > 0)) { $css = array_merge($css, TCPDF_STATIC::extractCSSproperties($cssdata)); } } @@ -16608,9 +16945,9 @@ class TCPDF { // get attributes preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER); $dom[$key]['attribute'] = array(); // reset attribute array - foreach($attr_array[1] as $id => $name) { - $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; - } + foreach ($attr_array[1] as $id => $name) { + $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; + } if (!empty($css)) { // merge CSS style to current style list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css); @@ -16621,10 +16958,10 @@ class TCPDF { // get style attributes preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER); $dom[$key]['style'] = array(); // reset style attribute array - foreach($style_array[1] as $id => $name) { - // in case of duplicate attribute the last replace the previous - $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); - } + foreach ($style_array[1] as $id => $name) { + // in case of duplicate attribute the last replace the previous + $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); + } // --- get some style attributes --- // text direction if (isset($dom[$key]['style']['direction'])) { @@ -17093,7 +17430,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.024 (2010-01-15) */ - protected function getSpaceString() { + protected function getSpaceString() + { $spacestr = chr(32); if ($this->isUnicodeFont()) { $spacestr = chr(0).chr(32); @@ -17107,7 +17445,8 @@ class TCPDF { * @return string * @public static */ - protected function getHashForTCPDFtagParams($data) { + protected function getHashForTCPDFtagParams($data) + { return md5(strlen($data).$this->file_id.$data); } @@ -17117,7 +17456,8 @@ class TCPDF { * @return string containing serialized data * @public static */ - public function serializeTCPDFtagParameters($data) { + public function serializeTCPDFtagParameters($data) + { $encoded = urlencode(json_encode($data)); return $this->getHashForTCPDFtagParams($encoded).$encoded; } @@ -17128,7 +17468,8 @@ class TCPDF { * @return array containing unserialized data * @protected static */ - protected function unserializeTCPDFtagParameters($data) { + protected function unserializeTCPDFtagParameters($data) + { $hash = substr($data, 0, 32); $encoded = substr($data, 32); if ($hash != $this->getHashForTCPDFtagParams($encoded)) { @@ -17150,8 +17491,7 @@ class TCPDF { * @param $y (float) upper-left corner Y coordinate * @param $html (string) html text to print. Default value: empty string. * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
      • 0: no border (default)
      • 1: frame
      or a string containing some or all of the following characters (in any order):
      • L: left
      • T: top
      • R: right
      • B: bottom
      or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
      • 0: to the right (or left for RTL language)
      • 1: to the beginning of the next line
      • 2: below
      -Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. + * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
      • 0: to the right (or left for RTL language)
      • 1: to the beginning of the next line
      • 2: below
      Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). * @param $reseth (boolean) if true reset the last cell height (default true). * @param $align (string) Allows to center or align the text. Possible values are:
      • L : left align
      • C : center
      • R : right align
      • '' : empty string : left for LTR or right for RTL
      @@ -17159,7 +17499,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @see Multicell(), writeHTML() * @public */ - public function writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopadding=true) { + public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true) + { return $this->MultiCell($w, $h, $html, $border, $align, $fill, $ln, $x, $y, $reseth, 0, true, $autopadding, 0, 'T', false); } @@ -17176,7 +17517,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $align (string) Allows to center or align the text. Possible values are:
      • L : left align
      • C : center
      • R : right align
      • '' : empty string : left for LTR or right for RTL
      * @public */ - public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') { + public function writeHTML($html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '') + { $gvars = $this->getGraphicVars(); // store current values $prev_cell_margin = $this->cell_margin; @@ -17834,7 +18176,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // justify block if (preg_match('/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s]('.$strpiece[2][0].')([\s]*)/x', $pmid, $pmatch) == 1) { - $newpmid = sprintf('%F',(floatval($pmatch[1]) + $spacew)).' '.$pmatch[2].' x*#!#*x'.$pmatch[3].$pmatch[4]; + $newpmid = sprintf('%F', (floatval($pmatch[1]) + $spacew)).' '.$pmatch[2].' x*#!#*x'.$pmatch[3].$pmatch[4]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid); } @@ -17879,8 +18221,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } if (preg_match('/('.$xmatches[1].')[\s]('.$xmatches[2].')[\s]('.$xmatches[3].')[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $pmatch) == 1) { - $newx = sprintf('%F',(floatval($pmatch[1]) + $x_diff)); - $neww = sprintf('%F',(floatval($pmatch[3]) + $w_diff)); + $newx = sprintf('%F', (floatval($pmatch[1]) + $x_diff)); + $neww = sprintf('%F', (floatval($pmatch[3]) + $w_diff)); $newpmid = $newx.' '.$pmatch[2].' '.$neww.' '.$pmatch[4].' x*#!#*x'.$pmatch[5].$pmatch[6]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid, $newx, $neww); @@ -17896,9 +18238,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $currentxpos = $xmatches[1]; // justify block if (preg_match('/('.$xmatches[1].')[\s]('.$xmatches[2].')[\s]('.$xmatches[3].')[\s]('.$xmatches[4].')[\s]('.$xmatches[5].')[\s]('.$strpiece[1][0].')[\s](c)([\s]*)/x', $pmid, $pmatch) == 1) { - $newx1 = sprintf('%F',(floatval($pmatch[1]) + $spacew)); - $newx2 = sprintf('%F',(floatval($pmatch[3]) + $spacew)); - $newx3 = sprintf('%F',(floatval($pmatch[5]) + $spacew)); + $newx1 = sprintf('%F', (floatval($pmatch[1]) + $spacew)); + $newx2 = sprintf('%F', (floatval($pmatch[3]) + $spacew)); + $newx3 = sprintf('%F', (floatval($pmatch[5]) + $spacew)); $newpmid = $newx1.' '.$pmatch[2].' '.$newx2.' '.$pmatch[4].' '.$newx3.' '.$pmatch[6].' x*#!#*x'.$pmatch[7].$pmatch[8]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid, $newx1, $newx2, $newx3); @@ -17950,13 +18292,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $pmid = preg_replace('/[\\\][\(]/x', '\\#!#OP#!#', $pmid); $pmid = preg_replace('/[\\\][\)]/x', '\\#!#CP#!#', $pmid); if (preg_match_all('/\[\(([^\)]*)\)\]/x', $pmid, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $replace = $pamatch[1][$pk]; $replace = str_replace('#!#OP#!#', '(', $replace); $replace = str_replace('#!#CP#!#', ')', $replace); $newpmid = '[('.str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacew).' (', $replace).')]'; $pos = strpos($pmid, $pmatch, $pos); - if ($pos !== FALSE) { + if ($pos !== false) { $pmid = substr_replace($pmid, $newpmid, $pos, strlen($pmatch)); } ++$pos; @@ -18529,8 +18871,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $loop = 0; // add the positive font spacing of the last character (if any) - if ($this->font_spacing > 0) { - if ($this->rtl) { + if ($this->font_spacing > 0) { + if ($this->rtl) { $this->x -= $this->font_spacing; } else { $this->x += $this->font_spacing; @@ -18734,7 +19076,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @return $dom array * @protected */ - protected function openHTMLTagHandler($dom, $key, $cell) { + protected function openHTMLTagHandler($dom, $key, $cell) + { $tag = $dom[$key]; $parent = $dom[($dom[$key]['parent'])]; $firsttag = ($key == 1); @@ -18799,7 +19142,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // Opening tag - switch($tag['value']) { + switch ($tag['value']) { case 'table': { $cp = 0; $cs = 0; @@ -18900,8 +19243,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // convert URL to server path $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); } - } - elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + } elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { @@ -18936,7 +19278,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // further development is required for other modes. $tag['attribute']['align'] = 'bottom'; //} - switch($tag['attribute']['align']) { + switch ($tag['attribute']['align']) { case 'top': { $align = 'T'; break; @@ -18997,7 +19339,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $this->Image($imgsrc, $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); } - switch($align) { + switch ($align) { case 'T': { $this->y = $prevy; break; @@ -19440,7 +19782,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @return $dom array * @protected */ - protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { + protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney = 0) + { $tag = $dom[$key]; $parent = $dom[($dom[$key]['parent'])]; $lasttag = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value'] == 'marker'))); @@ -19481,7 +19824,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // Closing tag - switch($tag['value']) { + switch ($tag['value']) { case 'tr': { $table_el = $dom[($dom[$key]['parent'])]['parent']; if (!isset($parent['endy'])) { @@ -19570,394 +19913,394 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // closing tag used for the thead part $in_table_head = true; $this->inthead = false; - case 'table': { - $table_el = $parent; - // set default border - if (isset($table_el['attribute']['border']) AND ($table_el['attribute']['border'] > 0)) { + case 'table': { + $table_el = $parent; // set default border - $border = array('LTRB' => array('width' => $this->getCSSBorderWidth($table_el['attribute']['border']), 'cap'=>'square', 'join'=>'miter', 'dash'=> 0, 'color'=>array(0,0,0))); - } else { - $border = 0; - } - $default_border = $border; - // fix bottom line alignment of last line before page break - foreach ($dom[($dom[$key]['parent'])]['trids'] as $j => $trkey) { - // update row-spanned cells - if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { - foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { - if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] > 0)) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] = $trkey; - } - if ($dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] == $trkey) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; - } - } + if (isset($table_el['attribute']['border']) AND ($table_el['attribute']['border'] > 0)) { + // set default border + $border = array('LTRB' => array('width' => $this->getCSSBorderWidth($table_el['attribute']['border']), 'cap'=>'square', 'join'=>'miter', 'dash'=> 0, 'color'=>array(0,0,0))); + } else { + $border = 0; } - if (isset($prevtrkey) AND ($dom[$trkey]['startpage'] > $dom[$prevtrkey]['endpage'])) { - $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage']]['hk'] - $this->pagedim[$dom[$prevtrkey]['endpage']]['bm']; - $dom[$prevtrkey]['endy'] = $pgendy; + $default_border = $border; + // fix bottom line alignment of last line before page break + foreach ($dom[($dom[$key]['parent'])]['trids'] as $j => $trkey) { // update row-spanned cells if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { - if (($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] >= 0) AND ($trwsp['endpage'] == $dom[$prevtrkey]['endpage'])) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['endy'] = $pgendy; - $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] = -1; + if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] > 0)) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] = $trkey; + } + if ($dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] == $trkey) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; } } } - } - $prevtrkey = $trkey; - $table_el = $dom[($dom[$key]['parent'])]; - } - // for each row - if (count($table_el['trids']) > 0) { - unset($xmax); - } - foreach ($table_el['trids'] as $j => $trkey) { - $parent = $dom[$trkey]; - if (!isset($xmax)) { - $xmax = $parent['cellpos'][(count($parent['cellpos']) - 1)]['endx']; - } - // for each cell on the row - foreach ($parent['cellpos'] as $k => $cellpos) { - if (isset($cellpos['rowspanid']) AND ($cellpos['rowspanid'] >= 0)) { - $cellpos['startx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['startx']; - $cellpos['endx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['endx']; - $endy = $table_el['rowspans'][($cellpos['rowspanid'])]['endy']; - $startpage = $table_el['rowspans'][($cellpos['rowspanid'])]['startpage']; - $endpage = $table_el['rowspans'][($cellpos['rowspanid'])]['endpage']; - $startcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['startcolumn']; - $endcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['endcolumn']; - } else { - $endy = $parent['endy']; - $startpage = $parent['startpage']; - $endpage = $parent['endpage']; - $startcolumn = $parent['startcolumn']; - $endcolumn = $parent['endcolumn']; - } - if ($this->num_columns == 0) { - $this->num_columns = 1; - } - if (isset($cellpos['border'])) { - $border = $cellpos['border']; - } - if (isset($cellpos['bgcolor']) AND ($cellpos['bgcolor']) !== false) { - $this->SetFillColorArray($cellpos['bgcolor']); - $fill = true; - } else { - $fill = false; - } - $x = $cellpos['startx']; - $y = $parent['starty']; - $starty = $y; - $w = abs($cellpos['endx'] - $cellpos['startx']); - // get border modes - $border_start = TCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell); - $border_end = TCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell); - $border_middle = TCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell); - // design borders around HTML cells. - for ($page = $startpage; $page <= $endpage; ++$page) { // for each page - $ccode = ''; - $this->setPage($page); - if ($this->num_columns < 2) { - // single-column mode - $this->x = $x; - $this->y = $this->tMargin; - } - // account for margin changes - if ($page > $startpage) { - if (($this->rtl) AND ($this->pagedim[$page]['orm'] != $this->pagedim[$startpage]['orm'])) { - $this->x -= ($this->pagedim[$page]['orm'] - $this->pagedim[$startpage]['orm']); - } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm'] != $this->pagedim[$startpage]['olm'])) { - $this->x += ($this->pagedim[$page]['olm'] - $this->pagedim[$startpage]['olm']); + if (isset($prevtrkey) AND ($dom[$trkey]['startpage'] > $dom[$prevtrkey]['endpage'])) { + $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage']]['hk'] - $this->pagedim[$dom[$prevtrkey]['endpage']]['bm']; + $dom[$prevtrkey]['endy'] = $pgendy; + // update row-spanned cells + if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { + foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { + if (($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] >= 0) AND ($trwsp['endpage'] == $dom[$prevtrkey]['endpage'])) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['endy'] = $pgendy; + $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] = -1; + } } } - if ($startpage == $endpage) { // single page - $deltacol = 0; - $deltath = 0; - for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); - if ($startcolumn == $endcolumn) { // single column - $cborder = $border; - $h = $endy - $parent['starty']; - $this->y = $y; - $this->x = $x; - } elseif ($column == $startcolumn) { // first column - $cborder = $border_start; - $this->y = $starty; - $this->x = $x; - $h = $this->h - $this->y - $this->bMargin; - if ($this->rtl) { - $deltacol = $this->x + $this->rMargin - $this->w; - } else { - $deltacol = $this->x - $this->lMargin; - } - } elseif ($column == $endcolumn) { // end column - $cborder = $border_end; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $endy - $this->y; - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } elseif ($page == $startpage) { // first page - $deltacol = 0; - $deltath = 0; - for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column - $this->selectColumn($column); - if ($column == $startcolumn) { // first column - $cborder = $border_start; - $this->y = $starty; - $this->x = $x; - $h = $this->h - $this->y - $this->bMargin; - if ($this->rtl) { - $deltacol = $this->x + $this->rMargin - $this->w; - } else { - $deltacol = $this->x - $this->lMargin; - } - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } elseif ($page == $endpage) { // last page - $deltacol = 0; - $deltath = 0; - for ($column = 0; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); - if ($column == $endcolumn) { // end column - $cborder = $border_end; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $endy - $this->y; - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } else { // middle page - $deltacol = 0; - $deltath = 0; - for ($column = 0; $column < $this->num_columns; ++$column) { // for each column - $this->selectColumn($column); - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column + } + $prevtrkey = $trkey; + $table_el = $dom[($dom[$key]['parent'])]; + } + // for each row + if (count($table_el['trids']) > 0) { + unset($xmax); + } + foreach ($table_el['trids'] as $j => $trkey) { + $parent = $dom[$trkey]; + if (!isset($xmax)) { + $xmax = $parent['cellpos'][(count($parent['cellpos']) - 1)]['endx']; + } + // for each cell on the row + foreach ($parent['cellpos'] as $k => $cellpos) { + if (isset($cellpos['rowspanid']) AND ($cellpos['rowspanid'] >= 0)) { + $cellpos['startx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['startx']; + $cellpos['endx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['endx']; + $endy = $table_el['rowspans'][($cellpos['rowspanid'])]['endy']; + $startpage = $table_el['rowspans'][($cellpos['rowspanid'])]['startpage']; + $endpage = $table_el['rowspans'][($cellpos['rowspanid'])]['endpage']; + $startcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['startcolumn']; + $endcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['endcolumn']; + } else { + $endy = $parent['endy']; + $startpage = $parent['startpage']; + $endpage = $parent['endpage']; + $startcolumn = $parent['startcolumn']; + $endcolumn = $parent['endcolumn']; } - if (!empty($cborder) OR !empty($fill)) { - $offsetlen = strlen($ccode); - // draw border and fill - if ($this->inxobj) { - // we are inside an XObject template - if (end($this->xobjects[$this->xobjid]['transfmrk']) !== false) { - $pagemarkkey = key($this->xobjects[$this->xobjid]['transfmrk']); - $pagemark = $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey]; - $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey] += $offsetlen; - } else { - $pagemark = $this->xobjects[$this->xobjid]['intmrk']; - $this->xobjects[$this->xobjid]['intmrk'] += $offsetlen; + if ($this->num_columns == 0) { + $this->num_columns = 1; + } + if (isset($cellpos['border'])) { + $border = $cellpos['border']; + } + if (isset($cellpos['bgcolor']) AND ($cellpos['bgcolor']) !== false) { + $this->SetFillColorArray($cellpos['bgcolor']); + $fill = true; + } else { + $fill = false; + } + $x = $cellpos['startx']; + $y = $parent['starty']; + $starty = $y; + $w = abs($cellpos['endx'] - $cellpos['startx']); + // get border modes + $border_start = TCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell); + $border_end = TCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell); + $border_middle = TCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell); + // design borders around HTML cells. + for ($page = $startpage; $page <= $endpage; ++$page) { // for each page + $ccode = ''; + $this->setPage($page); + if ($this->num_columns < 2) { + // single-column mode + $this->x = $x; + $this->y = $this->tMargin; + } + // account for margin changes + if ($page > $startpage) { + if (($this->rtl) AND ($this->pagedim[$page]['orm'] != $this->pagedim[$startpage]['orm'])) { + $this->x -= ($this->pagedim[$page]['orm'] - $this->pagedim[$startpage]['orm']); + } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm'] != $this->pagedim[$startpage]['olm'])) { + $this->x += ($this->pagedim[$page]['olm'] - $this->pagedim[$startpage]['olm']); } - $pagebuff = $this->xobjects[$this->xobjid]['outdata']; - $pstart = substr($pagebuff, 0, $pagemark); - $pend = substr($pagebuff, $pagemark); - $this->xobjects[$this->xobjid]['outdata'] = $pstart.$ccode.$pend; - } else { + } + if ($startpage == $endpage) { // single page + $deltacol = 0; + $deltath = 0; + for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column + $this->selectColumn($column); + if ($startcolumn == $endcolumn) { // single column + $cborder = $border; + $h = $endy - $parent['starty']; + $this->y = $y; + $this->x = $x; + } elseif ($column == $startcolumn) { // first column + $cborder = $border_start; + $this->y = $starty; + $this->x = $x; + $h = $this->h - $this->y - $this->bMargin; + if ($this->rtl) { + $deltacol = $this->x + $this->rMargin - $this->w; + } else { + $deltacol = $this->x - $this->lMargin; + } + } elseif ($column == $endcolumn) { // end column + $cborder = $border_end; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $endy - $this->y; + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } elseif ($page == $startpage) { // first page + $deltacol = 0; + $deltath = 0; + for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column + $this->selectColumn($column); + if ($column == $startcolumn) { // first column + $cborder = $border_start; + $this->y = $starty; + $this->x = $x; + $h = $this->h - $this->y - $this->bMargin; + if ($this->rtl) { + $deltacol = $this->x + $this->rMargin - $this->w; + } else { + $deltacol = $this->x - $this->lMargin; + } + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } elseif ($page == $endpage) { // last page + $deltacol = 0; + $deltath = 0; + for ($column = 0; $column <= $endcolumn; ++$column) { // for each column + $this->selectColumn($column); + if ($column == $endcolumn) { // end column + $cborder = $border_end; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $endy - $this->y; + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } else { // middle page + $deltacol = 0; + $deltath = 0; + for ($column = 0; $column < $this->num_columns; ++$column) { // for each column + $this->selectColumn($column); + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } + if (!empty($cborder) OR !empty($fill)) { + $offsetlen = strlen($ccode); // draw border and fill - if (end($this->transfmrk[$this->page]) !== false) { - $pagemarkkey = key($this->transfmrk[$this->page]); - $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; - } elseif ($this->InFooter) { - $pagemark = $this->footerpos[$this->page]; + if ($this->inxobj) { + // we are inside an XObject template + if (end($this->xobjects[$this->xobjid]['transfmrk']) !== false) { + $pagemarkkey = key($this->xobjects[$this->xobjid]['transfmrk']); + $pagemark = $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey]; + $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey] += $offsetlen; + } else { + $pagemark = $this->xobjects[$this->xobjid]['intmrk']; + $this->xobjects[$this->xobjid]['intmrk'] += $offsetlen; + } + $pagebuff = $this->xobjects[$this->xobjid]['outdata']; + $pstart = substr($pagebuff, 0, $pagemark); + $pend = substr($pagebuff, $pagemark); + $this->xobjects[$this->xobjid]['outdata'] = $pstart.$ccode.$pend; } else { - $pagemark = $this->intmrk[$this->page]; + // draw border and fill + if (end($this->transfmrk[$this->page]) !== false) { + $pagemarkkey = key($this->transfmrk[$this->page]); + $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; + } elseif ($this->InFooter) { + $pagemark = $this->footerpos[$this->page]; + } else { + $pagemark = $this->intmrk[$this->page]; + } + $pagebuff = $this->getPageBuffer($this->page); + $pstart = substr($pagebuff, 0, $pagemark); + $pend = substr($pagebuff, $pagemark); + $this->setPageBuffer($this->page, $pstart.$ccode.$pend); } - $pagebuff = $this->getPageBuffer($this->page); - $pstart = substr($pagebuff, 0, $pagemark); - $pend = substr($pagebuff, $pagemark); - $this->setPageBuffer($this->page, $pstart.$ccode.$pend); + } + } // end for each page + // restore default border + $border = $default_border; + } // end for each cell on the row + if (isset($table_el['attribute']['cellspacing'])) { + $this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px'); + } elseif (isset($table_el['border-spacing'])) { + $this->y += $table_el['border-spacing']['V']; + } + $this->Ln(0, $cell); + $this->x = $parent['startx']; + if ($endpage > $startpage) { + if (($this->rtl) AND ($this->pagedim[$endpage]['orm'] != $this->pagedim[$startpage]['orm'])) { + $this->x += ($this->pagedim[$endpage]['orm'] - $this->pagedim[$startpage]['orm']); + } elseif ((!$this->rtl) AND ($this->pagedim[$endpage]['olm'] != $this->pagedim[$startpage]['olm'])) { + $this->x += ($this->pagedim[$endpage]['olm'] - $this->pagedim[$startpage]['olm']); + } + } + } + if (!$in_table_head) { // we are not inside a thead section + $this->cell_padding = $table_el['old_cell_padding']; + // reset row height + $this->resetLastH(); + if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { + $plendiff = ($this->pagelen[$this->numpages] - $this->emptypagemrk[$this->numpages]); + if (($plendiff > 0) AND ($plendiff < 60)) { + $pagediff = substr($this->getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff); + if (substr($pagediff, 0, 5) == 'BT /F') { + // the difference is only a font setting + $plendiff = 0; } } - } // end for each page - // restore default border - $border = $default_border; - } // end for each cell on the row - if (isset($table_el['attribute']['cellspacing'])) { - $this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px'); - } elseif (isset($table_el['border-spacing'])) { - $this->y += $table_el['border-spacing']['V']; - } - $this->Ln(0, $cell); - $this->x = $parent['startx']; - if ($endpage > $startpage) { - if (($this->rtl) AND ($this->pagedim[$endpage]['orm'] != $this->pagedim[$startpage]['orm'])) { - $this->x += ($this->pagedim[$endpage]['orm'] - $this->pagedim[$startpage]['orm']); - } elseif ((!$this->rtl) AND ($this->pagedim[$endpage]['olm'] != $this->pagedim[$startpage]['olm'])) { - $this->x += ($this->pagedim[$endpage]['olm'] - $this->pagedim[$startpage]['olm']); - } - } - } - if (!$in_table_head) { // we are not inside a thead section - $this->cell_padding = $table_el['old_cell_padding']; - // reset row height - $this->resetLastH(); - if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { - $plendiff = ($this->pagelen[$this->numpages] - $this->emptypagemrk[$this->numpages]); - if (($plendiff > 0) AND ($plendiff < 60)) { - $pagediff = substr($this->getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff); - if (substr($pagediff, 0, 5) == 'BT /F') { - // the difference is only a font setting - $plendiff = 0; + if ($plendiff == 0) { + // remove last blank page + $this->deletePage($this->numpages); } } - if ($plendiff == 0) { - // remove last blank page - $this->deletePage($this->numpages); + if (isset($this->theadMargins['top'])) { + // restore top margin + $this->tMargin = $this->theadMargins['top']; + } + if (!isset($table_el['attribute']['nested']) OR ($table_el['attribute']['nested'] != 'true')) { + // reset main table header + $this->thead = ''; + $this->theadMargins = array(); + $this->pagedim[$this->page]['tm'] = $this->tMargin; } } - if (isset($this->theadMargins['top'])) { - // restore top margin - $this->tMargin = $this->theadMargins['top']; - } - if (!isset($table_el['attribute']['nested']) OR ($table_el['attribute']['nested'] != 'true')) { - // reset main table header - $this->thead = ''; - $this->theadMargins = array(); - $this->pagedim[$this->page]['tm'] = $this->tMargin; - } + $parent = $table_el; + break; } - $parent = $table_el; - break; - } - case 'a': { - $this->HREF = array(); - break; - } - case 'sup': { - $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); - break; - } - case 'sub': { - $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); - break; - } - case 'div': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'blockquote': { - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; + case 'a': { + $this->HREF = array(); + break; } - --$this->listindentlevel; - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'p': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'pre': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - $this->premode = false; - break; - } - case 'dl': { - --$this->listnum; - if ($this->listnum <= 0) { - $this->listnum = 0; + case 'sup': { + $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); + break; + } + case 'sub': { + $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); + break; + } + case 'div': { $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - } else { - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; } - $this->resetLastH(); - break; - } - case 'dt': { - $this->lispacer = ''; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'dd': { - $this->lispacer = ''; - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; - } - --$this->listindentlevel; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'ul': - case 'ol': { - --$this->listnum; - $this->lispacer = ''; - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; - } - --$this->listindentlevel; - if ($this->listnum <= 0) { - $this->listnum = 0; + case 'blockquote': { + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - } else { - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'p': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + break; + } + case 'pre': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + $this->premode = false; + break; + } + case 'dl': { + --$this->listnum; + if ($this->listnum <= 0) { + $this->listnum = 0; + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + } else { + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + } + $this->resetLastH(); + break; + } + case 'dt': { + $this->lispacer = ''; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'dd': { + $this->lispacer = ''; + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'ul': + case 'ol': { + --$this->listnum; + $this->lispacer = ''; + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; + if ($this->listnum <= 0) { + $this->listnum = 0; + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + } else { + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + } + $this->resetLastH(); + break; + } + case 'li': { + $this->lispacer = ''; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + break; + } + // Form fields (since 4.8.000 - 2009-09-07) + case 'form': { + $this->form_action = ''; + $this->form_enctype = 'application/x-www-form-urlencoded'; + break; + } + default : { + break; } - $this->resetLastH(); - break; - } - case 'li': { - $this->lispacer = ''; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'h1': - case 'h2': - case 'h3': - case 'h4': - case 'h5': - case 'h6': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - // Form fields (since 4.8.000 - 2009-09-07) - case 'form': { - $this->form_action = ''; - $this->form_enctype = 'application/x-www-form-urlencoded'; - break; - } - default : { - break; - } } // draw border and background (if any) $this->drawHTMLTagBorder($parent, $xmax); @@ -19987,7 +20330,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $lasttag (boolean) set to true when the tag is the last. * @protected */ - protected function addHTMLVertSpace($hbz=0, $hb=0, $cell=false, $firsttag=false, $lasttag=false) { + protected function addHTMLVertSpace($hbz = 0, $hb = 0, $cell = false, $firsttag = false, $lasttag = false) + { if ($firsttag) { $this->Ln(0, $cell); $this->htmlvspace = 0; @@ -20013,7 +20357,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.7.000 (2010-08-03) */ - protected function getBorderStartPosition() { + protected function getBorderStartPosition() + { if ($this->rtl) { $xmax = $this->lMargin; } else { @@ -20029,7 +20374,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.7.000 (2010-08-03) */ - protected function drawHTMLTagBorder($tag, $xmax) { + protected function drawHTMLTagBorder($tag, $xmax) + { if (!isset($tag['borderposition'])) { // nothing to draw return; @@ -20231,7 +20577,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.0.028 (2008-09-26) */ - public function setLIsymbol($symbol='!') { + public function setLIsymbol($symbol = '!') + { // check for custom image symbol if (substr($symbol, 0, 4) == 'img|') { $this->lisymbol = $symbol; @@ -20254,7 +20601,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.000 (2008-10-29) */ - public function SetBooklet($booklet=true, $inner=-1, $outer=-1) { + public function SetBooklet($booklet = true, $inner = -1, $outer = -1) + { $this->booklet = $booklet; if ($inner >= 0) { $this->lMargin = $inner; @@ -20270,7 +20618,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.000 (2008-10-29) */ - protected function swapMargins($reverse=true) { + protected function swapMargins($reverse = true) + { if ($reverse) { // swap left and right margins $mtemp = $this->original_lMargin; @@ -20294,7 +20643,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.001 (2008-10-30) */ - public function setHtmlVSpace($tagvs) { + public function setHtmlVSpace($tagvs) + { $this->tagvspaces = $tagvs; } @@ -20304,7 +20654,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.007 (2008-11-12) */ - public function setListIndentWidth($width) { + public function setListIndentWidth($width) + { return $this->customlistindent = floatval($width); } @@ -20314,7 +20665,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.010 (2008-11-14) */ - public function setOpenCell($isopen) { + public function setOpenCell($isopen) + { $this->opencell = $isopen; } @@ -20325,7 +20677,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.4.003 (2008-12-09) */ - public function setHtmlLinksStyle($color=array(0,0,255), $fontstyle='U') { + public function setHtmlLinksStyle($color = array(0,0,255), $fontstyle = 'U') + { $this->htmlLinkColorArray = $color; $this->htmlLinkFontStyle = $fontstyle; } @@ -20340,7 +20693,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.4.004 (2008-12-10) */ - public function getHTMLUnitToUnits($htmlval, $refsize=1, $defaultunit='px', $points=false) { + public function getHTMLUnitToUnits($htmlval, $refsize = 1, $defaultunit = 'px', $points = false) + { $supportedunits = array('%', 'em', 'ex', 'px', 'in', 'cm', 'mm', 'pc', 'pt'); $retval = 0; $value = 0; @@ -20424,7 +20778,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.4.004 (2008-12-10) */ - protected function putHtmlListBullet($listdepth, $listtype='', $size=10) { + protected function putHtmlListBullet($listdepth, $listtype = '', $size = 10) + { if ($this->state != 2) { return; } @@ -20626,7 +20981,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.010 (2008-11-14) */ - protected function getGraphicVars() { + protected function getGraphicVars() + { $grapvars = array( 'FontFamily' => $this->FontFamily, 'FontStyle' => $this->FontStyle, @@ -20687,7 +21043,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.010 (2008-11-14) */ - protected function setGraphicVars($gvars, $extended=false) { + protected function setGraphicVars($gvars, $extended = false) + { if ($this->state != 2) { return; } @@ -20751,7 +21108,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Outputs the "save graphics state" operator 'q' * @protected */ - protected function _outSaveGraphicsState() { + protected function _outSaveGraphicsState() + { $this->_out('q'); } @@ -20759,7 +21117,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Outputs the "restore graphics state" operator 'Q' * @protected */ - protected function _outRestoreGraphicsState() { + protected function _outRestoreGraphicsState() + { $this->_out('Q'); } @@ -20769,7 +21128,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setBuffer($data) { + protected function setBuffer($data) + { $this->bufferlen += strlen($data); $this->buffer .= $data; } @@ -20780,7 +21140,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.5.000 (2010-06-22) */ - protected function replaceBuffer($data) { + protected function replaceBuffer($data) + { $this->bufferlen = strlen($data); $this->buffer = $data; } @@ -20791,7 +21152,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function getBuffer() { + protected function getBuffer() + { return $this->buffer; } @@ -20803,7 +21165,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setPageBuffer($page, $data, $append=false) { + protected function setPageBuffer($page, $data, $append = false) + { if ($append) { $this->pages[$page] .= $data; } else { @@ -20823,7 +21186,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function getPageBuffer($page) { + protected function getPageBuffer($page) + { if (isset($this->pages[$page])) { return $this->pages[$page]; } @@ -20838,8 +21202,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setImageBuffer($image, $data) { - if (($data['i'] = array_search($image, $this->imagekeys)) === FALSE) { + protected function setImageBuffer($image, $data) + { + if (($data['i'] = array_search($image, $this->imagekeys)) === false) { $this->imagekeys[$this->numimages] = $image; $data['i'] = $this->numimages; ++$this->numimages; @@ -20856,7 +21221,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setImageSubBuffer($image, $key, $data) { + protected function setImageSubBuffer($image, $key, $data) + { if (!isset($this->images[$image])) { $this->setImageBuffer($image, array()); } @@ -20870,7 +21236,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function getImageBuffer($image) { + protected function getImageBuffer($image) + { if (isset($this->images[$image])) { return $this->images[$image]; } @@ -20884,7 +21251,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setFontBuffer($font, $data) { + protected function setFontBuffer($font, $data) + { $this->fonts[$font] = $data; if (!in_array($font, $this->fontkeys)) { $this->fontkeys[] = $font; @@ -20903,7 +21271,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setFontSubBuffer($font, $key, $data) { + protected function setFontSubBuffer($font, $key, $data) + { if (!isset($this->fonts[$font])) { $this->setFontBuffer($font, array()); } @@ -20917,7 +21286,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function getFontBuffer($font) { + protected function getFontBuffer($font) + { if (isset($this->fonts[$font])) { return $this->fonts[$font]; } @@ -20932,7 +21302,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.000 (2009-01-02) */ - public function movePage($frompage, $topage) { + public function movePage($frompage, $topage) + { if (($frompage > $this->numpages) OR ($frompage <= $topage)) { return false; } @@ -21076,7 +21447,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $jfrompage = $frompage; $jtopage = $topage; if (preg_match_all('/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $pagenum = intval($pamatch[3][$pk]) + 1; if (($pagenum >= $jtopage) AND ($pagenum < $jfrompage)) { $newpage = ($pagenum + 1); @@ -21103,7 +21474,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.6.004 (2009-04-23) */ - public function deletePage($page) { + public function deletePage($page) + { if (($page < 1) OR ($page > $this->numpages)) { return false; } @@ -21115,7 +21487,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->bordermrk[$page]); unset($this->cntmrk[$page]); foreach ($this->pageobjects[$page] as $oid) { - if (isset($this->offsets[$oid])){ + if (isset($this->offsets[$oid])) { unset($this->offsets[$oid]); } } @@ -21196,7 +21568,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->bordermrk[$this->numpages]); unset($this->cntmrk[$this->numpages]); foreach ($this->pageobjects[$this->numpages] as $oid) { - if (isset($this->offsets[$oid])){ + if (isset($this->offsets[$oid])) { unset($this->offsets[$oid]); } } @@ -21264,7 +21636,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // adjust javascript $jpage = $page; if (preg_match_all('/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $pagenum = intval($pamatch[3][$pk]) + 1; if ($pagenum >= $jpage) { $newpage = ($pagenum - 1); @@ -21293,7 +21665,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.015 (2010-04-20) */ - public function copyPage($page=0) { + public function copyPage($page = 0) + { if ($page == 0) { // default value $page = $this->page; @@ -21370,7 +21743,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.5.000 (2009-01-02) * @see addTOCPage(), endTOCPage(), addHTMLTOC() */ - public function addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { + public function addTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0,0,0)) + { $fontsize = $this->FontSizePt; $fontfamily = $this->FontFamily; $fontstyle = $this->FontStyle; @@ -21580,7 +21954,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.001 (2010-05-06) * @see addTOCPage(), endTOCPage(), addTOC() */ - public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0,0,0)) { + public function addHTMLTOC($page = '', $toc_name = 'TOC', $templates = array(), $correct_align = true, $style = '', $color = array(0,0,0)) + { $filler = ' '; $prev_htmlLinkColorArray = $this->htmlLinkColorArray; $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle; @@ -21713,7 +22088,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function startTransaction() { + public function startTransaction() + { if (isset($this->objcopy)) { // remove previous copy $this->commitTransaction(); @@ -21730,7 +22106,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function commitTransaction() { + public function commitTransaction() + { if (isset($this->objcopy)) { $this->objcopy->_destroy(true, true); unset($this->objcopy); @@ -21744,7 +22121,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function rollbackTransaction($self=false) { + public function rollbackTransaction($self = false) + { if (isset($this->objcopy)) { $this->_destroy(true, true); if ($self) { @@ -21768,7 +22146,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function setEqualColumns($numcols=0, $width=0, $y='') { + public function setEqualColumns($numcols = 0, $width = 0, $y = '') + { $this->columns = array(); if ($numcols < 2) { $numcols = 0; @@ -21800,7 +22179,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.072 (2011-04-26) */ - public function resetColumns() { + public function resetColumns() + { $this->lMargin = $this->original_lMargin; $this->rMargin = $this->original_rMargin; $this->setEqualColumns(); @@ -21813,7 +22193,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function setColumnsArray($columns) { + public function setColumnsArray($columns) + { $this->columns = $columns; $this->num_columns = count($columns); $this->current_column = 0; @@ -21827,7 +22208,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function selectColumn($col='') { + public function selectColumn($col = '') + { if (is_string($col)) { $col = $this->current_column; } elseif ($col >= $this->num_columns) { @@ -21906,7 +22288,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.5.011 (2010-07-08) */ - public function getColumn() { + public function getColumn() + { return $this->current_column; } @@ -21916,7 +22299,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.018 (2010-08-25) */ - public function getNumberOfColumns() { + public function getNumberOfColumns() + { return $this->num_columns; } @@ -21928,7 +22312,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.008 (2009-04-02) */ - public function setTextRenderingMode($stroke=0, $fill=true, $clip=false) { + public function setTextRenderingMode($stroke = 0, $fill = true, $clip = false) + { // Ref.: PDF 32000-1:2008 - 9.3.6 Text Rendering Mode // convert text rendering parameters if ($stroke < 0) { @@ -21983,7 +22368,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.174 (2012-07-25) * @public */ - public function setTextShadow($params=array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal')) { + public function setTextShadow($params = array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal')) + { if (isset($params['enabled'])) { $this->txtshadow['enabled'] = $params['enabled']?true:false; } else { @@ -22025,7 +22411,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.174 (2012-07-25) * @public */ - public function getTextShadow() { + public function getTextShadow() + { return $this->txtshadow; } @@ -22043,7 +22430,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.9.012 (2010-04-12) * @protected */ - protected function hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) { + protected function hyphenateWord($word, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) + { $hyphenword = array(); // hyphens positions $numchars = count($word); if ($numchars <= $charmin) { @@ -22123,7 +22511,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.9.012 (2010-04-12) * @public */ - public function hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) { + public function hyphenateText($text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) + { $text = $this->unhtmlentities($text); $word = array(); // last word $txtarr = array(); // text to be returned @@ -22187,7 +22576,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.0.000 (2010-04-27) */ - public function setRasterizeVectorImages($mode) { + public function setRasterizeVectorImages($mode) + { $this->rasterize_vector_images = $mode; } @@ -22198,7 +22588,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.3.002 (2010-06-07) */ - public function setFontSubsetting($enable=true) { + public function setFontSubsetting($enable = true) + { if ($this->pdfa_mode) { $this->font_subsetting = false; } else { @@ -22213,7 +22604,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.3.002 (2010-06-07) */ - public function getFontSubsetting() { + public function getFontSubsetting() + { return $this->font_subsetting; } @@ -22226,7 +22618,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringLeftTrim($str, $replace='') { + public function stringLeftTrim($str, $replace = '') + { return preg_replace('/^'.$this->re_space['p'].'+/'.$this->re_space['m'], $replace, $str); } @@ -22239,7 +22632,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringRightTrim($str, $replace='') { + public function stringRightTrim($str, $replace = '') + { return preg_replace('/'.$this->re_space['p'].'+$/'.$this->re_space['m'], $replace, $str); } @@ -22252,7 +22646,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringTrim($str, $replace='') { + public function stringTrim($str, $replace = '') + { $str = $this->stringLeftTrim($str, $replace); $str = $this->stringRightTrim($str, $replace); return $str; @@ -22265,7 +22660,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.002 (2010-08-14) */ - public function isUnicodeFont() { + public function isUnicodeFont() + { return (($this->CurrentFont['type'] == 'TrueTypeUnicode') OR ($this->CurrentFont['type'] == 'cidfont0')); } @@ -22277,7 +22673,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.004 (2010-08-17) */ - public function getFontFamilyName($fontfamily) { + public function getFontFamilyName($fontfamily) + { // remove spaces and symbols $fontfamily = preg_replace('/[^a-z0-9_\,]/', '', strtolower($fontfamily)); // extract all font names @@ -22321,7 +22718,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see endTemplate(), printTemplate() */ - public function startTemplate($w=0, $h=0, $group=false) { + public function startTemplate($w = 0, $h = 0, $group = false) + { if ($this->inxobj) { // we are already inside an XObject template return false; @@ -22386,7 +22784,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see startTemplate(), printTemplate() */ - public function endTemplate() { + public function endTemplate() + { if (!$this->inxobj) { // we are not inside a template return false; @@ -22415,7 +22814,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see startTemplate(), endTemplate() */ - public function printTemplate($id, $x='', $y='', $w=0, $h=0, $align='', $palign='', $fitonpage=false) { + public function printTemplate($id, $x = '', $y = '', $w = 0, $h = 0, $align = '', $palign = '', $fitonpage = false) + { if ($this->state != 2) { return; } @@ -22515,7 +22915,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T': { $this->y = $y; $this->x = $rb_x; @@ -22548,7 +22948,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function setFontStretching($perc=100) { + public function setFontStretching($perc = 100) + { $this->font_stretching = $perc; } @@ -22559,7 +22960,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function getFontStretching() { + public function getFontStretching() + { return $this->font_stretching; } @@ -22570,7 +22972,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function setFontSpacing($spacing=0) { + public function setFontSpacing($spacing = 0) + { $this->font_spacing = $spacing; } @@ -22581,7 +22984,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function getFontSpacing() { + public function getFontSpacing() + { return $this->font_spacing; } @@ -22593,7 +22997,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), addPageRegion() */ - public function getPageRegions() { + public function getPageRegions() + { return $this->page_regions; } @@ -22608,7 +23013,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see addPageRegion(), getPageRegions() */ - public function setPageRegions($regions=array()) { + public function setPageRegions($regions = array()) + { // empty current regions array $this->page_regions = array(); // add regions @@ -22628,7 +23034,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), getPageRegions() */ - public function addPageRegion($region) { + public function addPageRegion($region) + { if (!isset($region['page']) OR empty($region['page'])) { $region['page'] = $this->page; } @@ -22647,7 +23054,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), getPageRegions() */ - public function removePageRegion($key) { + public function removePageRegion($key) + { if (isset($this->page_regions[$key])) { unset($this->page_regions[$key]); } @@ -22665,7 +23073,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.9.003 (2010-10-13) */ - protected function checkPageRegions($h, $x, $y) { + protected function checkPageRegions($h, $x, $y) + { // set default values if ($x === '') { $x = $this->x; @@ -22768,7 +23177,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @public */ - public function ImageSVG($file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false) { + public function ImageSVG($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false) + { if ($this->state != 2) { return; } @@ -22794,7 +23204,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svgdir = dirname($file); $svgdata = TCPDF_STATIC::fileGetContents($file); } - if ($svgdata === FALSE) { + if ($svgdata === false) { $this->Error('SVG file not found: '.$file); } if ($x === '') { @@ -23039,7 +23449,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -23089,7 +23499,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.0.000 (2010-05-02) */ - protected function convertSVGtMatrix($tm) { + protected function convertSVGtMatrix($tm) + { $a = $tm[0]; $b = -$tm[1]; $c = -$tm[2]; @@ -23109,7 +23520,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.0.000 (2010-05-02) */ - protected function SVGTransform($tm) { + protected function SVGTransform($tm) + { $this->Transform($this->convertSVGtMatrix($tm)); } @@ -23128,7 +23540,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function='', $clip_params=array()) { + protected function setSVGStyles($svgstyle, $prevsvgstyle, $x = 0, $y = 0, $w = 1, $h = 1, $clip_function = '', $clip_params = array()) + { if ($this->state != 2) { return; } @@ -23243,7 +23656,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $gradient['coords'][3] = (($gradient['coords'][3] - $y) / $h); $gradient['coords'][4] /= $w; } elseif ($gradient['mode'] == 'percentage') { - foreach($gradient['coords'] as $key => $val) { + foreach ($gradient['coords'] as $key => $val) { $gradient['coords'][$key] = (intval($val) / 100); if ($val < 0) { $gradient['coords'][$key] = 0; @@ -23409,21 +23822,22 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Draws an SVG path * @param $d (string) attribute d of the path SVG element * @param $style (string) Style of rendering. Possible values are: - *
        - *
      • D or empty string: Draw (default).
      • - *
      • F: Fill.
      • - *
      • F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
      • - *
      • DF or FD: Draw and fill.
      • - *
      • DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
      • - *
      • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
      • - *
      • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
      • - *
      + *
        + *
      • D or empty string: Draw (default).
      • + *
      • F: Fill.
      • + *
      • F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
      • + *
      • DF or FD: Draw and fill.
      • + *
      • DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
      • + *
      • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
      • + *
      • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
      • + *
      * @return array of container box measures (x, y, w, h) * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected */ - protected function SVGPath($d, $style='') { + protected function SVGPath($d, $style = '') + { if ($this->state != 2) { return; } @@ -23714,7 +24128,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2))); } - if ($fa == $fs){ + if ($fa == $fs) { $root *= -1; } $cax = $root * (($rx * $ya) / $ry); @@ -23780,8 +24194,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $name (string) Tag name * @protected */ - protected function removeTagNamespace($name) { - if(strpos($name, ':') !== false) { + protected function removeTagNamespace($name) + { + if (strpos($name, ':') !== false) { $parts = explode(':', $name); return $parts[(sizeof($parts) - 1)]; } @@ -23798,7 +24213,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array()) { + protected function startSVGElementHandler($parser, $name, $attribs, $ctm = array()) + { $name = $this->removeTagNamespace($name); // check if we are in clip mode if ($this->svgclipmode) { @@ -23811,7 +24227,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs); return; } - if (end($this->svgdefs) !== FALSE) { + if (end($this->svgdefs) !== false) { $last_svgdefs_id = key($this->svgdefs); if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) { $attribs['id'] = 'DF_'.(count($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements']) + 1); @@ -23827,7 +24243,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $clipping = true; } // get styling properties - $prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; // previous style + $prev_svgstyle = $this->svgstyles[max(0, (count($this->svgstyles) - 1))]; // previous style $svgstyle = $this->svgstyles[0]; // set default style if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) { // default fill attribute for clipping @@ -23877,7 +24293,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $invisible = true; } // process tag - switch($name) { + switch ($name) { case 'defs': { $this->svgdefsmode = true; break; @@ -23898,7 +24314,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } case 'svg': { // start of SVG object - if(++$this->svg_tag_depth <= 1) { + if (++$this->svg_tag_depth <= 1) { break; } // inner SVG @@ -23934,7 +24350,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $aspectY = 'YMid'; $fit = 'meet'; if (isset($attribs['preserveAspectRatio'])) { - if($attribs['preserveAspectRatio'] == 'none') { + if ($attribs['preserveAspectRatio'] == 'none') { $fit = 'none'; } else { preg_match_all('/[a-zA-Z]+/', $attribs['preserveAspectRatio'], $tmp); @@ -24430,7 +24846,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } if (!empty($use['attribs']['style'])) { // merge styles - $attribs['style'] = str_replace(';;',';',';'.$use['attribs']['style'].$attribs['style']); + $attribs['style'] = str_replace(';;', ';', ';'.$use['attribs']['style'].$attribs['style']); } $attribs = array_merge($use['attribs'], $attribs); $this->startSVGElementHandler($parser, $use['name'], $attribs); @@ -24447,7 +24863,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (!empty($attribs['child_elements'])) { $child_elements = $attribs['child_elements']; unset($attribs['child_elements']); - foreach($child_elements as $child_element) { + foreach ($child_elements as $child_element) { if (empty($child_element['attribs']['closing_tag'])) { $this->startSVGElementHandler('child-tag', $child_element['name'], $child_element['attribs']); } else { @@ -24468,27 +24884,28 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function endSVGElementHandler($parser, $name) { + protected function endSVGElementHandler($parser, $name) + { $name = $this->removeTagNamespace($name); if ($this->svgdefsmode AND !in_array($name, array('defs', 'clipPath', 'linearGradient', 'radialGradient', 'stop'))) {; - if (end($this->svgdefs) !== FALSE) { + if (end($this->svgdefs) !== false) { $last_svgdefs_id = key($this->svgdefs); if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) { - foreach($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'] as $child_element) { + foreach ($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'] as $child_element) { if (isset($child_element['attribs']['id']) AND ($child_element['name'] == $name)) { - $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$child_element['attribs']['id'].'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE, 'content' => $this->svgtext)); + $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$child_element['attribs']['id'].'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => true, 'content' => $this->svgtext)); return; } } if ($this->svgdefs[$last_svgdefs_id]['name'] == $name) { - $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$last_svgdefs_id.'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE, 'content' => $this->svgtext)); + $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$last_svgdefs_id.'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => true, 'content' => $this->svgtext)); return; } } } return; } - switch($name) { + switch ($name) { case 'defs': { $this->svgdefsmode = false; break; @@ -24575,12 +24992,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function segSVGContentHandler($parser, $data) { + protected function segSVGContentHandler($parser, $data) + { $this->svgtext .= $data; } // --- END SVG METHODS ----------------------------------------------------- - } // END OF TCPDF CLASS //============================================================+ diff --git a/htdocs/install/default.css b/htdocs/install/default.css index d18e54c0c1c..e7bbe6c7771 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -32,6 +32,10 @@ vertical-align: middle; } +.right { + text-align: right; +} + .opacitymedium { opacity: 0.5; } diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index cbf3c8fadc5..03261a5fe62 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -245,3 +245,9 @@ create table llx_inventory_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); + + +ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); + +ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation; + diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index aed803cc7ea..d9713b66d38 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -42,6 +42,7 @@ create table llx_bank_account country_iban varchar(2), -- deprecated cle_iban varchar(2), domiciliation varchar(255), + pti_in_ctti smallint DEFAULT 0, state_id integer DEFAULT NULL, fk_pays integer NOT NULL, proprio varchar(60), diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index 7989f80cf58..8de59edcb77 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -26,11 +26,11 @@ create table llx_reception ref varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - fk_projet integer DEFAULT NULL, + fk_projet integer DEFAULT NULL, ref_ext varchar(30), -- reference into an external system (not used by dolibarr) - ref_int varchar(30), -- reference into an internal system (deprecated) - ref_supplier varchar(30), -- customer number + ref_int varchar(30), -- reference into an internal system (deprecated) + ref_supplier varchar(128), -- supplier number date_creation datetime, -- date de creation fk_user_author integer, -- author of creation @@ -38,7 +38,7 @@ create table llx_reception date_valid datetime, -- date de validation fk_user_valid integer, -- valideur date_delivery datetime DEFAULT NULL, -- date planned of delivery - date_reception datetime, + date_reception datetime, fk_shipping_method integer, tracking_number varchar(50), fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option diff --git a/htdocs/install/mysql/tables/llx_website-website.sql b/htdocs/install/mysql/tables/llx_website.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website-website.sql rename to htdocs/install/mysql/tables/llx_website.sql diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index e58ae528f97..25dd1ee84fd 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -235,8 +235,12 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Force l'affichage de la progression if ($ok) { - print '
    '; + print ''; + print '
    '.$langs->trans("PleaseBePatient").'
    '.$langs->trans("PleaseBePatient").'
    '; + flush(); + + print ''; } @@ -355,7 +359,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Scan if there is migration scripts that depends of Dolibarr version - // for modules htdocs/module/sql or htdocs/custom/module/sql (files called "dolibarr_x.y.z-a.b.c.sql") + // for modules htdocs/module/sql or htdocs/custom/module/sql (files called "dolibarr_x.y.z-a.b.c.sql" or "dolibarr_always.sql") $modulesfile = array(); foreach ($conf->file->dol_document_root as $type => $dirroot) { $handlemodule = @opendir($dirroot); // $dirroot may be '..' @@ -366,6 +370,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (is_file($dirroot.'/'.$filemodule.'/sql/dolibarr_'.$file)) { $modulesfile[$dirroot.'/'.$filemodule.'/sql/dolibarr_'.$file] = '/'.$filemodule.'/sql/dolibarr_'.$file; } + if (is_file($dirroot.'/'.$filemodule.'/sql/dolibarr_allversions.sql')) { + $modulesfile[$dirroot.'/'.$filemodule.'/sql/dolibarr_allversions.sql'] = '/'.$filemodule.'/sql/dolibarr_allversions.sql'; + } } } closedir($handlemodule); @@ -398,6 +405,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } } + if (empty($actiondone)) { print '
    '.$langs->trans("ErrorWrongParameters").'
    '; } diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 2fcf05a4393..91f127b0057 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -184,9 +184,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '."\n"; // Common attributes diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index f066877f676..2fc54eeceb3 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -182,3 +182,5 @@ IfYouDontReconcileDisableProperty=If you don't make the bank reconciliations on NoBankAccountDefined=No bank account defined NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled. AlreadyOneBankAccount=Already one bank account defined +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=SEPA XML: PaymentTypeInformation is mandatory and can now be placed at CreditTransferTransactionInformation level (instead of Payment level). We strongly recommend to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 093813f5776..9a9da452a44 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -97,15 +97,15 @@ function testSqlAndScriptInject($val, $type) //$val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $val); // Sometimes we have entities without the ; at end so html_entity_decode does not work but entities is still interpreted by browser. $val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { return realCharForNumericEntities($m); }, $val); + + // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) + // We should use dol_string_nounprintableascii but function is not yet loaded/available + $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace + // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) + $val = preg_replace('//', '', $val); } while ($oldval != $val); //print "after decoding $val\n"; - // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) - // We should use dol_string_nounprintableascii but function is not yet loaded/available - $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace - // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) - $val = preg_replace('//', '', $val); - $inj = 0; // For SQL Injection (only GET are used to scan for such injection strings) if ($type == 1 || $type == 3) { @@ -149,7 +149,7 @@ function testSqlAndScriptInject($val, $type) // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $val); - $inj += preg_match('/on(dblclick|drop|durationchange|emptied|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val); + $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val); @@ -158,8 +158,8 @@ function testSqlAndScriptInject($val, $type) $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like - $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); - $inj += preg_match('/on(dblclick|drop|durationchange|emptied|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); + $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); + $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval); @@ -533,7 +533,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings'); - if (isset($_POST['id'])) $savid = ((int) $_POST['id']); + $savid = null; + if (isset($_POST['id'])) { + $savid = ((int) $_POST['id']); + } unset($_POST); //unset($_POST['action']); unset($_POST['massaction']); //unset($_POST['confirm']); unset($_POST['confirmmassaction']); @@ -541,7 +544,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( unset($_GET['action']); unset($_GET['confirmmassaction']); unset($_GET['massaction']); - if (isset($savid)) $_POST['id'] = ((int) $savid); + unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ? + if (isset($savid)) { + $_POST['id'] = ((int) $savid); + } } // Note: There is another CSRF protection into the filefunc.inc.php diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 30c85197337..94330eb8dc1 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -64,7 +64,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { } if ($action == 'remises') { - if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); @@ -72,7 +72,7 @@ if ($action == 'remises') { } if ($action == 'typemarges') { - if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); @@ -80,7 +80,7 @@ if ($action == 'typemarges') { } if ($action == 'contact') { - if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); diff --git a/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql b/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql new file mode 100644 index 00000000000..5026bb4f5d8 --- /dev/null +++ b/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql @@ -0,0 +1,3 @@ +-- +-- Script run when an upgrade of Dolibarr is done. Whatever is the Dolibarr version. +-- diff --git a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql index 4ab8b39d548..2988bd71202 100644 --- a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql +++ b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql @@ -1,14 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- -- --- 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 --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. +-- Script run to make a migration of module version x.x.x to module version y.y.y -- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. + \ No newline at end of file diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 3f822679350..bc018a2dda1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -137,18 +137,18 @@ if (empty($reshook)) { if (GETPOST('ajoutcomment')) { $error = 0; - if (!GETPOST('comment')) { + if (!GETPOST('comment', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - if (!GETPOST('commentuser')) { + if (!GETPOST('commentuser', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); } if (!$error) { - $comment = (string) GETPOST("comment", "restricthtml"); - $comment_user = (string) GETPOST('commentuser', "restricthtml"); + $comment = (string) GETPOST("comment", "alphanohtml"); + $comment_user = (string) GETPOST('commentuser', "alphanohtml"); $resql = $object->addComment($comment, $comment_user); @@ -422,7 +422,7 @@ print '
    '; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
    '; print '
    '."\n"; - print $langs->trans("Name").': '."\n"; + print $langs->trans("Name").': '."\n"; print '
    '."\n"; } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index e37f9bf3de5..5b564f617fd 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -103,13 +103,13 @@ $testmodifier = false; $testligneamodifier = false; $ligneamodifier = -1; for ($i = 0; $i < $nblines; $i++) { - if (isset($_POST['modifierligne'.$i])) { + if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; $testligneamodifier = true; } //test pour voir si une ligne est a modifier - if (isset($_POST['validermodifier'.$i])) { + if (GETPOSTISSET('validermodifier'.$i)) { $modifier = $i; $testmodifier = true; } @@ -153,7 +153,7 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format = //on rajoute la valeur a la fin de tous les sujets deja entrés $nouveauxsujets .= ','; - $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(empty($_POST["typecolonne"]) ? '' : '@'.GETPOST("typecolonne")); + $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(!GETPOST("typecolonne") ? '' : '@'.GETPOST("typecolonne")); //mise a jour avec les nouveaux sujets dans la base $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 817f3d88139..762770acee6 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -51,7 +51,8 @@ if (GETPOST('confirmation')) { for ($i = 0; $i < $nbofchoice; $i++) { // Show hours choices for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; $tmphorairesi = GETPOST('horaires'.$i, 'array'); @@ -248,7 +249,8 @@ if (issetAndNoEmpty('moisavant_x') || issetAndNoEmpty('moisavant')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -269,7 +271,8 @@ if (issetAndNoEmpty('moisapres_x') || issetAndNoEmpty('moisapres')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -285,7 +288,8 @@ if (issetAndNoEmpty('anneeavant_x') || issetAndNoEmpty('anneeavant')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -301,7 +305,8 @@ if (issetAndNoEmpty('anneeapres_x') || issetAndNoEmpty('anneeapres')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -365,7 +370,8 @@ if (issetAndNoEmpty('choixjourajout')) { if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('choixjourajout') === true) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])) { + $choixjourajout = GETPOST("choixjourajout"); + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) { $journeuf = false; } } @@ -373,15 +379,17 @@ if (issetAndNoEmpty('choixjourajout')) { // Si le test est passé, alors on insere la valeur dans la variable de session qui contient les dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { - array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])); + $choixjourajout = GETPOST("choixjourajout"); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])); sort($_SESSION["totalchoixjour"]); - $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { + $horairesi = GETPOST("horaires".$i); for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { if (issetAndNoEmpty('horaires'.$i) === true && issetAndNoEmpty($i, $_POST['horaires'.$i]) === true) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -391,7 +399,8 @@ if (issetAndNoEmpty('choixjourajout')) { $k = $i + 1; if (issetAndNoEmpty('horaires'.$i) === true && issetAndNoEmpty($i, $_POST['horaires'.$i]) === true) { for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$k"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -407,12 +416,14 @@ if (issetAndNoEmpty('choixjourretrait')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } for ($i = 0; $i < $nbofchoice; $i++) { - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourretrait"][0], $_SESSION["annee"])) { + $choixjourretrait = GETPOST('choixjourretrait'); + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) { for ($j = $i; $j < $nbofchoice; $j++) { $k = $j + 1; $_SESSION["horaires$j"] = $_SESSION["horaires$k"]; @@ -425,7 +436,7 @@ if (issetAndNoEmpty('choixjourretrait')) { //report des horaires dans toutes les cases if (issetAndNoEmpty('reporterhoraires')) { - $_SESSION["horaires0"] = $_POST["horaires0"]; + $_SESSION["horaires0"] = GETPOST("horaires0"); $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { $j = $i + 1; diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 6afb9c88912..c460024be0f 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -273,9 +273,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '."\n"; // Common attributes diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 23473545b11..b71047a5f47 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -196,9 +196,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '."\n"; // Common attributes diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f522e61bec2..3d16b6bac7c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -496,8 +496,8 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans("Save")) { if ((!GETPOST("sellby")) && (!GETPOST("eatby")) && (!$batchnumber)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors'); } else { - $d_eatby = dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); - $d_sellby = dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $d_eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); + $d_sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); $pdluo->batch = $batchnumber; $pdluo->eatby = $d_eatby; $pdluo->sellby = $d_sellby; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index cbf7c901b37..eb6084e5f22 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -386,9 +386,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '."\n"; // Common attributes diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 8238d112b7b..c8af7348716 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -196,7 +196,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') } if ($action == 'addtime' && $user->rights->projet->lire) { - $timetoadd = $_POST['task']; + $timetoadd = GETPOST('task'); if (empty($timetoadd)) { setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors'); } else { diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 763ecefe650..6cb4a8600fc 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -257,7 +257,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') } if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields') { - $timetoadd = $_POST['task']; + $timetoadd = GETPOST('task'); if (empty($timetoadd)) { setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors'); } else { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b19bc407537..54cb72f744e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -821,12 +821,12 @@ $includeonly = ''; if (empty($user->rights->user->user->lire)) { $includeonly = array($user->id); } -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250'); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; $moreforfilter .= '
    '; $tmptitle = $langs->trans('ProjectsWithThisContact'); -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
    '; // If the user can view thirdparties other than his' @@ -834,7 +834,7 @@ if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
    '; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
    '; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 64d134a7254..310857e24cc 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -303,8 +303,6 @@ if ($action == 'createtask' && $user->rights->projet->creer) { $error = 0; // If we use user timezone, we must change also view/list to use user timezone everywhere - //$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); - //$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); $date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); $date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int')); @@ -318,7 +316,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; $error++; - } elseif (empty($_POST['task_parent'])) { + } elseif (!GETPOST('task_parent')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ChildOfProjectTask")), null, 'errors'); $action = 'create'; $error++; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 155cb261040..c57610d0130 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -74,7 +74,7 @@ $socid = 0; restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); -$permissiontoadd = $$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->rights->projet->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php /* diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8e773f92788..19be96cc558 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -91,7 +91,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { if (!$error) { $object->oldcopy = clone $object; - $tmparray = explode('_', $_POST['task_parent']); + $tmparray = explode('_', GETPOST('task_parent')); $task_parent = $tmparray[1]; if (empty($task_parent)) { $task_parent = 0; // If task_parent is '' diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index bc6ec7d15cf..ef8ac6aa9df 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -659,9 +659,10 @@ if ($action == 'confirm_generateinter') { if (!$error) { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent + // Get userid, timespent $object->fetchTimeSpent($value); // $object->id is the task id + $arrayoftasks[$object->timespent_id]['id'] = $object->id; $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; @@ -670,7 +671,7 @@ if ($action == 'confirm_generateinter') { foreach ($arrayoftasks as $timespent_id => $value) { $ftask = new Task($db); - $ftask->fetch($object->id); + $ftask->fetch($value['id']); // Define qty per hour $qtyhour = $value['timespent'] / 3600; $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); @@ -1433,12 +1434,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Note print ''; // Duration - Time spent print '
    '; - print ''; + print ''; print ''; - $durationtouse = ($_POST['timespent_duration'] ? $_POST['timespent_duration'] : ''); + $durationtouse = (GETPOST('timespent_duration') ? GETPOST('timespent_duration') : ''); if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) { $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 94ee0bb00b2..49bde1a2b9b 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -212,7 +212,7 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') { // Action run when we click o // If we disable modules using personalized list foreach ($modules as $val) { $modulekeyname = strtolower($val->name); - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) { + if (!GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) { $disablestring .= $modulekeyname.','; if ($modulekeyname == 'propale') { $disablestring .= 'propal,'; diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 42cde055ac2..a1c9efed6c3 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -79,8 +79,8 @@ if (GETPOST('ajoutcomment', 'alpha')) { $error = 0; - $comment = GETPOST("comment", 'restricthtml'); - $comment_user = GETPOST('commentuser', 'nohtml'); + $comment = GETPOST("comment", 'alphanohtml'); + $comment_user = GETPOST('commentuser', 'alphanohtml'); if (!$comment) { $error++; @@ -202,7 +202,6 @@ for ($i = 0; $i < $nblines; $i++) { } if ($testmodifier) { - //var_dump($_POST);exit; $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') { @@ -781,9 +780,9 @@ if ($comments) { if ($object->allow_comments) { print '
    '.$langs->trans("AddACommentForPoll")."
    \n"; - print '
    '."\n"; + print '
    '."\n"; print $langs->trans("Name").': '; - print '   '."\n"; + print '   '."\n"; print '
    '."\n"; print ''."\n"; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index f2b72693a13..51424d9277e 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -126,7 +126,7 @@ if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alph $upload_dir_tmp = $vardir.'/temp/'.session_id(); // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0, 0); + dol_remove_file_process(GETPOST('removedfile'), 0, 0); $action = 'create_ticket'; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 2d7c46e0c85..93140b88ef5 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -323,7 +323,6 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - //var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit; //reception line for product with no batch management and no multiple stock location if (GETPOST($qty, 'alpha') > 0) { $totalqty += price2num(GETPOST($qty, 'alpha'), 'MS'); @@ -335,7 +334,6 @@ if (empty($reshook)) { if ($totalqty > 0) { // There is at least one thing to ship - //var_dump($_POST);exit; for ($i = 1; $i <= $num; $i++) { $lineToTest = ''; $lineId = GETPOST($idl, 'int'); @@ -466,7 +464,6 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); }*/ } elseif ($action == 'setdate_livraison' && $permissiontoadd) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); @@ -956,10 +953,10 @@ if ($action == 'create') { $ent = 'entrepot_' . $paramSuffix; $pu = 'pu_' . $paramSuffix; $lot = 'lot_number_' . $paramSuffix; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$paramSuffix.'month'], $_POST['dluo_'.$paramSuffix.'day'], $_POST['dluo_'.$paramSuffix.'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$paramSuffix.'month'], $_POST['dlc_'.$paramSuffix.'day'], $_POST['dlc_'.$paramSuffix.'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$paramSuffix.'month', 'int'), GETPOST('dluo_'.$paramSuffix.'day', 'int'), GETPOST('dluo_'.$paramSuffix.'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$paramSuffix.'month', 'int'), GETPOST('dlc_'.$paramSuffix.'day', 'int'), GETPOST('dlc_'.$paramSuffix.'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page, it means that post was sent but an error occured diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index ac6fc37591a..42145f66c43 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -325,9 +325,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print ''."\n"; // Common attributes diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 221e5cf2c0e..cfca26efca4 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -87,7 +87,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num($_POST[$key]); + $amounts[$other_chid] = price2num(GETPOST($key)); } } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 236551c1c2e..55161f42e09 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -626,7 +626,7 @@ foreach ($dirsociete as $dirroot) { // Preview print '\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 75818a34f72..897a372dc27 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -156,7 +156,7 @@ if (empty($reshook)) { $action = ''; } - if ($action == 'update_customer_price_confirm' && !$_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + if ($action == 'update_customer_price_confirm' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) { $prodcustprice->fetch(GETPOST('lineid', 'int')); $update_child_soc = GETPOST('updatechildprice'); diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 82d815f0ac4..df10c0d4bf9 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -111,13 +111,6 @@ if ($action == 'addcontact' && $user->rights->societe->creer) { dol_print_error($db); } } -/* -elseif ($action == 'setaddress' && $user->rights->societe->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a5837c2557f..b66dfc94ed6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -244,7 +244,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'))); if ($result < 0) { dol_print_error($db, $object->error); } @@ -895,7 +895,7 @@ if (empty($reshook)) { if (!empty($productid)) { $productsupplier = new ProductFournisseur($db); if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) { - if ($productid > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), $productid, 'none', GETPOST('socid', 'int')) < 0) { + if ($productid > 0 && $productsupplier->get_buyprice(0, price2num(GETPOST('qty')), $productid, 'none', GETPOST('socid', 'int')) < 0) { setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings'); } } @@ -1007,7 +1007,7 @@ if (empty($reshook)) { $object->setProject(GETPOST('projectid'), 'int'); } elseif ($action == 'setavailability' && $usercancreate) { // Delivery delay - $result = $object->availability($_POST['availability_id']); + $result = $object->availability(GETPOST('availability_id')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payments $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d3bb10b4929..74807d8f216 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -223,7 +223,7 @@ input { padding-left: 5px; } select { - padding-top: 5px; + padding-top: 4px; padding-right: 4px; padding-bottom: 5px; padding-left: 2px; @@ -550,6 +550,13 @@ div#moretabsList, div#moretabsListaction { hr { border: 0; border-top: 1px solid #ccc; } .tabBar hr { margin-top: 20px; margin-bottom: 17px; } + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} + .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { margin-bottom: 3px; @@ -3495,11 +3502,10 @@ table.border, table.bordernooddeven, table.dataTable, .table-border, .table-bord table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 22px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 22px; + height: 28px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { @@ -3507,17 +3513,15 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border } div .tdtop { vertical-align: top !important; - /*padding-top: 10px !important; - padding-bottom: 2px !important; */ } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 5px 2px 5px 2px; + padding: 2px 2px 2px 2px; border-collapse: collapse; } div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd, div.tabBar div.border div div.tagtd { - padding-top: 5px; + padding-top: 2px; border-bottom: 1px solid #E0E0E0; } @@ -7409,7 +7413,7 @@ div.clipboardCPValue.hidewithsize { } #divbodywebsite { - word-break: break-all; + word-break: break-word; } .websiteselectionsection { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9fbcb48c32f..11e15869f45 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -730,6 +730,14 @@ div#moretabsList, div#moretabsListaction { } hr { border: 0; border-top: 1px solid #ccc; } +.tabBar hr { margin-top: 20px; margin-bottom: 17px; } + + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { border-color: #c5c5c5; @@ -3564,15 +3572,14 @@ table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 26px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 26px; + height: 28px; } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 4px 4px 4px 4px; + padding: 3px 4px 3px 4px; border: 1px solid #f0f0f0; border-collapse: collapse; } @@ -7230,7 +7237,7 @@ div.clipboardCPValue.hidewithsize { } #divbodywebsite { - word-break: break-all; + word-break: break-word; } .websiteselectionsection { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f9b92d36d72..de1ca3a5d92 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -402,12 +402,14 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); - $object->login = GETPOST("login", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; - if (!empty($user->admin)) { - $object->admin = GETPOST("admin", "int"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + if (!empty($user->admin)) { // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + $object->admin = GETPOST("admin", "int"); + } + if ($user->admin && !$object->ldap_sid) { // same test than on edit page + $object->login = GETPOST("login", 'alphanohtml'); } $object->address = GETPOST('address', 'alphanohtml'); $object->zip = GETPOST('zipcode', 'alphanohtml'); @@ -1856,7 +1858,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; } elseif ($caneditpassword && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print ''; } if ($object->statut == 0) { @@ -1864,7 +1866,7 @@ if ($action == 'create' || $action == 'adduserldap') { } elseif ($caneditpassword && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { if ($object->email) { - print ''; + print ''; } else { print ''; } @@ -1879,7 +1881,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print ''; } else { if ($user->id == $id) { print ''; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 5da92482785..dabac0727dc 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -113,7 +113,7 @@ if (empty($reshook)) { // Action modif mot de passe if ($action == 'buildnewpassword' && $username) { $sessionkey = 'dol_antispam_value'; - $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); + $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code')))); // Verify code if (!$ok) { diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 926fa8f6418..1581d569f27 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -350,8 +350,8 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) if (!$error) { $linesinvoice = array(); - $sql .= "SELECT f.rowid as facid"; - $sql .= " FROM '.MAIN_DB_PREFIX.'facture_fourn as f"; + $sql = "SELECT f.rowid as facid"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.entity = ".((int) $conf->entity); if ($idthirdparty != 'all') { $sql .= " AND f.fk_soc = ".((int) $idthirdparty); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7765d963d8f..5cf5f79935a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1406,9 +1406,13 @@ if ($action == 'updatecss' && $usercanedit) { } + $dataposted = trim(GETPOST('WEBSITE_HTML_HEADER', 'none')); + $dataposted = preg_replace(array('/\n*/ims', '/<\/html>\n*/ims'), array('', ''), $dataposted); + $dataposted = str_replace('\n";*/ - $htmlheadercontent .= preg_replace(array('/\n*/ims', '/<\/html>\n*/ims'), array('', ''), GETPOST('WEBSITE_HTML_HEADER', 'none')); + $htmlheadercontent .= $dataposted."\n"; /*$htmlheadercontent.= "\n".'"."\n";*/ - $htmlheadercontent = trim($htmlheadercontent)."\n"; - $result = dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); if (!$result) { $error++; @@ -1443,10 +1445,12 @@ if ($action == 'updatecss' && $usercanedit) { $error++; } + $dataposted = trim(GETPOST('WEBSITE_CSS_INLINE', 'none')); + $dataposted = str_replace('\n"; - $csscontent .= trim(GETPOST('WEBSITE_CSS_INLINE', 'none'))."\n"; + $csscontent .= $dataposted."\n"; $csscontent .= '\n"; - $jscontent .= trim(GETPOST('WEBSITE_JS_INLINE', 'none'))."\n"; + $jscontent .= $dataposted."\n"; $jscontent .= '\n";*/ - $robotcontent .= trim(GETPOST('WEBSITE_ROBOT', 'restricthtml'))."\n"; + $robotcontent .= $dataposted."\n"; /*$robotcontent.= "\n".'\n"; - $manifestjsoncontent .= trim(GETPOST('WEBSITE_MANIFEST_JSON', 'none'))."\n"; + $manifestjsoncontent .= $dataposted."\n"; $manifestjsoncontent .= '\n";*/ - $readmecontent .= trim(GETPOST('WEBSITE_README', 'restricthtml'))."\n"; + $readmecontent .= $dataposted."\n"; /*$readmecontent.= ' $val) { - var_dump($val); + //var_dump($val); if (!in_array($val[1], array( "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", "'search_status'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"'))) { diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 15e4eaa8bda..ad73d5ce14a 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -574,7 +574,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["backtopage"]='javascripT&javascript#javascriptxjavascript3a alert(1)'; $result=GETPOST("backtopage"); print __METHOD__." result=".$result."\n"; - $this->assertEquals('x3a alert(1)', $result, 'Test for backtopage param'); + $this->assertEquals('x3aalert(1)', $result, 'Test for backtopage param'); return $result; }
    '; if ($module->type == 'pdf') { - $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; + $linkspec = ''.img_object($langs->trans("Preview"), 'pdf').''; } else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index da056ec33da..81ceb22b9c4 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1604,11 +1604,11 @@ while ($i < min($num, $limit)) { } // VAT if (!empty($arrayfields['s.tva_intra']['checked'])) { - print ""; - print $obj->tva_intra; + print ''; if ($obj->tva_intra && !isValidVATID($companystatic)) { - print img_warning("BadVATNumber", '', ''); + print img_warning("BadVATNumber", '', 'pictofixedwidth'); } + print $obj->tva_intra; print "