get_channel(); $which = $channel['channel_address']; $profile = $a->argv[1]; profile_load($a,$which,$profile); } function profperm_content(&$a) { if(! local_user()) { notice( t('Permission denied') . EOL); return; } if(argc() < 2) { notice( t('Invalid profile identifier.') . EOL ); return; } // Switch to text mod interface if we have more than 'n' contacts or group members $switchtotext = get_pconfig(local_user(),'system','groupedit_image_limit'); if($switchtotext === false) $switchtotext = get_config('system','groupedit_image_limit'); if($switchtotext === false) $switchtotext = 400; if((argc() > 2) && intval(argv(1)) && intval(argv(2))) { $r = q("SELECT abook_id FROM abook WHERE abook_id = %d and abook_channel = %d limit 1", intval(argv(2)), intval(local_user()) ); if($r) $change = intval(argv(2)); } if((argc() > 1) && (intval(argv(1)))) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1", intval(argv(1)), intval(local_user()) ); if(! $r) { notice( t('Invalid profile identifier.') . EOL ); return; } $profile = $r[0]; $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'", intval(local_user()), dbesc($profile['profile_guid']) ); $ingroup = array(); if($r) foreach($r as $member) $ingroup[] = $member['abook_id']; $members = $r; if($change) { if(in_array($change,$ingroup)) { q("UPDATE abook SET abook_profile = '' WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($change), intval(local_user()) ); } else { q("UPDATE abook SET abook_profile = '%s' WHERE abook_id = %d AND abook_channel = %d LIMIT 1", dbesc($profile['profile_guid']), intval($change), intval(local_user()) ); } //Time to update the permissions on the profile-pictures as well require_once('mod/profile_photo.php'); profile_photo_set_profile_perms($profile['id']); $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'", intval(local_user()), dbesc($profile['profile_guid']) ); $members = $r; $ingroup = array(); if(count($r)) foreach($r as $member) $ingroup[] = $member['abook_id']; } $o .= '