upgrade acl_selectors

This commit is contained in:
nobody 2022-01-26 07:51:37 +11:00
parent b6d9d661cc
commit 2c7616ade7
44 changed files with 82 additions and 447 deletions

View file

@ -30,7 +30,7 @@ class Navbar {
App::$page['htmlhead'] = EMPTY_STR;
}
App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acl' . '\');});</script>';
App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acloader' . '\');});</script>';
$is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false);

View file

@ -421,7 +421,7 @@ class Oembed
if ($stopoembed == true) {
return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "<!-- oembed $1 --><i>" . t('Embedding disabled') . " : $1</i><!-- /oembed $1 -->", $text);
}
return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", ['self','replacecb'], $text);
return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", ['\\Zotlabs\\Lib\\Oembed','replacecb'], $text);
}

View file

@ -1,347 +0,0 @@
<?php
namespace Zotlabs\Module;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\AccessList;
use Zotlabs\Web\Controller;
require_once('include/acl_selectors.php');
/**
* @brief ACL selector json backend.
*
* This module provides JSON lists of connections and local/remote channels
* (xchans) to populate various tools such as the ACL (AccessControlList) popup
* and various auto-complete functions (such as email recipients, search, and
* mention targets.
*
* There are two primary output structural formats. One for the ACL widget and
* the other for auto-completion.
*
* Many of the behaviour variations are triggered on the use of single character
* keys however this functionality has grown in an ad-hoc manner and has gotten
* quite messy over time.
*/
class Acl extends Controller
{
public function init()
{
// logger('mod_acl: ' . print_r($_REQUEST,true),LOGGER_DATA);
$start = (x($_REQUEST, 'start') ? $_REQUEST['start'] : 0);
$count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 500);
$search = (x($_REQUEST, 'search') ? $_REQUEST['search'] : '');
$type = (x($_REQUEST, 'type') ? $_REQUEST['type'] : '');
$noforums = (x($_REQUEST, 'n') ? $_REQUEST['n'] : false);
// $type =
// '' => standard ACL request
// 'g' => Groups only ACL request
// 'f' => forums only ACL request
// 'c' => Connections only ACL request or editor (textarea) mention request
// $_REQUEST['search'] contains ACL search text.
// $type =
// 'm' => autocomplete private mail recipient (checks post_mail permission)
// 'a' => autocomplete connections (mod_connections, mod_poke, mod_sources, mod_photos)
// 'x' => nav search bar autocomplete (match any xchan)
// 'z' => autocomplete any xchan, but also include abook_alias, requires non-zero local_channel()
// and also contains xid without urlencode, used specifically by activity_filter widget
// $_REQUEST['query'] contains autocomplete search text.
// The different autocomplete libraries use different names for the search text
// parameter. Internally we'll use $search to represent the search text no matter
// what request variable it was attached to.
if (array_key_exists('query', $_REQUEST)) {
$search = $_REQUEST['query'];
}
if ((!local_channel()) && (!in_array($type, ['x', 'c', 'f']))) {
killme();
}
$permitted = [];
if (in_array($type, ['m', 'a', 'f'])) {
// These queries require permission checking. We'll create a simple array of xchan_hash for those with
// the requisite permissions which we can check against.
$x = q(
"select xchan from abconfig where chan = %d and cat = 'system' and k = 'their_perms' and v like '%s'",
intval(local_channel()),
dbesc(($type === 'm') ? '%post_mail%' : '%tag_deliver%')
);
$permitted = ids_to_array($x, 'xchan');
}
if ($search) {
$sql_extra = " AND pgrp.gname LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " ";
// sql_extra2 is typically used when we don't have a local_channel - so we are not search abook_alias
$sql_extra2 = " AND ( xchan_name LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " OR xchan_addr LIKE " . protect_sprintf("'%" . dbesc(punify($search)) . ((strpos($search, '@') === false) ? "%@%'" : "%'")) . ") ";
// This horrible mess is needed because position also returns 0 if nothing is found.
// Would be MUCH easier if it instead returned a very large value
// Otherwise we could just
// order by LEAST(POSITION($search IN xchan_name),POSITION($search IN xchan_addr)).
$order_extra2 = "CASE WHEN xchan_name LIKE "
. protect_sprintf("'%" . dbesc($search) . "%'")
. " then POSITION('" . protect_sprintf(dbesc($search))
. "' IN xchan_name) else position('" . protect_sprintf(dbesc(punify($search))) . "' IN xchan_addr) end, ";
$sql_extra3 = "AND ( xchan_addr like " . protect_sprintf("'%" . dbesc(punify($search)) . "%'") . " OR xchan_name like " . protect_sprintf("'%" . dbesc($search) . "%'") . " OR abook_alias like " . protect_sprintf("'%" . dbesc($search) . "%'") . " ) ";
$sql_extra4 = "AND ( xchan_name LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " OR xchan_addr LIKE " . protect_sprintf("'%" . dbesc(punify($search)) . ((strpos($search, '@') === false) ? "%@%'" : "%'")) . " OR abook_alias LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . ") ";
} else {
$sql_extra = $sql_extra2 = $sql_extra3 = $sql_extra4 = "";
}
$groups = [];
$contacts = [];
if ($type == '' || $type == 'g') {
// Normal privacy groups
$r = q(
"SELECT pgrp.id, pgrp.hash, pgrp.gname
FROM pgrp, pgrp_member
WHERE pgrp.deleted = 0 AND pgrp.uid = %d
AND pgrp_member.gid = pgrp.id
$sql_extra
GROUP BY pgrp.id
ORDER BY pgrp.gname
LIMIT %d OFFSET %d",
intval(local_channel()),
intval($count),
intval($start)
);
if ($r) {
foreach ($r as $g) {
// logger('acl: group: ' . $g['gname'] . ' members: ' . AccessList::members_xchan(local_channel(),$g['id']));
$groups[] = [
"type" => "g",
"photo" => "images/twopeople.png",
"name" => $g['gname'],
"id" => $g['id'],
"xid" => $g['hash'],
"uids" => AccessList::members_xchan(local_channel(), $g['id']),
"link" => ''
];
}
}
}
if ($type == '' || $type == 'c' || $type === 'f') {
// Getting info from the abook is better for local users because it contains info about permissions
if (local_channel()) {
// add connections
$r = q(
"SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, xchan_type, abook_flags, abook_self
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra4 order by xchan_name asc limit $count",
intval(local_channel())
);
} else { // Visitors
$r = q(
"SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_flags, 0 as abook_self
FROM xchan left join xlink on xlink_link = xchan_hash
WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc limit $count",
dbesc(get_observer_hash())
);
}
if ((count($r) < 100) && $type == 'c') {
$r2 = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_flags, 0 as abook_self
FROM xchan WHERE xchan_deleted = 0 and xchan_network != 'unknown' $sql_extra2 order by $order_extra2 xchan_name asc limit $count");
if ($r2) {
$r = array_merge($r, $r2);
$r = unique_multidim_array($r, 'hash');
}
}
} elseif ($type == 'm') {
$r = [];
$z = q(
"SELECT xchan_hash as hash, xchan_name as name, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and xchan_deleted = 0
$sql_extra3
ORDER BY xchan_name ASC ",
intval(local_channel())
);
if ($z) {
foreach ($z as $zz) {
if (in_array($zz['hash'], $permitted)) {
$r[] = $zz;
}
}
}
} elseif ($type == 'a') {
$r = q(
"SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and xchan_deleted = 0
$sql_extra3
ORDER BY xchan_name ASC ",
intval(local_channel())
);
} elseif ($type == 'z') {
$r = q(
"SELECT xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag FROM xchan left join abook on xchan_hash = abook_xchan
WHERE ( abook_channel = %d OR abook_channel IS NULL )
and xchan_deleted = 0
$sql_extra3
ORDER BY xchan_name ASC ",
intval(local_channel())
);
} elseif ($type == 'x') {
$contacts = [];
$r = $this->navbar_complete();
if ($r) {
foreach ($r as $g) {
$contacts[] = [
"photo" => $g['photo'],
"name" => $g['name'],
"nick" => $g['address'],
'link' => (($g['address']) ? $g['address'] : $g['url']),
'xchan' => $g['hash']
];
}
}
$o = [
'start' => $start,
'count' => $count,
'items' => $contacts,
];
json_return_and_die($o);
} else {
$r = [];
}
if ($r) {
foreach ($r as $g) {
if (isset($g['network']) && in_array($g['network'], ['rss', 'anon', 'unknown']) && ($type != 'a')) {
continue;
}
// 'z' (activity_filter autocomplete) requires an un-encoded hash to prevent double encoding
if ($type !== 'z') {
$g['hash'] = urlencode($g['hash']);
}
if (!$g['nick']) {
$g['nick'] = $g['url'];
}
if (in_array($g['hash'], $permitted) && $type === 'f' && (!$noforums)) {
$contacts[] = [
"type" => "c",
"photo" => "images/twopeople.png",
"name" => $g['name'],
"id" => urlencode($g['id']),
"xid" => $g['hash'],
"link" => (($g['nick']) ? $g['nick'] : $g['url']),
"nick" => substr($g['nick'], 0, strpos($g['nick'], '@')),
"self" => (intval($g['abook_self']) ? 'abook-self' : ''),
"taggable" => 'taggable',
"label" => t('network')
];
}
if ($type !== 'f') {
$contacts[] = [
"type" => "c",
"photo" => $g['micro'],
"name" => $g['name'],
"id" => urlencode($g['id']),
"xid" => $g['hash'],
"link" => (($g['nick']) ? $g['nick'] : $g['url']),
"nick" => ((strpos($g['nick'], '@')) ? substr($g['nick'], 0, strpos($g['nick'], '@')) : $g['nick']),
"self" => (intval($g['abook_self']) ? 'abook-self' : ''),
"taggable" => '',
"label" => '',
];
}
}
}
$items = array_merge($groups, $contacts);
$o = [
'start' => $start,
'count' => $count,
'items' => $items,
];
json_return_and_die($o);
}
public function navbar_complete()
{
// logger('navbar_complete');
if (observer_prohibited()) {
return;
}
$dirmode = intval(get_config('system', 'directory_mode'));
$search = ((x($_REQUEST, 'search')) ? htmlentities($_REQUEST['search'], ENT_COMPAT, 'UTF-8', false) : '');
if (!$search || mb_strlen($search) < 2) {
return [];
}
$star = false;
$address = false;
if (substr($search, 0, 1) === '@') {
$search = substr($search, 1);
}
if (substr($search, 0, 1) === '*') {
$star = true;
$search = substr($search, 1);
}
if (strpos($search, '@') !== false) {
$address = true;
}
$url = z_root() . '/dirsearch';
$results = [];
$count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 100);
if ($url) {
$query = $url . '?f=';
$query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode(punify($search)) : '');
$x = z_fetch_url($query);
if ($x['success']) {
$t = 0;
$j = json_decode($x['body'], true);
if ($j && $j['results']) {
$results = $j['results'];
}
}
}
return $results;
}
}

