X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsettings.php;h=663acd69f0267c974e5bb26776ea65a66261ca1e;hb=4a7c3b9eefd381bb5c77a96a4311ceb558a1c1a5;hp=5ae30d7d366274969a767ebbb373a5e3dae2c4c4;hpb=1ccbf3979913b8cd14534d9fe041ccf01e67e6dc;p=friendica.git
diff --git a/mod/settings.php b/mod/settings.php
index 5ae30d7d36..663acd69f0 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -1,5 +1,7 @@
t('Account'),
- 'url' => $a->get_baseurl(true).'/settings',
+ 'url' => 'settings',
'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''),
+ 'accesskey' => 'o',
),
- array(
- 'label' => t('Additional features'),
- 'url' => $a->get_baseurl(true).'/settings/features',
- 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
- ),
- array(
- 'label' => t('Display'),
- 'url' => $a->get_baseurl(true).'/settings/display',
- 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
- ),
+ );
- array(
- 'label' => t('Social Networks'),
- 'url' => $a->get_baseurl(true).'/settings/connectors',
- 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
- ),
- array(
- 'label' => t('Plugins'),
- 'url' => $a->get_baseurl(true).'/settings/addon',
- 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
- ),
- array(
- 'label' => t('Delegations'),
- 'url' => $a->get_baseurl(true).'/delegate',
- 'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''),
- ),
- array(
- 'label' => t('Connected apps'),
- 'url' => $a->get_baseurl(true) . '/settings/oauth',
- 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
- ),
- array(
- 'label' => t('Export personal data'),
- 'url' => $a->get_baseurl(true) . '/uexport',
- 'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
- ),
- array(
- 'label' => t('Remove account'),
- 'url' => $a->get_baseurl(true) . '/removeme',
- 'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''),
- )
+ if(get_features()) {
+ $tabs[] = array(
+ 'label' => t('Additional features'),
+ 'url' => 'settings/features',
+ 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
+ 'accesskey' => 't',
+ );
+ }
+
+ $tabs[] = array(
+ 'label' => t('Display'),
+ 'url' => 'settings/display',
+ 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
+ 'accesskey' => 'i',
);
+ $tabs[] = array(
+ 'label' => t('Social Networks'),
+ 'url' => 'settings/connectors',
+ 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
+ 'accesskey' => 'w',
+ );
+
+ $tabs[] = array(
+ 'label' => t('Plugins'),
+ 'url' => 'settings/addon',
+ 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
+ 'accesskey' => 'l',
+ );
+
+ $tabs[] = array(
+ 'label' => t('Delegations'),
+ 'url' => 'delegate',
+ 'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''),
+ 'accesskey' => 'd',
+ );
+
+ $tabs[] = array(
+ 'label' => t('Connected apps'),
+ 'url' => 'settings/oauth',
+ 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
+ 'accesskey' => 'b',
+ );
+
+ $tabs[] = array(
+ 'label' => t('Export personal data'),
+ 'url' => 'uexport',
+ 'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
+ 'accesskey' => 'e',
+ );
+
+ $tabs[] = array(
+ 'label' => t('Remove account'),
+ 'url' => 'removeme',
+ 'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''),
+ 'accesskey' => 'r',
+ );
+
+
$tabtpl = get_markup_template("generic_links_widget.tpl");
$a->page['aside'] = replace_macros($tabtpl, array(
'$title' => t('Settings'),
@@ -177,7 +198,12 @@ function settings_post(&$a) {
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
- if(x($_POST, 'imap-submit')) {
+ if(x($_POST, 'general-submit')) {
+ set_pconfig(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
+ set_pconfig(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
+ set_pconfig(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
+ set_pconfig(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
+ } elseif(x($_POST, 'imap-submit')) {
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
@@ -253,7 +279,7 @@ function settings_post(&$a) {
return;
}
- if(($a->argc > 1) && ($a->argv[1] === 'features')) {
+ if (($a->argc > 1) && ($a->argv[1] === 'features')) {
check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
foreach($_POST as $k => $v) {
if(strpos($k,'feature_') === 0) {
@@ -264,45 +290,52 @@ function settings_post(&$a) {
return;
}
- if(($a->argc > 1) && ($a->argv[1] === 'display')) {
-
+ if (($a->argc > 1) && ($a->argv[1] === 'display')) {
check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
- $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
- $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
- $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
- $noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0);
- $infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0);
- $no_auto_update = ((x($_POST,'no_auto_update')) ? intval($_POST['no_auto_update']) : 0);
- $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
- $browser_update = $browser_update * 1000;
- if($browser_update < 10000)
- $browser_update = 10000;
-
- $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40);
- if($itemspage_network > 100)
+ $theme = x($_POST, 'theme') ? notags(trim($_POST['theme'])) : $a->user['theme'];
+ $mobile_theme = x($_POST, 'mobile_theme') ? notags(trim($_POST['mobile_theme'])) : '';
+ $nosmile = x($_POST, 'nosmile') ? intval($_POST['nosmile']) : 0;
+ $first_day_of_week = x($_POST, 'first_day_of_week') ? intval($_POST['first_day_of_week']) : 0;
+ $noinfo = x($_POST, 'noinfo') ? intval($_POST['noinfo']) : 0;
+ $infinite_scroll = x($_POST, 'infinite_scroll') ? intval($_POST['infinite_scroll']) : 0;
+ $no_auto_update = x($_POST, 'no_auto_update') ? intval($_POST['no_auto_update']) : 0;
+ $bandwidth_saver = x($_POST, 'bandwidth_saver') ? intval($_POST['bandwidth_saver']) : 0;
+ $nowarn_insecure = x($_POST, 'nowarn_insecure') ? intval($_POST['nowarn_insecure']) : 0;
+ $browser_update = x($_POST, 'browser_update') ? intval($_POST['browser_update']) : 0;
+ if ($browser_update != -1) {
+ $browser_update = $browser_update * 1000;
+ if ($browser_update < 10000)
+ $browser_update = 10000;
+ }
+
+ $itemspage_network = x($_POST,'itemspage_network') ? intval($_POST['itemspage_network']) : 40;
+ if ($itemspage_network > 100) {
$itemspage_network = 100;
- $itemspage_mobile_network = ((x($_POST,'itemspage_mobile_network')) ? intval($_POST['itemspage_mobile_network']) : 20);
- if($itemspage_mobile_network > 100)
+ }
+ $itemspage_mobile_network = x($_POST,'itemspage_mobile_network') ? intval($_POST['itemspage_mobile_network']) : 20;
+ if ($itemspage_mobile_network > 100) {
$itemspage_mobile_network = 100;
-
+ }
if($mobile_theme !== '') {
set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
}
- set_pconfig(local_user(),'system','update_interval', $browser_update);
- set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
- set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network);
- set_pconfig(local_user(),'system','no_smilies',$nosmile);
- set_pconfig(local_user(),'system','ignore_info',$noinfo);
- set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll);
- set_pconfig(local_user(),'system','no_auto_update',$no_auto_update);
-
-
- if ($theme == $a->user['theme']){
+ set_pconfig(local_user(), 'system', 'nowarn_insecure' , $nowarn_insecure);
+ set_pconfig(local_user(), 'system', 'update_interval' , $browser_update);
+ set_pconfig(local_user(), 'system', 'itemspage_network' , $itemspage_network);
+ set_pconfig(local_user(), 'system', 'itemspage_mobile_network', $itemspage_mobile_network);
+ set_pconfig(local_user(), 'system', 'no_smilies' , $nosmile);
+ set_pconfig(local_user(), 'system', 'first_day_of_week' , $first_day_of_week);
+ set_pconfig(local_user(), 'system', 'ignore_info' , $noinfo);
+ set_pconfig(local_user(), 'system', 'infinite_scroll' , $infinite_scroll);
+ set_pconfig(local_user(), 'system', 'no_auto_update' , $no_auto_update);
+ set_pconfig(local_user(), 'system', 'bandwidth_saver' , $bandwidth_saver);
+
+ if ($theme == $a->user['theme']) {
// call theme_post only if theme has not been changed
- if( ($themeconfigfile = get_theme_config_file($theme)) != null){
+ if (($themeconfigfile = get_theme_config_file($theme)) != null) {
require_once($themeconfigfile);
theme_post($a);
}
@@ -315,16 +348,16 @@ function settings_post(&$a) {
);
call_hooks('display_settings_post', $_POST);
- goaway($a->get_baseurl(true) . '/settings/display' );
+ goaway('settings/display' );
return; // NOTREACHED
}
check_form_security_token_redirectOnErr('/settings', 'settings');
if (x($_POST,'resend_relocate')) {
- proc_run('php', 'include/notifier.php', 'relocate', local_user());
+ proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', local_user());
info(t("Relocate message has been send to your contacts"));
- goaway($a->get_baseurl(true) . '/settings');
+ goaway('settings');
}
call_hooks('settings_post', $_POST);
@@ -371,6 +404,8 @@ function settings_post(&$a) {
$username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
$email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
$timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
+ $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
+
$defloc = ((x($_POST,'defloc')) ? notags(trim($_POST['defloc'])) : '');
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
$maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
@@ -388,6 +423,7 @@ function settings_post(&$a) {
$publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
$net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
$old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
+ $account_type = (((x($_POST,'account-type')) && (intval($_POST['account-type']))) ? intval($_POST['account-type']) : 0);
$page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
$blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
$blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
@@ -421,6 +457,16 @@ function settings_post(&$a) {
if(x($_POST,'notify8'))
$notify += intval($_POST['notify8']);
+ // Adjust the page flag if the account type doesn't fit to the page flag.
+ if (($account_type == ACCOUNT_TYPE_PERSON) AND !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE)))
+ $page_flags = PAGE_NORMAL;
+ elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
+ $page_flags = PAGE_SOAPBOX;
+ elseif (($account_type == ACCOUNT_TYPE_NEWS) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
+ $page_flags = PAGE_SOAPBOX;
+ elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) AND !in_array($page_flags, array(PAGE_COMMUNITY, PAGE_PRVGROUP)))
+ $page_flags = PAGE_COMMUNITY;
+
$email_changed = false;
$err = '';
@@ -474,7 +520,7 @@ function settings_post(&$a) {
$str_contact_deny = perms2str($_POST['contact_deny']);
$openidserver = $a->user['openidserver'];
- $openid = normalise_openid($openid);
+ //$openid = normalise_openid($openid);
// If openid has changed or if there's an openid but no openidserver, try and discover it.
@@ -517,7 +563,15 @@ function settings_post(&$a) {
}
}
- $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d",
+
+ $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s',
+ `openid` = '%s', `timezone` = '%s',
+ `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s',
+ `notify-flags` = %d, `page-flags` = %d, `account-type` = %d, `default-location` = '%s',
+ `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s',
+ `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d,
+ `unkmail` = %d, `cntunkmail` = %d, `language` = '%s'
+ WHERE `uid` = %d",
dbesc($username),
dbesc($email),
dbesc($openid),
@@ -528,6 +582,7 @@ function settings_post(&$a) {
dbesc($str_group_deny),
intval($notify),
intval($page_flags),
+ intval($account_type),
dbesc($defloc),
intval($allow_location),
intval($maxreq),
@@ -539,11 +594,15 @@ function settings_post(&$a) {
intval($blocktags),
intval($unkmail),
intval($cntunkmail),
+ dbesc($language),
intval(local_user())
);
if($r)
info( t('Settings updated.') . EOL);
+ // clear session language
+ unset($_SESSION['language']);
+
$r = q("UPDATE `profile`
SET `publish` = %d,
`name` = '%s',
@@ -559,7 +618,7 @@ function settings_post(&$a) {
if($name_change) {
- q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1",
+ q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
dbesc($username),
dbesc(datetime_convert()),
intval(local_user())
@@ -569,15 +628,16 @@ function settings_post(&$a) {
if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
// Update global directory in background
$url = $_SESSION['my_url'];
- if($url && strlen(get_config('system','directory_submit_url')))
- proc_run('php',"include/directory.php","$url");
-
+ if($url && strlen(get_config('system','directory')))
+ proc_run(PRIORITY_LOW, "include/directory.php", $url);
}
-
require_once('include/profile_update.php');
profile_change();
+ // Update the global contact for the user
+ update_gcontact_for_user(local_user());
+
//$_SESSION['theme'] = $theme;
if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
@@ -586,12 +646,11 @@ function settings_post(&$a) {
}
- goaway($a->get_baseurl(true) . '/settings' );
+ goaway('settings');
return; // NOTREACHED
}
-if(! function_exists('settings_content')) {
function settings_content(&$a) {
$o = '';
@@ -716,7 +775,7 @@ function settings_content(&$a) {
$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(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
+ $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(feature_enabled(local_user(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
}
}
@@ -733,13 +792,55 @@ function settings_content(&$a) {
if(($a->argc > 1) && ($a->argv[1] === 'connectors')) {
- $settings_connectors = "";
+ $settings_connectors = '';
+ $settings_connectors .= ''. t('General Social Media Settings').'
';
+ $settings_connectors .= '';
+ $settings_connectors .= '