aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2015-09-01 07:21:17 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2015-09-01 07:21:17 +0200
commit4fe3b5c6a62987189f4d29fba78c71f7df42791c (patch)
tree89f53893011a8d623d685067cbc52449e25926da /mod
parent1b82fb7349a7a4048755d92e757efc5dc227b227 (diff)
parent417da13353431ddadafe661803115cf9dd9bf9ca (diff)
downloadvolse-hubzilla-4fe3b5c6a62987189f4d29fba78c71f7df42791c.tar.gz
volse-hubzilla-4fe3b5c6a62987189f4d29fba78c71f7df42791c.tar.bz2
volse-hubzilla-4fe3b5c6a62987189f4d29fba78c71f7df42791c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/chat.php24
-rwxr-xr-xmod/events.php52
-rw-r--r--mod/filestorage.php14
-rw-r--r--mod/help.php56
-rw-r--r--mod/import.php22
-rw-r--r--mod/item.php91
-rwxr-xr-xmod/like.php7
-rw-r--r--mod/mitem.php9
-rw-r--r--mod/photos.php53
-rw-r--r--mod/settings.php31
-rw-r--r--mod/siteinfo.php1
11 files changed, 137 insertions, 223 deletions
diff --git a/mod/chat.php b/mod/chat.php
index c54d29313..c2c11d0ab 100644
--- a/mod/chat.php
+++ b/mod/chat.php
@@ -54,12 +54,11 @@ function chat_post(&$a) {
goaway(z_root() . '/chat/' . $channel['channel_address']);
}
+ $acl = new AccessList($channel);
+ $acl->set_from_array($_REQUEST);
- $arr = array('name' => $room);
- $arr['allow_gid'] = perms2str($_REQUEST['group_allow']);
- $arr['allow_cid'] = perms2str($_REQUEST['contact_allow']);
- $arr['deny_gid'] = perms2str($_REQUEST['group_deny']);
- $arr['deny_cid'] = perms2str($_REQUEST['contact_deny']);
+ $arr = $acl->get();
+ $arr['name'] = $room;
chatroom_create($channel,$arr);
@@ -158,7 +157,10 @@ function chat_content(&$a) {
intval($a->profile['profile_uid'])
);
if($x) {
- $private = ((($x[0]['allow_cid']) || ($x[0]['allow_gid']) || ($x[0]['deny_cid']) || ($x[0]['deny_gid'])) ? true : false);
+ $acl = new AccessList(false);
+ $acl->set($x[0]);
+
+ $private = $acl->is_private();
$room_name = $x[0]['cr_name'];
if($bookmark_link)
$bookmark_link .= '&url=' . z_root() . '/chat/' . argv(1) . '/' . argv(2) . '&title=' . urlencode($x[0]['cr_name']) . (($private) ? '&private=1' : '') . '&ischat=1';
@@ -192,14 +194,8 @@ function chat_content(&$a) {
if(local_channel() && argc() > 2 && argv(2) === 'new') {
-
-
- $channel_acl = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
+ $channel_acl = $acl->get();
require_once('include/acl_selectors.php');
diff --git a/mod/events.php b/mod/events.php
index edb61a6cd..9120f8713 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -41,16 +41,11 @@ function events_post(&$a) {
$categories = escape_tags(trim($_POST['category']));
-
-
// only allow editing your own events.
if(($xchan) && ($xchan !== get_observer_hash()))
return;
- // The default setting for the `private` field in event_store() is false, so mirror that
- $private_event = false;
-
if($start_text) {
$start = $start_text;
}
@@ -119,6 +114,8 @@ function events_post(&$a) {
$channel = $a->get_channel();
+ $acl = new AccessList(false);
+
if($event_id) {
$x = q("select * from event where id = %d and uid = %d limit 1",
intval($event_id),
@@ -133,6 +130,8 @@ function events_post(&$a) {
return;
}
+ $acl->set($x[0]);
+
$created = $x[0]['created'];
$edited = datetime_convert();
@@ -142,39 +141,21 @@ function events_post(&$a) {
}
else {
$share = true;
- $str_group_allow = $x[0]['allow_gid'];
- $str_contact_allow = $x[0]['allow_cid'];
- $str_group_deny = $x[0]['deny_gid'];
- $str_contact_deny = $x[0]['deny_cid'];
-
- if(strlen($str_group_allow) || strlen($str_contact_allow)
- || strlen($str_group_deny) || strlen($str_contact_deny)) {
- $private_event = true;
- }
}
}
else {
$created = $edited = datetime_convert();
if($share) {
- $str_group_allow = perms2str($_POST['group_allow']);
- $str_contact_allow = perms2str($_POST['contact_allow']);
- $str_group_deny = perms2str($_POST['group_deny']);
- $str_contact_deny = perms2str($_POST['contact_deny']);
-
- if(strlen($str_group_allow) || strlen($str_contact_allow)
- || strlen($str_group_deny) || strlen($str_contact_deny)) {
- $private_event = true;
- }
+ $acl->set_from_array($_POST);
}
else {
- $str_contact_allow = '<' . $channel['channel_hash'] . '>';
- $str_group_allow = $str_contact_deny = $str_group_deny = '';
- $private_event = true;
+ $acl->set(array('allow_cid' => '<' . $channel['channel_hash'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''));
}
}
$post_tags = array();
$channel = $a->get_channel();
+ $ac = $acl->get();
if(strlen($categories)) {
$cats = explode(',',$categories);
@@ -201,11 +182,11 @@ function events_post(&$a) {
$datarray['uid'] = local_channel();
$datarray['account'] = get_account_id();
$datarray['event_xchan'] = $channel['channel_hash'];
- $datarray['allow_cid'] = $str_contact_allow;
- $datarray['allow_gid'] = $str_group_allow;
- $datarray['deny_cid'] = $str_contact_deny;
- $datarray['deny_gid'] = $str_group_deny;
- $datarray['private'] = (($private_event) ? 1 : 0);
+ $datarray['allow_cid'] = $ac['allow_cid'];
+ $datarray['allow_gid'] = $ac['allow_gid'];
+ $datarray['deny_cid'] = $ac['deny_cid'];
+ $datarray['deny_gid'] = $ac['deny_gid'];
+ $datarray['private'] = (($acl->is_private()) ? 1 : 0);
$datarray['id'] = $event_id;
$datarray['created'] = $created;
$datarray['edited'] = $edited;
@@ -660,12 +641,9 @@ function events_content(&$a) {
require_once('include/acl_selectors.php');
- $perm_defaults = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
+ $perm_defaults = $acl->get();
+
$tpl = get_markup_template('event_form.tpl');
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 9787c0380..7ba8c1801 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -28,20 +28,20 @@ function filestorage_post(&$a) {
return;
}
- $str_group_allow = perms2str($_REQUEST['group_allow']);
- $str_contact_allow = perms2str($_REQUEST['contact_allow']);
- $str_group_deny = perms2str($_REQUEST['group_deny']);
- $str_contact_deny = perms2str($_REQUEST['contact_deny']);
-
$channel = $a->get_channel();
+
+ $acl = new AccessList($channel);
+ $acl->set_from_array($_REQUEST);
+ $x = $acl->get();
+
$cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource);
//get the object before permissions change so we can catch eventual former allowed members
$object = get_file_activity_object($channel_id, $resource, $cloudPath);
- attach_change_permissions($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, $recurse);
+ attach_change_permissions($channel_id, $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse);
- file_activity($channel_id, $object, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, 'post', $notify);
+ file_activity($channel_id, $object, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], 'post', $notify);
goaway($cloudPath);
}
diff --git a/mod/help.php b/mod/help.php
index 809313a3e..16ec069a7 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -12,9 +12,6 @@
-
-
-
function load_doc_file($s) {
$lang = get_app()->language;
if(! isset($lang))
@@ -32,21 +29,6 @@ function load_doc_file($s) {
}
function find_doc_file($s) {
-
- // If the file was edited more recently than we've stored a copy in the database, use the file.
- // The stored database item will be searchable, the file won't be.
-
- $r = q("select item.* from item left join item_id on item.id = item_id.iid where service = 'docfile' and
- sid = '%s' and item_type = %d limit 1",
- dbesc($s),
- intval(ITEM_TYPE_DOC)
- );
-
- if($r) {
- if(file_exists($s) && (filemtime($s) > datetime_convert('UTC','UTC',$r[0]['edited'],'U')))
- return file_get_contents($s);
- return($r[0]['body']);
- }
if(file_exists($s))
return file_get_contents($s);
return '';
@@ -56,12 +38,9 @@ function search_doc_files($s) {
$a = get_app();
- $itemspage = get_pconfig(local_channel(),'system','itemspage');
- $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
-
- // If the file was edited more recently than we've stored a copy in the database, use the file.
- // The stored database item will be searchable, the file won't be.
+ $itemspage = get_pconfig(local_channel(),'system','itemspage');
+ $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
$regexop = db_getfunc('REGEXP');
@@ -72,11 +51,10 @@ function search_doc_files($s) {
);
$r = fetch_post_tags($r,true);
- require_once('include/html2plain.php');
for($x = 0; $x < count($r); $x ++) {
- $r[$x]['text'] = html2plain(prepare_text($r[$x]['body'],$r[$x]['mimetype'], true));
+ $r[$x]['text'] = $r[$x]['body'];
$r[$x]['rank'] = 0;
if($r[$x]['term']) {
@@ -89,16 +67,20 @@ function search_doc_files($s) {
if(stristr($r[$x]['sid'],$s))
$r[$x]['rank'] ++;
$r[$x]['rank'] += substr_count(strtolower($r[$x]['text']),strtolower($s));
+ // bias the results to the observer's native language
+ if($r[$x]['lang'] === $a->language)
+ $r[$x]['rank'] = $r[$x]['rank'] + 10;
+
}
usort($r,'doc_rank_sort');
return $r;
}
-function doc_rank_sort($a,$b) {
- if($a['rank'] == $b['rank'])
+function doc_rank_sort($s1,$s2) {
+ if($s1['rank'] == $s2['rank'])
return 0;
- return (($a['rank'] < $b['rank']) ? 1 : (-1));
+ return (($s1['rank'] < $s2['rank']) ? 1 : (-1));
}
@@ -118,14 +100,17 @@ function store_doc_file($s) {
if(strpos($s,'.md'))
- $item['mimetype'] = 'text/markdown';
+ $mimetype = 'text/markdown';
elseif(strpos($s,'.html'))
- $item['mimetype'] = 'text/html';
+ $mimetype = 'text/html';
else
- $item['mimetype'] = 'text/bbcode';
+ $mimetype = 'text/bbcode';
+ require_once('include/html2plain.php');
+
+ $item['body'] = html2plain(prepare_text(file_get_contents($s),$mimetype, true));
+ $item['mimetype'] = 'text/plain';
- $item['body'] = file_get_contents($s);
$item['plink'] = z_root() . '/' . str_replace('doc','help',$s);
$item['owner_xchan'] = $item['author_xchan'] = $sys['channel_hash'];
$item['item_type'] = ITEM_TYPE_DOC;
@@ -158,9 +143,12 @@ function help_content(&$a) {
nav_set_selected('help');
if($_REQUEST['search']) {
+
+ $o .= '<h2>' . t('Documentation Search') . ' - ' . htmlspecialchars($_REQUEST['search']) . '</h2>';
+
$r = search_doc_files($_REQUEST['search']);
if($r) {
- $o .= '<ul>';
+ $o .= '<ul class="help-searchlist">';
foreach($r as $rr) {
$dirname = dirname($rr['sid']);
$fname = basename($rr['sid']);
diff --git a/mod/import.php b/mod/import.php
index bf1f0ca2e..0c5ec2a4c 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -447,7 +447,7 @@ function import_post(&$a) {
-// FIXME - ensure we have an xchan if somebody is trying to pull a fast one
+ // FIXME - ensure we have an xchan if somebody is trying to pull a fast one
if($completed < 8) {
$friends = 0;
@@ -556,6 +556,24 @@ function import_post(&$a) {
ref_session_write(session_id(), serialize($_SESSION));
}
+
+// This needs more work - we also need the term where otype = 6 to link with this, and the terms need to be relocated.
+// $objs = $data['obj'];
+// if($objs) {
+// foreach($objs as $obj) {
+// unset($obj['obj_id']);
+// $obj['channel'] = $channel['channel_id'];
+
+// dbesc_array($obj);
+// $r = dbq("INSERT INTO obj (`"
+// . implode("`, `", array_keys($obj))
+// . "`) VALUES ('"
+// . implode("', '", array_values($obj))
+// . "')" );
+// }
+// }
+
+
$saved_notification_flags = notifications_off($channel['channel_id']);
if($import_posts && array_key_exists('item',$data) && $data['item']) {
@@ -614,7 +632,7 @@ function import_post(&$a) {
-// FIXME - ensure we have a self entry if somebody is trying to pull a fast one
+ // FIXME - ensure we have a self entry if somebody is trying to pull a fast one
// send out refresh requests
// notify old server that it may no longer be primary.
diff --git a/mod/item.php b/mod/item.php
index ff6a834e6..ec5d1b3a1 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -305,6 +305,8 @@ function item_post(&$a) {
}
}
+ $acl = new AccessList($channel);
+
$public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true));
if($webpage)
@@ -316,28 +318,17 @@ function item_post(&$a) {
$private = 0;
// webpages are allowed to change ACLs after the fact. Normal conversation items aren't.
if($webpage) {
- $str_group_allow = perms2str($_REQUEST['group_allow']);
- $str_contact_allow = perms2str($_REQUEST['contact_allow']);
- $str_group_deny = perms2str($_REQUEST['group_deny']);
- $str_contact_deny = perms2str($_REQUEST['contact_deny']);
+ $acl->set_from_arry($_REQUEST);
}
else {
- $str_group_allow = $orig_post['allow_gid'];
- $str_contact_allow = $orig_post['allow_cid'];
- $str_group_deny = $orig_post['deny_gid'];
- $str_contact_deny = $orig_post['deny_cid'];
+ $acl->set($orig_post);
$public_policy = $orig_post['public_policy'];
$private = $orig_post['item_private'];
}
- if((strlen($str_group_allow))
- || strlen($str_contact_allow)
- || strlen($str_group_deny)
- || strlen($str_contact_deny)
- || strlen($public_policy)
- || $private) {
+ if($private || $public_policy || $acl->is_private())
$private = 1;
- }
+
$location = $orig_post['location'];
$coord = $orig_post['coord'];
@@ -381,38 +372,12 @@ function item_post(&$a) {
}
else {
-
- // if coming from the API and no privacy settings are set,
- // use the user default permissions - as they won't have
- // been supplied via a form.
-
- if(($api_source)
- && (! array_key_exists('contact_allow',$_REQUEST))
- && (! array_key_exists('group_allow',$_REQUEST))
- && (! array_key_exists('contact_deny',$_REQUEST))
- && (! array_key_exists('group_deny',$_REQUEST))) {
- $str_group_allow = $channel['channel_allow_gid'];
- $str_contact_allow = $channel['channel_allow_cid'];
- $str_group_deny = $channel['channel_deny_gid'];
- $str_contact_deny = $channel['channel_deny_cid'];
- }
- elseif($walltowall) {
-
- // use the channel owner's default permissions
-
- $str_group_allow = $channel['channel_allow_gid'];
- $str_contact_allow = $channel['channel_allow_cid'];
- $str_group_deny = $channel['channel_deny_gid'];
- $str_contact_deny = $channel['channel_deny_cid'];
- }
- else {
-
- // use the posted permissions
-
- $str_group_allow = perms2str($_REQUEST['group_allow']);
- $str_contact_allow = perms2str($_REQUEST['contact_allow']);
- $str_group_deny = perms2str($_REQUEST['group_deny']);
- $str_contact_deny = perms2str($_REQUEST['contact_deny']);
+ if((! $walltowall) &&
+ ((array_key_exists('contact_allow',$_REQUEST))
+ || (array_key_exists('group_allow',$_REQUEST))
+ || (array_key_exists('contact_deny',$_REQUEST))
+ || (array_key_exists('group_deny',$_REQUEST)))) {
+ $acl->set_from_array($_REQUEST);
}
@@ -424,33 +389,15 @@ function item_post(&$a) {
$body .= trim($_REQUEST['attachment']);
$postopts = '';
- $private = (
- ( strlen($str_group_allow)
- || strlen($str_contact_allow)
- || strlen($str_group_deny)
- || strlen($str_contact_deny)
- || strlen($public_policy)
- ) ? 1 : 0);
+ $private = intval($acl->is_private() || ($public_policy));
// If this is a comment, set the permissions from the parent.
if($parent_item) {
$private = 0;
-
- if(($parent_item['item_private'])
- || strlen($parent_item['allow_cid'])
- || strlen($parent_item['allow_gid'])
- || strlen($parent_item['deny_cid'])
- || strlen($parent_item['deny_gid'])
- || strlen($parent_item['public_policy'])) {
- $private = (($parent_item['item_private']) ? $parent_item['item_private'] : 1);
- }
-
+ $acl->set($parent_item);
+ $private = intval($acl->is_private() || $parent_item['item_private']);
$public_policy = $parent_item['public_policy'];
- $str_contact_allow = $parent_item['allow_cid'];
- $str_group_allow = $parent_item['allow_gid'];
- $str_contact_deny = $parent_item['deny_cid'];
- $str_group_deny = $parent_item['deny_gid'];
$owner_hash = $parent_item['owner_xchan'];
}
@@ -505,6 +452,11 @@ function item_post(&$a) {
}
}
+ $gacl = $acl->get();
+ $str_contact_allow = $gacl['allow_cid'];
+ $str_group_allow = $gacl['allow_gid'];
+ $str_contact_deny = $gacl['deny_cid'];
+ $str_group_deny = $gacl['deny_gid'];
if($mimetype === 'text/bbcode') {
@@ -569,9 +521,6 @@ function item_post(&$a) {
$body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$body);
-
-
-
$body = bb_translate_video($body);
/**
diff --git a/mod/like.php b/mod/like.php
index 9077adbda..0d0a1a8c2 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -480,15 +480,16 @@ function like_content(&$a) {
if($extended_like) {
- $r = q("insert into likes (channel_id,liker,likee,iid,verb,target_type,target_id,target) values (%d,'%s','%s',%d,'%s','%s','%s','%s')",
+ $r = q("insert into likes (channel_id,liker,likee,iid,i_mid,verb,target_type,target_id,target) values (%d,'%s','%s',%d,'%s','%s','%s','%s','%s')",
intval($ch[0]['channel_id']),
dbesc($observer['xchan_hash']),
dbesc($ch[0]['channel_hash']),
intval($post_id),
+ dbesc($mid),
dbesc($activity),
- dbesc(($tgttype)?$tgttype:$objtype),
+ dbesc(($tgttype)? $tgttype : $objtype),
dbesc($obj_id),
- dbesc(json_encode(($target)?$target:$object))
+ dbesc(($target) ? $target : $object)
);
};
diff --git a/mod/mitem.php b/mod/mitem.php
index bc93165ac..0fadd1548 100644
--- a/mod/mitem.php
+++ b/mod/mitem.php
@@ -125,12 +125,7 @@ function mitem_content(&$a) {
$menu_names[] = $menus['menu_name'];
}
- $perm_defaults = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
$lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
@@ -151,7 +146,7 @@ function mitem_content(&$a) {
'$menu_id' => $a->data['menu']['menu_id'],
'$permissions' => t('Menu Item Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),
- '$aclselect' => populate_acl($perm_defaults,false),
+ '$aclselect' => populate_acl($acl->get(),false),
'$mitem_desc' => array('mitem_desc', t('Link Name'), '', 'Visible name of the link','*'),
'$mitem_link' => array('mitem_link', t('Link or Submenu Target'), '', t('Enter URL of the link or select a menu name to create a submenu'), '*', 'list="menu-names"'),
'$usezid' => array('usezid', t('Use magic-auth if available'), true, '', array(t('No'), t('Yes'))),
diff --git a/mod/photos.php b/mod/photos.php
index dc70e4f90..d06a8e69c 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -85,6 +85,7 @@ function photos_post(&$a) {
$owner_record = $s[0];
+ $acl = AccessList($a->data['channel']);
if((argc() > 3) && (argv(2) === 'album')) {
@@ -200,6 +201,7 @@ function photos_post(&$a) {
goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']);
}
+
if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
@@ -208,10 +210,9 @@ function photos_post(&$a) {
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
$is_nsfw = ((x($_POST,'adult')) ? intval($_POST['adult']) : 0);
- $str_group_allow = perms2str($_POST['group_allow']);
- $str_contact_allow = perms2str($_POST['contact_allow']);
- $str_group_deny = perms2str($_POST['group_deny']);
- $str_contact_deny = perms2str($_POST['contact_deny']);
+
+ $acl->set_from_array($_POST);
+ $perm = $acl->get();
$resource_id = $a->argv[2];
@@ -284,10 +285,10 @@ function photos_post(&$a) {
$r = q("UPDATE `photo` SET `description` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
dbesc($desc),
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
+ dbesc($perm['allow_cid']),
+ dbesc($perm['allow_gid']),
+ dbesc($perm['deny_cid']),
+ dbesc($perm['deny_gid']),
dbesc($resource_id),
intval($page_owner_uid)
);
@@ -331,20 +332,20 @@ function photos_post(&$a) {
// make sure the linked item has the same permissions as the photo regardless of any other changes
$x = q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d
where id = %d",
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
- intval($item_private),
+ dbesc($perm['allow_cid']),
+ dbesc($perm['allow_gid']),
+ dbesc($perm['deny_cid']),
+ dbesc($perm['deny_gid']),
+ intval($acl->is_private()),
intval($item_id)
);
// make sure the attach has the same permissions as the photo regardless of any other changes
$x = q("update attach set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s' where hash = '%s' and uid = %d and is_photo = 1",
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
+ dbesc($perm['allow_cid']),
+ dbesc($perm['allow_gid']),
+ dbesc($perm['deny_cid']),
+ dbesc($perm['deny_gid']),
dbesc($resource_id),
intval($page_owner_uid)
);
@@ -418,11 +419,11 @@ function photos_post(&$a) {
$_REQUEST['source'] = 'photos';
require_once('include/attach.php');
- if(!local_channel()) {
+ if(! local_channel()) {
$_REQUEST['contact_allow'] = expand_acl($channel['channel_allow_cid']);
- $_REQUEST['group_allow'] = expand_acl($channel['channel_allow_gid']);
- $_REQUEST['contact_deny'] = expand_acl($channel['channel_deny_cid']);
- $_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
+ $_REQUEST['group_allow'] = expand_acl($channel['channel_allow_gid']);
+ $_REQUEST['contact_deny'] = expand_acl($channel['channel_deny_cid']);
+ $_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
}
$r = attach_store($a->channel,get_observer_hash(), '', $_REQUEST);
@@ -557,14 +558,10 @@ function photos_content(&$a) {
if($_is_owner) {
$channel = $a->get_channel();
- $channel_acl = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
+ $channel_acl = $acl->get();
- $lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
+ $lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
}
$aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : '');
diff --git a/mod/settings.php b/mod/settings.php
index cbd6abafc..8bfff3765 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -311,17 +311,16 @@ function settings_post(&$a) {
foreach($global_perms as $k => $v) {
$set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' ';
}
-
- $str_group_allow = perms2str($_POST['group_allow']);
- $str_contact_allow = perms2str($_POST['contact_allow']);
- $str_group_deny = perms2str($_POST['group_deny']);
- $str_contact_deny = perms2str($_POST['contact_deny']);
- $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s'
- where channel_id = %d",
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
+ $acl = new AccessList($channel);
+ $acl->set_from_array($_POST);
+ $x = $acl->get();
+
+ $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s',
+ channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d",
+ dbesc($x['allow_cid']),
+ dbesc($x['allow_gid']),
+ dbesc($x['deny_cid']),
+ dbesc($x['deny_gid']),
intval(local_channel())
);
}
@@ -983,14 +982,8 @@ function settings_content(&$a) {
$stpl = get_markup_template('settings.tpl');
- $celeb = false;
-
- $perm_defaults = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
+ $acl = new AccessList($channel);
+ $perm_defaults = $acl->get();
require_once('include/group.php');
$group_select = mini_group_select(local_channel(),$channel['channel_default_group']);
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 61c20d66f..8281a7a0a 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -84,7 +84,6 @@ function siteinfo_init(&$a) {
'register_policy' => $register_policy[$a->config['system']['register_policy']],
'directory_mode' => $directory_mode[$a->config['system']['directory_mode']],
'language' => get_config('system','language'),
- 'diaspora_emulation' => get_config('system','diaspora_enabled'),
'rss_connections' => get_config('system','feed_contacts'),
'expiration' => $site_expire,
'default_service_restrictions' => $service_class,