- $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'] = '';
+ $c = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]);
+
+ if (DBM::is_result($c)) {
+ $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), array(
+ '$name' => htmlentities($c['name']),
+ '$photo' => $c['photo'],
+ 'url' => 'contacts/' . $cid
+ ));
+
+ if (!x($a->page, 'aside')) {
+ $a->page['aside'] = '';
+ }
+ $a->page['aside'] .= $vcard_widget;