Commit 993b8e24 authored by lphuberdeau's avatar lphuberdeau

[KIL] Removing most of the old friendship feature (with intention of adding...

[KIL] Removing most of the old friendship feature (with intention of adding back once bases are established), converting dedicated tables to relations - using the 'follow' model as it seems to be what was in place
parent 3857aa3a
......@@ -2103,6 +2103,7 @@ installer/schema/20130624_mailin_add_attr_tiki.sql -text
installer/schema/20130704_catname_tiki.sql -text
installer/schema/20130705_activity_stream_tiki.sql -text
installer/schema/20130715_activity_stream_rules_tiki.sql -text
installer/schema/20130730_friendship_conversion_tiki.sql -text
installer/schema/999999991_decode_pages_sources_tiki.php -text
installer/schema/99999999_image_plugins_kill_tiki.php -text
installer/schema/index.php -text
......
......@@ -2789,21 +2789,6 @@ CREATE TABLE `tiki_translated_objects` (
KEY `traId` ( `traId` )
) ENGINE=MyISAM AUTO_INCREMENT=1;
DROP TABLE IF EXISTS `tiki_friends`;
CREATE TABLE `tiki_friends` (
`user` varchar(200) NOT NULL default '',
`friend` varchar(200) NOT NULL default '',
PRIMARY KEY (`user`(120),friend(120))
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `tiki_friendship_requests`;
CREATE TABLE `tiki_friendship_requests` (
`userFrom` varchar(200) NOT NULL default '',
`userTo` varchar(200) NOT NULL default '',
`tstamp` timestamp NOT NULL,
PRIMARY KEY (`userFrom`(120),`userTo`(120))
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `tiki_score`;
CREATE TABLE `tiki_score` (
event varchar(40) NOT NULL default '',
......
......@@ -195,8 +195,6 @@ ALTER TABLE `users_users` ENGINE=InnoDB;
ALTER TABLE `tiki_integrator_reps` ENGINE=InnoDB;
ALTER TABLE `tiki_integrator_rules` ENGINE=InnoDB;
ALTER TABLE `tiki_translated_objects` ENGINE=InnoDB;
ALTER TABLE `tiki_friends` ENGINE=InnoDB;
ALTER TABLE `tiki_friendship_requests` ENGINE=InnoDB;
ALTER TABLE `tiki_score` ENGINE=InnoDB;
ALTER TABLE `tiki_users_score` ENGINE=InnoDB;
ALTER TABLE `tiki_file_handlers` ENGINE=InnoDB;
......
INSERT INTO tiki_object_relations (`relation`, `source_type`, `source_itemId`, `target_type`, `target_itemId`)
SELECT 'tiki.friend.follow', 'user', `user`, 'user', `friend` FROM `tiki_friends`;
INSERT INTO tiki_object_relations (`relation`, `source_type`, `source_itemId`, `target_type`, `target_itemId`)
SELECT 'tiki.friend.follow.request', 'user', `userFrom`, 'user', `userTo` FROM `tiki_friendship_requests`;
DROP TABLE `tiki_friends`;
DROP TABLE `tiki_friendship_requests`;
......@@ -2486,16 +2486,6 @@ function prefs_feature_list($partial = false)
'type' => 'flag',
'default' => 'y',
),
'feature_community_mouseover_friends' => array(
'name' => tra('Number of friends'),
'description' => tra(''),
'type' => 'flag',
'help' => 'Friendship+Network',
'dependencies' => array(
'feature_friends',
),
'default' => 'y',
),
'feature_community_mouseover_score' => array(
'name' => tra('Score'),
'description' => tra(''),
......
......@@ -13,6 +13,7 @@
* \brief Smarty plugin to display content only to some groups, friends or combination of all per specified user(s)
* (if user is not specified, current user is used)
* ex.: {display groups='Anonymous,-Registered,foo' friends=$f_42[ error='You may not see this item']}$f_1...$f_9///else///Become friend with $_42 first{/display}
* TODO : Re-implement friend filter
*/
//this script may only be included - so its better to die if called directly.
......@@ -31,17 +32,11 @@ function smarty_block_display($params, $content, $smarty, &$repeat)
$groups = explode(',', $params['groups']);
$userGroups = $userlib->get_user_groups($user);
}
#$users = explode(',', $params['users']); // TODO users param support
if (!empty($params['friends']) && $prefs['feature_friends'] == 'y') {
$friends = explode(',', $params['friends']);
}
$content = explode('///else///', $content);
if (!empty($params['error'])) {
$errmsg = $params['error'];
} elseif (empty($params['error']) && isset($friends)) {
$errmsg = tra('You are not in group of friends to have the content of this block displayed for you');
} elseif (empty($params['error']) && isset($groups)) {
$errmsg = '';
} else {
......@@ -67,17 +62,6 @@ function smarty_block_display($params, $content, $smarty, &$repeat)
}
}
/* now we check friends (if any) */
if (!empty($friends)) {
foreach ($friends as $friend) {
if ($userlib->verify_friendship($user, $friend)) {
$ok = true;
break;
} else {
$ok = false;
}
}
}
/* is it ok ? */
if (!$ok) {
if (isset($content[1])) {
......
......@@ -38,9 +38,7 @@ function smarty_modifier_userlink($other_user, $class='link', $idletime='not_set
$prefs['feature_community_mouseover'] == 'y' &&
$userlib->get_user_preference($user, 'show_mouseover_user_info', 'y') == 'y';
$show_friends = $prefs['feature_friends'] == 'y' && $tikilib->verify_friendship($user, $other_user);
if ( $show_mouseover || $show_friends ) {
if ( $show_mouseover ) {
$cacheItem = 'userlink.' . $user . '.' . $other_user . $fullname . $max_length;
} else {
$cacheItem = 'userlink.' . $other_user . $fullname . $max_length;
......@@ -67,10 +65,6 @@ function smarty_modifier_userlink($other_user, $class='link', $idletime='not_set
$friend = '';
if ($show_friends) {
$friend = '&nbsp;<img src="img/icons/ico_friend.gif" width="7" height="10" alt="'.tra('Friend').'" />&nbsp;';
}
if ( $fullname != '' ) {
$ou = $fullname;
} else {
......
......@@ -2499,109 +2499,6 @@ class TikiLib extends TikiDb_Bridge
$semaphores->delete(array('semName' => $semName,'timestamp' => (int) $lock,'objectType' => $objectType));
}
// FRIENDS METHODS //
/**
* @param $user
* @param int $offset
* @param $maxRecords
* @param string $sort_mode
* @param string $find
* @return array
*/
function list_user_friends($user, $offset = 0, $maxRecords = -1, $sort_mode = 'login_asc', $find = '')
{
$sort_mode = $this->convertSortMode($sort_mode);
if ($find) {
$findesc = '%'.$find.'%';
$mid=" and (u.`login` like ? or p.`value` like ?) ";
$bindvars=array($user,$findesc,$findesc);
} else {
$mid='';
$bindvars=array($user);
}
// TODO: same as list_users
$query = "select u.*, p.`value` as realName from `tiki_friends` as f, `users_users` as u left join `tiki_user_preferences` p on u.`login`=p.`user` and p.`prefName` = 'realName' where u.`login`=f.`friend` and f.`user`=? and f.`user` <> f.`friend` $mid order by $sort_mode";
$query_cant = "select count(*) from `tiki_friends` as f, `users_users` as u left join `tiki_user_preferences` p on u.`login`=p.`user` and p.`prefName` = 'realName' where u.`login`=f.`friend` and f.`user`=? $mid";
$result = $this->fetchAll($query, $bindvars, $maxRecords, $offset);
$cant = $this->getOne($query_cant, $bindvars);
$ret = Array();
foreach ( $result as $res ) {
$res['realname'] = $this->get_user_preference($res['login'], 'realName');
$ret[] = $res;
}
$retval = Array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
/**
* @param $user
* @return mixed
*/
function list_online_friends($user)
{
$this->update_session();
$bindvars = array($user);
// TODO: same as list_users
$query = "select u.*, p.`value` as realName from `tiki_friends` as f, `users_users` as u, `tiki_sessions` s left join `tiki_user_preferences` p on u.`login`=p.`user` and p.`prefName` = 'realName' where u.`login`=f.`friend` and s.`user`=u.`login` and f.`user`=? and f.`user` <> f.`friend`";
return $this->fetchAll($query, $bindvars);
}
/**
* @param $user
* @param $friend
* @return int
*/
function verify_friendship($user, $friend)
{
if ($user == $friend) {
return 0;
}
return $this->table('tiki_friends')->fetchCount(array('user' => $user, 'friend' => $friend));
}
// Check if there's already a friendship request from userwatched to userwatching
/**
* @param $userwatched
* @param $userwatching
* @return int
*/
function verify_friendship_request($userwatched, $userwatching)
{
if ($userwatched == $userwatching) {
return 0;
}
return $this->table('tiki_friendship_requests')->fetchCount(array('userTo' => $userwatching, 'userFrom' => $userwatched));
}
/**
* @param $user
* @return bool|string
*/
function get_friends_count($user)
{
$cachelib = TikiLib::lib('cache');
$cacheKey = 'friends_count_'.$user;
if ($cachelib->isCached($cacheKey)) {
return $cachelib->getCached($cacheKey);
} else {
$count = $this->table('tiki_friends')->fetchCount(array('user' => $user));
$cachelib->cacheItem($cacheKey, $count);
return $count;
}
}
/**
* @param int $offset
* @param $maxRecords
......@@ -2616,9 +2513,6 @@ class TikiLib extends TikiDb_Bridge
$userprefslib = TikiLib::lib('userprefs');
$bindvars = array();
if ($prefs['feature_friends'] == 'y' && !$include_prefs) {
$bindvars[] = $user;
}
if ( $find ) {
$findesc = '%'.$find.'%';
$mid = 'where (`login` like ? or p1.`value` like ?)';
......@@ -2673,12 +2567,7 @@ class TikiLib extends TikiDb_Bridge
if ( $sort_mode != '' ) $sort_mode = 'order by '.$sort_mode;
// Need to use a subquery to avoid bad results when using a limit and an offset, with at least MySQL
if ($prefs['feature_friends'] == 'y' && !$include_prefs) {
$query = "select * from (select u.* $pref_field, f.`friend` from `users_users` u $pref_join $find_join left join `tiki_friends` as f on (u.`login` = f.`friend` and f.`user`=?) $pref_where $sort_mode) as tab";
} else {
$query = "select u.* $pref_field from `users_users` u $pref_join $find_join $pref_where $sort_mode";
}
$query = "select u.* $pref_field from `users_users` u $pref_join $find_join $pref_where $sort_mode";
$query_cant = "select count(distinct u.`login`) from `users_users` u $find_join_cant $mid_cant";
$result = $this->fetchAll($query, $bindvars, $maxRecords, $offset);
......@@ -2686,10 +2575,9 @@ class TikiLib extends TikiDb_Bridge
$ret = array();
foreach ( $result as $res ) {
if ($prefs['feature_friends'] == 'y') {
$res['friend'] = !empty($res['friend'] );
if ( $include_prefs ) {
$res['preferences'] = $userprefslib->get_userprefs($res['login']);
}
if ( $include_prefs ) $res['preferences'] = $userprefslib->get_userprefs($res['login']);
$ret[] = $res;
}
......
......@@ -2135,10 +2135,8 @@ class UsersLib extends TikiLib
$this->query('update `messu_messages` set `user`=? where `user`=?', array($to, $from));
$this->query('update `messu_messages` set `user_from`=? where `user_from`=?', array($to, $from));
$this->query('update `tiki_newsletter_subscriptions` set `email`=? where `email`=? and `isUser`=?', array($to, $from, 'y'));
$this->query('update `tiki_friends` set `user`=? where `user`=?', array($to, $from));
$this->query('update `tiki_friends` set `friend`=? where `friend`=?', array($to, $from));
$this->query('update `tiki_friendship_requests` set `userFrom`=? where `userFrom`=?', array($to, $from));
$this->query('update `tiki_friendship_requests` set `userTo`=? where `userTo`=?', array($to, $from));
$this->query('update `tiki_object_relations` set `source_itemId`=? where source_type="user" `source_itemId`=?', array($to, $from));
$this->query('update `tiki_object_relations` set `target_itemId`=? where target_type="user" `target_itemId`=?', array($to, $from));
$this->query('update `tiki_freetagged_objects` set `user`=? where `user`=?', array($to, $from));
$this->query(
......@@ -6509,118 +6507,6 @@ class UsersLib extends TikiLib
return $this->fetchAll($query, $bindvals, $max, 0);
}
// Friends methods
function request_friendship($user, $friend)
{
if (empty($user) || empty($friend) || $user == $friend) {
return false;
}
$query = 'delete from `tiki_friendship_requests` where `userFrom`=? and `userTo`=?';
$this->query($query, array($user, $friend));
$query = 'insert into `tiki_friendship_requests` (`userFrom`, `userTo`) values (?, ?)';
$result = $this->query($query, array($user, $friend));
if (!$result)
return false;
return true;
}
function accept_friendship($user, $friend)
{
$exists = $this->getOne(
'select count(*) from `tiki_friendship_requests` where `userTo`=? and `userFrom`=?',
array($user, $friend)
);
if (!$exists)
return false;
if (empty($user) || empty($friend)) {
return false;
}
$query = 'delete from `tiki_friends` where `user`=? and `friend`=?';
$this->query($query, array($user, $friend));
$this->query($query, array($friend, $user));
$query = 'insert into `tiki_friends` (`user`, `friend`) values (?,?)';
$this->query($query, array($user, $friend));
$this->query($query, array($friend, $user));
$query = 'delete from `tiki_friendship_requests` where `userFrom`=? and `userTo`=?';
$this->query($query, array($user, $friend));
$this->query($query, array($friend, $user));
$this->score_event($user, 'friend_new', $friend);
$this->score_event($friend, 'friend_new', $user);
global $cachelib;
$cachelib->invalidate('friends_count_'.$user);
$cachelib->invalidate('friends_count_'.$friend);
return true;
}
function refuse_friendship($user, $friend)
{
$exists = $this->getOne(
'select count(*) from `tiki_friendship_requests` where `userTo`=? and `userFrom`=?',
array($user, $friend)
);
if (!$exists)
return false;
$query = 'delete from `tiki_friendship_requests` where `userFrom`=? and `userTo`=?';
$this->query($query, array($user, $friend));
$this->query($query, array($friend, $user));
return true;
}
function list_pending_friendship_requests($user)
{
$query = 'select * from `tiki_friendship_requests` where `userTo`=? order by tstamp';
$result = $this->query($query, array($user));
$requests = array();
while ($res = $result->fetchRow('DB_FETCHMODE_ASSOC')) {
$requests[$res['userFrom']] = $res['tstamp'];
}
return $requests;
}
function list_waiting_friendship_requests($user)
{
$query = 'select * from `tiki_friendship_requests` where `userFrom`=? order by tstamp';
$result = $this->query($query, array($user));
$requests = array();
while ($res = $result->fetchRow('DB_FETCHMODE_ASSOC')) {
$requests[$res['userTo']] = $res['tstamp'];
}
return $requests;
}
function break_friendship($user, $friend)
{
$query = 'delete from `tiki_friends` where `user`=? and `friend`=?';
$this->query($query, array($user, $friend));
$this->query($query, array($friend, $user));
global $cachelib;
$cachelib->invalidate('friends_count_'.$user);
$cachelib->invalidate('friends_count_'.$friend);
}
// Case-sensitivity regression only. used for patching
function get_object_case_permissions($objectId, $objectType)
{
......
......@@ -44,6 +44,7 @@ function wikiplugin_group_info()
function wikiplugin_group($data, $params)
{
// TODO : Re-implement friend filter
global $user, $prefs, $tikilib, $smarty, $groupPluginReturnAll;
$dataelse = '';
if (strrpos($data, '{ELSE}')) {
......@@ -55,16 +56,13 @@ function wikiplugin_group($data, $params)
return $data.$dataelse;
}
if (!empty($params['friends']) && $prefs['feature_friends'] == 'y') {
$friends = explode('|', $params['friends']);
}
if (!empty($params['groups'])) {
$groups = explode('|', $params['groups']);
}
if (!empty($params['notgroups'])) {
$notgroups = explode('|', $params['notgroups']);
}
if (empty($friends) && empty($groups) && empty($notgroups)) {
if (empty($groups) && empty($notgroups)) {
return '';
}
......@@ -79,18 +77,6 @@ function wikiplugin_group($data, $params)
}
}
if (!empty($friends)) {
$ok = false;
foreach ($friends as $key=>$friend) {
if ($tikilib->verify_friendship($user, $friend)) {
$ok = true;
break;
}
}
if (!$ok)
return $dataelse;
}
if (!empty($groups)) {
$ok = false;
......
......@@ -38,25 +38,8 @@ function wikiplugin_topfriends_info()
function wikiplugin_topfriends($data, $params)
{
global $smarty, $prefs, $tiki_p_list_users, $tikilib;
/* Check we can be called */
if ($prefs['feature_friends'] != 'y') {
return ' ';
}
extract($params, EXTR_SKIP);
if (!(isset($limit) && $limit <> '')) {
$limit = 5;
}
if ((isset($public) && $public != 'y') && ($tiki_p_list_users != 'y')) {
// Access denied
return ' ';
}
$listusers = $tikilib->list_users(0, $limit, 'score_desc', '', false);
$smarty->assign_by_ref('listusers', $listusers["data"]);
// TODO : Re-implement
$smarty->assign_by_ref('listusers', array());
return $smarty->fetch('plugins/plugin-topfriends.tpl');
}
......@@ -12,8 +12,5 @@
{/section}
{/modules_list}
{/if}
{if $prefs.feature_friends eq 'y'}
<a style="margin-left: 20px" href="tiki-list_users.php" class="more">{tr}More...{/tr}</a>
{/if}
{/tikimodule}
{title help="Friendship+Network"}{tr}Friendship Network{/tr}{/title}
{if $msg}
<center>{$msg}</center>
<br><br>
{/if}
{if $pending_requests|@count}
<p style="font-weight: bold;">{tr}Pending requests{/tr}</p>
<table class="userlist">
<tr>
<td class="userlistheading">{tr}Login{/tr}</td>
<td class="userlistheading">{tr}Request Time{/tr}</td>
<td class="userlistheading">{tr}Actions{/tr}</td>
</tr>
{foreach from=$pending_requests item=time key=pending_user}
<tr>
<td class="userlistodd">{$pending_user|userlink}</td>
<td class="userlistodd">{$time|date_format}</td>
<td class="userlistodd"><a href="tiki-friends.php?accept={$pending_user}">{tr}Accept{/tr}</a>|<a href="tiki-friends.php?refuse={$pending_user}">{tr}Refuse{/tr}</a></td>
</tr>
{/foreach}
</table>
{/if}
{if $waiting_requests|@count}
<p style="font-weight: bold;">{tr}Waiting requests{/tr}</p>
<table class="userlist">
<tr>
<td class="userlistheading">{tr}Login{/tr}</td>
<td class="userlistheading">{tr}Request Time{/tr}</td>
<td class="userlistheading">{tr}Actions{/tr}</td>
</tr>
{foreach from=$waiting_requests item=time key=wuser}
<tr>
<td class="userlistodd">{$wuser|userlink}</td>
<td class="userlistodd">{$time|date_format}</td>
<td class="userlistodd"><a href="tiki-friends.php?cancel_waiting_friendship={$wuser}">{tr}Cancel friendship request{/tr}</a></td>
</tr>
{/foreach}
</table>
{/if}
<p style="font-weight: bold;">{tr}Your friends{/tr}</p>
{include file='find.tpl' autocomplete="username"}
<table class="userlist">
{if $listpages}
<tr>
<td class="userlistheading"><a class="userlistheading" href="tiki-friends.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'login_desc'}login_asc{else}login_desc{/if}">{tr}Login{/tr}</a></td>
<td class="userlistheading"><a class="userlistheading" href="tiki-friends.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'pref:realName_desc'}pref:realName_asc{else}pref:realName_desc{/if}">{tr}Real Name{/tr}</a></td>
<td class="userlistheading">{tr}Action{/tr}</td>
</tr>
{/if}
{cycle values="odd,even" print=false}
{section name=changes loop=$listpages}
<tr>
<td class="userlist{cycle advance=false}">
<a class="userlistlogin{cycle advance=false}" href="tiki-user_information.php?view_user={$listpages[changes].login}">{$listpages[changes].login|userlink}</a>{if $prefs.feature_score eq 'y'}{$listpages[changes].score|star}{/if}
</td>
<td class="userlist{cycle advance=false}"><a class="userlistlogin{cycle advance=false}" href="tiki-user_information.php?view_user={$listpages[changes].login}">{$listpages[changes].realname}</a></td>
<td class="userlist{cycle advance=true}"><a class="userlistlogin{cycle advance=false}" href="?break={$listpages[changes].login}">{icon _id='cross' alt="{tr}break friendship{/tr}"}</a></td>
</tr>
{sectionelse}
{norecords _colspan=6}
{/section}
</table>
{pagination_links cant=$cant_pages step=$prefs.maxRecords offset=$offset}{/pagination_links}
{extends "layout_view.tpl"}
{block name=title}
{title help="Friendship+Network"}{tr}Friendship Network{/tr}{/title}
{/block}
{block name=content}
{/block}
......@@ -151,45 +151,6 @@
</div>
</div>
{if $prefs.feature_friends eq 'y' && $user ne $userwatch && $user}
<div class="cbox-data">
{if $friend}
<div class="clearfix">
<div class="">
{icon _id='user'}
<a class="link" href="tiki-friends.php">{tr}This user is your friend !{/tr}</a>
</div>
</div>
{elseif $friend_pending}
<div class="clearfix">
<div class="">
{icon _id='user_delete'} {tr}The user requested friendship with you{/tr}<br>
<a class="link" href="tiki-friends.php?accept={$userinfo.login}">{tr}Accept friendship from this user{/tr}</a><br>
<a class="link" href="tiki-friends.php?refuse={$userinfo.login}">{tr}Refuse friendship from this user{/tr}</a>
</div>
</div>
{elseif $friend_waiting}
<div class="clearfix">
<div class="">{icon _id='user_delete'} {tr}Currently waiting for user approval{/tr} <br>
<a class="link" href="tiki-friends.php?cancel_waiting_friendship={$userinfo.login}">
{tr}Cancel friendship request towards this user{/tr}
</a>
</div>
</div>
{else}
<div class="clearfix">
<div class="">
{icon _id='user_delete'}
<a class="link" href="tiki-friends.php?request_friendship={$userinfo.login}">
{tr}Request friendship from this user{/tr}
</a>
</div>
</div>
{/if}
</div>
{/if}
</div>
</div>
{else}{* infoPublic eq 'n' *}
......
......@@ -14,145 +14,4 @@ include_once('lib/messu/messulib.php');
$access->check_user($user);
$access->check_feature('feature_friends');
// TODO: all messages should be translated to receiver language, not sender.
if (isset($_REQUEST['request_friendship'])) {
$friend = $_REQUEST['request_friendship'];
if ($userlib->user_exists($friend)) {
if (!$tikilib->verify_friendship($friend, $user)) {
$userlib->request_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra("Friendship request sent to %s"), $friend));
$foo = parse_url($_SERVER["REQUEST_URI"]);
$machine = $tikilib->httpPrefix(true). $foo["path"];
$smarty->assign('server_name', $machine);
$messulib->post_message(
$friend,
$user,
$friend,
'',
$smarty->fetchLang($lg, 'mail/new_friend_invitation_subject.tpl'),
$smarty->fetchLang($lg, 'mail/new_friend_invitation.tpl'),
3
);
} else {
$smarty->assign('msg', sprintf(tra("You're already friend of %s"), $_REQUEST['request_friendship']));
$smarty->display("error.tpl");
die;
}
} else {
$smarty->assign('msg', tra("Invalid username"));
$smarty->display("error.tpl");
die;
}
} elseif (isset($_REQUEST['accept'])) {
$friend = $_REQUEST['accept'];
$userlib->accept_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Accepted friendship request from %s'), $friend));
$messulib->post_message(
$friend,
$user,
$friend,
'',
tra("I have accepted your friendship request!", $lg),
'', // Do we need a message?
3
);
} elseif (isset($_REQUEST['refuse'])) {
$friend = $_REQUEST['refuse'];
$userlib->refuse_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Refused friendship request from %s'), $friend));
// Should we send a message, or that would intimidate refusing friendships?
// TODO: make it optional
$messulib->post_message(
$friend,
$user,
$friend,
'',
tra("I have refused your friendship request.", $lg),
'',
3
);
} elseif (isset($_REQUEST['cancel_waiting_friendship'])) {
$friend = $_REQUEST['cancel_waiting_friendship'];
$userlib->refuse_friendship($friend, $user);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Canceled friendship request with %s'), $friend));
// Should we send a message, or that would intimidate refusing friendships?
// TODO: make it optional
$messulib->post_message(
$friend,
$user,
$friend,
'',
tra("I have canceled my friendship request.", $lg),
'',
3
);
} elseif (isset($_REQUEST['break'])) {
$friend = $_REQUEST['break'];
$userlib->break_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Broke friendship with %s'), $friend));