]> git.mxchange.org Git - friendica.git/blob - mod/settings.php
2e942231a8cbbcd3e8cefd51b509ac13f639cfce
[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         call_hooks('settings_post', $_POST);
56
57         if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
58
59                 $newpass = $_POST['npassword'];
60                 $confirm = $_POST['confirm'];
61
62                 $err = false;
63                 if($newpass != $confirm ) {
64                         notice( t('Passwords do not match. Password unchanged.') . EOL);
65                         $err = true;
66                 }
67
68                 if((! x($newpass)) || (! x($confirm))) {
69                         notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
70                         $err = true;
71                 }
72
73                 if(! $err) {
74                         $password = hash('whirlpool',$newpass);
75                         $r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d LIMIT 1",
76                                 dbesc($password),
77                                 intval(local_user())
78                         );
79                         if($r)
80                                 info( t('Password changed.') . EOL);
81                         else
82                                 notice( t('Password update failed. Please try again.') . EOL);
83                 }
84         }
85
86         $theme            = ((x($_POST,'theme'))      ? notags(trim($_POST['theme']))        : '');
87         $username         = ((x($_POST,'username'))   ? notags(trim($_POST['username']))     : '');
88         $email            = ((x($_POST,'email'))      ? notags(trim($_POST['email']))        : '');
89         $timezone         = ((x($_POST,'timezone'))   ? notags(trim($_POST['timezone']))     : '');
90         $defloc           = ((x($_POST,'defloc'))     ? notags(trim($_POST['defloc']))       : '');
91         $openid           = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url']))   : '');
92         $maxreq           = ((x($_POST,'maxreq'))     ? intval($_POST['maxreq'])             : 0);
93         $expire           = ((x($_POST,'expire'))     ? intval($_POST['expire'])             : 0);
94
95         $allow_location   = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
96         $publish          = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
97         $net_publish      = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
98         $old_visibility   = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
99         $page_flags       = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
100         $blockwall        = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
101
102         $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
103         $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
104
105
106
107
108         $mail_server      = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
109         $mail_port        = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
110         $mail_ssl         = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
111         $mail_user        = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
112         $mail_pass        = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
113         $mail_replyto     = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
114         $mail_pubmail     = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
115
116
117         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
118
119         if(! $mail_disabled) {
120                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
121                         intval(local_user())
122                 );
123                 if(! count($r)) {
124                         q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
125                                 intval(local_user())
126                         );
127                 }
128                 if(strlen($mail_pass)) {
129                         $pass = '';
130                         openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']);
131                         q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1",
132                                         dbesc(bin2hex($pass)),
133                                         intval(local_user())
134                         );
135                 }
136                 $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
137                         `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
138                         dbesc($mail_server),
139                         intval($mail_port),
140                         dbesc($mail_ssl),
141                         dbesc($mail_user),
142                         dbesc($mail_replyto),
143                         intval($mail_pubmail),
144                         intval(local_user())
145                 );
146                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
147                         intval(local_user())
148                 );
149                 if(count($r)) {
150                         $eacct = $r[0];
151                         require_once('include/email.php');
152                         $mb = construct_mailbox_name($eacct);
153                         if(strlen($eacct['server'])) {
154                                 $dcrpass = '';
155                                 openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
156                                 $mbox = email_connect($mb,$mail_user,$dcrpass);
157                                 unset($dcrpass);
158                                 if(! $mbox)
159                                         notice( t('Failed to connect with email account using the settings provided.') . EOL);
160                         }
161                 }
162         }
163
164         $notify = 0;
165
166         if(x($_POST,'notify1'))
167                 $notify += intval($_POST['notify1']);
168         if(x($_POST,'notify2'))
169                 $notify += intval($_POST['notify2']);
170         if(x($_POST,'notify3'))
171                 $notify += intval($_POST['notify3']);
172         if(x($_POST,'notify4'))
173                 $notify += intval($_POST['notify4']);
174         if(x($_POST,'notify5'))
175                 $notify += intval($_POST['notify5']);
176
177         $email_changed = false;
178
179         $err = '';
180
181         $name_change = false;
182
183         if($username != $a->user['username']) {
184                 $name_change = true;
185                 if(strlen($username) > 40)
186                         $err .= t(' Please use a shorter name.');
187                 if(strlen($username) < 3)
188                         $err .= t(' Name too short.');
189         }
190
191         if($email != $a->user['email']) {
192                 $email_changed = true;
193         if(! valid_email($email))
194                         $err .= t(' Not valid email.');
195                 if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
196                         $err .= t(' Cannot change to that email.');
197                         $email = $a->user['email'];
198                 }
199         }
200
201         if(strlen($err)) {
202                 notice($err . EOL);
203                 return;
204         }
205
206         if($timezone != $a->user['timezone']) {
207                 if(strlen($timezone))
208                         date_default_timezone_set($timezone);
209         }
210
211         $str_group_allow   = perms2str($_POST['group_allow']);
212         $str_contact_allow = perms2str($_POST['contact_allow']);
213         $str_group_deny    = perms2str($_POST['group_deny']);
214         $str_contact_deny  = perms2str($_POST['contact_deny']);
215
216         $openidserver = $a->user['openidserver'];
217
218         // If openid has changed or if there's an openid but no openidserver, try and discover it.
219
220         if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
221                 $tmp_str = $openid;
222                 if(strlen($tmp_str) && validate_url($tmp_str)) {
223                         logger('updating openidserver');
224                         require_once('library/openid.php');
225                         $open_id_obj = new LightOpenID;
226                         $open_id_obj->identity = $openid;
227                         $openidserver = $open_id_obj->discover($open_id_obj->identity);
228                 }
229                 else
230                         $openidserver = '';
231         }
232
233         $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  WHERE `uid` = %d LIMIT 1",
234                         dbesc($username),
235                         dbesc($email),
236                         dbesc($openid),
237                         dbesc($timezone),
238                         dbesc($str_contact_allow),
239                         dbesc($str_group_allow),
240                         dbesc($str_contact_deny),
241                         dbesc($str_group_deny),
242                         intval($notify),
243                         intval($page_flags),
244                         dbesc($defloc),
245                         intval($allow_location),
246                         dbesc($theme),
247                         intval($maxreq),
248                         intval($expire),
249                         dbesc($openidserver),
250                         intval($blockwall),
251                         intval(local_user())
252         );
253         if($r)
254                 info( t('Settings updated.') . EOL);
255
256         $r = q("UPDATE `profile` 
257                 SET `publish` = %d, 
258                 `net-publish` = %d,
259                 `hide-friends` = %d,
260                 `hidewall` = %d
261                 WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
262                 intval($publish),
263                 intval($net_publish),
264                 intval($hide_friends),
265                 intval($hidewall),
266                 intval(local_user())
267         );
268
269
270         if($name_change) {
271                 q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
272                         dbesc($username),
273                         dbesc(datetime_convert()),
274                         intval(local_user())
275                 );
276         }               
277
278         if($old_visibility != $net_publish) {
279                 // Update global directory in background
280                 $url = $_SESSION['my_url'];
281                 if($url && strlen(get_config('system','directory_submit_url')))
282                         proc_run('php',"include/directory.php","$url");
283         }
284
285         $_SESSION['theme'] = $theme;
286         if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
287
288                 // FIXME - set to un-verified, blocked and redirect to logout
289
290         }
291
292         goaway($a->get_baseurl() . '/settings' );
293         return; // NOTREACHED
294 }
295                 
296
297 if(! function_exists('settings_content')) {
298 function settings_content(&$a) {
299
300         $o = '';
301         $o .= '<script> $(document).ready(function() { $(\'#nav-settings-link\').addClass(\'nav-selected\'); });</script>';
302
303         if(! local_user()) {
304                 notice( t('Permission denied.') . EOL );
305                 return;
306         }
307
308         if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
309                 $o .= '<h1>' . t('Plugin Settings') . '</h1>';
310                 $o .= '<div id="account-settings-link"><a href="settings">' . t('Account Settings') . '</a></div>';
311
312                 $o .= '<form action="settings/addon" method="post" >';
313
314                 $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
315                 if(! count($r))
316                         notice( t('No Plugin settings configured') . EOL);
317
318                 call_hooks('plugin_settings', $o);
319                 $o .= '</form>';
320                 return $o;
321         }
322                 
323         require_once('include/acl_selectors.php');
324
325         $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
326                 intval(local_user())
327         );
328         if(count($p))
329                 $profile = $p[0];
330
331         $username = $a->user['username'];
332         $email    = $a->user['email'];
333         $nickname = $a->user['nickname'];
334         $timezone = $a->user['timezone'];
335         $notify   = $a->user['notify-flags'];
336         $defloc   = $a->user['default-location'];
337         $openid   = $a->user['openid'];
338         $maxreq   = $a->user['maxreq'];
339         $expire   = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
340         $blockwall = $a->user['blockwall'];
341
342         if(! strlen($a->user['timezone']))
343                 $timezone = date_default_timezone_get();
344
345
346         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
347
348         if(! $mail_disabled) {
349                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
350                         local_user()
351                 );
352         }
353         else {
354                 $r = null;
355                 $imap_disabled = (($mail_disabled) ? ' disabled="disabled" ' : '');
356         }
357
358         $mail_server  = ((count($r)) ? $r[0]['server'] : '');
359         $mail_port    = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
360         $mail_ssl     = ((count($r)) ? $r[0]['ssltype'] : '');
361         $mail_user    = ((count($r)) ? $r[0]['user'] : '');
362         $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
363         $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
364         $mail_chk     = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
365
366         $pageset_tpl = get_markup_template('pagetypes.tpl');
367         $pagetype = replace_macros($pageset_tpl,array(
368                 '$normal'         => (($a->user['page-flags'] == PAGE_NORMAL)      ? " checked=\"checked\" " : ""),
369                 '$soapbox'        => (($a->user['page-flags'] == PAGE_SOAPBOX)     ? " checked=\"checked\" " : ""),
370                 '$community'      => (($a->user['page-flags'] == PAGE_COMMUNITY)   ? " checked=\"checked\" " : ""),
371                 '$freelove'       => (($a->user['page-flags'] == PAGE_FREELOVE)    ? " checked=\"checked\" " : ""),
372                 '$page_normal'    => PAGE_NORMAL,
373                 '$page_soapbox'   => PAGE_SOAPBOX,
374                 '$page_community' => PAGE_COMMUNITY,
375                 '$page_freelove'  => PAGE_FREELOVE,
376                 '$n_l'            => t('Normal Account'),
377                 '$n_d'            => t('This account is a normal personal profile'),
378                 '$s_l'            => t('Soapbox Account'),
379                 '$s_d'            => t('Automatically approve all connection/friend requests as read-only fans'),
380                 '$c_l'            => t('Community/Celebrity Account'),
381                 '$c_d'            => t('Automatically approve all connection/friend requests as read-write fans'),
382                 '$f_l'            => t('Automatic Friend Account'),
383                 '$f_d'            => t('Automatically approve all connection/friend requests as friends')               
384         ));
385
386         $noid = get_config('system','no_openid');
387
388         if($noid) {
389                 $oidhtml = '';
390         }
391         else {
392                 $oidhtml = '<label id="settings-openid-label" for="settings-openid" >' . t('OpenID: ') . '</label><input type="text" id="settings-openid" class="openid" name="openid_url" value="$openid" />' . t("&nbsp;\x28Optional\x29 Allow this OpenID to login to this account.");
393         }
394
395
396         if(get_config('system','publish_all')) {
397                 $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
398         }
399         else {
400                 $opt_tpl = get_markup_template("profile-in-directory.tpl");
401                 $profile_in_dir = replace_macros($opt_tpl,array(
402                         '$desc'         => t('Publish your default profile in your local site directory?'),
403                         '$yes_str'      => t('Yes'),
404                         '$no_str'       => t('No'),
405                         '$yes_selected' => (($profile['publish'])      ? " checked=\"checked\" " : ""),
406                         '$no_selected'  => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
407                 ));
408         }
409
410         if(strlen(get_config('system','directory_submit_url'))) {
411                 $opt_tpl = get_markup_template("profile-in-netdir.tpl");
412
413                 $profile_in_net_dir = replace_macros($opt_tpl,array(
414                         '$desc'         => t('Publish your default profile in the global social directory?'),
415                         '$yes_str'      => t('Yes'),
416                         '$no_str'       => t('No'),
417                         '$yes_selected' => (($profile['net-publish'])      ? " checked=\"checked\" " : ""),
418                         '$no_selected'  => (($profile['net-publish'] == 0) ? " checked=\"checked\" " : "")
419                 ));
420         }
421         else
422                 $profile_in_net_dir = '';
423
424
425         $opt_tpl = get_markup_template("profile-hide-friends.tpl");
426         $hide_friends = replace_macros($opt_tpl,array(
427                 '$desc' => t('Hide your contact/friend list from viewers of your default profile?'),
428                 '$yes_str' => t('Yes'),
429                 '$no_str' => t('No'),
430                 '$yes_selected' => (($profile['hide-friends']) ? " checked=\"checked\" " : ""),
431                 '$no_selected' => (($profile['hide-friends'] == 0) ? " checked=\"checked\" " : "")
432         ));
433
434         $opt_tpl = get_markup_template("profile-hide-wall.tpl");
435         $hide_wall = replace_macros($opt_tpl,array(
436                 '$desc' => t('Hide profile details and all your messages from unknown viewers?'),
437                 '$yes_str' => t('Yes'),
438                 '$no_str' => t('No'),
439                 '$yes_selected' => (($profile['hidewall']) ? " checked=\"checked\" " : ""),
440                 '$no_selected' => (($profile['hidewall'] == 0) ? " checked=\"checked\" " : "")
441         ));
442
443
444
445
446
447
448         $loc_checked = (($a->user['allow_location'] == 1)      ? " checked=\"checked\" " : "");
449
450         $invisible = (((! $profile['publish']) && (! $profile['net-publish']))
451                 ? true : false);
452
453         if($invisible)
454                 info( t('Profile is <strong>not published</strong>.') . EOL );
455
456         
457         $theme_selector = '<select name="theme" id="theme-select" >';
458         $files = glob('view/theme/*');
459
460         $default_theme = get_config('system','theme');
461         if(! $default_theme)
462                 $default_theme = 'default';
463
464         if($files) {
465                 foreach($files as $file) {
466                         $f = basename($file);
467                         $selected = (($f == $_SESSION['theme']) || ($f === $default_theme && (! x($_SESSION,'theme')))
468                                 ? ' selected="selected" ' : '' );
469                         $theme_name = ((file_exists($file . '/experimental')) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
470                         $theme_selector .= '<option value="' . $f . '"' . $selected . '>' . $theme_name . '</option>';
471                 }
472         }
473
474         $theme_selector .= '</select>';
475
476         $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : '');
477
478         $tpl_addr = get_markup_template("settings_nick_set.tpl");
479
480         $prof_addr = replace_macros($tpl_addr,array(
481                 '$desc' => t('Your Identity Address is'),
482                 '$nickname' => $nickname,
483                 '$subdir' => $subdir,
484                 '$basepath' => $a->get_hostname()
485         ));
486
487         $stpl = get_markup_template('settings.tpl');
488
489         $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
490
491         $uexport = '<div id="uexport-link"><a href="uexport" >' . t('Export Personal Data') . '</a></div>';
492
493
494         $o .= replace_macros($stpl,array(
495                 '$ptitle' => t('Account Settings'),
496                 '$lbl_plug' => t('Plugin Settings'),
497                 '$lbl_basic' => t('Basic Settings'),
498                 '$lbl_fn' => t('Full Name:'),
499                 '$lbl_email' => t('Email Address:'),
500                 '$lbl_tz' => t('Your Timezone:'),
501                 '$lbl_loc1' => t('Default Post Location:'),
502                 '$lbl_loc2' => t('Use Browser Location:'),
503                 '$lbl_theme' => t('Display Theme:'),
504                 '$submit' => t('Submit'),
505                 '$lbl_prv' => t('Security and Privacy Settings'),
506                 '$lbl_maxreq' => t('Maximum Friend Requests/Day:'),
507                 '$lbl_maxrdesc' => t("\x28to prevent spam abuse\x29"),
508                 '$lbl_rempost' => t('Allow friends to post to your profile page:'),
509                 '$lbl_exp1' => t("Automatically expire \x28delete\x29 posts older than"),
510                 '$lbl_exp2' => t('days'),
511                 '$lbl_not1' => t('Notification Settings'),
512                 '$lbl_not2' => t('Send a notification email when:'),
513                 '$lbl_not3' => t('You receive an introduction'),
514                 '$lbl_not4' => t('Your introductions are confirmed'),
515                 '$lbl_not5' => t('Someone writes on your profile wall'),
516                 '$lbl_not6' => t('Someone writes a followup comment'),
517                 '$lbl_not7' => t('You receive a private message'),
518                 '$lbl_pass1' => t('Password Settings'),
519                 '$lbl_pass2' => t('Leave password fields blank unless changing'),
520                 '$lbl_pass3' => t('New Password:'),
521                 '$lbl_pass4' => t('Confirm:'),
522                 '$lbl_advn' => t('Advanced Page Settings'),
523                 '$baseurl' => $a->get_baseurl(),
524                 '$hide_friends' => $hide_friends,
525                 '$hide_wall' => $hide_wall,
526                 '$oidhtml' => $oidhtml,
527                 '$uexport' => $uexport,
528                 '$uid' => local_user(),
529                 '$username' => $username,
530                 '$openid' => $openid,
531                 '$email' => $email,
532                 '$nickname_block' => $prof_addr,
533                 '$timezone' => $timezone,
534                 '$zoneselect' => select_timezone($timezone),
535                 '$defloc' => $defloc,
536                 '$loc_checked' => $loc_checked,
537                 '$profile_in_dir' => $profile_in_dir,
538                 '$profile_in_net_dir' => $profile_in_net_dir,
539                 '$permissions' => t('Default Post Permissions'),
540                 '$permdesc' => t("\x28click to open/close\x29"),
541                 '$visibility' => $profile['net-publish'],
542                 '$aclselect' => populate_acl($a->user,$celeb),
543                 '$sel_notify1' => (($notify & NOTIFY_INTRO)   ? ' checked="checked" ' : ''),
544                 '$sel_notify2' => (($notify & NOTIFY_CONFIRM) ? ' checked="checked" ' : ''),
545                 '$sel_notify3' => (($notify & NOTIFY_WALL)    ? ' checked="checked" ' : ''),
546                 '$sel_notify4' => (($notify & NOTIFY_COMMENT) ? ' checked="checked" ' : ''),
547                 '$sel_notify5' => (($notify & NOTIFY_MAIL)    ? ' checked="checked" ' : ''),
548                 '$maxreq' => $maxreq,
549                 '$expire' => $expire,
550                 '$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ),
551                 '$theme' => $theme_selector,
552                 '$pagetype' => $pagetype,
553                 '$lbl_imap0' => t('Email/Mailbox Setup'),
554                 '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
555                 '$lbl_imap1' => t('IMAP server name:'),
556                 '$imap_server' => $mail_server,
557                 '$lbl_imap2' => t('IMAP port:'),
558                 '$imap_port' => $mail_port,
559                 '$lbl_imap3' => t("Security \x28TLS or SSL\x29:"),
560                 '$imap_ssl' => $mail_ssl,
561                 '$lbl_imap4' => t('Email login name:'),
562                 '$imap_user' => $mail_user,
563                 '$lbl_imap5' => t('Email password:'),
564                 '$lbl_imap6' => t("Reply-to address \x28Optional\x29:"),
565                 '$imap_replyto' => $mail_replyto,
566                 '$lbl_imap7' => t('Send public posts to all email contacts:'),
567                 '$lbl_imap8' => t('Last successful email check:'),
568                 '$lbl_imap9' => (($mail_chk === '0000-00-00 00:00:00') ? t('never') : datetime_convert('UTC', date_default_timezone_get(), $mail_chk, t('g A l F d Y'))), 
569                 '$pubmail_checked' => (($mail_pubmail) ? ' checked="checked" ' : ''),
570                 '$mail_disabled' => (($mail_disabled) ? '<div class="info-message">' . t('Email access is disabled on this site.') . '</div>' : ''),
571                 '$imap_disabled' => $imap_disabled
572         ));
573
574         call_hooks('settings_form',$o);
575
576         $o .= '</form>' . "\r\n";
577
578         return $o;
579
580 }}
581