aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-03-27 21:11:34 -0400
committerAndrew Manning <tamanning@zoho.com>2018-03-27 21:11:34 -0400
commit1dc795722a8e748ebb98e8fab778cd4686a0654f (patch)
tree4f4a4e8dea10090106c4d54a02c6860332cd9df4 /Zotlabs
parentdcd658f12ea60945678717e3c310e94ece7b1f96 (diff)
parentc98776923a3aed4a0a17ca1412787de3b718eba9 (diff)
downloadvolse-hubzilla-1dc795722a8e748ebb98e8fab778cd4686a0654f.tar.gz
volse-hubzilla-1dc795722a8e748ebb98e8fab778cd4686a0654f.tar.bz2
volse-hubzilla-1dc795722a8e748ebb98e8fab778cd4686a0654f.zip
Merge branch 'dev' into oauth2
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Access/PermissionRoles.php19
-rw-r--r--Zotlabs/Lib/Apps.php7
-rw-r--r--Zotlabs/Lib/Share.php12
-rw-r--r--Zotlabs/Module/Acl.php6
-rw-r--r--Zotlabs/Module/Admin/Accounts.php7
-rw-r--r--Zotlabs/Module/Appman.php1
-rw-r--r--Zotlabs/Module/Articles.php20
-rw-r--r--Zotlabs/Module/Cards.php21
-rw-r--r--Zotlabs/Module/Chanview.php2
-rw-r--r--Zotlabs/Module/Cloud.php6
-rw-r--r--Zotlabs/Module/Connections.php34
-rw-r--r--Zotlabs/Module/Display.php34
-rw-r--r--Zotlabs/Module/Follow.php2
-rw-r--r--Zotlabs/Module/Item.php6
-rw-r--r--Zotlabs/Module/Moderate.php9
-rw-r--r--Zotlabs/Module/New_channel.php20
-rw-r--r--Zotlabs/Module/Ochannel.php69
-rw-r--r--Zotlabs/Module/Oep.php4
-rw-r--r--Zotlabs/Module/Profiles.php43
-rw-r--r--Zotlabs/Module/Regmod.php2
-rw-r--r--Zotlabs/Module/Rpost.php38
-rw-r--r--Zotlabs/Module/Settings/Channel.php4
-rw-r--r--Zotlabs/Module/Share.php21
-rw-r--r--Zotlabs/Storage/Directory.php20
-rw-r--r--Zotlabs/Widget/Newmember.php7
25 files changed, 307 insertions, 107 deletions
diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php
index b335bf825..a8a9ae462 100644
--- a/Zotlabs/Access/PermissionRoles.php
+++ b/Zotlabs/Access/PermissionRoles.php
@@ -41,6 +41,24 @@ class PermissionRoles {
break;
+ case 'social_party':
+ $ret['perms_auto'] = false;
+ $ret['default_collection'] = false;
+ $ret['directory_publish'] = true;
+ $ret['online'] = true;
+ $ret['perms_connect'] = [
+ 'view_stream', 'view_profile', 'view_contacts', 'view_storage',
+ 'view_pages', 'view_wiki', 'send_stream', 'post_wall', 'post_comments',
+ 'post_mail', 'chat', 'post_like', 'republish'
+ ];
+ $ret['limits'] = PermissionLimits::Std_Limits();
+ $ret['limits']['post_comments'] = PERMS_AUTHED;
+ $ret['limits']['post_mail'] = PERMS_AUTHED;
+ $ret['limits']['post_like'] = PERMS_AUTHED;
+ $ret['limits']['chat'] = PERMS_AUTHED;
+ break;
+
+
case 'social_restricted':
$ret['perms_auto'] = false;
$ret['default_collection'] = true;
@@ -263,6 +281,7 @@ class PermissionRoles {
static public function roles() {
$roles = [
t('Social Networking') => [
+ 'social_party' => t('Social - Party'),
'social' => t('Social - Mostly Public'),
'social_restricted' => t('Social - Restricted'),
'social_private' => t('Social - Private')
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index f91dc8e49..24cb4a626 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -785,6 +785,7 @@ class Apps {
dbesc($darray['app_plugin']),
intval($darray['app_deleted'])
);
+
if($r) {
$ret['success'] = true;
$ret['app_id'] = $darray['app_id'];
@@ -871,6 +872,12 @@ class Apps {
dbesc($darray['app_id']),
intval($darray['app_channel'])
);
+
+ // if updating an embed app, don't mess with any existing categories.
+
+ if(array_key_exists('embed',$arr) && intval($arr['embed']))
+ return $ret;
+
if($x) {
q("delete from term where otype = %d and oid = %d",
intval(TERM_OBJ_APP),
diff --git a/Zotlabs/Lib/Share.php b/Zotlabs/Lib/Share.php
index b5341e662..e9e4d23c4 100644
--- a/Zotlabs/Lib/Share.php
+++ b/Zotlabs/Lib/Share.php
@@ -123,11 +123,13 @@ class Share {
$bb = substr($this->item['body'], $pos);
} else {
$bb = "[share author='".urlencode($this->item['author']['xchan_name']).
- "' profile='".$this->item['author']['xchan_url'] .
- "' avatar='".$this->item['author']['xchan_photo_s'].
- "' link='".$this->item['plink'].
- "' posted='".$this->item['created'].
- "' message_id='".$this->item['mid']."']";
+ "' profile='" . $this->item['author']['xchan_url'] .
+ "' avatar='" . $this->item['author']['xchan_photo_s'] .
+ "' link='" . $this->item['plink'] .
+ "' auth='" . (($this->item['author']['network'] === 'zot') ? 'true' : 'false') .
+ "' posted='" . $this->item['created'] .
+ "' message_id='" . $this->item['mid'] .
+ "']";
if($this->item['title'])
$bb .= '[b]'.$this->item['title'].'[/b]'."\r\n";
$bb .= (($is_photo) ? $photo_bb . "\r\n" . $this->item['body'] : $this->item['body']);
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index fae7e2e44..245b0a9b7 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -82,7 +82,7 @@ class Acl extends \Zotlabs\Web\Controller {
if($search) {
$sql_extra = " AND groups.gname 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) ? "%@%'" : "%'")) . ") ";
+ $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
@@ -92,7 +92,7 @@ class Acl extends \Zotlabs\Web\Controller {
$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($search)) . "' IN xchan_addr) end, ";
+ . "' IN xchan_name) else position('" . protect_sprintf(dbesc(punify($search))) . "' IN xchan_addr) end, ";
$col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' );
$sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
@@ -435,7 +435,7 @@ class Acl extends \Zotlabs\Web\Controller {
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
if($url) {
$query = $url . '?f=' . (($token) ? '&t=' . urlencode($token) : '');
- $query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode($search) : '');
+ $query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode(punify($search)) : '');
$x = z_fetch_url($query);
if($x['success']) {
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index 2e417edd1..0c7e089be 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -133,12 +133,13 @@ class Accounts {
$base = z_root() . '/admin/accounts?f=';
$odir = (($dir === 'asc') ? '0' : '1');
-
+
$users = q("SELECT account_id , account_email, account_lastlog, account_created, account_expires, account_service_class, ( account_flags & %d ) > 0 as blocked,
(SELECT %s FROM channel as ch WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as channels FROM account as ac
- where true $serviceclass order by $key $dir limit %d offset %d ",
+ where true $serviceclass and account_flags != %d order by $key $dir limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
+ intval(ACCOUNT_BLOCKED | ACCOUNT_PENDING),
intval(\App::$pager['itemspage']),
intval(\App::$pager['start'])
);
@@ -203,4 +204,4 @@ class Accounts {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php
index 64d4628ae..3ebafafa4 100644
--- a/Zotlabs/Module/Appman.php
+++ b/Zotlabs/Module/Appman.php
@@ -25,6 +25,7 @@ class Appman extends \Zotlabs\Web\Controller {
'photo' => escape_tags($_REQUEST['photo']),
'version' => escape_tags($_REQUEST['version']),
'price' => escape_tags($_REQUEST['price']),
+ 'page' => escape_tags($_REQUEST['page']),
'requires' => escape_tags($_REQUEST['requires']),
'system' => intval($_REQUEST['system']),
'plugin' => escape_tags($_REQUEST['plugin']),
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index e2e0fed5d..62ce1cb9c 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -127,21 +127,26 @@ class Articles extends \Zotlabs\Web\Controller {
$editor = '';
}
+ $itemspage = get_pconfig(local_channel(),'system','itemspage');
+ \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+
$sql_extra = item_permissions_sql($owner);
+ $sql_item = '';
if($selected_card) {
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.v = '%s' limit 1",
dbesc($selected_card)
);
if($r) {
- $sql_extra .= "and item.id = " . intval($r[0]['iid']) . " ";
+ $sql_item = "and item.id = " . intval($r[0]['iid']) . " ";
}
}
$r = q("select * from item
where item.uid = %d and item_type = %d
- $sql_extra order by item.created desc",
+ $sql_extra $sql_item order by item.created desc $pager_sql",
intval($owner),
intval(ITEM_TYPE_ARTICLE)
);
@@ -152,6 +157,8 @@ class Articles extends \Zotlabs\Web\Controller {
if($r) {
+ $pager_total = count($r);
+
$parents_str = ids_to_querystr($r,'id');
$items = q("SELECT item.*, item.id AS item_id
@@ -173,13 +180,18 @@ class Articles extends \Zotlabs\Web\Controller {
$mode = 'articles';
- $content = conversation($items,$mode,false,'traditional');
+ if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
+ $page_mode = 'pager_list';
+ else
+ $page_mode = 'traditional';
+
+ $content = conversation($items,$mode,false,$page_mode);
$o = replace_macros(get_markup_template('cards.tpl'), [
'$title' => t('Articles'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a,count($items))
+ '$pager' => alt_pager($a,$pager_total)
]);
return $o;
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index f87988183..d3b16e82e 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -131,20 +131,26 @@ class Cards extends \Zotlabs\Web\Controller {
}
+ $itemspage = get_pconfig(local_channel(),'system','itemspage');
+ \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+
+
$sql_extra = item_permissions_sql($owner);
+ $sql_item = '';
if($selected_card) {
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1",
dbesc($selected_card)
);
if($r) {
- $sql_extra .= "and item.id = " . intval($r[0]['iid']) . " ";
+ $sql_item = "and item.id = " . intval($r[0]['iid']) . " ";
}
}
$r = q("select * from item
where uid = %d and item_type = %d
- $sql_extra order by item.created desc",
+ $sql_extra $sql_item order by item.created desc $pager_sql",
intval($owner),
intval(ITEM_TYPE_CARD)
);
@@ -156,6 +162,8 @@ class Cards extends \Zotlabs\Web\Controller {
$items_result = [];
if($r) {
+ $pager_total = count($r);
+
$parents_str = ids_to_querystr($r, 'id');
$items = q("SELECT item.*, item.id AS item_id
@@ -175,13 +183,18 @@ class Cards extends \Zotlabs\Web\Controller {
$mode = 'cards';
- $content = conversation($items_result, $mode, false, 'traditional');
+ if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
+ $page_mode = 'pager_list';
+ else
+ $page_mode = 'traditional';
+
+ $content = conversation($items_result, $mode, false, $page_mode);
$o = replace_macros(get_markup_template('cards.tpl'), [
'$title' => t('Cards'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a, count($items_result))
+ '$pager' => alt_pager($a, $pager_total)
]);
return $o;
diff --git a/Zotlabs/Module/Chanview.php b/Zotlabs/Module/Chanview.php
index 24ab9b022..779c7e646 100644
--- a/Zotlabs/Module/Chanview.php
+++ b/Zotlabs/Module/Chanview.php
@@ -19,7 +19,7 @@ class Chanview extends \Zotlabs\Web\Controller {
}
if($_REQUEST['address']) {
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
- dbesc($_REQUEST['address'])
+ dbesc(punify($_REQUEST['address']))
);
}
elseif(local_channel() && intval($_REQUEST['cid'])) {
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 8b5476efc..34397d275 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -60,6 +60,12 @@ class Cloud extends \Zotlabs\Web\Controller {
// if we arrived at this path with any query parameters in the url, build a clean url without
// them and redirect.
+ if(! array_key_exists('cloud_sort',$_SESSION)) {
+ $_SESSION['cloud_sort'] = 'name';
+ }
+
+ $_SESSION['cloud_sort'] = (($_REQUEST['sort']) ? trim(notags($_REQUEST['sort'])) : $_SESSION['cloud_sort']);
+
$x = clean_query_string();
if($x !== \App::$query_string)
goaway(z_root() . '/' . $x);
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index 55e716ace..3bbdbf326 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -32,6 +32,7 @@ class Connections extends \Zotlabs\Web\Controller {
nav_set_selected('Connections');
+ $active = false;
$blocked = false;
$hidden = false;
$ignored = false;
@@ -44,11 +45,16 @@ class Connections extends \Zotlabs\Web\Controller {
if(! $_REQUEST['aj'])
$_SESSION['return_url'] = \App::$query_string;
- $search_flags = '';
+ $search_flags = "";
$head = '';
if(argc() == 2) {
switch(argv(1)) {
+ case 'active':
+ $search_flags = " and abook_blocked = 0 and abook_ignored = 0 and abook_hidden = 0 and abook_archived = 0 AND abook_not_here = 0 ";
+ $head = t('Active');
+ $active = true;
+ break;
case 'blocked':
$search_flags = " and abook_blocked = 1 ";
$head = t('Blocked');
@@ -101,8 +107,9 @@ class Connections extends \Zotlabs\Web\Controller {
case 'all':
$head = t('All');
default:
- $search_flags = '';
- $all = true;
+ $search_flags = " and abook_blocked = 0 and abook_ignored = 0 and abook_hidden = 0 and abook_archived = 0 and abook_not_here = 0 ";
+ $active = true;
+ $head = t('Active');
break;
}
@@ -129,6 +136,13 @@ class Connections extends \Zotlabs\Web\Controller {
),
*/
+ 'active' => array(
+ 'label' => t('Active Connections'),
+ 'url' => z_root() . '/connections/active',
+ 'sel' => ($active) ? 'active' : '',
+ 'title' => t('Show active connections'),
+ ),
+
'pending' => array(
'label' => t('New Connections'),
'url' => z_root() . '/connections/pending',
@@ -136,12 +150,6 @@ class Connections extends \Zotlabs\Web\Controller {
'title' => t('Show pending (new) connections'),
),
- 'all' => array(
- 'label' => t('All Connections'),
- 'url' => z_root() . '/connections/all',
- 'sel' => ($all) ? 'active' : '',
- 'title' => t('Show all connections'),
- ),
/*
array(
@@ -187,6 +195,13 @@ class Connections extends \Zotlabs\Web\Controller {
// 'title' => t('Only show one-way connections'),
// ),
+
+ 'all' => array(
+ 'label' => t('All Connections'),
+ 'url' => z_root() . '/connections',
+ 'sel' => ($all) ? 'active' : '',
+ 'title' => t('Show all connections'),
+ ),
);
@@ -238,6 +253,7 @@ class Connections extends \Zotlabs\Web\Controller {
$status_str = '';
$status = array(
+ ((intval($rr['abook_active'])) ? t('Active') : ''),
((intval($rr['abook_pending'])) ? t('Pending approval') : ''),
((intval($rr['abook_archived'])) ? t('Archived') : ''),
((intval($rr['abook_hidden'])) ? t('Hidden') : ''),
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 8e8a1ed24..fa29ce66c 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -134,6 +134,40 @@ class Display extends \Zotlabs\Web\Controller {
return '';
}
}
+ if($target_item['item_type'] == ITEM_TYPE_ARTICLE) {
+ $x = q("select * from channel where channel_id = %d limit 1",
+ intval($target_item['uid'])
+ );
+ $y = q("select * from iconfig left join item on iconfig.iid = item.id
+ where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and item.id = %d limit 1",
+ intval($target_item['uid']),
+ intval($target_item['id'])
+ );
+ if($x && $y) {
+ goaway(z_root() . '/articles/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
+ }
+ else {
+ notice( t('Page not found.') . EOL);
+ return '';
+ }
+ }
+ if($target_item['item_type'] == ITEM_TYPE_CARD) {
+ $x = q("select * from channel where channel_id = %d limit 1",
+ intval($target_item['uid'])
+ );
+ $y = q("select * from iconfig left join item on iconfig.iid = item.id
+ where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'CARD' and item.id = %d limit 1",
+ intval($target_item['uid']),
+ intval($target_item['id'])
+ );
+ if($x && $y) {
+ goaway(z_root() . '/cards/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
+ }
+ else {
+ notice( t('Page not found.') . EOL);
+ return '';
+ }
+ }
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php
index 146c4e564..cbf9d62c5 100644
--- a/Zotlabs/Module/Follow.php
+++ b/Zotlabs/Module/Follow.php
@@ -14,7 +14,7 @@ class Follow extends \Zotlabs\Web\Controller {
}
$uid = local_channel();
- $url = notags(trim($_REQUEST['url']));
+ $url = notags(trim(punify($_REQUEST['url'])));
$return_url = $_SESSION['return_url'];
$confirm = intval($_REQUEST['confirm']);
$interactive = (($_REQUEST['interactive']) ? intval($_REQUEST['interactive']) : 1);
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 3f857030b..fba2ef7a4 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -830,6 +830,12 @@ class Item extends \Zotlabs\Web\Controller {
$datarray['plink'] = $plink;
$datarray['route'] = $route;
+
+ // A specific ACL over-rides public_policy completely
+
+ if(! empty_acl($datarray))
+ $datarray['public_policy'] = '';
+
if($iconfig)
$datarray['iconfig'] = $iconfig;
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php
index cf1625a6b..10c8ab8f2 100644
--- a/Zotlabs/Module/Moderate.php
+++ b/Zotlabs/Module/Moderate.php
@@ -47,17 +47,26 @@ class Moderate extends \Zotlabs\Web\Controller {
);
if($r) {
+ $item = $r[0];
+
if($action === 'approve') {
q("update item set item_blocked = 0 where uid = %d and id = %d",
intval(local_channel()),
intval($post_id)
);
+
+ $item['item_blocked'] = 0;
+
+ item_update_parent_commented($item);
+
notice( t('Comment approved') . EOL);
}
elseif($action === 'drop') {
drop_item($post_id,false);
notice( t('Comment deleted') . EOL);
}
+
+ // refetch the item after changes have been made
$r = q("select * from item where id = %d",
intval($post_id)
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 548f28c4f..ea9f27447 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -16,8 +16,15 @@ class New_channel extends \Zotlabs\Web\Controller {
require_once('library/urlify/URLify.php');
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['name']);
-
- $x = strtolower(\URLify::transliterate($n));
+
+ $x = false;
+
+ if(get_config('system','unicode_usernames')) {
+ $x = punify(mb_strtolower($n));
+ }
+
+ if((! $x) || strlen($x) > 64)
+ $x = strtolower(\URLify::transliterate($n));
$test = array();
@@ -43,7 +50,14 @@ class New_channel extends \Zotlabs\Web\Controller {
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['nick']);
- $x = strtolower(\URLify::transliterate($n));
+ $x = false;
+
+ if(get_config('system','unicode_usernames')) {
+ $x = punify(mb_strtolower($n));
+ }
+
+ if((! $x) || strlen($x) > 64)
+ $x = strtolower(\URLify::transliterate($n));
$test = array();
diff --git a/Zotlabs/Module/Ochannel.php b/Zotlabs/Module/Ochannel.php
new file mode 100644
index 000000000..508be1408
--- /dev/null
+++ b/Zotlabs/Module/Ochannel.php
@@ -0,0 +1,69 @@
+<?php
+
+namespace Zotlabs\Module;
+
+require_once('include/contact_widgets.php');
+require_once('include/items.php');
+require_once("include/bbcode.php");
+require_once('include/security.php');
+require_once('include/conversation.php');
+require_once('include/acl_selectors.php');
+require_once('include/permissions.php');
+
+/**
+ * @brief Channel Controller for broken OStatus implementations
+ *
+ */
+class Ochannel extends \Zotlabs\Web\Controller {
+
+ function init() {
+
+ $which = null;
+ if(argc() > 1)
+ $which = argv(1);
+ if(! $which) {
+ if(local_channel()) {
+ $channel = \App::get_channel();
+ if($channel && $channel['channel_address'])
+ $which = $channel['channel_address'];
+ }
+ }
+ if(! $which) {
+ notice( t('You must be logged in to see this page.') . EOL );
+ return;
+ }
+
+ $profile = 0;
+ $channel = \App::get_channel();
+
+ if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
+ $which = $channel['channel_address'];
+ $profile = argv(1);
+ }
+
+ head_add_link( [
+ 'rel' => 'alternate',
+ 'type' => 'application/atom+xml',
+ 'href' => z_root() . '/ofeed/' . $which
+ ]);
+
+
+ // Run profile_load() here to make sure the theme is set before
+ // we start loading content
+
+ profile_load($which,$profile);
+ }
+
+ function get($update = 0, $load = false) {
+
+ if(argc() < 2)
+ return;
+
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
+ return '<script>window.location.href = "' . z_root() . '/' . str_replace('ochannel/','channel/',\App::$query_string) . '";</script>';
+
+ }
+
+}
diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php
index bb3a13b56..ec40bf9db 100644
--- a/Zotlabs/Module/Oep.php
+++ b/Zotlabs/Module/Oep.php
@@ -125,6 +125,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -209,6 +210,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -292,6 +294,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -366,6 +369,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index b1cf9596c..e02cb33db 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -655,7 +655,7 @@ class Profiles extends \Zotlabs\Web\Controller {
intval($id),
intval(local_channel())
);
- if(! count($r)) {
+ if(! $r) {
notice( t('Profile not found.') . EOL);
return;
}
@@ -712,13 +712,10 @@ class Profiles extends \Zotlabs\Web\Controller {
$tpl = get_markup_template("profile_edit.tpl");
$o .= replace_macros($tpl,array(
-
+ '$multi_profiles' => ((feature_enabled(local_channel(),'multi_profiles')) ? true : false),
'$form_security_token' => get_form_security_token("profile_edit"),
- '$profile_clone_link' => ((feature_enabled(local_channel(),'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t='
- . get_form_security_token("profile_clone") : ''),
- '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t='
- . get_form_security_token("profile_drop"),
-
+ '$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"),
+ '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$fields' => $fields,
'$vcard' => $vcard,
'$guid' => $r[0]['profile_guid'],
@@ -786,22 +783,22 @@ class Profiles extends \Zotlabs\Web\Controller {
'$channels' => array('channels', t('My other channels'), $r[0]['channels']),
'$extra_fields' => $extra_fields,
'$comms' => t('Communications'),
- '$tel_label' => t('Phone'),
- '$email_label' => t('Email'),
- '$impp_label' => t('Instant messenger'),
- '$url_label' => t('Website'),
- '$adr_label' => t('Address'),
- '$note_label' => t('Note'),
- '$mobile' => t('Mobile'),
- '$home' => t('Home'),
- '$work' => t('Work'),
- '$other' => t('Other'),
- '$add_card' => t('Add Contact'),
- '$add_field' => t('Add Field'),
- '$create' => t('Create'),
- '$update' => t('Update'),
- '$delete' => t('Delete'),
- '$cancel' => t('Cancel'),
+ '$tel_label' => t('Phone'),
+ '$email_label' => t('Email'),
+ '$impp_label' => t('Instant messenger'),
+ '$url_label' => t('Website'),
+ '$adr_label' => t('Address'),
+ '$note_label' => t('Note'),
+ '$mobile' => t('Mobile'),
+ '$home' => t('Home'),
+ '$work' => t('Work'),
+ '$other' => t('Other'),
+ '$add_card' => t('Add Contact'),
+ '$add_field' => t('Add Field'),
+ '$create' => t('Create'),
+ '$update' => t('Update'),
+ '$delete' => t('Delete'),
+ '$cancel' => t('Cancel'),
));
$arr = array('profile' => $r[0], 'entry' => $o);
diff --git a/Zotlabs/Module/Regmod.php b/Zotlabs/Module/Regmod.php
index c7e5c44aa..70635d707 100644
--- a/Zotlabs/Module/Regmod.php
+++ b/Zotlabs/Module/Regmod.php
@@ -35,6 +35,8 @@ class Regmod extends \Zotlabs\Web\Controller {
if($cmd === 'allow') {
if (! account_allow($hash)) killme();
}
+
+ goaway('/admin/accounts');
}
}
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index 5d2f0d7e8..e6ea52845 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -111,43 +111,7 @@ class Rpost extends \Zotlabs\Web\Controller {
}
if($_REQUEST['post_id']) {
- $r = q("SELECT * from item WHERE id = %d LIMIT 1",
- intval($_REQUEST['post_id'])
- );
- if(($r) && (! intval($r[0]['item_private']))) {
- $sql_extra = item_permissions_sql($r[0]['uid']);
-
- $r = q("select * from item where id = %d $sql_extra",
- intval($_REQUEST['post_id'])
- );
- if($r && $r[0]['mimetype'] === 'text/bbcode') {
-
- xchan_query($r);
-
- $is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
- if($is_photo) {
- $object = json_decode($r[0]['obj'],true);
- $photo_bb = $object['body'];
- }
-
- if (strpos($r[0]['body'], "[/share]") !== false) {
- $pos = strpos($r[0]['body'], "[share");
- $i = substr($r[0]['body'], $pos);
- } else {
- $i = "[share author='".urlencode($r[0]['author']['xchan_name']).
- "' profile='".$r[0]['author']['xchan_url'] .
- "' avatar='".$r[0]['author']['xchan_photo_s'].
- "' link='".$r[0]['plink'].
- "' posted='".$r[0]['created'].
- "' message_id='".$r[0]['mid']."']";
- if($r[0]['title'])
- $i .= '[b]'.$r[0]['title'].'[/b]'."\r\n";
- $i .= (($is_photo) ? $photo_bb . "\r\n" . $r[0]['body'] : $r[0]['body']);
- $i .= "[/share]";
- }
- }
- }
- $_REQUEST['body'] = $_REQUEST['body'] . $i;
+ $_REQUEST['body'] .= '[share=' . intval($_REQUEST['post_id']) . '][/share]';
}
$x = array(
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index fb8284d2e..139e5f966 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -202,7 +202,7 @@ class Channel {
$vnotify += intval($_POST['vnotify9']);
if(x($_POST,'vnotify10'))
$vnotify += intval($_POST['vnotify10']);
- if(x($_POST,'vnotify11'))
+ if(x($_POST,'vnotify11') && is_site_admin())
$vnotify += intval($_POST['vnotify11']);
if(x($_POST,'vnotify12'))
$vnotify += intval($_POST['vnotify12']);
@@ -569,7 +569,7 @@ class Channel {
'$vnotify8' => array('vnotify8', t('System info messages'), ($vnotify & VNOTIFY_INFO), VNOTIFY_INFO, t('Recommended'), $yes_no),
'$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended'), $yes_no),
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no),
- '$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no),
+ '$vnotify11' => ((is_site_admin()) ? array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no) : array()),
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
'$vnotify13' => (($disable_discover_tab) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ],
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index 7f4d8b1eb..c6d0be051 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,10 +14,15 @@ class Share extends \Zotlabs\Web\Controller {
if(! $post_id)
killme();
-
echo '[share=' . $post_id . '][/share]';
killme();
+
+ /**
+ * The remaining code is deprecated and handled in Zotlabs/Lib/Share.php at post
+ * submission time.
+ */
+
if(! (local_channel() || remote_channel()))
killme();
@@ -60,12 +65,14 @@ class Share extends \Zotlabs\Web\Controller {
$pos = strpos($r[0]['body'], "[share");
$o = substr($r[0]['body'], $pos);
} else {
- $o = "[share author='".urlencode($r[0]['author']['xchan_name']).
- "' profile='".$r[0]['author']['xchan_url'] .
- "' avatar='".$r[0]['author']['xchan_photo_s'].
- "' link='".$r[0]['plink'].
- "' posted='".$r[0]['created'].
- "' message_id='".$r[0]['mid']."']";
+ $o = "[share author='" . urlencode($r[0]['author']['xchan_name']) .
+ "' profile='" . $r[0]['author']['xchan_url'] .
+ "' avatar='" . $r[0]['author']['xchan_photo_s'] .
+ "' link='" . $r[0]['plink'] .
+ "' auth='" . (($r[0]['author']['network'] === 'zot') ? 'true' : 'false') .
+ "' posted='" . $r[0]['created'] .
+ "' message_id='" . $r[0]['mid'] .
+ "']";
if($r[0]['title'])
$o .= '[b]'.$r[0]['title'].'[/b]'."\r\n";
$o .= (($is_photo) ? $photo_bb . "\r\n" . $r[0]['body'] : $r[0]['body']);
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index 510d463c1..a2ae0fee8 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -680,7 +680,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
throw new DAV\Exception\Forbidden('Permission denied.');
}
else {
- throw new DAV\Exception\NotFound('A component of the request file path could not be found.');
+ throw new DAV\Exception\NotFound('A component of the requested file path could not be found.');
}
}
@@ -691,7 +691,23 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
}
$prefix = '';
- $suffix = ' order by is_dir desc, filename asc ';
+
+ if(! array_key_exists('cloud_sort',$_SESSION))
+ $_SESSION['cloud_sort'] = 'name';
+
+ switch($_SESSION['cloud_sort']) {
+ case 'size':
+ $suffix = ' order by is_dir desc, filesize asc ';
+ break;
+ // The following provides inconsistent results for directories because we re-calculate the date for directories based on the most recent change
+ case 'date':
+ $suffix = ' order by is_dir desc, edited asc ';
+ break;
+ case 'name':
+ default:
+ $suffix = ' order by is_dir desc, filename asc ';
+ break;
+ }
$r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach where folder = '%s' and uid = %d $perms $suffix",
dbesc($folder),
diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php
index cdb70e23d..afa808e6f 100644
--- a/Zotlabs/Widget/Newmember.php
+++ b/Zotlabs/Widget/Newmember.php
@@ -9,16 +9,17 @@ class Newmember {
if(! local_channel())
return EMPTY_STR;
+ if(get_pconfig(local_channel(), 'system', 'disable_newmemberwidget'))
+ return EMPTY_STR;
+
$c = \App::get_channel();
if(! $c)
return EMPTY_STR;
-
$a = \App::get_account();
if(! $a)
return EMPTY_STR;
-
if(datetime_convert('UTC','UTC',$a['account_created']) < datetime_convert('UTC','UTC', 'now - 60 days'))
return EMPTY_STR;
@@ -46,7 +47,7 @@ class Newmember {
t('Communicate'),
[
- 'channel/' . $channel['channel_address'] => t('View your channel homepage'),
+ 'channel/' . $c['channel_address'] => t('View your channel homepage'),
'network' => t('View your network stream'),
],