From 431a4abd2563e8aa271549e5f18c523dcef4acaa Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 Dec 2011 14:17:48 -0800 Subject: [PATCH 01/23] name change stragglers, fix newmember links, liveupdate glitch --- boot.php | 2 +- js/main.js | 12 +++++++----- mod/admin.php | 8 ++++---- mod/newmember.php | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/boot.php b/boot.php index c604e4f77e..bc6f77dc68 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1194' ); +define ( 'FRIENDICA_VERSION', '2.3.1195' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1111 ); diff --git a/js/main.js b/js/main.js index 65d05e58ad..071acb7770 100644 --- a/js/main.js +++ b/js/main.js @@ -257,11 +257,13 @@ $('.wall-item-outside-wrapper',data).each(function() { var ident = $(this).attr('id'); // If not on page 1, only add new conversation items to existing conversations on this page - if($('#' + ident).length == 0 && (profile_page == 1 || prev != 'live-' + src)) { - $('img',this).each(function() { - $(this).attr('src',$(this).attr('dst')); - }); - $('#' + prev).after($(this)); + if($('#' + ident).length == 0) { + if(profile_page == 1 || prev != 'live-' + src) { + $('img',this).each(function() { + $(this).attr('src',$(this).attr('dst')); + }); + $('#' + prev).after($(this)); + } } else { $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); diff --git a/mod/admin.php b/mod/admin.php index 8ca89900c0..e444040973 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1,7 +1,7 @@ logoFriendika'; + $banner = 'logoFriendica'; $banner = htmlspecialchars($banner); //echo "
"; var_dump($lang_choices); die("
"); @@ -325,7 +325,7 @@ function admin_page_site(&$a) { '$no_community_page' => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), "Display a Community page showing all recent public postings on this site."), '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disable'), "Provide built-in OStatus \x28identi.ca, status.net, etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed."), '$diaspora_enabled' => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), "Provide built-in Diaspora network compatibility."), - '$dfrn_only' => array('dfrn_only', t('Only allow Friendika contacts'), get_config('system','dfrn_only'), "All contacts must use Friendika protocols. All other built-in communication protocols disabled."), + '$dfrn_only' => array('dfrn_only', t('Only allow Friendica contacts'), get_config('system','dfrn_only'), "All contacts must use Friendica protocols. All other built-in communication protocols disabled."), '$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), "If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites."), '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""), '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""), @@ -657,7 +657,7 @@ function admin_page_logs(&$a){ // name, label, value, help string, extra data... '$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""), - '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendika index.php.")), + '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")), '$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices), )); } diff --git a/mod/newmember.php b/mod/newmember.php index fc53e7112c..60ca49757d 100644 --- a/mod/newmember.php +++ b/mod/newmember.php @@ -3,7 +3,7 @@ function newmember_content(&$a) { - $o = '

' . t('Welcome to Friendika') . '

'; + $o = '

' . t('Welcome to Friendica') . '

'; $o .= '

' . t('New Member Checklist') . '

'; @@ -25,13 +25,13 @@ function newmember_content(&$a) { $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); if(! $mail_disabled) - $o .= '
  • ' . '' . t('Enter your email access information on your Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '
  • ' . EOL; + $o .= '
  • ' . '' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '
  • ' . EOL; $o .= '
  • ' . '' . t('Edit your default profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '
  • ' . EOL; $o .= '
  • ' . '' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '
  • ' . EOL; - $o .= '
  • ' . '' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the Connect dialog.') . '
  • ' . EOL; + $o .= '
  • ' . '' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the Add New Contact dialog.') . '
  • ' . EOL; $o .= '
  • ' . '' . t('The Directory page lets you find other people in this network or other federated sites. Look for a Connect or Follow link on their profile page. Provide your own Identity Address if requested.') . '
  • ' . EOL; From 84fd2a1501e3cf2e7bf3c140e7f91ecfca2f7c7f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 Dec 2011 15:51:13 -0800 Subject: [PATCH 02/23] live update glitches cont. --- js/main.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/main.js b/js/main.js index 071acb7770..8421deb567 100644 --- a/js/main.js +++ b/js/main.js @@ -254,16 +254,14 @@ prev = 'live-' + src; - $('.wall-item-outside-wrapper',data).each(function() { + $('.wall-item-outside-wrapper.comment',data).each(function() { var ident = $(this).attr('id'); - // If not on page 1, only add new conversation items to existing conversations on this page + if($('#' + ident).length == 0) { - if(profile_page == 1 || prev != 'live-' + src) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); $('#' + prev).after($(this)); - } } else { $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); From 9768adf719dffc59c1f2c7f0d4b2b932fcf9b142 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 Dec 2011 16:43:37 -0800 Subject: [PATCH 03/23] testing --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 8421deb567..2c8a8fad1c 100644 --- a/js/main.js +++ b/js/main.js @@ -254,10 +254,10 @@ prev = 'live-' + src; - $('.wall-item-outside-wrapper.comment',data).each(function() { + $('.wall-item-outside-wrapper',data).each(function() { var ident = $(this).attr('id'); - if($('#' + ident).length == 0) { + if($('#' + ident).length == 0 && prev != 'live-' + src) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); From 001e4023117b23c90a791eedd5c8026c48f45667 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 Dec 2011 17:23:41 -0800 Subject: [PATCH 04/23] simplify live update --- js/main.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 2c8a8fad1c..96c7fa642b 100644 --- a/js/main.js +++ b/js/main.js @@ -241,18 +241,25 @@ $('.tread-wrapper',data).each(function() { var ident = $(this).attr('id'); + if($('#' + ident).length == 0 && profile_page == 1) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); $('#' + prev).after($(this)); } + else { + $('img',this).each(function() { + $(this).attr('src',$(this).attr('dst')); + }); + $('#' + ident).replaceWith($(this)); + } prev = ident; }); // reset vars for inserting individual items - prev = 'live-' + src; + /* prev = 'live-' + src; $('.wall-item-outside-wrapper',data).each(function() { var ident = $(this).attr('id'); @@ -276,7 +283,7 @@ } prev = ident; }); - + */ $('.like-rotator').hide(); if(commentBusy) { commentBusy = false; From cb2e68c88ef6d5b50f3636066d76f5ecfe68cf13 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 Dec 2011 01:08:19 -0800 Subject: [PATCH 05/23] home_init hook --- include/bbcode.php | 23 ++++++++++------------- mod/home.php | 2 ++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 15b2ebb0a5..a8e3bed701 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -11,6 +11,7 @@ function stripcode_br_cb($s) { function tryoembed($match){ $url = ((count($match)==2)?$match[1]:$match[2]); + logger('tryoembed: $url'); $o = oembed_fetch_url($url); @@ -180,22 +181,18 @@ function bbcode($Text,$preserve_nl = false) { $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '', $Text); - /*if (get_pconfig(local_user(), 'oembed', 'use_for_youtube' )==1){ - // use oembed for youtube links - $Text = preg_replace("/\[youtube\]/",'[embed]',$Text); - $Text = preg_replace("/\[\/youtube\]/",'[/embed]',$Text); - } else {*/ - // Youtube extensions - $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); - $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); + // Youtube extensions + $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); + $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); + $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); - $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text); - //} + $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text); + $Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text); $Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text); diff --git a/mod/home.php b/mod/home.php index 225bd294d2..8db5b26ac9 100644 --- a/mod/home.php +++ b/mod/home.php @@ -3,6 +3,8 @@ if(! function_exists('home_init')) { function home_init(&$a) { + call_hooks('home_init',array()); + if(local_user() && ($a->user['nickname'])) goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); From 6d7781434bedda23366e6c007c15f85b80a0e073 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 Dec 2011 01:09:38 -0800 Subject: [PATCH 06/23] must use named vars in plugin args --- mod/home.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/home.php b/mod/home.php index 8db5b26ac9..0320c1b398 100644 --- a/mod/home.php +++ b/mod/home.php @@ -3,7 +3,8 @@ if(! function_exists('home_init')) { function home_init(&$a) { - call_hooks('home_init',array()); + $ret = array(); + call_hooks('home_init',$ret); if(local_user() && ($a->user['nickname'])) goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); From cc5fd0a136894702437fc5add133c784e8545b0b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 Dec 2011 12:50:34 -0800 Subject: [PATCH 07/23] revup --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index bc6f77dc68..f4da4a670f 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1195' ); +define ( 'FRIENDICA_VERSION', '2.3.1196' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1111 ); From 193435e9803b29555772f19e45283eb411f91f8b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 Dec 2011 13:52:52 -0800 Subject: [PATCH 08/23] default suggestions not being collected properly --- include/socgraph.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/socgraph.php b/include/socgraph.php index 07dafe7f88..ffd3fd5df8 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -42,7 +42,8 @@ function poco_load($cid,$uid = 0,$url = null) { logger('poco_load: ' . $url, LOGGER_DATA); - $s = fetch_url($url . '/@me/@all?fields=displayName,urls,photos'); + + $s = fetch_url($url . ($uid) ? '/@me/@all?fields=displayName,urls,photos' : '?fields=displayName,urls,photos' ); if(($a->get_curl_code() > 299) || (! $s)) return; From efb9157490c38258106d8e33ae33b28a2e11788f Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 16 Dec 2011 01:42:45 -0800 Subject: [PATCH 09/23] eliminate dup identical hashtags in posts --- mod/item.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mod/item.php b/mod/item.php index 95a27eb8ea..f72b17fc12 100644 --- a/mod/item.php +++ b/mod/item.php @@ -398,9 +398,13 @@ function item_post(&$a) { continue; $basetag = str_replace('_',' ',substr($tag,1)); $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); - if(strlen($str_tags)) - $str_tags .= ','; - $str_tags .= '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + + $newtag = '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + if(! stristr($str_tags,$newtag)) { + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= $newtag; + } continue; } if(strpos($tag,'@') === 0) { From 690b3f57b7869a0032993b0b93abe0fa292df44f Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 16 Dec 2011 14:06:50 -0800 Subject: [PATCH 10/23] bug 241 - valid emails may contain + on lhs --- boot.php | 2 +- include/text.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index f4da4a670f..c06f59be27 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1196' ); +define ( 'FRIENDICA_VERSION', '2.3.1197' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1111 ); diff --git a/include/text.php b/include/text.php index 04d5dfcedf..5e9c393362 100644 --- a/include/text.php +++ b/include/text.php @@ -635,7 +635,7 @@ function search($s,$id='search-box',$url='/search',$save = false) { if(! function_exists('valid_email')) { function valid_email($x){ - if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) + if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) return true; return false; }} From 22d59350e958e24cc3b7c49ce8ceae2e3178576e Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 16 Dec 2011 14:31:39 -0800 Subject: [PATCH 11/23] improve the email regex a bit more --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 5e9c393362..d6b3ceeab4 100644 --- a/include/text.php +++ b/include/text.php @@ -635,7 +635,7 @@ function search($s,$id='search-box',$url='/search',$save = false) { if(! function_exists('valid_email')) { function valid_email($x){ - if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) + if(preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) return true; return false; }} From 978717a2475bbd25d61969e9448dc6f197c8d637 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 00:14:34 -0800 Subject: [PATCH 12/23] add webfinger to poco, if present --- boot.php | 2 +- mod/poco.php | 4 +++- view/poco_entry_xml.tpl | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index c06f59be27..3189f929ee 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1197' ); +define ( 'FRIENDICA_VERSION', '2.3.1198' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1111 ); diff --git a/mod/poco.php b/mod/poco.php index dd8df60083..6efd4ab8cc 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -125,8 +125,10 @@ function poco_init(&$a) { $entry['id'] = $rr['id']; if($fields_ret['displayName']) $entry['displayName'] = $rr['name']; - if($fields_ret['urls']) + if($fields_ret['urls']) { $entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile')); + if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL) + $entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger'); if($fields_ret['preferredUsername']) $entry['preferredUsername'] = $rr['nick']; if($fields_ret['photos']) diff --git a/view/poco_entry_xml.tpl b/view/poco_entry_xml.tpl index 8d55151525..c3db9f2b27 100644 --- a/view/poco_entry_xml.tpl +++ b/view/poco_entry_xml.tpl @@ -2,6 +2,10 @@ {{ if $entry.id }}$entry.id{{ endif }} {{ if $entry.displayName }}$entry.displayName{{ endif }} {{ if $entry.preferredUsername }}$entry.preferredUsername{{ endif }} -{{ if $entry.urls }}$entry.urls.value$entry.urls.type{{ endif }} +{{ if $entry.urls }} +{{for $entry.urls as $url }} +$url.value$url.type +{{endfor}} +{{ endif }} {{ if $entry.photos }}$entry.photos.value$entry.photos.type{{ endif }} From b0718c4f05ad8b03d4bfb1acaeea2e8ce18f59df Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 00:21:01 -0800 Subject: [PATCH 13/23] typo --- mod/poco.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/poco.php b/mod/poco.php index 6efd4ab8cc..54ec60ff3f 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -127,7 +127,7 @@ function poco_init(&$a) { $entry['displayName'] = $rr['name']; if($fields_ret['urls']) { $entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile')); - if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL) + if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL)) $entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger'); if($fields_ret['preferredUsername']) $entry['preferredUsername'] = $rr['nick']; From 3aab1c714000a1b420d0bdcc25635593c27e3a04 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 00:22:44 -0800 Subject: [PATCH 14/23] typo --- mod/poco.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/poco.php b/mod/poco.php index 54ec60ff3f..79cf820bcd 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -129,6 +129,7 @@ function poco_init(&$a) { $entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile')); if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL)) $entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger'); + } if($fields_ret['preferredUsername']) $entry['preferredUsername'] = $rr['nick']; if($fields_ret['photos']) From c4a5fcaf278947782e4d600a3d6bdfe14eeb7fab Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 00:39:15 -0800 Subject: [PATCH 15/23] fix xml poco for arrays --- view/poco_entry_xml.tpl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/view/poco_entry_xml.tpl b/view/poco_entry_xml.tpl index c3db9f2b27..4d84cee416 100644 --- a/view/poco_entry_xml.tpl +++ b/view/poco_entry_xml.tpl @@ -2,10 +2,6 @@ {{ if $entry.id }}$entry.id{{ endif }} {{ if $entry.displayName }}$entry.displayName{{ endif }} {{ if $entry.preferredUsername }}$entry.preferredUsername{{ endif }} -{{ if $entry.urls }} -{{for $entry.urls as $url }} -$url.value$url.type -{{endfor}} -{{ endif }} -{{ if $entry.photos }}$entry.photos.value$entry.photos.type{{ endif }} +{{ if $entry.urls }}{{ for $entry.urls as $url }}$url.value$url.type{{ endfor }}{{ endif }} +{{ if $entry.photos }}{{ for $entry.photos as $photo }}$photo.value$photo.type{{ endfor }}{{ endif }} From e6b538c0466fb73bc3bf781266f85f45f8b39ea3 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 00:50:17 -0800 Subject: [PATCH 16/23] add webfinger addr to gcontact for friend "connect" links --- boot.php | 2 +- database.sql | 1 + include/socgraph.php | 22 +++++++++++++++------- update.php | 6 +++++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/boot.php b/boot.php index 3189f929ee..b01effcbfb 100644 --- a/boot.php +++ b/boot.php @@ -11,7 +11,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '2.3.1198' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1111 ); +define ( 'DB_UPDATE_VERSION', 1112 ); define ( 'EOL', "
    \r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 894ea42d98..e96aff4b77 100644 --- a/database.sql +++ b/database.sql @@ -694,6 +694,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` ( `url` CHAR( 255 ) NOT NULL , `nurl` CHAR( 255 ) NOT NULL , `photo` CHAR( 255 ) NOT NULL, +`connect` CHAR( 255 ) NOT NULL, INDEX ( `nurl` ) ) ENGINE = MyISAM DEFAULT CHARSET=utf8; diff --git a/include/socgraph.php b/include/socgraph.php index ffd3fd5df8..78a5514a0d 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -52,6 +52,7 @@ function poco_load($cid,$uid = 0,$url = null) { $profile_url = ''; $profile_photo = ''; + $connect_url = ''; $name = ''; $name = $entry->displayName; @@ -59,13 +60,18 @@ function poco_load($cid,$uid = 0,$url = null) { foreach($entry->urls as $url) { if($url->type == 'profile') { $profile_url = $url->value; - break; + continue; } + if($url->type == 'webfinger') { + $connect_url = str_replace('acct:' , '', $url->value); + continue; + } + } foreach($entry->photos as $photo) { if($photo->type == 'profile') { $profile_photo = $photo->value; - break; + continue; } } @@ -80,21 +86,23 @@ function poco_load($cid,$uid = 0,$url = null) { $gcid = $x[0]['id']; if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) { - q("update gcontact set `name` = '%s', `photo` = '%s' where - `nurl` = '%s' limit 1", + q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s' + where `nurl` = '%s' limit 1", dbesc($name), dbesc($profile_photo), + dbesc($connect_url), dbesc(normalise_link($profile_url)) ); } } else { - q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`) - values ( '%s', '%s', '%s', '%s') ", + q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`,`connect`) + values ( '%s', '%s', '%s', '%s','%s') ", dbesc($name), dbesc($profile_url), dbesc(normalise_link($profile_url)), - dbesc($profile_photo) + dbesc($profile_photo), + dbesc($connect_url) ); $x = q("select * from `gcontact` where `nurl` = '%s' limit 1", dbesc(normalise_link($profile_url)) diff --git a/update.php b/update.php index 61a9a80edf..9b5772af1c 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Sun, 18 Dec 2011 01:08:32 -0800 Subject: [PATCH 17/23] add connect link to friend suggest --- mod/follow.php | 2 +- mod/suggest.php | 8 ++++++-- view/suggest_friends.tpl | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mod/follow.php b/mod/follow.php index 2d643400a7..5fdb938157 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -10,7 +10,7 @@ function follow_post(&$a) { // NOTREACHED } - $url = $orig_url = notags(trim($_POST['url'])); + $url = $orig_url = notags(trim($_REQUEST['url'])); // remove ajax junk, e.g. Twitter diff --git a/mod/suggest.php b/mod/suggest.php index aedf3fd46a..bbffe8fb0f 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -39,19 +39,23 @@ function suggest_content(&$a) { $r = suggestion_query(local_user()); if(! count($r)) { - $o .= t('No suggestions. This works best when you have more than one contact/friend.'); + $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.'); return $o; } $tpl = get_markup_template('suggest_friends.tpl'); foreach($r as $rr) { - + + $connlink = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); + $o .= replace_macros($tpl,array( '$url' => $rr['url'], '$name' => $rr['name'], '$photo' => $rr['photo'], '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], + '$conntxt' => t('Connect'), + '$connlnk' => $connlnk, '$ignore' => t('Ignore/Hide') )); } diff --git a/view/suggest_friends.tpl b/view/suggest_friends.tpl index 8e60564944..c66cdd65d1 100644 --- a/view/suggest_friends.tpl +++ b/view/suggest_friends.tpl @@ -9,5 +9,8 @@ + {{ if $connlnk }} + + {{ endif }}
    \ No newline at end of file From 5d6a098ce0bf14e372c297ed09c9f0452fa60ec7 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 01:44:46 -0800 Subject: [PATCH 18/23] add connect link to suggestion and matches --- mod/match.php | 7 +++++++ mod/suggest.php | 4 +++- view/match.tpl | 4 ++++ view/suggest_friends.tpl | 2 +- view/theme/duepuntozero/style.css | 5 +++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mod/match.php b/mod/match.php index c33bbd5c2d..9324624c84 100644 --- a/mod/match.php +++ b/mod/match.php @@ -7,6 +7,8 @@ function match_content(&$a) { if(! local_user()) return; + $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; + $o .= '

    ' . t('Profile Match') . '

    '; $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", @@ -41,14 +43,19 @@ function match_content(&$a) { } if(count($j->results)) { + + $tpl = get_markup_template('match.tpl'); foreach($j->results as $jj) { + $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url; $o .= replace_macros($tpl,array( '$url' => $jj->url, '$name' => $jj->name, '$photo' => $jj->photo, + '$conntxt' => t('Connect'), + '$connlnk' => $connlnk, '$tags' => $jj->tags )); } diff --git a/mod/suggest.php b/mod/suggest.php index bbffe8fb0f..b8ca423c5a 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -29,6 +29,8 @@ function suggest_content(&$a) { return; } + $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; + $a->page['aside'] .= follow_widget(); $a->page['aside'] .= findpeople_widget(); @@ -47,7 +49,7 @@ function suggest_content(&$a) { foreach($r as $rr) { - $connlink = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); + $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $o .= replace_macros($tpl,array( '$url' => $rr['url'], diff --git a/view/match.tpl b/view/match.tpl index 330245a2ae..5f2fc7a302 100644 --- a/view/match.tpl +++ b/view/match.tpl @@ -9,4 +9,8 @@ $name
    + {{ if $connlnk }} + + {{ endif }} + \ No newline at end of file diff --git a/view/suggest_friends.tpl b/view/suggest_friends.tpl index c66cdd65d1..e97b5e8cce 100644 --- a/view/suggest_friends.tpl +++ b/view/suggest_friends.tpl @@ -9,8 +9,8 @@ +
    {{ if $connlnk }} {{ endif }} -
    \ No newline at end of file diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 1127f11451..c6582d0685 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2383,6 +2383,11 @@ aside input[type='text'] { clear: both; } +.profile-match-connect { + text-align: center; + font-weight: bold; +} + .profile-match-wrapper { float: left; padding: 10px; From 622886a33c459e5290bdfcf491a1c8f9ed132207 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 12:41:46 -0800 Subject: [PATCH 19/23] make mod-follow "get"-able --- boot.php | 2 +- mod/follow.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index b01effcbfb..5cc77182aa 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1198' ); +define ( 'FRIENDICA_VERSION', '2.3.1199' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1112 ); diff --git a/mod/follow.php b/mod/follow.php index 5fdb938157..f99d91757c 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -2,7 +2,7 @@ require_once('Scrape.php'); -function follow_post(&$a) { +function follow_init(&$a) { if(! local_user()) { notice( t('Permission denied.') . EOL); @@ -202,7 +202,9 @@ function follow_post(&$a) { } } - goaway($a->get_baseurl() . '/contacts/' . $contact_id); -// goaway($_SESSION['return_url']); + if(strstr($_SESSION['return_url'],'contacts')) + goaway($a->get_baseurl() . '/contacts/' . $contact_id); + + goaway($_SESSION['return_url']); // NOTREACHED } From eb05d00794055dcd895ff9c3f73c55d7d7a13d10 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 12:51:45 -0800 Subject: [PATCH 20/23] connect on suggest/match - added to testbubble --- mod/follow.php | 8 ++++++++ mod/match.php | 1 + view/theme/testbubble/match.tpl | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mod/follow.php b/mod/follow.php index f99d91757c..f8964885e1 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -22,6 +22,14 @@ function follow_init(&$a) { // NOTREACHED } + + if(! $url) { + notice( t('Connect URL missing.') . EOL); + goaway($_SESSION['return_url']); + // NOTREACHED + } + + $ret = probe_url($url); if($ret['network'] === NETWORK_DFRN) { diff --git a/mod/match.php b/mod/match.php index 9324624c84..3645a419da 100644 --- a/mod/match.php +++ b/mod/match.php @@ -54,6 +54,7 @@ function match_content(&$a) { '$url' => $jj->url, '$name' => $jj->name, '$photo' => $jj->photo, + '$inttxt' => ' ' . t('is interested in:'), '$conntxt' => t('Connect'), '$connlnk' => $connlnk, '$tags' => $jj->tags diff --git a/view/theme/testbubble/match.tpl b/view/theme/testbubble/match.tpl index 49c3c81e4b..244b243ece 100644 --- a/view/theme/testbubble/match.tpl +++ b/view/theme/testbubble/match.tpl @@ -4,7 +4,10 @@ $name - $name is interested in:
    $tags
    + $name$inttxt
    $tags
    + {{ if $connlnk }} + + {{ endif }}
    \ No newline at end of file From dc46a01cd467ac8c03acda6abcdb3aa56ef2db77 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 18 Dec 2011 13:03:20 -0800 Subject: [PATCH 21/23] suggest query for no friends messed up --- include/socgraph.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/socgraph.php b/include/socgraph.php index 78a5514a0d..5420b06c89 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -231,20 +231,22 @@ function suggestion_query($uid, $start = 0, $limit = 40) { intval($limit) ); - if(count($r)) + if(count($r) && count($r) >= ($limit -1)) return $r; - $r = q("SELECT gcontact.* from gcontact + $r2 = q("SELECT gcontact.* from gcontact left join glink on glink.gcid = gcontact.id - where uid = 0 and cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d) + where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d) and not gcontact.id in ( select gcid from gcign where uid = %d ) - order by rand limit %d, %d ", + order by rand() limit %d, %d ", + intval($uid), intval($uid), intval($start), intval($limit) ); - return $r; + + return array_merge($r,$r2); } From ad54a91d4df0007892f4c801fa1b3a79466b5bf3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 19 Dec 2011 00:40:00 -0800 Subject: [PATCH 22/23] poco_load aborting after debug statement --- include/socgraph.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/socgraph.php b/include/socgraph.php index 5420b06c89..60bf075d3e 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -40,16 +40,28 @@ function poco_load($cid,$uid = 0,$url = null) { if(! $url) return; - logger('poco_load: ' . $url, LOGGER_DATA); + $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos' : '?fields=displayName,urls,photos') ; + logger('poco_load: ' . $url, LOGGER_DEBUG); - $s = fetch_url($url . ($uid) ? '/@me/@all?fields=displayName,urls,photos' : '?fields=displayName,urls,photos' ); + $s = fetch_url($url); + + logger('poco_load: returns ' . $s, LOGGER_DATA); + + logger('poco_load: return code: ' . $a->get_curl_code(), LOGGER_DEBUG); if(($a->get_curl_code() > 299) || (! $s)) return; + + $j = json_decode($s); + + logger('poco_load: json: ' . print_r($j,true),LOGGER_DATA); + + $total = 0; foreach($j->entry as $entry) { + $total ++; $profile_url = ''; $profile_photo = ''; $connect_url = ''; @@ -136,6 +148,7 @@ function poco_load($cid,$uid = 0,$url = null) { } } + logger("poco_load: loaded $total entries",LOGGER_DEBUG); q("delete from glink where `cid` = %d and `uid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", intval($cid), From 177af1fc9d286c4ecc7e5ce43e17f492b9e11817 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 19 Dec 2011 01:23:12 -0800 Subject: [PATCH 23/23] jquery effects missing from zero derivatives --- view/theme/darkzero/theme.php | 45 +++++++++++++++++++++++++++++++++ view/theme/greenzero/theme.php | 45 +++++++++++++++++++++++++++++++++ view/theme/purplezero/theme.php | 45 +++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/view/theme/darkzero/theme.php b/view/theme/darkzero/theme.php index 338f40cbfb..5d63583f42 100644 --- a/view/theme/darkzero/theme.php +++ b/view/theme/darkzero/theme.php @@ -2,3 +2,48 @@ $a->theme_info = array( 'extends' => 'duepuntozero', ); + +$a->page['htmlhead'] .= <<< EOT + +EOT; diff --git a/view/theme/greenzero/theme.php b/view/theme/greenzero/theme.php index 338f40cbfb..5d63583f42 100644 --- a/view/theme/greenzero/theme.php +++ b/view/theme/greenzero/theme.php @@ -2,3 +2,48 @@ $a->theme_info = array( 'extends' => 'duepuntozero', ); + +$a->page['htmlhead'] .= <<< EOT + +EOT; diff --git a/view/theme/purplezero/theme.php b/view/theme/purplezero/theme.php index 338f40cbfb..5d63583f42 100644 --- a/view/theme/purplezero/theme.php +++ b/view/theme/purplezero/theme.php @@ -2,3 +2,48 @@ $a->theme_info = array( 'extends' => 'duepuntozero', ); + +$a->page['htmlhead'] .= <<< EOT + +EOT;