View file

@ -7,10 +7,7 @@ use Zotlabs\Lib\Libprofile;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Blocks extends Controller
{

View file

@ -7,8 +7,8 @@ use Zotlabs\Lib\Apps;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Libacl;
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
class Card_edit extends Controller
@ -113,7 +113,7 @@ class Card_edit extends Controller
'hide_location' => false,
'hide_expire' => false,
'showacl' => true,
'acl' => populate_acl($itm[0], false, PermissionDescription::fromGlobalPermission('view_pages')),
'acl' => Libacl::populate($itm[0], false, PermissionDescription::fromGlobalPermission('view_pages')),
'permissions' => $itm[0],
'lockstate' => (($itm[0]['allow_cid'] || $itm[0]['allow_gid'] || $itm[0]['deny_cid'] || $itm[0]['deny_gid']) ? 'lock' : 'unlock'),
'ptyp' => $itm[0]['type'],

View file

@ -9,9 +9,9 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Cards extends Controller
{
@ -113,7 +113,7 @@ class Cards extends Controller
'nickname' => $channel['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl(
'acl' => (($is_owner) ? Libacl::populate(
$channel_acl,
false,
PermissionDescription::fromGlobalPermission('view_pages')

View file

@ -31,6 +31,7 @@ use Zotlabs\Storage\BasicAuth;
use Zotlabs\Lib\System;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/event.php');
require_once('include/auth.php');
@ -1021,12 +1022,11 @@ class Cdav extends Controller
$catsenabled = Apps::system_app_installed(local_channel(), 'Categories');
require_once('include/acl_selectors.php');
$accesslist = new AccessControl($channel);
$perm_defaults = $accesslist->get();
$acl = populate_acl($perm_defaults, false, PermissionDescription::fromGlobalPermission('view_stream'));
$acl = Libacl::populate($perm_defaults, false, PermissionDescription::fromGlobalPermission('view_stream'));
$permissions = $perm_defaults;

View file

@ -16,11 +16,11 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Widget\Pinned;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/items.php');
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
/**
@ -276,7 +276,7 @@ class Channel extends Controller
'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
'nickname' => App::$profile['channel_address'],
'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
'acl' => (($is_owner) ? Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
'permissions' => $channel_acl,
'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '',

View file

@ -12,6 +12,7 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Access\AccessControl;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
class Chat extends Controller
{
@ -230,7 +231,6 @@ class Chat extends Controller
$channel_acl = $acl->get();
$lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
require_once('include/acl_selectors.php');
$chatroom_new = '';
if (local_channel()) {
@ -239,7 +239,7 @@ class Chat extends Controller
'$name' => array('room_name', t('Chatroom name'), '', ''),
'$chat_expire' => array('chat_expire', t('Expiration of chats (minutes)'), 120, ''),
'$permissions' => t('Permissions'),
'$acl' => populate_acl($channel_acl, false),
'$acl' => Libacl::populate($channel_acl, false),
'$allow_cid' => acl2json($channel_acl['allow_cid']),
'$allow_gid' => acl2json($channel_acl['allow_gid']),
'$deny_cid' => acl2json($channel_acl['deny_cid']),

View file

@ -8,11 +8,11 @@ use Zotlabs\Lib\System;
use Zotlabs\Lib\PConfig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Libacl;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Display extends Controller
@ -85,7 +85,7 @@ class Display extends Controller
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,

View file

@ -9,7 +9,6 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
class Editblock extends Controller

View file

@ -7,8 +7,6 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
class Editlayout extends Controller

View file

@ -7,8 +7,8 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Libacl;
require_once('include/acl_selectors.php');
require_once('include/taxonomy.php');
require_once('include/conversation.php');
@ -130,7 +130,7 @@ class Editpost extends Controller
'category' => $category,
'showacl' => ((intval($item['item_unpublished'])) ? true : false),
'lockstate' => (($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($item, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($item, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'bang' => EMPTY_STR,
'permissions' => $item,
'profile_uid' => $owner_uid,

View file

@ -8,9 +8,9 @@ use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Libacl;
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
@ -163,7 +163,7 @@ class Editwebpage extends Controller
'body' => undo_post_tagging($content),
'post_id' => $post_id,
'visitor' => ($is_owner) ? true : false,
'acl' => populate_acl($itm[0], false, PermissionDescription::fromGlobalPermission('view_pages')),
'acl' => Libacl::populate($itm[0], false, PermissionDescription::fromGlobalPermission('view_pages')),
'permissions' => $itm[0],
'showacl' => ($is_owner) ? true : false,
'mimetype' => $mimetype,

View file

@ -11,6 +11,7 @@ use Zotlabs\Lib\Apps;
use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/conversation.php');
require_once('include/bbcode.php');
@ -482,8 +483,6 @@ class Events extends Controller
}
}
require_once('include/acl_selectors.php');
$acl = new AccessControl($channel);
$perm_defaults = $acl->get();
@ -528,7 +527,7 @@ class Events extends Controller
'$perms_label' => t('Permission settings'),
// populating the acl dialog was a permission description from view_stream because Cal.php, which
// displays events, says "since we don't currently have an event permission - use the stream permission"
'$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults), false, PermissionDescription::fromGlobalPermission('view_stream'))),
'$acl' => (($orig_event['event_xchan']) ? '' : Libacl::populate(((x($orig_event)) ? $orig_event : $perm_defaults), false, PermissionDescription::fromGlobalPermission('view_stream'))),
'$allow_cid' => acl2json($permissions['allow_cid']),
'$allow_gid' => acl2json($permissions['allow_gid']),

View file

@ -13,6 +13,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libsync;
use Zotlabs\Access\AccessControl;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Libacl;
class Filestorage extends Controller
{
@ -192,7 +193,6 @@ class Filestorage extends Controller
if (argc() > 3 && argv(3) === 'edit') {
require_once('include/acl_selectors.php');
if (!$perms['write_storage']) {
notice(t('Permission denied.') . EOL);
return;
@ -212,7 +212,7 @@ class Filestorage extends Controller
$cloudpath = get_cloudpath($f);
$aclselect_e = populate_acl($f, false, PermissionDescription::fromGlobalPermission('view_storage'));
$aclselect_e = Libacl::populate($f, false, PermissionDescription::fromGlobalPermission('view_storage'));
$is_a_dir = (intval($f['is_dir']) ? true : false);
$lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock');

View file

@ -7,11 +7,11 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Hq extends Controller
@ -141,7 +141,7 @@ class Hq extends Controller
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,

View file

@ -9,7 +9,6 @@ use Zotlabs\Lib\Channel;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Layouts extends Controller
{

View file

@ -260,7 +260,6 @@ class Lists extends Controller
}
if (argc() > 1) {
require_once('include/acl_selectors.php');
if (strlen(argv(1)) <= 11 && intval(argv(1))) {
$r = q(

View file

@ -7,9 +7,9 @@ use Zotlabs\Access\AccessControl;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Libacl;
require_once('include/menu.php');
require_once('include/acl_selectors.php');
class Mitem extends Controller
@ -179,7 +179,7 @@ class Mitem extends Controller
'$menu_id' => App::$data['menu']['menu_id'],
'$permissions' => t('Menu Item Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),
'$aclselect' => populate_acl($acl->get(), false),
'$aclselect' => Libacl::populate($acl->get(), false),
'$allow_cid' => acl2json($acl->get()['allow_cid']),
'$allow_gid' => acl2json($acl->get()['allow_gid']),
'$deny_cid' => acl2json($acl->get()['deny_cid']),
@ -258,7 +258,7 @@ class Mitem extends Controller
'$menu_id' => App::$data['menu']['menu_id'],
'$permissions' => t('Menu Item Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),
'$aclselect' => populate_acl($mitem, false),
'$aclselect' => Libacl::populate($mitem, false),
'$allow_cid' => acl2json($mitem['allow_cid']),
'$allow_gid' => acl2json($mitem['allow_gid']),
'$deny_cid' => acl2json($mitem['deny_cid']),

View file

@ -13,10 +13,10 @@ use Zotlabs\Web\Controller;
use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/photo_factory.php');
require_once('include/photos.php');
require_once('include/acl_selectors.php');
require_once('include/bbcode.php');
require_once('include/security.php');
require_once('include/attach.php');
@ -694,7 +694,7 @@ class Photos extends Controller
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
}
$aclselect = (($_is_owner) ? populate_acl($channel_acl, false, PermissionDescription::fromGlobalPermission('view_storage')) : '');
$aclselect = (($_is_owner) ? Libacl::populate($channel_acl, false, PermissionDescription::fromGlobalPermission('view_storage')) : '');
// this is wrong but is to work around an issue with js_upload wherein it chokes if these variables
// don't exist. They really should be set to a parseable representation of the channel's default permissions
@ -1097,7 +1097,7 @@ class Photos extends Controller
if ($can_post) {
$album_e = $ph[0]['album'];
$caption_e = $ph[0]['description'];
$aclselect_e = (($_is_owner) ? populate_acl($ph[0], true, PermissionDescription::fromGlobalPermission('view_storage')) : '');
$aclselect_e = (($_is_owner) ? Libacl::populate($ph[0], true, PermissionDescription::fromGlobalPermission('view_storage')) : '');
$albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'], App::$data['observer']));
$_SESSION['album_return'] = bin2hex($ph[0]['album']);

View file

@ -15,8 +15,6 @@ use Zotlabs\Lib\Navbar;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Profile extends Controller
{

View file

@ -8,9 +8,9 @@ use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Pubstream extends Controller
@ -74,7 +74,7 @@ class Pubstream extends Controller
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,

View file

@ -8,8 +8,8 @@ use Zotlabs\Access\AccessControl;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/acl_selectors.php');
require_once('include/items.php');
require_once('include/taxonomy.php');
require_once('include/conversation.php');
@ -225,7 +225,7 @@ class Rpost extends Controller
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,

View file

@ -14,6 +14,7 @@ use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Permcat;
use Zotlabs\Lib\Libacl;
class Channel
{
@ -408,7 +409,6 @@ class Channel
public function get()
{
require_once('include/acl_selectors.php');
require_once('include/permissions.php');
@ -658,7 +658,7 @@ class Channel
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']), t('May reduce spam activity')),
'$permissions' => t('Default Access List'),
'$permdesc' => t("(click to open/close)"),
'$aclselect' => populate_acl($perm_defaults, false, PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
'$aclselect' => Libacl::populate($perm_defaults, false, PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
'$profseltxt' => t('Profile to assign new connections'),
'$profselect' => ((feature_enabled(local_channel(), 'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(), 'system', 'profile_assign', '')) : ''),

View file

@ -10,10 +10,9 @@ use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Stream extends Controller
{
@ -235,7 +234,7 @@ class Stream extends Controller
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => Libacl::populate($channel_acl, true, PermissionDescription::fromGlobalPermission('view_stream'), Libacl::get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => EMPTY_STR,
'body' => $body,

View file

@ -7,6 +7,7 @@ use Zotlabs\Access\AccessControl;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libacl;
/**
* @file Zotlabs/Module/Thing.php
@ -14,8 +15,6 @@ use Zotlabs\Lib\Libsync;
require_once('include/security.php');
require_once('include/acl_selectors.php');
class Thing extends Controller
{
@ -353,7 +352,7 @@ class Thing extends Controller
'$img_lbl' => t('URL for photo of thing (optional)'),
'$imgurl' => $r[0]['obj_imgurl'],
'$permissions' => t('Permissions'),
'$aclselect' => populate_acl($channel_acl, false),
'$aclselect' => Libacl::populate($channel_acl, false),
'$allow_cid' => acl2json($channel_acl['allow_cid']),
'$allow_gid' => acl2json($channel_acl['allow_gid']),
'$deny_cid' => acl2json($channel_acl['deny_cid']),
@ -408,7 +407,7 @@ class Thing extends Controller
'$url_lbl' => t('URL of thing (optional)'),
'$img_lbl' => t('URL for photo of thing (optional)'),
'$permissions' => t('Permissions'),
'$aclselect' => populate_acl($channel_acl, false),
'$aclselect' => Libacl::populate($channel_acl, false),
'$allow_cid' => acl2json($channel_acl['allow_cid']),
'$allow_gid' => acl2json($channel_acl['allow_gid']),
'$deny_cid' => acl2json($channel_acl['deny_cid']),

View file

@ -10,10 +10,11 @@ use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\ExtendedZip;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
use ZipArchive;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Webpages extends Controller
{
@ -173,7 +174,7 @@ class Webpages extends Controller
'is_owner' => true,
'nickname' => App::$profile['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl, false, PermissionDescription::fromGlobalPermission('view_pages')) : ''),
'acl' => (($is_owner) ? Libacl::populate($channel_acl, false, PermissionDescription::fromGlobalPermission('view_pages')) : ''),
'permissions' => $channel_acl,
'showacl' => (($is_owner) ? true : false),
'visitor' => true,

View file

@ -11,13 +11,9 @@ use Zotlabs\Render\Theme;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Navbar;
use Zotlabs\Lib\Libacl;
use function Sabre\HTTP\encodePath;
//require_once('include/conversation.php');
//require_once('include/text.php');
require_once('include/acl_selectors.php');
/**
* @brief Provides a DAV frontend for the webbrowser.
@ -376,7 +372,7 @@ class Browser extends DAV\Browser\Plugin {
$channel_acl = $acl->get();
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
$aclselect = ((local_channel() == $this->auth->owner_id) ? populate_acl($channel_acl,false,PermissionDescription::fromGlobalPermission('view_storage')) : '');
$aclselect = ((local_channel() == $this->auth->owner_id) ? Libacl::populate($channel_acl,false,PermissionDescription::fromGlobalPermission('view_storage')) : '');
}
// Storage and quota for the account (all channels of the owner of this directory)!

View file

@ -890,7 +890,7 @@ function updateConvItems(mode,data) {
});
/* autocomplete @nicknames */
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
/* autocomplete bbcode */
$(".comment-edit-form textarea").bbco_autocomplete('bbcode');

View file

@ -2,7 +2,7 @@ $(document).ready( function() {
$(".autotime").timeago();
/* autocomplete @nicknames */
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
/* autocomplete bbcode */
$(".comment-edit-form textarea").bbco_autocomplete('bbcode');

View file

@ -2,7 +2,7 @@ $(document).ready( function() {
$(".autotime").timeago();
/* autocomplete @nicknames */
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
/* autocomplete bbcode */
$(".comment-edit-form textarea").bbco_autocomplete('bbcode');

View file

@ -1,5 +1,4 @@
$(document).ready(function() {
// $('form').areYouSure(); // Warn user about unsaved settings
$('textarea').editor_autocomplete(baseurl + "/acl");
$('textarea').editor_autocomplete(baseurl + "/acloader");
$('textarea').bbco_autocomplete('bbcode');
});

View file

@ -1,6 +1,6 @@
$(document).ready(function() {
$("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
$("#follow_input").discover_autocomplete(baseurl + '/acl', 'x', true);
$("#contacts-search").contact_autocomplete(baseurl + '/acloader', 'a', true);
$("#follow_input").discover_autocomplete(baseurl + '/acloader', 'x', true);
$(".autotime").timeago();
});

View file

@ -1,5 +1,4 @@
$(document).ready(function() {
$(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
// make auto-complete work in more places
$(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
$(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
});

View file

@ -1,7 +1,7 @@
$(document).ready(function() {
$("#recip").name_autocomplete(baseurl + '/acl', 'm', false, function(data) {
$("#recip").name_autocomplete(baseurl + '/acloader', 'm', false, function(data) {
$("#recip-complete").val(data.xid);
});
$('#prvmail-text').bbco_autocomplete('bbcode');
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
$("#prvmail-text").editor_autocomplete(baseurl+"/acloader");
});

View file

@ -8,12 +8,12 @@ $(document).ready(function() {
UploadInit();
}
$("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#photo-edit-newtag").contact_autocomplete(baseurl + '/acloader', 'a', false, function(data) {
$("#photo-edit-newtag").val('@' + data.name);
});
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$('textarea').editor_autocomplete(baseurl+"/acl");
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
$('textarea').editor_autocomplete(baseurl+"/acloader");
$('textarea').bbco_autocomplete('bbcode');
showHideBodyTextarea();

View file

@ -1,5 +1,5 @@
$(document).ready(function() {
$("#poke-recip").name_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#poke-recip").name_autocomplete(baseurl + '/acloader', 'a', false, function(data) {
$("#poke-recip-complete").val(data.id);
});
});

View file

@ -1,5 +1,5 @@
$(document).ready(function() {
$(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
// make auto-complete work in more places
$(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
$(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acloader?f=&n=1");
});

View file

@ -1,6 +1,6 @@
$(document).ready(function() {
$(document).ready(function() {
$("#id_name").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#id_name").contact_autocomplete(baseurl + '/acloader', 'a', false, function(data) {
$("#id_abook").val(data.id);
});
});

View file

@ -1,4 +1,4 @@
$(document).ready(function() {
$("#follow_input").discover_autocomplete(baseurl + '/acl', 'x', true);
$("#follow_input").discover_autocomplete(baseurl + '/acloader', 'x', true);
});

View file

@ -26,7 +26,7 @@
</form>
</div>
<script>
$("#xchan-filter").name_autocomplete(baseurl + '/acl', 'z', true, function(data) {
$("#xchan-filter").name_autocomplete(baseurl + '/acloader', 'z', true, function(data) {
$("#xchan").val(data.xid);
});
</script>

View file

@ -21,12 +21,12 @@ function initEditor(cb){
{{/if}}
{{if $editor_autocomplete}}
if(typeof channelId === 'undefined') {
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acl");
$("#profile-jot-text").editor_autocomplete(baseurl+"/acloader");
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acloader");
}
else {
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl",[channelId]); // Also gives suggestions from current channel's connections
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acl",[channelId]); // Also gives suggestions from current channel's connections
$("#profile-jot-text").editor_autocomplete(baseurl+"/acloader",[channelId]); // Also gives suggestions from current channel's connections
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acloader",[channelId]); // Also gives suggestions from current channel's connections
}
{{/if}}
editor = true;
@ -66,7 +66,7 @@ var activeCommentText = '';
$('#id_mimetype').on('change', jotSetMime);
{{if $webpage === 8}}
$("#jot-pagetitle").name_autocomplete(baseurl + '/acl', 'm', false, function(data) {
$("#jot-pagetitle").name_autocomplete(baseurl + '/acloader', 'm', false, function(data) {
$("#recip-complete").val(data.xid);
});
{{/if}}

View file

@ -4,7 +4,7 @@
<script>
$(document).ready(function() {
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
$("#prvmail-text").editor_autocomplete(baseurl+"/acloader");
$('#invisible-wall-file-upload').fileupload({
url: 'wall_attach/{{$nickname}}',