Merge pull request #1084 from annando/master

Displaying the author of a post on the "display" page/network page as default page after login
This commit is contained in:
fabrixxm 2014-08-26 08:39:56 +02:00
commit faf8afe65c
15 changed files with 274 additions and 67 deletions

View file

@ -768,8 +768,8 @@ if(! class_exists('App')) {
if(! count($r)){ if(! count($r)){
$this->cached_profile_image[$avatar_image] = $avatar_image; $this->cached_profile_image[$avatar_image] = $avatar_image;
} else { } else {
$this->cached_profile_picdate[$common_filename] = "?rev=" . urlencode($r[0]['picdate']); $this->cached_profile_picdate[$common_filename] = "?rev=".urlencode($r[0]['picdate']);
$this->cached_profile_image[$avatar_image] = $avatar_image . $this->cached_profile_picdate[$common_filename]; $this->cached_profile_image[$avatar_image] = $avatar_image.$this->cached_profile_picdate[$common_filename];
} }
} }
return $this->cached_profile_image[$avatar_image]; return $this->cached_profile_image[$avatar_image];
@ -1345,7 +1345,7 @@ if(! function_exists('get_max_import_size')) {
*/ */
if(! function_exists('profile_load')) { if(! function_exists('profile_load')) {
function profile_load(&$a, $nickname, $profile = 0) { function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) {
$user = q("select uid from user where nickname = '%s' limit 1", $user = q("select uid from user where nickname = '%s' limit 1",
dbesc($nickname) dbesc($nickname)
@ -1410,9 +1410,10 @@ if(! function_exists('profile_load')) {
$a->profile = $r[0]; $a->profile = $r[0];
$a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme');
$a->profile['network'] = NETWORK_DFRN;
$a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename'];
$_SESSION['theme'] = $a->profile['theme']; $_SESSION['theme'] = $a->profile['theme'];
$_SESSION['mobile-theme'] = $a->profile['mobile-theme']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
@ -1430,7 +1431,7 @@ if(! function_exists('profile_load')) {
if(! (x($a->page,'aside'))) if(! (x($a->page,'aside')))
$a->page['aside'] = ''; $a->page['aside'] = '';
if(local_user() && local_user() == $a->profile['uid']) { if(local_user() && local_user() == $a->profile['uid'] && $profiledata) {
$a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'),array( $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'),array(
'$editprofile' => t('Edit profile'), '$editprofile' => t('Edit profile'),
'$profid' => $a->profile['id'] '$profid' => $a->profile['id']
@ -1439,8 +1440,15 @@ if(! function_exists('profile_load')) {
$block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
// To-Do:
// By now, the contact block isn't shown, when a different profile is given
// But: When this profile was on the same server, then we could display the contacts
if ($profiledata)
$a->page['aside'] .= profile_sidebar($profiledata, true);
else
$a->page['aside'] .= profile_sidebar($a->profile, $block); $a->page['aside'] .= profile_sidebar($a->profile, $block);
/*if(! $block) /*if(! $block)
$a->page['aside'] .= contact_block();*/ $a->page['aside'] .= contact_block();*/
@ -1467,7 +1475,6 @@ if(! function_exists('profile_load')) {
if(! function_exists('profile_sidebar')) { if(! function_exists('profile_sidebar')) {
function profile_sidebar($profile, $block = 0) { function profile_sidebar($profile, $block = 0) {
$a = get_app(); $a = get_app();
$o = ''; $o = '';
@ -1480,6 +1487,15 @@ if(! function_exists('profile_sidebar')) {
$profile['picdate'] = urlencode($profile['picdate']); $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'] = '<a href="'.$profile['url'].'">'.network_to_name($profile['network'])."</a>";
else
$profile['network_name'] = network_to_name($profile['network']);
} else
$profile['network_name'] = "";
call_hooks('profile_sidebar_enter', $profile); call_hooks('profile_sidebar_enter', $profile);
@ -1498,6 +1514,9 @@ if(! function_exists('profile_sidebar')) {
// Is the local user already connected to that user? // Is the local user already connected to that user?
if ($connect AND local_user()) { if ($connect AND local_user()) {
if (isset($profile["url"]))
$profile_url = normalise_link($profile["url"]);
else
$profile_url = normalise_link($a->get_baseurl()."/profile/".$profile["nickname"]); $profile_url = normalise_link($a->get_baseurl()."/profile/".$profile["nickname"]);
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'", $r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
@ -1506,6 +1525,12 @@ if(! function_exists('profile_sidebar')) {
$connect = false; $connect = false;
} }
if ($connect AND ($profile['network'] != NETWORK_DFRN) AND !isset($profile['remoteconnect']))
$connect = false;
if (isset($profile['remoteconnect']))
$remoteconnect = $profile['remoteconnect'];
if( get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()) ) if( get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()) )
$wallmessage = t('Message'); $wallmessage = t('Message');
else else
@ -1514,7 +1539,6 @@ if(! function_exists('profile_sidebar')) {
// show edit profile to yourself // show edit profile to yourself
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) { if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); $profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
$r = q("SELECT * FROM `profile` WHERE `uid` = %d", $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user()); local_user());
@ -1604,12 +1628,14 @@ if(! function_exists('profile_sidebar')) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$profile' => $p, '$profile' => $p,
'$connect' => $connect, '$connect' => $connect,
'$remoteconnect' => $remoteconnect,
'$wallmessage' => $wallmessage, '$wallmessage' => $wallmessage,
'$location' => $location, '$location' => $location,
'$gender' => $gender, '$gender' => $gender,
'$pdesc' => $pdesc, '$pdesc' => $pdesc,
'$marital' => $marital, '$marital' => $marital,
'$homepage' => $homepage, '$homepage' => $homepage,
'$network' => t('Network:'),
'$diaspora' => $diaspora, '$diaspora' => $diaspora,
'$contact_block' => $contact_block, '$contact_block' => $contact_block,
)); ));

View file

@ -41,6 +41,8 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
if ($matches[1] != "") if ($matches[1] != "")
$title = $matches[1]; $title = $matches[1];
$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
$image = ""; $image = "";
if ($type != "video") { if ($type != "video") {
preg_match("/image='(.*?)'/ism", $attributes, $matches); preg_match("/image='(.*?)'/ism", $attributes, $matches);
@ -75,9 +77,9 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$oembed = $bookmark[0]; $oembed = $bookmark[0];
if (($image != "") AND !strstr(strtolower($oembed), "<img ")) if (($image != "") AND !strstr(strtolower($oembed), "<img "))
$text .= sprintf('<img src="%s" alt="%s" class="attachment-image" />', $image, $title); // To-Do: Anführungszeichen in "alt" $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $url, $image, $title);
elseif (($preview != "") AND !strstr(strtolower($oembed), "<img ")) elseif (($preview != "") AND !strstr(strtolower($oembed), "<img "))
$text .= sprintf('<img src="%s" alt="%s" class="attachment-preview" />', $preview, $title); // To-Do: Anführungszeichen in "alt" $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $url, $preview, $title);
$text .= $oembed; $text .= $oembed;
@ -90,7 +92,7 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
return($Text); return($Text);
} }
function bb_rearrange_link($shared) { /* function bb_rearrange_link($shared) {
if ($shared[1] != "type-link") if ($shared[1] != "type-link")
return($shared[0]); return($shared[0]);
@ -117,6 +119,66 @@ function bb_rearrange_link($shared) {
$newshare = "[class=type-link]".$newshare."[/class]"; $newshare = "[class=type-link]".$newshare."[/class]";
return($newshare); return($newshare);
} */
function bb_rearrange_share($shared) {
if (!in_array(strtolower($shared[2]), array("type-link", "type-audio", "type-video")))
return($shared[0]);
if (!preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$shared[3], $bookmark))
return($shared[0]);
$type = substr(trim(strtolower($shared[2])), 5);
$title = "";
$url = "";
$preview = "";
$description = "";
if (isset($bookmark[2][0]))
$title = $bookmark[2][0];
if (isset($bookmark[1][0]))
$url = $bookmark[1][0];
$cleanedshare = trim($shared[3]);
$cleanedshare = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $cleanedshare);
preg_match("/\[img\](.*?)\[\/img\]/ism", $cleanedshare, $matches);
if ($matches)
$preview = trim($matches[1]);
preg_match("/\[quote\](.*?)\[\/quote\]/ism", $cleanedshare, $matches);
if ($matches)
$description = trim($matches[1]);
$url = htmlentities($url, ENT_QUOTES, 'UTF-8', false);
$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
$preview = htmlentities($preview, ENT_QUOTES, 'UTF-8', false);
$Text = trim($shared[1])."\n[attachment type='".$type."'";
if ($url != "")
$Text .= " url='".$url."'";
if ($title != "")
$Text .= " title='".$title."'";
if ($preview != "") {
require_once("include/Photo.php");
$picturedata = get_photo_info($preview);
// echo $preview."*".print_r($picturedata, true)."*";
if (count($picturedata) > 0) {
// if the preview picture is larger than 500 pixels then show it in a larger mode
// But only, if the picture isn't higher than large (To prevent huge posts)
if (($picturedata[0] >= 500) AND ($picturedata[0] >= $picturedata[1]))
$Text .= " image='".$preview."'";
else
$Text .= " preview='".$preview."'";
} else
$Text .= " preview='".$preview."'";
}
$Text .= "]".$description."[/attachment]";
return($Text);
} }
function bb_remove_share_information($Text, $plaintext = false, $nolink = false) { function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
@ -740,12 +802,15 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/\n\[code\]/ism", "[code]", $Text); $Text = preg_replace("/\n\[code\]/ism", "[code]", $Text);
$Text = preg_replace("/\[\/code\]\n/ism", "[/code]", $Text); $Text = preg_replace("/\[\/code\]\n/ism", "[/code]", $Text);
// Rearrange shares to attachments
$Text = preg_replace_callback("((.*?)\[class=(.*?)\](.*?)\[\/class\])ism", "bb_rearrange_share",$Text);
// Handle attached links or videos // Handle attached links or videos
$Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed); $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
// Rearrange shared links // Rearrange shared links
if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed)) // if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed))
$Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text); // $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text);
// when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems // when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
if (!$tryoembed) if (!$tryoembed)

View file

@ -1,11 +1,12 @@
<?php <?php
function follow_widget() { function follow_widget($value = "") {
return replace_macros(get_markup_template('follow.tpl'),array( return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Contact'), '$connect' => t('Add New Contact'),
'$desc' => t('Enter address or web location'), '$desc' => t('Enter address or web location'),
'$hint' => t('Example: bob@example.com, http://example.com/barbara'), '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
'$value' => $value,
'$follow' => t('Connect') '$follow' => t('Connect')
)); ));

View file

@ -180,7 +180,8 @@ function plaintext($a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2) {
if (!isset($post["url"])) { if (!isset($post["url"])) {
$limit = $limit - 23; $limit = $limit - 23;
$post["url"] = $b["plink"]; $post["url"] = $b["plink"];
} } elseif (strpos($b["body"], "[share") !== false)
$post["url"] = $b["plink"];
$msg = shortenmsg($msg, $limit); $msg = shortenmsg($msg, $limit);
} }

View file

@ -37,6 +37,9 @@ function contacts_init(&$a) {
} }
else { else {
$vcard_widget = ''; $vcard_widget = '';
if (isset($_GET['add']))
$follow_widget = follow_widget($_GET['add']);
else
$follow_widget = follow_widget(); $follow_widget = follow_widget();
} }

View file

@ -7,34 +7,106 @@ function display_init(&$a) {
} }
$nick = (($a->argc > 1) ? $a->argv[1] : ''); $nick = (($a->argc > 1) ? $a->argv[1] : '');
$profiledata = array();
// If there is only one parameter, then check if this parameter could be a guid // If there is only one parameter, then check if this parameter could be a guid
if ($a->argc == 2) { if ($a->argc == 2) {
$nick = ""; $nick = "";
$itemuid = 0;
// Does the local user have this item? // Does the local user have this item?
if (local_user()) { if (local_user()) {
$r = q("SELECT `id` FROM `item` $r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network` FROM `item`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user()); AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user());
if (count($r)) if (count($r)) {
$nick = $a->user["nickname"]; $nick = $a->user["nickname"];
$itemuid = local_user();
}
} }
// Or is it anywhere on the server? // Or is it anywhere on the server?
if ($nick == "") { if ($nick == "") {
$r = q("SELECT `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid` $r = q("SELECT `user`.`nickname`, `item`.`id`, `item`.`parent`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`
FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`private` = 0
AND `item`.`guid` = '%s'", $a->argv[1]); AND `item`.`guid` = '%s'", $a->argv[1]);
if (count($r)) // AND `item`.`private` = 0 AND `item`.`wall` = 1
if (count($r)) {
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];
$itemuid = $r[0]["uid"];
}
}
if (count($r)) {
if ($r[0]["id"] != $r[0]["parent"])
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network` FROM `item`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `id` = %d", $r[0]["parent"]);
if (!strstr(normalise_link($r[0]["author-link"]), normalise_link($a->get_baseurl()))) {
require_once("mod/proxy.php");
require_once("include/bbcode.php");
$profiledata["uid"] = -1;
$profiledata["nickname"] = $r[0]["author-name"];
$profiledata["name"] = $r[0]["author-name"];
$profiledata["picdate"] = "";
$profiledata["photo"] = proxy_url($r[0]["author-avatar"]);
$profiledata["url"] = $r[0]["author-link"];
$profiledata["network"] = $r[0]["network"];
// Fetching profile data from unique contacts
// To-do: Extend "unique contacts" table for further contact data like location, ...
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"];
} else {
// Is this case possible?
// Fetching further contact data from the contact table, when it isn't available in the "unique contacts"
$r = q("SELECT `photo`, `nick` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
normalise_link($profiledata["url"]), $itemuid);
if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["photo"]);
if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"];
} }
} }
profile_load($a,$nick); if (local_user()) {
if ($profiledata["network"] == NETWORK_DFRN) {
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"])."&addr=".bin2hex($a->get_baseurl()."/profile/".$a->user["nickname"]);
$profiledata["remoteconnect"] = $connect;
} elseif ($profiledata["network"] == NETWORK_DIASPORA)
$profiledata["remoteconnect"] = $a->get_baseurl()."/contacts?add=".GetProfileUsername($profiledata["url"], "", true);
} elseif ($profiledata["network"] == NETWORK_DFRN) {
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
$profiledata["remoteconnect"] = $connect;
}
} else {
$nickname = str_replace(normalise_link($a->get_baseurl())."/profile/", "", normalise_link($r[0]["author-link"]));
if (($nickname != $a->user["nickname"])) {
$profiledata["url"] = $r[0]["author-link"];
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `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 (count($r))
$profiledata = $r[0];
$profiledata["network"] = NETWORK_DFRN;
}
}
}
}
profile_load($a, $nick, 0, $profiledata);
} }
@ -89,8 +161,9 @@ function display_content(&$a, $update = 0) {
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`private` = 0
AND `item`.`guid` = '%s'", $a->argv[1]); AND `item`.`guid` = '%s'", $a->argv[1]);
// AND `item`.`private` = 0 AND `item`.`wall` = 1
if (count($r)) { if (count($r)) {
$item_id = $r[0]["id"]; $item_id = $r[0]["id"];
$nick = $r[0]["nickname"]; $nick = $r[0]["nickname"];

View file

@ -7,10 +7,11 @@ function home_init(&$a) {
call_hooks('home_init',$ret); call_hooks('home_init',$ret);
if(local_user() && ($a->user['nickname'])) if(local_user() && ($a->user['nickname']))
goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); goaway($a->get_baseurl()."/network");
//goaway($a->get_baseurl()."/profile/".$a->user['nickname']);
if(strlen(get_config('system','singleuser'))) if(strlen(get_config('system','singleuser')))
goaway( $a->get_baseurl() . "/profile/" . get_config('system','singleuser')); goaway($a->get_baseurl()."/profile/" . get_config('system','singleuser'));
}} }}
@ -27,11 +28,11 @@ function home_content(&$a) {
if(file_exists('home.html')){ if(file_exists('home.html')){
if(file_exists('home.css')){ if(file_exists('home.css')){
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/home.css' . '" media="all" />';} $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/home.css'.'" media="all" />';}
$o .= file_get_contents('home.html');} $o .= file_get_contents('home.html');}
else $o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>'; else $o .= '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1); $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);

View file

@ -573,7 +573,7 @@ function item_post(&$a) {
if($fullnametagged) if($fullnametagged)
continue; continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag); $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
if($success['replaced']) if($success['replaced'])
$tagged[] = $tag; $tagged[] = $tag;
if(is_array($success['contact']) && intval($success['contact']['prv'])) { if(is_array($success['contact']) && intval($success['contact']['prv'])) {
@ -1040,7 +1040,7 @@ function item_content(&$a) {
* *
* @return boolean true if replaced, false if not replaced * @return boolean true if replaced, false if not replaced
*/ */
function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
$replaced = false; $replaced = false;
$r = null; $r = null;
@ -1093,7 +1093,9 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
} }
} }
} }
} else { //if it is a name rather than an address } elseif (($network != NETWORK_OSTATUS) AND ($network != NETWORK_TWITTER) AND
($network != NETWORK_STATUSNET) AND ($network != NETWORK_APPNET)) {
//if it is a name rather than an address
$newname = $name; $newname = $name;
$alias = ''; $alias = '';
$tagcid = 0; $tagcid = 0;
@ -1116,11 +1118,33 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
else { else {
$newname = str_replace('_',' ',$name); $newname = str_replace('_',' ',$name);
// At first try to fetch a contact according to the given network
if ($network != "") {
//select someone from this user's contacts by name
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
dbesc($network),
intval($profile_uid)
);
if(! $r) {
//select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
dbesc($network),
intval($profile_uid)
);
}
} else
$r = false;
if(! $r) {
//select someone from this user's contacts by name //select someone from this user's contacts by name
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname), dbesc($newname),
intval($profile_uid) intval($profile_uid)
); );
}
if(! $r) { if(! $r) {
//select someone by attag or nick and the name passed in //select someone by attag or nick and the name passed in

View file

@ -691,9 +691,8 @@ class Item extends BaseObject {
$this->wall_to_wall = false; $this->wall_to_wall = false;
if($this->is_toplevel()) { if($this->is_toplevel()) {
if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'profile')) { if($conv->get_mode() !== 'profile') {
if($this->get_data_value('wall')) { if($this->get_data_value('wall') AND !$this->get_data_value('self')) {
// On the network page, I am the owner. On the display page it will be the profile owner. // On the network page, I am the owner. On the display page it will be the profile owner.
// This will have been stored in $a->page_contact by our calling page. // This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice. // Put this person as the wall owner of the wall-to-wall notice.
@ -708,6 +707,7 @@ class Item extends BaseObject {
$owner_linkmatch = (($this->get_data_value('owner-link')) && link_compare($this->get_data_value('owner-link'),$this->get_data_value('author-link'))); $owner_linkmatch = (($this->get_data_value('owner-link')) && link_compare($this->get_data_value('owner-link'),$this->get_data_value('author-link')));
$alias_linkmatch = (($this->get_data_value('alias')) && link_compare($this->get_data_value('alias'),$this->get_data_value('author-link'))); $alias_linkmatch = (($this->get_data_value('alias')) && link_compare($this->get_data_value('alias'),$this->get_data_value('author-link')));
$owner_namematch = (($this->get_data_value('owner-name')) && $this->get_data_value('owner-name') == $this->get_data_value('author-name')); $owner_namematch = (($this->get_data_value('owner-name')) && $this->get_data_value('owner-name') == $this->get_data_value('author-name'));
if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) { if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
// The author url doesn't match the owner (typically the contact) // The author url doesn't match the owner (typically the contact)

View file

@ -44,7 +44,8 @@ span.connector {
.wall-item-container .wall-item-content .type-link img.attachment-image, .wall-item-container .wall-item-content .type-link img.attachment-image,
.type-link img.attachment-image, .type-video img.attachment-image { .type-link img.attachment-image, .type-video img.attachment-image {
max-width: 640px; /* max-width: 640px; */
max-width: 100%;
max-height: initial; max-height: initial;
float: initial; float: initial;
margin-right: 0px; margin-right: 0px;

View file

@ -7,7 +7,7 @@
<h3>{{$connect}}</h3> <h3>{{$connect}}</h3>
<div id="connect-desc">{{$desc}}</div> <div id="connect-desc">{{$desc}}</div>
<form action="follow" method="post" > <form action="follow" method="post" >
<input id="side-follow-url" type="text" name="url" size="24" placeholder="{{$hint}}" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" /> <input id="side-follow-url" type="text" name="url" value="{{$value}}" size="24" placeholder="{{$hint}}" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
</form> </form>
</div> </div>

View file

@ -10,10 +10,13 @@
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
{{if $profile.picdate}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>
{{else}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}" alt="{{$profile.name}}"></div>
{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>
<dd class="adr"> <dd class="adr">

View file

@ -898,6 +898,10 @@ aside .vcard dd {
margin-left: 4px; margin-left: 4px;
/* width: 60%; */ /* width: 60%; */
} }
aside #profile-photo-wrapper img {
width: 175px;
}
aside #profile-extra-links ul { aside #profile-extra-links ul {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;

View file

@ -23,15 +23,20 @@
</ul> </ul>
</div> </div>
{{else}} {{else}}
{{if $profile.menu}}
<div class="profile-edit-side-div"><a class="profile-edit-side-link icon edit" title="{{$editprofile}}" href="profiles" ></a></div> <div class="profile-edit-side-div"><a class="profile-edit-side-link icon edit" title="{{$editprofile}}" href="profiles" ></a></div>
{{/if}} {{/if}}
{{/if}}
</div> </div>
{{if $profile.picdate}}
<div id="profile-photo-wrapper"><img class="photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div> <div id="profile-photo-wrapper"><img class="photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div>
{{else}}
<div id="profile-photo-wrapper"><img class="photo" src="{{$profile.photo}}" alt="{{$profile.name}}" /></div>
{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt><br> <dl class="location"><dt class="location-label">{{$location}}</dt><br>
<dd class="adr"> <dd class="adr">
@ -59,8 +64,12 @@
<div id="profile-extra-links"> <div id="profile-extra-links">
<ul> <ul>
{{if $connect}} {{if $connect}}
{{if $remoteconnect}}
<li><a id="dfrn-request-link" href="{{$remoteconnect}}">{{$connect}}</a></li>
{{else}}
<li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li> <li><a id="dfrn-request-link" href="dfrn_request/{{$profile.nickname}}">{{$connect}}</a></li>
{{/if}} {{/if}}
{{/if}}
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -33,10 +33,6 @@ $a->page['htmlhead'] .= <<< EOT
<script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script> <script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script>
<script> <script>
function showHideASide(e) {
var mouse_pos(e);
}
function collapseHeight(elems) { function collapseHeight(elems) {
var elemName = '.wall-item-body:not(.divmore)'; var elemName = '.wall-item-body:not(.divmore)';
if(typeof elems != 'undefined') { if(typeof elems != 'undefined') {