diff --git a/mod/allfriends.php b/mod/allfriends.php index f675b8e29..c32a05a2c 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -20,13 +20,15 @@ function allfriends_content(&$a) { intval(local_user()) ); - $a->page['aside'] .= '
' - . '
' . $c[0]['name'] . '
' - . '
' - . '' . $c[0]['name'] . '
' - . '
'; - + $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + '$name' => $c[0]['name'], + '$photo' => $c[0]['photo'], + 'url' => z_root() . '/contacts/' . $cid + )); + + if(! x($a->page,'aside')) + $a->page['aside'] = ''; + $a->page['aside'] .= $vcard_widget; if(! count($c)) return; diff --git a/mod/common.php b/mod/common.php index 617b5b670..a4320f9eb 100644 --- a/mod/common.php +++ b/mod/common.php @@ -28,13 +28,15 @@ function common_content(&$a) { ); } - $a->page['aside'] .= '
' - . '
' . $c[0]['name'] . '
' - . '
' - . '' . $c[0]['name'] . '
' - . '
'; - + $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + '$name' => $c[0]['name'], + '$photo' => $c[0]['photo'], + 'url' => z_root() . '/contacts/' . $cid + )); + + if(! x($a->page,'aside')) + $a->page['aside'] = ''; + $a->page['aside'] .= $vcard_widget; if(! count($c)) return; diff --git a/mod/crepair.php b/mod/crepair.php index 55231faf7..457a06685 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -22,11 +22,12 @@ function crepair_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; - $o .= '
'; - $o .= '
' . $a->data['contact']['name'] . '
'; - $o .= '
' . $a->data['contact']['name'] . '
'; - $o .= '
'; - $a->page['aside'] .= $o; + $tpl = get_markup_template("vcard-widget.tpl"); + $vcard_widget .= replace_macros($tpl, array( + '$name' => $a->data['contact']['name'], + '$photo' => $a->data['contact']['photo'] + )); + $a->page['aside'] .= $vcard_widget; } } diff --git a/mod/photos.php b/mod/photos.php index f8bba01b0..ebb88c739 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -30,10 +30,14 @@ function photos_init(&$a) { $a->data['user'] = $r[0]; - $o .= '
'; - $o .= '
' . $a->data['user']['username'] . '
'; - $o .= '
' . $a->data['user']['username'] . '
'; - $o .= '
'; + $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + + $tpl = get_markup_template("vcard-widget.tpl"); + + $vcard_widget .= replace_macros($tpl, array( + '$name' => $a->data['user']['username'], + '$photo' => $profilephoto + )); $sql_extra = permissions_sql($a->data['user']['uid']); @@ -72,6 +76,7 @@ function photos_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; + $a->page['aside'] .= $vcard_widget; $a->page['aside'] .= $o; diff --git a/mod/videos.php b/mod/videos.php index 607c900eb..943a9d09f 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -28,10 +28,14 @@ function videos_init(&$a) { $a->data['user'] = $r[0]; - $o .= '
'; - $o .= '
' . $a->data['user']['username'] . '
'; - $o .= '
' . $a->data['user']['username'] . '
'; - $o .= '
'; + $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + + $tpl = get_markup_template("vcard-widget.tpl"); + + $vcard_widget = replace_macros($tpl, array( + '$name' => $a->data['user']['username'], + '$photo' => $profilephoto + )); /*$sql_extra = permissions_sql($a->data['user']['uid']); @@ -70,7 +74,7 @@ function videos_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= $o; + $a->page['aside'] .= $vcard_widget; $tpl = get_markup_template("videos_head.tpl"); diff --git a/view/templates/vcard-widget.tpl b/view/templates/vcard-widget.tpl index bc1a571be..04e26607a 100644 --- a/view/templates/vcard-widget.tpl +++ b/view/templates/vcard-widget.tpl @@ -1,6 +1,9 @@ -
-
{{$name}}
-
{{$name}}
-
- +
+
{{$name}}
+ {{if $url}} +
{{$name}}
+ {{else}} +
{{$name}}
+ {{/if}} +