]> git.mxchange.org Git - friendica.git/blob - mod/settings.php
522ae52debb9feeba647796d8321b87b21160a86
[friendica.git] / mod / settings.php
1 <?php
2
3
4 function settings_init(&$a) {
5         if(local_user()) {
6                 profile_load($a,$a->user['nickname']);
7         }
8
9         $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "';" ;
10
11         $a->page['htmlhead'] .= <<< EOT
12
13         $(document).ready(function() {
14
15                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
16                         var selstr;
17                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
18                                 selstr = $(this).text();
19                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
20                                 $('#jot-public').hide();
21                         });
22                         if(selstr == null) { 
23                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
24                                 $('#jot-public').show();
25                         }
26
27                 }).trigger('change');
28
29         });
30
31         </script>
32 EOT;
33
34
35 }
36
37
38 function settings_post(&$a) {
39
40         if(! local_user()) {
41                 notice( t('Permission denied.') . EOL);
42                 return;
43         }
44
45         if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
46                 notice( t('Permission denied.') . EOL);
47                 return;
48         }
49
50         if(($a->argc > 1) && ($a->argv[1] == 'addon')) {
51                 call_hooks('plugin_settings_post', $_POST);
52                 return;
53         }
54
55         if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
56
57                 if(x($_POST['imap-submit'])) {
58                         $mail_server      = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
59                         $mail_port        = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
60                         $mail_ssl         = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
61                         $mail_user        = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
62                         $mail_pass        = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
63                         $mail_replyto     = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
64                         $mail_pubmail     = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
65
66
67                         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
68                         if(get_config('system','dfrn_only'))
69                                 $mail_disabled = 1;
70
71                         if(! $mail_disabled) {
72                                 $failed = false;
73                                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
74                                         intval(local_user())
75                                 );
76                                 if(! count($r)) {
77                                         q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
78                                                 intval(local_user())
79                                         );
80                                 }
81                                 if(strlen($mail_pass)) {
82                                         $pass = '';
83                                         openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']);
84                                         q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1",
85                                                 dbesc(bin2hex($pass)),
86                                                 intval(local_user())
87                                         );
88                                 }
89                                 $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
90                                         `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
91                                         dbesc($mail_server),
92                                         intval($mail_port),
93                                         dbesc($mail_ssl),
94                                         dbesc($mail_user),
95                                         dbesc($mail_replyto),
96                                         intval($mail_pubmail),
97                                         intval(local_user())
98                                 );
99                                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
100                                         intval(local_user())
101                                 );
102                                 if(count($r)) {
103                                         $eacct = $r[0];
104                                         require_once('include/email.php');
105                                         $mb = construct_mailbox_name($eacct);
106                                         if(strlen($eacct['server'])) {
107                                                 $dcrpass = '';
108                                                 openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
109                                                 $mbox = email_connect($mb,$mail_user,$dcrpass);
110                                                 unset($dcrpass);
111                                                 if(! $mbox) {
112                                                         $failed = true;
113                                                         notice( t('Failed to connect with email account using the settings provided.') . EOL);
114                                                 }
115                                         }
116                                 }
117                                 if(! $failed)
118                                         info( t('Email settings updated.') . EOL);
119                         }
120                 }
121
122                 call_hooks('connector_settings_post', $_POST);
123                 return;
124         }
125
126
127         call_hooks('settings_post', $_POST);
128
129         if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
130
131                 $newpass = $_POST['npassword'];
132                 $confirm = $_POST['confirm'];
133
134                 $err = false;
135                 if($newpass != $confirm ) {
136                         notice( t('Passwords do not match. Password unchanged.') . EOL);
137                         $err = true;
138                 }
139
140                 if((! x($newpass)) || (! x($confirm))) {
141                         notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
142                         $err = true;
143                 }
144
145                 if(! $err) {
146                         $password = hash('whirlpool',$newpass);
147                         $r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d LIMIT 1",
148                                 dbesc($password),
149                                 intval(local_user())
150                         );
151                         if($r)
152                                 info( t('Password changed.') . EOL);
153                         else
154                                 notice( t('Password update failed. Please try again.') . EOL);
155                 }
156         }
157
158         $theme            = ((x($_POST,'theme'))      ? notags(trim($_POST['theme']))        : '');
159         $username         = ((x($_POST,'username'))   ? notags(trim($_POST['username']))     : '');
160         $email            = ((x($_POST,'email'))      ? notags(trim($_POST['email']))        : '');
161         $timezone         = ((x($_POST,'timezone'))   ? notags(trim($_POST['timezone']))     : '');
162         $defloc           = ((x($_POST,'defloc'))     ? notags(trim($_POST['defloc']))       : '');
163         $openid           = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url']))   : '');
164         $maxreq           = ((x($_POST,'maxreq'))     ? intval($_POST['maxreq'])             : 0);
165         $expire           = ((x($_POST,'expire'))     ? intval($_POST['expire'])             : 0);
166
167         $allow_location   = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
168         $publish          = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
169         $net_publish      = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
170         $old_visibility   = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
171         $page_flags       = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
172         $blockwall        = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
173         $blocktags        = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
174
175         $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
176         $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
177
178
179         $notify = 0;
180
181         if(x($_POST,'notify1'))
182                 $notify += intval($_POST['notify1']);
183         if(x($_POST,'notify2'))
184                 $notify += intval($_POST['notify2']);
185         if(x($_POST,'notify3'))
186                 $notify += intval($_POST['notify3']);
187         if(x($_POST,'notify4'))
188                 $notify += intval($_POST['notify4']);
189         if(x($_POST,'notify5'))
190                 $notify += intval($_POST['notify5']);
191
192         $email_changed = false;
193
194         $err = '';
195
196         $name_change = false;
197
198         if($username != $a->user['username']) {
199                 $name_change = true;
200                 if(strlen($username) > 40)
201                         $err .= t(' Please use a shorter name.');
202                 if(strlen($username) < 3)
203                         $err .= t(' Name too short.');
204         }
205
206         if($email != $a->user['email']) {
207                 $email_changed = true;
208         if(! valid_email($email))
209                         $err .= t(' Not valid email.');
210                 if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
211                         $err .= t(' Cannot change to that email.');
212                         $email = $a->user['email'];
213                 }
214         }
215
216         if(strlen($err)) {
217                 notice($err . EOL);
218                 return;
219         }
220
221         if($timezone != $a->user['timezone']) {
222                 if(strlen($timezone))
223                         date_default_timezone_set($timezone);
224         }
225
226         $str_group_allow   = perms2str($_POST['group_allow']);
227         $str_contact_allow = perms2str($_POST['contact_allow']);
228         $str_group_deny    = perms2str($_POST['group_deny']);
229         $str_contact_deny  = perms2str($_POST['contact_deny']);
230
231         $openidserver = $a->user['openidserver'];
232
233         // If openid has changed or if there's an openid but no openidserver, try and discover it.
234
235         if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
236                 $tmp_str = $openid;
237                 if(strlen($tmp_str) && validate_url($tmp_str)) {
238                         logger('updating openidserver');
239                         require_once('library/openid.php');
240                         $open_id_obj = new LightOpenID;
241                         $open_id_obj->identity = $openid;
242                         $openidserver = $open_id_obj->discover($open_id_obj->identity);
243                 }
244                 else
245                         $openidserver = '';
246         }
247
248         $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, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d  WHERE `uid` = %d LIMIT 1",
249                         dbesc($username),
250                         dbesc($email),
251                         dbesc($openid),
252                         dbesc($timezone),
253                         dbesc($str_contact_allow),
254                         dbesc($str_group_allow),
255                         dbesc($str_contact_deny),
256                         dbesc($str_group_deny),
257                         intval($notify),
258                         intval($page_flags),
259                         dbesc($defloc),
260                         intval($allow_location),
261                         dbesc($theme),
262                         intval($maxreq),
263                         intval($expire),
264                         dbesc($openidserver),
265                         intval($blockwall),
266                         intval($hidewall),
267                         intval($blocktags),
268                         intval(local_user())
269         );
270         if($r)
271                 info( t('Settings updated.') . EOL);
272
273         $r = q("UPDATE `profile` 
274                 SET `publish` = %d, 
275                 `net-publish` = %d,
276                 `hide-friends` = %d
277                 WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
278                 intval($publish),
279                 intval($net_publish),
280                 intval($hide_friends),
281                 intval(local_user())
282         );
283
284
285         if($name_change) {
286                 q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
287                         dbesc($username),
288                         dbesc(datetime_convert()),
289                         intval(local_user())
290                 );
291         }               
292
293         if($old_visibility != $net_publish) {
294                 // Update global directory in background
295                 $url = $_SESSION['my_url'];
296                 if($url && strlen(get_config('system','directory_submit_url')))
297                         proc_run('php',"include/directory.php","$url");
298
299         }
300
301
302         require_once('include/profile_update.php');
303         profile_change();
304
305         $_SESSION['theme'] = $theme;
306         if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
307
308                 // FIXME - set to un-verified, blocked and redirect to logout
309
310         }
311
312         goaway($a->get_baseurl() . '/settings' );
313         return; // NOTREACHED
314 }
315                 
316
317 if(! function_exists('settings_content')) {
318 function settings_content(&$a) {
319
320         $o = '';
321         nav_set_selected('settings');
322
323         if(! local_user()) {
324                 notice( t('Permission denied.') . EOL );
325                 return;
326         }
327         
328         $tabs = array(
329                 array(
330                         'label' => t('Account settings'),
331                         'url'   => $a->get_baseurl().'/settings',
332                         'sel'   => (($a->argc == 1)?'active':''),
333                 ),      
334                 array(
335                         'label' => t('Connector settings'),
336                         'url'   => $a->get_baseurl().'/settings/connectors',
337                         'sel'   => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
338                 ),
339                 array(
340                         'label' => t('Plugin settings'),
341                         'url'   => $a->get_baseurl().'/settings/addon',
342                         'sel'   => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
343                 ),
344                 array(
345                         'label' => t('Export personal data'),
346                         'url' => $a->get_baseurl() . '/uexport',
347                         'sel' => ''
348                 )
349         );
350         
351         $tabtpl = get_markup_template("common_tabs.tpl");
352         $tabs = replace_macros($tabtpl, array(
353                 '$tabs' => $tabs,
354         ));
355                 
356         
357
358         if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
359                 $settings_addons = "";
360                 
361                 $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
362                 if(! count($r))
363                         $settings_addons = t('No Plugin settings configured');
364
365                 call_hooks('plugin_settings', $settings_addons);
366                 
367                 
368                 $tpl = get_markup_template("settings_addons.tpl");
369                 $o .= replace_macros($tpl, array(
370                         '$title'        => t('Plugin Settings'),
371                         '$tabs'         => $tabs,
372                         '$settings_addons' => $settings_addons
373                 ));
374                 return $o;
375         }
376
377         if(($a->argc > 1) && ($a->argv[1] === 'connectors')) {
378
379                 $settings_connectors = "";
380                 
381                 call_hooks('connector_settings', $settings_connectors);
382
383                 $diasp_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('Diaspora'), ((get_config('system','diaspora_enabled')) ? t('enabled') : t('disabled')));
384                 $ostat_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('StatusNet'), ((get_config('system','ostatus_disabled')) ? t('disabled') : t('enabled')));
385
386         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
387         if(get_config('system','dfrn_only'))
388                 $mail_disabled = 1;
389
390         if(! $mail_disabled) {
391                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
392                         local_user()
393                 );
394         }
395         else {
396                 $r = null;
397         }
398
399         $mail_server  = ((count($r)) ? $r[0]['server'] : '');
400         $mail_port    = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
401         $mail_ssl     = ((count($r)) ? $r[0]['ssltype'] : '');
402         $mail_user    = ((count($r)) ? $r[0]['user'] : '');
403         $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
404         $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
405         $mail_chk     = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
406
407                 
408         $tpl = get_markup_template("settings_connectors.tpl");
409                 $o .= replace_macros($tpl, array(
410                         '$title'        => t('Connector Settings'),
411                         '$tabs'         => $tabs,
412                 
413                 '$diasp_enabled' => $diasp_enabled,
414                 '$ostat_enabled' => $ostat_enabled,
415                 
416                 '$h_imap' => t('Email/Mailbox Setup'),
417                 '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
418                 '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''),
419                 '$mail_disabled' => (($mail_disabled) ? t('Email access is disabled on this site.') : ''),
420                 '$mail_server'  => array('mail_server',  t('IMAP server name:'), $mail_server, ''),
421                 '$mail_port'    => array('mail_port',    t('IMAP port:'), $mail_port, ''),
422                 '$mail_ssl'             => array('mail_ssl',     t('Security:'), strtoupper($mail_ssl), '', array( ''=>t('None'), 'TSL'=>'TSL', 'SSL'=>'SSL')),
423                 '$mail_user'    => array('mail_user',    t('Email login name:'), $mail_user, ''),
424                 '$mail_pass'    => array('mail_pass',    t('Email password:'), '', ''),
425                 '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'),
426                 '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
427                 '$submit' => t('Submit'),               
428                 
429
430
431                         '$settings_connectors' => $settings_connectors
432                 ));
433                 return $o;
434         }
435
436                 
437         require_once('include/acl_selectors.php');
438
439         $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
440                 intval(local_user())
441         );
442         if(count($p))
443                 $profile = $p[0];
444
445         $username = $a->user['username'];
446         $email    = $a->user['email'];
447         $nickname = $a->user['nickname'];
448         $timezone = $a->user['timezone'];
449         $notify   = $a->user['notify-flags'];
450         $defloc   = $a->user['default-location'];
451         $openid   = $a->user['openid'];
452         $maxreq   = $a->user['maxreq'];
453         $expire   = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
454         $blockwall = $a->user['blockwall'];
455         $blocktags = $a->user['blocktags'];
456
457         if(! strlen($a->user['timezone']))
458                 $timezone = date_default_timezone_get();
459
460
461
462         $pageset_tpl = get_markup_template('pagetypes.tpl');
463         $pagetype = replace_macros($pageset_tpl,array(
464                 '$page_normal'  => array('page-flags', t('Normal Account'), PAGE_NORMAL, 
465                                                                         t('This account is a normal personal profile'), 
466                                                                         ($a->user['page-flags'] == PAGE_NORMAL)),
467                                                                 
468                 '$page_soapbox'         => array('page-flags', t('Soapbox Account'), PAGE_SOAPBOX, 
469                                                                         t('Automatically approve all connection/friend requests as read-only fans'), 
470                                                                         ($a->user['page-flags'] == PAGE_SOAPBOX)),
471                                                                         
472                 '$page_community'       => array('page-flags', t('Community/Celebrity Account'), PAGE_COMMUNITY, 
473                                                                         t('Automatically approve all connection/friend requests as read-write fans'), 
474                                                                         ($a->user['page-flags'] == PAGE_COMMUNITY)),
475                                                                         
476                 '$page_freelove'        => array('page-flags', t('Automatic Friend Account'), PAGE_FREELOVE, 
477                                                                         t('Automatically approve all connection/friend requests as friends'), 
478                                                                         ($a->user['page-flags'] == PAGE_FREELOVE)),
479         ));
480
481         $noid = get_config('system','no_openid');
482
483         if($noid) {
484                 $openid_field = false;
485         }
486         else {
487                 $openid_field = array('openid_url', t('OpenID:'),$openid, t("\x28Optional\x29 Allow this OpenID to login to this account."));
488         }
489
490
491         $opt_tpl = get_markup_template("field_yesno.tpl");
492         if(get_config('system','publish_all')) {
493                 $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
494         }
495         else {
496                 $profile_in_dir = replace_macros($opt_tpl,array(
497                         '$field'        => array('profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], '', array(t('No'),t('Yes'))),
498                 ));
499         }
500
501         if(strlen(get_config('system','directory_submit_url'))) {
502                 $profile_in_net_dir = replace_macros($opt_tpl,array(
503                         '$field'        => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
504                 ));
505         }
506         else
507                 $profile_in_net_dir = '';
508
509
510         $hide_friends = replace_macros($opt_tpl,array(
511                         '$field'        => array('hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', array(t('No'),t('Yes'))),
512         ));
513
514         $hide_wall = replace_macros($opt_tpl,array(
515                         '$field'        => array('hidewall',  t('Hide profile details and all your messages from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))),
516
517         ));
518
519         $blockwall = replace_macros($opt_tpl,array(
520                         '$field'        => array('blockwall',  t('Allow friends to post to your profile page?'), ! $a->user['blockwall'], '', array(t('No'),t('Yes'))),
521
522         ));
523  
524
525         $blocktags = replace_macros($opt_tpl,array(
526                         '$field'        => array('blocktags',  t('Allow friends to tag your posts?'), ! $a->user['blocktags'], '', array(t('No'),t('Yes'))),
527
528         ));
529
530
531         $invisible = (((! $profile['publish']) && (! $profile['net-publish']))
532                 ? true : false);
533
534         if($invisible)
535                 info( t('Profile is <strong>not published</strong>.') . EOL );
536
537         
538         $default_theme = get_config('system','theme');
539         if(! $default_theme)
540                 $default_theme = 'default';
541         
542         $themes = array();
543         $files = glob('view/theme/*');
544         if($files) {
545                 foreach($files as $file) {
546                         $f = basename($file);
547                         $theme_name = ((file_exists($file . '/experimental')) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
548                         $themes[$f]=$theme_name;
549                 }
550         }
551         $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
552
553
554         $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : '');
555
556         $tpl_addr = get_markup_template("settings_nick_set.tpl");
557
558         $prof_addr = replace_macros($tpl_addr,array(
559                 '$desc' => t('Your Identity Address is'),
560                 '$nickname' => $nickname,
561                 '$subdir' => $subdir,
562                 '$basepath' => $a->get_hostname()
563         ));
564
565         $stpl = get_markup_template('settings.tpl');
566
567         $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
568
569         
570
571         $o .= replace_macros($stpl,array(
572                 '$tabs'         => $tabs,
573                 '$ptitle'       => t('Account Settings'),
574
575                 '$submit'       => t('Submit'),
576                 '$baseurl' => $a->get_baseurl(),
577                 '$uid' => local_user(),
578                 
579                 '$nickname_block' => $prof_addr,
580                 
581                 '$h_pass'       => t('Password Settings'),
582                 '$password1'=> array('npassword', t('New Password:'), '', ''),
583                 '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
584                 '$oid_enable' => (! get_config('system','no_openid')),
585                 '$openid'       => $openid_field,
586                 
587                 '$h_basic'      => t('Basic Settings'),
588                 '$username' => array('username',  t('Full Name:'), $username,''),
589                 '$email'        => array('email', t('Email Address:'), $email, ''),
590                 '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''),
591                 '$defloc'       => array('defloc', t('Default Post Location:'), $defloc, ''),
592                 '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''),
593                 '$theme'        => array('theme', t('Display Theme:'), $theme_selected, '', $themes),
594
595
596
597                 '$h_prv'        => t('Security and Privacy Settings'),
598
599                 '$maxreq'       => array('maxreq', t('Maximum Friend Requests/Day:'), $maxreq ,t("\x28to prevent spam abuse\x29")),
600                 '$permissions' => t('Default Post Permissions'),
601                 '$permdesc' => t("\x28click to open/close\x29"),
602                 '$visibility' => $profile['net-publish'],
603                 '$aclselect' => populate_acl($a->user,$celeb),
604
605                 '$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''),
606                 '$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''),
607                 '$expire'       => array('expire', t("Automatically expire posts after days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
608
609                 '$profile_in_dir' => $profile_in_dir,
610                 '$profile_in_net_dir' => $profile_in_net_dir,
611                 '$hide_friends' => $hide_friends,
612                 '$hide_wall' => $hide_wall,
613                 
614                 
615                 
616                 '$h_not'        => t('Notification Settings'),
617                 '$lbl_not'      => t('Send a notification email when:'),
618                 '$notify1'      => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''),
619                 '$notify2'      => array('notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''),
620                 '$notify3'      => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''),
621                 '$notify4'      => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
622                 '$notify5'      => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
623                 
624                 
625                 
626                 '$h_advn' => t('Advanced Page Settings'),
627                 '$pagetype' => $pagetype,
628                 
629
630                 
631                 
632
633                 
634
635
636
637
638                 
639
640         ));
641
642         call_hooks('settings_form',$o);
643
644         $o .= '</form>' . "\r\n";
645
646         return $o;
647
648 }}
649