berichten: lege inhoud/samenvatting afvangen (PHP 8.1 deprecations)

Een leeg bericht (create_empty_bericht) gaf base64_decode(null); de
deprecation kwam lokaal voor de JSON van getAdminBerichten, waardoor
'nieuw bericht' vastliep. saveBericht vangt lege velden ook af.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 12:13:48 +02:00
co-authored by Claude Opus 5.5
parent 64c7031b50
commit 27b932f604
+4 -4
View File
@@ -124,7 +124,7 @@ class Berichten extends MY_Controller {
foreach ( $berichten ? $berichten : [] as $bericht ) foreach ( $berichten ? $berichten : [] as $bericht )
{ {
$bericht->datum = mysql2date( $bericht->startdatum ); $bericht->datum = mysql2date( $bericht->startdatum );
$bericht->inhoud = nl2br( base64_decode( $bericht->inhoud ) ); $bericht->inhoud = nl2br( base64_decode( $bericht->inhoud ?? '' ) );
} }
return $berichten; return $berichten;
} }
@@ -239,9 +239,9 @@ class Berichten extends MY_Controller {
return; return;
} }
$berichtID = $this->uri->segment( 4 ); $berichtID = $this->uri->segment( 4 );
$datum = str_replace( '/', '-', $this->input->post( 'datum' )); $datum = str_replace( '/', '-', $this->input->post( 'datum' ) ?? '');
$samenvatting = $this->input->post( 'samenvatting' ); $samenvatting = $this->input->post( 'samenvatting' ) ?? '';
$inhoud = $this->input->post( 'inhoud' ); $inhoud = $this->input->post( 'inhoud' ) ?? '';
$samenvatting = stripslashes( implode( "", explode( "\\", $samenvatting ))); $samenvatting = stripslashes( implode( "", explode( "\\", $samenvatting )));
if (! $samenvatting || ! strlen( $samenvatting )> 3){ if (! $samenvatting || ! strlen( $samenvatting )> 3){
$this->deletebericht($berichtID); $this->deletebericht($berichtID);