diff options
Diffstat (limited to 'mod/settings.php')
-rw-r--r--[-rwxr-xr-x] | mod/settings.php | 114 |
1 files changed, 62 insertions, 52 deletions
diff --git a/mod/settings.php b/mod/settings.php index 926d1faa5..8c8b3062d 100755..100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -15,10 +15,6 @@ function get_theme_config_file($theme){ } function settings_init(&$a) { - if(local_user()) { - profile_load($a,$a->user['nickname']); - } - // These lines provide the javascript needed by the acl selector $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "';" ; @@ -47,6 +43,47 @@ function settings_init(&$a) { EOT; + + $tabs = array( + array( + 'label' => t('Account settings'), + 'url' => $a->get_baseurl(true).'/settings', + 'selected' => (($a->argc == 1)?'active':''), + ), + array( + 'label' => t('Display settings'), + 'url' => $a->get_baseurl(true).'/settings/display', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), + ), + + array( + 'label' => t('Connector settings'), + 'url' => $a->get_baseurl(true).'/settings/connectors', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), + ), + array( + 'label' => t('Plugin settings'), + 'url' => $a->get_baseurl(true).'/settings/addon', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'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' => '' + ) + ); + + $tabtpl = get_markup_template("generic_links_widget.tpl"); + $a->page['aside'] = replace_macros($tabtpl, array( + '$title' => t('Settings'), + '$items' => $tabs, + )); + } @@ -229,7 +266,7 @@ function settings_post(&$a) { if ($theme == $a->user['theme']){ - // call theme_post only if theme has not benn changed + // call theme_post only if theme has not been changed if( ($themeconfigfile = get_theme_config_file($theme)) != null){ require_once($themeconfigfile); theme_post($a); @@ -242,6 +279,7 @@ function settings_post(&$a) { intval(local_user()) ); + call_hooks('display_settings_post', $_POST); goaway($a->get_baseurl(true) . '/settings/display' ); return; // NOTREACHED } @@ -308,6 +346,8 @@ function settings_post(&$a) { $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); + $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0); + $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $notify = 0; @@ -390,6 +430,8 @@ function settings_post(&$a) { set_pconfig(local_user(),'expire','photos', $expire_photos); set_pconfig(local_user(),'system','suggestme', $suggestme); + set_pconfig(local_user(),'system','post_newfriend', $post_newfriend); + set_pconfig(local_user(),'system','post_profilechange', $post_profilechange); $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', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1", @@ -478,44 +520,7 @@ function settings_content(&$a) { return; } - $tabs = array( - array( - 'label' => t('Account settings'), - 'url' => $a->get_baseurl(true).'/settings', - 'sel' => (($a->argc == 1)?'active':''), - ), - array( - 'label' => t('Display settings'), - 'url' => $a->get_baseurl(true).'/settings/display', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), - ), - - array( - 'label' => t('Connector settings'), - 'url' => $a->get_baseurl(true).'/settings/connectors', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), - ), - array( - 'label' => t('Plugin settings'), - 'url' => $a->get_baseurl(true).'/settings/addon', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), - ), - array( - 'label' => t('Connections'), - 'url' => $a->get_baseurl(true) . '/settings/oauth', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), - ), - array( - 'label' => t('Export personal data'), - 'url' => $a->get_baseurl(true) . '/uexport', - 'sel' => '' - ) - ); - - $tabtpl = get_markup_template("common_tabs.tpl"); - $tabs = replace_macros($tabtpl, array( - '$tabs' => $tabs, - )); + if(($a->argc > 1) && ($a->argv[1] === 'oauth')) { @@ -523,7 +528,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_oauth_edit.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), - '$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), @@ -550,7 +554,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_oauth_edit.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), - '$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), @@ -593,7 +596,6 @@ function settings_content(&$a) { '$consumerkey' => t('Client key starts with'), '$noname' => t('No name'), '$remove' => t('Remove authorization'), - '$tabs' => $tabs, '$apps' => $r, )); return $o; @@ -613,7 +615,6 @@ function settings_content(&$a) { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_addon"), '$title' => t('Plugin Settings'), - '$tabs' => $tabs, '$settings_addons' => $settings_addons )); return $o; @@ -657,7 +658,6 @@ function settings_content(&$a) { '$form_security_token' => get_form_security_token("settings_connectors"), '$title' => t('Connector Settings'), - '$tabs' => $tabs, '$diasp_enabled' => $diasp_enabled, '$ostat_enabled' => $ostat_enabled, @@ -679,6 +679,8 @@ function settings_content(&$a) { '$settings_connectors' => $settings_connectors )); + + call_hooks('display_settings', $o); return $o; } @@ -694,8 +696,8 @@ function settings_content(&$a) { $allowed_themes_raw = explode(',',$allowed_themes_str); $allowed_themes = array(); if(count($allowed_themes_raw)) - foreach($allowed_themes_raw as $x) - if(strlen(trim($x))) + foreach($allowed_themes_raw as $x) + if(strlen(trim($x)) && is_dir("view/theme/$x")) $allowed_themes[] = trim($x); @@ -732,7 +734,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_display.tpl"); $o = replace_macros($tpl, array( - '$tabs' => $tabs, '$ptitle' => t('Display Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), @@ -793,6 +794,11 @@ function settings_content(&$a) { $suggestme = get_pconfig(local_user(), 'system','suggestme'); $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0 + $post_newfriend = get_pconfig(local_user(), 'system','post_newfriend'); + $post_newfriend = (($post_newfriend===false)? '0': $post_newfriend); // default if not set: 0 + + $post_profilechange = get_pconfig(local_user(), 'system','post_profilechange'); + $post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0 if(! strlen($a->user['timezone'])) @@ -881,6 +887,8 @@ function settings_content(&$a) { )); + + $invisible = (((! $profile['publish']) && (! $profile['net-publish'])) ? true : false); @@ -917,7 +925,6 @@ function settings_content(&$a) { ); $o .= replace_macros($stpl,array( - '$tabs' => $tabs, '$ptitle' => t('Account Settings'), '$submit' => t('Submit'), @@ -962,6 +969,9 @@ function settings_content(&$a) { '$h_not' => t('Notification Settings'), + '$activity_options' => t('By default post a status message when:'), + '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, ''), + '$post_profilechange' => array('post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, ''), '$lbl_not' => t('Send a notification email when:'), '$notify1' => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''), '$notify2' => array('notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''), |