aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-03-15 19:14:10 +0100
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-03-15 19:14:10 +0100
commit9b64c6163cba7530ee09e47b44e62c3e8ecf69ef (patch)
treee84880e412390f44e67aff1497562e633deed136 /mod
parent4fd0d1489825bd456e0cac77b47de156ff94c0cc (diff)
parent3cb179aff19d803b91261e410c50b36e4bae1246 (diff)
downloadvolse-hubzilla-9b64c6163cba7530ee09e47b44e62c3e8ecf69ef.tar.gz
volse-hubzilla-9b64c6163cba7530ee09e47b44e62c3e8ecf69ef.tar.bz2
volse-hubzilla-9b64c6163cba7530ee09e47b44e62c3e8ecf69ef.zip
Merge pull request #2 from friendica/master
merge from friendica/red
Diffstat (limited to 'mod')
-rw-r--r--mod/block.php86
-rw-r--r--mod/blocks.php2
-rw-r--r--mod/bookmarks.php4
-rw-r--r--mod/chatsvc.php4
-rw-r--r--mod/connections.php50
-rw-r--r--mod/connedit.php6
-rw-r--r--mod/directory.php8
-rw-r--r--mod/dirsearch.php123
-rw-r--r--mod/editblock.php91
-rw-r--r--mod/filer.php14
-rw-r--r--mod/follow.php2
-rw-r--r--mod/help.php16
-rw-r--r--mod/item.php2
-rw-r--r--mod/lang.php6
-rw-r--r--mod/layouts.php114
-rw-r--r--mod/openid.php2
-rw-r--r--mod/pdledit.php62
-rw-r--r--mod/poco.php11
-rw-r--r--mod/post.php5
-rw-r--r--mod/rbmark.php7
-rw-r--r--mod/settings.php2
-rwxr-xr-xmod/setup.php3
-rw-r--r--mod/siteinfo.php18
-rw-r--r--mod/wall_upload.php5
-rw-r--r--mod/wfinger.php2
-rw-r--r--mod/zfinger.php15
26 files changed, 479 insertions, 181 deletions
diff --git a/mod/block.php b/mod/block.php
new file mode 100644
index 000000000..043b0e9e8
--- /dev/null
+++ b/mod/block.php
@@ -0,0 +1,86 @@
+<?php
+
+require_once('include/items.php');
+require_once('include/conversation.php');
+require_once('include/page_widgets.php');
+
+function block_init(&$a) {
+
+ $which = argv(1);
+ $profile = 0;
+ profile_load($a,$which,$profile);
+
+ if($a->profile['profile_uid'])
+ head_set_icon($a->profile['thumb']);
+
+}
+
+
+function block_content(&$a) {
+
+ if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_pages')) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if(argc() < 3) {
+ notice( t('Invalid item.') . EOL);
+ return;
+ }
+
+ $channel_address = argv(1);
+ $page_id = argv(2);
+
+ $u = q("select channel_id from channel where channel_address = '%s' limit 1",
+ dbesc($channel_address)
+ );
+
+ if(! $u) {
+ notice( t('Channel not found.') . EOL);
+ return;
+ }
+
+ if($_REQUEST['rev'])
+ $revision = " and revision = " . intval($_REQUEST['rev']) . " ";
+ else
+ $revision = " order by revision desc ";
+
+ require_once('include/security.php');
+ $sql_options = item_permissions_sql($u[0]['channel_id']);
+
+ $r = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and
+ item_restrict = %d $sql_options $revision limit 1",
+ intval($u[0]['channel_id']),
+ dbesc($page_id),
+ intval(ITEM_BUILDBLOCK)
+ );
+
+ if(! $r) {
+
+ // Check again with no permissions clause to see if it is a permissions issue
+
+ $x = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and
+ item_restrict = %d $revision limit 1",
+ intval($u[0]['channel_id']),
+ dbesc($page_id),
+ intval(ITEM_BUILDBLOCK)
+ );
+ if($x) {
+ // Yes, it's there. You just aren't allowed to see it.
+ notice( t('Permission denied.') . EOL);
+ }
+ else {
+ notice( t('Page not found.') . EOL);
+ }
+ return;
+ }
+
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+
+ $o .= prepare_page($r[0]);
+ return $o;
+
+}
diff --git a/mod/blocks.php b/mod/blocks.php
index 9a4e0b1ca..81337448c 100644
--- a/mod/blocks.php
+++ b/mod/blocks.php
@@ -88,7 +88,7 @@ $r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by
//Build the base URL for edit links
$url = z_root() . "/editblock/" . $which;
// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
- return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
+ return $o . replace_macros(get_markup_template("blocklist.tpl"), array(
'$baseurl' => $url,
'$edit' => t('Edit'),
'$pages' => $pages,
diff --git a/mod/bookmarks.php b/mod/bookmarks.php
index c5be68b8e..141ae2e0b 100644
--- a/mod/bookmarks.php
+++ b/mod/bookmarks.php
@@ -57,7 +57,7 @@ function bookmarks_content(&$a) {
if($x) {
foreach($x as $xx) {
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
- $o .= menu_render($y,true);
+ $o .= menu_render($y,'',true);
}
}
@@ -69,7 +69,7 @@ function bookmarks_content(&$a) {
if($x) {
foreach($x as $xx) {
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
- $o .= menu_render($y,true);
+ $o .= menu_render($y,'',true);
}
}
diff --git a/mod/chatsvc.php b/mod/chatsvc.php
index e6590f57a..9cc8778f5 100644
--- a/mod/chatsvc.php
+++ b/mod/chatsvc.php
@@ -113,7 +113,7 @@ function chatsvc_content(&$a) {
$chats = array();
- $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d",
+ $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created",
intval($a->data['chat']['room_id']),
intval($lastseen)
);
@@ -147,4 +147,4 @@ function chatsvc_content(&$a) {
json_return_and_die($ret);
}
- \ No newline at end of file
+
diff --git a/mod/connections.php b/mod/connections.php
index e36cb5fc7..dbdcbdc93 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -35,7 +35,7 @@ function connections_post(&$a) {
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
- goaway($a->get_baseurl(true) . '/connections');
+ goaway(z_root() . '/connections');
return; // NOTREACHED
}
@@ -170,14 +170,14 @@ function connections_content(&$a) {
return login();
}
- $blocked = false;
- $hidden = false;
- $ignored = false;
- $archived = false;
- $unblocked = false;
- $pending = false;
-
- $all = false;
+ $blocked = false;
+ $hidden = false;
+ $ignored = false;
+ $archived = false;
+ $unblocked = false;
+ $pending = false;
+ $unconnected = false;
+ $all = false;
$_SESSION['return_url'] = $a->query_string;
@@ -212,6 +212,11 @@ function connections_content(&$a) {
$pending = true;
nav_set_selected('intros');
break;
+ case 'unconnected':
+ $search_flags = ABOOK_FLAG_UNCONNECTED;
+ $head = t('Unconnected');
+ $unconnected = true;
+ break;
case 'all':
$head = t('All');
@@ -223,7 +228,8 @@ function connections_content(&$a) {
}
$sql_extra = (($search_flags) ? " and ( abook_flags & " . $search_flags . " ) " : "");
-
+ if(argv(1) === 'pending')
+ $sql_extra .= " and not ( abook_flags & " . ABOOK_FLAG_IGNORED . " ) ";
}
else {
@@ -236,57 +242,65 @@ function connections_content(&$a) {
$tabs = array(
array(
'label' => t('Suggestions'),
- 'url' => $a->get_baseurl(true) . '/suggest',
+ 'url' => z_root() . '/suggest',
'sel' => '',
'title' => t('Suggest new connections'),
),
array(
'label' => t('New Connections'),
- 'url' => $a->get_baseurl(true) . '/connections/pending',
+ 'url' => z_root() . '/connections/pending',
'sel' => ($pending) ? 'active' : '',
'title' => t('Show pending (new) connections'),
),
array(
'label' => t('All Connections'),
- 'url' => $a->get_baseurl(true) . '/connections/all',
+ 'url' => z_root() . '/connections/all',
'sel' => ($all) ? 'active' : '',
'title' => t('Show all connections'),
),
array(
'label' => t('Unblocked'),
- 'url' => $a->get_baseurl(true) . '/connections',
+ 'url' => z_root() . '/connections',
'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '',
'title' => t('Only show unblocked connections'),
),
array(
'label' => t('Blocked'),
- 'url' => $a->get_baseurl(true) . '/connections/blocked',
+ 'url' => z_root() . '/connections/blocked',
'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked connections'),
),
array(
'label' => t('Ignored'),
- 'url' => $a->get_baseurl(true) . '/connections/ignored',
+ 'url' => z_root() . '/connections/ignored',
'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored connections'),
),
array(
'label' => t('Archived'),
- 'url' => $a->get_baseurl(true) . '/connections/archived',
+ 'url' => z_root() . '/connections/archived',
'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived connections'),
),
array(
'label' => t('Hidden'),
- 'url' => $a->get_baseurl(true) . '/connections/hidden',
+ 'url' => z_root() . '/connections/hidden',
'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden connections'),
),
+ array(
+ 'label' => t('Unconnected'),
+ 'url' => z_root() . '/connections/unconnected',
+ 'sel' => ($unconnected) ? 'active' : '',
+ 'title' => t('Only show one-way connections'),
+ ),
+
+
);
$tab_tpl = get_markup_template('common_tabs.tpl');
diff --git a/mod/connedit.php b/mod/connedit.php
index c6f64ccfc..b9b7fcce3 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -177,7 +177,13 @@ function connedit_content(&$a) {
$sort_type = 0;
$o = '';
+ // this triggers some javascript to set Full Sharing by default after
+ // completing a "follow" - which can be changed to something else before
+ // form submission, but this gives us something useable
+ if($_GET['follow'] == 1) {
+ $o .= '<script>var after_following = 1;</script>';
+ }
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return login();
diff --git a/mod/directory.php b/mod/directory.php
index 8fc62e95b..6e0e2e7dc 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -42,12 +42,13 @@ function directory_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+ $advanced = ((x($_REQUEST,'query')) ? notags(trim($_REQUEST['query'])) : '');
+
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
$tpl = get_markup_template('directory_header.tpl');
-
$dirmode = intval(get_config('system','directory_mode'));
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
@@ -81,6 +82,7 @@ function directory_content(&$a) {
if($url) {
// We might want to make the tagadelic count (&kw=) configurable or turn it off completely.
+
$numtags = get_config('system','directorytags');
$kw = ((intval($numtags)) ? $numtags : 24);
@@ -92,7 +94,9 @@ function directory_content(&$a) {
$query .= '&address=' . urlencode($search);
if($keywords)
$query .= '&keywords=' . urlencode($keywords);
-
+ if($advanced)
+ $query .= '&query=' . urlencode($advanced);
+
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
if($sort_order)
$query .= '&order=' . urlencode($sort_order);
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 59a1d448d..801be6189 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -27,6 +27,26 @@ function dirsearch_content(&$a) {
json_return_and_die($ret);
}
+ $sql_extra = '';
+
+ $tables = array('name','address','locale','region','postcode','country','gender','marital','sexual','keywords');
+
+ if($_REQUEST['query']) {
+ $advanced = dir_parse_query($_REQUEST['query']);
+ if($advanced) {
+ foreach($advanced as $adv) {
+ if(in_array($adv['field'],$tables)) {
+ if($adv['field'] === 'name')
+ $sql_extra .= dir_query_build($adv['logic'],'xchan_name',$adv['value']);
+ elseif($adv['field'] === 'address')
+ $sql_extra .= dir_query_build($adv['logic'],'xchan_addr',$adv['value']);
+ else
+ $sql_extra .= dir_query_build($adv['logic'],'xprof_' . $adv['field'],$adv['value']);
+ }
+ }
+ }
+ }
+
$hash = ((x($_REQUEST['hash'])) ? $_REQUEST['hash'] : '');
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : '');
@@ -38,6 +58,7 @@ function dirsearch_content(&$a) {
$country = ((x($_REQUEST,'country')) ? $_REQUEST['country'] : '');
$gender = ((x($_REQUEST,'gender')) ? $_REQUEST['gender'] : '');
$marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : '');
+ $sexual = ((x($_REQUEST,'sexual')) ? $_REQUEST['sexual'] : '');
$keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : '');
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
@@ -59,36 +80,38 @@ function dirsearch_content(&$a) {
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
-// TODO - a meta search which joins all of these things to one search string
-
- $sql_extra = '';
+ $joiner = ' OR ';
+ if($_REQUEST['and'])
+ $joiner = ' AND ';
if($name)
- $sql_extra .= " OR xchan_name like '" . protect_sprintf( '%' . dbesc($name) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xchan_name',$name);
if($hub)
- $sql_extra .= " OR xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
+ $sql_extra .= " $joiner xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
if($address)
- $sql_extra .= " OR xchan_addr like '" . protect_sprintf( '%' . dbesc($address) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xchan_addr',$address);
if($city)
- $sql_extra .= " OR xprof_locale like '" . protect_sprintf( '%' . dbesc($city) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_locale',$city);
if($region)
- $sql_extra .= " OR xprof_region like '" . protect_sprintf( '%' . dbesc($region) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_region',$region);
if($post)
- $sql_extra .= " OR xprof_postcode like '" . protect_sprintf( '%' . dbesc($post) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_postcode',$post);
if($country)
- $sql_extra .= " OR xprof_country like '" . protect_sprintf( '%' . dbesc($country) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_country',$country);
if($gender)
- $sql_extra .= " OR xprof_gender like '" . protect_sprintf( '%' . dbesc($gender) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_gender',$gender);
if($marital)
- $sql_extra .= " OR xprof_marital like '" . protect_sprintf( '%' . dbesc($marital) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_marital',$marital);
+ if($sexual)
+ $sql_extra .= dir_query_build($joiner,'xprof_sexual',$sexual);
if($keywords)
- $sql_extra .= " OR xprof_keywords like '" . protect_sprintf( '%' . dbesc($keywords) . '%' ) . "' ";
+ $sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
// we only support an age range currently. You must set both agege
// (greater than or equal) and agele (less than or equal)
if($agele && $agege) {
- $sql_extra .= " OR ( xprof_age <= " . intval($agele) . " ";
+ $sql_extra .= " $joiner ( xprof_age <= " . intval($agele) . " ";
$sql_extra .= " AND xprof_age >= " . intval($agege) . ") ";
}
@@ -98,7 +121,6 @@ function dirsearch_content(&$a) {
}
-
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80);
$page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;
@@ -159,7 +181,12 @@ function dirsearch_content(&$a) {
);
if($r) {
foreach($r as $rr) {
- $flags = (($rr['ud_flags'] & UPDATE_FLAGS_DELETED) ? array('deleted') : array());
+ $flags = array();
+ if($rr['ud_flags'] & UPDATE_FLAGS_DELETED)
+ $flags[] = 'deleted';
+ if($rr['ud_flags'] & UPDATE_FLAGS_FORCED)
+ $flags[] = 'forced';
+
$spkt['transactions'][] = array(
'hash' => $rr['ud_hash'],
'address' => $rr['ud_addr'],
@@ -231,6 +258,70 @@ function dirsearch_content(&$a) {
}
+function dir_query_build($joiner,$field,$s) {
+ $ret = '';
+ if(trim($s))
+ $ret .= dbesc($joiner) . " " . dbesc($field) . " like '" . protect_sprintf( '%' . dbesc($s) . '%' ) . "' ";
+ return $ret;
+}
+
+function dir_parse_query($s) {
+
+ $ret = array();
+ $curr = array();
+ $all = explode(' ',$s);
+ $quoted_string = false;
+
+ if($all) {
+ foreach($all as $q) {
+ if($q === 'and') {
+ $curr['logic'] = 'and';
+ continue;
+ }
+ if($q === 'or') {
+ $curr['logic'] = 'or';
+ continue;
+ }
+ if($q === 'not') {
+ $curr['logic'] .= ' not';
+ continue;
+ }
+ if(strpos($q,'=')) {
+ if(! isset($curr['logic']))
+ $curr['logic'] = 'or';
+ $curr['field'] = trim(substr($q,0,strpos($q,'=')));
+ $curr['value'] = trim(substr($q,strpos($q,'=')+1));
+ if(strpos($curr['value'],'"') !== false) {
+ $quoted_string = true;
+ $curr['value'] = substr($curr['value'],strpos($curr['value'],'"')+1);
+ }
+ else {
+ $ret[] = $curr;
+ $curr = array();
+ $continue;
+ }
+ }
+ elseif($quoted_string) {
+ if(strpos($q,'"') !== false) {
+ $curr['value'] .= ' ' . str_replace('"','',trim($q));
+ $ret[] = $curr;
+ $curr = array();
+ $quoted_string = false;
+ }
+ else
+ $curr['value'] .= ' ' . trim(q);
+ }
+ }
+ }
+ logger('dir_parse_query:' . print_r($ret,true),LOGGER_DATA);
+ return $ret;
+}
+
+
+
+
+
+
function list_public_sites() {
$r = q("select * from site where site_access != 0 and site_register !=0 order by rand()");
diff --git a/mod/editblock.php b/mod/editblock.php
index dcb4b42a7..8ccccc24b 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -1,74 +1,68 @@
<?php
-// What is this here for? I think it's cruft, but comment out for now in case it's here for a reason
-// require_once('acl_selectors.php');
function editblock_content(&$a) {
-// We first need to figure out who owns the webpage, grab it from an argument
- $which = argv(1);
-// $a->get_channel() and stuff don't work here, so we've got to find the owner for ourselves.
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
- );
- if($r) {
- $owner = intval($r[0]['channel_id']);
- //logger('owner: ' . print_r($owner,true));
- }
+ if(argc() < 2) {
+ notice( t('Item not found') . EOL);
+ return;
+ }
+ $channel = get_channel_by_nick(argv(1));
-
-
- if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
- $which = $channel['channel_address'];
- }
+ if($c) {
+ $owner = intval($channel['channel_id']);
+ }
$o = '';
-// Figure out which post we're editing
+ // Figure out which post we're editing
$post_id = ((argc() > 2) ? intval(argv(2)) : 0);
- if(! $post_id) {
+ if(! ($post_id && $channel)) {
notice( t('Item not found') . EOL);
return;
}
-// Now we've got a post and an owner, let's find out if we're allowed to edit it
-
- $observer = $a->get_observer();
- $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ // Now we've got a post and an owner, let's find out if we're allowed to edit it
- $perms = get_all_perms($owner,$ob_hash);
-
- if(! $perms['write_pages']) {
- notice( t('Permission denied.') . EOL);
- return;
- }
+ if(! perm_is_allowed($channel['channel_id'],get_observer_hash(),'write_pages')) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
-// We've already figured out which item we want and whose copy we need, so we don't need anything fancy here
- $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
- intval($post_id),
- intval($owner)
- );
- $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1",
- $itm[0]['id']
+ // We've already figured out which item we want and whose copy we need, so we don't need anything fancy here
+ $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
+ intval($post_id),
+ intval($channel['channel_id'])
);
- if($item_id)
- $block_title = $item_id[0]['sid'];
+ if($itm) {
+ $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1",
+ $itm[0]['id']
+ );
+ if($item_id)
+ $block_title = $item_id[0]['sid'];
+ }
+ else {
+ notice( t('Item not found') . EOL);
+ return;
+ }
$plaintext = true;
-// You may or may not be a local user. This won't work,
- if(feature_enabled(local_user(),'richtext'))
+
+ // You may or may not be a local user.
+ if(local_user() && feature_enabled(local_user(),'richtext'))
$plaintext = false;
$mimeselect = '';
+ $mimetype = $itm[0]['mimetype'];
if($mimetype != 'text/bbcode')
$plaintext = true;
@@ -79,9 +73,6 @@ function editblock_content(&$a) {
$mimeselect = mimetype_select($itm[0]['uid'],$mimetype);
-
-
-
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Block')
));
@@ -91,8 +82,8 @@ function editblock_content(&$a) {
'$baseurl' => $a->get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
- '$geotag' => $geotag,
- '$nickname' => $a->user['nickname'],
+ '$geotag' => '',
+ '$nickname' => $channel['channel_address'],
'$confirmdelete' => t('Delete block?')
));
@@ -105,13 +96,13 @@ function editblock_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
- $channel = $a->get_channel();
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-//FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page. So, send folk to the webpage list.
+ // FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page.
+ //So, send folk to the webpage list.
- $rp = '/blocks/' . $which;
+ $rp = 'blocks/' . $channel['channel_address'];
$o .= replace_macros($tpl,array(
'$return_path' => $rp,
@@ -147,10 +138,10 @@ function editblock_content(&$a) {
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
- '$profile_uid' => (intval($owner)),
+ '$profile_uid' => (intval($channel['channel_id'])),
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
- '$sourceapp' => t($a->sourcename),
+ '$sourceapp' => $itm[0]['app'],
'$defexpire' => '',
'$feature_expire' => 'none',
'$expires' => t('Set expiration date'),
diff --git a/mod/filer.php b/mod/filer.php
index adc6245e1..3340fc999 100644
--- a/mod/filer.php
+++ b/mod/filer.php
@@ -19,6 +19,20 @@ function filer_content(&$a) {
if($item_id && strlen($term)){
// file item
store_item_tag(local_user(),$item_id,TERM_OBJ_POST,TERM_FILE,$term,'');
+
+ // protect the entire conversation from periodic expiration
+
+ $r = q("select parent from item where id = %d and uid = %d limit 1",
+ intval($item_id),
+ intval(local_user())
+ );
+ if($r) {
+ $x = q("update item set item_flags = ( item_flags | %d ) where id = %d and uid = %d limit 1",
+ intval(ITEM_RETAINED),
+ intval($r[0]['parent']),
+ intval(local_user())
+ );
+ }
}
else {
$filetags = array();
diff --git a/mod/follow.php b/mod/follow.php
index 962bb71a7..663fb7536 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -30,7 +30,7 @@ function follow_init(&$a) {
proc_run('php','include/onepoll.php',$result['abook']['abook_id']);
- goaway(z_root() . '/connedit/' . $result['abook']['abook_id']);
+ goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
}
diff --git a/mod/help.php b/mod/help.php
index bbfeb9a6c..81ecd6ba9 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -40,19 +40,19 @@ function help_content(&$a) {
if(argc() > 1) {
$text = load_doc_file('doc/' . $a->argv[1] . '.md');
- $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1)));
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1))));
}
if(! $text) {
$text = load_doc_file('doc/' . $a->argv[1] . '.bb');
if($text)
$doctype = 'bbcode';
- $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1)));
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags(argv(1))));
}
if(! $text) {
$text = load_doc_file('doc/' . $a->argv[1] . '.html');
if($text)
$doctype = 'html';
- $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1)));
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1))));
}
if(! $text) {
@@ -76,14 +76,18 @@ function help_content(&$a) {
$text = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $text);
if($doctype === 'html')
- return $text;
+ $content = $text;
if($doctype === 'markdown')
- return Markdown($text);
+ $content = Markdown($text);
if($doctype === 'bbcode') {
require_once('include/bbcode.php');
- return bbcode($text);
+ $content = bbcode($text);
}
+ return replace_macros(get_markup_template("help.tpl"), array(
+ '$content' => $content
+ ));
+
}
diff --git a/mod/item.php b/mod/item.php
index 2feb64a37..6ea434542 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -862,7 +862,7 @@ function item_post(&$a) {
// figure out how to return, depending on from whence we came
if($api_source)
- return;
+ return $post;
if($return_path) {
goaway($a->get_baseurl() . "/" . $return_path);
diff --git a/mod/lang.php b/mod/lang.php
new file mode 100644
index 000000000..fba5f9c73
--- /dev/null
+++ b/mod/lang.php
@@ -0,0 +1,6 @@
+<?php
+
+function lang_content(&$a) {
+ return lang_selector();
+}
+
diff --git a/mod/layouts.php b/mod/layouts.php
index 9ed349850..0dcaba361 100644
--- a/mod/layouts.php
+++ b/mod/layouts.php
@@ -28,84 +28,94 @@ function layouts_content(&$a) {
return;
}
+ // Get the observer, check their permissions
+ $observer = $a->get_observer();
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ $perms = get_all_perms($owner,$ob_hash);
-// Get the observer, check their permissions
+ if(! $perms['write_pages']) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
- $observer = $a->get_observer();
- $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ if((argc() > 3) && (argv(2) === 'share') && (argv(3))) {
+ $r = q("select sid, service, mimetype, title, body from item_id left join item on item.id = item_id.iid where item_id.uid = %d and item.mid = '%s' and service = 'PDL' order by sid asc",
+ intval($owner),
+ dbesc(argv(3))
+ );
+ if($r) {
+ header('Content-type: application/x-redmatrix-layout');
+ header('Content-disposition: attachment; filename="' . $r[0]['sid'] . '.pdl"');
+ echo json_encode($r);
+ killme();
- $perms = get_all_perms($owner,$ob_hash);
+ }
+ }
- if(! $perms['write_pages']) {
- notice( t('Permission denied.') . EOL);
- return;
- }
+ $tabs = array(
+ array(
+ 'label' => t('Layout Help'),
+ 'url' => 'help/Comanche',
+ 'sel' => '',
+ 'title' => t('Help with this feature'),
+ 'id' => 'layout-help-tab',
+ ));
-// if(local_user() && local_user() == $owner) {
- // $a->set_widget('design',design_tools());
- // }
- $tabs = array(
- array(
- 'label' => t('Layout Help'),
- 'url' => 'help/Comanche',
- 'sel' => '',
- 'title' => t('Help with this feature'),
- 'id' => 'layout-help-tab',
- ));
+ $o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs));
- $o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs));
+ // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
+ // Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
+ require_once ('include/conversation.php');
-// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
-// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
-require_once ('include/conversation.php');
- $x = array(
- 'webpage' => ITEM_PDL,
- 'is_owner' => true,
- 'nickname' => $a->profile['channel_address'],
- 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'bang' => (($group || $cid) ? '!' : ''),
- 'visitor' => 'none',
- 'nopreview' => 1,
- 'ptlabel' => t('Layout Name'),
- 'profile_uid' => intval($owner),
- );
+ $x = array(
+ 'webpage' => ITEM_PDL,
+ 'is_owner' => true,
+ 'nickname' => $a->profile['channel_address'],
+ 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
+ 'bang' => (($group || $cid) ? '!' : ''),
+ 'visitor' => 'none',
+ 'nopreview' => 1,
+ 'ptlabel' => t('Layout Name'),
+ 'profile_uid' => intval($owner),
+ );
- $o .= status_editor($a,$x);
+ $o .= status_editor($a,$x);
- //Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
-//TODO - this should be replaced with pagelist_widget
+ // Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
+ // TODO - this should be replaced with pagelist_widget
-$r = q("select * from item_id where uid = %d and service = 'PDL' order by sid asc",
- intval($owner)
-);
+ $r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid where item_id.uid = %d and service = 'PDL' order by sid asc",
+ intval($owner)
+ );
- $pages = null;
+ $pages = null;
+
+ if($r) {
+ $pages = array();
+ foreach($r as $rr) {
+ $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid'], 'mid' => $rr['mid']);
+ }
+ }
- if($r) {
- $pages = array();
- foreach($r as $rr) {
- $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
- }
- }
+ //Build the base URL for edit links
+ $url = z_root() . "/editlayout/" . $which;
-//Build the base URL for edit links
- $url = z_root() . "/editlayout/" . $which;
-// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
- return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
+ return $o . replace_macros(get_markup_template("layoutlist.tpl"), array(
'$baseurl' => $url,
'$edit' => t('Edit'),
+ '$share' => t('Share'),
'$pages' => $pages,
'$channel' => $which,
'$view' => t('View'),
'$preview' => '1',
- ));
+ ));
}
diff --git a/mod/openid.php b/mod/openid.php
index b0d4008d4..2112e0af4 100644
--- a/mod/openid.php
+++ b/mod/openid.php
@@ -62,6 +62,7 @@ function openid_content(&$a) {
if($r) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['xchan_hash'];
+ $_SESSION['my_url'] = $r[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['xchan_addr'];
$arr = array('xchan' => $r[0], 'session' => $_SESSION);
call_hooks('magic_auth_openid_success',$arr);
@@ -169,6 +170,7 @@ function openid_content(&$a) {
set_xconfig($url,'system','openid',$authid);
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['xchan_hash'];
+ $_SESSION['my_url'] = $r[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['xchan_addr'];
$arr = array('xchan' => $r[0], 'session' => $_SESSION);
call_hooks('magic_auth_openid_success',$arr);
diff --git a/mod/pdledit.php b/mod/pdledit.php
new file mode 100644
index 000000000..36b9a0c14
--- /dev/null
+++ b/mod/pdledit.php
@@ -0,0 +1,62 @@
+<?php
+
+function pdledit_post(&$a) {
+ if(! local_user())
+ return;
+ if(! $_REQUEST['module'])
+ return;
+ if(! trim($_REQUEST['content'])) {
+ del_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl');
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+ }
+ set_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content']));
+ info( t('Layout updated.') . EOL);
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+}
+
+
+function pdledit_content(&$a) {
+
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if(argc() > 1)
+ $module = 'mod_' . argv(1) . '.pdl';
+ else {
+ $o .= '<h1>' . t('Edit System Page Description') . '</h1>';
+ $files = glob('mod/*');
+ if($files) {
+ foreach($files as $f) {
+ $name = basename($f,'.php');
+ $x = theme_include('mod_' . $name . '.pdl');
+ if($x) {
+ $o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
+ }
+ }
+ }
+
+ // list module pdl files
+ return $o;
+ }
+
+ $t = get_pconfig(local_user(),'system',$module);
+ if(! $t)
+ $t = file_get_contents(theme_include($module));
+ if(! $t) {
+ notice( t('Layout not found.') . EOL);
+ return '';
+ }
+
+ $o = replace_macros(get_markup_template('pdledit.tpl'),array(
+ '$header' => t('Edit System Page Description'),
+ '$mname' => t('Module Name:'),
+ '$help' => t('Layout Help'),
+ '$module' => argv(1),
+ '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+}
diff --git a/mod/poco.php b/mod/poco.php
index a5808b7db..9295f13de 100644
--- a/mod/poco.php
+++ b/mod/poco.php
@@ -76,6 +76,9 @@ function poco_init(&$a) {
$sql_extra ",
intval($channel_id)
);
+ $c = q("select * from menu_item where ( mitem_flags & " . intval(MENU_ITEM_CHATROOM) . " ) and allow_cid = '' and allow_gid = '' and deny_cid = '' and deny_gid = '' and mitem_channel_id = %d",
+ intval($channel_id)
+ );
}
if($r)
$totalResults = intval($r[0]['total']);
@@ -115,6 +118,14 @@ function poco_init(&$a) {
$ret['startIndex'] = (string) $startIndex;
$ret['itemsPerPage'] = (string) $itemsPerPage;
$ret['totalResults'] = (string) $totalResults;
+
+ if($c) {
+ $ret['chatrooms'] = array();
+ foreach($c as $d) {
+ $ret['chatrooms'][] = array('url' => $d['mitem_link'], 'desc' => $d['mitem_desc']);
+ }
+ }
+
$ret['entry'] = array();
diff --git a/mod/post.php b/mod/post.php
index 6c57bfa0d..95c984b40 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -243,6 +243,7 @@ function post_init(&$a) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $x[0]['xchan_hash'];
+ $_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $address;
$_SESSION['remote_service_class'] = $remote_service_class;
$_SESSION['remote_level'] = $remote_level;
@@ -264,7 +265,7 @@ function post_init(&$a) {
} else {
if($test) {
$ret['message'] .= 'auth failure. ' . print_r($_REQUEST,true) . print_r($j,true) . EOL;
- json_return_and_dir($ret);
+ json_return_and_die($ret);
}
logger('mod_zot: magic-auth failure - not authenticated: ' . $x[0]['xchan_addr']);
@@ -280,7 +281,7 @@ function post_init(&$a) {
if($test) {
$ret['message'] .= 'auth failure fallthrough ' . print_r($_REQUEST,true) . print_r($j,true) . EOL;
- json_return_and_dir($ret);
+ json_return_and_die($ret);
}
if(strstr($desturl,z_root() . '/rmagic'))
diff --git a/mod/rbmark.php b/mod/rbmark.php
index 1c962152c..e35c2494a 100644
--- a/mod/rbmark.php
+++ b/mod/rbmark.php
@@ -35,7 +35,8 @@ function rbmark_post(&$a) {
$t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title']));
bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0),
array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0),
- 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : '')
+ 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''),
+ 'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0)
));
goaway(z_root() . '/bookmarks');
@@ -92,8 +93,8 @@ function rbmark_content(&$a) {
'$header' => t('Save Bookmark'),
'$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])),
'$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])),
- '$ischat' => (($ischat) ? 1 : 0),
- '$private' => (($private) ? 1 : 0),
+ '$ischat' => ((x($_REQUEST,'ischat')) ? intval($_REQUEST['ischat']) : 0),
+ '$private' => ((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0),
'$submit' => t('Save'),
'$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''),
'$menus' => $menu_select
diff --git a/mod/settings.php b/mod/settings.php
index b88380ff0..1d2a5ecf9 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -439,7 +439,6 @@ function settings_post(&$a) {
dbesc($str_group_deny),
intval(local_user())
);
-
if($r)
info( t('Settings updated.') . EOL);
@@ -759,6 +758,7 @@ function settings_content(&$a) {
'$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')),
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
'$chanview_full' => array('chanview_full', t('Do not view remote profiles in frames'), $chanview, t('By default open in a sub-window of your own site')),
+ '$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
));
diff --git a/mod/setup.php b/mod/setup.php
index 14572699e..d12627e84 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -602,6 +602,9 @@ function what_next() {
$a = get_app();
// install the standard theme
set_config('system','allowed_themes','redbasic');
+ // Create a system channel
+ require_once ('include/identity.php');
+ create_sys_channel();
$baseurl = $a->get_baseurl();
return
t('<h1>What next</h1>')
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 7fdb892d2..bdf9b1af6 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -90,24 +90,6 @@ function siteinfo_content(&$a) {
$admininfo = bbcode(get_config('system','admininfo'));
- $project_donate = t('Project Donations');
- $donate_text = t('<p>The Red Matrix is provided for you by volunteers working in their spare time. Your support will help us to build a better, freer, and privacy respecting web. Select the following option for a one-time donation of your choosing</p>');
- $alternatively = t('<p>or</p>');
- $recurring = t('Recurring Donation Options');
-
- $donate = <<< EOT
-<h3>{$project_donate}</h3>
-$donate_text
-<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="mike@macgirvin.com" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="item_name" value="Distributed Social Network Support Donation" /><input type="hidden" name="no_note" value="0" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest" /><input style="border: none;" type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donations gladly accepted to support our work" /></form><br />
-<strong>$alternatively</strong>
-<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick" /><input type="hidden" name="hosted_button_id" value="FHV36KE28CYM8" /><br />
-<table><tbody><tr><td><input type="hidden" name="on0" value="$recurring" />$recurring</td>
-</tr><tr><td>
-<select name="os0"><option value="Option 1">Option 1 : $3.00USD - monthly</option><option value="Option 2">Option 2 : $5.00USD - monthly</option><option value="Option 3">Option 3 : $10.00USD - monthly</option><option value="Option 4">Option 4 : $20.00USD - monthly</option></select></td>
-</tr></tbody></table><p><input type="hidden" name="currency_code" value="USD" /><input type="image" style="border: none;" border="0" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" /><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></p></form>
-<p></p>
-EOT;
-
if(file_exists('doc/site_donate.html'))
$donate .= file_get_contents('doc/site_donate.html');
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 2939cf0d1..f83f4f7cf 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -45,11 +45,10 @@ function wall_upload_post(&$a) {
$m = $ret['body'];
- // This might make Friendica for Android uploads work again, as it won't have any knowledge of zrl and zmg tags
- // and these tags probably aren't useful with other client apps.
+
if($using_api)
- return(str_replace(array('zrl','zmg'),array('url','img'),$ret['body']));
+ return("\n\n" . $ret['body'] . "\n\n");
else
echo "\n\n" . $ret['body'] . "\n\n";
killme();
diff --git a/mod/wfinger.php b/mod/wfinger.php
index 33d2fe478..fb75da193 100644
--- a/mod/wfinger.php
+++ b/mod/wfinger.php
@@ -80,7 +80,7 @@ function wfinger_init(&$a) {
array(
'rel' => 'http://purl.org/zot/protocol',
- 'href' => z_root() . '/.well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'],
+ 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'],
)
);
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 94671271b..4f59c1973 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -176,10 +176,21 @@ function zfinger_init(&$a) {
$ret['follow_url'] = z_root() . '/follow?f=&url=%s';
- $permissions = get_all_perms($e['channel_id'],(($ztarget && $zsig)
+ $ztarget_hash = (($ztarget && $zsig)
? base64url_encode(hash('whirlpool',$ztarget . $zsig,true))
- : '' ),false);
+ : '' );
+ $permissions = get_all_perms($e['channel_id'],$ztarget_hash,false);
+
+ if($ztarget_hash) {
+ $permissions['connected'] = false;
+ $b = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
+ dbesc($ztarget_hash),
+ intval($e['channel_id'])
+ );
+ if($b)
+ $permissions['connected'] = true;
+ }
$ret['permissions'] = (($ztarget && $zkey) ? aes_encapsulate(json_encode($permissions),$zkey) : $permissions);