From c791b8ed83a339c8031b3a682b6b29cb904599e8 Mon Sep 17 00:00:00 2001 From: Florent VIOLLEAU Date: Tue, 19 Aug 2025 02:13:58 +0200 Subject: [PATCH] [SamMobileBridge] Fetches the latest security patches for Samsung devices --- bridges/SamMobileUpdateBridge.php | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 bridges/SamMobileUpdateBridge.php diff --git a/bridges/SamMobileUpdateBridge.php b/bridges/SamMobileUpdateBridge.php new file mode 100644 index 00000000..f31df4bf --- /dev/null +++ b/bridges/SamMobileUpdateBridge.php @@ -0,0 +1,53 @@ + [ + 'name' => 'Model', + 'exampleValue' => 'SM-S926B', + 'required' => true, + ], + 'country' => [ + 'name' => 'Country', + 'exampleValue' => 'EUX', + 'required' => true, + ] + ] + ]; + const CACHE_TIMEOUT = 7200; // 2h + + public function collectData() + { + $model = $this->getInput('model'); + $country = $this->getInput('country'); + $uri = self::URI . $model . '/' . $country; + $html = getSimpleHTMLDOM($uri); + + $elementsDom = $html->find('.main-content-item__content.main-content-item__content-md table tbody tr'); + + foreach ($elementsDom as $elementDom) { + $item = []; + + $td = $elementDom->find('td'); + + $title = 'Security patch: ' . $td[2] . ' - Android version: ' . $td[3] . ' - PDA: ' . $td[4]; + $text = 'Model: ' . $td[0] . '
Country/Carrier: ' . $td[1] . '
Security patch: ' . $td[2] . '
OS version: Android ' . $td[3] . '
PDA: ' . $td[4]; + + $item['uri'] = $uri; + $item['title'] = $title; + $item['author'] = self::MAINTAINER; + $item['date'] = $td[2]; + $item['content'] = $text; + $item['uid'] = hash('sha256', $item['title']); + + $this->items[] = $item; + } + } +}