diff program/steps/addressbook/photo.inc @ 21:73124dd49283

More cleaning up php8 Warnings/deprecations, noticed that setting non-my-Dates mailboxes to sort on Date isn't sticky over ctrl-R
author Charlie Root
date Thu, 09 Oct 2025 11:31:41 -0400
parents 4681f974d28b
children
line wrap: on
line diff
--- a/program/steps/addressbook/photo.inc	Wed Oct 08 09:42:21 2025 -0400
+++ b/program/steps/addressbook/photo.inc	Thu Oct 09 11:31:41 2025 -0400
@@ -24,6 +24,7 @@
 $cids   = rcmail_get_cids();
 $source = key($cids);
 $cid    = $cids ? array_shift($cids[$source]) : null;
+$data   = '';
 
 // read the referenced file
 if (($file_id = rcube_utils::get_input_value('_photo', rcube_utils::INPUT_GPC)) && ($tempfile = $_SESSION['contacts']['files'][$file_id])) {
@@ -57,7 +58,7 @@
         $record = $CONTACTS->get_record($cid, true);
     }
 
-    if ($record['photo']) {
+    if (!empty($record) && $record['photo']) {
         $data = is_array($record['photo']) ? $record['photo'][0] : $record['photo'];
         if (!preg_match('![^a-z0-9/=+-]!i', $data))
             $data = base64_decode($data, true);
@@ -69,7 +70,7 @@
     array('record' => $record, 'email' => $email, 'data' => $data));
 
 // redirect to url provided by a plugin
-if ($plugin['url']) {
+if ($plugin['url']??null) {
     $RCMAIL->output->redirect($plugin['url']);
 }