couple of fixes to follow, prepare for default connection permissions

This commit is contained in:
friendica 2012-12-31 15:47:51 -08:00
parent 791302f317
commit a8812346c4
4 changed files with 48 additions and 19 deletions

View File

@ -118,7 +118,7 @@ function new_contact($uid,$url,$channel,$interactive = false) {
return $result; return $result;
} }
$r = q("select abook_xchan from abook_id where abook_xchan = '%s' and abook_channel = %d limit 1", $r = q("select abook_xchan from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
dbesc($xchan_hash), dbesc($xchan_hash),
intval($uid) intval($uid)
); );
@ -143,6 +143,14 @@ function new_contact($uid,$url,$channel,$interactive = false) {
if(! $r) if(! $r)
logger('mod_follow: abook creation failed'); logger('mod_follow: abook creation failed');
$r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
where abook_xchan = '%s' and abook_channel = %d limit 1",
dbesc($xchan_hash),
intval($uid)
);
if($r)
$result['abook'] = $r[0];
// Then send a ping/message to the other side // Then send a ping/message to the other side

View File

@ -1,21 +1,19 @@
<?php <?php
require_once('Scrape.php');
require_once('include/follow.php'); require_once('include/follow.php');
function follow_init(&$a) { function follow_init(&$a) {
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
goaway($_SESSION['return_url']); return;
// NOTREACHED
} }
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$return_url = $_SESSION['return_url']; $return_url = $_SESSION['return_url'];
$result = new_contact($uid,$url,$a->get_channel(),true); $result = new_contact($uid,$url,$a->get_channel(),true);
if($result['success'] == false) { if($result['success'] == false) {
@ -26,9 +24,6 @@ function follow_init(&$a) {
info( t('Channel added') . EOL); info( t('Channel added') . EOL);
if(strstr($return_url,'channel')) goaway(z_root() . '/connection/' . $result['abook']['abook_id']);
goaway($a->get_baseurl() . '/channel/' . $result['channel_id']);
goaway($return_url);
// NOTREACHED
} }

View File

@ -344,6 +344,36 @@ function settings_post(&$a) {
$arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0); $arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
$defperms = 0;
if(x($_POST['def_view_stream']))
$defperms += $_POST['def_view_stream'];
if(x($_POST['def_view_profile']))
$defperms += $_POST['def_view_profile'];
if(x($_POST['def_view_photos']))
$defperms += $_POST['def_view_photos'];
if(x($_POST['def_view_contacts']))
$defperms += $_POST['def_view_contacts'];
if(x($_POST['def_send_stream']))
$defperms += $_POST['def_send_stream'];
if(x($_POST['def_post_wall']))
$defperms += $_POST['def_post_wall'];
if(x($_POST['def_tag_deliver']))
$defperms += $_POST['def_tag_deliver'];
if(x($_POST['def_post_comments']))
$defperms += $_POST['def_post_comments'];
if(x($_POST['def_post_mail']))
$defperms += $_POST['def_post_mail'];
if(x($_POST['def_post_photos']))
$defperms += $_POST['def_post_photos'];
if(x($_POST['def_chat']))
$defperms += $_POST['def_chat'];
if(x($_POST['def_delegate']))
$defperms += $_POST['def_delegate'];
if(x($_POST['def_view_storage']))
$defperms += $_POST['def_view_storage'];
if(x($_POST['def_write_storage']))
$defperms += $_POST['def_write_storage'];
$notify = 0; $notify = 0;
if(x($_POST,'notify1')) if(x($_POST,'notify1'))
@ -398,7 +428,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','post_joingroup', $post_joingroup); set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange); set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
/*
if($page_flags == PAGE_PRVGROUP) { if($page_flags == PAGE_PRVGROUP) {
$hidewall = 1; $hidewall = 1;
if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) { if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
@ -412,6 +442,8 @@ function settings_post(&$a) {
} }
} }
*/
/* /*
$r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1", $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1",
dbesc($username), dbesc($username),
@ -455,12 +487,6 @@ function settings_post(&$a) {
intval(local_user()) intval(local_user())
); );
if($r) if($r)
info( t('Settings updated.') . EOL); info( t('Settings updated.') . EOL);

View File

@ -1 +1 @@
2012-12-30.185 2012-12-31.186