aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/display.php19
-rw-r--r--mod/follow.php54
-rw-r--r--mod/item.php6
-rw-r--r--mod/network.php4
-rw-r--r--mod/profile.php2
5 files changed, 80 insertions, 5 deletions
diff --git a/mod/display.php b/mod/display.php
index de11ec35d..3215ae90a 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -173,6 +173,9 @@ function display_content(&$a) {
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+ // I think this is redundant now but too chicken to remove it unless
+ // I've had six cups of coffee and tested it completely
+
if(($item['network'] === 'dfrn') && (! $item['self'] )) {
$profile_url = $redirect_url;
$sparkle = ' sparkle';
@@ -216,7 +219,18 @@ function display_content(&$a) {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
- $profile_link = $profile_url;
+ // Can we use our special contact URL for this author?
+
+ if(strlen($item['author-link'])) {
+ if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ else {
+ $profile_link = $item['author-link'];
+ $sparkle = '';
+ }
+ }
if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
$drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));
@@ -291,6 +305,9 @@ function display_content(&$a) {
}
}
+
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+
return $o;
}
diff --git a/mod/follow.php b/mod/follow.php
index 14bdb9fc6..e5eb7763b 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -48,6 +48,8 @@ function follow_post(&$a) {
}
}
+ $network = 'stat';
+
if($hcard) {
$vcard = scrape_vcard($hcard);
@@ -63,13 +65,58 @@ function follow_post(&$a) {
if(! $profile)
$profile = $url;
- // do we have enough information?
if(! x($vcard,'fn'))
if(x($vcard,'nick'))
$vcard['fn'] = $vcard['nick'];
+ if((! isset($vcard)) && (! $poll)) {
+
+ $ret = scrape_feed($url);
+
+ if(count($ret) && $ret['feed_atom']) {
+ $poll = $ret['feed_atom'];
+ $vcard = array();
+ require_once('simplepie/simplepie.inc');
+ $feed = new SimplePie();
+ $xml = fetch_url($poll);
+
+ $feed->set_raw_data($xml);
+
+ $feed->init();
+
+ $vcard['photo'] = $feed->get_image_url();
+ $author = $feed->get_author();
+ if($author) {
+ $vcard['fn'] = trim($author->get_name());
+ $vcard['nick'] = strtolower($vcard['fn']);
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = $author->get_email();
+ }
+ else {
+ $item = $feed->get_item(0);
+ if($item) {
+ $author = $item->get_author();
+ if($author) {
+ $vcard['fn'] = trim($author->get_name());
+ $vcard['nick'] = strtolower($vcard['fn']);
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = $author->get_email();
+ }
+ }
+ }
+ if((! $vcard['photo']) && strlen($email))
+ $vcard['photo'] = gravatar_img($email);
+ $network = 'feed';
+ }
+ }
+
logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true));
+
+
+ // do we have enough information?
if(! ((x($vcard['fn'])) && ($poll) && ($profile))) {
notice( t('The profile address specified does not provide adequate information.') . EOL);
@@ -115,7 +162,7 @@ function follow_post(&$a) {
dbesc($vcard['fn']),
dbesc($vcard['nick']),
dbesc($vcard['photo']),
- dbesc('stat'),
+ dbesc($network),
intval(REL_FAN)
);
}
@@ -158,6 +205,9 @@ function follow_post(&$a) {
// pull feed and consume it, which should subscribe to the hub.
+ $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+ proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
+
// create a follow slap
diff --git a/mod/item.php b/mod/item.php
index f9bf9a04e..feef7c95f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -165,7 +165,11 @@ function item_post(&$a) {
}
}
+ /**
+ * Fold multi-line [code] sequences
+ */
+ $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
/**
* Look for any tags and linkify them
@@ -228,7 +232,7 @@ function item_post(&$a) {
}
}
if($profile) {
- $body = str_replace($name,'[url=' . $profile . ']' . $newname . '[/url]', $body);
+ $body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile);
if(strlen($str_tags))
$str_tags .= ',';
diff --git a/mod/network.php b/mod/network.php
index 096c8a79f..f9badda78 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -430,8 +430,10 @@ function network_content(&$a, $update = 0) {
}
}
- if(! $update)
+ if(! $update) {
$o .= paginate($a);
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+ }
return $o;
} \ No newline at end of file
diff --git a/mod/profile.php b/mod/profile.php
index 936379360..505edf5ce 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -379,6 +379,8 @@ function profile_content(&$a, $update = 0) {
}
$o .= paginate($a);
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+
return $o;
}