aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Apps.php3
-rw-r--r--Zotlabs/Module/Articles.php2
-rw-r--r--Zotlabs/Module/Cdav.php55
-rw-r--r--Zotlabs/Module/Invite.php25
-rw-r--r--Zotlabs/Module/Lang.php19
-rw-r--r--Zotlabs/Module/Mood.php23
-rw-r--r--Zotlabs/Module/Poke.php21
-rw-r--r--Zotlabs/Module/Settings/Network.php128
-rw-r--r--Zotlabs/Module/Setup.php11
-rw-r--r--Zotlabs/Update/_1220.php47
-rw-r--r--Zotlabs/Web/SubModule.php17
11 files changed, 331 insertions, 20 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 6b87ac6cb..aa7e2282d 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -722,6 +722,9 @@ class Apps {
);
if($r) {
+ $hookinfo = Array('uid'=>$uid,'deleted'=>$deleted,'cats'=>$cats,'apps'=>$r);
+ call_hooks('app_list',$hookinfo);
+ $r = $hookinfo['apps'];
for($x = 0; $x < count($r); $x ++) {
if(! $r[$x]['app_system'])
$r[$x]['type'] = 'personal';
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index d622b221a..7af1ab6b8 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -45,7 +45,7 @@ class Articles extends Controller {
return $o;
}
- nav_set_selected(t('Articles'));
+ nav_set_selected('Articles');
head_add_link([
'rel' => 'alternate',
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index 6737ac4ee..bff308dfa 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -1,12 +1,16 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
+
require_once('include/event.php');
require_once('include/auth.php');
require_once('include/security.php');
-class Cdav extends \Zotlabs\Web\Controller {
+class Cdav extends Controller {
function init() {
@@ -126,8 +130,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 +175,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 +221,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 +832,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 +917,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'),
diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php
index 359f99b3e..234802746 100644
--- a/Zotlabs/Module/Invite.php
+++ b/Zotlabs/Module/Invite.php
@@ -1,6 +1,10 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
+
/**
* module: invite.php
*
@@ -9,7 +13,7 @@ namespace Zotlabs\Module;
*/
-class Invite extends \Zotlabs\Web\Controller {
+class Invite extends Controller {
function post() {
@@ -17,6 +21,10 @@ class Invite extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return;
}
+
+ if(! Apps::system_app_installed(local_channel(), 'Invite')) {
+ return;
+ }
check_form_security_token_redirectOnErr('/', 'send_invite');
@@ -57,7 +65,7 @@ class Invite extends \Zotlabs\Web\Controller {
else
$nmessage = $message;
- $account = \App::get_account();
+ $account = App::get_account();
$res = z_mail(
[
@@ -95,6 +103,15 @@ class Invite extends \Zotlabs\Web\Controller {
return;
}
+ if(! Apps::system_app_installed(local_channel(), 'Invite')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Invite App (Not Installed):</b><br>';
+ $o .= t('Send email invitations to join this network');
+ return $o;
+ }
+
nav_set_selected('Invite');
$tpl = get_markup_template('invite.tpl');
@@ -127,11 +144,11 @@ class Invite extends \Zotlabs\Web\Controller {
}
}
- $ob = \App::get_observer();
+ $ob = App::get_observer();
if(! $ob)
return $o;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$o = replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("send_invite"),
diff --git a/Zotlabs/Module/Lang.php b/Zotlabs/Module/Lang.php
index 0e5d85d05..9858beecd 100644
--- a/Zotlabs/Module/Lang.php
+++ b/Zotlabs/Module/Lang.php
@@ -1,13 +1,28 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
-class Lang extends \Zotlabs\Web\Controller {
+class Lang extends Controller {
function get() {
+
+ if(local_channel()) {
+ if(! Apps::system_app_installed(local_channel(), 'Language')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Language App (Not Installed):</b><br>';
+ $o .= t('Change UI language');
+ return $o;
+ }
+ }
+
nav_set_selected('Language');
return lang_selector();
+
}
-
}
diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php
index ad29ec7e8..cceef5ffa 100644
--- a/Zotlabs/Module/Mood.php
+++ b/Zotlabs/Module/Mood.php
@@ -1,21 +1,29 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
+
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
-class Mood extends \Zotlabs\Web\Controller {
+class Mood extends Controller {
function init() {
if(! local_channel())
return;
+
+ if(! Apps::system_app_installed(local_channel(), 'Mood')) {
+ return;
+ }
$uid = local_channel();
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$verb = notags(trim($_GET['verb']));
if(! $verb)
@@ -60,7 +68,7 @@ class Mood extends \Zotlabs\Web\Controller {
$deny_gid = $channel['channel_deny_gid'];
}
- $poster = \App::get_observer();
+ $poster = App::get_observer();
$mid = item_message_id();
@@ -117,6 +125,15 @@ class Mood extends \Zotlabs\Web\Controller {
return;
}
+ if(! Apps::system_app_installed(local_channel(), 'Mood')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Mood App (Not Installed):</b><br>';
+ $o .= t('Set your current mood and tell your friends');
+ return $o;
+ }
+
nav_set_selected('Mood');
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php
index d13ec5ced..46dcf6dd3 100644
--- a/Zotlabs/Module/Poke.php
+++ b/Zotlabs/Module/Poke.php
@@ -1,6 +1,10 @@
<?php
namespace Zotlabs\Module; /** @file */
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
+
/**
*
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
@@ -18,15 +22,19 @@ namespace Zotlabs\Module; /** @file */
require_once('include/items.php');
-class Poke extends \Zotlabs\Web\Controller {
+class Poke extends Controller {
function init() {
if(! local_channel())
return;
+
+ if(! Apps::system_app_installed(local_channel(), 'Poke')) {
+ return;
+ }
$uid = local_channel();
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$verb = notags(trim($_REQUEST['verb']));
@@ -150,6 +158,15 @@ class Poke extends \Zotlabs\Web\Controller {
return;
}
+ if(! Apps::system_app_installed(local_channel(), 'Poke')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Poke App (Not Installed):</b><br>';
+ $o .= t('Poke somebody in your addressbook');
+ return $o;
+ }
+
nav_set_selected('Poke');
$name = '';
diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php
new file mode 100644
index 000000000..14a118f2c
--- /dev/null
+++ b/Zotlabs/Module/Settings/Network.php
@@ -0,0 +1,128 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Network {
+
+ function post() {
+ check_form_security_token_redirectOnErr('/settings/network', 'settings_network');
+
+ $features = self::get_features();
+
+ foreach($features as $f) {
+ $k = $f[0];
+ if(array_key_exists("feature_$k",$_POST))
+ set_pconfig(local_channel(),'feature',$k, (string) $_POST["feature_$k"]);
+ else
+ set_pconfig(local_channel(),'feature', $k, '');
+ }
+
+ build_sync_packet();
+ return;
+ }
+
+ function get() {
+
+ $features = self::get_features();
+
+ foreach($features as $f) {
+ $arr[] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
+ }
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$action_url' => 'settings/network',
+ '$form_security_token' => get_form_security_token("settings_network"),
+ '$title' => t('Activity Settings'),
+ '$features' => $arr,
+ '$baseurl' => z_root(),
+ '$submit' => t('Submit'),
+ ));
+
+ return $o;
+ }
+
+ function get_features() {
+ $arr = [
+
+ [
+ 'archives',
+ t('Search by Date'),
+ t('Ability to select posts by date ranges'),
+ false,
+ get_config('feature_lock','archives')
+ ],
+
+ [
+ 'savedsearch',
+ t('Saved Searches'),
+ t('Save search terms for re-use'),
+ false,
+ get_config('feature_lock','savedsearch')
+ ],
+
+ [
+ 'order_tab',
+ t('Alternate Stream Order'),
+ t('Ability to order the stream by last post date, last comment date or unthreaded activities'),
+ false,
+ get_config('feature_lock','order_tab')
+ ],
+
+ [
+ 'name_tab',
+ t('Contact Filter'),
+ t('Ability to display only posts of a selected contact'),
+ false,
+ get_config('feature_lock','name_tab')
+ ],
+
+ [
+ 'forums_tab',
+ t('Forum Filter'),
+ t('Ability to display only posts of a specific forum'),
+ false,
+ get_config('feature_lock','forums_tab')
+ ],
+
+ [
+ 'personal_tab',
+ t('Personal Posts Filter'),
+ t('Ability to display only posts that you\'ve interacted on'),
+ false,
+ get_config('feature_lock','personal_tab')
+ ],
+
+ [
+ 'affinity',
+ t('Affinity Tool'),
+ t('Filter stream activity by depth of relationships'),
+ false,
+ get_config('feature_lock','affinity')
+ ],
+
+ [
+ 'suggest',
+ t('Suggest Channels'),
+ t('Show friend and connection suggestions'),
+ false,
+ get_config('feature_lock','suggest')
+ ],
+
+ [
+ 'connfilter',
+ t('Connection Filtering'),
+ t('Filter incoming posts from connections based on keywords/content'),
+ false,
+ get_config('feature_lock','connfilter')
+ ]
+
+ ];
+
+ return $arr;
+
+ }
+
+}
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index a3832d156..50b40834b 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -526,14 +526,21 @@ class Setup extends \Zotlabs\Web\Controller {
$ck_funcs[0]['status'] = false;
$ck_funcs[0]['help'] = t('Error: libCURL PHP module required but not installed.');
}
- if(! function_exists('imagecreatefromjpeg')) {
+ if((! function_exists('imagecreatefromjpeg')) || (! class_exists('Imagick'))) {
$ck_funcs[1]['status'] = false;
- $ck_funcs[1]['help'] = t('Error: GD graphics PHP module with JPEG support required but not installed.');
+ $ck_funcs[1]['help'] = t('Error: GD PHP module with JPEG support or ImageMagick graphics library required but not installed.');
}
if(! function_exists('openssl_public_encrypt')) {
$ck_funcs[2]['status'] = false;
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.');
}
+ if(class_exists('PDO')) {
+ $x = PDO::getAvailableDrivers();
+ if((! in_array('mysql',$x)) && (! in_array('pgsql',$x))) {
+ $ck_funcs[3]['status'] = false;
+ $ck_funcs[3]['help'] = t('Error: PDO database PHP module missing a driver for either mysql or pgsql.');
+ }
+ }
if(! class_exists('PDO')) {
$ck_funcs[3]['status'] = false;
$ck_funcs[3]['help'] = t('Error: PDO database PHP module required but not installed.');
diff --git a/Zotlabs/Update/_1220.php b/Zotlabs/Update/_1220.php
new file mode 100644
index 000000000..adcb8c9c6
--- /dev/null
+++ b/Zotlabs/Update/_1220.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1220 {
+
+ function run() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("CREATE TABLE listeners (
+ id serial NOT NULL,
+ target_id text NOT NULL,
+ portable_id text NOT NULL,
+ ltype smallint NOT NULL DEFAULT '0',
+ PRIMARY KEY (id)
+)");
+
+ $r2 = q("create index \"target_id_idx\" on listeners (\"target_id\")");
+ $r3 = q("create index \"portable_id_idx\" on listeners (\"portable_id\")");
+ $r4 = q("create index \"ltype_idx\" on listeners (\"ltype\")");
+
+ $r = $r1 && $r2 && $r3 && $r4;
+
+ }
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r = q("CREATE TABLE IF NOT EXISTS listeners (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ target_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
+ portable_id varchar(191) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
+ ltype int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (id),
+ KEY target_id (target_id),
+ KEY portable_id (portable_id),
+ KEY ltype (ltype)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8");
+
+ }
+
+ if($r) {
+ return UPDATE_SUCCESS;
+ }
+ return UPDATE_FAILED;
+
+ }
+
+}
diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php
index 7c8404201..763a55d86 100644
--- a/Zotlabs/Web/SubModule.php
+++ b/Zotlabs/Web/SubModule.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Web;
+use Zotlabs\Extend\Route;
+
/*
* @brief
*
@@ -31,9 +33,23 @@ class SubModule {
$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php';
$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg));
+
if(file_exists($filename)) {
$this->controller = new $modname();
}
+
+ $routes = Route::get();
+
+ if($routes) {
+ foreach($routes as $route) {
+ if(is_array($route) && strtolower($route[1]) === strtolower(argv(0)) . '/' . strtolower(argv($whicharg))) {
+ include_once($route[0]);
+ if(class_exists($modname)) {
+ $this->controller = new $modname;
+ }
+ }
+ }
+ }
}
/**
@@ -43,6 +59,7 @@ class SubModule {
* @return boolean|mixed
*/
function call($method) {
+
if(! $this->controller)
return false;