From ea2140258c2bd457a911475820b91a743c6ff127 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 22 Feb 2023 18:57:56 +0100 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B05317=20-=20Handle=20overlapping=20ta?= =?UTF-8?q?bles=20when=20table=20cells=20have=20fixed=20widths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/backoffice/utils/helpers/_misc.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/css/backoffice/utils/helpers/_misc.scss b/css/backoffice/utils/helpers/_misc.scss index 845208ba1..88c0809ed 100644 --- a/css/backoffice/utils/helpers/_misc.scss +++ b/css/backoffice/utils/helpers/_misc.scss @@ -159,6 +159,16 @@ body.ibo-has-fullscreen-descendant { border-spacing: 2px; } + /* + * N°5317 - Handle overlapping tables when table cells have fixed widths + * Force table cell NOT to have a fixed width and to wrap when necessary + */ + td { + width: unset !important; + word-break: break-word !important; + white-space: unset !important; + } + /* Preserve original text color in code blocks, except for the Highlight.js blocks which have their own colors */ & > code, code:not(.hljs) { From f55fc8d264c357135c744e6327c235e25f37bc79 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 23 Feb 2023 10:59:38 +0100 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06014=20Validation=20pattern=20for=20?= =?UTF-8?q?URL=20:=20now=20handles=20commas=20in=20params=20(#356)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seen on PRTG URLs Co-authored-by: Molkobain --- core/attributedef.class.inc.php | 11 +++++++++++ core/config.class.inc.php | 15 +++++---------- .../unitary-tests/core/AttributeURLTest.php | 13 +++++++------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index d8edb8cb1..30c72ebb0 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -7664,6 +7664,17 @@ class AttributeExternalField extends AttributeDefinition */ class AttributeURL extends AttributeString { + /** + * @var string + * SCHEME....... USER....................... PASSWORD.......................... HOST/IP........... PORT.......... PATH......................... GET............................................ ANCHOR.......................... + * Example: http://User:passWord@127.0.0.1:8888/patH/Page.php?arrayArgument[2]=something:blah20#myAnchor + * @link http://www.php.net/manual/fr/function.preg-match.php#93824 regexp source + * @since 3.0.1 N°4515 handle Alfresco and Sharepoint URLs + * @since 3.0.3 moved from Config to AttributeURL constant + */ + public const DEFAULT_VALIDATION_PATTERN = /** @lang RegExp */ + '(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.,-]*)?(#[a-zA-Z0-9_.-][a-zA-Z0-9+\$_.-]*)?'; + /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) * diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 166a2d322..2894cf4a6 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -899,16 +899,11 @@ class Config 'show_in_conf_sample' => false, ], 'url_validation_pattern' => [ - 'type' => 'string', - 'description' => 'Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)', - 'default' => /** @lang RegExp */ - '(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.-]*)?(#[a-zA-Z0-9_.-][a-zA-Z0-9+\$_.-]*)?', - // SCHEME....... USER....................... PASSWORD.......................... HOST/IP........... PORT.......... PATH......................... GET............................................ ANCHOR.......................... - // Example: http://User:passWord@127.0.0.1:8888/patH/Page.php?arrayArgument[2]=something:blah20#myAnchor - // RegExp source: http://www.php.net/manual/fr/function.preg-match.php#93824 - // Update with N°4515 - 'value' => '', - 'source_of_value' => '', + 'type' => 'string', + 'description' => 'Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)', + 'default' => AttributeURL::DEFAULT_VALIDATION_PATTERN, + 'value' => '', + 'source_of_value' => '', 'show_in_conf_sample' => true, ], 'email_validation_pattern' => [ diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php index bd257d629..551fc329a 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php @@ -33,13 +33,14 @@ class AttributeURLTest extends ItopTestCase { public function CheckFormatProvider(): array { return [ - 'Simple https URL' => ['https://www.combodo.com/itop', 1], - 'Simple FTP URL' => ['ftp://user:password@myftp.mydomain.com', 1], - 'Sharepoint URL 1' => ['https://mydomain1.sharepoint.com/:i:/r/sites/DSIMyDept/Shared%20Documents/Architecture%20Technique/02%20-%20R%C3%A9seau/Baie%2025C/Baie%201er/Baie-25C-1er.jpg?csf=1&web=1&e=Il3txR', 1], - 'Sharepoint URL 2' => ['https://mydomain2.sharepoint.com/:u:/r/sites/DIS/ITSM/00_Admin_iTOP/iTop%20-%20Upgrade%20manuel/Procedure%20upgrade%20Combodo.url?csf=1&web=1&e=DAF0i3', 1], - 'Alfresco URL 2' => ['http://alfresco.mydomain3.org/share/page/site/books/document-details?nodeRef=workspace://SpacesStore/6274f55f-a25b-4762-a863-77f7066f2034', 1], - 'SF URL' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/707145b859/?limit=25#f53c', 1], + 'Simple https URL' => ['https://www.combodo.com/itop', 1], + 'Simple FTP URL' => ['ftp://user:password@myftp.mydomain.com', 1], + 'Sharepoint URL 1' => ['https://mydomain1.sharepoint.com/:i:/r/sites/DSIMyDept/Shared%20Documents/Architecture%20Technique/02%20-%20R%C3%A9seau/Baie%2025C/Baie%201er/Baie-25C-1er.jpg?csf=1&web=1&e=Il3txR', 1], + 'Sharepoint URL 2' => ['https://mydomain2.sharepoint.com/:u:/r/sites/DIS/ITSM/00_Admin_iTOP/iTop%20-%20Upgrade%20manuel/Procedure%20upgrade%20Combodo.url?csf=1&web=1&e=DAF0i3', 1], + 'Alfresco URL 2' => ['http://alfresco.mydomain3.org/share/page/site/books/document-details?nodeRef=workspace://SpacesStore/6274f55f-a25b-4762-a863-77f7066f2034', 1], + 'SF URL' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/707145b859/?limit=25#f53c', 1], 'SF URL anchor starting with digit' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/b0a2d474ba/?limit=25#2b35', 1], + 'URL param containing commas' => ['http://mydomain.prtg.com/chart.png?type=graph&width=1500&height=700&hide=2,3,6,7,8,9,10,11,12,13,14&graphstyling=showLegend%3D%271%27+baseFontSize%3D%2715%27&graphid=0&id=34759&username=portaluser&passhash=2353031973', 1], ]; } }