From c94203213627a70591c7aea248c94e192d7bf83d Mon Sep 17 00:00:00 2001 From: Fabian Schneider <139592458+fabianswebworld@users.noreply.github.com> Date: Fri, 22 Dec 2023 23:51:54 +0100 Subject: [PATCH] Fixes and improvements for v1.4.4.664, see CHANGELOG --- CHANGELOG | 6 ++++++ README.md | 2 ++ includes/ttxweb_decoder.php | 2 +- includes/ttxweb_main.php | 12 +++++++++--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1504005..57bb57f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +1.4.4.664 + +- Further improved handling of 0-byte files when used to de-publish only specific subpages of a page +- Using the "Previous Page" button on page 100 now wraps around, back to the highest page number of the service +- Added ttxPrevPageNum and ttxNextPageNum to the ttxEnv section to facilitate implementation in certain mobile apps + 1.4.2.662 - More sanity checks to avoid PHP warnings in some rare cases diff --git a/README.md b/README.md index 7f25d8b..923ac98 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ The teletext pages to be displayed must be in EP1 format (Softel). This file for The EP1 files must be suitably synchronized in the filename format PxxxSyy.EP1 (where xxx = page number, yy = subpage number) to a folder accessible to the PHP script. The file name format can be adjusted in the script if required. +Files with a size of 0 bytes (e.g. used as "deletion files" in some Sophora installations) are considered non-existent; corresponding pages are treated as non-existent pages, i.e. skipped. + ### Deployment The PHP script and all auxiliary files must be copied to the web server and configured according to the section below. The **g1.zip** file in the **g1** folder needs to be unzipped on the server (faster deployment than transferring 1024 separate files). The transfer of the EP1 files must be set up. In order to prevent users from directly accessing the EP1 files via the web server, the commented lines of the supplied .htaccess file in the ttxweb folder should be uncommented (as long as the server supports Rewrite Rules). diff --git a/includes/ttxweb_decoder.php b/includes/ttxweb_decoder.php index 9fec67f..0e96bb6 100644 --- a/includes/ttxweb_decoder.php +++ b/includes/ttxweb_decoder.php @@ -1,7 +1,7 @@ = 0) && (filesize(EP1_PATH . $ep1FileList[$prevIdx]) == 0)); $prevIdx--); // extract page numbers from filenames in list @@ -94,6 +95,9 @@ function getPageNumbers() { // get number of subpages $ep1SubpageFileList = glob(EP1_PATH . str_replace(array('%ppp%', '%ss%'), array($pageNum, '[0-9][0-9]'), EP1_PATTERN)); + for ($subpageIdx = 0; $subpageIdx <= count($ep1SubpageFileList); $subpageIdx++) { + if (filesize($ep1SubpageFileList[$subpageIdx]) == 0) unset($ep1SubpageFileList[$subpageIdx]); + } $numSubpages = count($ep1SubpageFileList); if ($subpageNum > $numSubpages) $subpageNum = sprintf('%02d', $numSubpages); @@ -287,6 +291,8 @@ function pageExists($pageNum, $subpageNum) {
' . ROW_0_CUSTOMHEADER  . '
'     . $ttxLanguage        . '
'      . $pageNum            . '
+
'  . $prevPageNum        . '
+
'  . $nextPageNum        . '
'   . intval($subpageNum) . '
'  . $numSubpages        . '
'       . intval($reveal)     . '