From 1ef2d1c5c405a5c9ab7f41a4fdefd295098b5ac8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 Jan 2015 16:52:17 -0800 Subject: updates to put rating info into the local xlink before sending it to known directory servers --- mod/connedit.php | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index 8270fa981..5e7db3a09 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -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'); -- cgit v1.2.3 From e2edc2c96841588ade355890c49ff7a3c900078d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Jan 2015 15:17:50 -0800 Subject: disable ratings until we're a bit further along. It's all changing. --- mod/connedit.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index c082e03a8..da0ab2b6c 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -528,6 +528,7 @@ function connedit_content(&$a) { } $poco_rating = get_config('system','poco_rating_enable'); + $poco_rating = 0; // leave disabled until we're ready for it. // if unset default to enabled if($poco_rating === false) $poco_rating = true; -- cgit v1.2.3 From 43f5fbddc6db09adb54148fb6d44c4375b5f8b7a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Jan 2015 15:21:50 -0800 Subject: enable ratings only in this branch until we're ready to push --- mod/connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index 1a00e854c..c613c3ba6 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -564,7 +564,7 @@ function connedit_content(&$a) { } $poco_rating = get_config('system','poco_rating_enable'); - $poco_rating = 0; // leave disabled until we're ready for it. + // if unset default to enabled if($poco_rating === false) $poco_rating = true; -- cgit v1.2.3 From 3e22de0be01cc53e74ffd00f5b9d14d4bcc9b6c5 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Jan 2015 18:17:24 -0800 Subject: how did that stuff merge? grrrr.... --- mod/connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index c613c3ba6..8c0212afe 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -564,7 +564,7 @@ function connedit_content(&$a) { } $poco_rating = get_config('system','poco_rating_enable'); - + $poco_rating = 0; // if unset default to enabled if($poco_rating === false) $poco_rating = true; -- cgit v1.2.3