From 3e8bded0cdca01739bf858c20b5b6df3b2cba196 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Aug 2022 13:32:08 +0200 Subject: [PATCH] links in meeting description --- .../control/TB_Server_Control_Appointment.php | 18 ++++++++++++++++++ .../server/utils/TB_Server_Utils_Helper.php | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/src/server/server/control/TB_Server_Control_Appointment.php b/src/server/server/control/TB_Server_Control_Appointment.php index 5cdddb8..4e764c2 100644 --- a/src/server/server/control/TB_Server_Control_Appointment.php +++ b/src/server/server/control/TB_Server_Control_Appointment.php @@ -61,11 +61,20 @@ class TB_Server_Control_Appointment { $maxAttendees = ( (int)$params->get( 'maxAttendee') === 0 ) ? NULL : (int)$params->get( 'maxAttendee'); $comment = _xss( $params->get( 'comment' ) ); + if ( 0 === mb_strlen( $comment ) ) { $comment = NULL; } +// Link replacements +// if ( 0 === mb_strlen( $comment ) ) +// { +// $comment = NULL; +// } else { +// $comment = TB_Server_Utils_Helper::makeUrltoLink($comment); +// } + $visibility = $params->get( 'visibility', TB_Shared_Ent_TeamData_Appointment::VISIBLE_ALL ); if ( $visibility !== TB_Shared_Ent_TeamData_Appointment::VISIBLE_ALL && $visibility !== TB_Shared_Ent_TeamData_Appointment::VISIBLE_CATEGORIES ) @@ -399,11 +408,20 @@ class TB_Server_Control_Appointment { $maxAttendees = ( (int)$params->get( 'maxAttendee') === 0 ) ? NULL : (int)$params->get( 'maxAttendee'); $comment = _xss( $params->get( 'comment' ) ); + if ( 0 === mb_strlen( $comment ) ) { $comment = NULL; } +// Link replacements +// if ( 0 === mb_strlen( $comment ) ) +// { +// $comment = NULL; +// } else { +// $comment = TB_Server_Utils_Helper::makeUrltoLink($comment); +// } + $visibility = $params->get( 'visibility', TB_Shared_Ent_TeamData_Appointment::VISIBLE_ALL ); if ( $visibility !== TB_Shared_Ent_TeamData_Appointment::VISIBLE_ALL && $visibility !== TB_Shared_Ent_TeamData_Appointment::VISIBLE_CATEGORIES ) diff --git a/src/server/server/utils/TB_Server_Utils_Helper.php b/src/server/server/utils/TB_Server_Utils_Helper.php index 5f65c86..95ff86f 100644 --- a/src/server/server/utils/TB_Server_Utils_Helper.php +++ b/src/server/server/utils/TB_Server_Utils_Helper.php @@ -140,6 +140,15 @@ class TB_Server_Utils_Helper { return $token; } + public static function makeUrltoLink($string) { + // The Regular Expression filter + $reg_pattern = "/(((http|https|ftp|ftps)\:\/\/)|(www\.))[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\:[0-9]+)?(\/\S*)?/"; + + // make the urls to hyperlinks + $strUrlReplaced = preg_replace($reg_pattern, '$0', $string); + return preg_replace('/href="www./', 'href="https://www.', $strUrlReplaced); + } + private static function generateTeamId() { $length = 4;