diff --git a/boot.php b/boot.php
index 6e12e1ae6..e2778d737 100644
--- a/boot.php
+++ b/boot.php
@@ -17,7 +17,7 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1032 );
+define ( 'DB_UPDATE_VERSION', 1033 );
define ( 'EOL', '
' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/include/socgraph.php b/include/socgraph.php
index 3c77a59a1..678d13d11 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -254,12 +254,26 @@ function all_friends($uid,$cid,$start = 0, $limit = 80) {
-function suggestion_query($uid, $start = 0, $limit = 80) {
+function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
- if(! $uid)
+ if((! $uid) || (! $myxchan))
return array();
- $r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact
+ $r = q("SELECT count(xlink_xchan) as `total`, xchan.* from xchan
+ left join xlink on xlink_link = xchan_hash
+ where not xchan_hash in ( select abook_xchan from abook where abook_channel = %d )
+ and not xchan_hash in ( select xchan from xign where uid = %d )
+ and xchan_hash != '%s'
+ group by xchan_hash order by total desc limit %d, %d ",
+ intval($uid),
+ intval($uid),
+ dbesc($myxchan),
+ intval($start),
+ intval($limit)
+ );
+
+/*
+ $r = q("SELECT count(xlink.xchan) as `total`, gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d )
and not gcontact.name in ( select name from contact where uid = %d )
@@ -272,7 +286,12 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
intval($start),
intval($limit)
);
+*/
+ if($r)
+ return $r;
+
+/*
if(count($r) && count($r) >= ($limit -1))
return $r;
@@ -291,7 +310,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
return array_merge($r,$r2);
-
+*/
}
function update_suggestions() {
diff --git a/install/database.sql b/install/database.sql
index 31c5b441a..0262bce63 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -909,6 +909,15 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_connurl` (`xchan_connurl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE IF NOT EXISTS `xign` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `uid` int(11) NOT NULL DEFAULT '0',
+ `xchan` char(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `uid` (`uid`),
+ KEY `xchan` (`xchan`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
CREATE TABLE IF NOT EXISTS `xlink` (
`xlink_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`xlink_xchan` char(255) NOT NULL DEFAULT '',
diff --git a/install/update.php b/install/update.php
index 944841c41..afb4b08b9 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
' . t('Friend Suggestions') . '';
+ $r = suggestion_query(local_user(),get_observer_hash());
- $r = suggestion_query(local_user());
-
- if(! count($r)) {
+ if(! $r) {
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
return $o;
}
@@ -49,13 +48,13 @@ function suggest_content(&$a) {
foreach($r as $rr) {
- $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
+ $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['xchan_addr'];
$o .= replace_macros($tpl,array(
- '$url' => zid($rr['url']),
- '$name' => $rr['name'],
- '$photo' => $rr['photo'],
- '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
+ '$url' => zid($rr['xchan_url']),
+ '$name' => $rr['xchan_name'],
+ '$photo' => $rr['xchan_photo_m'],
+ '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['xchan_hash'],
'$conntxt' => t('Connect'),
'$connlnk' => $connlnk,
'$ignore' => t('Ignore/Hide')
diff --git a/view/tpl/main_slider.tpl b/view/tpl/main_slider.tpl
index 662677684..a3b7769a6 100644
--- a/view/tpl/main_slider.tpl
+++ b/view/tpl/main_slider.tpl
@@ -1,16 +1,26 @@