define ( 'FRIENDIKA_VERSION', '2.2.1023' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1069 );
+define ( 'DB_UPDATE_VERSION', 1070 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`url` CHAR( 255 ) NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
-`photo` CHAR( 255 ) NOT NULL
+`photo` CHAR( 255 ) NOT NULL ,
+`request` CHAR( 255 ) NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
`cid` INT NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
`url` CHAR( 255 ) NOT NULL ,
+`request` CHAR( 255 ) NOT NULL,
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
`created` DATETIME NOT NULL
if(! count($items))
return;
}
+ elseif($cmd === 'suggest') {
+ $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
+ intval($item_id)
+ );
+ if(! count($suggest))
+ return;
+ $uid = $suggest[0]['uid'];
+ $recipients[] = $suggest[0]['cid'];
+ $item = $suggest[0];
+ }
else {
// find ancestors
// fill this in with a single salmon slap if applicable
$slap = '';
- if($cmd != 'mail') {
+ if($cmd != 'mail' && $cmd != 'suggest') {
require_once('include/group.php');
'$parent_id' => xmlify($item['parent-uri'])
));
}
+ elseif($cmd === 'suggest') {
+ $notify_hub = false; // suggestions are not public
+
+ $sugg_template = get_markup_template('atom_suggest.tpl');
+
+ $atom .= replace_macros($sugg_template, array(
+ '$name' => xmlify($item['name']),
+ '$url' => xmlify($item['url']),
+ '$photo' => xmlify($item['photo']),
+ '$request' => xmlify($item['request']),
+ '$note' => xmlify($item['note'])
+ ));
+
+ // We don't need this any more
+
+ q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
+ intval($item['id'])
+ );
+
+ }
else {
if($followup) {
foreach($items as $item) { // there is only one item
$fsugg['name'] = notags(unxmlify($base['name'][0]['data']));
$fsugg['photo'] = notags(unxmlify($base['photo'][0]['data']));
$fsugg['url'] = notags(unxmlify($base['url'][0]['data']));
+ $fsugg['request'] = notags(unxmlify($base['request'][0]['data']));
$fsugg['body'] = escape_tags(unxmlify($base['note'][0]['data']));
// Does our member already have a friend matching this description?
// Do we already have an fcontact record for this person?
$fid = 0;
- $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `photo` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `request` = '%s' LIMIT 1",
dbesc($fsugg['url']),
dbesc($fsugg['name']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['request'])
);
if(count($r)) {
$fid = $r[0]['id'];
}
if(! $fid)
- $r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo` ) VALUES ( '%s', '%s', '%s' ) ",
+ $r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo`,`request` ) VALUES ( '%s', '%s', '%s', '%s' ) ",
dbesc($fsugg['name']),
dbesc($fsugg['url']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['photo']),
+ dbesc($fsugg['request'])
);
- $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `photo` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `request` = '%s' LIMIT 1",
dbesc($fsugg['url']),
dbesc($fsugg['name']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['request'])
);
if(count($r)) {
$fid = $r[0]['id'];
<?php
-define( 'UPDATE_VERSION' , 1069 );
+define( 'UPDATE_VERSION' , 1070 );
/**
*
}
-
+function update_1069() {
+ q("ALTER TABLE `fsuggest` ADD `request` CHAR( 255 ) NOT NULL AFTER `url` ");
+ q("ALTER TABLE `fcontact` ADD `request` CHAR( 255 ) NOT NULL AFTER `photo` ");
+}
<dfrn:url>$url</dfrn:url>
<dfrn:name>$name</dfrn:name>
<dfrn:photo>$photo</dfrn:photo>
+ <dfrn:request>$request</dfrn:request>
<dfrn:note>$note</dfrn:note>
</dfrn:suggest>