aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Settings
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Settings')
-rw-r--r--Zotlabs/Module/Settings/Account.php15
-rw-r--r--Zotlabs/Module/Settings/Calendar.php47
-rw-r--r--Zotlabs/Module/Settings/Channel.php50
-rw-r--r--Zotlabs/Module/Settings/Channel_home.php95
-rw-r--r--Zotlabs/Module/Settings/Connections.php47
-rw-r--r--Zotlabs/Module/Settings/Conversation.php60
-rw-r--r--Zotlabs/Module/Settings/Directory.php47
-rw-r--r--Zotlabs/Module/Settings/Display.php32
-rw-r--r--Zotlabs/Module/Settings/Editor.php47
-rw-r--r--Zotlabs/Module/Settings/Events.php47
-rw-r--r--Zotlabs/Module/Settings/Features.php35
-rw-r--r--Zotlabs/Module/Settings/Manage.php47
-rw-r--r--Zotlabs/Module/Settings/Network.php67
-rw-r--r--Zotlabs/Module/Settings/Oauth.php161
-rw-r--r--Zotlabs/Module/Settings/Oauth2.php161
-rw-r--r--Zotlabs/Module/Settings/Permcats.php120
-rw-r--r--Zotlabs/Module/Settings/Photos.php47
-rw-r--r--Zotlabs/Module/Settings/Profiles.php56
-rw-r--r--Zotlabs/Module/Settings/Tokens.php173
19 files changed, 629 insertions, 725 deletions
diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php
index 9643c5958..b40f516ca 100644
--- a/Zotlabs/Module/Settings/Account.php
+++ b/Zotlabs/Module/Settings/Account.php
@@ -12,7 +12,6 @@ class Account {
$errs = array();
$email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
- $techlevel = ((array_key_exists('techlevel',$_POST)) ? intval($_POST['techlevel']) : 0);
$account = \App::get_account();
if($email != $account['account_email']) {
@@ -32,13 +31,6 @@ class Account {
$errs[] = t('System failure storing new email. Please try again.');
}
}
- if($techlevel != $account['account_level']) {
- $r = q("update account set account_level = %d where account_id = %d",
- intval($techlevel),
- intval($account['account_id'])
- );
- info( t('Technical skill level updated') . EOL);
- }
if($errs) {
foreach($errs as $err)
@@ -101,11 +93,6 @@ class Account {
$email = \App::$account['account_email'];
- $techlevels = \Zotlabs\Lib\Techlevels::levels();
-
- $def_techlevel = \App::$account['account_level'];
- $techlock = get_config('system','techlevel_lock');
-
$tpl = get_markup_template("settings_account.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_account"),
@@ -113,8 +100,6 @@ class Account {
'$origpass' => array('origpass', t('Current Password'), ' ',''),
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
- '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
- '$techlock' => $techlock,
'$submit' => t('Submit'),
'$email' => array('email', t('Email Address:'), $email, ''),
'$removeme' => t('Remove Account'),
diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php
new file mode 100644
index 000000000..a27bf0fa5
--- /dev/null
+++ b/Zotlabs/Module/Settings/Calendar.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Calendar {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('CalDAV Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 3a6e03588..b0115d352 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Module\Settings;
+use Zotlabs\Lib\Apps;
+
require_once('include/selectors.php');
@@ -63,7 +65,7 @@ class Channel {
}
$hide_presence = 1 - (intval($role_permissions['online']));
if($role_permissions['default_collection']) {
- $r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
+ $r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@@ -71,7 +73,7 @@ class Channel {
require_once('include/group.php');
group_add(local_channel(), t('Friends'));
group_add_member(local_channel(),t('Friends'),$channel['channel_hash']);
- $r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
+ $r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1",
intval(local_channel()),
dbesc( t('Friends') )
);
@@ -133,8 +135,6 @@ class Channel {
$photo_path = ((x($_POST,'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : '');
$attach_path = ((x($_POST,'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : '');
- $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
-
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
$expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
$expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0);
@@ -154,10 +154,7 @@ class Channel {
$adult = (($_POST['adult'] == 1) ? 1 : 0);
$defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default');
- $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0);
$mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : '');
- $profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
-
$pageflags = $channel['channel_pageflags'];
$existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0);
@@ -245,16 +242,13 @@ class Channel {
set_pconfig(local_channel(),'system','post_joingroup', $post_joingroup);
set_pconfig(local_channel(),'system','post_profilechange', $post_profilechange);
set_pconfig(local_channel(),'system','blocktags',$blocktags);
- set_pconfig(local_channel(),'system','channel_menu',$channel_menu);
set_pconfig(local_channel(),'system','vnotify',$vnotify);
set_pconfig(local_channel(),'system','always_show_in_notices',$always_show_in_notices);
set_pconfig(local_channel(),'system','evdays',$evdays);
set_pconfig(local_channel(),'system','photo_path',$photo_path);
set_pconfig(local_channel(),'system','attach_path',$attach_path);
- set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day);
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
- set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
set_pconfig(local_channel(),'system','autoperms',$autoperms);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
@@ -434,7 +428,7 @@ class Channel {
'$nickname' => (($intl_nickname === $webbie) ? $webbie : $intl_nickname . '&nbsp;(' . $webbie . ')'),
'$subdir' => $subdir,
'$davdesc' => t('Your files/photos are accessible via WebDAV at'),
- '$davpath' => ((get_account_techlevel() > 3) ? z_root() . '/dav/' . $nickname : ''),
+ '$davpath' => z_root() . '/dav/' . $nickname,
'$basepath' => \App::get_hostname()
));
@@ -460,18 +454,6 @@ class Channel {
require_once('include/group.php');
$group_select = mini_group_select(local_channel(),$channel['channel_default_group']);
- require_once('include/menu.php');
- $m1 = menu_list(local_channel());
- $menu = false;
- if($m1) {
- $menu = array();
- $current = get_pconfig(local_channel(),'system','channel_menu');
- $menu[] = array('name' => '', 'selected' => ((! $current) ? true : false));
- foreach($m1 as $m) {
- $menu[] = array('name' => htmlspecialchars($m['menu_name'],ENT_COMPAT,'UTF-8'), 'selected' => (($m['menu_name'] === $current) ? ' selected="selected" ' : false));
- }
- }
-
$evdays = get_pconfig(local_channel(),'system','evdays');
if(! $evdays)
$evdays = 3;
@@ -492,18 +474,13 @@ class Channel {
$permissions_set = (($permissions_role != 'custom') ? true : false);
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
- if((get_account_techlevel() < 4) && $permissions_role !== 'custom')
- unset($perm_roles[t('Other')]);
-
-
-
$vnotify = get_pconfig(local_channel(),'system','vnotify');
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
if($vnotify === false)
$vnotify = (-1);
- $plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ];
+ $plugin = [ 'basic' => '', 'security' => '', 'notify' => '' ];
call_hooks('channel_settings',$plugin);
$disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1;
@@ -548,8 +525,6 @@ class Channel {
'$permissions' => t('Default Privacy Group'),
'$permdesc' => t("\x28click to open/close\x29"),
'$aclselect' => populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
- '$profseltxt' => t('Profile to assign new connections'),
- '$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''),
'$allow_cid' => acl2json($perm_defaults['allow_cid']),
'$allow_gid' => acl2json($perm_defaults['allow_gid']),
@@ -558,8 +533,8 @@ class Channel {
'$suggestme' => $suggestme,
'$group_select' => $group_select,
'$role' => array('permissions_role' , t('Channel role and privacy'), $permissions_role, '', $perm_roles),
- '$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ],
- '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
+ '$defpermcat' => [ 'defpermcat', t('Default permissions category'), $default_permcat, '', $permcats ],
+ '$permcat_enable' => Apps::system_app_installed(local_channel(), 'Permission Categories'),
'$profile_in_dir' => $profile_in_dir,
'$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall,
@@ -587,7 +562,7 @@ class Channel {
'$lbl_vnot' => t('Show visual notifications including:'),
- '$vnotify1' => array('vnotify1', t('Unseen grid activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no),
+ '$vnotify1' => array('vnotify1', t('Unseen stream activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no),
'$vnotify2' => array('vnotify2', t('Unseen channel activity'), ($vnotify & VNOTIFY_CHANNEL), VNOTIFY_CHANNEL, '', $yes_no),
'$vnotify3' => array('vnotify3', t('Unseen private messages'), ($vnotify & VNOTIFY_MAIL), VNOTIFY_MAIL, t('Recommended'), $yes_no),
'$vnotify4' => array('vnotify4', t('Upcoming events'), ($vnotify & VNOTIFY_EVENT), VNOTIFY_EVENT, '', $yes_no),
@@ -599,7 +574,7 @@ class Channel {
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no),
'$vnotify11' => ((is_site_admin()) ? array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no) : array()),
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
- '$vnotify13' => (($disable_discover_tab && !$site_firehose) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
+ '$vnotify13' => ((($disable_discover_tab && !$site_firehose) || !Apps::system_app_installed(local_channel(), 'Public Stream')) ? array() : array('vnotify13', t('Unseen public stream activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
'$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no),
'$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ],
@@ -609,7 +584,6 @@ class Channel {
'$basic_addon' => $plugin['basic'],
'$sec_addon' => $plugin['security'],
'$notify_addon' => $plugin['notify'],
- '$misc_addon' => $plugin['misc'],
'$h_advn' => t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'),
@@ -617,12 +591,8 @@ class Channel {
'$lbl_misc' => t('Miscellaneous Settings'),
'$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), t('%Y - current year, %m - current month')),
'$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), t('%Y - current year, %m - current month')),
- '$menus' => $menu,
- '$menu_desc' => t('Personal menu to display in your channel pages'),
'$removeme' => t('Remove Channel'),
'$removechannel' => t('Remove this channel.'),
- '$firefoxshare' => t('Firefox Share $Projectname provider'),
- '$cal_first_day' => array('first_day', t('Start calendar week on Monday'), ((get_pconfig(local_channel(),'system','cal_first_day')) ? 1 : ''), '', $yes_no),
));
call_hooks('settings_form',$o);
diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php
new file mode 100644
index 000000000..b6ecf4ff1
--- /dev/null
+++ b/Zotlabs/Module/Settings/Channel_home.php
@@ -0,0 +1,95 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+require_once('include/menu.php');
+
+class Channel_home {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
+ if($channel_divmore_height < 50)
+ $channel_divmore_height = 50;
+ set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
+
+ $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
+ set_pconfig(local_channel(),'system','channel_menu',$channel_menu);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $channel_divmore_height = [
+ 'channel_divmore_height',
+ t('Max height of content (in pixels)'),
+ ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400),
+ t('Click to expand content exceeding this height')
+ ];
+
+ $menus = menu_list(local_channel());
+ if($menus) {
+ $current = get_pconfig(local_channel(),'system','channel_menu');
+ $menu[] = '';
+ foreach($menus as $m) {
+ $menu[$m['menu_name']] = htmlspecialchars($m['menu_name'],ENT_COMPAT,'UTF-8');
+ }
+
+ $menu_select = [
+ 'channel_menu',
+ t('Personal menu to display in your channel pages'),
+ $current,
+ '',
+ $menu
+ ];
+ }
+
+ $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
+ [
+ '$field' => $channel_divmore_height
+ ]
+ );
+
+ if($menu) {
+ $extra_settings_html .= replace_macros(get_markup_template('field_select.tpl'),
+ [
+ '$field' => $menu_select
+ ]
+ );
+ }
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Channel Home Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$extra_settings_html' => $extra_settings_html,
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php
new file mode 100644
index 000000000..cac357791
--- /dev/null
+++ b/Zotlabs/Module/Settings/Connections.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Connections {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Connections Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Conversation.php b/Zotlabs/Module/Settings/Conversation.php
new file mode 100644
index 000000000..43e59a3c2
--- /dev/null
+++ b/Zotlabs/Module/Settings/Conversation.php
@@ -0,0 +1,60 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Conversation {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['aj']) {
+ if($_POST['auto_update'] == 1)
+ info(t('Settings saved.') . EOL);
+ else
+ info(t('Settings saved. Reload page please.') . EOL);
+
+ killme();
+ }
+ else {
+ return;
+ }
+ }
+
+ function get() {
+
+ $aj = ((isset($_GET['aj'])) ? true : false);
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+
+ $tpl = (($aj) ? get_markup_template("settings_module_ajax.tpl") : get_markup_template("settings_module.tpl"));
+
+ $o .= replace_macros($tpl, array(
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Conversation Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ if($aj) {
+ echo $o;
+ killme();
+ }
+ else {
+ return $o;
+ }
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Directory.php b/Zotlabs/Module/Settings/Directory.php
new file mode 100644
index 000000000..13fe6eb79
--- /dev/null
+++ b/Zotlabs/Module/Settings/Directory.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Directory {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Directory Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index 340b3c0bb..45d80e011 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -27,16 +27,8 @@ class Display {
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0);
- $channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0);
- $network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0);
$manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0);
-
- $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
- if($channel_divmore_height < 50)
- $channel_divmore_height = 50;
- $network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
- if($network_divmore_height < 50)
- $network_divmore_height = 50;
+ $start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0);
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
@@ -54,12 +46,9 @@ class Display {
set_pconfig(local_channel(),'system','itemspage', $itemspage);
set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile));
set_pconfig(local_channel(),'system','title_tosource',$title_tosource);
- set_pconfig(local_channel(),'system','channel_list_mode', $channel_list_mode);
- set_pconfig(local_channel(),'system','network_list_mode', $network_list_mode);
- set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
- set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update);
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
+ set_pconfig(local_channel(),'system','start_menu', $start_menu);
$newschema = '';
if($theme){
@@ -150,6 +139,14 @@ class Display {
$theme_selected = explode(':', $theme_selected)[0];
}
+ $account = \App::get_account();
+
+ if($account['account_created'] > datetime_convert('','','now - 60 days')) {
+ $start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 1);
+ }
+ else {
+ $start_menu = get_pconfig(local_channel(), 'system', 'start_menu', 0);
+ }
$preload_images = get_pconfig(local_channel(),'system','preload_images');
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0
@@ -204,15 +201,8 @@ class Display {
'$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ],
'$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no),
'$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no),
- '$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
- '$expert' => feature_enabled(local_channel(),'advanced_theming'),
- '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no),
- '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no),
- '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
- '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
-
-
+ '$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no]
));
call_hooks('display_settings',$o);
diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php
new file mode 100644
index 000000000..5e7a9473a
--- /dev/null
+++ b/Zotlabs/Module/Settings/Editor.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Editor {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Editor Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php
new file mode 100644
index 000000000..eb6dda99b
--- /dev/null
+++ b/Zotlabs/Module/Settings/Events.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Events {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Events Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php
index 888032c28..6a3ab104b 100644
--- a/Zotlabs/Module/Settings/Features.php
+++ b/Zotlabs/Module/Settings/Features.php
@@ -26,44 +26,14 @@ class Features {
function get() {
$arr = [];
- $harr = [];
- if(intval($_REQUEST['techlevel']))
- $level = intval($_REQUEST['techlevel']);
- else {
- $level = get_account_techlevel();
- }
-
- if(! intval($level)) {
- notice( t('Permission denied.') . EOL);
- return;
- }
-
- $techlevels = \Zotlabs\Lib\Techlevels::levels();
-
- // This page isn't accessible at techlevel 0
-
- unset($techlevels[0]);
-
- $def_techlevel = (($level > 0) ? $level : 1);
- $techlock = get_config('system','techlevel_lock');
-
- $all_features_raw = get_features(false);
-
- foreach($all_features_raw as $fname => $fdata) {
- foreach(array_slice($fdata,1) as $f) {
- $harr[$f[0]] = ((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : '');
- }
- }
-
- $features = get_features(true,$level);
+ $features = get_features(false);
foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
$arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
- unset($harr[$f[0]]);
}
}
@@ -71,10 +41,7 @@ class Features {
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_features"),
'$title' => t('Additional Features'),
- '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
- '$techlock' => $techlock,
'$features' => $arr,
- '$hiddens' => $harr,
'$baseurl' => z_root(),
'$submit' => t('Submit'),
));
diff --git a/Zotlabs/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php
new file mode 100644
index 000000000..9bae12022
--- /dev/null
+++ b/Zotlabs/Module/Settings/Manage.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Manage {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Channel Manager Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php
new file mode 100644
index 000000000..ae02b06e9
--- /dev/null
+++ b/Zotlabs/Module/Settings/Network.php
@@ -0,0 +1,67 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Network {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ $network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
+ if($network_divmore_height < 50)
+ $network_divmore_height = 50;
+
+ set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $network_divmore_height = [
+ 'network_divmore_height',
+ t('Max height of content (in pixels)'),
+ ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400),
+ t('Click to expand content exceeding this height')
+ ];
+
+ $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
+ [
+ '$field' => $network_divmore_height
+ ]
+ );
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Stream Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$extra_settings_html' => $extra_settings_html,
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Oauth.php b/Zotlabs/Module/Settings/Oauth.php
deleted file mode 100644
index d6576c6de..000000000
--- a/Zotlabs/Module/Settings/Oauth.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-namespace Zotlabs\Module\Settings;
-
-
-class Oauth {
-
-
- function post() {
-
- if(x($_POST,'remove')){
- check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
-
- $key = $_POST['remove'];
- q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
- dbesc($key),
- local_channel());
- goaway(z_root()."/settings/oauth/");
- return;
- }
-
- if((argc() > 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) {
-
- check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
-
- $name = ((x($_POST,'name')) ? escape_tags($_POST['name']) : '');
- $key = ((x($_POST,'key')) ? escape_tags($_POST['key']) : '');
- $secret = ((x($_POST,'secret')) ? escape_tags($_POST['secret']) : '');
- $redirect = ((x($_POST,'redirect')) ? escape_tags($_POST['redirect']) : '');
- $icon = ((x($_POST,'icon')) ? escape_tags($_POST['icon']) : '');
- $oauth2 = ((x($_POST,'oauth2')) ? intval($_POST['oauth2']) : 0);
- $ok = true;
- if($name == '') {
- $ok = false;
- notice( t('Name is required') . EOL);
- }
- if($key == '' || $secret == '') {
- $ok = false;
- notice( t('Key and Secret are required') . EOL);
- }
-
- if($ok) {
- if ($_POST['submit']==t("Update")){
- $r = q("UPDATE clients SET
- client_id='%s',
- pw='%s',
- clname='%s',
- redirect_uri='%s',
- icon='%s',
- uid=%d
- WHERE client_id='%s'",
- dbesc($key),
- dbesc($secret),
- dbesc($name),
- dbesc($redirect),
- dbesc($icon),
- intval(local_channel()),
- dbesc($key));
- } else {
- $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
- VALUES ('%s','%s','%s','%s','%s',%d)",
- dbesc($key),
- dbesc($secret),
- dbesc($name),
- dbesc($redirect),
- dbesc($icon),
- intval(local_channel())
- );
- $r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
- dbesc($key),
- intval(local_channel()),
- dbesc('all')
- );
- }
- }
- goaway(z_root()."/settings/oauth/");
- return;
- }
- }
-
- function get() {
-
- if((argc() > 2) && (argv(2) === 'add')) {
- $tpl = get_markup_template("settings_oauth_edit.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth"),
- '$title' => t('Add application'),
- '$submit' => t('Submit'),
- '$cancel' => t('Cancel'),
- '$name' => array('name', t('Name'), '', t('Name of application')),
- '$key' => array('key', t('Consumer Key'), random_string(16), t('Automatically generated - change if desired. Max length 20')),
- '$secret' => array('secret', t('Consumer Secret'), random_string(16), t('Automatically generated - change if desired. Max length 20')),
- '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')),
- '$icon' => array('icon', t('Icon url'), '', t('Optional')),
- ));
- return $o;
- }
-
- if((argc() > 3) && (argv(2) === 'edit')) {
- $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d",
- dbesc(argv(3)),
- local_channel());
-
- if (!count($r)){
- notice(t('Application not found.'));
- return;
- }
- $app = $r[0];
-
- $tpl = get_markup_template("settings_oauth_edit.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth"),
- '$title' => t('Add application'),
- '$submit' => t('Update'),
- '$cancel' => t('Cancel'),
- '$name' => array('name', t('Name'), $app['clname'] , ''),
- '$key' => array('key', t('Consumer Key'), $app['client_id'], ''),
- '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''),
- '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''),
- '$icon' => array('icon', t('Icon url'), $app['icon'], ''),
- ));
- return $o;
- }
-
- if((argc() > 3) && (argv(2) === 'delete')) {
- check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
-
- $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
- dbesc(argv(3)),
- local_channel());
- goaway(z_root()."/settings/oauth/");
- return;
- }
-
-
- $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my
- FROM clients
- LEFT JOIN tokens ON clients.client_id=tokens.client_id
- WHERE clients.uid IN (%d,0)",
- local_channel(),
- local_channel());
-
-
- $tpl = get_markup_template("settings_oauth.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth"),
- '$baseurl' => z_root(),
- '$title' => t('Connected Apps'),
- '$add' => t('Add application'),
- '$edit' => t('Edit'),
- '$delete' => t('Delete'),
- '$consumerkey' => t('Client key starts with'),
- '$noname' => t('No name'),
- '$remove' => t('Remove authorization'),
- '$apps' => $r,
- ));
- return $o;
-
- }
-
-} \ No newline at end of file
diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Settings/Oauth2.php
deleted file mode 100644
index 985095115..000000000
--- a/Zotlabs/Module/Settings/Oauth2.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-namespace Zotlabs\Module\Settings;
-
-
-class Oauth2 {
-
-
- function post() {
-
- if(x($_POST,'remove')){
- check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
-
- $key = $_POST['remove'];
- q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
- dbesc($key),
- intval(local_channel())
- );
- goaway(z_root()."/settings/oauth2/");
- return;
- }
-
- if((argc() > 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) {
-
- check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
-
- $name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : '');
- $secret = ((x($_POST,'secret')) ? escape_tags(trim($_POST['secret'])) : '');
- $redirect = ((x($_POST,'redirect')) ? escape_tags(trim($_POST['redirect'])) : '');
- $grant = ((x($_POST,'grant')) ? escape_tags(trim($_POST['grant'])) : '');
- $scope = ((x($_POST,'scope')) ? escape_tags(trim($_POST['scope'])) : '');
-
- $ok = true;
- if($name == '' || $secret == '') {
- $ok = false;
- notice( t('Name and Secret are required') . EOL);
- }
-
- if($ok) {
- if ($_POST['submit']==t("Update")){
- $r = q("UPDATE oauth_clients SET
- client_id = '%s',
- client_secret = '%s',
- redirect_uri = '%s',
- grant_types = '%s',
- scope = '%s',
- user_id = %d
- WHERE client_id='%s'",
- dbesc($name),
- dbesc($secret),
- dbesc($redirect),
- dbesc($grant),
- dbesc($scope),
- intval(local_channel()),
- dbesc($name));
- } else {
- $r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
- VALUES ('%s','%s','%s','%s','%s',%d)",
- dbesc($name),
- dbesc($secret),
- dbesc($redirect),
- dbesc($grant),
- dbesc($scope),
- intval(local_channel())
- );
- $r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
- dbesc($name),
- intval(local_channel()),
- dbesc('all')
- );
- }
- }
- goaway(z_root()."/settings/oauth2/");
- return;
- }
- }
-
- function get() {
-
- if((argc() > 2) && (argv(2) === 'add')) {
- $tpl = get_markup_template("settings_oauth2_edit.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth2"),
- '$title' => t('Add OAuth2 application'),
- '$submit' => t('Submit'),
- '$cancel' => t('Cancel'),
- '$name' => array('name', t('Name'), '', t('Name of application')),
- '$secret' => array('secret', t('Consumer Secret'), random_string(16), t('Automatically generated - change if desired. Max length 20')),
- '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')),
- '$grant' => array('grant', t('Grant Types'), '', t('leave blank unless your application sepcifically requires this')),
- '$scope' => array('scope', t('Authorization scope'), '', t('leave blank unless your application sepcifically requires this')),
- ));
- return $o;
- }
-
- if((argc() > 3) && (argv(2) === 'edit')) {
- $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= %d",
- dbesc(argv(3)),
- intval(local_channel())
- );
-
- if (! $r){
- notice(t('OAuth2 Application not found.'));
- return;
- }
-
- $app = $r[0];
-
- $tpl = get_markup_template("settings_oauth2_edit.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth2"),
- '$title' => t('Add application'),
- '$submit' => t('Update'),
- '$cancel' => t('Cancel'),
- '$name' => array('name', t('Name'), $app['client_id'], t('Name of application')),
- '$secret' => array('secret', t('Consumer Secret'), $app['client_secret'], t('Automatically generated - change if desired. Max length 20')),
- '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], t('Redirect URI - leave blank unless your application specifically requires this')),
- '$grant' => array('grant', t('Grant Types'), $app['grant_types'], t('leave blank unless your application sepcifically requires this')),
- '$scope' => array('scope', t('Authorization scope'), $app['scope'], t('leave blank unless your application sepcifically requires this')),
- ));
- return $o;
- }
-
- if((argc() > 3) && (argv(2) === 'delete')) {
- check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't');
-
- $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = %d",
- dbesc(argv(3)),
- intval(local_channel())
- );
- goaway(z_root()."/settings/oauth2/");
- return;
- }
-
-
- $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = %d) AS my
- FROM oauth_clients
- LEFT JOIN oauth_access_tokens ON oauth_clients.client_id=oauth_access_tokens.client_id
- WHERE oauth_clients.user_id IN (%d,0)",
- intval(local_channel()),
- intval(local_channel())
- );
-
- $tpl = get_markup_template("settings_oauth2.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_oauth2"),
- '$baseurl' => z_root(),
- '$title' => t('Connected OAuth2 Apps'),
- '$add' => t('Add application'),
- '$edit' => t('Edit'),
- '$delete' => t('Delete'),
- '$consumerkey' => t('Client key starts with'),
- '$noname' => t('No name'),
- '$remove' => t('Remove authorization'),
- '$apps' => $r,
- ));
- return $o;
-
- }
-
-}
diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php
deleted file mode 100644
index 40641c3f2..000000000
--- a/Zotlabs/Module/Settings/Permcats.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-namespace Zotlabs\Module\Settings;
-
-
-
-class Permcats {
-
- function post() {
-
- if(! local_channel())
- return;
-
- $channel = \App::get_channel();
-
- check_form_security_token_redirectOnErr('/settings/permcats', 'settings_permcats');
-
-
- $all_perms = \Zotlabs\Access\Permissions::Perms();
-
- $name = escape_tags(trim($_POST['name']));
- if(! $name) {
- notice( t('Permission Name is required.') . EOL);
- return;
- }
-
-
- $pcarr = [];
-
- if($all_perms) {
- foreach($all_perms as $perm => $desc) {
- if(array_key_exists('perms_' . $perm, $_POST)) {
- $pcarr[] = $perm;
- }
- }
- }
-
- \Zotlabs\Lib\Permcat::update(local_channel(),$name,$pcarr);
-
- build_sync_packet();
-
- info( t('Permission category saved.') . EOL);
-
- return;
- }
-
-
- function get() {
-
- if(! local_channel())
- return;
-
- $channel = \App::get_channel();
-
-
- if(argc() > 2)
- $name = hex2bin(argv(2));
-
- if(argc() > 3 && argv(3) === 'drop') {
- \Zotlabs\Lib\Permcat::delete(local_channel(),$name);
- build_sync_packet();
- json_return_and_die([ 'success' => true ]);
- }
-
-
- $desc = t('Use this form to create permission rules for various classes of people or connections.');
-
- $existing = [];
-
- $pcat = new \Zotlabs\Lib\Permcat(local_channel());
- $pcatlist = $pcat->listing();
- $permcats = [];
- if($pcatlist) {
- foreach($pcatlist as $pc) {
- if(($pc['name']) && ($name) && ($pc['name'] == $name))
- $existing = $pc['perms'];
- if(! $pc['system'])
- $permcats[bin2hex($pc['name'])] = $pc['localname'];
- }
- }
-
- $global_perms = \Zotlabs\Access\Permissions::Perms();
-
- foreach($global_perms as $k => $v) {
- $thisperm = \Zotlabs\Lib\Permcat::find_permcat($existing,$k);
- $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k);
-
- if($existing[$k])
- $thisperm = "1";
-
- $perms[] = array('perms_' . $k, $v, '',$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited);
- }
-
-
-
- $tpl = get_markup_template("settings_permcats.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_permcats"),
- '$title' => t('Permission Categories'),
- '$desc' => $desc,
- '$desc2' => $desc2,
- '$tokens' => $t,
- '$permcats' => $permcats,
- '$atoken' => $atoken,
- '$url1' => z_root() . '/channel/' . $channel['channel_address'],
- '$url2' => z_root() . '/photos/' . $channel['channel_address'],
- '$name' => array('name', t('Permission Name') . ' <span class="required">*</span>', (($name) ? $name : ''), ''),
- '$me' => t('My Settings'),
- '$perms' => $perms,
- '$inherited' => t('inherited'),
- '$notself' => 0,
- '$self' => 1,
- '$permlbl' => t('Individual Permissions'),
- '$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'),
- '$submit' => t('Submit')
- ));
- return $o;
- }
-
-}
diff --git a/Zotlabs/Module/Settings/Photos.php b/Zotlabs/Module/Settings/Photos.php
new file mode 100644
index 000000000..9edbaa929
--- /dev/null
+++ b/Zotlabs/Module/Settings/Photos.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Photos {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Photos Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php
new file mode 100644
index 000000000..fb6abf664
--- /dev/null
+++ b/Zotlabs/Module/Settings/Profiles.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+require_once('include/selectors.php');
+
+class Profiles {
+
+ function post() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
+
+ $features = get_module_features($module);
+
+ process_module_features_post(local_channel(), $features, $_POST);
+
+ $profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
+ set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
+
+ build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
+ return;
+ }
+
+ function get() {
+
+ $module = substr(strrchr(strtolower(static::class), '\\'), 1);
+
+ $features = get_module_features($module);
+ $rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
+
+ $extra_settings_html = '';
+ if(feature_enabled(local_channel(),'multi_profiles'))
+ $extra_settings_html = contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign',''));
+
+ $tpl = get_markup_template("settings_module.tpl");
+
+ $o .= replace_macros($tpl, array(
+ '$rpath' => $rpath,
+ '$action_url' => 'settings/' . $module,
+ '$form_security_token' => get_form_security_token('settings_' . $module),
+ '$title' => t('Profiles Settings'),
+ '$features' => process_module_features_get(local_channel(), $features),
+ '$extra_settings_html' => $extra_settings_html,
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}
diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Settings/Tokens.php
deleted file mode 100644
index 619c8b5ba..000000000
--- a/Zotlabs/Module/Settings/Tokens.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-
-namespace Zotlabs\Module\Settings;
-
-
-
-class Tokens {
-
- function post() {
-
- $channel = \App::get_channel();
-
- check_form_security_token_redirectOnErr('/settings/tokens', 'settings_tokens');
- $token_errs = 0;
- if(array_key_exists('token',$_POST)) {
- $atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0);
- $name = trim(escape_tags($_POST['name']));
- $token = trim($_POST['token']);
- if((! $name) || (! $token))
- $token_errs ++;
- if(trim($_POST['expires']))
- $expires = datetime_convert(date_default_timezone_get(),'UTC',$_POST['expires']);
- else
- $expires = NULL_DATE;
- $max_atokens = service_class_fetch(local_channel(),'access_tokens');
- if($max_atokens) {
- $r = q("select count(atoken_id) as total where atoken_uid = %d",
- intval(local_channel())
- );
- if($r && intval($r[0]['total']) >= $max_tokens) {
- notice( sprintf( t('This channel is limited to %d tokens'), $max_tokens) . EOL);
- return;
- }
- }
- }
- if($token_errs) {
- notice( t('Name and Password are required.') . EOL);
- return;
- }
- if($atoken_id) {
- $r = q("update atoken set atoken_name = '%s', atoken_token = '%s', atoken_expires = '%s'
- where atoken_id = %d and atoken_uid = %d",
- dbesc($name),
- dbesc($token),
- dbesc($expires),
- intval($atoken_id),
- intval($channel['channel_id'])
- );
- }
- else {
- $r = q("insert into atoken ( atoken_aid, atoken_uid, atoken_name, atoken_token, atoken_expires )
- values ( %d, %d, '%s', '%s', '%s' ) ",
- intval($channel['channel_account_id']),
- intval($channel['channel_id']),
- dbesc($name),
- dbesc($token),
- dbesc($expires)
- );
- }
-
- $atoken_xchan = substr($channel['channel_hash'],0,16) . '.' . $name;
-
- $all_perms = \Zotlabs\Access\Permissions::Perms();
-
- if($all_perms) {
- foreach($all_perms as $perm => $desc) {
- if(array_key_exists('perms_' . $perm, $_POST)) {
- set_abconfig($channel['channel_id'],$atoken_xchan,'my_perms',$perm,intval($_POST['perms_' . $perm]));
- }
- else {
- set_abconfig($channel['channel_id'],$atoken_xchan,'my_perms',$perm,0);
- }
- }
- }
-
-
- info( t('Token saved.') . EOL);
- return;
- }
-
-
- function get() {
-
- $channel = \App::get_channel();
-
- $atoken = null;
- $atoken_xchan = '';
-
- if(argc() > 2) {
- $id = argv(2);
-
- $atoken = q("select * from atoken where atoken_id = %d and atoken_uid = %d",
- intval($id),
- intval(local_channel())
- );
-
- if($atoken) {
- $atoken = $atoken[0];
- $atoken_xchan = substr($channel['channel_hash'],0,16) . '.' . $atoken['atoken_name'];
- }
-
- if($atoken && argc() > 3 && argv(3) === 'drop') {
- atoken_delete($id);
- $atoken = null;
- $atoken_xchan = '';
- }
- }
-
- $t = q("select * from atoken where atoken_uid = %d",
- intval(local_channel())
- );
-
- $desc = t('Use this form to create temporary access identifiers to share things with non-members. These identities may be used in Access Control Lists and visitors may login using these credentials to access private content.');
-
- $desc2 = t('You may also provide <em>dropbox</em> style access links to friends and associates by adding the Login Password to any specific site URL as shown. Examples:');
-
- $global_perms = \Zotlabs\Access\Permissions::Perms();
- $their_perms = [];
-
- $existing = get_all_perms(local_channel(),(($atoken_xchan) ? $atoken_xchan : ''));
-
- if($atoken_xchan) {
- $theirs = q("select * from abconfig where chan = %d and xchan = '%s' and cat = 'their_perms'",
- intval(local_channel()),
- dbesc($atoken_xchan)
- );
- if($theirs) {
- foreach($theirs as $t) {
- $their_perms[$t['k']] = $t['v'];
- }
- }
- }
- foreach($global_perms as $k => $v) {
- $thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k);
-//fixme
-
- $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k);
-
- if($existing[$k])
- $thisperm = "1";
-
- $perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited);
- }
-
-
-
- $tpl = get_markup_template("settings_tokens.tpl");
- $o .= replace_macros($tpl, array(
- '$form_security_token' => get_form_security_token("settings_tokens"),
- '$title' => t('Guest Access Tokens'),
- '$desc' => $desc,
- '$desc2' => $desc2,
- '$tokens' => $t,
- '$atoken' => $atoken,
- '$url1' => z_root() . '/channel/' . $channel['channel_address'],
- '$url2' => z_root() . '/photos/' . $channel['channel_address'],
- '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', (($atoken) ? $atoken['atoken_name'] : ''),''),
- '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : autoname(8)), ''),
- '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''),
- '$them' => t('Their Settings'),
- '$me' => t('My Settings'),
- '$perms' => $perms,
- '$inherited' => t('inherited'),
- '$notself' => 1,
- '$self' => 0,
- '$permlbl' => t('Individual Permissions'),
- '$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'),
- '$submit' => t('Submit')
- ));
- return $o;
- }
-
-}