aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Apps.php8
-rw-r--r--Zotlabs/Module/Defperms.php46
-rw-r--r--Zotlabs/Module/Uexport.php21
-rw-r--r--Zotlabs/Widget/Settings_menu.php17
4 files changed, 57 insertions, 35 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index ec1f3f9dc..8db4e000f 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -271,6 +271,10 @@ class Apps {
if(! can_view_public_stream())
unset($ret);
break;
+ case 'custom_role':
+ if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
+ unset($ret);
+ break;
case 'observer':
if(! $observer)
unset($ret);
@@ -468,6 +472,10 @@ class Apps {
if(! can_view_public_stream())
return '';
break;
+ case 'custom_role':
+ if(get_pconfig(local_channel(),'system','permissions_role') != 'custom')
+ return '';
+ break;
case 'observer':
$observer = \App::get_observer();
if(! $observer)
diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php
index 2e886aa64..463ecb57a 100644
--- a/Zotlabs/Module/Defperms.php
+++ b/Zotlabs/Module/Defperms.php
@@ -1,15 +1,16 @@
<?php
namespace Zotlabs\Module;
+use App;
use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
require_once('include/socgraph.php');
require_once('include/selectors.php');
require_once('include/group.php');
require_once('include/photos.php');
-
-class Defperms extends \Zotlabs\Web\Controller {
+class Defperms extends Controller {
/* @brief Initialize the connection-editor
*
@@ -20,6 +21,9 @@ class Defperms extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
+
+ if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
+ return;
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
@@ -27,10 +31,10 @@ class Defperms extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
- \App::$poi = $r[0];
+ App::$poi = $r[0];
}
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if($channel)
head_set_icon($channel['xchan_photo_s']);
}
@@ -44,12 +48,15 @@ class Defperms extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
+
+ if(! Apps::system_app_installed(local_channel(), 'Default Permissions'))
+ return;
$contact_id = intval(argv(1));
if(! $contact_id)
return;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
@@ -113,7 +120,7 @@ class Defperms extends \Zotlabs\Web\Controller {
intval($contact_id)
);
if($r) {
- \App::$poi = $r[0];
+ App::$poi = $r[0];
}
@@ -132,22 +139,22 @@ class Defperms extends \Zotlabs\Web\Controller {
function defperms_clone(&$a) {
- if(! \App::$poi)
+ if(! App::$poi)
return;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_channel()),
- intval(\App::$poi['abook_id'])
+ intval(App::$poi['abook_id'])
);
if($r) {
- \App::$poi = array_shift($r);
+ App::$poi = array_shift($r);
}
- $clone = \App::$poi;
+ $clone = App::$poi;
unset($clone['abook_id']);
unset($clone['abook_account']);
@@ -174,9 +181,18 @@ class Defperms extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
return login();
}
+
+ if(! Apps::system_app_installed(local_channel(), 'Default Permissions')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>' . t('Default Permissions App') . ' (' . t('Not Installed') . '):</b><br>';
+ $o .= t('Set custom default permissions for new connections');
+ return $o;
+ }
$section = ((array_key_exists('section',$_REQUEST)) ? $_REQUEST['section'] : '');
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$yes_no = array(t('No'),t('Yes'));
@@ -194,7 +210,7 @@ class Defperms extends \Zotlabs\Web\Controller {
}
$o .= " }\n</script>\n";
- if(\App::$poi) {
+ if(App::$poi) {
$sections = [];
@@ -204,9 +220,9 @@ class Defperms extends \Zotlabs\Web\Controller {
$perms = array();
- $channel = \App::get_channel();
+ $channel = App::get_channel();
- $contact = \App::$poi;
+ $contact = App::$poi;
$global_perms = \Zotlabs\Access\Permissions::Perms();
diff --git a/Zotlabs/Module/Uexport.php b/Zotlabs/Module/Uexport.php
index 9af1887dc..3d1587b87 100644
--- a/Zotlabs/Module/Uexport.php
+++ b/Zotlabs/Module/Uexport.php
@@ -1,18 +1,24 @@
<?php
namespace Zotlabs\Module;
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
-class Uexport extends \Zotlabs\Web\Controller {
+class Uexport extends Controller {
function init() {
if(! local_channel())
killme();
-
+
+ if(! Apps::system_app_installed(local_channel(), 'Channel Export'))
+ return;
+
if(argc() > 1) {
$sections = (($_REQUEST['sections']) ? explode(',',$_REQUEST['sections']) : '');
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if(argc() > 1 && intval(argv(1)) > 1900) {
$year = intval(argv(1));
@@ -47,6 +53,15 @@ class Uexport extends \Zotlabs\Web\Controller {
}
function get() {
+
+ if(! Apps::system_app_installed(local_channel(), 'Channel Export')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>' . t('Channel Export App') . ' (' . t('Not Installed') . '):</b><br>';
+ $o .= t('Export your channel');
+ return $o;
+ }
$y = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index 238b8071e..c537c3835 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -9,15 +9,12 @@ class Settings_menu {
if(! local_channel())
return;
-
$channel = \App::get_channel();
$abook_self_id = 0;
// Retrieve the 'self' address book entry for use in the auto-permissions link
- $role = get_pconfig(local_channel(),'system','permissions_role');
-
$abk = q("select abook_id from abook where abook_channel = %d and abook_self = 1 limit 1",
intval(local_channel())
);
@@ -66,20 +63,6 @@ class Settings_menu {
);
}
- $tabs[] = array(
- 'label' => t('Export channel'),
- 'url' => z_root() . '/uexport',
- 'selected' => ''
- );
-
- if($role === false || $role === 'custom') {
- $tabs[] = array(
- 'label' => t('Connection Default Permissions'),
- 'url' => z_root() . '/defperms',
- 'selected' => ''
- );
- }
-
$tabtpl = get_markup_template("generic_links_widget.tpl");
return replace_macros($tabtpl, array(
'$title' => t('Settings'),