Skip to content

Commit c942032

Browse files
Fixes and improvements for v1.4.4.664, see CHANGELOG
1 parent 603ccc3 commit c942032

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.4.4.664
2+
3+
- Further improved handling of 0-byte files when used to de-publish only specific subpages of a page
4+
- Using the "Previous Page" button on page 100 now wraps around, back to the highest page number of the service
5+
- Added ttxPrevPageNum and ttxNextPageNum to the ttxEnv section to facilitate implementation in certain mobile apps
6+
17
1.4.2.662
28

39
- More sanity checks to avoid PHP warnings in some rare cases

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ The teletext pages to be displayed must be in EP1 format (Softel). This file for
3232

3333
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.
3434

35+
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.
36+
3537
### Deployment
3638

3739
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).

includes/ttxweb_decoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// ttxweb.php EP1 teletext document renderer
4-
// version: 1.4.2.662 (2023-10-23)
4+
// version: 1.4.4.664 (2023-12-22)
55
// (c) 2023 Fabian Schneider - @fabianswebworld
66

77
const EP1_HEADER_LENGTH = 6;

includes/ttxweb_main.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

33
// ttxweb.php EP1 teletext document renderer
4-
// version: 1.4.2.662 (2023-10-23)
4+
// version: 1.4.4.664 (2023-12-22)
55
// (c) 2023 Fabian Schneider - @fabianswebworld
66

77
// GLOBAL DEFINITIONS
88

9-
const TTXWEB_VERSION = '1.4.2.662 (2023-10-23)'; // version string
9+
const TTXWEB_VERSION = '1.4.4.664 (2023-12-22)'; // version string
1010

1111
// for user and template configuration see ttxweb_config.php
1212

@@ -77,10 +77,11 @@ function getPageNumbers() {
7777
$nextIdx = $currentIdx + 1;
7878
$prevIdx = $currentIdx - 1;
7979
if ($nextIdx == sizeof($ep1FileList)) $nextIdx = 0;
80+
if ($prevIdx == -1) $prevIdx = sizeof($ep1FileList) - 1;
8081
}
8182

8283
// jump over 0-byte files (needed for some Sophora installations)
83-
for ( ; (($nextIdx < count($ep1FileList)) && (filesize(EP1_PATH . $ep1FileList[$nextIdx]) == 0)); $nextIdx++);
84+
for ( ; (($nextIdx <= count($ep1FileList)) && (filesize(EP1_PATH . $ep1FileList[$nextIdx]) == 0)); $nextIdx++);
8485
for ( ; (($prevIdx >= 0) && (filesize(EP1_PATH . $ep1FileList[$prevIdx]) == 0)); $prevIdx--);
8586

8687
// extract page numbers from filenames in list
@@ -94,6 +95,9 @@ function getPageNumbers() {
9495

9596
// get number of subpages
9697
$ep1SubpageFileList = glob(EP1_PATH . str_replace(array('%ppp%', '%ss%'), array($pageNum, '[0-9][0-9]'), EP1_PATTERN));
98+
for ($subpageIdx = 0; $subpageIdx <= count($ep1SubpageFileList); $subpageIdx++) {
99+
if (filesize($ep1SubpageFileList[$subpageIdx]) == 0) unset($ep1SubpageFileList[$subpageIdx]);
100+
}
97101
$numSubpages = count($ep1SubpageFileList);
98102
if ($subpageNum > $numSubpages) $subpageNum = sprintf('%02d', $numSubpages);
99103

@@ -287,6 +291,8 @@ function pageExists($pageNum, $subpageNum) {
287291
<pre id="ttxRow0Template">' . ROW_0_CUSTOMHEADER . '</pre>
288292
<pre id="ttxLanguage">' . $ttxLanguage . '</pre>
289293
<pre id="ttxPageNum">' . $pageNum . '</pre>
294+
<pre id="ttxPrevPageNum">' . $prevPageNum . '</pre>
295+
<pre id="ttxNextPageNum">' . $nextPageNum . '</pre>
290296
<pre id="ttxSubpageNum">' . intval($subpageNum) . '</pre>
291297
<pre id="ttxNumSubpages">' . $numSubpages . '</pre>
292298
<pre id="ttxReveal">' . intval($reveal) . '</pre>

0 commit comments

Comments
 (0)