* Description: Allow the recipients of private posts to see who else can see the post by clicking the lock icon
* Version: 1.0
* Author: Zach <https://f.shmuz.in/profile/techcity>
* Description: Allow the recipients of private posts to see who else can see the post by clicking the lock icon
* Version: 1.0
* Author: Zach <https://f.shmuz.in/profile/techcity>
- Addon::registerHook('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
- Addon::registerHook('addon_settings', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings');
- Addon::registerHook('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post');
+ Hook::register('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
+ Hook::register('addon_settings', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings');
+ Hook::register('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post');
- Addon::unregisterHook('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
- Addon::unregisterHook('addon_settings', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings');
- Addon::unregisterHook('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post');
+ Hook::unregister('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
+ Hook::unregister('addon_settings', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings');
+ Hook::unregister('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post');
/* Add some HTML to the existing form */
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
/* Add some HTML to the existing form */
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
- $t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
- $o .= replace_macros($t, [
+ $t = Renderer::getMarkupTemplate("settings.tpl", "addon/remote_permissions/" );
+ $o .= Renderer::replaceMacros($t, [
'$remote_perms_title' => L10n::t('Remote Permissions Settings'),
'$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
'$remote_perms_title' => L10n::t('Remote Permissions Settings'),
'$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
return;
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
return;
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
$baseurl = substr($baseurl, strpos($baseurl, '://') + 3);
if(strpos($r[0]['url'], $baseurl) === false)
return;
$baseurl = substr($baseurl, strpos($baseurl, '://') + 3);
if(strpos($r[0]['url'], $baseurl) === false)
return;
// The contact lives here. Get his/her user info
$nick = $r[0]['nick'];
$r = q("SELECT uid FROM user WHERE nickname = '%s' LIMIT 1",
// The contact lives here. Get his/her user info
$nick = $r[0]['nick'];
$r = q("SELECT uid FROM user WHERE nickname = '%s' LIMIT 1",
if($item_copy['uri'] === $item_copy['parent-uri']) {
// Lockview for a top-level post
$r = q("SELECT allow_cid, allow_gid, deny_cid, deny_gid FROM item WHERE uri = '%s' AND type = 'wall' LIMIT 1",
if($item_copy['uri'] === $item_copy['parent-uri']) {
// Lockview for a top-level post
$r = q("SELECT allow_cid, allow_gid, deny_cid, deny_gid FROM item WHERE uri = '%s' AND type = 'wall' LIMIT 1",
);
}
else {
// Lockview for a comment
$r = q("SELECT allow_cid, allow_gid, deny_cid, deny_gid FROM item WHERE uri = '%s'
AND parent = ( SELECT id FROM item WHERE uri = '%s' AND type = 'wall' ) LIMIT 1",
);
}
else {
// Lockview for a comment
$r = q("SELECT allow_cid, allow_gid, deny_cid, deny_gid FROM item WHERE uri = '%s'
AND parent = ( SELECT id FROM item WHERE uri = '%s' AND type = 'wall' ) LIMIT 1",
- dbesc($item_copy['uri']),
- dbesc($item_copy['parent-uri'])
+ DBA::escape($item_copy['uri']),
+ DBA::escape($item_copy['parent-uri'])
- $allowed_users = expand_acl($item['allow_cid']);
- $allowed_groups = expand_acl($item['allow_gid']);
- $deny_users = expand_acl($item['deny_cid']);
- $deny_groups = expand_acl($item['deny_gid']);
+ $aclFormatter = DI::aclFormatter();
+
+ $allowed_users = $aclFormatter->expand($item['allow_cid']);
+ $allowed_groups = $aclFormatter->expand($item['allow_gid']);
+ $deny_users = $aclFormatter->expand($item['deny_cid']);
+ $deny_groups = $aclFormatter->expand($item['deny_gid']);
if(count($allowed_groups)) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
if(count($allowed_groups)) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
if(count($deny_groups)) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
if(count($deny_groups)) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
- dbesc(implode(', ', array_diff($allow, $deny)))
+ DBA::escape(implode(', ', array_diff($allow, $deny)))
// will have different URIs than the original. We can match the GUID for
// those
$r = q("SELECT `uid` FROM item WHERE uri = '%s' OR guid = '%s'",
// will have different URIs than the original. We can match the GUID for
// those
$r = q("SELECT `uid` FROM item WHERE uri = '%s' OR guid = '%s'",
- dbesc($item_copy['uri']),
- dbesc($item_copy['guid'])
+ DBA::escape($item_copy['uri']),
+ DBA::escape($item_copy['guid'])
// Sort the names alphabetically, case-insensitive
natcasesort($allow_names);
echo $o . implode(', ', $allow_names);
// Sort the names alphabetically, case-insensitive
natcasesort($allow_names);
echo $o . implode(', ', $allow_names);
- $t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
- $o = replace_macros($t, [
+ $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
+ $o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
'$submit' => L10n::t('Save Settings'),
'$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
info(L10n::t('Settings updated.'). EOL);
}
Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
info(L10n::t('Settings updated.'). EOL);
}