From 950e5f6693907c76821b4da99cd4e3b080c4ae23 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 23 Jan 2011 13:49:21 -0800 Subject: given a tag @foo, don't also link/replace words like food in msg body --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index f9bf9a04e..f964e7737 100644 --- a/mod/item.php +++ b/mod/item.php @@ -228,7 +228,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 .= ','; -- cgit v1.2.3 From 1460fc0d710ce14d6c746eb06fc8f3a5372493c2 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 23 Jan 2011 14:56:14 -0800 Subject: add cc-license text to all content pages --- mod/display.php | 3 +++ mod/network.php | 4 +++- mod/profile.php | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index de11ec35d..aed114abc 100644 --- a/mod/display.php +++ b/mod/display.php @@ -291,6 +291,9 @@ function display_content(&$a) { } } + + $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; + return $o; } 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 .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; + } 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 .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; + return $o; } -- cgit v1.2.3 From 00d2b583588ea1c55e9b478809e8041d6ba98639 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 23 Jan 2011 16:29:30 -0800 Subject: fix a few issues with code blocks, ignore tags within blocks, fold multi-line blocks to one, also turn html br into two LFs. --- mod/item.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index f964e7737..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 -- cgit v1.2.3 From 5be98e3ec8b0475dc67504967cac695d9e4a129a Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 23 Jan 2011 20:09:34 -0800 Subject: following random feeds --- mod/follow.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'mod') 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 -- cgit v1.2.3 From 205a2b8930c9d519c06f106d5d37702f8f69d013 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 23 Jan 2011 21:26:09 -0800 Subject: owner's sparkle link, sometimes not author's - on display page --- mod/display.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index aed114abc..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'])); -- cgit v1.2.3