aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-03-13 10:59:21 +0100
committerGitHub <noreply@github.com>2018-03-13 10:59:21 +0100
commit790660e61264ed884a8c600f407cf75893ffe977 (patch)
tree8fb3e4263cd7cdf4b34e0d7bb859c2f290c8ab39 /Zotlabs
parent2bcfa0c12687d47c11e8c445a5a38ffe96d5c135 (diff)
parent53c1d3775cc140ecda50d837752adac851d9e0b2 (diff)
downloadvolse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.gz
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.bz2
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.zip
Merge pull request #18 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/DReport.php (renamed from Zotlabs/Zot/DReport.php)2
-rw-r--r--Zotlabs/Lib/Enotify.php17
-rw-r--r--Zotlabs/Lib/ProtoDriver.php19
-rw-r--r--Zotlabs/Lib/Verify.php (renamed from Zotlabs/Zot/Verify.php)2
-rw-r--r--Zotlabs/Lib/ZotDriver.php30
-rw-r--r--Zotlabs/Module/Admin/Profs.php39
-rw-r--r--Zotlabs/Module/Admin/Site.php30
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--Zotlabs/Module/Cloud.php3
-rw-r--r--Zotlabs/Module/Cover_photo.php17
-rw-r--r--Zotlabs/Module/Directory.php7
-rw-r--r--Zotlabs/Module/Display.php5
-rw-r--r--Zotlabs/Module/Email_validation.php11
-rw-r--r--Zotlabs/Module/Embedphotos.php2
-rw-r--r--Zotlabs/Module/Follow.php22
-rw-r--r--Zotlabs/Module/Go.php3
-rw-r--r--Zotlabs/Module/Hashtags.php27
-rw-r--r--Zotlabs/Module/Import.php21
-rw-r--r--Zotlabs/Module/Item.php6
-rw-r--r--Zotlabs/Module/Magic.php2
-rw-r--r--Zotlabs/Module/New_channel.php20
-rw-r--r--Zotlabs/Module/Owa.php2
-rw-r--r--Zotlabs/Module/Profile_photo.php34
-rw-r--r--Zotlabs/Module/Pubstream.php8
-rw-r--r--Zotlabs/Module/Register.php6
-rw-r--r--Zotlabs/Module/Settings/Account.php2
-rw-r--r--Zotlabs/Module/Settings/Featured.php22
-rw-r--r--Zotlabs/Module/Setup.php20
-rw-r--r--Zotlabs/Module/Sitelist.php4
-rw-r--r--Zotlabs/Module/Thing.php5
-rw-r--r--Zotlabs/Module/Viewconnections.php10
-rw-r--r--Zotlabs/Module/Wfinger.php3
-rw-r--r--Zotlabs/Storage/Browser.php5
-rw-r--r--Zotlabs/Update/_1204.php34
-rw-r--r--Zotlabs/Update/_1205.php38
-rw-r--r--Zotlabs/Update/_1206.php24
-rw-r--r--Zotlabs/Update/_1207.php24
-rw-r--r--Zotlabs/Update/_1208.php26
-rw-r--r--Zotlabs/Update/_1209.php26
-rw-r--r--Zotlabs/Web/HTTPSig.php117
-rw-r--r--Zotlabs/Widget/Newmember.php83
-rw-r--r--Zotlabs/Widget/Notifications.php9
-rw-r--r--Zotlabs/Widget/Settings_menu.php6
43 files changed, 618 insertions, 177 deletions
diff --git a/Zotlabs/Zot/DReport.php b/Zotlabs/Lib/DReport.php
index c90f4f670..a68d6c18f 100644
--- a/Zotlabs/Zot/DReport.php
+++ b/Zotlabs/Lib/DReport.php
@@ -1,5 +1,5 @@
<?php
-namespace Zotlabs\Zot;
+namespace Zotlabs\Lib;
class DReport {
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index c5bc706c2..61c98c881 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -63,7 +63,9 @@ class Enotify {
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
-
+ $opt_out1 = sprintf( t('This email was sent by %1$s at %2$s.'), t('$Projectname'), \App::get_hostname());
+ $opt_out2 = sprintf( t('To stop receiving these messages, please adjust your Notification Settings at %s'), z_root() . '/settings');
+ $hopt_out2 = sprintf( t('To stop receiving these messages, please adjust your %s.'), '<a href="' . z_root() . '/settings' . '">' . t('Notification Settings') . '</a>');
$sender_name = $product;
$hostname = \App::get_hostname();
if(strpos($hostname,':'))
@@ -136,7 +138,7 @@ class Enotify {
$itemlink = $params['link'];
- $action = 'commented on';
+ $action = t('commented on');
if(array_key_exists('item',$params) && in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
@@ -147,10 +149,10 @@ class Enotify {
}
if(activity_match($params['verb'], ACTIVITY_LIKE))
- $action = 'liked';
+ $action = t('liked');
if(activity_match($params['verb'], ACTIVITY_DISLIKE))
- $action = 'disliked';
+ $action = t('disliked');
}
@@ -613,6 +615,9 @@ class Enotify {
$datarray['titemlink'] = $itemlink;
$datarray['thanks'] = $thanks;
$datarray['site_admin'] = $site_admin;
+ $datarray['opt_out1'] = $opt_out1;
+ $datarray['opt_out2'] = $opt_out2;
+ $datarray['hopt_out2'] = $hopt_out2;
$datarray['title'] = stripslashes($title);
$datarray['htmlversion'] = $htmlversion;
$datarray['textversion'] = $textversion;
@@ -670,6 +675,8 @@ class Enotify {
'$hitemlink' => $datarray['hitemlink'],
'$thanks' => $datarray['thanks'],
'$site_admin' => $datarray['site_admin'],
+ '$opt_out1' => $datarray['opt_out1'],
+ '$opt_out2' => $datarray['hopt_out2'],
'$title' => $datarray['title'],
'$htmlversion' => $datarray['htmlversion'],
));
@@ -690,6 +697,8 @@ class Enotify {
'$titemlink' => $datarray['titemlink'],
'$thanks' => $datarray['thanks'],
'$site_admin' => $datarray['site_admin'],
+ '$opt_out1' => $datarray['opt_out1'],
+ '$opt_out2' => $datarray['opt_out2'],
'$title' => $datarray['title'],
'$textversion' => $datarray['textversion'],
));
diff --git a/Zotlabs/Lib/ProtoDriver.php b/Zotlabs/Lib/ProtoDriver.php
deleted file mode 100644
index daf887dbb..000000000
--- a/Zotlabs/Lib/ProtoDriver.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php /** @file */
-
-namespace Zotlabs\Lib;
-
-/*
- * Abstraction class for dealing with alternate networks (which of course do not exist, hence the abstraction)
- */
-
-
-abstract class ProtoDriver {
- abstract protected function discover($channel,$location);
- abstract protected function deliver($item,$channel,$recipients);
- abstract protected function collect($channel,$connection);
- abstract protected function change_permissions($permissions,$channel,$recipient);
- abstract protected function acknowledge_permissions($permissions,$channel,$recipient);
- abstract protected function deliver_private($item,$channel,$recipients);
- abstract protected function collect_private($channel,$connection);
-
-}
diff --git a/Zotlabs/Zot/Verify.php b/Zotlabs/Lib/Verify.php
index 7abe38d17..8703e29e6 100644
--- a/Zotlabs/Zot/Verify.php
+++ b/Zotlabs/Lib/Verify.php
@@ -1,6 +1,6 @@
<?php
-namespace Zotlabs\Zot;
+namespace Zotlabs\Lib;
class Verify {
diff --git a/Zotlabs/Lib/ZotDriver.php b/Zotlabs/Lib/ZotDriver.php
deleted file mode 100644
index e14cc7f35..000000000
--- a/Zotlabs/Lib/ZotDriver.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php /** @file */
-
-namespace Zotlabs\Lib;
-
-
-class ZotDriver extends ProtoDriver {
-
- protected function discover($channel,$location) {
-
- }
- protected function deliver($item,$channel,$recipients) {
-
- }
- protected function collect($channel,$connection) {
-
- }
- protected function change_permissions($permissions,$channel,$recipient) {
-
- }
- protected function acknowledge_permissions($permissions,$channel,$recipient) {
-
- }
- protected function deliver_private($item,$channel,$recipients) {
-
- }
- protected function collect_private($channel,$connection) {
-
- }
-
-}
diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php
index b3da09cb7..eb2501d43 100644
--- a/Zotlabs/Module/Admin/Profs.php
+++ b/Zotlabs/Module/Admin/Profs.php
@@ -9,17 +9,37 @@ class Profs {
if(array_key_exists('basic',$_REQUEST)) {
$arr = explode(',',$_REQUEST['basic']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_basic',$arr);
-
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_basic');
+ else
+ set_config('system','profile_fields_basic',$narr);
+
+
if(array_key_exists('advanced',$_REQUEST)) {
$arr = explode(',',$_REQUEST['advanced']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_advanced',$arr);
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_advanced');
+ else
+ set_config('system','profile_fields_advanced',$narr);
+
}
goaway(z_root() . '/admin/profs');
}
@@ -98,6 +118,7 @@ class Profs {
$basic = '';
$barr = array();
$fields = get_profile_fields_basic();
+
if(! $fields)
$fields = get_profile_fields_basic(1);
if($fields) {
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index ca181d5f8..95d44d754 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -24,7 +24,7 @@ class Site {
$siteinfo = ((x($_POST,'siteinfo')) ? trim($_POST['siteinfo']) : '');
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
- $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
+// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
// $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
@@ -38,7 +38,12 @@ class Site {
$site_sellpage = ((x($_POST,'site_sellpage')) ? notags(trim($_POST['site_sellpage'])) : '');
$site_location = ((x($_POST,'site_location')) ? notags(trim($_POST['site_location'])) : '');
$frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : '');
- $firstpage = ((x(trim($_POST,'firstpage'))) ? notags(trim($_POST['firstpage'])) : 'profiles');
+ $firstpage = ((x($_POST,'firstpage')) ? notags(trim($_POST['firstpage'])) : 'profiles');
+ $first_page = ((x($_POST,'first_page')) ? notags(trim($_POST['first_page'])) : 'profiles');
+ // check value after trim
+ if(! $first_page) {
+ $first_page = 'profiles';
+ }
$mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
$directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
@@ -82,7 +87,7 @@ class Site {
set_config('system', 'maxloadavg', $maxloadavg);
set_config('system', 'frontpage', $frontpage);
set_config('system', 'sellpage', $site_sellpage);
- set_config('system', 'workflow_channel_next', $firstpage);
+ set_config('system', 'workflow_channel_next', $first_page);
set_config('system', 'site_location', $site_location);
set_config('system', 'mirror_frontpage', $mirror_frontpage);
set_config('system', 'sitename', $sitename);
@@ -122,11 +127,11 @@ class Site {
set_config('system','siteinfo',$siteinfo);
set_config('system', 'language', $language);
set_config('system', 'theme', $theme);
- if ( $theme_mobile === '---' ) {
- del_config('system', 'mobile_theme');
- } else {
- set_config('system', 'mobile_theme', $theme_mobile);
- }
+// if ( $theme_mobile === '---' ) {
+// del_config('system', 'mobile_theme');
+// } else {
+// set_config('system', 'mobile_theme', $theme_mobile);
+// }
// set_config('system','site_channel', $site_channel);
set_config('system','maximagesize', $maximagesize);
@@ -220,9 +225,10 @@ class Site {
$realm = get_directory_realm();
// directory server should not be set or settable unless we are a directory client
+ // avoid older redmatrix servers which don't have modern encryption
if($dirmode == DIRECTORY_MODE_NORMAL) {
- $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0",
+ $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0 and site_project != 'redmatrix'",
intval(DIRECTORY_MODE_SECONDARY),
intval(DIRECTORY_MODE_PRIMARY),
dbesc($realm)
@@ -299,12 +305,12 @@ class Site {
'$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ],
- '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
+ '$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
- '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
+// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
@@ -344,7 +350,7 @@ class Site {
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
- '$firstpage' => array('firstpage', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')),
+ '$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')),
'$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')),
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 231146999..3d3eb2a85 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -255,7 +255,7 @@ class Channel extends \Zotlabs\Web\Controller {
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
AND item.item_wall = 1
$sql_extra $sql_extra2
- ORDER BY created DESC $pager_sql ",
+ ORDER BY created DESC, id $pager_sql ",
intval(\App::$profile['profile_uid'])
);
}
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 2215507ca..8b5476efc 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -110,6 +110,9 @@ class Cloud extends \Zotlabs\Web\Controller {
elseif($err instanceof \Sabre\DAV\Exception\Forbidden) {
notice( t('Permission denied') . EOL);
}
+ elseif($err instanceof \Sabre\DAV\Exception\NotImplemented) {
+ notice( t('Please refresh page') . EOL);
+ }
else {
notice( t('Unknown error') . EOL);
}
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index cfb513365..56e35f912 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -207,7 +207,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
}
- $imagedata = (($os_storage) ? @file_get_contents($imagedata) : $imagedata);
+ $imagedata = (($os_storage) ? @file_get_contents(dbunescbin($imagedata)) : dbunescbin($imagedata));
$ph = photo_factory($imagedata, $filetype);
if(! $ph->is_valid()) {
@@ -357,12 +357,23 @@ class Cover_photo extends \Zotlabs\Web\Controller {
'$user' => \App::$channel['channel_address'],
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
- '$title' => t('Upload Cover Photo'),
+ '$title' => t('Change Cover Photo'),
'$submit' => t('Upload'),
'$profiles' => $profiles,
+ '$embedPhotos' => t('Use a photo from your albums'),
+ '$embedPhotosModalTitle' => t('Use a photo from your albums'),
+ '$embedPhotosModalCancel' => t('Cancel'),
+ '$embedPhotosModalOK' => t('OK'),
+ '$modalchooseimages' => t('Choose images to embed'),
+ '$modalchoosealbum' => t('Choose an album'),
+ '$modaldiffalbum' => t('Choose a different album'),
+ '$modalerrorlist' => t('Error getting album list'),
+ '$modalerrorlink' => t('Error getting photo link'),
+ '$modalerroralbum' => t('Error getting album'),
'$form_security_token' => get_form_security_token("cover_photo"),
/// @FIXME - yuk
- '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
+ '$select' => t('Select existing photo'),
+
));
call_hooks('cover_photo_content_end', $o);
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index b1552a694..62a1670f9 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -17,7 +17,7 @@ class Directory extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($_GET['ignore'])
);
- goaway(z_root() . '/directory?suggest=1');
+ goaway(z_root() . '/directory?f=&suggest=1');
}
$observer = get_observer_hash();
@@ -101,6 +101,11 @@ class Directory extends \Zotlabs\Web\Controller {
if($suggest) {
$r = suggestion_query(local_channel(),get_observer_hash());
+
+ if(! $r) {
+ notice( t('No default suggestions were found.') . EOL);
+ return;
+ }
// Remember in which order the suggestions were
$addresses = array();
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 11dd0d174..8e8a1ed24 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -215,6 +215,7 @@ class Display extends \Zotlabs\Web\Controller {
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']),intval(\App::$pager['start']));
if($load || ($checkjs->disabled()) || ($module_format !== 'html')) {
+
$r = null;
require_once('include/channel.php');
@@ -235,7 +236,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
- if($r === null) {
+ if(! $r) {
// in case somebody turned off public access to sys channel content using permissions
// make that content unsearchable by ensuring the owner uid can't match
@@ -281,7 +282,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
- if($r === null) {
+ if(! $r) {
// in case somebody turned off public access to sys channel content using permissions
// make that content unsearchable by ensuring the owner_xchan can't match
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php
index b8bb720cd..c1ba9a01a 100644
--- a/Zotlabs/Module/Email_validation.php
+++ b/Zotlabs/Module/Email_validation.php
@@ -7,12 +7,11 @@ class Email_validation extends \Zotlabs\Web\Controller {
function post() {
+ $success = false;
if($_POST['token']) {
// This will redirect internally on success unless the channel is auto_created
- if(! account_approve(trim(basename($_POST['token'])))) {
- notice('Token verification failed.');
- }
- else {
+ if(account_approve(trim(basename($_POST['token'])))) {
+ $success = true;
if(get_config('system','auto_channel_create')) {
$next_page = get_config('system', 'workflow_channel_next', 'profiles');
}
@@ -21,7 +20,9 @@ class Email_validation extends \Zotlabs\Web\Controller {
}
}
}
-
+ if(! $success) {
+ notice( t('Token verification failed.') . EOL);
+ }
}
diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php
index 15cc68d7f..bcbb0e116 100644
--- a/Zotlabs/Module/Embedphotos.php
+++ b/Zotlabs/Module/Embedphotos.php
@@ -53,7 +53,7 @@ class Embedphotos extends \Zotlabs\Web\Controller {
} else {
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
}
- json_return_and_die(array('status' => true, 'photolink' => $photolink));
+ json_return_and_die(array('status' => true, 'photolink' => $photolink, 'resource_id' => $resource_id));
}
}
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php
index d8a86d0ce..d441f21d2 100644
--- a/Zotlabs/Module/Follow.php
+++ b/Zotlabs/Module/Follow.php
@@ -14,21 +14,26 @@ class Follow extends \Zotlabs\Web\Controller {
}
$uid = local_channel();
- $url = notags(trim($_REQUEST['url']));
+ $url = notags(trim(unpunify($_REQUEST['url'])));
$return_url = $_SESSION['return_url'];
$confirm = intval($_REQUEST['confirm']);
-
+ $interactive = (($_REQUEST['interactive']) ? intval($_REQUEST['interactive']) : 1);
$channel = \App::get_channel();
- $result = new_contact($uid,$url,$channel,true,$confirm);
+ $result = new_contact($uid,$url,$channel,$interactive,$confirm);
if($result['success'] == false) {
if($result['message'])
notice($result['message']);
- goaway($return_url);
+ if($interactive) {
+ goaway($return_url);
+ }
+ else {
+ json_return_and_die($result);
+ }
}
- info( t('Channel added.') . EOL);
+ info( t('Connection added.') . EOL);
$clone = array();
foreach($result['abook'] as $k => $v) {
@@ -53,7 +58,12 @@ class Follow extends \Zotlabs\Web\Controller {
if(($can_view_stream) || ($result['abook']['xchan_network'] === 'rss'))
\Zotlabs\Daemon\Master::Summon(array('Onepoll',$result['abook']['abook_id']));
- goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
+ if($interactive) {
+ goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
+ }
+ else {
+ json_return_and_die([ 'success' => true ]);
+ }
}
diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php
index 2c2dcf460..d33136d9e 100644
--- a/Zotlabs/Module/Go.php
+++ b/Zotlabs/Module/Go.php
@@ -33,9 +33,10 @@ class Go extends \Zotlabs\Web\Controller {
$options = [
'profile_photo' => t('Upload a profile photo'),
+ 'cover_photo' => t('Upload a cover photo'),
'profiles' => t('Edit your default profile'),
'suggest' => t('View friend suggestions'),
- 'directory' => t('View the directory to find other interesting channels'),
+ 'directory' => t('View the channel directory'),
'settings' => t('View/edit your channel settings'),
'help' => t('View the site or project documentation'),
'channel/' . $channel['channel_address'] => t('Visit your channel homepage'),
diff --git a/Zotlabs/Module/Hashtags.php b/Zotlabs/Module/Hashtags.php
new file mode 100644
index 000000000..edb631871
--- /dev/null
+++ b/Zotlabs/Module/Hashtags.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Zotlabs\Module;
+
+
+class Hashtags extends \Zotlabs\Web\Controller {
+
+ function init() {
+ $result = [];
+
+ $t = escape_tags($_REQUEST['t']);
+ if(! $t)
+ json_return_and_die($result);
+
+ $r = q("select distinct(term) from term where term like '%s' and ttype = %d order by term",
+ dbesc($t . '%'),
+ intval(TERM_HASHTAG)
+ );
+ if($r) {
+ foreach($r as $rv) {
+ $result[] = [ 'text' => strtolower($rv['term']) ];
+ }
+ }
+
+ json_return_and_die($result);
+ }
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 2b16ff4e1..81c405f00 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -64,7 +64,7 @@ class Import extends \Zotlabs\Web\Controller {
notice( t('Nothing to import.') . EOL);
return;
} else if(strpos($old_address, '@')) {
- // if you copy the identity address from your profile page, make it work for convenience
+ // if you copy the identity address from your profile page, make it work for convenience - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit.
$old_address = str_replace('@', '@', $old_address);
}
@@ -114,15 +114,16 @@ class Import extends \Zotlabs\Web\Controller {
return;
}
- if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) {
- $v1 = substr($data['compatibility']['database'],-4);
- $v2 = substr(DB_UPDATE_VERSION,-4);
- if($v2 > $v1) {
- $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 );
- notice($t);
- }
-
- }
+// This is only an info message but it is alarming to folks who then report failure with this as the cause, when in fact we ignore this completely.
+// if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) {
+// $v1 = substr($data['compatibility']['database'],-4);
+// $v2 = substr(DB_UPDATE_VERSION,-4);
+// if($v2 > $v1) {
+// $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 );
+// notice($t);
+// }
+//
+// }
if($moving)
$seize = 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/Magic.php b/Zotlabs/Module/Magic.php
index 9ad9c951c..15e5cedcf 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -166,7 +166,7 @@ class Magic extends \Zotlabs\Web\Controller {
$token = random_string();
- \Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']);
+ \Zotlabs\Lib\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']);
$target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode(channel_reddress($channel))
. '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION;
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/Owa.php b/Zotlabs/Module/Owa.php
index 23ee14f39..e62fc9592 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -42,7 +42,7 @@ class Owa extends \Zotlabs\Web\Controller {
logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA);
$ret['success'] = true;
$token = random_string(32);
- \Zotlabs\Zot\Verify::create('owt',0,$token,$hubloc['hubloc_addr']);
+ \Zotlabs\Lib\Verify::create('owt',0,$token,$hubloc['hubloc_addr']);
$result = '';
openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
$ret['encrypted_token'] = base64url_encode($result);
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 222b92721..2ce8686b9 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -304,7 +304,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
$channel = \App::get_channel();
-
+ $pf = 0;
$newuser = false;
if(argc() == 2 && argv(1) === 'new')
@@ -318,8 +318,8 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$resource_id = argv(2);
- // When using an existing photo, we don't have a dialogue to offer a choice of profiles,
- // so it gets attached to the default
+
+ $pf = (($_REQUEST['pf']) ? intval($_REQUEST['pf']) : 0);
$c = q("select id, is_default from profile where uid = %d",
intval(local_channel())
@@ -331,6 +331,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$_REQUEST['profile'] = $c[0]['id'];
$multi_profiles = false;
}
+ else {
+ $_REQUEST['profile'] = $pf;
+ }
$r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()),
@@ -430,6 +433,16 @@ class Profile_photo extends \Zotlabs\Web\Controller {
intval(local_channel())
);
+ if($profiles) {
+ for($x = 0; $x < count($profiles); $x ++) {
+ $profiles[$x]['selected'] = false;
+ if($pf && $profiles[$x]['id'] == $pf)
+ $profiles[$x]['selected'] = true;
+ if((! $pf) && $profiles[$x]['is_default'])
+ $profiles[$x]['selected'] = true;
+ }
+ }
+
$importing = ((array_key_exists('importfile',\App::$data)) ? true : false);
if(! x(\App::$data,'imagecrop')) {
@@ -441,14 +454,23 @@ class Profile_photo extends \Zotlabs\Web\Controller {
'$importfile' => (($importing) ? \App::$data['importfile'] : ''),
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
- '$title' => (($importing) ? t('Use Photo for Profile') : t('Upload Profile Photo')),
+ '$title' => (($importing) ? t('Use Photo for Profile') : t('Change Profile Photo')),
'$submit' => (($importing) ? t('Use') : t('Upload')),
'$profiles' => $profiles,
'$single' => ((count($profiles) == 1) ? true : false),
'$profile0' => $profiles[0],
+ '$embedPhotos' => t('Use a photo from your albums'),
+ '$embedPhotosModalTitle' => t('Use a photo from your albums'),
+ '$embedPhotosModalCancel' => t('Cancel'),
+ '$embedPhotosModalOK' => t('OK'),
+ '$modalchooseimages' => t('Choose images to embed'),
+ '$modalchoosealbum' => t('Choose an album'),
+ '$modaldiffalbum' => t('Choose a different album'),
+ '$modalerrorlist' => t('Error getting album list'),
+ '$modalerrorlink' => t('Error getting photo link'),
+ '$modalerroralbum' => t('Error getting album'),
'$form_security_token' => get_form_security_token("profile_photo"),
- // FIXME - yuk
- '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
+ '$select' => t('Select existing photo'),
));
call_hooks('profile_photo_content_end', $o);
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index af7bc7658..79f205a22 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -12,10 +12,16 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($load)
$_SESSION['loadtime'] = datetime_convert();
- if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
+ if((observer_prohibited(true))) {
return login();
}
+ if(! intval(get_config('system','open_pubstream',1))) {
+ if(! get_observer_hash()) {
+ return login();
+ }
+ }
+
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index c7fa1cee8..5356669e9 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -123,9 +123,6 @@ class Register extends \Zotlabs\Web\Controller {
if($policy == REGISTER_OPEN ) {
if($email_verify) {
$res = verify_email_address($result);
- if($res) {
- info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ;
- }
}
else {
$res = send_register_success_email($result['email'],$result['password']);
@@ -133,7 +130,8 @@ class Register extends \Zotlabs\Web\Controller {
if($res) {
if($invite_code) {
info( t('Registration successful. Continue to create your first channel...') . EOL ) ;
- } else {
+ }
+ else {
info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ;
}
}
diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php
index 18890e89f..9643c5958 100644
--- a/Zotlabs/Module/Settings/Account.php
+++ b/Zotlabs/Module/Settings/Account.php
@@ -113,7 +113,7 @@ class Account {
'$origpass' => array('origpass', t('Current Password'), ' ',''),
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
- '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience matched to your comfort level'), $techlevels ],
+ '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
'$techlock' => $techlock,
'$submit' => t('Submit'),
'$email' => array('email', t('Email Address:'), $email, ''),
diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php
index 9c5a7b16c..542a05363 100644
--- a/Zotlabs/Module/Settings/Featured.php
+++ b/Zotlabs/Module/Settings/Featured.php
@@ -57,14 +57,28 @@ class Featured {
}
call_hooks('feature_settings', $settings_addons);
-
+
+ $this->sortpanels($settings_addons);
+
+
$tpl = get_markup_template("settings_addons.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_featured"),
- '$title' => t('Feature/Addon Settings'),
+ '$title' => t('Addon Settings'),
+ '$descrip' => t('Please save/submit changes to any panel before opening another.'),
'$settings_addons' => $settings_addons
));
return $o;
}
-
-} \ No newline at end of file
+
+ function sortpanels(&$s) {
+ $a = explode('<div class="panel">',$s);
+ if($a) {
+ usort($a,'featured_sort');
+ $s = implode('<div class="panel">',$a);
+ }
+ }
+
+}
+
+
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index 8e7fbbddf..a3832d156 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -563,16 +563,20 @@ class Setup extends \Zotlabs\Web\Controller {
$status = true;
$help = '';
- if( (file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
- (!file_exists('.htconfig.php') && !is_writable('.')) ) {
- $status = false;
- $help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL;
- $help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL;
- $help .= t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Red top folder.').EOL;
- $help .= t('You can alternatively skip this procedure and perform a manual installation. Please see the file "install/INSTALL.txt" for instructions.').EOL;
+ $fname = '.htconfig.php';
+
+ if((file_exists($fname) && is_writable($fname)) ||
+ (! (file_exists($fname) && is_writable('.')))) {
+ $this->check_add($checks, t('.htconfig.php is writable'), $status, true, $help);
+ return;
}
- $this->check_add($checks, t('.htconfig.php is writable'), $status, false, $help);
+ $status = false;
+ $help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') .EOL;
+ $help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.').EOL;
+ $help .= t('Please see install/INSTALL.txt for additional information.');
+
+ $this->check_add($checks, t('.htconfig.php is writable'), $status, true, $help);
}
/**
diff --git a/Zotlabs/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php
index e7d4187b7..2ac5ed1b8 100644
--- a/Zotlabs/Module/Sitelist.php
+++ b/Zotlabs/Module/Sitelist.php
@@ -32,7 +32,7 @@ class Sitelist extends \Zotlabs\Web\Controller {
$result = array('success' => false);
- $r = q("select count(site_url) as total from site where site_type = %d $sql_extra ",
+ $r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ",
intval(SITE_TYPE_ZOT)
);
@@ -42,7 +42,7 @@ class Sitelist extends \Zotlabs\Web\Controller {
$result['start'] = $start;
$result['limit'] = $limit;
- $r = q("select * from site where site_type = %d $sql_extra $sql_order $sql_limit",
+ $r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit",
intval(SITE_TYPE_ZOT)
);
diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php
index f816632ab..c3d8ff802 100644
--- a/Zotlabs/Module/Thing.php
+++ b/Zotlabs/Module/Thing.php
@@ -20,6 +20,11 @@ class Thing extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
+ if($_SERVER['REQUEST_METHOD'] === 'GET' && argc() < 2) {
+ profile_load($channel['channel_address']);
+ }
+
+
$term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : '');
$name = escape_tags($_REQUEST['term']);
diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php
index 1f9c03751..8366e1325 100644
--- a/Zotlabs/Module/Viewconnections.php
+++ b/Zotlabs/Module/Viewconnections.php
@@ -44,7 +44,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
$sql_extra = '';
if(! $is_owner) {
- $abook_flags = " and abook_hidden = 0 ";
+ $abook_flags .= " and abook_hidden = 0 ";
$sql_extra = " and xchan_hidden = 0 ";
}
@@ -69,8 +69,13 @@ class Viewconnections extends \Zotlabs\Web\Controller {
$contacts = array();
foreach($r as $rr) {
+
+ $oneway = false;
+ if(! intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $oneway = true;
+ }
- $url = chanlink_hash($rr['xchan_hash']);
+ $url = chanlink_hash($rr['xchan_hash']);
if($url) {
$contacts[] = array(
'id' => $rr['abook_id'],
@@ -83,6 +88,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
'sparkle' => '',
'itemurl' => $rr['url'],
'network' => '',
+ 'oneway' => $oneway
);
}
}
diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php
index 753721d27..81d4beaed 100644
--- a/Zotlabs/Module/Wfinger.php
+++ b/Zotlabs/Module/Wfinger.php
@@ -123,7 +123,8 @@ class Wfinger extends \Zotlabs\Web\Controller {
$result['properties'] = [
'http://webfinger.net/ns/name' => $r[0]['channel_name'],
'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'],
- 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey']
+ 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'],
+ 'http://purl.org/zot/federation' => 'zot'
];
foreach($aliases as $alias)
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index c21b68971..f1c95802b 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -264,7 +264,10 @@ class Browser extends DAV\Browser\Plugin {
$this->server->emit('onHTMLActionsPanel', array($parent, &$output, $path));
}
-
+ $deftiles = (($is_owner) ? 0 : 1);
+ $tiles = ((array_key_exists('cloud_tiles',$_SESSION)) ? intval($_SESSION['cloud_tiles']) : $deftiles);
+ $_SESSION['cloud_tiles'] = $tiles;
+
$html .= replace_macros(get_markup_template('cloud.tpl'), array(
'$header' => t('Files') . ": " . $this->escapeHTML($path) . "/",
'$total' => t('Total'),
diff --git a/Zotlabs/Update/_1204.php b/Zotlabs/Update/_1204.php
new file mode 100644
index 000000000..0b9204b9b
--- /dev/null
+++ b/Zotlabs/Update/_1204.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1204 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE poll ADD poll_guid text NOT NULL");
+ $r2 = q("create index \"poll_guid_idx\" on poll (\"poll_guid\")");
+ $r3 = q("ALTER TABLE poll_elm ADD pelm_guid text NOT NULL");
+ $r4 = q("create index \"pelm_guid_idx\" on poll_elm (\"pelm_guid\")");
+ $r5 = q("ALTER TABLE vote ADD vote_guid text NOT NULL");
+ $r6 = q("create index \"vote_guid_idx\" on vote (\"vote_guid\")");
+
+ $r = ($r1 && $r2 && $r3 && $r4 && $r5 && $r6);
+ }
+ else {
+ $r1 = q("ALTER TABLE `poll` ADD `poll_guid` VARCHAR(191) NOT NULL, ADD INDEX `poll_guid` (`poll_guid`) ");
+ $r2 = q("ALTER TABLE `poll_elm` ADD `pelm_guid` VARCHAR(191) NOT NULL, ADD INDEX `pelm_guid` (`pelm_guid`) ");
+ $r3 = q("ALTER TABLE `vote` ADD `vote_guid` VARCHAR(191) NOT NULL, ADD INDEX `vote_guid` (`vote_guid`) ");
+
+ $r = ($r1 && $r2 && $r3);
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+
+ return UPDATE_FAILED;
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1205.php b/Zotlabs/Update/_1205.php
new file mode 100644
index 000000000..968833726
--- /dev/null
+++ b/Zotlabs/Update/_1205.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1205 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+
+ q("ALTER TABLE item DROP INDEX title");
+ q("ALTER TABLE item DROP INDEX body");
+ q("ALTER TABLE item DROP INDEX allow_cid");
+ q("ALTER TABLE item DROP INDEX allow_gid");
+ q("ALTER TABLE item DROP INDEX deny_cid");
+ q("ALTER TABLE item DROP INDEX deny_gid");
+ q("ALTER TABLE item DROP INDEX item_flags");
+ q("ALTER TABLE item DROP INDEX item_restrict");
+ q("ALTER TABLE item DROP INDEX aid");
+
+ $r = q("ALTER TABLE item
+ DROP INDEX item_private,
+ ADD INDEX uid_item_private (uid, item_private),
+ ADD INDEX item_wall (item_wall),
+ ADD INDEX item_pending_remove_changed (item_pending_remove, changed)
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1206.php b/Zotlabs/Update/_1206.php
new file mode 100644
index 000000000..351d53ff6
--- /dev/null
+++ b/Zotlabs/Update/_1206.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1206 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ ADD INDEX uid_resource_type (uid, resource_type)
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1207.php b/Zotlabs/Update/_1207.php
new file mode 100644
index 000000000..f53bc46ae
--- /dev/null
+++ b/Zotlabs/Update/_1207.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1207 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("ALTER TABLE item
+ DROP INDEX resource_type
+ ");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+ }
+ else {
+ return UPDATE_SUCCESS;
+ }
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1208.php b/Zotlabs/Update/_1208.php
new file mode 100644
index 000000000..4cbcf4322
--- /dev/null
+++ b/Zotlabs/Update/_1208.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1208 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE poll ADD poll_author text NOT NULL");
+ $r2 = q("create index \"poll_author_idx\" on poll \"poll_author\"");
+
+ $r = ($r1 && $r2);
+ }
+ else {
+ $r = q("ALTER TABLE `poll` ADD `poll_author` VARCHAR(191) NOT NULL AFTER `poll_votes`,
+ ADD INDEX `poll_author` (`poll_author`)");
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+ }
+
+}
diff --git a/Zotlabs/Update/_1209.php b/Zotlabs/Update/_1209.php
new file mode 100644
index 000000000..5ec449395
--- /dev/null
+++ b/Zotlabs/Update/_1209.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1209 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE poll_elm ADD pelm_order numeric(6) NOT NULL DEFAULT '0' ");
+ $r2 = q("create index \"pelm_order_idx\" on poll_elm \"pelm_order\"");
+
+ $r = ($r1 && $r2);
+ }
+ else {
+ $r = q("ALTER TABLE `poll_elm` ADD `pelm_order` int(11) NOT NULL DEFAULT 0,
+ ADD INDEX `pelm_order` (`pelm_order`)");
+ }
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+ }
+
+}
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index a27edb73d..9bcc2e5ec 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -3,16 +3,24 @@
namespace Zotlabs\Web;
/**
- * Implements HTTP Signatures per draft-cavage-http-signatures-07
+ * @brief Implements HTTP Signatures per draft-cavage-http-signatures-07.
+ *
+ * @see https://tools.ietf.org/html/draft-cavage-http-signatures-07
*/
-
-
class HTTPSig {
- // See RFC5843
-
- static function generate_digest($body,$set = true) {
- $digest = base64_encode(hash('sha256',$body,true));
+ /**
+ * @brief RFC5843
+ *
+ * @see https://tools.ietf.org/html/rfc5843
+ *
+ * @param string $body The value to create the digest for
+ * @param boolean $set (optional, default true)
+ * If set send a Digest HTTP header
+ * @return string The generated digest of $body
+ */
+ static function generate_digest($body, $set = true) {
+ $digest = base64_encode(hash('sha256', $body, true));
if($set) {
header('Digest: SHA-256=' . $digest);
@@ -40,6 +48,7 @@ class HTTPSig {
if(is_array($data) && $data['header']) {
if(! $data['success'])
return $result;
+
$h = new \Zotlabs\Web\HTTPHeaders($data['header']);
$headers = $h->fetcharr();
$body = $data['body'];
@@ -47,7 +56,7 @@ class HTTPSig {
else {
$headers = [];
- $headers['(request-target)'] =
+ $headers['(request-target)'] =
strtolower($_SERVER['REQUEST_METHOD']) . ' ' .
$_SERVER['REQUEST_URI'];
foreach($_SERVER as $k => $v) {
@@ -78,7 +87,7 @@ class HTTPSig {
$result['header_signed'] = true;
$signed_headers = $sig_block['headers'];
- if(! $signed_headers)
+ if(! $signed_headers)
$signed_headers = [ 'date' ];
$signed_data = '';
@@ -131,7 +140,7 @@ class HTTPSig {
if($digest[0] === 'SHA-512')
$hashalg = 'sha512';
- // The explode operation will have stripped the '=' padding, so compare against unpadded base64
+ // The explode operation will have stripped the '=' padding, so compare against unpadded base64
if(rtrim(base64_encode(hash($hashalg,$body,true)),'=') === $digest[1]) {
$result['content_valid'] = true;
}
@@ -146,7 +155,7 @@ class HTTPSig {
if($digest[0] === 'SHA-512')
$hashalg = 'sha512';
- // The explode operation will have stripped the '=' padding, so compare against unpadded base64
+ // The explode operation will have stripped the '=' padding, so compare against unpadded base64
if(rtrim(base64_encode(hash($hashalg,$_POST['data'],true)),'=') === $digest[1]) {
$result['content_valid'] = true;
}
@@ -155,9 +164,15 @@ class HTTPSig {
logger('Content_Valid: ' . (($result['content_valid']) ? 'true' : 'false'));
return $result;
-
}
+ /**
+ * @brief
+ *
+ * @param string $id
+ * @return boolean|string
+ * false if no pub key found, otherwise return the pub key
+ */
function get_activitypub_key($id) {
if(strpos($id,'acct:') === 0) {
@@ -180,19 +195,33 @@ class HTTPSig {
$j = json_decode($r,true);
if($j['id'] !== $id)
- return false;
+ return false;
+
if(array_key_exists('publicKey',$j) && array_key_exists('publicKeyPem',$j['publicKey'])) {
return($j['publicKey']['publicKeyPem']);
}
}
+
return false;
}
-
-
-
- static function create_sig($request,$head,$prvkey,$keyid = 'Key',$send_headers = false,$auth = false,$alg = 'sha256',
- $crypt_key = null, $crypt_algo = 'aes256ctr') {
+ /**
+ * @brief
+ *
+ * @param string $request
+ * @param array $head
+ * @param string $prvkey
+ * @param string $keyid (optional, default 'Key')
+ * @param boolean $send_headers (optional, default false)
+ * If set send a HTTP header
+ * @param boolean $auth (optional, default false)
+ * @param string $alg (optional, default 'sha256')
+ * @param string $crypt_key (optional, default null)
+ * @param string $crypt_algo (optional, default 'aes256ctr')
+ * @return array
+ */
+ static function create_sig($request, $head, $prvkey, $keyid = 'Key', $send_headers = false, $auth = false,
+ $alg = 'sha256', $crypt_key = null, $crypt_algo = 'aes256ctr') {
$return_headers = [];
@@ -212,7 +241,7 @@ class HTTPSig {
$x = crypto_encapsulate($headerval,$crypt_key,$crypt_algo);
$headerval = 'iv="' . $x['iv'] . '",key="' . $x['key'] . '",alg="' . $x['alg'] . '",data="' . $x['data'] . '"';
}
-
+
if($auth) {
$sighead = 'Authorization: Signature ' . $headerval;
}
@@ -236,12 +265,20 @@ class HTTPSig {
else {
$return_headers[] = $sighead;
}
+
return $return_headers;
}
-
-
- static function sign($request,$head,$prvkey,$alg = 'sha256') {
+ /**
+ * @brief
+ *
+ * @param string $request
+ * @param array $head
+ * @param string $prvkey
+ * @param string $alg (optional) default 'sha256'
+ * @return array
+ */
+ static function sign($request, $head, $prvkey, $alg = 'sha256') {
$ret = [];
@@ -250,27 +287,38 @@ class HTTPSig {
if($request) {
$headers = '(request-target)' . ': ' . trim($request) . "\n";
$fields = '(request-target)';
- }
+ }
if($head) {
foreach($head as $k => $v) {
$headers .= strtolower($k) . ': ' . trim($v) . "\n";
if($fields)
$fields .= ' ';
+
$fields .= strtolower($k);
}
// strip the trailing linefeed
$headers = rtrim($headers,"\n");
}
- $sig = base64_encode(rsa_sign($headers,$prvkey,$alg));
+ $sig = base64_encode(rsa_sign($headers,$prvkey,$alg));
$ret['headers'] = $fields;
$ret['signature'] = $sig;
-
+
return $ret;
}
+ /**
+ * @brief
+ *
+ * @param string $header
+ * @return array associate array with
+ * - \e string \b keyID
+ * - \e string \b algorithm
+ * - \e array \b headers
+ * - \e string \b signature
+ */
static function parse_sigheader($header) {
$ret = [];
@@ -297,12 +345,23 @@ class HTTPSig {
}
- static function decrypt_sigheader($header,$prvkey = null) {
+ /**
+ * @brief
+ *
+ * @param string $header
+ * @param string $prvkey (optional), if not set use site private key
+ * @return array|string associative array, empty string if failue
+ * - \e string \b iv
+ * - \e string \b key
+ * - \e string \b alg
+ * - \e string \b data
+ */
+ static function decrypt_sigheader($header, $prvkey = null) {
$iv = $key = $alg = $data = null;
if(! $prvkey) {
- $prvkey = get_config('system','prvkey');
+ $prvkey = get_config('system', 'prvkey');
}
$matches = [];
@@ -319,10 +378,8 @@ class HTTPSig {
if($iv && $key && $alg && $data) {
return crypto_unencapsulate([ 'iv' => $iv, 'key' => $key, 'alg' => $alg, 'data' => $data ] , $prvkey);
}
- return '';
+ return '';
}
}
-
-
diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php
new file mode 100644
index 000000000..cdb70e23d
--- /dev/null
+++ b/Zotlabs/Widget/Newmember.php
@@ -0,0 +1,83 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Newmember {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ 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;
+
+ // This could be a new account that was used to clone a very old channel
+
+ $ob = \App::get_observer();
+ if($ob && array_key_exists('xchan_name_date',$ob) && $ob['xchan_name_date'] < datetime_convert('UTC','UTC','now - 60 days'))
+ return EMPTY_STR;
+
+
+ $options = [
+ t('Profile Creation'),
+ [
+ 'profile_photo' => t('Upload profile photo'),
+ 'cover_photo' => t('Upload cover photo'),
+ 'profiles' => t('Edit your profile'),
+ ],
+
+ t('Find and Connect with others'),
+ [
+ 'directory' => t('View the directory'),
+ 'directory?f=&suggest=1' => t('View friend suggestions'),
+ 'connections' => t('Manage your connections'),
+ ],
+
+ t('Communicate'),
+ [
+ 'channel/' . $channel['channel_address'] => t('View your channel homepage'),
+ 'network' => t('View your network stream'),
+ ],
+
+ t('Miscellaneous'),
+ [
+ 'settings' => t('Settings'),
+ 'help' => t('Documentation'),
+ ]
+ ];
+
+ $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+
+ // hack to put this in the correct spot of the array
+
+ if($site_firehose || $net_firehose) {
+ $options[5]['pubstream'] = t('View public stream');
+ }
+
+ $o = replace_macros(get_markup_template('new_member.tpl'), [
+ '$title' => t('New Member Links'),
+ '$options' => $options
+
+ ]);
+
+ return $o;
+
+ }
+
+}
+
+
+
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index d51cb0113..f2619c5cf 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -23,7 +23,8 @@ class Notifications {
'label' => t('Mark all notifications read')
],
'filter' => [
- 'label' => t('Show new posts only')
+ 'posts_label' => t('Show new posts only'),
+ 'name_label' => t('Filter by name')
]
];
@@ -41,7 +42,8 @@ class Notifications {
'label' => t('Mark all notifications seen')
],
'filter' => [
- 'label' => t('Show new posts only')
+ 'posts_label' => t('Show new posts only'),
+ 'name_label' => t('Filter by name')
]
];
@@ -136,7 +138,8 @@ class Notifications {
'label' => t('Mark all notifications seen')
],
'filter' => [
- 'label' => t('Show new posts only')
+ 'posts_label' => t('Show new posts only'),
+ 'name_label' => t('Filter by name')
]
];
}
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index e15ed96a5..455fdcb9b 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -54,7 +54,7 @@ class Settings_menu {
}
$tabs[] = array(
- 'label' => t('Feature/Addon settings'),
+ 'label' => t('Addon settings'),
'url' => z_root().'/settings/featured',
'selected' => ((argv(1) === 'featured') ? 'active' : ''),
);
@@ -79,7 +79,7 @@ class Settings_menu {
'selected' => ''
);
- if(get_account_techlevel() > 0) {
+ if(feature_enabled(local_channel(),'oauth_clients')) {
$tabs[] = array(
'label' => t('Connected apps'),
'url' => z_root() . '/settings/oauth',
@@ -87,7 +87,7 @@ class Settings_menu {
);
}
- if(get_account_techlevel() > 2) {
+ if(feature_enabled(local_channel(),'access_tokens')) {
$tabs[] = array(
'label' => t('Guest Access Tokens'),
'url' => z_root() . '/settings/tokens',