From 014c91431e7796f9c5394efaae507837fe5c168b Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Nov 2011 16:00:52 -0700 Subject: [PATCH] ignore suggestions --- boot.php | 2 +- database.sql | 11 ++++++++++- include/socgraph.php | 2 ++ mod/suggest.php | 23 +++++++++++++++++++++-- update.php | 13 ++++++++++++- view/suggest_friends.tpl | 13 +++++++++++++ 6 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 view/suggest_friends.tpl diff --git a/boot.php b/boot.php index 1c0328fb8..6b549a48a 100644 --- a/boot.php +++ b/boot.php @@ -11,7 +11,7 @@ require_once('include/cache.php'); define ( 'FRIENDIKA_PLATFORM', 'Friendica'); define ( 'FRIENDIKA_VERSION', '2.3.1154' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1101 ); +define ( 'DB_UPDATE_VERSION', 1102 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index eeb3700ff..3d11ff4b7 100644 --- a/database.sql +++ b/database.sql @@ -667,7 +667,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` ( `url` CHAR( 255 ) NOT NULL , `nurl` CHAR( 255 ) NOT NULL , `photo` CHAR( 255 ) NOT NULL, -INDEX ( `nurl` ), +INDEX ( `nurl` ) ) ENGINE = MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `glink` ( @@ -681,3 +681,12 @@ INDEX ( `uid` ), INDEX ( `gcid` ), INDEX ( `updated` ) ) ENGINE = MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `gcign` ( +`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , +`uid` INT NOT NULL , +`gcid` INT NOT NULL, +INDEX ( `uid` ), +INDEX ( `gcid` ) +) ENGINE = MyISAM DEFAULT CHARSET=utf8; + diff --git a/include/socgraph.php b/include/socgraph.php index b9f53d6a6..84cfe4468 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -171,9 +171,11 @@ function suggestion_query($uid, $start = 0, $limit = 40) { $r = q("SELECT count(glink.gcid) 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.id in ( select gcid from gcign where uid = %d ) group by glink.gcid order by total desc limit %d, %d ", intval($uid), intval($uid), + intval($uid), intval($start), intval($limit) ); diff --git a/mod/suggest.php b/mod/suggest.php index 2d2a32938..aedf3fd46 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -3,6 +3,24 @@ require_once('include/socgraph.php'); require_once('include/contact_widgets.php'); + +function suggest_init(&$a) { + if(! local_user()) + return; + + if(x($_GET,'ignore') && intval($_GET['ignore'])) { + q("insert into gcign ( uid, gcid ) values ( %d, %d ) ", + intval(local_user()), + intval($_GET['ignore']) + ); + } + +} + + + + + function suggest_content(&$a) { $o = ''; @@ -25,7 +43,7 @@ function suggest_content(&$a) { return $o; } - $tpl = get_markup_template('common_friends.tpl'); + $tpl = get_markup_template('suggest_friends.tpl'); foreach($r as $rr) { @@ -33,7 +51,8 @@ function suggest_content(&$a) { '$url' => $rr['url'], '$name' => $rr['name'], '$photo' => $rr['photo'], - '$tags' => '' + '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], + '$ignore' => t('Ignore/Hide') )); } diff --git a/update.php b/update.php index cdadb2e38..67017fa03 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ +
+ + $name + +
+
+
+ $name +
+ +
+ \ No newline at end of file