aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-08 11:10:10 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-08 11:10:10 +0200
commit62e466f7746b5d7d007c61782f194ac8d0262e24 (patch)
tree8408ef8667a75f43d0c89055b0455b26fbc5ae0a /Zotlabs/Module
parent70777a047d3e952b15b418406a46b7983af60cec (diff)
parent47fd95db9d2edc21f113e5843d87af9d9b62b243 (diff)
downloadvolse-hubzilla-62e466f7746b5d7d007c61782f194ac8d0262e24.tar.gz
volse-hubzilla-62e466f7746b5d7d007c61782f194ac8d0262e24.tar.bz2
volse-hubzilla-62e466f7746b5d7d007c61782f194ac8d0262e24.zip
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Acl.php2
-rw-r--r--Zotlabs/Module/Cdav.php83
-rw-r--r--Zotlabs/Module/Changeaddr.php4
-rw-r--r--Zotlabs/Module/Connections.php18
-rw-r--r--Zotlabs/Module/Cover_photo.php34
-rw-r--r--Zotlabs/Module/Dirsearch.php8
-rw-r--r--Zotlabs/Module/Display.php5
-rw-r--r--Zotlabs/Module/Import.php36
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--Zotlabs/Module/Photo.php45
-rw-r--r--Zotlabs/Module/Subthread.php2
-rw-r--r--Zotlabs/Module/Tagger.php2
12 files changed, 175 insertions, 66 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 738e8fbe2..82c156a9c 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -166,7 +166,7 @@ class Acl extends \Zotlabs\Web\Controller {
if($extra_channels) {
foreach($extra_channels as $channel) {
if(perm_is_allowed(intval($channel), get_observer_hash(),'view_contacts')) {
- if($extra_channel_sql)
+ if($extra_channels_sql)
$extra_channels_sql .= ',';
$extra_channels_sql .= intval($channel);
}
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index d644e48b1..5dd233d28 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -280,9 +280,12 @@ class Cdav extends Controller {
return;
$title = $_REQUEST['title'];
- $dtstart = new \DateTime($_REQUEST['dtstart']);
- if($_REQUEST['dtend'])
- $dtend = new \DateTime($_REQUEST['dtend']);
+ $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']);
+ $dtstart = new \DateTime($start);
+ if($_REQUEST['dtend']) {
+ $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']);
+ $dtend = new \DateTime($end);
+ }
$description = $_REQUEST['description'];
$location = $_REQUEST['location'];
@@ -306,13 +309,17 @@ class Cdav extends Controller {
'DTSTART' => $dtstart
]
]);
- if($dtend)
+ if($dtend) {
$vcalendar->VEVENT->add('DTEND', $dtend);
+ $vcalendar->VEVENT->DTEND['TZID'] = App::$timezone;
+ }
if($description)
$vcalendar->VEVENT->add('DESCRIPTION', $description);
if($location)
$vcalendar->VEVENT->add('LOCATION', $location);
+ $vcalendar->VEVENT->DTSTART['TZID'] = App::$timezone;
+
$calendarData = $vcalendar->serialize();
$caldavBackend->createCalendarObject($id, $objectUri, $calendarData);
@@ -351,8 +358,12 @@ class Cdav extends Controller {
$uri = $_REQUEST['uri'];
$title = $_REQUEST['title'];
- $dtstart = new \DateTime($_REQUEST['dtstart']);
- $dtend = $_REQUEST['dtend'] ? new \DateTime($_REQUEST['dtend']) : '';
+ $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']);
+ $dtstart = new \DateTime($start);
+ if($_REQUEST['dtend']) {
+ $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']);
+ $dtend = new \DateTime($end);
+ }
$description = $_REQUEST['description'];
$location = $_REQUEST['location'];
@@ -404,8 +415,12 @@ class Cdav extends Controller {
return;
$uri = $_REQUEST['uri'];
- $dtstart = new \DateTime($_REQUEST['dtstart']);
- $dtend = $_REQUEST['dtend'] ? new \DateTime($_REQUEST['dtend']) : '';
+ $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']);
+ $dtstart = new \DateTime($start);
+ if($_REQUEST['dtend']) {
+ $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']);
+ $dtend = new \DateTime($end);
+ }
$object = $caldavBackend->getCalendarObject($id, $uri);
@@ -877,12 +892,19 @@ class Cdav extends Controller {
//Display calendar(s) here
if(argc() == 2 && argv(1) === 'calendar') {
- head_add_css('/library/fullcalendar/fullcalendar.css');
+ head_add_css('/library/fullcalendar/packages/core/main.min.css');
+ head_add_css('/library/fullcalendar/packages/daygrid/main.min.css');
+ head_add_css('/library/fullcalendar/packages/timegrid/main.min.css');
+ head_add_css('/library/fullcalendar/packages/list/main.min.css');
head_add_css('cdav_calendar.css');
- head_add_js('/library/moment/moment.min.js', 1);
- head_add_js('/library/fullcalendar/fullcalendar.min.js', 1);
- head_add_js('/library/fullcalendar/locale-all.js', 1);
+ head_add_js('/library/fullcalendar/packages/core/main.min.js');
+ head_add_js('/library/fullcalendar/packages/interaction/main.min.js');
+ head_add_js('/library/fullcalendar/packages/daygrid/main.min.js');
+ head_add_js('/library/fullcalendar/packages/timegrid/main.min.js');
+ head_add_js('/library/fullcalendar/packages/list/main.min.js');
+
+ $sources = '';
foreach($calendars as $calendar) {
$editable = (($calendar['share-access'] == 2) ? 'false' : 'true'); // false/true must be string since we're passing it to javascript
@@ -891,6 +913,7 @@ class Cdav extends Controller {
$switch = get_pconfig(local_channel(), 'cdav_calendar', $calendar['id'][0]);
if($switch) {
$sources .= '{
+ id: ' . $calendar['id'][0] . ',
url: \'/cdav/calendar/json/' . $calendar['id'][0] . '/' . $calendar['id'][1] . '\',
color: \'' . $color . '\'
}, ';
@@ -911,8 +934,8 @@ class Cdav extends Controller {
$first_day = (($first_day) ? $first_day : 0);
$title = ['title', t('Event title')];
- $dtstart = ['dtstart', t('Start date and time'), '', t('Example: YYYY-MM-DD HH:mm')];
- $dtend = ['dtend', t('End date and time'), '', t('Example: YYYY-MM-DD HH:mm')];
+ $dtstart = ['dtstart', t('Start date and time')];
+ $dtend = ['dtend', t('End date and time')];
$description = ['description', t('Description')];
$location = ['location', t('Location')];
@@ -920,6 +943,7 @@ class Cdav extends Controller {
'$sources' => $sources,
'$color' => $color,
'$lang' => App::$language,
+ '$timezone' => App::$timezone,
'$first_day' => $first_day,
'$prev' => t('Previous'),
'$next' => t('Next'),
@@ -952,10 +976,12 @@ class Cdav extends Controller {
//Provide json data for calendar
if(argc() == 5 && argv(1) === 'calendar' && argv(2) === 'json' && intval(argv(3)) && intval(argv(4))) {
+ $events = [];
+
$id = [argv(3), argv(4)];
if(! cdav_perms($id[0],$calendars))
- killme();
+ json_return_and_die($events);
if (x($_GET,'start'))
$start = new \DateTime($_GET['start']);
@@ -969,16 +995,19 @@ class Cdav extends Controller {
$filters['comp-filters'][0]['time-range']['end'] = $end;
$uris = $caldavBackend->calendarQuery($id, $filters);
- if($uris) {
+ if($uris) {
$objects = $caldavBackend->getMultipleCalendarObjects($id, $uris);
-
foreach($objects as $object) {
$vcalendar = \Sabre\VObject\Reader::read($object['calendardata']);
- if(isset($vcalendar->VEVENT->RRULE))
+ if(isset($vcalendar->VEVENT->RRULE)) {
+ // expanding recurrent events seems to loose timezone info
+ // save it here so we can add it later
+ $recurrent_timezone = (string)$vcalendar->VEVENT->DTSTART['TZID'];
$vcalendar = $vcalendar->expand($start, $end);
+ }
foreach($vcalendar->VEVENT as $vevent) {
$title = (string)$vevent->SUMMARY;
@@ -986,14 +1015,15 @@ class Cdav extends Controller {
$dtend = (string)$vevent->DTEND;
$description = (string)$vevent->DESCRIPTION;
$location = (string)$vevent->LOCATION;
-
+ $timezone = (string)$vevent->DTSTART['TZID'];
$rw = ((cdav_perms($id[0],$calendars,true)) ? true : false);
- $recurrent = ((isset($vevent->{'RECURRENCE-ID'})) ? true : false);
-
$editable = $rw ? true : false;
+ $recurrent = ((isset($vevent->{'RECURRENCE-ID'})) ? true : false);
- if($recurrent)
+ if($recurrent) {
$editable = false;
+ $timezone = $recurrent_timezone;
+ }
$allDay = false;
@@ -1007,8 +1037,8 @@ class Cdav extends Controller {
'calendar_id' => $id,
'uri' => $object['uri'],
'title' => $title,
- 'start' => $dtstart,
- 'end' => $dtend,
+ 'start' => datetime_convert($timezone, $timezone, $dtstart, 'c'),
+ 'end' => (($dtend) ? datetime_convert($timezone, $timezone, $dtend, 'c') : ''),
'description' => $description,
'location' => $location,
'allDay' => $allDay,
@@ -1018,11 +1048,8 @@ class Cdav extends Controller {
];
}
}
- json_return_and_die($events);
- }
- else {
- killme();
}
+ json_return_and_die($events);
}
//enable/disable calendars
diff --git a/Zotlabs/Module/Changeaddr.php b/Zotlabs/Module/Changeaddr.php
index 5cd236394..ed139c9f9 100644
--- a/Zotlabs/Module/Changeaddr.php
+++ b/Zotlabs/Module/Changeaddr.php
@@ -31,7 +31,7 @@ class Changeaddr extends \Zotlabs\Web\Controller {
if($account['account_password_changed'] > NULL_DATE) {
$d1 = datetime_convert('UTC','UTC','now - 48 hours');
- if($account['account_password_changed'] > d1) {
+ if($account['account_password_changed'] > $d1) {
notice( t('Channel name changes are not allowed within 48 hours of changing the account password.') . EOL);
return;
}
@@ -49,7 +49,7 @@ class Changeaddr extends \Zotlabs\Web\Controller {
if(check_webbie(array($new_address)) !== $new_address) {
notice( t('Nickname has unsupported characters or is already being used on this site.') . EOL);
- return $ret;
+ return;
}
channel_change_address($channel,$new_address);
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index 6a93b3462..7c8d71210 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -127,6 +127,20 @@ class Connections extends \Zotlabs\Web\Controller {
$unblocked = true;
}
+ switch($_REQUEST['order']) {
+ case 'name_desc':
+ $sql_order = 'xchan_name DESC';
+ break;
+ case 'connected':
+ $sql_order = 'abook_created';
+ break;
+ case 'connected_desc':
+ $sql_order = 'abook_created DESC';
+ break;
+ default:
+ $sql_order = 'xchan_name';
+ }
+
$search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : '');
$tabs = array(
@@ -233,7 +247,7 @@ class Connections extends \Zotlabs\Web\Controller {
}
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
- WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ",
+ WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY $sql_order LIMIT %d OFFSET %d ",
intval(local_channel()),
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
@@ -307,7 +321,7 @@ class Connections extends \Zotlabs\Web\Controller {
'ignore_hover' => t('Ignore connection'),
'ignore' => ((! $rr['abook_ignored']) ? t('Ignore') : false),
'recent_label' => t('Recent activity'),
- 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']),
+ 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']) . '&name=' . $rr['xchan_name'],
'oneway' => $oneway
);
}
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index b911ac991..b67c00cdc 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -48,6 +48,29 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo');
+
+ // Remove cover photo
+ if(isset($_POST['remove'])) {
+
+ $r = q("SELECT resource_id FROM photo WHERE photo_usage = %d AND uid = %d LIMIT 1",
+ intval(PHOTO_COVER),
+ intval(local_channel())
+ );
+
+ if($r) {
+ q("update photo set photo_usage = %d where photo_usage = %d and uid = %d",
+ intval(PHOTO_NORMAL),
+ intval(PHOTO_COVER),
+ intval(local_channel())
+ );
+
+ $sync = attach_export_data($channel,$r[0]['resource_id']);
+ if($sync)
+ build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+ }
+
+ goaway(z_root() . '/cover_photo');
+ }
if((array_key_exists('cropfinal',$_POST)) && ($_POST['cropfinal'] == 1)) {
@@ -195,10 +218,12 @@ logger('gis: ' . print_r($gis,true));
);
return;
}
-
- $channel = \App::get_channel();
+
$this->send_cover_photo_activity($channel,$base_image,$profile);
-
+
+ $sync = attach_export_data($channel,$base_image['resource_id']);
+ if($sync)
+ build_sync_packet($channel['channel_id'],array('file' => array($sync)));
}
else
@@ -215,7 +240,7 @@ logger('gis: ' . print_r($gis,true));
require_once('include/attach.php');
- $res = attach_store(\App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash));
+ $res = attach_store(\App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash, 'nosync' => true));
logger('attach_store: ' . print_r($res,true));
@@ -393,6 +418,7 @@ logger('gis: ' . print_r($gis,true));
'$lbl_profiles' => t('Select a profile:'),
'$title' => t('Change Cover Photo'),
'$submit' => t('Upload'),
+ '$remove' => t('Remove'),
'$profiles' => $profiles,
'$embedPhotos' => t('Use a photo from your albums'),
'$embedPhotosModalTitle' => t('Use a photo from your albums'),
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index 81942860f..26cb82044 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -116,12 +116,12 @@ class Dirsearch extends \Zotlabs\Web\Controller {
$sql_extra .= $this->dir_query_build($joiner,'xchan_name',$name);
if($address)
$sql_extra .= $this->dir_query_build($joiner,'xchan_addr',$address);
- if($city)
- $sql_extra .= $this->dir_query_build($joiner,'xprof_locale',$city);
+ if($locale)
+ $sql_extra .= $this->dir_query_build($joiner,'xprof_locale',$locale);
if($region)
$sql_extra .= $this->dir_query_build($joiner,'xprof_region',$region);
- if($post)
- $sql_extra .= $this->dir_query_build($joiner,'xprof_postcode',$post);
+ if($postcode)
+ $sql_extra .= $this->dir_query_build($joiner,'xprof_postcode',$postcode);
if($country)
$sql_extra .= $this->dir_query_build($joiner,'xprof_country',$country);
if($gender)
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 258aac556..5983578b3 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -175,6 +175,11 @@ class Display extends \Zotlabs\Web\Controller {
return '';
}
}
+ if ($target_item['item_type'] == ITEM_TYPE_CUSTOM) {
+ call_hooks('item_custom_display',$target_item);
+ notice( t('Page not found.') . EOL);
+ return '';
+ }
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 9d047ed7b..a48c690a7 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -8,6 +8,8 @@ require_once('include/import.php');
require_once('include/perm_upgrade.php');
require_once('library/urlify/URLify.php');
+use Zotlabs\Lib\Libzot;
+
/**
* @brief Module for channel import.
@@ -228,13 +230,45 @@ class Import extends \Zotlabs\Web\Controller {
);
// reset the original primary hubloc if it is being seized
-
if($seize) {
$r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ",
dbesc($channel['channel_hash']),
dbesc(z_root())
);
}
+
+ // create a new zot6 hubloc if we have got a channel_portable_id
+ if($channel['channel_portable_id']) {
+ $r = hubloc_store_lowlevel(
+ [
+ 'hubloc_guid' => $channel['channel_guid'],
+ 'hubloc_guid_sig' => 'sha256.' . $channel['channel_guid_sig'],
+ 'hubloc_hash' => $channel['channel_portable_id'],
+ 'hubloc_addr' => channel_reddress($channel),
+ 'hubloc_network' => 'zot6',
+ 'hubloc_primary' => (($seize) ? 1 : 0),
+ 'hubloc_url' => z_root(),
+ 'hubloc_url_sig' => 'sha256.' . base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])),
+ 'hubloc_host' => \App::get_hostname(),
+ 'hubloc_callback' => z_root() . '/zot',
+ 'hubloc_sitekey' => get_config('system','pubkey'),
+ 'hubloc_updated' => datetime_convert(),
+ 'hubloc_id_url' => channel_url($channel),
+ 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(),get_config('system','pubkey'))
+
+ ]
+ );
+
+ // reset the original primary hubloc if it is being seized
+ if($seize) {
+ $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ",
+ dbesc($channel['channel_portable_id']),
+ dbesc(z_root())
+ );
+ }
+
+ }
+
}
logger('import step 5');
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index c466e7c82..6bc8c645f 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -166,7 +166,7 @@ class Item extends Controller {
if(! perm_is_allowed($chan['channel_id'],get_observer_hash(),'view_stream'))
http_status_exit(403, 'Forbidden');
- $i = Activity::encode_item_collection($nitems,'conversation/' . $item_id,'OrderedCollection',( defined('NOMADIC') ? false : true));
+ $i = Activity::encode_item_collection($nitems,'conversation/' . $item_id,'OrderedCollection');
if($portable_id) {
ThreadListener::store(z_root() . '/item/' . $item_id,$portable_id);
}
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 96a4e1f40..6912322aa 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -71,29 +71,32 @@ class Photo extends \Zotlabs\Web\Controller {
$modified = filemtime($default);
$default = z_root() . '/' . $default;
$uid = $person;
+
+ $data = '';
- $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ];
- call_hooks('get_profile_photo',$d);
-
- $resolution = $d['imgscale'];
- $uid = $d['channel_id'];
- $default = $d['default'];
- $data = $d['data'];
- $mimetype = $d['mimetype'];
-
+ $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
+ intval($resolution),
+ intval($uid),
+ intval(PHOTO_PROFILE)
+ );
+ if($r) {
+ $modified = strtotime($r[0]['edited'] . "Z");
+ $mimetype = $r[0]['mimetype'];
+ if(intval($r[0]['os_storage']))
+ $data = file_get_contents($data);
+ else
+ $data = dbunescbin($r[0]['content']);
+ }
+
if(! $data) {
- $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
- intval($resolution),
- intval($uid),
- intval(PHOTO_PROFILE)
- );
- if($r) {
- $modified = strtotime($r[0]['edited'] . "Z");
- $data = dbunescbin($r[0]['content']);
- $mimetype = $r[0]['mimetype'];
- }
- if(intval($r[0]['os_storage']))
- $data = file_get_contents($data);
+ $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ];
+ call_hooks('get_profile_photo',$d);
+
+ $resolution = $d['imgscale'];
+ $uid = $d['channel_id'];
+ $default = $d['default'];
+ $data = $d['data'];
+ $mimetype = $d['mimetype'];
}
if(! $data) {
diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php
index 54343fdfa..30e57197d 100644
--- a/Zotlabs/Module/Subthread.php
+++ b/Zotlabs/Module/Subthread.php
@@ -33,7 +33,7 @@ class Subthread extends \Zotlabs\Web\Controller {
if(! $i) {
$i = q("select * from item where id = %d and uid = %d",
- intval($postid),
+ intval($item_id),
intval($sys['channel_id'])
);
diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php
index 24adf1bde..e6e80dce3 100644
--- a/Zotlabs/Module/Tagger.php
+++ b/Zotlabs/Module/Tagger.php
@@ -69,7 +69,7 @@ class Tagger extends \Zotlabs\Web\Controller {
$post_type = t('photo');
break;
case 'event':
- $targgettype = ACTIVITY_OBJ_EVENT;
+ $targettype = ACTIVITY_OBJ_EVENT;
$post_type = t('event');
break;
default: