From f60a0c5ce050febb0b200938eb51d88cf563b88f Mon Sep 17 00:00:00 2001
From: redmatrix
Date: Wed, 13 Jul 2016 17:51:19 -0700
Subject: document mod_acl a bit better and try to remove some redundancies and
consolidate the various options
---
Zotlabs/Module/Acl.php | 84 ++++++++++++++++++++++++++++++++++---------------
view/js/autocomplete.js | 2 +-
view/js/mod_mail.js | 2 +-
view/js/mod_photos.js | 2 +-
4 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 2bc4ba62d..f33e257f4 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -1,7 +1,18 @@
standard ACL request
+ // 'g' => Groups 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)
+ // $_REQUEST['query'] contains autocomplete search text.
+
+ // List of channels whose connections to also suggest,
+ // e.g. currently viewed channel or channels mentioned in a post
+
$extra_channels = (x($_REQUEST,'extra_channels') ? $_REQUEST['extra_channels'] : array());
- // For use with jquery.autocomplete for private mail completion
+ // The different autocomplete libraries use different names for the search text
+ // parameter. Internaly we'll use $search to represent the search text no matter
+ // what request variable it was attached to.
- if(x($_REQUEST,'query') && strlen($_REQUEST['query'])) {
- if(! $type)
- $type = 'm';
+ if(array_key_exists('query',$_REQUEST)) {
$search = $_REQUEST['query'];
}
- if(!(local_channel()))
- if(!($type == 'x' || $type == 'c'))
- killme();
+ if( (! local_channel()) && (! ($type == 'x' || $type == 'c')))
+ killme();
- if ($search != "") {
+ if($search) {
$sql_extra = " AND `name` LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
$sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc($search) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
- // This horrible mess is needed because position also returns 0 if nothing is found. W/ould 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('".dbesc($search)."' IN xchan_name) else position('".dbesc($search)."' IN xchan_addr) end, ";
+ // 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('" . dbesc($search)
+ . "' IN xchan_name) else position('" . dbesc($search) . "' IN xchan_addr) end, ";
+
$col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' );
$sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
- } else {
+ }
+ else {
$sql_extra = $sql_extra2 = $sql_extra3 = "";
}
@@ -51,7 +85,7 @@ class Acl extends \Zotlabs\Web\Controller {
$groups = array();
$contacts = array();
- if ($type=='' || $type=='g'){
+ if($type == '' || $type == 'g') {
$r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`gname`
FROM `groups`,`group_member`
@@ -82,7 +116,7 @@ class Acl extends \Zotlabs\Web\Controller {
}
}
- if ($type=='' || $type=='c') {
+ if($type == '' || $type == 'c') {
$extra_channels_sql = '';
// Only include channels who allow the observer to view their permissions
foreach($extra_channels as $channel) {
@@ -171,7 +205,7 @@ class Acl extends \Zotlabs\Web\Controller {
intval(PERMS_W_MAIL)
);
}
- elseif(($type == 'a') || ($type == 'p')) {
+ 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 , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
@@ -296,7 +330,7 @@ class Acl extends \Zotlabs\Web\Controller {
$url = $directory['url'] . '/dirsearch';
}
- $count = (x($_REQUEST,'count')?$_REQUEST['count']:100);
+ $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
if($url) {
$query = $url . '?f=' ;
$query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode($search) : '');
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 59a9ed355..63f1e9a13 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -1,5 +1,5 @@
/**
- * Red people autocomplete
+ * general autocomplete support
*
* require jQuery, jquery.textcomplete
*/
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 3e55c8aeb..46574a63d 100644
--- a/view/js/mod_mail.js
+++ b/view/js/mod_mail.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#recip").name_autocomplete(baseurl + '/acl', '', false, function(data) {
+ $("#recip").name_autocomplete(baseurl + '/acl', 'm', false, function(data) {
$("#recip-complete").val(data.xid);
});
$(".autotime").timeago()
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index 006be5f23..e3df3ca68 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -3,7 +3,7 @@
*/
$(document).ready(function() {
- $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
+ $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#photo-edit-newtag").val('@' + data.name);
});
--
cgit v1.2.3
From 00afe56cadbf72bd76efceb0663291d7f88a93fc Mon Sep 17 00:00:00 2001
From: redmatrix
Date: Wed, 13 Jul 2016 20:17:40 -0700
Subject: let abconfig specify a family
---
Zotlabs/Lib/AbConfig.php | 6 ++++--
include/config.php | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php
index 138d0dfea..cab59abbd 100644
--- a/Zotlabs/Lib/AbConfig.php
+++ b/Zotlabs/Lib/AbConfig.php
@@ -5,8 +5,10 @@ namespace Zotlabs\Lib;
class AbConfig {
- static public function Load($chan,$xhash) {
- $r = q("select * from abconfig where chan = %d and xchan = '%s'",
+ static public function Load($chan,$xhash,$family = '') {
+ if($family)
+ $where = sprintf(" and family = '%s' ",dbesc($family));
+ $r = q("select * from abconfig where chan = %d and xchan = '%s' $where",
intval($chan),
dbesc($xhash)
);
diff --git a/include/config.php b/include/config.php
index ece22793f..08810e298 100644
--- a/include/config.php
+++ b/include/config.php
@@ -98,8 +98,8 @@ function del_aconfig($account_id, $family, $key) {
}
-function load_abconfig($chan,$xhash) {
- Zlib\AbConfig::Load($chan,$xhash);
+function load_abconfig($chan, $xhash, $family = '') {
+ return Zlib\AbConfig::Load($chan,$xhash,$family);
}
function get_abconfig($chan,$xhash,$family,$key) {
--
cgit v1.2.3
From 115ef3249cb9b724fecb03ff043af34458587be0 Mon Sep 17 00:00:00 2001
From: redmatrix
Date: Thu, 14 Jul 2016 17:45:09 -0700
Subject: who are we
---
README.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/README.md b/README.md
index 8a6c003fc..fc19e26fc 100644
--- a/README.md
+++ b/README.md
@@ -47,4 +47,16 @@ Possible website applications include
Installing Hubzilla
+** Who Are We and What Are Our Principles? **
+
+The Hubzilla community is powered by passionate volunteers creating an open source **commons** of decentralised services which are highly integrated and can rival the feature set of centralised providers. We are open to sponsorship and donations to cover expenses and compensate for our time and energy, however the project core is basically non-profit and is not designed for the purpose of commercial gain or exploitation.
+
+Some sites may include monetisation strategies such as subscriptions and *freemium* models where members pay for resources they consume beyond a basic level. The project community supports such monetisation initiatives (nobody should be forced to pay "out of pocket" to provide a service to others), but we maintain the **commons** to provide open and free access of the software to all.
+
+The software is not designed for data collection of its members or providing advertising. We don't have a need or desire for these things and feel that software built around these goals is poorly designed and represents compromised principles and ethics.
+
+As a project, we are inclusive of all beliefs and cultures and do what we are able to provide an environment that is free from hostility and harrassment. Whether or not we succeed in this endaevour requires constant vigilance and help from all members of the community, working together to build an inter-networking tool with amazing potential.
+
+
+
[![Build Status](https://travis-ci.org/redmatrix/hubzilla.svg)](https://travis-ci.org/redmatrix/hubzilla)
--
cgit v1.2.3
From 05a9f2f0f58b9ca84e3a286a6126baf9455f947b Mon Sep 17 00:00:00 2001
From: redmatrix
Date: Thu, 14 Jul 2016 17:46:21 -0700
Subject: markdown is whitespace sensitive
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index fc19e26fc..9929f6a16 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ Possible website applications include
Installing Hubzilla
-** Who Are We and What Are Our Principles? **
+**Who Are We and What Are Our Principles?**
The Hubzilla community is powered by passionate volunteers creating an open source **commons** of decentralised services which are highly integrated and can rival the feature set of centralised providers. We are open to sponsorship and donations to cover expenses and compensate for our time and energy, however the project core is basically non-profit and is not designed for the purpose of commercial gain or exploitation.
--
cgit v1.2.3