aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bbcode.php10
-rw-r--r--mod/profiles.php40
2 files changed, 24 insertions, 26 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 9f07b71ce..7e6ef3a2b 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -189,6 +189,10 @@ function bb_ShareAttributes($match) {
return($text);
}
+function bb_location($match) {
+ // not yet implemented
+}
+
function bb_ShareAttributesSimple($match) {
$attributes = $match[1];
@@ -256,6 +260,11 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
}
+// Not yet implemented - thinking this should display a map or perhaps be a map directive
+// if (strpos($Text,'[location]') !== false) {
+// $Text = preg_replace_callback("/\[location\](.*?)\[\/location\]/ism", 'bb_location',$Text);
+// }
+
// If we find any event code, turn it into an event.
@@ -266,6 +275,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// process [observer] tags before we do anything else because we might
// be stripping away stuff that then doesn't need to be worked on anymore
+
$observer = $a->get_observer();
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
if ($observer) {
diff --git a/mod/profiles.php b/mod/profiles.php
index b94e4bf03..c71ad9733 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -256,35 +256,23 @@ function profiles_post(&$a) {
if(strpos($lookup,'@') === 0)
$lookup = substr($lookup,1);
$lookup = str_replace('_',' ', $lookup);
- if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
- $newname = $lookup;
- $links = @lrdd($lookup);
- if(count($links)) {
- foreach($links as $link) {
- if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
- $prf = $link['@attributes']['href'];
- }
- }
- }
- }
- else {
- $newname = $lookup;
-
- $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($newname),
+ $newname = $lookup;
+
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
+ dbesc($newname),
+ intval(local_user())
+ );
+ if(! $r) {
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE xchan_addr = '%s' AND abook_channel = %d LIMIT 1",
+ dbesc($lookup . '@%'),
intval(local_user())
);
- if(! $r) {
- $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($lookup),
- intval(local_user())
- );
- }
- if(count($r)) {
- $prf = $r[0]['url'];
- $newname = $r[0]['name'];
- }
}
+ if($r) {
+ $prf = $r[0]['xchan_url'];
+ $newname = $r[0]['xchan_name'];
+ }
+
if($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);