Browse Source

ACL network - fixed preselected acl items

Peter Liebetrau 4 days ago
parent
commit
3dede5dbd2
2 changed files with 10 additions and 10 deletions
  1. 5
    5
      mod/network.php
  2. 5
    5
      src/Core/ACL.php

+ 5
- 5
mod/network.php View File

@@ -525,7 +525,7 @@ function networkThreadedView(App $a, $update, $parent)
525 525
 				}
526 526
 			} elseif (intval($a->argv[$x])) {
527 527
 				$gid = intval($a->argv[$x]);
528
-				$default_permissions = ['allow_gid' => '<' . $gid . '>'];
528
+				$default_permissions['allow_gid'] = [$gid];
529 529
 			}
530 530
 		}
531 531
 	}
@@ -540,18 +540,18 @@ function networkThreadedView(App $a, $update, $parent)
540 540
 	$nets  =        defaults($_GET, 'nets' , '');
541 541
 
542 542
 	if ($cid) {
543
-		$default_permissions = ['allow_cid' => '<' . intval($cid) . '>'];
543
+		$default_permissions['allow_cid'] = [(int) $cid];
544 544
 	}
545 545
 
546 546
 	if ($nets) {
547 547
 		$r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
548 548
 
549
-		$str = '';
549
+		$str = [];
550 550
 		while ($rr = DBA::fetch($r)) {
551
-			$str .= '<' . $rr['id'] . '>';
551
+			$str[] = (int) $rr['id'];
552 552
 		}
553 553
 		if (strlen($str)) {
554
-			$default_permissions = ['allow_cid' => $str];
554
+			$default_permissions['allow_cid'] = $str;
555 555
 		}
556 556
 	}
557 557
 

+ 5
- 5
src/Core/ACL.php View File

@@ -293,16 +293,16 @@ class ACL extends BaseObject
293 293
 						L10n::t('Hide your profile details from unknown viewers?'));
294 294
 			}
295 295
 		}
296
-
296
+		
297 297
 		$tpl = Renderer::getMarkupTemplate('acl_selector.tpl');
298 298
 		$o = Renderer::replaceMacros($tpl, [
299 299
 			'$showall' => L10n::t('Visible to everybody'),
300 300
 			'$show' => L10n::t('show'),
301 301
 			'$hide' => L10n::t('don\'t show'),
302
-			'$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', '')),
303
-			'$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', '')),
304
-			'$denycid' => json_encode(defaults($default_permissions, 'deny_cid', '')),
305
-			'$denygid' => json_encode(defaults($default_permissions, 'deny_gid', '')),
302
+			'$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', [])), // we need arrays for Javascript since we call .remove() and .push() on this values
303
+			'$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', [])),
304
+			'$denycid' => json_encode(defaults($default_permissions, 'deny_cid', [])),
305
+			'$denygid' => json_encode(defaults($default_permissions, 'deny_gid', [])),
306 306
 			'$networks' => $show_jotnets,
307 307
 			'$emailcc' => L10n::t('CC: email addresses'),
308 308
 			'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),

Loading…
Cancel
Save