From 89c5989cfb679449fb776df7380e972d0f676d8d Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Tue, 1 Dec 2015 18:31:08 +0100 Subject: [PATCH 1/4] unify hcard and vcard --- include/identity.php | 115 +++++++++++------- include/text.php | 22 ++++ mod/contacts.php | 32 ++--- mod/crepair.php | 28 +++-- mod/directory.php | 4 +- mod/photos.php | 23 ++-- mod/videos.php | 23 ++-- view/templates/profile_vcard.tpl | 3 +- view/templates/vcard-widget.tpl | 17 ++- view/theme/duepuntozero/style.css | 11 +- .../duepuntozero/templates/profile_vcard.tpl | 4 +- view/theme/frost-mobile/style.css | 12 +- .../frost-mobile/templates/profile_vcard.tpl | 4 +- view/theme/frost/style.css | 11 +- view/theme/frost/templates/profile_vcard.tpl | 4 +- view/theme/quattro/dark/style.css | 6 +- view/theme/quattro/green/style.css | 6 +- view/theme/quattro/lilac/style.css | 6 +- view/theme/quattro/quattro.less | 3 +- .../theme/quattro/templates/profile_vcard.tpl | 4 +- view/theme/smoothly/style.css | 10 +- view/theme/vier/style.css | 5 + view/theme/vier/templates/profile_vcard.tpl | 5 +- 23 files changed, 234 insertions(+), 124 deletions(-) diff --git a/include/identity.php b/include/identity.php index 48fd5056d..7bd2d2cbc 100644 --- a/include/identity.php +++ b/include/identity.php @@ -45,39 +45,9 @@ if(! function_exists('profile_load')) { return; } - if(remote_user() && count($_SESSION['remote'])) { - foreach($_SESSION['remote'] as $visitor) { - if($visitor['uid'] == $user[0]['uid']) { - $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", - intval($visitor['cid']) - ); - if(count($r)) - $profile = $r[0]['profile-id']; - break; - } - } - } + $pdata = get_profiledata_by_nick($nickname, $user[0]['uid'], $profile); - $r = null; - - if($profile) { - $profile_int = intval($profile); - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr` AS faddr, `user`.* FROM `profile` - INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` - WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d AND `contact`.`self` = 1 LIMIT 1", - dbesc($nickname), - intval($profile_int) - ); - } - if((!$r) && (!count($r))) { - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr` AS faddr, `user`.* FROM `profile` - INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` - WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 AND `contact`.`self` = 1 LIMIT 1", - dbesc($nickname) - ); - } - - if(($r === false) || (!count($r)) && !count($profiledata)) { + if(($pdata === false) || (!count($pdata)) && !count($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice( t('Requested profile is not available.') . EOL ); $a->error = 404; @@ -86,16 +56,16 @@ if(! function_exists('profile_load')) { // fetch user tags if this isn't the default profile - if(!$r[0]['is-default']) { + if(!$pdata['is-default']) { $x = q("SELECT `pub_keywords` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", - intval($r[0]['profile_uid']) + intval($pdata['profile_uid']) ); if($x && count($x)) - $r[0]['pub_keywords'] = $x[0]['pub_keywords']; + $pdata['pub_keywords'] = $x[0]['pub_keywords']; } - $a->profile = $r[0]; - $a->profile_uid = $r[0]['profile_uid']; + $a->profile = $pdata; + $a->profile_uid = $pdata['profile_uid']; $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['network'] = NETWORK_DFRN; @@ -147,6 +117,58 @@ if(! function_exists('profile_load')) { } +/** + * @brief Get all profil data of a local user + * If the viewer is an authenticated remote viewer, the profile displayed is the + * one that has been configured for his/her viewing in the Contact manager. + * Passing a non-zero profile ID can also allow a preview of a selected profile + * by the owner + * + * @param string $nickname + * @param int $uid + * @param int $profile + * ID of the profile + * @returns array + * Includes all available profile data + */ +function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) { + if(remote_user() && count($_SESSION['remote'])) { + foreach($_SESSION['remote'] as $visitor) { + if($visitor['uid'] == $uid) { + $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", + intval($visitor['cid']) + ); + if(count($r)) + $profile = $r[0]['profile-id']; + break; + } + } + } + + $r = null; + + if($profile) { + $profile_int = intval($profile); + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.* FROM `profile` + INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` + WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d AND `contact`.`self` = 1 LIMIT 1", + dbesc($nickname), + intval($profile_int) + ); + } + if((!$r) && (!count($r))) { + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.* FROM `profile` + INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` + WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 AND `contact`.`self` = 1 LIMIT 1", + dbesc($nickname) + ); + } + + return $r[0]; + +} + + /** * * Function: profile_sidebar @@ -161,8 +183,6 @@ if(! function_exists('profile_load')) { * Exceptions: Returns empty string if passed $profile is wrong type or not populated * */ - - if(! function_exists('profile_sidebar')) { function profile_sidebar($profile, $block = 0) { $a = get_app(); @@ -178,12 +198,8 @@ if(! function_exists('profile_sidebar')) { $profile['picdate'] = urlencode($profile['picdate']); if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) { - require_once('include/contact_selectors.php'); - if ($profile['url'] != "") - $profile['network_name'] = ''.network_to_name($profile['network'], $profile['url']).""; - else - $profile['network_name'] = network_to_name($profile['network']); - } else + $profile['network_name'] = format_network_name($profile['network'],$profile['url']); + } else $profile['network_name'] = ""; call_hooks('profile_sidebar_enter', $profile); @@ -270,6 +286,14 @@ if(! function_exists('profile_sidebar')) { ); } + if((x($profile['page-flags']) == 1) + || (x($profile['page-flags']) == 2) + || (x($profile['page-flags']) == 5)) + $account_type = page_type_translate($profile['page-flags']); + + if(! $account_type) + $account_type = (x($profile['forum']) || x($profile['prv']) || (x($profile['community'])) ? t('Forum') : ""); + if((x($profile,'address') == 1) || (x($profile,'locality') == 1) || (x($profile,'region') == 1) @@ -344,6 +368,7 @@ if(! function_exists('profile_sidebar')) { '$remoteconnect' => $remoteconnect, '$subscribe_feed' => $subscribe_feed, '$wallmessage' => $wallmessage, + '$account_type' => $account_type, '$location' => $location, '$gender' => $gender, '$pdesc' => $pdesc, diff --git a/include/text.php b/include/text.php index 253489180..89a58cccc 100644 --- a/include/text.php +++ b/include/text.php @@ -2318,3 +2318,25 @@ function page_type_translate($page_type) { return $trans_type; } + +/** + * @brief translate and format the networkname of a contact + * + * @param string $network + * Networkname of the contact (e.g. dfrn, rss and so on) + * @param sting $url + * The contact url + * @return string + */ +function format_network_name($network, $url = 0) { + if ($network != "") { + require_once('include/contact_selectors.php'); + if ($url != "") + $network_name = ''.network_to_name($network, $url).""; + else + $network_name = network_to_name($network); + + return $network_name; + } + +} diff --git a/mod/contacts.php b/mod/contacts.php index 992f8ed6b..f1829a183 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -35,10 +35,20 @@ function contacts_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; + + if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) { + $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']); + } else + $networkname = ''; + $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => htmlentities($a->data['contact']['name']), '$photo' => $a->data['contact']['photo'], - '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? z_root()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] + '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? z_root()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'], + '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""), + '$network_name' => $networkname, + '$network' => t('Network:'), + 'account_type' => (($a->data['contact']['forum'] || $a->data['contact']['prv']) ? t('Forum') : '') )); $finpeople_widget = ''; $follow_widget = ''; @@ -570,16 +580,8 @@ function contacts_content(&$a) { $follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]); - $header = $contact["name"]; - - if ($contact["addr"] != "") - $header .= " <".$contact["addr"].">"; - - $header .= " (".network_to_name($contact['network'], $contact['url']).")"; - $o .= replace_macros($tpl, array( //'$header' => t('Contact Editor'), - '$header' => htmlentities($header), '$tab_str' => $tab_str, '$submit' => t('Submit'), '$lbl_vis1' => t('Profile Visibility'), @@ -905,18 +907,6 @@ function contact_posts($a, $contact_id) { $tab_str = contact_tabs($a, $contact_id, 1); - $header = $contact["name"]; - - if ($contact["addr"] != "") - $header .= " <".$contact["addr"].">"; - - $header .= " (".network_to_name($contact['network'], $contact['url']).")"; - - $tpl = get_markup_template("section_title.tpl"); - $o = replace_macros($tpl,array( - '$title' => htmlentities($header) - )); - $o .= $tab_str; $o .= conversation($a,$r,'community',false); diff --git a/mod/crepair.php b/mod/crepair.php index d16adf8c7..98202ae0b 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -24,11 +24,22 @@ function crepair_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; - $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget .= replace_macros($tpl, array( - '$name' => htmlentities($a->data['contact']['name']), - '$photo' => $a->data['contact']['photo'] - )); + + if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) { + $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']); + } else + $networkname = ''; + + $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( + '$name' => htmlentities($a->data['contact']['name']), + '$photo' => $a->data['contact']['photo'], + '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? z_root()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'], + '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""), + '$network_name' => $networkname, + '$network' => t('Network:'), + 'account_type' => (($a->data['contact']['forum'] || $a->data['contact']['prv']) ? t('Forum') : '') + )); + $a->page['aside'] .= $vcard_widget; } @@ -161,17 +172,10 @@ function crepair_content(&$a) { $tab_str = contact_tabs($a, $contact['id'], 3); - $header = $contact["name"]; - - if ($contact["addr"] != "") - $header .= " <".$contact["addr"].">"; - - $header .= " (".network_to_name($contact['network'], $contact['url']).")"; $tpl = get_markup_template('crepair.tpl'); $o .= replace_macros($tpl, array( //'$title' => t('Repair Contact Settings'), - '$title' => htmlentities($header), '$tab_str' => $tab_str, '$warning' => $warning, '$info' => $info, diff --git a/mod/directory.php b/mod/directory.php index bedc71907..cb233db89 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -86,7 +86,7 @@ function directory_content(&$a) { $limit = intval($a->pager['start']).",".intval($a->pager['itemspage']); $r = $db->q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`, - `contact`.`addr` AS faddr, `contact`.`url` AS profile_url FROM `profile` + `contact`.`addr`, `contact`.`url` AS profile_url FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit); @@ -102,7 +102,7 @@ function directory_content(&$a) { $community = ''; $itemurl= ''; - $itemurl = (($rr['faddr'] != "") ? $rr['faddr'] : $rr['profile_url']); + $itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']); $profile_link = z_root() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); diff --git a/mod/photos.php b/mod/photos.php index 5ca973d16..3f8d3afaf 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -24,24 +24,31 @@ function photos_init(&$a) { if($a->argc > 1) { $nick = $a->argv[1]; - $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", + $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", dbesc($nick) ); - if(! count($r)) + if(! count($user)) return; - $a->data['user'] = $r[0]; - $a->profile_uid = $r[0]['uid']; + $a->data['user'] = $user[0]; + $a->profile_uid = $user[0]['uid']; $is_owner = (local_user() && (local_user() == $a->profile_uid)); - $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + $profile = get_profiledata_by_nick($nick, $a->profile_uid); + + if((x($profile['page-flags']) == 1) + || (x($profile['page-flags']) == 2) + || (x($profile['page-flags']) == 5)) + $account_type = page_type_translate($profile['page-flags']); $tpl = get_markup_template("vcard-widget.tpl"); $vcard_widget .= replace_macros($tpl, array( - '$name' => $a->data['user']['username'], - '$photo' => $profilephoto + '$name' => $profile[name], + '$photo' => $profile[photo], + '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ''), + '$account_type' => $account_type, )); @@ -89,7 +96,7 @@ function photos_init(&$a) { $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array( '$nick' => $a->data['user']['nickname'], '$title' => t('Photo Albums'), - 'recent' => t('Recent Photos'), + '$recent' => t('Recent Photos'), '$albums' => $albums['albums'], '$baseurl' => z_root(), '$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'), diff --git a/mod/videos.php b/mod/videos.php index 4f5d7cd22..ae00185cc 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -21,23 +21,30 @@ function videos_init(&$a) { if($a->argc > 1) { $nick = $a->argv[1]; - $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", + $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", dbesc($nick) ); - if(! count($r)) + if(! count($user)) return; - $a->data['user'] = $r[0]; - $a->profile_uid = $r[0]['uid']; + $a->data['user'] = $user[0]; + $a->profile_uid = $user[0]['uid']; - $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + $profile = get_profiledata_by_nick($nick, $a->profile_uid); + + if((x($profile['page-flags']) == 1) + || (x($profile['page-flags']) == 2) + || (x($profile['page-flags']) == 5)) + $account_type = page_type_translate($profile['page-flags']); $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, array( - '$name' => $a->data['user']['username'], - '$photo' => $profilephoto + $vcard_widget .= replace_macros($tpl, array( + '$name' => $profile[name], + '$photo' => $profile[photo], + '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ''), + '$account_type' => $account_type, )); diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index fa209bf46..1b4e6a6ee 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -3,7 +3,7 @@
{{$profile.name}}
- {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} @@ -12,6 +12,7 @@ {{else}}
{{$profile.name}}
{{/if}} + {{if $account_type}}
{{$account_type}}
{{/if}} {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
diff --git a/view/templates/vcard-widget.tpl b/view/templates/vcard-widget.tpl index 04e26607a..77405614c 100644 --- a/view/templates/vcard-widget.tpl +++ b/view/templates/vcard-widget.tpl @@ -1,9 +1,14 @@
-
{{$name}}
- {{if $url}} -
{{$name}}
- {{else}} -
{{$name}}
- {{/if}} +
{{$name}}
+ {{if $addr}}
{{$addr}}
{{/if}} + {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $url}} +
{{$name}}
+ {{else}} +
{{$name}}
+ {{/if}} + {{if $account_type}}{{/if}} + {{if $network_name}}
{{$network}}
{{$network_name}}
{{/if}} +
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 903846e69..76bbab8e0 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2492,14 +2492,14 @@ aside input[type='text'] { margin-bottom: 25px; } -.location-label, .gender-label, .marital-label, .homepage-label { +.location-label, .gender-label, .marital-label, .homepage-label, .network-label { float: left; text-align: right; display: block; width: 65px; } -.adr, .x-gender, .marital-text, .homepage-url { +.adr, .x-gender, .marital-text, .homepage-url, .x-network { float: left; display: block; margin-left: 8px; @@ -2538,11 +2538,16 @@ aside input[type='text'] { } .vcard .title, -.vcard .p-faddr { +.vcard .p-addr { margin-bottom: 5px; margin-left: 12px; } +.vcard .account-type { + font-size: 120%; + margin-bottom: 13px; +} + .vcard dl { clear: both; } diff --git a/view/theme/duepuntozero/templates/profile_vcard.tpl b/view/theme/duepuntozero/templates/profile_vcard.tpl index fb5d4e420..bfcbda798 100644 --- a/view/theme/duepuntozero/templates/profile_vcard.tpl +++ b/view/theme/duepuntozero/templates/profile_vcard.tpl @@ -3,12 +3,14 @@
{{$profile.name}}
- {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
+ {{if $account_type}}
{{$account_type}}
{{/if}} + {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
diff --git a/view/theme/frost-mobile/style.css b/view/theme/frost-mobile/style.css index a4af7f907..91dd907a0 100644 --- a/view/theme/frost-mobile/style.css +++ b/view/theme/frost-mobile/style.css @@ -3081,14 +3081,14 @@ aside input[type='text'] { margin-bottom: 25px; } -.location-label, .gender-label, .marital-label, .homepage-label { +.location-label, .gender-label, .marital-label, .homepage-label, .network-label { float: left; text-align: right; display: block; width: 65px; } -.adr, .x-gender, .marital-text, .homepage-url { +.adr, .x-gender, .marital-text, .homepage-url, .x-network { float: left; display: block; margin-left: 8px; @@ -3127,11 +3127,17 @@ aside input[type='text'] { } .vcard .title, -.vcard .p-faddr { +.vcard .p-addr, +.vcard .account-type { margin-bottom: 5px; margin-left: 12px; } +.vcard .account-type { + font-size: 120%; + margin-bottom: 13px; +} + .vcard dl { clear: both; } diff --git a/view/theme/frost-mobile/templates/profile_vcard.tpl b/view/theme/frost-mobile/templates/profile_vcard.tpl index 515740871..a7ea8e6a0 100644 --- a/view/theme/frost-mobile/templates/profile_vcard.tpl +++ b/view/theme/frost-mobile/templates/profile_vcard.tpl @@ -3,12 +3,14 @@
{{$profile.name}}
- {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
+ {{if $account_type}}{{/if}} + {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
diff --git a/view/theme/frost/style.css b/view/theme/frost/style.css index 7b2b1358c..7cf1c8a98 100644 --- a/view/theme/frost/style.css +++ b/view/theme/frost/style.css @@ -2867,14 +2867,14 @@ aside input[type='text'] { margin-bottom: 25px; } -.location-label, .gender-label, .marital-label, .homepage-label { +.location-label, .gender-label, .marital-label, .homepage-label, .network-label { float: left; text-align: right; display: block; width: 65px; } -.adr, .x-gender, .marital-text, .homepage-url { +.adr, .x-gender, .marital-text, .homepage-url, .x-network { float: left; display: block; margin-left: 8px; @@ -2913,10 +2913,15 @@ aside input[type='text'] { } .vcard .title, -.vcard .p-faddr { +.vcard .p-addr, +.vcard .account-type { margin-bottom: 5px; margin-left: 12px; } +.vcard .account-type { + font-size: 120%; + margin-bottom: 13px; +} .vcard dl { clear: both; diff --git a/view/theme/frost/templates/profile_vcard.tpl b/view/theme/frost/templates/profile_vcard.tpl index b8f59ccaa..9d1a37016 100644 --- a/view/theme/frost/templates/profile_vcard.tpl +++ b/view/theme/frost/templates/profile_vcard.tpl @@ -3,12 +3,14 @@
{{$profile.name}}
- {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
+ {{if $account_type}}{{/if}} + {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
diff --git a/view/theme/quattro/dark/style.css b/view/theme/quattro/dark/style.css index 1ff2de700..33b236d0b 100644 --- a/view/theme/quattro/dark/style.css +++ b/view/theme/quattro/dark/style.css @@ -833,9 +833,13 @@ aside .vcard .fn { aside .vcard .title { margin-bottom: 5px; } -aside .vcard .p-faddr { +aside .vcard .p-addr { margin-bottom: 5px; } +aside .vcard .account-type { + font-size: 14px; + margin-bottom: 13px; +} aside .vcard dl { height: auto; overflow: auto; diff --git a/view/theme/quattro/green/style.css b/view/theme/quattro/green/style.css index 2b05335e0..e98572434 100644 --- a/view/theme/quattro/green/style.css +++ b/view/theme/quattro/green/style.css @@ -833,9 +833,13 @@ aside .vcard .fn { aside .vcard .title { margin-bottom: 5px; } -aside .vcard .p-faddr { +aside .vcard .p-addr { margin-bottom: 5px; } +aside .vcard .account-type { + font-size: 14px; + margin-bottom: 13px; +} aside .vcard dl { height: auto; overflow: auto; diff --git a/view/theme/quattro/lilac/style.css b/view/theme/quattro/lilac/style.css index ec0982a75..1d72a7146 100644 --- a/view/theme/quattro/lilac/style.css +++ b/view/theme/quattro/lilac/style.css @@ -833,9 +833,13 @@ aside .vcard .fn { aside .vcard .title { margin-bottom: 5px; } -aside .vcard .p-faddr { +aside .vcard .p-addr { margin-bottom: 5px; } +aside .vcard .account-type { + font-size: 14px; + margin-bottom: 13px; +} aside .vcard dl { height: auto; overflow: auto; diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less index b6bed2c9c..c698497a1 100644 --- a/view/theme/quattro/quattro.less +++ b/view/theme/quattro/quattro.less @@ -332,7 +332,8 @@ aside { .vcard { .fn { font-size: 16px; font-weight: bold; margin-bottom: 5px; } .title { margin-bottom: 5px; } - .p-faddr{ margin-bottom: 5px; } + .p-addr { margin-bottom: 5px; } + .account-type { font-size: 14px; margin-bottom: 13px; } dl { height: auto; overflow: auto; } dt {float: left; margin-left: 0px; width: 35%; text-align: right; color: @VCardLabelColor; } dd {float: left; margin-left: 4px; width: 60%;} diff --git a/view/theme/quattro/templates/profile_vcard.tpl b/view/theme/quattro/templates/profile_vcard.tpl index 7a06e7588..f4eae78d2 100644 --- a/view/theme/quattro/templates/profile_vcard.tpl +++ b/view/theme/quattro/templates/profile_vcard.tpl @@ -26,12 +26,14 @@ {{/if}} - {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
+ {{if $account_type}}{{/if}} + {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index 45d2629da..37d1c53a7 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -665,6 +665,10 @@ aside h4 { font-size: 1em; } +.vcard .account-type { + font-size: 1.2em; +} + .vcard dd { font-size: 12px; font-variant: normal; @@ -4554,7 +4558,8 @@ hr.line-dots { .location-label, .gender-label, .marital-label, -.homepage-label { +.homepage-label, +.network-label { float: left; text-align: left; display: block; @@ -4564,7 +4569,8 @@ hr.line-dots { .adr, .x-gender, .marital-text, -.homepage-url { +.homepage-url, +.x-network { float: left; display: block; margin-left: 8px; diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 2892862da..6313d2f0d 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -998,6 +998,11 @@ aside .vcard dl { height: auto; overflow: auto; } +aside .vcard .account-type { + margin-bottom: 13px; + font-size: 14px; + font-weight: bold; +} aside select { background-color: white; diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl index 1882c1558..d81faf175 100644 --- a/view/theme/vier/templates/profile_vcard.tpl +++ b/view/theme/vier/templates/profile_vcard.tpl @@ -13,7 +13,7 @@ {{/if}} - {{if $profile.faddr}}
{{$profile.faddr}}
{{/if}} + {{if $profile.addr}}
{{$profile.addr}}
{{/if}} {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} @@ -22,7 +22,8 @@ {{else}}
{{$profile.name}}
{{/if}} - + + {{if $account_type}}{{/if}} {{if $profile.network_name}}
{{$network}}
{{$profile.network_name}}
{{/if}} {{if $location}}
{{$location}}
From cd7ec72b205ad2e2b177a9a76888e73a065b831c Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Tue, 1 Dec 2015 19:47:23 +0100 Subject: [PATCH 2/4] unify hcard and vcard: make $pdesc available in hcard&vcard --- include/identity.php | 4 ++-- mod/photos.php | 15 ++++++++++----- mod/videos.php | 15 ++++++++++----- view/templates/profile_vcard.tpl | 2 +- view/templates/vcard-widget.tpl | 2 +- .../duepuntozero/templates/profile_vcard.tpl | 2 +- .../frost-mobile/templates/profile_vcard.tpl | 2 +- view/theme/frost/templates/profile_vcard.tpl | 2 +- view/theme/vier/style.css | 1 + view/theme/vier/templates/profile_vcard.tpl | 2 +- 10 files changed, 29 insertions(+), 18 deletions(-) diff --git a/include/identity.php b/include/identity.php index e412c68c9..b9984f10a 100644 --- a/include/identity.php +++ b/include/identity.php @@ -190,7 +190,7 @@ if(! function_exists('profile_sidebar')) { $o = ''; $location = false; $address = false; - $pdesc = true; +// $pdesc = true; if((! is_array($profile)) && (! count($profile))) return $o; @@ -371,7 +371,7 @@ if(! function_exists('profile_sidebar')) { '$account_type' => $account_type, '$location' => $location, '$gender' => $gender, - '$pdesc' => $pdesc, +// '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, '$about' => $about, diff --git a/mod/photos.php b/mod/photos.php index 3f8d3afaf..7ca850bc9 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -37,18 +37,23 @@ function photos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((x($profile['page-flags']) == 1) + if((x($profile['page-flags']) == 1) || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) + || (x($profile['page-flags']) == 5)) { $account_type = page_type_translate($profile['page-flags']); + } + else { + $account_type = ""; + } $tpl = get_markup_template("vcard-widget.tpl"); $vcard_widget .= replace_macros($tpl, array( - '$name' => $profile[name], - '$photo' => $profile[photo], - '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ''), + '$name' => $profile['name'], + '$photo' => $profile['photo'], + '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""), '$account_type' => $account_type, + '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""), )); diff --git a/mod/videos.php b/mod/videos.php index ae00185cc..de9feac06 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -33,18 +33,23 @@ function videos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((x($profile['page-flags']) == 1) + if((x($profile['page-flags']) == 1) || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) + || (x($profile['page-flags']) == 5)) { $account_type = page_type_translate($profile['page-flags']); + } + else { + $account_type = ""; + } $tpl = get_markup_template("vcard-widget.tpl"); $vcard_widget .= replace_macros($tpl, array( - '$name' => $profile[name], - '$photo' => $profile[photo], - '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ''), + '$name' => $profile['name'], + '$photo' => $profile['photo'], + '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""), '$account_type' => $account_type, + '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""), )); diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index 1b4e6a6ee..0a3a13f9d 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}} {{if $profile.picdate}}
{{$profile.name}}
diff --git a/view/templates/vcard-widget.tpl b/view/templates/vcard-widget.tpl index 77405614c..ec59fa46d 100644 --- a/view/templates/vcard-widget.tpl +++ b/view/templates/vcard-widget.tpl @@ -2,7 +2,7 @@
{{$name}}
{{if $addr}}
{{$addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $pdesc}}
{{$pdesc}}
{{/if}} {{if $url}}
{{$name}}
{{else}} diff --git a/view/theme/duepuntozero/templates/profile_vcard.tpl b/view/theme/duepuntozero/templates/profile_vcard.tpl index bfcbda798..bd2e92f9e 100644 --- a/view/theme/duepuntozero/templates/profile_vcard.tpl +++ b/view/theme/duepuntozero/templates/profile_vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
{{if $account_type}}{{/if}} diff --git a/view/theme/frost-mobile/templates/profile_vcard.tpl b/view/theme/frost-mobile/templates/profile_vcard.tpl index a7ea8e6a0..b3024074b 100644 --- a/view/theme/frost-mobile/templates/profile_vcard.tpl +++ b/view/theme/frost-mobile/templates/profile_vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
{{if $account_type}}{{/if}} diff --git a/view/theme/frost/templates/profile_vcard.tpl b/view/theme/frost/templates/profile_vcard.tpl index 9d1a37016..1a0c39a82 100644 --- a/view/theme/frost/templates/profile_vcard.tpl +++ b/view/theme/frost/templates/profile_vcard.tpl @@ -5,7 +5,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}}
{{$profile.name}}
{{if $account_type}}{{/if}} diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 94390d7a4..97a3aaaf9 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -993,6 +993,7 @@ aside .vcard .fn { } aside .vcard .title { margin-bottom: 5px; + float: left; } aside .vcard dl { height: auto; diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl index d81faf175..a3b08947d 100644 --- a/view/theme/vier/templates/profile_vcard.tpl +++ b/view/theme/vier/templates/profile_vcard.tpl @@ -15,7 +15,7 @@ {{if $profile.addr}}
{{$profile.addr}}
{{/if}} - {{if $pdesc}}
{{$profile.pdesc}}
{{/if}} + {{if $profile.pdesc}}
{{$profile.pdesc}}
{{/if}} {{if $profile.picdate}}
{{$profile.name}}
From d963cdfe48b536a4c5eeeae54acf97493fca304f Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 2 Dec 2015 20:01:22 +0100 Subject: [PATCH 3/4] photos-albms widget: add some classes --- include/identity.php | 16 +++++++++------- mod/photos.php | 10 +++------- mod/videos.php | 10 +++------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/include/identity.php b/include/identity.php index b9984f10a..2230d98a4 100644 --- a/include/identity.php +++ b/include/identity.php @@ -286,13 +286,15 @@ if(! function_exists('profile_sidebar')) { ); } - if((x($profile['page-flags']) == 1) - || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) - $account_type = page_type_translate($profile['page-flags']); - - if(! $account_type) - $account_type = (x($profile['forum']) || x($profile['prv']) || (x($profile['community'])) ? t('Forum') : ""); + // check if profile is a forum + if((x($profile['page-flags']) == 2) + || (x($profile['page-flags']) == 5) + || (x($profile['forum'])) + || (x($profile['prv'])) + || (x($profile['community']))) + $account_type = t('Forum'); + else + $account_type = ""; if((x($profile,'address') == 1) || (x($profile,'locality') == 1) diff --git a/mod/photos.php b/mod/photos.php index 7ca850bc9..6b97d7d4f 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -37,14 +37,10 @@ function photos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((x($profile['page-flags']) == 1) - || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) { - $account_type = page_type_translate($profile['page-flags']); - } - else { + if((x($profile['page-flags']) == 2) || (x($profile['page-flags']) == 5)) + $account_type = t('Forum'); + else $account_type = ""; - } $tpl = get_markup_template("vcard-widget.tpl"); diff --git a/mod/videos.php b/mod/videos.php index de9feac06..707606769 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -33,14 +33,10 @@ function videos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((x($profile['page-flags']) == 1) - || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) { - $account_type = page_type_translate($profile['page-flags']); - } - else { + if((x($profile['page-flags']) == 2) || (x($profile['page-flags']) == 5)) + $account_type = t('Forum'); + else $account_type = ""; - } $tpl = get_markup_template("vcard-widget.tpl"); From 3af7cff281d0a0af6759340684adb75723b34071 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 3 Dec 2015 00:08:43 +0100 Subject: [PATCH 4/4] remove unneeded function page_type_translate() --- include/text.php | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/include/text.php b/include/text.php index 89a58cccc..1b03c39d2 100644 --- a/include/text.php +++ b/include/text.php @@ -2288,37 +2288,6 @@ function formatBytes($bytes, $precision = 2) { return round($bytes, $precision) . ' ' . $units[$pow]; } -/** - * @brief Translate the PAGE type flags in human readable string - * - * @param int $page_type - * @return string $trans_type - */ -function page_type_translate($page_type) { - - // ToDo: we need a good interpretable translation for PAGE_SOAPBOX - // and PAGE_PRVGROUP - switch ($page_type) { - case PAGE_NORMAL: - $trans_type = t('Normal Account'); - break; - case PAGE_SOAPBOX: - $trans_type = t('Fan Page'); - break; - case PAGE_COMMUNITY: - $trans_type = t('Community Forum'); - break; - case PAGE_FREELOVE: - $trans_type = t('Open Forum'); - break; - case PAGE_PRVGROUP: - $trans_type = t('Private Forum'); - break; - } - - return $trans_type; -} - /** * @brief translate and format the networkname of a contact *