diff options
author | Mario <mario@mariovavti.com> | 2024-07-06 11:05:22 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-07-06 11:05:22 +0000 |
commit | 45275910e606a02b12393714ea3b0409da440d61 (patch) | |
tree | 10b2d173d58cb930f8df28fe75af73dd4974c08c /Zotlabs/Module/Profperm.php | |
parent | 0c1d0f7498661fb34dcca6f3c6566e757af310a7 (diff) | |
parent | c04e781926a78e514cdf211fa24930a331149072 (diff) | |
download | volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.gz volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.bz2 volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.zip |
Merge branch '9.2RC'master
Diffstat (limited to 'Zotlabs/Module/Profperm.php')
-rw-r--r-- | Zotlabs/Module/Profperm.php | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/Zotlabs/Module/Profperm.php b/Zotlabs/Module/Profperm.php index 900e2f981..842197415 100644 --- a/Zotlabs/Module/Profperm.php +++ b/Zotlabs/Module/Profperm.php @@ -1,6 +1,7 @@ <?php namespace Zotlabs\Module; +use Zotlabs\Lib\Config; require_once('include/photos.php'); @@ -8,42 +9,42 @@ require_once('include/photos.php'); class Profperm extends \Zotlabs\Web\Controller { function init() { - + if(! local_channel()) return; - + $channel = \App::get_channel(); $which = $channel['channel_address']; - + $profile = \App::$argv[1]; - + profile_load($which,$profile); - + } - - + + function get() { - + if(! local_channel()) { 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_channel(),'system','groupedit_image_limit'); if($switchtotext === false) - $switchtotext = get_config('system','groupedit_image_limit'); + $switchtotext = Config::Get('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)), @@ -52,8 +53,8 @@ class Profperm extends \Zotlabs\Web\Controller { 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)), @@ -63,21 +64,21 @@ class Profperm extends \Zotlabs\Web\Controller { 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_channel()), 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", @@ -91,42 +92,42 @@ class Profperm extends \Zotlabs\Web\Controller { intval($change), intval(local_channel()) ); - + } - - $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash + + $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'", intval(local_channel()), dbesc($profile['profile_guid']) ); - + $members = $r; - + $ingroup = array(); if(count($r)) foreach($r as $member) $ingroup[] = $member['abook_id']; } - + $o .= '<h2>' . t('Profile Visibility Editor') . '</h2>'; - + $o .= '<h3>' . t('Profile') . ' \'' . $profile['profile_name'] . '\'</h3>'; - + $o .= '<div id="prof-edit-desc">' . t('Click on a contact to add or remove.') . '</div>'; - + } - + $o .= '<div id="prof-update-wrapper">'; if($change) $o = ''; - + $o .= '<div id="prof-members-title">'; $o .= '<h3>' . t('Visible To') . '</h3>'; $o .= '</div>'; $o .= '<div id="prof-members">'; - + $textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false); - + foreach($members as $member) { if($member['xchan_url']) { $member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['abook_id'] . '); return false;'; @@ -135,14 +136,14 @@ class Profperm extends \Zotlabs\Web\Controller { } $o .= '</div><div id="prof-members-end"></div>'; $o .= '<hr id="prof-separator" />'; - + $o .= '<div id="prof-all-contcts-title">'; $o .= '<h3>' . t("All Connections") . '</h3>'; $o .= '</div>'; $o .= '<div id="prof-all-contacts">'; - + $r = abook_connections(local_channel()); - + if($r) { $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); foreach($r as $member) { @@ -152,17 +153,17 @@ class Profperm extends \Zotlabs\Web\Controller { } } } - + $o .= '</div><div id="prof-all-contacts-end"></div>'; - + if($change) { echo $o; killme(); } $o .= '</div>'; return $o; - + } - - + + } |