diff --git a/boot.php b/boot.php
index c604e4f77e..5cc77182aa 100644
--- a/boot.php
+++ b/boot.php
@@ -9,9 +9,9 @@ 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.1199' );
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/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/include/socgraph.php b/include/socgraph.php
index 07dafe7f88..60bf075d3e 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -40,17 +40,31 @@ 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') ;
- $s = fetch_url($url . '/@me/@all?fields=displayName,urls,photos');
+ logger('poco_load: ' . $url, LOGGER_DEBUG);
+
+ $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 = '';
$name = '';
$name = $entry->displayName;
@@ -58,13 +72,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;
}
}
@@ -79,21 +98,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))
@@ -127,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),
@@ -222,20 +244,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);
}
diff --git a/include/text.php b/include/text.php
index 04d5dfcedf..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;
}}
diff --git a/js/main.js b/js/main.js
index 65d05e58ad..96c7fa642b 100644
--- a/js/main.js
+++ b/js/main.js
@@ -241,27 +241,34 @@
$('.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');
- // 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 && 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'));
@@ -276,7 +283,7 @@
}
prev = ident;
});
-
+ */
$('.like-rotator').hide();
if(commentBusy) {
commentBusy = false;
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 @@
Friendika';
+ $banner = 'Friendica';
$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/follow.php b/mod/follow.php index 2d643400a7..f8964885e1 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); @@ -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 @@ -22,6 +22,14 @@ function follow_post(&$a) { // NOTREACHED } + + if(! $url) { + notice( t('Connect URL missing.') . EOL); + goaway($_SESSION['return_url']); + // NOTREACHED + } + + $ret = probe_url($url); if($ret['network'] === NETWORK_DFRN) { @@ -202,7 +210,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 } diff --git a/mod/home.php b/mod/home.php index 225bd294d2..0320c1b398 100644 --- a/mod/home.php +++ b/mod/home.php @@ -3,6 +3,9 @@ if(! function_exists('home_init')) { function home_init(&$a) { + $ret = array(); + call_hooks('home_init',$ret); + if(local_user() && ($a->user['nickname'])) goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); 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) { diff --git a/mod/match.php b/mod/match.php index c33bbd5c2d..3645a419da 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 .= '