- $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
- intval($uid)
- );
- /// @TODO Handle $c with dbm::is_result()
-
- $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
- '$name' => htmlentities($c[0]['name']),
- '$photo' => $c[0]['photo'],
- 'url' => 'contacts/' . $cid
- ));
-
- if (! x($a->page,'aside')) {
- $a->page['aside'] = '';
+ $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
+
+ if (DBM::is_result($contact)) {
+ $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
+ '$name' => htmlentities($contact['name']),
+ '$photo' => $contact['photo'],
+ 'url' => 'contacts/' . $cid
+ ]);
+
+ if (!x($a->page, 'aside')) {
+ $a->page['aside'] = '';
+ }
+ $a->page['aside'] .= $vcard_widget;