mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-10-13 02:13:01 +00:00
Revert to stable version 3.5.4
This commit is contained in:
parent
38db18b624
commit
5360f08f42
355 changed files with 21449 additions and 4957 deletions
|
@ -4,11 +4,9 @@
|
|||
* 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>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function remote_permissions_install() {
|
||||
register_hook('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
|
||||
|
@ -27,7 +25,7 @@ function remote_permissions_settings(&$a,&$o) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$global = Config::get("remote_perms", "global");
|
||||
$global = get_config("remote_perms", "global");
|
||||
if($global == 1)
|
||||
return;
|
||||
|
||||
|
@ -37,18 +35,18 @@ function remote_permissions_settings(&$a,&$o) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$remote_perms = PConfig::get(local_user(),'remote_perms','show');
|
||||
|
||||
$remote_perms = get_pconfig(local_user(),'remote_perms','show');
|
||||
|
||||
/* 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, [
|
||||
$o .= replace_macros($t, array(
|
||||
'$remote_perms_title' => t('Remote Permissions Settings'),
|
||||
'$remote_perms_label' => t('Allow recipients of your private posts to see the other recipients of the posts'),
|
||||
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
|
||||
'$submit' => t('Save Settings')
|
||||
]);
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,7 +54,7 @@ function remote_permissions_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'remote-perms-submit')))
|
||||
return;
|
||||
|
||||
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
set_pconfig(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
info( t('Remote Permissions settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -65,13 +63,13 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if($item_copy['uid'] != local_user())
|
||||
return;
|
||||
|
||||
if(Config::get('remote_perms','global') == 0) {
|
||||
if(get_config('remote_perms','global') == 0) {
|
||||
// Admin has set Individual choice. We need to find
|
||||
// the original poster. First, get the contact's info
|
||||
$r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
|
||||
intval($item_copy['contact-id'])
|
||||
);
|
||||
if(! $r)
|
||||
if(! $r)
|
||||
return;
|
||||
|
||||
// Find out if the contact lives here
|
||||
|
@ -88,14 +86,14 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if(! $r)
|
||||
return;
|
||||
|
||||
if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0)
|
||||
if(get_pconfig($r[0]['uid'],'remote_perms','show') == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if(($item_copy['private'] == 1) && (! strlen($item_copy['allow_cid'])) && (! strlen($item_copy['allow_gid']))
|
||||
&& (! strlen($item_copy['deny_cid'])) && (! strlen($item_copy['deny_gid']))) {
|
||||
|
||||
$allow_names = [];
|
||||
$allow_names = array();
|
||||
|
||||
// Check for the original post here -- that's the only way
|
||||
// to definitely get all of the recipients
|
||||
|
@ -124,14 +122,14 @@ function remote_permissions_content($a, $item_copy) {
|
|||
$deny_groups = expand_acl($item['deny_gid']);
|
||||
|
||||
$o = t('Visible to:') . '<br />';
|
||||
$allow = [];
|
||||
$deny = [];
|
||||
$allow = array();
|
||||
$deny = array();
|
||||
|
||||
if(count($allowed_groups)) {
|
||||
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
|
||||
dbesc(implode(', ', $allowed_groups))
|
||||
);
|
||||
foreach($r as $rr)
|
||||
foreach($r as $rr)
|
||||
$allow[] = $rr['contact-id'];
|
||||
}
|
||||
$allow = array_unique($allow + $allowed_users);
|
||||
|
@ -140,7 +138,7 @@ function remote_permissions_content($a, $item_copy) {
|
|||
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
|
||||
dbesc(implode(', ', $deny_groups))
|
||||
);
|
||||
foreach($r as $rr)
|
||||
foreach($r as $rr)
|
||||
$deny[] = $rr['contact-id'];
|
||||
}
|
||||
$deny = $deny + $deny_users;
|
||||
|
@ -167,7 +165,7 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if(! $r)
|
||||
return;
|
||||
|
||||
$allow = [];
|
||||
$allow = array();
|
||||
foreach($r as $rr)
|
||||
$allow[] = $rr['uid'];
|
||||
|
||||
|
@ -194,16 +192,16 @@ function remote_permissions_content($a, $item_copy) {
|
|||
|
||||
function remote_permissions_plugin_admin(&$a, &$o){
|
||||
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
|
||||
$o = replace_macros($t, [
|
||||
$o = replace_macros($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
'$global' => ['remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
|
||||
'$individual' => ['remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
|
||||
]);
|
||||
'$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), get_config('remote_perms', 'global') == 1),
|
||||
'$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), get_config('remote_perms', 'global') == 0)
|
||||
));
|
||||
}
|
||||
|
||||
function remote_permissions_plugin_admin_post(&$a){
|
||||
$choice = ((x($_POST,'remotepermschoice')) ? notags(trim($_POST['remotepermschoice'])) : '');
|
||||
Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
|
||||
set_config('remote_perms','global',($choice == 1 ? 1 : 0));
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue