aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-05-24 05:35:50 -0400
committerAndrew Manning <tamanning@zoho.com>2018-05-24 05:35:50 -0400
commitfc6b337bbbd2fd3b5412c8b957122830f73feb2d (patch)
treee8417e561ac7445a4018c0cf3bf722779493c430 /Zotlabs
parent40d99c171678654817e392b7f59050dccce770a8 (diff)
parent9cf8931136c703c66d0bf83e4c6b8fb7f4d2cf0b (diff)
downloadvolse-hubzilla-fc6b337bbbd2fd3b5412c8b957122830f73feb2d.tar.gz
volse-hubzilla-fc6b337bbbd2fd3b5412c8b957122830f73feb2d.tar.bz2
volse-hubzilla-fc6b337bbbd2fd3b5412c8b957122830f73feb2d.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Apps.php2
-rw-r--r--Zotlabs/Lib/ThreadItem.php4
-rw-r--r--Zotlabs/Module/Admin.php8
-rw-r--r--Zotlabs/Module/Admin/Site.php4
-rw-r--r--Zotlabs/Module/Channel.php3
-rw-r--r--Zotlabs/Module/Display.php6
-rw-r--r--Zotlabs/Module/Hq.php6
-rw-r--r--Zotlabs/Module/Network.php3
-rw-r--r--Zotlabs/Module/New_channel.php31
-rw-r--r--Zotlabs/Module/Oauthinfo.php23
-rw-r--r--Zotlabs/Module/Photo.php5
-rw-r--r--Zotlabs/Module/Pubstream.php6
-rw-r--r--Zotlabs/Module/Removeme.php2
-rw-r--r--Zotlabs/Module/Settings/Oauth2.php29
-rw-r--r--Zotlabs/Module/Well_known.php10
-rw-r--r--Zotlabs/Update/_1213.php28
-rw-r--r--Zotlabs/Update/_1214.php57
17 files changed, 187 insertions, 40 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 24cb4a626..2dded1aaa 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -45,6 +45,8 @@ class Apps {
}
}
+ call_hooks('get_system_apps',$ret);
+
return $ret;
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index c7a2c9373..0fed78158 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -102,6 +102,9 @@ class ThreadItem {
if($item['author']['xchan_network'] === 'rss')
$shareable = true;
+ $privacy_warning = false;
+ if($item['owner']['xchan_network'] === 'activitypub')
+ $privacy_warning = true;
$mode = $conv->get_mode();
@@ -370,6 +373,7 @@ class ThreadItem {
'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''),
'expiretime' => (($item['expires'] > NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''),
'lock' => $lock,
+ 'privacy_warning' => $privacy_warning,
'verified' => $verified,
'unverified' => $unverified,
'forged' => $forged,
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 30f3dfa48..934312efe 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -100,8 +100,12 @@ class Admin extends \Zotlabs\Web\Controller {
}
// pending registrations
- $r = q("SELECT COUNT(id) AS rtotal FROM register WHERE uid != '0'");
- $pending = $r[0]['rtotal'];
+
+ $pdg = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d ) > 0 ",
+ intval(ACCOUNT_PENDING)
+ );
+
+ $pending = (($pdg) ? count($pdg) : 0);
// available channels, primary and clones
$channels = array();
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index ff4f56ac8..292de4c3a 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -344,8 +344,8 @@ class Site {
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
'$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
'$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the Public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing. Warning: this content is unmoderated.')),
- '$incl' => array('pub_incl',t('Only import Public stream posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
- '$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$incl' => array('pub_incl',t('Only import Public stream posts with this text'), get_config('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), get_config('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 9ce57d6eb..327ca53db 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -152,7 +152,8 @@ class Channel extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
);
$o .= status_editor($a,$x);
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 06c9479b2..a127ab196 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -67,8 +67,7 @@ class Display extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
-
- 'acl' => populate_acl($channel_acl),
+ 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@@ -78,7 +77,8 @@ class Display extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
);
$o = '<div id="jot-popup">';
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index baeba82e8..fee4246c0 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -120,8 +120,7 @@ class Hq extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
-
- 'acl' => populate_acl($channel_acl),
+ 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@@ -131,7 +130,8 @@ class Hq extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
];
$o = replace_macros(get_markup_template("hq.tpl"),
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 2d6307eb1..82c88e565 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -185,7 +185,8 @@ class Network extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
);
if($deftag)
$x['pretext'] = $deftag;
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index df7da2fe8..97a46a43e 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -41,7 +41,7 @@ class New_channel extends \Zotlabs\Web\Controller {
$test[] = legal_webbie($x);
// fullname plus random number
$test[] = legal_webbie($x) . mt_rand(1000,9999);
-
+
json_return_and_die(check_webbie($test));
}
@@ -49,7 +49,10 @@ class New_channel extends \Zotlabs\Web\Controller {
require_once('library/urlify/URLify.php');
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['nick']);
-
+ if(! $n) {
+ $n = trim($_REQUEST['name']);
+ }
+
$x = false;
if(get_config('system','unicode_usernames')) {
@@ -58,9 +61,20 @@ class New_channel extends \Zotlabs\Web\Controller {
if((! $x) || strlen($x) > 64)
$x = strtolower(\URLify::transliterate($n));
-
+
+
$test = array();
+ // first name
+ if(strpos($x,' '))
+ $test[] = legal_webbie(substr($x,0,strpos($x,' ')));
+ if($test[0]) {
+ // first name plus first initial of last
+ $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : '');
+ // first name plus random number
+ $test[] = $test[0] . mt_rand(1000,9999);
+ }
+
$n = legal_webbie($x);
if(strlen($n)) {
$test[] = $n;
@@ -137,16 +151,19 @@ class New_channel extends \Zotlabs\Web\Controller {
}
}
- $name_help = (($default_role)
+ $name_help = '<span id="name_help_loading" style="display:none">' . t('Loading') . '</span><span id="name_help_text">';
+ $name_help .= (($default_role)
? t('Your real name is recommended.')
: t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')
- );
-
- $nick_help = t('This will be used to create a unique network address (like an email address).');
+ );
+ $name_help .= '</span>';
+ $nick_help = '<span id="nick_help_loading" style="display:none">' . t('Loading') . '</span><span id="nick_help_text">';
+ $nick_help .= t('This will be used to create a unique network address (like an email address).');
if(! get_config('system','unicode_usernames')) {
$nick_help .= ' ' . t('Allowed characters are a-z 0-9, - and _');
}
+ $nick_help .= '<span>';
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
diff --git a/Zotlabs/Module/Oauthinfo.php b/Zotlabs/Module/Oauthinfo.php
new file mode 100644
index 000000000..2d10913c4
--- /dev/null
+++ b/Zotlabs/Module/Oauthinfo.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Oauthinfo extends \Zotlabs\Web\Controller {
+
+
+ function init() {
+
+ $ret = [
+ 'issuer' => z_root(),
+ 'authorization_endpoint' => z_root() . '/authorize',
+ 'token_endpoint' => z_root() . '/token',
+ 'response_types_supported' => [ 'code', 'token', 'id_token', 'code id_token', 'token id_token' ]
+ ];
+
+
+ json_return_and_die($ret);
+ }
+
+
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index f348866d9..8efc00707 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -14,7 +14,8 @@ class Photo extends \Zotlabs\Web\Controller {
$prvcachecontrol = false;
$streaming = null;
$channel = null;
-
+ $person = 0;
+
switch(argc()) {
case 4:
$person = argv(3);
@@ -31,7 +32,7 @@ class Photo extends \Zotlabs\Web\Controller {
}
$observer_xchan = get_observer_hash();
-
+
$default = z_root() . '/' . get_default_profile_photo();
if(isset($type)) {
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 571118201..f0e87f468 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -66,8 +66,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
-
- 'acl' => populate_acl($channel_acl),
+ 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@@ -77,7 +76,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode',
'bbcode' => true,
- 'jotnets' => true
+ 'jotnets' => true,
+ 'reset' => t('Reset form')
);
$o = '<div id="jot-popup">';
diff --git a/Zotlabs/Module/Removeme.php b/Zotlabs/Module/Removeme.php
index 111230937..451e280c3 100644
--- a/Zotlabs/Module/Removeme.php
+++ b/Zotlabs/Module/Removeme.php
@@ -38,7 +38,7 @@ class Removeme extends \Zotlabs\Web\Controller {
}
$global_remove = intval($_POST['global']);
-
+
channel_remove(local_channel(),1 - $global_remove,true);
}
diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Settings/Oauth2.php
index 88bbea3b8..985095115 100644
--- a/Zotlabs/Module/Settings/Oauth2.php
+++ b/Zotlabs/Module/Settings/Oauth2.php
@@ -14,7 +14,8 @@ class Oauth2 {
$key = $_POST['remove'];
q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
dbesc($key),
- local_channel());
+ intval(local_channel())
+ );
goaway(z_root()."/settings/oauth2/");
return;
}
@@ -43,24 +44,24 @@ class Oauth2 {
redirect_uri = '%s',
grant_types = '%s',
scope = '%s',
- user_id = '%s'
+ user_id = %d
WHERE client_id='%s'",
dbesc($name),
dbesc($secret),
dbesc($redirect),
dbesc($grant),
dbesc($scope),
- dbesc(local_channel()),
+ intval(local_channel()),
dbesc($name));
} else {
$r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
- VALUES ('%s','%s','%s','%s','%s','%s')",
+ VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($name),
dbesc($secret),
dbesc($redirect),
dbesc($grant),
dbesc($scope),
- dbesc(local_channel())
+ intval(local_channel())
);
$r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
dbesc($name),
@@ -93,9 +94,9 @@ class Oauth2 {
}
if((argc() > 3) && (argv(2) === 'edit')) {
- $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= '%s'",
+ $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= %d",
dbesc(argv(3)),
- dbesc(local_channel())
+ intval(local_channel())
);
if (! $r){
@@ -123,21 +124,21 @@ class Oauth2 {
if((argc() > 3) && (argv(2) === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't');
- $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = '%s'",
+ $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = %d",
dbesc(argv(3)),
- dbesc(local_channel())
+ intval(local_channel())
);
goaway(z_root()."/settings/oauth2/");
return;
}
- $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = '%s') AS my
+ $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = %d) AS my
FROM oauth_clients
LEFT JOIN oauth_access_tokens ON oauth_clients.client_id=oauth_access_tokens.client_id
- WHERE oauth_clients.user_id IN ('%s',0)",
- dbesc(local_channel()),
- dbesc(local_channel())
+ WHERE oauth_clients.user_id IN (%d,0)",
+ intval(local_channel()),
+ intval(local_channel())
);
$tpl = get_markup_template("settings_oauth2.tpl");
@@ -157,4 +158,4 @@ class Oauth2 {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Well_known.php b/Zotlabs/Module/Well_known.php
index 177de2323..442994b54 100644
--- a/Zotlabs/Module/Well_known.php
+++ b/Zotlabs/Module/Well_known.php
@@ -50,7 +50,15 @@ class Well_known extends \Zotlabs\Web\Controller {
$module = new \Zotlabs\Module\Hostxrd();
$module->init();
break;
-
+
+ case 'oauth-authorization-server':
+ \App::$argc -= 1;
+ array_shift(\App::$argv);
+ \App::$argv[0] = 'oauthinfo';
+ $module = new \Zotlabs\Module\Oauthinfo();
+ $module->init();
+ break;
+
case 'dnt-policy.txt':
echo file_get_contents('doc/dnt-policy.txt');
killme();
diff --git a/Zotlabs/Update/_1213.php b/Zotlabs/Update/_1213.php
new file mode 100644
index 000000000..d396829a6
--- /dev/null
+++ b/Zotlabs/Update/_1213.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1213 {
+
+ function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ q("START TRANSACTION");
+
+ $r = q("ALTER TABLE abconfig
+ DROP INDEX chan,
+ DROP INDEX xchan,
+ ADD INDEX chan_xchan (chan, xchan)
+ ");
+
+ if($r) {
+ q("COMMIT");
+ return UPDATE_SUCCESS;
+ }
+ else {
+ q("ROLLBACK");
+ return UPDATE_FAILED;
+ }
+ }
+ }
+
+}
diff --git a/Zotlabs/Update/_1214.php b/Zotlabs/Update/_1214.php
new file mode 100644
index 000000000..06e5d96ed
--- /dev/null
+++ b/Zotlabs/Update/_1214.php
@@ -0,0 +1,57 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1214 {
+
+ function run() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ q("START TRANSACTION");
+
+ $r1 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id TYPE bigint USING user_id::bigint");
+ $r2 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id SET NOT NULL");
+ $r3 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id SET DEFAULT 0");
+
+ $r4 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id TYPE bigint USING user_id::bigint");
+ $r5 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id SET NOT NULL");
+ $r6 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id SET DEFAULT 0");
+
+ $r7 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id TYPE bigint USING user_id::bigint");
+ $r8 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id SET NOT NULL");
+ $r9 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id SET DEFAULT 0");
+
+ $r10 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id TYPE bigint USING user_id::bigint");
+ $r11 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id SET NOT NULL");
+ $r12 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id SET DEFAULT 0");
+
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12) {
+ q("COMMIT");
+ return UPDATE_SUCCESS;
+ }
+ else {
+ q("ROLLBACK");
+ return UPDATE_FAILED;
+ }
+ }
+ else {
+ q("START TRANSACTION");
+
+ $r1 = q("ALTER TABLE oauth_clients MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0");
+ $r2 = q("ALTER TABLE oauth_access_tokens MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0");
+ $r3 = q("ALTER TABLE oauth_authorization_codes MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0");
+ $r4 = q("ALTER TABLE oauth_refresh_tokens MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0");
+
+ if($r1 && $r2 && $r3 && $r4) {
+ q("COMMIT");
+ return UPDATE_SUCCESS;
+ }
+ else {
+ q("ROLLBACK");
+ return UPDATE_FAILED;
+ }
+
+ }
+ }
+
+}