diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 32c47fc9b17..a2a99bdfd5a 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -100,7 +100,7 @@ with * Replace in tcpdf.php: if (!@TCPDF_STATIC::file_exists($file)) { - return false; + return false; } with if (!@TCPDF_STATIC::file_exists($file)) { @@ -155,10 +155,10 @@ into * Removed useless directories ("examples", "tools") -* Optionnaly, removed all fonts except - dejavusans* (used by greek, arab, persan, romanian, turkish), - freemono* (russian), - cid*+msungstdlight+stsongstdlight+uni2cid* (chinese), +* Optionnaly, removed all fonts except + dejavusans* (used by greek, arab, persan, romanian, turkish), + freemono* (russian), + cid*+msungstdlight+stsongstdlight+uni2cid* (chinese), helvetica* (all other languages), zapfdingbats.php (for special chars like form checkboxes) @@ -170,15 +170,15 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php * In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning of the function, replace: - $roman = ''; + $roman = ''; -with: + with: - $roman = ''; - if ($number >= 4000) { - // do not represent numbers above 4000 in Roman numerals - return strval($number); - } + $roman = ''; + if ($number >= 4000) { + // do not represent numbers above 4000 in Roman numerals + return strval($number); + } * Add this at begin of tcpdf_autoconfig.php @@ -213,7 +213,7 @@ with: * Fix syntax error by replacing } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) { -with + with } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) { * Fix php fatal error on php 8.0 on tcpdi.php @@ -304,6 +304,24 @@ RESTLER: empty($value[0]) ? null : empty($value[1]) ? null : +* Add a test into AutoLoader.php to complete function loadThisLoader and test if property exists before calling it. For this replace code + + if (false !== $file = $b::$loader[1]($className) && $this->exists($className, $b::$loader[1])) { + return $file; + } + + with: + + //avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader + //in case of multiple autoloader systems + if(property_exists($b, $loader[1])) { + if (false !== $file = $b::$loader[1]($className) + && $this->exists($className, $b::$loader[1])) { + return $file; + } + } + + +With swagger 2 provided into /explorer: ---------------------------------------- @@ -317,16 +335,15 @@ PARSEDOWN * Add support of css by adding in Parsedown.php: // @CHANGE LDR - 'class' => $Link['element']['attributes']['class'] + 'class' => $Link['element']['attributes']['class'] ... - + // @CHANGE LDR - if (preg_match('/{([^}]+)}/', $remainder, $matches2)) - { - $Element['attributes']['class'] = $matches2[1]; - $remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder); - } + if (preg_match('/{([^}]+)}/', $remainder, $matches2)) { + $Element['attributes']['class'] = $matches2[1]; + $remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder); + } // @CHANGE LDR @@ -359,7 +376,7 @@ Add into Class Google of file OAuth2/Service/Google: } $this->approvalPrompt = $prompt; } - + JEDITABLE.JS diff --git a/htdocs/bookcal/bookcalindex.php b/htdocs/bookcal/bookcalindex.php index c2116980254..d5ca67b5b39 100644 --- a/htdocs/bookcal/bookcalindex.php +++ b/htdocs/bookcal/bookcalindex.php @@ -19,7 +19,7 @@ */ /** - * \file bookcal/bookcalindex.php + * \file htdocs/bookcal/bookcalindex.php * \ingroup bookcal * \brief Home page of bookcal top menu */ diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 5aef44ac048..20cecf07a51 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -22,8 +22,8 @@ */ /** - * \file htdocs/compta/facture/prelevement.php - * \ingroup facture + * \file htdocs/bookcal/booking_list.php + * \ingroup bookcal * \brief Management of direct debit order or credit tranfer of invoices */ diff --git a/htdocs/bookcal/calendar_agenda.php b/htdocs/bookcal/calendar_agenda.php index cb4c381ea33..a9792756553 100644 --- a/htdocs/bookcal/calendar_agenda.php +++ b/htdocs/bookcal/calendar_agenda.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_agenda.php + * \file htdocs/bookcal/calendar_agenda.php * \ingroup bookcal * \brief Tab of events on Calendar */ diff --git a/htdocs/bookcal/calendar_card.php b/htdocs/bookcal/calendar_card.php index 6d83687c13d..4cd79c357f1 100644 --- a/htdocs/bookcal/calendar_card.php +++ b/htdocs/bookcal/calendar_card.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_card.php + * \file htdocs/bookcal/calendar_card.php * \ingroup bookcal * \brief Page to create/edit/view calendar */ diff --git a/htdocs/bookcal/calendar_contact.php b/htdocs/bookcal/calendar_contact.php index 87fd2721489..a102542f5ca 100644 --- a/htdocs/bookcal/calendar_contact.php +++ b/htdocs/bookcal/calendar_contact.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_contact.php + * \file htdocs/bookcal/calendar_contact.php * \ingroup bookcal * \brief Tab for contacts linked to Calendar */ diff --git a/htdocs/bookcal/calendar_document.php b/htdocs/bookcal/calendar_document.php index 61f9c8b9fd9..07df7276c3a 100644 --- a/htdocs/bookcal/calendar_document.php +++ b/htdocs/bookcal/calendar_document.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_document.php + * \file htdocs/bookcal/calendar_document.php * \ingroup bookcal * \brief Tab for documents linked to Calendar */ diff --git a/htdocs/bookcal/calendar_list.php b/htdocs/bookcal/calendar_list.php index 44f0ea96e6f..04b14be5743 100644 --- a/htdocs/bookcal/calendar_list.php +++ b/htdocs/bookcal/calendar_list.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_list.php + * \file htdocs/bookcal/calendar_list.php * \ingroup bookcal * \brief List page for calendar */ diff --git a/htdocs/bookcal/calendar_note.php b/htdocs/bookcal/calendar_note.php index ae509dbf019..69c30f892bb 100644 --- a/htdocs/bookcal/calendar_note.php +++ b/htdocs/bookcal/calendar_note.php @@ -17,7 +17,7 @@ */ /** - * \file calendar_note.php + * \file htdocs/bookcal/calendar_note.php * \ingroup bookcal * \brief Tab for notes on Calendar */ diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 957da647102..31514673a21 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -197,22 +197,28 @@ foreach (array('internal', 'external') as $source) { foreach ($contactlist as $contact) { $entry = new stdClass(); $entry->id = $contact['rowid']; + $entry->type_id = $contact['fk_c_type_contact']; $entry->type = $contact['libelle']; $entry->nature = ""; + $entry->nature_html = ""; $entry->thirdparty_html = ""; $entry->thirdparty_name = ""; $entry->contact_html = ""; $entry->contact_name = ""; - $entry->status = ""; + $entry->status = 0; + $entry->status_html = ""; if ($contact['source'] == 'internal') { - $entry->nature = $langs->trans("User"); + $entry->nature = 'user'; + $entry->nature_html = $langs->trans("User"); } elseif ($contact['source'] == 'external') { - $entry->nature = $langs->trans("ThirdPartyContact"); + $entry->nature = 'thirdparty'; + $entry->nature_html = $langs->trans("ThirdPartyContact"); } if ($contact['socid'] > 0) { $companystatic->fetch($contact['socid']); + $entry->thirdparty_id = $companystatic->id; $entry->thirdparty_html = $companystatic->getNomUrl(1); $entry->thirdparty_name = strtolower($companystatic->getFullName($langs)); } elseif ($contact['socid'] < 0) { @@ -222,18 +228,22 @@ foreach (array('internal', 'external') as $source) { if ($contact['source'] == 'internal') { $userstatic->fetch($contact['id']); + $entry->contact_id = $userstatic->id; $entry->contact_html = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); $entry->contact_name = strtolower($userstatic->getFullName($langs)); } elseif ($contact['source'] == 'external') { $contactstatic->fetch($contact['id']); + $entry->contact_id = $contactstatic->id; $entry->contact_html = $contactstatic->getNomUrl(1, '', 0, '', 0, 0); $entry->contact_name = strtolower($contactstatic->getFullName($langs)); } if ($contact['source'] == 'internal') { - $entry->status = $userstatic->LibStatut($contact['statuscontact'], 3); + $entry->status = $contact['statuscontact']; + $entry->status_html = $userstatic->LibStatut($contact['statuscontact'], 3); } elseif ($contact['source'] == 'external') { - $entry->status = $contactstatic->LibStatut($contact['statuscontact'], 3); + $entry->status = $contact['statuscontact']; + $entry->status_html = $contactstatic->LibStatut($contact['statuscontact'], 3); } $list[] = $entry; @@ -291,13 +301,13 @@ if ($permission) { print ""; foreach ($list as $entry) { - print ''; + print ''; - print ''.$entry->thirdparty_html.''; - print ''.$entry->contact_html.''; - print ''.$entry->nature.''; - print ''.$entry->type.''; - print ''.$entry->status.''; + print ''.$entry->thirdparty_html.''; + print ''.$entry->contact_html.''; + print ''.dol_escape_htmltag($entry->nature_html).''; + print ''.dol_escape_htmltag($entry->type).''; + print ''.$entry->status_html.''; if ($permission) { $href = $_SERVER["PHP_SELF"]; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 274fb881968..ca5b93994e8 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1351,7 +1351,7 @@ class FactureFournisseurRec extends CommonInvoice } if (!$error && ($facturerec->auto_validate || $forcevalidation)) { $result = $new_fac_fourn->validate($user); - $laststep="Validate by user {$user->id}"; + $laststep = "Validate by user {$user->login}"; if ($result <= 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; @@ -1361,9 +1361,9 @@ class FactureFournisseurRec extends CommonInvoice if (!$error && $facturerec->generate_pdf) { // We refresh the object in order to have all necessary data (like date_lim_reglement) - $laststep="Refresh ".$new_fac_fourn->id; + $laststep = "Refresh ".$new_fac_fourn->id; $new_fac_fourn->fetch($new_fac_fourn->id); - $laststep="GenerateDocument ".$new_fac_fourn->id; + $laststep = "GenerateDocument ".$new_fac_fourn->id; $result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs); if ($result < 0) { $this->errors = $new_fac_fourn->errors; diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 0076c3521a4..40f5d747011 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -766,7 +766,6 @@ if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create' } } - // End of page llxFooter(); $db->close(); diff --git a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php index b11506ea86c..a5a1fd98750 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php @@ -1,449 +1,450 @@ - * @copyright 2012 Luracast - * - */ -class AutoLoader -{ - protected static $instance, // the singleton instance reference - $perfectLoaders, // used to keep the ideal list of loaders - $rogueLoaders = array(), // other auto loaders now unregistered - $classMap = array(), // the class to include file mapping - $aliases = array( // aliases and prefixes instead of null list aliases - 'Luracast\\Restler' => null, - 'Luracast\\Restler\\Format' => null, - 'Luracast\\Restler\\Data' => null, - 'Luracast\\Restler\\Filter' => null, - ); + /** + * Class that implements spl_autoload facilities and multiple + * conventions support. + * Supports composer libraries and 100% PSR-0 compliant. + * In addition we enable namespace prefixing and class aliases. + * + * @category Framework + * @package Restler + * @subpackage Helper + * @author Nick Lombard + * @copyright 2012 Luracast + * + */ + class AutoLoader + { + protected static $instance, // the singleton instance reference + $perfectLoaders, // used to keep the ideal list of loaders + $rogueLoaders = array(), // other auto loaders now unregistered + $classMap = array(), // the class to include file mapping + $aliases = array( // aliases and prefixes instead of null list aliases + 'Luracast\\Restler' => null, + 'Luracast\\Restler\\Format' => null, + 'Luracast\\Restler\\Data' => null, + 'Luracast\\Restler\\Filter' => null, + ); - /** - * Singleton instance facility. - * - * @static - * @return AutoLoader the current instance or new instance if none exists. - */ - public static function instance() - { - static::$instance = static::$instance ?: new static(); - return static::thereCanBeOnlyOne(); - } + /** + * Singleton instance facility. + * + * @static + * @return AutoLoader the current instance or new instance if none exists. + */ + public static function instance() + { + static::$instance = static::$instance ?: new static(); + return static::thereCanBeOnlyOne(); + } - /** - * Helper function to add a path to the include path. - * AutoLoader uses the include path to discover classes. - * - * @static - * - * @param $path string absolute or relative path. - * - * @return bool false if the path cannot be resolved - * or the resolved absolute path. - */ - public static function addPath($path) { - if (false === $path = stream_resolve_include_path($path)) - return false; - else - set_include_path($path.PATH_SEPARATOR.get_include_path()); - return $path; - } + /** + * Helper function to add a path to the include path. + * AutoLoader uses the include path to discover classes. + * + * @static + * + * @param $path string absolute or relative path. + * + * @return bool false if the path cannot be resolved + * or the resolved absolute path. + */ + public static function addPath($path) + { + if (false === $path = stream_resolve_include_path($path)) + return false; + else set_include_path($path.PATH_SEPARATOR.get_include_path()); + return $path; + } - /** - * Other autoLoaders interfere and cause duplicate class loading. - * AutoLoader is capable enough to handle all standards so no need - * for others stumbling about. - * - * @return callable the one true auto loader. - */ - public static function thereCanBeOnlyOne() { - if (static::$perfectLoaders === spl_autoload_functions()) - return static::$instance; + /** + * Other autoLoaders interfere and cause duplicate class loading. + * AutoLoader is capable enough to handle all standards so no need + * for others stumbling about. + * + * @return callable the one true auto loader. + */ + public static function thereCanBeOnlyOne() + { + if (static::$perfectLoaders === spl_autoload_functions()) + return static::$instance; - if (false !== $loaders = spl_autoload_functions()) - if (0 < $count = count($loaders)) - for ($i = 0, static::$rogueLoaders += $loaders; - $i < $count && false != ($loader = $loaders[$i]); - $i++) - if ($loader !== static::$perfectLoaders[0]) - spl_autoload_unregister($loader); + if (false !== $loaders = spl_autoload_functions()) + if (0 < $count = count($loaders)) + for ($i = 0, static::$rogueLoaders += $loaders; + $i < $count && false != ($loader = $loaders[$i]); + $i++) + if ($loader !== static::$perfectLoaders[0]) + spl_autoload_unregister($loader); - return static::$instance; - } + return static::$instance; + } - /** - * Seen this before cache handler. - * Facilitates both lookup and persist operations as well as convenience, - * load complete map functionality. The key can only be given a non falsy - * value once, this will be truthy for life. - * - * @param $key mixed class name considered or a collection of - * classMap entries - * @param $value mixed optional not required when doing a query on - * key. Default is false we haven't seen this - * class. Most of the time it will be the filename - * for include and is set to true if we are unable - * to load this class iow true == it does not exist. - * value may also be a callable auto loader function. - * - * @return mixed The known value for the key or false if key has no value - */ - public static function seen($key, $value = false) - { - if (is_array($key)) { - static::$classMap = $key + static::$classMap; - return false; - } + /** + * Seen this before cache handler. + * Facilitates both lookup and persist operations as well as convenience, + * load complete map functionality. The key can only be given a non falsy + * value once, this will be truthy for life. + * + * @param $key mixed class name considered or a collection of + * classMap entries + * @param $value mixed optional not required when doing a query on + * key. Default is false we haven't seen this + * class. Most of the time it will be the filename + * for include and is set to true if we are unable + * to load this class iow true == it does not exist. + * value may also be a callable auto loader function. + * + * @return mixed The known value for the key or false if key has no value + */ + public static function seen($key, $value = false) + { + if (is_array($key)) { + static::$classMap = $key + static::$classMap; + return false; + } - if (empty(static::$classMap[$key])) - static::$classMap[$key] = $value; + if (empty(static::$classMap[$key])) + static::$classMap[$key] = $value; - if (is_string($alias = static::$classMap[$key])) - if (isset(static::$classMap[$alias])) - return static::$classMap[$alias]; + if (is_string($alias = static::$classMap[$key])) + if (isset(static::$classMap[$alias])) + return static::$classMap[$alias]; - return static::$classMap[$key]; - } + return static::$classMap[$key]; + } - /** - * Protected constructor to enforce singleton pattern. - * Populate a default include path. - * All possible includes cant possibly be catered for and if you - * require another path then simply add it calling set_include_path. - */ - protected function __construct() - { - static::$perfectLoaders = array($this); + /** + * Protected constructor to enforce singleton pattern. + * Populate a default include path. + * All possible includes cant possibly be catered for and if you + * require another path then simply add it calling set_include_path. + */ + protected function __construct() + { + static::$perfectLoaders = array($this); - if (false === static::seen('__include_path')) { + if (false === static::seen('__include_path')) { + $paths = explode(PATH_SEPARATOR, get_include_path()); + $slash = DIRECTORY_SEPARATOR; + $dir = dirname(__DIR__); + $source_dir = dirname($dir); + $dir = dirname($source_dir); - $paths = explode(PATH_SEPARATOR, get_include_path()); - $slash = DIRECTORY_SEPARATOR; - $dir = dirname(__DIR__); - $source_dir = dirname($dir); - $dir = dirname($source_dir); + foreach (array( + array($source_dir), + array($dir, '..', '..', 'composer'), + array($dir, 'vendor', 'composer'), + array($dir, '..', '..', '..', 'php'), + array($dir, 'vendor', 'php')) + as $includePath) + if (false !== $path = stream_resolve_include_path( + implode($slash, $includePath) + )) + if ('composer' == end($includePath) && + false !== $classmapPath = stream_resolve_include_path( + "$path{$slash}autoload_classmap.php" + ) + ) { + static::seen(static::loadFile( + $classmapPath + )); + $paths = array_merge( + $paths, + array_values(static::loadFile( + "$path{$slash}autoload_namespaces.php" + )) + ); + } else $paths[] = $path; - foreach ( - array( - array($source_dir), - array($dir, '..', '..', 'composer'), - array($dir, 'vendor', 'composer'), - array($dir, '..', '..', '..', 'php'), - array($dir, 'vendor', 'php')) - as $includePath) - if (false !== $path = stream_resolve_include_path( - implode($slash, $includePath) - )) - if ('composer' == end($includePath) && - false !== $classmapPath = stream_resolve_include_path( - "$path{$slash}autoload_classmap.php" - ) - ) { - static::seen(static::loadFile( - $classmapPath - )); - $paths = array_merge( - $paths, - array_values(static::loadFile( - "$path{$slash}autoload_namespaces.php" - )) - ); - } else - $paths[] = $path; + $paths = array_filter(array_map( + function ($path) { + if (false == $realPath = @realpath($path)) + return null; + return $realPath . DIRECTORY_SEPARATOR; + }, + $paths + )); + natsort($paths); + static::seen( + '__include_path', + implode(PATH_SEPARATOR, array_unique($paths)) + ); + } - $paths = array_filter(array_map( - function ($path) { - if (false == $realPath = @realpath($path)) - return null; - return $realPath . DIRECTORY_SEPARATOR; - }, - $paths - )); - natsort($paths); - static::seen( - '__include_path', - implode(PATH_SEPARATOR, array_unique($paths)) - ); - } + set_include_path(static::seen('__include_path')); + } - set_include_path(static::seen('__include_path')); - } + /** + * Attempt to include the path location. + * Called from a static context which will not expose the AutoLoader + * instance itself. + * + * @param $path string location of php file on the include path + * + * @return bool|mixed returns reference obtained from the include or false + */ + private static function loadFile($path) + { + return \Luracast_Restler_autoloaderInclude($path); + } - /** - * Attempt to include the path location. - * Called from a static context which will not expose the AutoLoader - * instance itself. - * - * @param $path string location of php file on the include path - * - * @return bool|mixed returns reference obtained from the include or false - */ - private static function loadFile($path) - { - return \Luracast_Restler_autoloaderInclude($path); - } + /** + * Attempt to load class with namespace prefixes. + * + * @param $className string class name + * + * @return bool|mixed reference to discovered include or false + */ + private function loadPrefixes($className) + { + $currentClass = $className; + if (false !== $pos = strrpos($className, '\\')) + $className = substr($className, $pos); + else $className = "\\$className"; - /** - * Attempt to load class with namespace prefixes. - * - * @param $className string class name - * - * @return bool|mixed reference to discovered include or false - */ - private function loadPrefixes($className) - { - $currentClass = $className; - if (false !== $pos = strrpos($className, '\\')) - $className = substr($className, $pos); - else - $className = "\\$className"; + for ( + $i = 0, + $file = false, + $count = count(static::$aliases), + $prefixes = array_keys(static::$aliases); + $i < $count + && false === $file + && false === $file = $this->discover( + $variant = $prefixes[$i++].$className, + $currentClass + ); + $file = $this->loadAliases($variant) + ); - for ( - $i = 0, - $file = false, - $count = count(static::$aliases), - $prefixes = array_keys(static::$aliases); - $i < $count - && false === $file - && false === $file = $this->discover( - $variant = $prefixes[$i++].$className, - $currentClass - ); - $file = $this->loadAliases($variant) - ); + return $file; + } - return $file; - } + /** + * Attempt to load configured aliases based on namespace part of class name. + * + * @param $className string fully qualified class name. + * + * @return bool|mixed reference to discovered include or false + */ + private function loadAliases($className) + { + $file = false; + if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) + for ( + $i = 0, + $aliases = isset(static::$aliases[$parts[1]]) + ? static::$aliases[$parts[1]] : array(), + $count = count($aliases); + $i < $count && false === $file; + $file = $this->discover( + "{$aliases[$i++]}$parts[2]", + $className + ) + ) ; - /** - * Attempt to load configured aliases based on namespace part of class name. - * - * @param $className string fully qualified class name. - * - * @return bool|mixed reference to discovered include or false - */ - private function loadAliases($className) - { - $file = false; - if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) - for ( - $i = 0, - $aliases = isset(static::$aliases[$parts[1]]) - ? static::$aliases[$parts[1]] : array(), - $count = count($aliases); - $i < $count && false === $file; - $file = $this->discover( - "{$aliases[$i++]}$parts[2]", - $className - ) - ) ; + return $file; + } - return $file; - } + /** + * Load from rogueLoaders as last resort. + * It may happen that a custom auto loader may load classes in a unique way, + * these classes cannot be seen otherwise nor should we attempt to cover every + * possible deviation. If we still can't find a class, as a last resort, we will + * run through the list of rogue loaders and verify if we succeeded. + * + * @param $className string className that can't be found + * @param null $loader callable loader optional when the loader is known + * + * @return bool false unless className now exists + */ + private function loadLastResort($className, $loader = null) + { + $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); + if (isset($loader)) { + if (false === array_search($loader, $loaders)) + static::$rogueLoaders[] = $loader; + return $this->loadThisLoader($className, $loader); + } + foreach ($loaders as $loader) + if (false !== $file = $this->loadThisLoader($className, $loader)) + return $file; - /** - * Load from rogueLoaders as last resort. - * It may happen that a custom auto loader may load classes in a unique way, - * these classes cannot be seen otherwise nor should we attempt to cover every - * possible deviation. If we still can't find a class, as a last resort, we will - * run through the list of rogue loaders and verify if we succeeded. - * - * @param $className string className that can't be found - * @param null $loader callable loader optional when the loader is known - * - * @return bool false unless className now exists - */ - private function loadLastResort($className, $loader = null) { - $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); - if (isset($loader)) { - if (false === array_search($loader, $loaders)) - static::$rogueLoaders[] = $loader; - return $this->loadThisLoader($className, $loader); - } - foreach ($loaders as $loader) - if (false !== $file = $this->loadThisLoader($className, $loader)) - return $file; + return false; + } - return false; - } + /** + * Helper for loadLastResort. + * Use loader with $className and see if className exists. + * + * @param $className string name of a class to load + * @param $loader callable autoLoader method + * + * @return bool false unless className exists + */ + private function loadThisLoader($className, $loader) + { + if (is_array($loader) + && is_callable($loader)) { + $b = new $loader[0]; + //avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader + //in case of multiple autoloader systems + if (property_exists($b, $loader[1])) { + if (false !== $file = $b::$loader[1]($className) + && $this->exists($className, $b::$loader[1])) { + return $file; + } + } + } elseif (is_callable($loader) + && false !== $file = $loader($className) + && $this->exists($className, $loader)) { + return $file; + } + return false; + } - /** - * Helper for loadLastResort. - * Use loader with $className and see if className exists. - * - * @param $className string name of a class to load - * @param $loader callable autoLoader method - * - * @return bool false unless className exists - */ - private function loadThisLoader($className, $loader) - { - if (is_array($loader) - && is_callable($loader)) { - $b = new $loader[0]; - if (false !== $file = $b::$loader[1]($className) - && $this->exists($className, $b::$loader[1])) { - return $file; - } - } elseif (is_callable($loader) - && false !== $file = $loader($className) - && $this->exists($className, $loader)) { - return $file; - } - return false; - } + /** + * Create an alias for class. + * + * @param $className string the name of the alias class + * @param $currentClass string the current class this alias references + * @return void + */ + private function alias($className, $currentClass) + { + if ($className == 'Luracast\Restler\string') return; + if ($className == 'Luracast\Restler\mixed') return; + if ($className != $currentClass + && false !== strpos($className, $currentClass)) + if (!class_exists($currentClass, false) + && class_alias($className, $currentClass)) + static::seen($currentClass, $className); + } - /** - * Create an alias for class. - * - * @param $className string the name of the alias class - * @param $currentClass string the current class this alias references - */ - private function alias($className, $currentClass) - { - if ($className == 'Luracast\Restler\string') return; - if ($className == 'Luracast\Restler\mixed') return; - if ($className != $currentClass - && false !== strpos($className, $currentClass)) - if (!class_exists($currentClass, false) - && class_alias($className, $currentClass)) - static::seen($currentClass, $className); - } + /** + * Discovery process. + * + * @param $className string class name to discover + * @param $currentClass string optional name of current class when + * looking up an alias + * + * @return bool|mixed resolved include reference or false + */ + private function discover($className, $currentClass = null) + { + $currentClass = $currentClass ?: $className; - /** - * Discovery process. - * - * @param $className string class name to discover - * @param $currentClass string optional name of current class when - * looking up an alias - * - * @return bool|mixed resolved include reference or false - */ - private function discover($className, $currentClass = null) - { - $currentClass = $currentClass ?: $className; + /** The short version we've done this before and found it in cache */ + if (false !== $file = static::seen($className)) { + if (!$this->exists($className)) + if (is_callable($file)) + $file = $this->loadLastResort($className, $file); + elseif ($file = stream_resolve_include_path($file)) + $file = static::loadFile($file); - /** The short version we've done this before and found it in cache */ - if (false !== $file = static::seen($className)) { - if (!$this->exists($className)) - if (is_callable($file)) - $file = $this->loadLastResort($className, $file); - elseif($file = stream_resolve_include_path($file)) - $file = static::loadFile($file); + $this->alias($className, $currentClass); + return $file; + } - $this->alias($className, $currentClass); - return $file; - } + /** We did not find it in cache, lets look for it shall we */ - /** We did not find it in cache, lets look for it shall we */ + /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ + $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); + if (false === $file = stream_resolve_include_path("$file.php")) + return false; - /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ - $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); - if (false === $file = stream_resolve_include_path("$file.php")) - return false; + /** have we loaded this file before could this be an alias */ + if (in_array($file, get_included_files())) { + if (false !== $sameFile = array_search($file, static::$classMap)) + if (!$this->exists($className, $file)) + if (false !== strpos($sameFile, $className)) + $this->alias($sameFile, $className); - /** have we loaded this file before could this be an alias */ - if (in_array($file, get_included_files())) { - if (false !== $sameFile = array_search($file, static::$classMap)) - if (!$this->exists($className, $file)) - if (false !== strpos($sameFile, $className)) - $this->alias($sameFile, $className); + return $file; + } - return $file; - } + $state = array_merge(get_declared_classes(), get_declared_interfaces()); - $state = array_merge(get_declared_classes(), get_declared_interfaces()); + if (false !== $result = static::loadFile($file)) { + if ($this->exists($className, $file)) + $this->alias($className, $currentClass); + elseif (false != $diff = array_diff( + array_merge(get_declared_classes(), get_declared_interfaces()), $state)) + foreach ($diff as $autoLoaded) + if ($this->exists($autoLoaded, $file)) + if (false !== strpos($autoLoaded, $className)) + $this->alias($autoLoaded, $className); - if (false !== $result = static::loadFile($file)) { + if (!$this->exists($currentClass)) + $result = false; + } - if ($this->exists($className, $file)) - $this->alias($className, $currentClass); - elseif (false != $diff = array_diff( - array_merge(get_declared_classes(), get_declared_interfaces()), $state)) - foreach ($diff as $autoLoaded) - if ($this->exists($autoLoaded, $file)) - if (false !== strpos($autoLoaded, $className)) - $this->alias($autoLoaded, $className); + return $result; + } - if (!$this->exists($currentClass)) - $result = false; - } + /** + * Checks whether supplied string exists in a loaded class or interface. + * As a convenience the supplied $mapping can be the value for seen. + * + * @param $className string The class or interface to verify + * @param $mapping string (optional) value for map/seen if found to exist + * + * @return bool whether the class/interface exists without calling auto loader + */ + private function exists($className, $mapping = null) + { + if (class_exists($className, false) + || interface_exists($className, false)) + if (isset($mapping)) + return static::seen($className, $mapping); + else return true; + return false; + } - return $result; - } + /** + * Auto loader callback through __invoke object as function. + * + * @param $className string class/interface name to auto load + * + * @return mixed|null the reference from the include or null + */ + public function __invoke($className) + { + if (empty($className)) + return false; - /** - * Checks whether supplied string exists in a loaded class or interface. - * As a convenience the supplied $mapping can be the value for seen. - * - * @param $className string The class or interface to verify - * @param $mapping string (optional) value for map/seen if found to exist - * - * @return bool whether the class/interface exists without calling auto loader - */ - private function exists($className, $mapping = null) - { - if (class_exists($className, false) - || interface_exists($className, false)) - if (isset($mapping)) - return static::seen($className, $mapping); - else - return true; - return false; - } + if (false !== $includeReference = $this->discover($className)) + return $includeReference; - /** - * Auto loader callback through __invoke object as function. - * - * @param $className string class/interface name to auto load - * - * @return mixed|null the reference from the include or null - */ - public function __invoke($className) - { - if (empty($className)) - return false; + static::thereCanBeOnlyOne(); - if (false !== $includeReference = $this->discover($className)) - return $includeReference; + if (false !== $includeReference = $this->loadAliases($className)) + return $includeReference; - static::thereCanBeOnlyOne(); + if (false !== $includeReference = $this->loadPrefixes($className)) + return $includeReference; - if (false !== $includeReference = $this->loadAliases($className)) - return $includeReference; + if (false !== $includeReference = $this->loadLastResort($className)) + return $includeReference; - if (false !== $includeReference = $this->loadPrefixes($className)) - return $includeReference; - - if (false !== $includeReference = $this->loadLastResort($className)) - return $includeReference; - - static::seen($className, true); - return null; - } -} + static::seen($className, true); + return null; + } + } } namespace { - /** - * Include function in the root namespace to include files optimized - * for the global context. - * - * @param $path string path of php file to include into the global context. - * - * @return mixed|bool false if the file could not be included. - */ - function Luracast_Restler_autoloaderInclude($path) { - return include $path; - } + /** + * Include function in the root namespace to include files optimized + * for the global context. + * + * @param $path string path of php file to include into the global context. + * + * @return mixed|bool false if the file could not be included. + */ + function Luracast_Restler_autoloaderInclude($path) + { + return include $path; + } } - diff --git a/htdocs/install/check.php b/htdocs/install/check.php index a5f571fec0b..d434a5bdad2 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -200,12 +200,14 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc } // Check if Imap is supported -if (!function_exists("imap_open")) { - $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "IMAP")."
\n"; - // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) -} else { - print 'Ok '.$langs->trans("PHPSupport", "IMAP")."
\n"; +if (PHP_VERSION_ID <= 80300) { + if (!function_exists("imap_open")) { + $langs->load("errors"); + print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "IMAP")."
\n"; + // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) + } else { + print 'Ok '.$langs->trans("PHPSupport", "IMAP")."
\n"; + } } // Check if Zip is supported diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6bf70b996fe..1fd788b490b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1664,7 +1664,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) * @param int $disablenoindex Disable noindex tag for meta robots * @return void */ -function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $disableforlogin = 0, $disablenofollow = 0, $disablenoindex = 0) +function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = array(), $arrayofcss = array(), $disableforlogin = 0, $disablenofollow = 0, $disablenoindex = 0) { global $db, $conf, $langs, $user, $mysoc, $hookmanager; @@ -2062,20 +2062,20 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr /** * Show an HTML header + a BODY + The top menu bar * - * @param string $head Lines in the HEAD - * @param string $title Title of web page - * @param string $target Target to use in menu links (Example: '' or '_top') - * @param int $disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) - * @param int $disablehead Do not output head section - * @param array $arrayofjs Array of js files to add in header - * @param array $arrayofcss Array of css files to add in header - * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) - * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage - * For other external page: http://server/url + * @param string $head Lines in the HEAD + * @param string $title Title of web page + * @param string $target Target to use in menu links (Example: '' or '_top') + * @param int $disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) + * @param int $disablehead Do not output head section + * @param array $arrayofjs Array of js files to add in header + * @param array $arrayofcss Array of css files to add in header + * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) + * @param string $helppagename Name of wiki page for help ('' by default). + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage + * For other external page: http://server/url * @return void */ -function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $helppagename = '') +function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = array(), $arrayofcss = array(), $morequerystring = '', $helppagename = '') { global $user, $conf, $langs, $db, $form; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -3082,7 +3082,7 @@ function top_menu_search() * @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return void */ -function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_array_after = '', $leftmenuwithoutmainarea = 0, $title = '', $acceptdelayedhtml = 0) +function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_array_after = array(), $leftmenuwithoutmainarea = 0, $title = '', $acceptdelayedhtml = 0) { global $user, $conf, $langs, $db, $form; global $hookmanager, $menumanager; @@ -3450,8 +3450,8 @@ function getHelpParamFor($helppagename, $langs) * @param string $accesskey Accesskey * @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page * @param string $img Image to use - * @param string $showtitlebefore Show title before input text instead of into placeholder. This can be set when output is dedicated for text browsers. - * @param string $autofocus Set autofocus on field + * @param int $showtitlebefore Show title before input text instead of into placeholder. This can be set when output is dedicated for text browsers. + * @param int $autofocus Set autofocus on field * @return string */ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey = '', $prefhtmlinputname = '', $img = '', $showtitlebefore = 0, $autofocus = 0) diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index da364497a80..2656500fbc3 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1132,7 +1132,6 @@ for ($i = 0; $i < $nbcolonnes; $i++) { $meilleursujet .= ($meilleursujet ? ", " : ""); if ($object->format == "D") { - $meilleursujetexport = $toutsujet[$i]; //var_dump($toutsujet); if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); @@ -1148,7 +1147,7 @@ for ($i = 0; $i < $nbcolonnes; $i++) { $compteursujet++; } } -$meilleursujet = substr($meilleursujet, 1); +//$meilleursujet = substr($meilleursujet, 1); $meilleursujet = str_replace("°", "'", $meilleursujet); // Show best choice @@ -1157,9 +1156,9 @@ if ($nbofcheckbox >= 2) { print '

'."\n"; if (isset($meilleurecolonne) && $compteursujet == "1") { - print " ".$langs->trans('TheBestChoice').": ".$meilleursujet." ".$langs->trans("with")." ".$meilleurecolonne." ".$vote_str.".\n"; + print ' '.$langs->trans('TheBestChoice').": ".$meilleursujet." - ".$meilleurecolonne." ".$vote_str.".\n"; } elseif (isset($meilleurecolonne)) { - print " ".$langs->trans('TheBestChoices').": ".$meilleursujet." ".$langs->trans("with")." ".$meilleurecolonne." ".$vote_str.".\n"; + print ' '.$langs->trans('TheBestChoices').": ".$meilleursujet." - ".$meilleurecolonne." ".$vote_str.".\n"; } print '


'."\n"; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index c6171867557..73245eb75e4 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -788,7 +788,6 @@ if ($object->allow_spy) { if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) { $meilleursujet .= ($meilleursujet ? ", " : ""); if ($object->format == "D") { - $meilleursujetexport = $toutsujet[$i]; if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').') - '.$toutsujetdate[1]; @@ -804,7 +803,7 @@ if ($object->allow_spy) { } } - $meilleursujet = substr("$meilleursujet", 1); + //$meilleursujet = substr($meilleursujet, 1); $meilleursujet = str_replace("°", "'", $meilleursujet); // Show best choice @@ -813,9 +812,9 @@ if ($object->allow_spy) { print '

'."\n"; if (isset($meilleurecolonne) && $compteursujet == "1") { - print ' '.$langs->trans('TheBestChoice').": ".$meilleursujet." ".$langs->trans('with')." ".$meilleurecolonne."".$vote_str.".\n"; + print ' '.$langs->trans('TheBestChoice').": ".$meilleursujet." - ".$meilleurecolonne." ".$vote_str.".\n"; } elseif (isset($meilleurecolonne)) { - print ' '.$langs->trans('TheBestChoices').": ".$meilleursujet." ".$langs->trans('with')." ".$meilleurecolonne."".$vote_str.".\n"; + print ' '.$langs->trans('TheBestChoices').": ".$meilleursujet." - ".$meilleurecolonne." ".$vote_str.".\n"; } print '


'."\n";