From f309f3a6810b5af5d3b778843533c1c69ddc090d Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Tue, 26 May 2015 14:32:40 +0200 Subject: [PATCH 1/3] remove html and use vcard-widget.tpl --- mod/allfriends.php | 11 +++++------ mod/common.php | 11 +++++------ mod/crepair.php | 9 +++++---- mod/photos.php | 12 ++++++++---- mod/videos.php | 12 ++++++++---- view/templates/vcard-widget.tpl | 13 ++++++++----- 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/mod/allfriends.php b/mod/allfriends.php index f675b8e29..bbdc5ef45 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -20,12 +20,11 @@ function allfriends_content(&$a) { intval(local_user()) ); - $a->page['aside'] .= '
' - . '
' . $c[0]['name'] . '
' - . '
' - . '' . $c[0]['name'] . '
' - . '
'; + $a->page['aside'] .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + '$name' => $c[0]['name'], + '$photo' => $c[0]['photo'], + 'url' => $a->get_baseurl() . '/contacts/' . $cid + )); if(! count($c)) diff --git a/mod/common.php b/mod/common.php index 617b5b670..574443f48 100644 --- a/mod/common.php +++ b/mod/common.php @@ -28,12 +28,11 @@ function common_content(&$a) { ); } - $a->page['aside'] .= '
' - . '
' . $c[0]['name'] . '
' - . '
' - . '' . $c[0]['name'] . '
' - . '
'; + $a->page['aside'] .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + '$name' => $c[0]['name'], + '$photo' => $c[0]['photo'], + 'url' => $a->get_baseurl() . '/contacts/' . $cid + )); if(! count($c)) diff --git a/mod/crepair.php b/mod/crepair.php index 55231faf7..7cc67d4c8 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -22,10 +22,11 @@ function crepair_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; - $o .= '
'; - $o .= '
' . $a->data['contact']['name'] . '
'; - $o .= '
' . $a->data['contact']['name'] . '
'; - $o .= '
'; + $tpl = get_markup_template("vcard-widget.tpl"); + $o .= replace_macros($tpl, array( + '$name' => $a->data['contact']['name'], + '$photo' => $a->data['contact']['photo'] + )); $a->page['aside'] .= $o; } diff --git a/mod/photos.php b/mod/photos.php index f8bba01b0..657f23236 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"); + + $o .= replace_macros($tpl, array( + '$name' => $a->data['user']['username'], + '$photo' => $profilephoto + )); $sql_extra = permissions_sql($a->data['user']['uid']); diff --git a/mod/videos.php b/mod/videos.php index 0f29e631b..bc076e740 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"); + + $o .= replace_macros($tpl, array( + '$name' => $a->data['user']['username'], + '$photo' => $profilephoto + )); /*$sql_extra = permissions_sql($a->data['user']['uid']); 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}}
+ {{if $url}} +
{{$name}}
+ {{else}} +
{{$name}}
+ {{/if}} +
From 1067718018610cda4b544c5b106a89af109a48c9 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 27 May 2015 12:44:40 +0200 Subject: [PATCH 2/3] little revision --- mod/allfriends.php | 7 +++++-- mod/common.php | 7 +++++-- mod/crepair.php | 4 ++-- mod/photos.php | 3 ++- mod/videos.php | 4 ++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/mod/allfriends.php b/mod/allfriends.php index bbdc5ef45..b73c55c22 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -20,12 +20,15 @@ function allfriends_content(&$a) { intval(local_user()) ); - $a->page['aside'] .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $c[0]['name'], '$photo' => $c[0]['photo'], 'url' => $a->get_baseurl() . '/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 574443f48..6a1bf4e31 100644 --- a/mod/common.php +++ b/mod/common.php @@ -28,12 +28,15 @@ function common_content(&$a) { ); } - $a->page['aside'] .= replace_macros(get_markup_template("vcard-widget.tpl"),array( + $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $c[0]['name'], '$photo' => $c[0]['photo'], 'url' => $a->get_baseurl() . '/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 7cc67d4c8..457a06685 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -23,11 +23,11 @@ function crepair_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; $tpl = get_markup_template("vcard-widget.tpl"); - $o .= replace_macros($tpl, array( + $vcard_widget .= replace_macros($tpl, array( '$name' => $a->data['contact']['name'], '$photo' => $a->data['contact']['photo'] )); - $a->page['aside'] .= $o; + $a->page['aside'] .= $vcard_widget; } } diff --git a/mod/photos.php b/mod/photos.php index 657f23236..ebb88c739 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -34,7 +34,7 @@ function photos_init(&$a) { $tpl = get_markup_template("vcard-widget.tpl"); - $o .= replace_macros($tpl, array( + $vcard_widget .= replace_macros($tpl, array( '$name' => $a->data['user']['username'], '$photo' => $profilephoto )); @@ -76,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 bc076e740..5553bbbeb 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -32,7 +32,7 @@ function videos_init(&$a) { $tpl = get_markup_template("vcard-widget.tpl"); - $o .= replace_macros($tpl, array( + $vcard_widget = replace_macros($tpl, array( '$name' => $a->data['user']['username'], '$photo' => $profilephoto )); @@ -74,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"); From 5990d62b06c1de259e6844341c9de1c191e5a5ac Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 28 May 2015 16:15:48 +0200 Subject: [PATCH 3/3] use z_root --- mod/allfriends.php | 2 +- mod/common.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/allfriends.php b/mod/allfriends.php index b73c55c22..c32a05a2c 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -23,7 +23,7 @@ function allfriends_content(&$a) { $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $c[0]['name'], '$photo' => $c[0]['photo'], - 'url' => $a->get_baseurl() . '/contacts/' . $cid + 'url' => z_root() . '/contacts/' . $cid )); if(! x($a->page,'aside')) diff --git a/mod/common.php b/mod/common.php index 6a1bf4e31..a4320f9eb 100644 --- a/mod/common.php +++ b/mod/common.php @@ -31,12 +31,12 @@ function common_content(&$a) { $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $c[0]['name'], '$photo' => $c[0]['photo'], - 'url' => $a->get_baseurl() . '/contacts/' . $cid + 'url' => z_root() . '/contacts/' . $cid )); if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= $vcard_widget; + $a->page['aside'] .= $vcard_widget; if(! count($c)) return;