updates to put rating info into the local xlink before sending it to known directory servers
This commit is contained in:
parent
da842da683
commit
1ef2d1c5c4
@ -59,6 +59,7 @@ require_once('include/html2plain.php');
|
||||
* relay item_id (item was relayed to owner, we will deliver it as owner)
|
||||
* location channel_id
|
||||
* request channel_id xchan_hash message_id
|
||||
* rating xlink_id
|
||||
*
|
||||
*/
|
||||
|
||||
@ -296,6 +297,15 @@ function notifier_run($argv, $argc){
|
||||
$private = false;
|
||||
$packet_type = 'purge';
|
||||
}
|
||||
elseif($cmd === 'rating') {
|
||||
$r = q("select * from xlink where xlink_id = %d and xlink_static = 1 limit 1",
|
||||
intval($item_id)
|
||||
);
|
||||
if($r) {
|
||||
logger('rating message: ' . print_r($r[0],true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// Normal items
|
||||
|
@ -55,6 +55,8 @@ function connedit_post(&$a) {
|
||||
if(! $contact_id)
|
||||
return;
|
||||
|
||||
$channel = $a->get_channel();
|
||||
|
||||
// TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the
|
||||
// connection enable is toggled to a special autopost url and set permissions immediately, leaving
|
||||
// the other form elements alone pending a manual submit of the form. The downside is that there
|
||||
@ -79,9 +81,11 @@ function connedit_post(&$a) {
|
||||
|
||||
if($orig_record[0]['abook_flags'] & ABOOK_FLAG_SELF) {
|
||||
$autoperms = intval($_POST['autoperms']);
|
||||
$is_self = true;
|
||||
}
|
||||
else {
|
||||
$autoperms = null;
|
||||
$is_self = false;
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +130,40 @@ function connedit_post(&$a) {
|
||||
$abook_flags = $orig_record[0]['abook_flags'];
|
||||
$new_friend = false;
|
||||
|
||||
|
||||
if(! $is_self) {
|
||||
$z = q("select * from xlink where xlink_xchan = '%s' and xlink_xlink = '%s' and xlink_static = 1 limit 1",
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($orig_record[0]['abook_xchan'])
|
||||
);
|
||||
if($z) {
|
||||
$record = $z[0]['xlink_id'];
|
||||
$w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_updated = '%s'
|
||||
where xlink_id = %d",
|
||||
intval($rating),
|
||||
dbesc($rating_text),
|
||||
dbesc(datetime_convert()),
|
||||
intval($record)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', 1 ) ",
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($orig_record[0]['abook_xchan']),
|
||||
intval($rating),
|
||||
dbesc($rating_text),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
$z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1",
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($orig_record[0]['abook_xchan'])
|
||||
);
|
||||
if($z)
|
||||
$record = $z[0]['xlink_id'];
|
||||
}
|
||||
if($record) {
|
||||
proc_run('php','include/notifier.php','rating',$record);
|
||||
}
|
||||
}
|
||||
|
||||
if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) {
|
||||
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
|
||||
@ -167,7 +204,6 @@ function connedit_post(&$a) {
|
||||
}
|
||||
|
||||
if($new_friend) {
|
||||
$channel = $a->get_channel();
|
||||
$default_group = $channel['channel_default_group'];
|
||||
if($default_group) {
|
||||
require_once('include/group.php');
|
||||
|
Reference in New Issue
Block a user