3 require_once('include/group.php');
5 function get_theme_config_file($theme){
7 $base_theme = $a->theme_info['extends'];
9 if (file_exists("view/theme/$theme/config.php")){
10 return "view/theme/$theme/config.php";
12 if (file_exists("view/theme/$base_theme/config.php")){
13 return "view/theme/$base_theme/config.php";
18 function settings_init(&$a) {
21 notice( t('Permission denied.') . EOL );
25 // APC deactivated, since there are problems with PHP 5.5
26 //if (function_exists("apc_delete")) {
27 // $toDelete = new APCIterator('user', APC_ITER_VALUE);
28 // apc_delete($toDelete);
31 // These lines provide the javascript needed by the acl selector
33 $tpl = get_markup_template("settings-head.tpl");
34 $a->page['htmlhead'] .= replace_macros($tpl,array(
35 '$ispublic' => t('everybody')
42 'label' => t('Account'),
44 'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''),
51 'label' => t('Additional features'),
52 'url' => 'settings/features',
53 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
59 'label' => t('Display'),
60 'url' => 'settings/display',
61 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
66 'label' => t('Social Networks'),
67 'url' => 'settings/connectors',
68 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
73 'label' => t('Plugins'),
74 'url' => 'settings/addon',
75 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
80 'label' => t('Delegations'),
82 'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''),
87 'label' => t('Connected apps'),
88 'url' => 'settings/oauth',
89 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
94 'label' => t('Export personal data'),
96 'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
101 'label' => t('Remove account'),
103 'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''),
108 $tabtpl = get_markup_template("generic_links_widget.tpl");
109 $a->page['aside'] = replace_macros($tabtpl, array(
110 '$title' => t('Settings'),
111 '$class' => 'settings-widget',
118 function settings_post(&$a) {
123 if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
126 if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
127 notice( t('Permission denied.') . EOL);
131 $old_page_flags = $a->user['page-flags'];
133 if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){
134 check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
136 $key = $_POST['remove'];
137 q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
140 goaway($a->get_baseurl(true)."/settings/oauth/");
144 if(($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) {
146 check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
148 $name = ((x($_POST,'name')) ? $_POST['name'] : '');
149 $key = ((x($_POST,'key')) ? $_POST['key'] : '');
150 $secret = ((x($_POST,'secret')) ? $_POST['secret'] : '');
151 $redirect = ((x($_POST,'redirect')) ? $_POST['redirect'] : '');
152 $icon = ((x($_POST,'icon')) ? $_POST['icon'] : '');
153 if ($name=="" || $key=="" || $secret==""){
154 notice(t("Missing some important data!"));
157 if ($_POST['submit']==t("Update")){
158 $r = q("UPDATE clients SET
165 WHERE client_id='%s'",
174 $r = q("INSERT INTO clients
175 (client_id, pw, name, redirect_uri, icon, uid)
176 VALUES ('%s','%s','%s','%s','%s',%d)",
185 goaway($a->get_baseurl(true)."/settings/oauth/");
189 if(($a->argc > 1) && ($a->argv[1] == 'addon')) {
190 check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
192 call_hooks('plugin_settings_post', $_POST);
196 if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
198 check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
200 if(x($_POST, 'general-submit')) {
201 set_pconfig(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
202 set_pconfig(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
203 set_pconfig(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
204 set_pconfig(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
205 } elseif(x($_POST, 'imap-submit')) {
207 $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
208 $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
209 $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
210 $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
211 $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
212 $mail_action = ((x($_POST,'mail_action')) ? trim($_POST['mail_action']) : '');
213 $mail_movetofolder = ((x($_POST,'mail_movetofolder')) ? trim($_POST['mail_movetofolder']) : '');
214 $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
215 $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
218 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
219 if(get_config('system','dfrn_only'))
222 if(! $mail_disabled) {
224 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
228 q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
232 if(strlen($mail_pass)) {
234 openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']);
235 q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d",
236 dbesc(bin2hex($pass)),
240 $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
241 `action` = %d, `movetofolder` = '%s',
242 `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d",
247 intval($mail_action),
248 dbesc($mail_movetofolder),
249 dbesc($mail_replyto),
250 intval($mail_pubmail),
253 logger("mail: updating mailaccount. Response: ".print_r($r, true));
254 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
259 require_once('include/email.php');
260 $mb = construct_mailbox_name($eacct);
261 if(strlen($eacct['server'])) {
263 openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
264 $mbox = email_connect($mb,$mail_user,$dcrpass);
268 notice( t('Failed to connect with email account using the settings provided.') . EOL);
273 info( t('Email settings updated.') . EOL);
277 call_hooks('connector_settings_post', $_POST);
281 if(($a->argc > 1) && ($a->argv[1] === 'features')) {
282 check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
283 foreach($_POST as $k => $v) {
284 if(strpos($k,'feature_') === 0) {
285 set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0));
288 info( t('Features updated') . EOL);
292 if(($a->argc > 1) && ($a->argv[1] === 'display')) {
294 check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
296 $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
297 $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
298 $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
299 $first_day_of_week = ((x($_POST,'first_day_of_week')) ? intval($_POST['first_day_of_week']) : 0);
300 $noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0);
301 $infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0);
302 $no_auto_update = ((x($_POST,'no_auto_update')) ? intval($_POST['no_auto_update']) : 0);
303 $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
304 if ($browser_update != -1) {
305 $browser_update = $browser_update * 1000;
306 if ($browser_update < 10000)
307 $browser_update = 10000;
310 $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40);
311 if($itemspage_network > 100)
312 $itemspage_network = 100;
313 $itemspage_mobile_network = ((x($_POST,'itemspage_mobile_network')) ? intval($_POST['itemspage_mobile_network']) : 20);
314 if($itemspage_mobile_network > 100)
315 $itemspage_mobile_network = 100;
318 if($mobile_theme !== '') {
319 set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
322 set_pconfig(local_user(),'system','update_interval', $browser_update);
323 set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
324 set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network);
325 set_pconfig(local_user(),'system','no_smilies',$nosmile);
326 set_pconfig(local_user(),'system','first_day_of_week',$first_day_of_week);
327 set_pconfig(local_user(),'system','ignore_info',$noinfo);
328 set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll);
329 set_pconfig(local_user(),'system','no_auto_update',$no_auto_update);
332 if ($theme == $a->user['theme']){
333 // call theme_post only if theme has not been changed
334 if( ($themeconfigfile = get_theme_config_file($theme)) != null){
335 require_once($themeconfigfile);
341 $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
346 call_hooks('display_settings_post', $_POST);
347 goaway('settings/display' );
348 return; // NOTREACHED
351 check_form_security_token_redirectOnErr('/settings', 'settings');
353 if (x($_POST,'resend_relocate')) {
354 proc_run('php', 'include/notifier.php', 'relocate', local_user());
355 info(t("Relocate message has been send to your contacts"));
359 call_hooks('settings_post', $_POST);
361 if((x($_POST,'password')) || (x($_POST,'confirm'))) {
363 $newpass = $_POST['password'];
364 $confirm = $_POST['confirm'];
365 $oldpass = hash('whirlpool', $_POST['opassword']);
368 if($newpass != $confirm ) {
369 notice( t('Passwords do not match. Password unchanged.') . EOL);
373 if((! x($newpass)) || (! x($confirm))) {
374 notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
378 // check if the old password was supplied correctly before
379 // changing it to the new value
380 $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
381 if( $oldpass != $r[0]['password'] ) {
382 notice( t('Wrong password.') . EOL);
387 $password = hash('whirlpool',$newpass);
388 $r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d",
393 info( t('Password changed.') . EOL);
395 notice( t('Password update failed. Please try again.') . EOL);
400 $username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
401 $email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
402 $timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
403 $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
405 $defloc = ((x($_POST,'defloc')) ? notags(trim($_POST['defloc'])) : '');
406 $openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
407 $maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
408 $expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
409 $def_gid = ((x($_POST,'group-selection')) ? intval($_POST['group-selection']) : 0);
412 $expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
413 $expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
414 $expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
415 $expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0);
416 $expire_network_only = ((x($_POST,'expire_network_only'))? intval($_POST['expire_network_only']) : 0);
418 $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
419 $publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
420 $net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
421 $old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
422 $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
423 $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
424 $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
425 $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
426 $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
427 $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
428 $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
429 $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
430 $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
431 $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
432 $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
434 $email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0);
438 if(x($_POST,'notify1'))
439 $notify += intval($_POST['notify1']);
440 if(x($_POST,'notify2'))
441 $notify += intval($_POST['notify2']);
442 if(x($_POST,'notify3'))
443 $notify += intval($_POST['notify3']);
444 if(x($_POST,'notify4'))
445 $notify += intval($_POST['notify4']);
446 if(x($_POST,'notify5'))
447 $notify += intval($_POST['notify5']);
448 if(x($_POST,'notify6'))
449 $notify += intval($_POST['notify6']);
450 if(x($_POST,'notify7'))
451 $notify += intval($_POST['notify7']);
452 if(x($_POST,'notify8'))
453 $notify += intval($_POST['notify8']);
455 $email_changed = false;
459 $name_change = false;
461 if($username != $a->user['username']) {
463 if(strlen($username) > 40)
464 $err .= t(' Please use a shorter name.');
465 if(strlen($username) < 3)
466 $err .= t(' Name too short.');
469 if($email != $a->user['email']) {
470 $email_changed = true;
471 // check for the correct password
472 $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
473 $password = hash('whirlpool', $_POST['mpassword']);
474 if ($password != $r[0]['password']) {
475 $err .= t('Wrong Password') . EOL;
476 $email = $a->user['email'];
478 // check the email is valid
479 if(! valid_email($email))
480 $err .= t(' Not valid email.');
481 // ensure new email is not the admin mail
482 //if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
483 if(x($a->config,'admin_email')) {
484 $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
485 if (in_array(strtolower($email), $adminlist)) {
486 $err .= t(' Cannot change to that email.');
487 $email = $a->user['email'];
497 if($timezone != $a->user['timezone']) {
498 if(strlen($timezone))
499 date_default_timezone_set($timezone);
502 $str_group_allow = perms2str($_POST['group_allow']);
503 $str_contact_allow = perms2str($_POST['contact_allow']);
504 $str_group_deny = perms2str($_POST['group_deny']);
505 $str_contact_deny = perms2str($_POST['contact_deny']);
507 $openidserver = $a->user['openidserver'];
508 //$openid = normalise_openid($openid);
510 // If openid has changed or if there's an openid but no openidserver, try and discover it.
512 if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
514 if(strlen($tmp_str) && validate_url($tmp_str)) {
515 logger('updating openidserver');
516 require_once('library/openid.php');
517 $open_id_obj = new LightOpenID;
518 $open_id_obj->identity = $openid;
519 $openidserver = $open_id_obj->discover($open_id_obj->identity);
525 set_pconfig(local_user(),'expire','items', $expire_items);
526 set_pconfig(local_user(),'expire','notes', $expire_notes);
527 set_pconfig(local_user(),'expire','starred', $expire_starred);
528 set_pconfig(local_user(),'expire','photos', $expire_photos);
529 set_pconfig(local_user(),'expire','network_only', $expire_network_only);
531 set_pconfig(local_user(),'system','suggestme', $suggestme);
532 set_pconfig(local_user(),'system','post_newfriend', $post_newfriend);
533 set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
534 set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
536 set_pconfig(local_user(),'system','email_textonly', $email_textonly);
538 if($page_flags == PAGE_PRVGROUP) {
540 if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
542 info( t('Private forum has no privacy permissions. Using default privacy group.'). EOL);
543 $str_group_allow = '<' . $def_gid . '>';
546 notice( t('Private forum has no privacy permissions and no default privacy group.') . EOL);
552 $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s',
553 `openid` = '%s', `timezone` = '%s',
554 `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s',
555 `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s',
556 `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s',
557 `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d,
558 `unkmail` = %d, `cntunkmail` = %d, `language` = '%s'
564 dbesc($str_contact_allow),
565 dbesc($str_group_allow),
566 dbesc($str_contact_deny),
567 dbesc($str_group_deny),
571 intval($allow_location),
574 dbesc($openidserver),
585 info( t('Settings updated.') . EOL);
587 // clear session language
588 unset($_SESSION['language']);
590 $r = q("UPDATE `profile`
595 WHERE `is-default` = 1 AND `uid` = %d",
598 intval($net_publish),
599 intval($hide_friends),
605 q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1",
607 dbesc(datetime_convert()),
612 if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
613 // Update global directory in background
614 $url = $_SESSION['my_url'];
615 if($url && strlen(get_config('system','directory')))
616 proc_run('php',"include/directory.php","$url");
621 require_once('include/profile_update.php');
624 //$_SESSION['theme'] = $theme;
625 if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
627 // FIXME - set to un-verified, blocked and redirect to logout
628 // Why? Are we verifying people or email addresses?
633 return; // NOTREACHED
637 function settings_content(&$a) {
640 nav_set_selected('settings');
643 #notice( t('Permission denied.') . EOL );
647 if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
648 notice( t('Permission denied.') . EOL );
654 if(($a->argc > 1) && ($a->argv[1] === 'oauth')) {
656 if(($a->argc > 2) && ($a->argv[2] === 'add')) {
657 $tpl = get_markup_template("settings_oauth_edit.tpl");
658 $o .= replace_macros($tpl, array(
659 '$form_security_token' => get_form_security_token("settings_oauth"),
660 '$title' => t('Add application'),
661 '$submit' => t('Save Settings'),
662 '$cancel' => t('Cancel'),
663 '$name' => array('name', t('Name'), '', ''),
664 '$key' => array('key', t('Consumer Key'), '', ''),
665 '$secret' => array('secret', t('Consumer Secret'), '', ''),
666 '$redirect' => array('redirect', t('Redirect'), '', ''),
667 '$icon' => array('icon', t('Icon url'), '', ''),
672 if(($a->argc > 3) && ($a->argv[2] === 'edit')) {
673 $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d",
678 notice(t("You can't edit this application."));
683 $tpl = get_markup_template("settings_oauth_edit.tpl");
684 $o .= replace_macros($tpl, array(
685 '$form_security_token' => get_form_security_token("settings_oauth"),
686 '$title' => t('Add application'),
687 '$submit' => t('Update'),
688 '$cancel' => t('Cancel'),
689 '$name' => array('name', t('Name'), $app['name'] , ''),
690 '$key' => array('key', t('Consumer Key'), $app['client_id'], ''),
691 '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''),
692 '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''),
693 '$icon' => array('icon', t('Icon url'), $app['icon'], ''),
698 if(($a->argc > 3) && ($a->argv[2] === 'delete')) {
699 check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
701 $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
704 goaway($a->get_baseurl(true)."/settings/oauth/");
709 $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my
711 LEFT JOIN tokens ON clients.client_id=tokens.client_id
712 WHERE clients.uid IN (%d,0)",
717 $tpl = get_markup_template("settings_oauth.tpl");
718 $o .= replace_macros($tpl, array(
719 '$form_security_token' => get_form_security_token("settings_oauth"),
720 '$baseurl' => $a->get_baseurl(true),
721 '$title' => t('Connected Apps'),
722 '$add' => t('Add application'),
723 '$edit' => t('Edit'),
724 '$delete' => t('Delete'),
725 '$consumerkey' => t('Client key starts with'),
726 '$noname' => t('No name'),
727 '$remove' => t('Remove authorization'),
734 if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
735 $settings_addons = "";
737 $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
739 $settings_addons = t('No Plugin settings configured');
741 call_hooks('plugin_settings', $settings_addons);
744 $tpl = get_markup_template("settings_addons.tpl");
745 $o .= replace_macros($tpl, array(
746 '$form_security_token' => get_form_security_token("settings_addon"),
747 '$title' => t('Plugin Settings'),
748 '$settings_addons' => $settings_addons
753 if(($a->argc > 1) && ($a->argv[1] === 'features')) {
756 $features = get_features();
757 foreach($features as $fname => $fdata) {
758 $arr[$fname] = array();
759 $arr[$fname][0] = $fdata[0];
760 foreach(array_slice($fdata,1) as $f) {
761 $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(feature_enabled(local_user(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
766 $tpl = get_markup_template("settings_features.tpl");
767 $o .= replace_macros($tpl, array(
768 '$form_security_token' => get_form_security_token("settings_features"),
769 '$title' => t('Additional Features'),
771 '$submit' => t('Save Settings'),
776 if(($a->argc > 1) && ($a->argv[1] === 'connectors')) {
778 $settings_connectors = '<span id="settings_general_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_general_expanded\'); openClose(\'settings_general_inflated\');">';
779 $settings_connectors .= '<h3 class="connector">'. t('General Social Media Settings').'</h3>';
780 $settings_connectors .= '</span>';
781 $settings_connectors .= '<div id="settings_general_expanded" class="settings-block" style="display: none;">';
782 $settings_connectors .= '<span class="fakelink" onclick="openClose(\'settings_general_expanded\'); openClose(\'settings_general_inflated\');">';
783 $settings_connectors .= '<h3 class="connector">'. t('General Social Media Settings').'</h3>';
784 $settings_connectors .= '</span>';
786 $checked = ((get_pconfig(local_user(), 'system', 'no_intelligent_shortening')) ? ' checked="checked" ' : '');
788 $settings_connectors .= '<div id="no_intelligent_shortening" class="field checkbox">';
789 $settings_connectors .= '<label id="no_intelligent_shortening-label" for="shortening-checkbox">'. t('Disable intelligent shortening'). '</label>';
790 $settings_connectors .= '<input id="shortening-checkbox" type="checkbox" name="no_intelligent_shortening" value="1" ' . $checked . '/>';
791 $settings_connectors .= '<span class="field_help">'.t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.').'</span>';
792 $settings_connectors .= '</div>';
794 $checked = ((get_pconfig(local_user(), 'system', 'ostatus_autofriend')) ? ' checked="checked" ' : '');
796 $settings_connectors .= '<div id="snautofollow-wrapper" class="field checkbox">';
797 $settings_connectors .= '<label id="snautofollow-label" for="snautofollow-checkbox">'. t('Automatically follow any GNU Social (OStatus) followers/mentioners'). '</label>';
798 $settings_connectors .= '<input id="snautofollow-checkbox" type="checkbox" name="snautofollow" value="1" ' . $checked . '/>';
799 $settings_connectors .= '<span class="field_help">'.t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.').'</span>';
800 $settings_connectors .= '</div>';
802 $default_group = get_pconfig(local_user(), 'ostatus', 'default_group');
803 $legacy_contact = get_pconfig(local_user(), 'ostatus', 'legacy_contact');
805 $settings_connectors .= mini_group_select(local_user(), $default_group, t("Default group for OStatus contacts"));
807 if ($legacy_contact != "")
808 $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.$a->get_baseurl().'/ostatus_subscribe?url='.urlencode($legacy_contact).'">';
810 $settings_connectors .= '<div id="legacy-contact-wrapper" class="field input">';
811 $settings_connectors .= '<label id="legacy-contact-label" for="snautofollow-checkbox">'. t('Your legacy GNU Social account'). '</label>';
812 $settings_connectors .= '<input id="legacy-contact-checkbox" name="legacy_contact" value="'.$legacy_contact.'"/>';
813 $settings_connectors .= '<span class="field_help">'.t('If you enter your old GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.').'</span>';
814 $settings_connectors .= '</div>';
816 $settings_connectors .= '<p><a href="'.$a->get_baseurl().'/repair_ostatus">'.t("Repair OStatus subscriptions").'</a></p>';
818 $settings_connectors .= '<div class="settings-submit-wrapper" ><input type="submit" name="general-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
820 $settings_connectors .= '</div><div class="clear"></div>';
822 call_hooks('connector_settings', $settings_connectors);
824 if (is_site_admin()) {
825 $diasp_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('Diaspora'), ((get_config('system','diaspora_enabled')) ? t('enabled') : t('disabled')));
826 $ostat_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('GNU Social (OStatus)'), ((get_config('system','ostatus_disabled')) ? t('disabled') : t('enabled')));
832 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
833 if(get_config('system','dfrn_only'))
836 if(! $mail_disabled) {
837 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
845 $mail_server = ((count($r)) ? $r[0]['server'] : '');
846 $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
847 $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
848 $mail_user = ((count($r)) ? $r[0]['user'] : '');
849 $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
850 $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
851 $mail_action = ((count($r)) ? $r[0]['action'] : 0);
852 $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
853 $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
856 $tpl = get_markup_template("settings_connectors.tpl");
858 if(! service_class_allows(local_user(),'email_connect')) {
859 $mail_disabled_message = upgrade_bool_message();
862 $mail_disabled_message = (($mail_disabled) ? t('Email access is disabled on this site.') : '');
866 $o .= replace_macros($tpl, array(
867 '$form_security_token' => get_form_security_token("settings_connectors"),
869 '$title' => t('Social Networks'),
871 '$diasp_enabled' => $diasp_enabled,
872 '$ostat_enabled' => $ostat_enabled,
874 '$h_imap' => t('Email/Mailbox Setup'),
875 '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
876 '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''),
877 '$mail_disabled' => $mail_disabled_message,
878 '$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''),
879 '$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''),
880 '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( 'notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')),
881 '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''),
882 '$mail_pass' => array('mail_pass', t('Email password:'), '', ''),
883 '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'),
884 '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
885 '$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder'))),
886 '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
887 '$submit' => t('Save Settings'),
889 '$settings_connectors' => $settings_connectors
892 call_hooks('display_settings', $o);
899 if(($a->argc > 1) && ($a->argv[1] === 'display')) {
900 $default_theme = get_config('system','theme');
902 $default_theme = 'default';
903 $default_mobile_theme = get_config('system','mobile-theme');
904 if(! $mobile_default_theme)
905 $mobile_default_theme = 'none';
907 $allowed_themes_str = get_config('system','allowed_themes');
908 $allowed_themes_raw = explode(',',$allowed_themes_str);
909 $allowed_themes = array();
910 if(count($allowed_themes_raw))
911 foreach($allowed_themes_raw as $x)
912 if(strlen(trim($x)) && is_dir("view/theme/$x"))
913 $allowed_themes[] = trim($x);
917 $mobile_themes = array("---" => t('No special theme for mobile devices'));
918 $files = glob('view/theme/*'); /* */
919 if($allowed_themes) {
920 foreach($allowed_themes as $th) {
922 $is_experimental = file_exists('view/theme/' . $th . '/experimental');
923 $unsupported = file_exists('view/theme/' . $th . '/unsupported');
924 $is_mobile = file_exists('view/theme/' . $th . '/mobile');
925 if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
926 $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
928 $mobile_themes[$f]=$theme_name;
931 $themes[$f]=$theme_name;
936 $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
937 $mobile_theme_selected = (!x($_SESSION,'mobile-theme')? $default_mobile_theme : $_SESSION['mobile-theme']);
939 $browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
940 if (intval($browser_update) != -1)
941 $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
943 $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network'));
944 $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
945 $itemspage_mobile_network = intval(get_pconfig(local_user(), 'system','itemspage_mobile_network'));
946 $itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
948 $nosmile = get_pconfig(local_user(),'system','no_smilies');
949 $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
951 $first_day_of_week = get_pconfig(local_user(),'system','first_day_of_week');
952 $first_day_of_week = (($first_day_of_week===false)? '0': $first_day_of_week); // default if not set: 0
953 $weekdays = array(0 => t("Sunday"), 1 => t("Monday"));
955 $noinfo = get_pconfig(local_user(),'system','ignore_info');
956 $noinfo = (($noinfo===false)? '0': $noinfo); // default if not set: 0
958 $infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll');
959 $infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0
961 $no_auto_update = get_pconfig(local_user(),'system','no_auto_update');
962 $no_auto_update = (($no_auto_update===false)? '0': $no_auto_update); // default if not set: 0
965 if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){
966 require_once($themeconfigfile);
967 $theme_config = theme_content($a);
970 $tpl = get_markup_template("settings_display.tpl");
971 $o = replace_macros($tpl, array(
972 '$ptitle' => t('Display Settings'),
973 '$form_security_token' => get_form_security_token("settings_display"),
974 '$submit' => t('Save Settings'),
975 '$baseurl' => $a->get_baseurl(true),
976 '$uid' => local_user(),
978 '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes, true),
979 '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false),
980 '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds. Enter -1 to disable it.')),
981 '$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')),
982 '$itemspage_mobile_network' => array('itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')),
983 '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
984 '$calendar_title' => t('Calendar'),
985 '$first_day_of_week' => array('first_day_of_week', t('Beginning of week:'), $first_day_of_week, '', $weekdays, false),
986 '$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''),
987 '$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
988 '$no_auto_update' => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, 'When disabled, the network page is updated all the time, which could be confusing while reading.'),
990 'stitle' => t('Theme settings'),
991 '$theme_config' => $theme_config,
994 $tpl = get_markup_template("settings_display_end.tpl");
995 $a->page['end'] .= replace_macros($tpl, array(
996 '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes)
1007 require_once('include/acl_selectors.php');
1009 $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
1010 intval(local_user())
1015 $username = $a->user['username'];
1016 $email = $a->user['email'];
1017 $nickname = $a->user['nickname'];
1018 $timezone = $a->user['timezone'];
1019 $language = $a->user['language'];
1020 $notify = $a->user['notify-flags'];
1021 $defloc = $a->user['default-location'];
1022 $openid = $a->user['openid'];
1023 $maxreq = $a->user['maxreq'];
1024 $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
1025 $blockwall = $a->user['blockwall'];
1026 $blocktags = $a->user['blocktags'];
1027 $unkmail = $a->user['unkmail'];
1028 $cntunkmail = $a->user['cntunkmail'];
1030 $expire_items = get_pconfig(local_user(), 'expire','items');
1031 $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1
1033 $expire_notes = get_pconfig(local_user(), 'expire','notes');
1034 $expire_notes = (($expire_notes===false)? '1' : $expire_notes); // default if not set: 1
1036 $expire_starred = get_pconfig(local_user(), 'expire','starred');
1037 $expire_starred = (($expire_starred===false)? '1' : $expire_starred); // default if not set: 1
1039 $expire_photos = get_pconfig(local_user(), 'expire','photos');
1040 $expire_photos = (($expire_photos===false)? '0' : $expire_photos); // default if not set: 0
1042 $expire_network_only = get_pconfig(local_user(), 'expire','network_only');
1043 $expire_network_only = (($expire_network_only===false)? '0' : $expire_network_only); // default if not set: 0
1046 $suggestme = get_pconfig(local_user(), 'system','suggestme');
1047 $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0
1049 $post_newfriend = get_pconfig(local_user(), 'system','post_newfriend');
1050 $post_newfriend = (($post_newfriend===false)? '0': $post_newfriend); // default if not set: 0
1052 $post_joingroup = get_pconfig(local_user(), 'system','post_joingroup');
1053 $post_joingroup = (($post_joingroup===false)? '0': $post_joingroup); // default if not set: 0
1055 $post_profilechange = get_pconfig(local_user(), 'system','post_profilechange');
1056 $post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0
1060 if(! strlen($a->user['timezone']))
1061 $timezone = date_default_timezone_get();
1065 $pageset_tpl = get_markup_template('pagetypes.tpl');
1066 $pagetype = replace_macros($pageset_tpl, array(
1067 '$user' => t("User Types"),
1068 '$community' => t("Community Types"),
1069 '$page_normal' => array('page-flags', t('Normal Account Page'), PAGE_NORMAL,
1070 t('This account is a normal personal profile'),
1071 ($a->user['page-flags'] == PAGE_NORMAL)),
1073 '$page_soapbox' => array('page-flags', t('Soapbox Page'), PAGE_SOAPBOX,
1074 t('Automatically approve all connection/friend requests as read-only fans'),
1075 ($a->user['page-flags'] == PAGE_SOAPBOX)),
1077 '$page_community' => array('page-flags', t('Community Forum/Celebrity Account'), PAGE_COMMUNITY,
1078 t('Automatically approve all connection/friend requests as read-write fans'),
1079 ($a->user['page-flags'] == PAGE_COMMUNITY)),
1081 '$page_freelove' => array('page-flags', t('Automatic Friend Page'), PAGE_FREELOVE,
1082 t('Automatically approve all connection/friend requests as friends'),
1083 ($a->user['page-flags'] == PAGE_FREELOVE)),
1085 '$page_prvgroup' => array('page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP,
1086 t('Private forum - approved members only'),
1087 ($a->user['page-flags'] == PAGE_PRVGROUP)),
1092 $noid = get_config('system','no_openid');
1095 $openid_field = false;
1098 $openid_field = array('openid_url', t('OpenID:'),$openid, t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url");
1102 $opt_tpl = get_markup_template("field_yesno.tpl");
1103 if(get_config('system','publish_all')) {
1104 $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
1107 $profile_in_dir = replace_macros($opt_tpl,array(
1108 '$field' => array('profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], '', array(t('No'),t('Yes'))),
1112 if(strlen(get_config('system','directory'))) {
1113 $profile_in_net_dir = replace_macros($opt_tpl,array(
1114 '$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
1118 $profile_in_net_dir = '';
1121 $hide_friends = replace_macros($opt_tpl,array(
1122 '$field' => array('hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', array(t('No'),t('Yes'))),
1125 $hide_wall = replace_macros($opt_tpl,array(
1126 '$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), array(t('No'),t('Yes'))),
1130 $blockwall = replace_macros($opt_tpl,array(
1131 '$field' => array('blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
1136 $blocktags = replace_macros($opt_tpl,array(
1137 '$field' => array('blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
1142 $suggestme = replace_macros($opt_tpl,array(
1143 '$field' => array('suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', array(t('No'),t('Yes'))),
1148 $unkmail = replace_macros($opt_tpl,array(
1149 '$field' => array('unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', array(t('No'),t('Yes'))),
1153 $invisible = (((! $profile['publish']) && (! $profile['net-publish']))
1157 info( t('Profile is <strong>not published</strong>.') . EOL );
1160 //$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . 'profile/' . $nickname : '');
1162 $tpl_addr = get_markup_template("settings_nick_set.tpl");
1164 $prof_addr = replace_macros($tpl_addr,array(
1165 '$desc' => sprintf(t("Your Identity Address is <strong>'%s'</strong> or '%s'."), $nickname.'@'.$a->get_hostname().$a->get_path(), $a->get_baseurl().'/profile/'.$nickname),
1166 '$basepath' => $a->get_hostname()
1169 $stpl = get_markup_template('settings.tpl');
1171 $expire_arr = array(
1172 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
1173 'advanced' => t('Advanced expiration settings'),
1174 'label' => t('Advanced Expiration'),
1175 'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
1176 'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'),t('Yes'))),
1177 'starred' => array('expire_starred', t("Expire starred posts:"), $expire_starred, '', array(t('No'),t('Yes'))),
1178 'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'),t('Yes'))),
1179 'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'),t('Yes'))),
1182 require_once('include/group.php');
1183 $group_select = mini_group_select(local_user(),$a->user['def_gid']);
1186 // Private/public post links for the non-JS ACL form
1188 if($_REQUEST['public'])
1191 $query_str = $a->query_string;
1192 if(strpos($query_str, 'public=1') !== false)
1193 $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
1195 // I think $a->query_string may never have ? in it, but I could be wrong
1196 // It looks like it's from the index.php?q=[etc] rewrite that the web
1197 // server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
1198 if(strpos($query_str, '?') === false)
1199 $public_post_link = '?public=1';
1201 $public_post_link = '&public=1';
1203 /* Installed langs */
1204 $lang_choices = get_avaiable_languages();
1206 $o .= replace_macros($stpl, array(
1207 '$ptitle' => t('Account Settings'),
1209 '$submit' => t('Save Settings'),
1210 '$baseurl' => $a->get_baseurl(true),
1211 '$uid' => local_user(),
1212 '$form_security_token' => get_form_security_token("settings"),
1213 '$nickname_block' => $prof_addr,
1215 '$h_pass' => t('Password Settings'),
1216 '$password1'=> array('password', t('New Password:'), '', ''),
1217 '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
1218 '$password3'=> array('opassword', t('Current Password:'), '', t('Your current password to confirm the changes')),
1219 '$password4'=> array('mpassword', t('Password:'), '', t('Your current password to confirm the changes')),
1220 '$oid_enable' => (! get_config('system','no_openid')),
1221 '$openid' => $openid_field,
1223 '$h_basic' => t('Basic Settings'),
1224 '$username' => array('username', t('Full Name:'), $username,''),
1225 '$email' => array('email', t('Email Address:'), $email, '', '', '', 'email'),
1226 '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''),
1227 '$language' => array('language', t('Your Language:'), $language, t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices),
1228 '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''),
1229 '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''),
1232 '$h_prv' => t('Security and Privacy Settings'),
1234 '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), $maxreq ,t("\x28to prevent spam abuse\x29")),
1235 '$permissions' => t('Default Post Permissions'),
1236 '$permdesc' => t("\x28click to open/close\x29"),
1237 '$visibility' => $profile['net-publish'],
1238 '$aclselect' => populate_acl($a->user),
1239 '$suggestme' => $suggestme,
1240 '$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''),
1241 '$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''),
1243 // ACL permissions box
1244 '$acl_data' => construct_acl_data($a, $a->user), // For non-Javascript ACL selector
1245 '$group_perms' => t('Show to Groups'),
1246 '$contact_perms' => t('Show to Contacts'),
1247 '$private' => t('Default Private Post'),
1248 '$public' => t('Default Public Post'),
1249 '$is_private' => $private_post,
1250 '$return_path' => $query_str,
1251 '$public_link' => $public_post_link,
1252 '$settings_perms' => t('Default Permissions for New Posts'),
1254 '$group_select' => $group_select,
1257 '$expire' => $expire_arr,
1259 '$profile_in_dir' => $profile_in_dir,
1260 '$profile_in_net_dir' => $profile_in_net_dir,
1261 '$hide_friends' => $hide_friends,
1262 '$hide_wall' => $hide_wall,
1263 '$unkmail' => $unkmail,
1264 '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail ,t("\x28to prevent spam abuse\x29")),
1267 '$h_not' => t('Notification Settings'),
1268 '$activity_options' => t('By default post a status message when:'),
1269 '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, ''),
1270 '$post_joingroup' => array('post_joingroup', t('joining a forum/community'), $post_joingroup, ''),
1271 '$post_profilechange' => array('post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, ''),
1272 '$lbl_not' => t('Send a notification email when:'),
1273 '$notify1' => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''),
1274 '$notify2' => array('notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''),
1275 '$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''),
1276 '$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
1277 '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
1278 '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
1279 '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
1280 '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
1282 '$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')),
1284 '$email_textonly' => array('email_textonly', t('Text-only notification emails'),
1285 get_pconfig(local_user(),'system','email_textonly'),
1286 t('Send text only notification emails, without the html part')),
1288 '$h_advn' => t('Advanced Account/Page Type Settings'),
1289 '$h_descadvn' => t('Change the behaviour of this account for special situations'),
1290 '$pagetype' => $pagetype,
1292 '$relocate' => t('Relocate'),
1293 '$relocate_text' => t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."),
1294 '$relocate_button' => t("Resend relocate message to contacts"),
1298 call_hooks('settings_form',$o);
1300 $o .= '</form>' . "\r\n";