aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php7
-rw-r--r--Zotlabs/Lib/Activity.php89
-rw-r--r--Zotlabs/Lib/Libzot.php4
-rw-r--r--Zotlabs/Module/Channel.php8
-rw-r--r--Zotlabs/Module/Connedit.php27
-rw-r--r--Zotlabs/Module/Like.php3
-rw-r--r--Zotlabs/Module/Setup.php5
-rw-r--r--Zotlabs/Update/_1230.php12
8 files changed, 141 insertions, 14 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 8b81c49da..beb30ed96 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -625,7 +625,12 @@ class Notifier {
continue;
}
- $hash = new_uuid();
+ // Do not change this to a uuid as long as we have traditional zot servers
+ // in the loop. The signature verification step can't handle dashes in the
+ // hashes.
+
+ $hash = random_string(48);
+
$packet = null;
$pmsg = '';
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 8cef41c42..ef6ee6c3e 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -546,6 +546,12 @@ class Activity {
}
+
+
+
+
+
+
static function activity_mapper($verb) {
if(strpos($verb,'/') === false) {
@@ -588,6 +594,67 @@ class Activity {
}
+
+ static function activity_decode_mapper($verb) {
+
+ $acts = [
+ 'http://activitystrea.ms/schema/1.0/post' => 'Create',
+ 'http://activitystrea.ms/schema/1.0/share' => 'Announce',
+ 'http://activitystrea.ms/schema/1.0/update' => 'Update',
+ 'http://activitystrea.ms/schema/1.0/like' => 'Like',
+ 'http://activitystrea.ms/schema/1.0/favorite' => 'Like',
+ 'http://purl.org/zot/activity/dislike' => 'Dislike',
+ 'http://activitystrea.ms/schema/1.0/tag' => 'Add',
+ 'http://activitystrea.ms/schema/1.0/follow' => 'Follow',
+ 'http://activitystrea.ms/schema/1.0/unfollow' => 'Unfollow',
+ ];
+
+
+ foreach($acts as $k => $v) {
+ if($verb === $v) {
+ return $k;
+ }
+ }
+
+ logger('Unmapped activity: ' . $verb);
+ return 'Create';
+
+ }
+
+ static function activity_obj_decode_mapper($obj) {
+
+ $objs = [
+ 'http://activitystrea.ms/schema/1.0/note' => 'Note',
+ 'http://activitystrea.ms/schema/1.0/note' => 'Article',
+ 'http://activitystrea.ms/schema/1.0/comment' => 'Note',
+ 'http://activitystrea.ms/schema/1.0/person' => 'Person',
+ 'http://purl.org/zot/activity/profile' => 'Profile',
+ 'http://activitystrea.ms/schema/1.0/photo' => 'Image',
+ 'http://activitystrea.ms/schema/1.0/profile-photo' => 'Icon',
+ 'http://activitystrea.ms/schema/1.0/event' => 'Event',
+ 'http://activitystrea.ms/schema/1.0/wiki' => 'Document',
+ 'http://purl.org/zot/activity/location' => 'Place',
+ 'http://purl.org/zot/activity/chessgame' => 'Game',
+ 'http://purl.org/zot/activity/tagterm' => 'zot:Tag',
+ 'http://purl.org/zot/activity/thing' => 'Object',
+ 'http://purl.org/zot/activity/file' => 'zot:File',
+ 'http://purl.org/zot/activity/mood' => 'zot:Mood',
+
+ ];
+
+ foreach($objs as $k => $v) {
+ if($obj === $v) {
+ return $k;
+ }
+ }
+
+ logger('Unmapped activity object: ' . $obj);
+ return 'Note';
+ }
+
+
+
+
static function activity_obj_mapper($obj) {
if(strpos($obj,'/') === false) {
@@ -1236,6 +1303,20 @@ class Activity {
}
+ static function get_actor_bbmention($id) {
+
+ $x = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_hash = '%s' or hubloc_id_url = '%s' limit 1",
+ dbesc($id),
+ dbesc($id)
+ );
+
+ if($x) {
+ return sprintf('@[zrl=%s]%s[/zrl]',$x[0]['xchan_url'],$x[0]['xchan_name']);
+ }
+ return '@{' . $id . '}';
+
+ }
+
static function decode_note($act) {
@@ -1320,13 +1401,17 @@ class Activity {
$s['summary'] = self::bb_content($content,'summary');
$s['body'] = ((self::bb_content($content,'bbcode') && (! $response_activity)) ? self::bb_content($content,'bbcode') : self::bb_content($content,'content'));
- $s['verb'] = self::activity_mapper($act->type);
+ $s['verb'] = self::activity_decode_mapper($act->type);
if($act->type === 'Tombstone') {
$s['item_deleted'] = 1;
}
- $s['obj_type'] = self::activity_obj_mapper($act->obj['type']);
+ $s['obj_type'] = self::activity_obj_decode_mapper($act->obj['type']);
+ if($s['obj_type'] === ACTIVITY_OBJ_NOTE && $s['mid'] !== $s['parent_mid']) {
+ $s['obj_type'] = ACTIVITY_OBJ_COMMENT;
+ }
+
$s['obj'] = $act->obj;
$instrument = $act->get_property_obj('instrument');
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 0fbde9765..87a5126f4 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -397,9 +397,7 @@ logger('4');
}
}
- $closeness = get_pconfig($channel['channel_id'],'system','new_abook_closeness');
- if($closeness === false)
- $closeness = 80;
+ $closeness = get_pconfig($channel['channel_id'],'system','new_abook_closeness',80);
$y = abook_store_lowlevel(
[
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 12d87885f..5fdefd805 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -124,6 +124,11 @@ class Channel extends Controller {
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
+ if(strpos($mid,'b64.') === 0)
+ $decoded = @base64url_decode(substr($mid,4));
+ if($decoded)
+ $mid = $decoded;
+
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
@@ -375,6 +380,9 @@ class Channel extends Controller {
if((! $update) && (! $load)) {
+ if($decoded)
+ $mid = 'b64.' . base64url_encode($mid);
+
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index a9f643306..c14bcd0dd 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -101,7 +101,8 @@ class Connedit extends \Zotlabs\Web\Controller {
}
- $profile_id = $_POST['profile_assign'];
+ $profile_id = ((array_key_exists('profile_assign',$_POST)) ? $_POST['profile_assign'] : $orig_record[0]['abook_profile']);
+
if($profile_id) {
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND uid = %d LIMIT 1",
dbesc($profile_id),
@@ -113,18 +114,23 @@ class Connedit extends \Zotlabs\Web\Controller {
}
}
- $abook_incl = escape_tags($_POST['abook_incl']);
- $abook_excl = escape_tags($_POST['abook_excl']);
-
+ $abook_incl = ((array_key_exists('abook_incl',$_POST)) ? escape_tags($_POST['abook_incl']) : $orig_record[0]['abook_incl']);
+ $abook_excl = ((array_key_exists('abook_excl',$_POST)) ? escape_tags($_POST['abook_excl']) : $orig_record[0]['abook_excl']);
+
+
$hidden = intval($_POST['hidden']);
$priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
$priority = 0;
+ if(! array_key_exists('closeness',$_POST)) {
+ $_POST['closeness'] = 80;
+ }
$closeness = intval($_POST['closeness']);
- if($closeness < 0)
- $closeness = 99;
+ if($closeness < 0 || $closeness > 99) {
+ $closeness = 80;
+ }
$rating = intval($_POST['rating']);
if($rating < (-10))
@@ -231,6 +237,8 @@ class Connedit extends \Zotlabs\Web\Controller {
}
$abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending']);
+
+
$r = q("UPDATE abook SET abook_profile = '%s', abook_closeness = %d, abook_pending = %d,
abook_incl = '%s', abook_excl = '%s'
@@ -733,9 +741,12 @@ class Connedit extends \Zotlabs\Web\Controller {
}
$slider_tpl = get_markup_template('contact_slider.tpl');
+
+ $slideval = intval($contact['abook_closeness']);
+
$slide = replace_macros($slider_tpl,array(
'$min' => 1,
- '$val' => (($contact['abook_closeness']) ? $contact['abook_closeness'] : 99),
+ '$val' => $slideval,
'$labels' => $label_str,
));
}
@@ -892,7 +903,7 @@ class Connedit extends \Zotlabs\Web\Controller {
'$inherited' => t('inherited'),
'$submit' => t('Submit'),
'$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']),
- '$close' => $contact['abook_closeness'],
+ '$close' => (($contact['abook_closeness']) ? $contact['abook_closeness'] : 80),
'$them' => t('Their Settings'),
'$me' => t('My Settings'),
'$perms' => $perms,
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index d19154eb4..0455c5265 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -251,6 +251,9 @@ class Like extends \Zotlabs\Web\Controller {
}
}
else {
+
+ if(! $observer)
+ killme();
// this is used to like an item or comment
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index c0716ca7c..370b7b9f8 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -441,13 +441,18 @@ class Setup extends \Zotlabs\Web\Controller {
require_once 'include/environment.php';
$help = '';
+ $mem_warning = '';
$result = getPhpiniUploadLimits();
+ if($result['post_max_size'] < 4194304 || $result['max_upload_filesize'] < 4194304) {
+ $mem_warning = '<strong>' .t('This is not sufficient to upload larger images or files. You should be able to upload at least 4 MB at once.') . '</strong>';
+ }
$help = sprintf(t('Your max allowed total upload size is set to %s. Maximum size of one file to upload is set to %s. You are allowed to upload up to %d files at once.'),
userReadableSize($result['post_max_size']),
userReadableSize($result['max_upload_filesize']),
$result['max_file_uploads']
);
+ $help .= $mem_warning;
$help .= '<br><br>' . t('You can adjust these settings in the server php.ini file.');
$this->check_add($checks, t('PHP upload limits'), true, false, $help);
diff --git a/Zotlabs/Update/_1230.php b/Zotlabs/Update/_1230.php
new file mode 100644
index 000000000..fe59f2e08
--- /dev/null
+++ b/Zotlabs/Update/_1230.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1230 {
+
+ function run() {
+ q("update abook set abook_closeness = 80 where abook_closeness = 0 and abook_self = 0");
+ return UPDATE_SUCCESS;
+
+ }
+} \ No newline at end of file