Skip to content

Commit

Permalink
Hide QR-Code button if PHP-GD is not installed
Browse files Browse the repository at this point in the history
Keep it as an optional dependency.
  • Loading branch information
alecpl committed Jan 4, 2017
1 parent f78e2a4 commit 9d6aa00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions program/steps/addressbook/show.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ 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
$OUTPUT->set_env('qrcode', function_exists('imagecreate'));
$OUTPUT->add_label('qrcode');

$OUTPUT->add_handlers(array(
'contacthead' => 'rcmail_contact_head',
'contactdetails' => 'rcmail_contact_details',
Expand Down
2 changes: 2 additions & 0 deletions skins/classic/templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</div>
<p>
<roundcube:button command="edit" type="input" class="button" label="editcontact" condition="!ENV:readonly" />
<roundcube:if condition="env:qrcode" />
<roundcube:button command="qrcode" type="input" class="button" label="qrcode" />
<roundcube:endif />
</p>
</div>
<script type="text/javascript">rcube_init_tabs('contacttabs')</script>
Expand Down
2 changes: 2 additions & 0 deletions skins/larry/templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ <h1 class="boxtitle"><roundcube:label name="contactproperties" /></h1>

<div id="headerbuttons" class="formbuttons">
<roundcube:button command="edit" type="input" class="button mainaction" label="editcontact" condition="!ENV:readonly" />
<roundcube:if condition="env:qrcode" />
<roundcube:button command="qrcode" type="input" class="button" label="qrcode" />
<roundcube:endif />
</div>

<roundcube:include file="/includes/footer.html" />
Expand Down

0 comments on commit 9d6aa00

Please sign in to comment.