@@ -279,19 +279,21 @@ public function getMessages(string $email, int $offset = 0, int $max = 20)
279279 $ dbc = $ this ->pdo ;
280280 if ($ dbc instanceof \PDO ) {
281281 $ emails = $ dbc ->prepare ("SELECT * FROM emails WHERE toaddr=:mail LIMIT :offset, :max " );
282- $ emails ->bindValue (':mail ' , $ email );
283- $ emails ->bindValue (':offset ' , $ offset , \PDO ::PARAM_INT );
284- $ emails ->bindValue (':max ' , $ max , \PDO ::PARAM_INT );
285- $ emails ->execute ();
286-
287- $ records = [];
288- while ($ record = $ emails ->fetchObject ('Mail\Messages ' )) {
289- $ records [] = $ record ;
290- }
282+ if (!is_bool ($ email )) {
283+ $ emails ->bindValue (':mail ' , $ email );
284+ $ emails ->bindValue (':offset ' , $ offset , \PDO ::PARAM_INT );
285+ $ emails ->bindValue (':max ' , $ max , \PDO ::PARAM_INT );
286+ $ emails ->execute ();
287+
288+ $ records = [];
289+ while ($ record = $ emails ->fetchObject ('Mail\Messages ' )) {
290+ $ records [] = $ record ;
291+ }
291292
292- unset($ emails );
293- if (\count ($ records ) > 0 )
294- return $ records ;
293+ unset($ emails );
294+ if (\count ($ records ) > 0 )
295+ return $ records ;
296+ }
295297 }
296298
297299 return false ;
@@ -302,17 +304,19 @@ public function getMessageAttachments(int $message_id)
302304 $ dbc = $ this ->pdo ;
303305 if ($ dbc instanceof \PDO ) {
304306 $ files = $ dbc ->prepare ("SELECT * FROM files WHERE email=:id " );
305- $ files ->bindValue (':id ' , $ message_id , \PDO ::PARAM_INT );
306- $ files ->execute ();
307+ if (!is_bool ($ files )) {
308+ $ files ->bindValue (':id ' , $ message_id , \PDO ::PARAM_INT );
309+ $ files ->execute ();
307310
308- $ records = [];
309- while ($ record = $ files ->fetchObject ('Mail\MessageAttachments ' )) {
310- $ records [] = $ record ;
311- }
311+ $ records = [];
312+ while ($ record = $ files ->fetchObject ('Mail\MessageAttachments ' )) {
313+ $ records [] = $ record ;
314+ }
312315
313- unset($ files );
314- if (\count ($ records ) > 0 )
315- return $ records ;
316+ unset($ files );
317+ if (\count ($ records ) > 0 )
318+ return $ records ;
319+ }
316320 }
317321
318322 return false ;
0 commit comments