aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-09-15 10:10:43 +0200
committerMario Vavti <mario@mariovavti.com>2018-09-15 10:10:43 +0200
commit7856f5882bceaf83d5df42e117c23badc89ad1a8 (patch)
tree3f297a52bfa3595453d4f02f852d87e423683a67 /Zotlabs/Module
parentab611e9ef3a2b4bdd4b4f33d72e43c1a6d28331f (diff)
downloadvolse-hubzilla-7856f5882bceaf83d5df42e117c23badc89ad1a8.tar.gz
volse-hubzilla-7856f5882bceaf83d5df42e117c23badc89ad1a8.tar.bz2
volse-hubzilla-7856f5882bceaf83d5df42e117c23badc89ad1a8.zip
appify cdav stuff. WARNING: if you use caldav or carddav from a client or the webinterface you will need to enable those apps to make things work again
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Cdav.php52
1 files changed, 47 insertions, 5 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index 6737ac4ee..69030b582 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -1,6 +1,9 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+
require_once('include/event.php');
require_once('include/auth.php');
@@ -126,8 +129,18 @@ class Cdav extends \Zotlabs\Web\Controller {
$auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . 'CalDAV/CardDAV');
if (local_channel()) {
+
logger('loggedin');
- $channel = \App::get_channel();
+
+ if((argv(1) == 'calendars') && (!Apps::system_app_installed(local_channel(), 'CalDAV'))) {
+ killme();
+ }
+
+ if((argv(1) == 'addressbooks') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) {
+ killme();
+ }
+
+ $channel = App::get_channel();
$auth->setCurrentUser($channel['channel_address']);
$auth->channel_id = $channel['channel_id'];
$auth->channel_hash = $channel['channel_hash'];
@@ -161,12 +174,15 @@ class Cdav extends \Zotlabs\Web\Controller {
$nodes = [
// /principals
new \Sabre\CalDAV\Principal\Collection($principalBackend),
+
// /calendars
new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
+
// /addressbook
- new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
+ new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend)
];
+
// The object tree needs in turn to be passed to the server class
$server = new \Sabre\DAV\Server($nodes);
@@ -204,7 +220,15 @@ class Cdav extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
- $channel = \App::get_channel();
+ if((argv(1) === 'calendar') && (! Apps::system_app_installed(local_channel(), 'CalDAV'))) {
+ return;
+ }
+
+ if((argv(1) === 'addressbook') && (! Apps::system_app_installed(local_channel(), 'CardDAV'))) {
+ return;
+ }
+
+ $channel = App::get_channel();
$principalUri = 'principals/' . $channel['channel_address'];
if(!cdav_principal($principalUri))
@@ -807,7 +831,25 @@ class Cdav extends \Zotlabs\Web\Controller {
if(!local_channel())
return;
- $channel = \App::get_channel();
+ if((argv(1) === 'calendar') && (! Apps::system_app_installed(local_channel(), 'CalDAV'))) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>CalDAV App (Not Installed):</b><br>';
+ $o .= t('CalDAV capable calendar');
+ return $o;
+ }
+
+ if((argv(1) === 'addressbook') && (! Apps::system_app_installed(local_channel(), 'CardDAV'))) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>CardDAV App (Not Installed):</b><br>';
+ $o .= t('CalDAV capable addressbook');
+ return $o;
+ }
+
+ $channel = App::get_channel();
$principalUri = 'principals/' . $channel['channel_address'];
$pdo = \DBA::$dba->db;
@@ -874,7 +916,7 @@ class Cdav extends \Zotlabs\Web\Controller {
$o .= replace_macros(get_markup_template('cdav_calendar.tpl'), [
'$sources' => $sources,
'$color' => $color,
- '$lang' => \App::$language,
+ '$lang' => App::$language,
'$first_day' => $first_day,
'$prev' => t('Previous'),
'$next' => t('Next'),