From 333d7556afd227374858ca9f426569c93c8e765e Mon Sep 17 00:00:00 2001 From: Philippe 'Peep' Chaintreuil Date: Mon, 3 Jul 2017 08:25:15 -0400 Subject: [PATCH 1/2] Disable qrcode if Endroid QrCode library is missing Treat a missing QrCode library the same as roundcube treats a missing php-gd library. Hide the button to disallow access. Requested by distributions that don't use composer and don't yet have packages for the QrCode library. --- program/steps/addressbook/show.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index 0c5a2d611..303c8c00a 100644 --- a/program/steps/addressbook/show.inc +++ b/program/steps/addressbook/show.inc @@ -43,7 +43,11 @@ if ($cid && ($record = ($CONTACT_RECORD ?: $CONTACTS->get_record($cid, true)))) rcmail_set_sourcename($CONTACTS); // Disable qr-code if php-gd is not installed -$OUTPUT->set_env('qrcode', function_exists('imagecreate')); +// Disable qr-code if Endriod's QrCode is not installed +$OUTPUT->set_env( + 'qrcode', + function_exists('imagecreate') && class_exists('Endroid\QrCode\QrCode') +); $OUTPUT->add_label('qrcode'); $OUTPUT->add_handlers(array( From b5e5e2d12afffb70e021788d2d7cee4f702946ab Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 3 Jul 2017 20:25:49 +0200 Subject: [PATCH 2/2] CS fix --- program/steps/addressbook/show.inc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index 303c8c00a..1a27207fd 100644 --- a/program/steps/addressbook/show.inc +++ b/program/steps/addressbook/show.inc @@ -42,12 +42,8 @@ if ($cid && ($record = ($CONTACT_RECORD ?: $CONTACTS->get_record($cid, true)))) // get address book name (for display) rcmail_set_sourcename($CONTACTS); -// Disable qr-code if php-gd is not installed -// Disable qr-code if Endriod's QrCode is not installed -$OUTPUT->set_env( - 'qrcode', - function_exists('imagecreate') && class_exists('Endroid\QrCode\QrCode') -); +// Disable qr-code if php-gd or Endroid's QrCode is not installed +$OUTPUT->set_env('qrcode', function_exists('imagecreate') && class_exists('Endroid\QrCode\QrCode')); $OUTPUT->add_label('qrcode'); $OUTPUT->add_handlers(array(