mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 03:25:15 +02:00
Merge pull request #2131 from rabuzarus/3011_hcard_vcard
unify hcard and vcard
This commit is contained in:
commit
1f9644bded
23 changed files with 238 additions and 154 deletions
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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']);
|
||||
|
||||
|
|
|
@ -24,24 +24,32 @@ 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']) == 2) || (x($profile['page-flags']) == 5))
|
||||
$account_type = t('Forum');
|
||||
else
|
||||
$account_type = "";
|
||||
|
||||
$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,
|
||||
'$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
|
||||
));
|
||||
|
||||
|
||||
|
@ -89,7 +97,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'),
|
||||
|
|
|
@ -21,23 +21,31 @@ 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']) == 2) || (x($profile['page-flags']) == 5))
|
||||
$account_type = t('Forum');
|
||||
else
|
||||
$account_type = "";
|
||||
|
||||
$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,
|
||||
'$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
|
||||
));
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue