aboutsummaryrefslogtreecommitdiffstats
path: root/mod/connedit.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-31 00:50:20 -0800
committerfriendica <info@friendica.com>2015-01-31 00:50:20 -0800
commite6a5f7800390e5091743d6a97c6fd8f54c5d1530 (patch)
tree20c49c7d11b411b91530ef43374a208274ebbb57 /mod/connedit.php
parent4a243b63f7019a1e56ecf03b138cd7fc396236c2 (diff)
parent3e5226adc70838c784a0b208de25fffde37a6679 (diff)
downloadvolse-hubzilla-e6a5f7800390e5091743d6a97c6fd8f54c5d1530.tar.gz
volse-hubzilla-e6a5f7800390e5091743d6a97c6fd8f54c5d1530.tar.bz2
volse-hubzilla-e6a5f7800390e5091743d6a97c6fd8f54c5d1530.zip
Merge branch 'master' into tres
Conflicts: include/zot.php
Diffstat (limited to 'mod/connedit.php')
-rw-r--r--mod/connedit.php41
1 files changed, 39 insertions, 2 deletions
diff --git a/mod/connedit.php b/mod/connedit.php
index 2f2ac6c46..e7d16cd82 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');
@@ -530,6 +566,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;