diff options
-rw-r--r-- | include/security.php | 2 | ||||
-rw-r--r-- | mod/profiles.php | 64 | ||||
-rw-r--r-- | version.inc | 2 |
3 files changed, 37 insertions, 31 deletions
diff --git a/include/security.php b/include/security.php index 926b2a8fe..d1b3deca7 100644 --- a/include/security.php +++ b/include/security.php @@ -206,7 +206,7 @@ function change_channel($change_channel) { $ret = false; if($change_channel) { - $r = q("select * from channel where channel_id = %d and channel_account_id = %d limit 1", + $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d limit 1", intval($change_channel), intval(get_account_id()) ); diff --git a/mod/profiles.php b/mod/profiles.php index d4b8a1ed8..1e34542bc 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -12,7 +12,7 @@ function profiles_post(&$a) { call_hooks('profile_post', $_POST); - if(($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) { + if((argc() > 1) && (argv(1) !== "new") && intval(argv(1))) { $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval(local_user()) @@ -286,11 +286,13 @@ function profiles_post(&$a) { if($r) info( t('Profile updated.') . EOL); + $channel = $a->get_channel(); if($namechanged && $is_default) { - $r = q("UPDATE `contact` SET `name_date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1", + $r = q("UPDATE xchan SET xchan_name = '%s', xchan_name_date` = '%s' WHERE xchan_hash = '%s' limit 1", + dbesc($name), dbesc(datetime_convert()), - intval(local_user()) + dbesc($channel['xchan_hash']) ); } @@ -310,17 +312,19 @@ function profile_activity($changed, $value) { if(! local_user() || ! is_array($changed) || ! count($changed)) return; - if($a->user['hidewall'] || get_config('system','block_public')) - return; +// FIXME (lots to fix) +// if($a->user['hidewall'] || get_config('system','block_public')) +// return; + +return; + if(! get_pconfig(local_user(),'system','post_profilechange')) return; require_once('include/items.php'); - $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", - intval(local_user()) - ); + $self = $a->get_channel(); if(! count($self)) return; @@ -328,14 +332,14 @@ function profile_activity($changed, $value) { $arr = array(); $arr['uri'] = $arr['parent_uri'] = item_message_id(); $arr['uid'] = local_user(); - $arr['contact-id'] = $self[0]['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self[0]['name']; - $arr['author-link'] = $arr['owner-link'] = $self[0]['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb']; +// $arr['contact-id'] = $self[0]['id']; +// $arr['wall'] = 1; +// $arr['type'] = 'wall'; +// $arr['gravity'] = 0; +// $arr['origin'] = 1; +// $arr['author-name'] = $arr['owner-name'] = $self[0]['name']; +// $arr['author-link'] = $arr['owner-link'] = $self[0]['url']; +// $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb']; $arr['verb'] = ACTIVITY_UPDATE; $arr['obj_type'] = ACTIVITY_OBJ_PROFILE; @@ -368,20 +372,22 @@ function profile_activity($changed, $value) { $arr['body'] = $message; - $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>' - . '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>'; - $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n"); - $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n"); - $arr['object'] .= '</link></object>' . "\n"; +// $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>' +// . '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>'; +// $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n"); +// $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n"); +// $arr['object'] .= '</link></object>' . "\n"; - $arr['allow_cid'] = $a->user['allow_cid']; - $arr['allow_gid'] = $a->user['allow_gid']; - $arr['deny_cid'] = $a->user['deny_cid']; - $arr['deny_gid'] = $a->user['deny_gid']; +// $arr['allow_cid'] = $a->user['allow_cid']; +// $arr['allow_gid'] = $a->user['allow_gid']; +// $arr['deny_cid'] = $a->user['deny_cid']; +// $arr['deny_gid'] = $a->user['deny_gid']; $i = item_store($arr); if($i) { +// ??? are we going to change plink structure? I'm guessing yes + // give it a permanent link q("update item set plink = '%s' where id = %d limit 1", dbesc($a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $i), @@ -404,7 +410,7 @@ function profiles_content(&$a) { return; } - if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) { + if((argc() > 2) && (argv(1) === "drop") && intval(argv(2))) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1", intval($a->argv[2]), intval(local_user()) @@ -440,7 +446,7 @@ function profiles_content(&$a) { - if(($a->argc > 1) && ($a->argv[1] === 'new')) { + if((argc() > 1) && (argv(1) === 'new')) { check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't'); @@ -476,7 +482,7 @@ function profiles_content(&$a) { goaway($a->get_baseurl(true) . '/profiles'); } - if(($a->argc > 2) && ($a->argv[1] === 'clone')) { + if((argc() > 2) && (argv(1) === 'clone')) { check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't'); @@ -521,7 +527,7 @@ function profiles_content(&$a) { } - if(($a->argc > 1) && (intval($a->argv[1]))) { + if((argc() > 1) && (intval(argv(1)))) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval(local_user()) diff --git a/version.inc b/version.inc index 86436466e..ddd4c384e 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-10-18.111 +2012-10-19.112 |