From 57f440a76410b130983fbe494fefacb697f9a7fc Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Wed, 10 May 2023 08:36:42 -0600 Subject: [PATCH] Revert "Merge remote-tracking branch 'origin/bugs-5879' into bugs-5880" This reverts commit 77f08324b677b131c838e32bf0dca584a17f5ba9. --- php/pantheon/utils.php | 22 ++-------------------- php/pantheon/views/table.php | 8 ++------ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/php/pantheon/utils.php b/php/pantheon/utils.php index 9675e12..a987d40 100644 --- a/php/pantheon/utils.php +++ b/php/pantheon/utils.php @@ -3,6 +3,7 @@ use \Symfony\Component\Filesystem\Filesystem; use \Symfony\Component\Finder\Finder; +use \Pantheon\Utils as Pantheon; class Utils { static $fs; @@ -59,27 +60,8 @@ public static function sanitize_data($data, $sanitizer_function = 'htmlspecialch array_map('self::sanitize_data', array_values((array)$data)) ); return is_object( $data ) ? (object)$sanitized_data : $sanitized_data; - } elseif ( is_integer( $data ) ) { + } elseif ( is_integer($data) ) { return (string)$data; - } elseif ( is_string( $data ) ) { - if ( ! empty( $data ) ) { - $dom = new \DOMDocument; - $dom->loadHTML( $data ); - $anchors = $dom->getElementsByTagName('a'); - - // Bail if our string does not only contain an anchor tag. - if ( 0 === $anchors->length ) {; - return $sanitizer_function($data); - } - - $href = $anchors[0]->getAttribute('href'); - $sanitized_href = call_user_func($sanitizer_function, $href); - $sanitized_link_text = call_user_func($sanitizer_function, $anchors[0]->textContent); - - // Rebuild anchor tags to ensure there are no injected attributes. - $rebuilt_link = '' . $sanitized_link_text . ''; - return $rebuilt_link; - } } return $sanitizer_function($data); diff --git a/php/pantheon/views/table.php b/php/pantheon/views/table.php index 6197fab..2630751 100644 --- a/php/pantheon/views/table.php +++ b/php/pantheon/views/table.php @@ -1,13 +1,9 @@ - - - + @@ -16,7 +12,7 @@ - +