Skip to content

Commit

Permalink
Fix undefined functions in commented-out teaser on individual member …
Browse files Browse the repository at this point in the history
…pages

Imperia now wrote the teaser code onto every individual member page, causing
errors since this code includes functions `member_teaser_start()` and `member_teaser_end()`
that are only defined in overview pages
  • Loading branch information
2xB committed Jul 10, 2022
1 parent 14d2cab commit 5981237
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$ob_offset = 0;
$started = false;

function member_teaser_start(): void {
function member_teaser_start_impl(): void {
global $started;
// since the person’s name & title are duplicated in the “alt” attribute
// of the img element, this function will be called several times and
Expand All @@ -34,7 +34,7 @@
}
}

function member_teaser_end(): void {
function member_teaser_end_impl(): void {
global $started;
$started = false;
}
Expand Down
17 changes: 16 additions & 1 deletion www/data/Physik.FSPHYS/php_include/init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<?php
namespace de\uni_muenster\fsphys;
namespace {
// Prevent errors from teasers being included in full pages
function member_teaser_start(): void {
if (function_exists('member_teaser_start_impl')) {
member_teaser_start_impl();
}
}
function member_teaser_end(): void {
if (function_exists('member_teaser_end_impl')) {
member_teaser_end_impl();
}
}
}

namespace de\uni_muenster\fsphys {
const LOG_EMAIL = 'fsphys@uni-muenster.de';
// all fatal PHP runtime errors (category “error”)
const E_CAT_ERROR = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR
Expand Down Expand Up @@ -124,3 +138,4 @@ function mail_and_log(\Throwable $exception): void {
}
});

}

0 comments on commit 5981237

Please sign in to comment.