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.php4
-rw-r--r--Zotlabs/Module/Settings/Channel.php17
-rw-r--r--Zotlabs/Module/Settings/Channel_home.php67
-rw-r--r--Zotlabs/Module/Settings/Connections.php4
-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.php4
-rw-r--r--Zotlabs/Module/Settings/Events.php4
-rw-r--r--Zotlabs/Module/Settings/Features.php35
-rw-r--r--Zotlabs/Module/Settings/Manage.php4
-rw-r--r--Zotlabs/Module/Settings/Network.php28
-rw-r--r--Zotlabs/Module/Settings/Oauth.php161
-rw-r--r--Zotlabs/Module/Settings/Oauth2.php184
-rw-r--r--Zotlabs/Module/Settings/Permcats.php120
-rw-r--r--Zotlabs/Module/Settings/Photos.php4
-rw-r--r--Zotlabs/Module/Settings/Profiles.php4
-rw-r--r--Zotlabs/Module/Settings/Tokens.php173
19 files changed, 247 insertions, 720 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
index b3a611cdf..a27bf0fa5 100644
--- a/Zotlabs/Module/Settings/Calendar.php
+++ b/Zotlabs/Module/Settings/Calendar.php
@@ -16,6 +16,10 @@ class Calendar {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 27a8e695d..6b49f165d 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') )
);
@@ -432,7 +434,7 @@ class Channel {
'$nickname' => (($intl_nickname === $webbie) ? $webbie : $intl_nickname . ' (' . $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()
));
@@ -490,11 +492,6 @@ 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');
@@ -556,8 +553,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,
diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php
new file mode 100644
index 000000000..0e916d530
--- /dev/null
+++ b/Zotlabs/Module/Settings/Channel_home.php
@@ -0,0 +1,67 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+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);
+
+ 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')
+ ];
+
+ $extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
+ [
+ '$field' => $channel_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('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
index 70b4daa42..cac357791 100644
--- a/Zotlabs/Module/Settings/Connections.php
+++ b/Zotlabs/Module/Settings/Connections.php
@@ -16,6 +16,10 @@ class Connections {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
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
index 93e3ce602..5e7a9473a 100644
--- a/Zotlabs/Module/Settings/Editor.php
+++ b/Zotlabs/Module/Settings/Editor.php
@@ -16,6 +16,10 @@ class Editor {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php
index fcb4441e1..eb6dda99b 100644
--- a/Zotlabs/Module/Settings/Events.php
+++ b/Zotlabs/Module/Settings/Events.php
@@ -16,6 +16,10 @@ class Events {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
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
index 15d3216e9..9bae12022 100644
--- a/Zotlabs/Module/Settings/Manage.php
+++ b/Zotlabs/Module/Settings/Manage.php
@@ -16,6 +16,10 @@ class Manage {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php
index c51b780f1..aaafe9255 100644
--- a/Zotlabs/Module/Settings/Network.php
+++ b/Zotlabs/Module/Settings/Network.php
@@ -14,8 +14,18 @@ class Network {
$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;
}
@@ -26,6 +36,19 @@ class Network {
$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(
@@ -33,8 +56,9 @@ class Network {
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Activity Settings'),
- '$features' => process_module_features_get(local_channel(), $features),
- '$submit' => t('Submit')
+ '$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 70fd3a5c3..000000000
--- a/Zotlabs/Module/Settings/Oauth2.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-
-namespace Zotlabs\Module\Settings;
-
-
-class Oauth2 {
-
-
- function post() {
-
- if(x($_POST,'remove')){
- check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
- $name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : '');
- logger("REMOVE! ".$name." uid: ".local_channel());
- $key = $_POST['remove'];
- q("DELETE FROM oauth_authorization_codes WHERE client_id='%s' AND user_id=%d",
- dbesc($name),
- intval(local_channel())
- );
- q("DELETE FROM oauth_access_tokens WHERE client_id='%s' AND user_id=%d",
- dbesc($name),
- intval(local_channel())
- );
- q("DELETE FROM oauth_refresh_tokens WHERE client_id='%s' AND user_id=%d",
- dbesc($name),
- 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' and user_id = %s",
- dbesc($name),
- dbesc($secret),
- dbesc($redirect),
- dbesc($grant),
- dbesc($scope),
- intval(local_channel()),
- dbesc($name),
- intval(local_channel()));
- } 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 specifically requires this')),
- '$scope' => array('scope', t('Authorization scope'), $app['scope'], t('leave blank unless your application specifically 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())
- );
- $r = q("DELETE FROM oauth_access_tokens WHERE client_id = '%s' AND user_id = %d",
- dbesc(argv(3)),
- intval(local_channel())
- );
- $r = q("DELETE FROM oauth_authorization_codes WHERE client_id = '%s' AND user_id = %d",
- dbesc(argv(3)),
- intval(local_channel())
- );
- $r = q("DELETE FROM oauth_refresh_tokens 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 AND
- oauth_clients.user_id=oauth_access_tokens.user_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
index f403b4d38..9edbaa929 100644
--- a/Zotlabs/Module/Settings/Photos.php
+++ b/Zotlabs/Module/Settings/Photos.php
@@ -16,6 +16,10 @@ class Photos {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php
index 78dc0160e..2dc037317 100644
--- a/Zotlabs/Module/Settings/Profiles.php
+++ b/Zotlabs/Module/Settings/Profiles.php
@@ -16,6 +16,10 @@ class Profiles {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
+
+ if($_POST['rpath'])
+ goaway($_POST['rpath']);
+
return;
}
diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Settings/Tokens.php
deleted file mode 100644
index e59cf8d1c..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 : ''),false);
-
- 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;
- }
-
-}