Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1165 lines
42 KiB

  1. <?php
  2. function get_theme_config_file($theme){
  3. $a = get_app();
  4. $base_theme = $a->theme_info['extends'];
  5. if (file_exists("view/theme/$theme/config.php")){
  6. return "view/theme/$theme/config.php";
  7. }
  8. if (file_exists("view/theme/$base_theme/config.php")){
  9. return "view/theme/$base_theme/config.php";
  10. }
  11. return null;
  12. }
  13. function settings_init(&$a) {
  14. if (function_exists("apc_delete")) {
  15. $toDelete = new APCIterator('user', APC_ITER_VALUE);
  16. apc_delete($toDelete);
  17. }
  18. // These lines provide the javascript needed by the acl selector
  19. $tpl = get_markup_template("settings-head.tpl");
  20. $a->page['htmlhead'] .= replace_macros($tpl,array(
  21. '$ispublic' => t('everybody')
  22. ));
  23. $tabs = array(
  24. array(
  25. 'label' => t('Account settings'),
  26. 'url' => $a->get_baseurl(true).'/settings',
  27. 'selected' => (($a->argc == 1)?'active':''),
  28. ),
  29. array(
  30. 'label' => t('Additional features'),
  31. 'url' => $a->get_baseurl(true).'/settings/features',
  32. 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
  33. ),
  34. array(
  35. 'label' => t('Display settings'),
  36. 'url' => $a->get_baseurl(true).'/settings/display',
  37. 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
  38. ),
  39. array(
  40. 'label' => t('Connector settings'),
  41. 'url' => $a->get_baseurl(true).'/settings/connectors',
  42. 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
  43. ),
  44. array(
  45. 'label' => t('Plugin settings'),
  46. 'url' => $a->get_baseurl(true).'/settings/addon',
  47. 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
  48. ),
  49. array(
  50. 'label' => t('Connected apps'),
  51. 'url' => $a->get_baseurl(true) . '/settings/oauth',
  52. 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
  53. ),
  54. array(
  55. 'label' => t('Export personal data'),
  56. 'url' => $a->get_baseurl(true) . '/uexport',
  57. 'selected' => ''
  58. ),
  59. array(
  60. 'label' => t('Remove account'),
  61. 'url' => $a->get_baseurl(true) . '/removeme',
  62. 'selected' => ''
  63. )
  64. );
  65. $tabtpl = get_markup_template("generic_links_widget.tpl");
  66. $a->page['aside'] = replace_macros($tabtpl, array(
  67. '$title' => t('Settings'),
  68. '$class' => 'settings-widget',
  69. '$items' => $tabs,
  70. ));
  71. }
  72. function settings_post(&$a) {
  73. if(! local_user())
  74. return;
  75. if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
  76. return;
  77. if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
  78. notice( t('Permission denied.') . EOL);
  79. return;
  80. }
  81. $old_page_flags = $a->user['page-flags'];
  82. if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){
  83. check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
  84. $key = $_POST['remove'];
  85. q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
  86. dbesc($key),
  87. local_user());
  88. goaway($a->get_baseurl(true)."/settings/oauth/");
  89. return;
  90. }
  91. if(($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) {
  92. check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
  93. $name = ((x($_POST,'name')) ? $_POST['name'] : '');
  94. $key = ((x($_POST,'key')) ? $_POST['key'] : '');
  95. $secret = ((x($_POST,'secret')) ? $_POST['secret'] : '');
  96. $redirect = ((x($_POST,'redirect')) ? $_POST['redirect'] : '');
  97. $icon = ((x($_POST,'icon')) ? $_POST['icon'] : '');
  98. if ($name=="" || $key=="" || $secret==""){
  99. notice(t("Missing some important data!"));
  100. } else {
  101. if ($_POST['submit']==t("Update")){
  102. $r = q("UPDATE clients SET
  103. client_id='%s',
  104. pw='%s',
  105. name='%s',
  106. redirect_uri='%s',
  107. icon='%s',
  108. uid=%d
  109. WHERE client_id='%s'",
  110. dbesc($key),
  111. dbesc($secret),
  112. dbesc($name),
  113. dbesc($redirect),
  114. dbesc($icon),
  115. local_user(),
  116. dbesc($key));
  117. } else {
  118. $r = q("INSERT INTO clients
  119. (client_id, pw, name, redirect_uri, icon, uid)
  120. VALUES ('%s','%s','%s','%s','%s',%d)",
  121. dbesc($key),
  122. dbesc($secret),
  123. dbesc($name),
  124. dbesc($redirect),
  125. dbesc($icon),
  126. local_user());
  127. }
  128. }
  129. goaway($a->get_baseurl(true)."/settings/oauth/");
  130. return;
  131. }
  132. if(($a->argc > 1) && ($a->argv[1] == 'addon')) {
  133. check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
  134. call_hooks('plugin_settings_post', $_POST);
  135. return;
  136. }
  137. if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
  138. check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
  139. if(x($_POST, 'imap-submit')) {
  140. $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
  141. $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
  142. $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
  143. $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
  144. $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
  145. $mail_action = ((x($_POST,'mail_action')) ? trim($_POST['mail_action']) : '');
  146. $mail_movetofolder = ((x($_POST,'mail_movetofolder')) ? trim($_POST['mail_movetofolder']) : '');
  147. $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
  148. $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
  149. $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
  150. if(get_config('system','dfrn_only'))
  151. $mail_disabled = 1;
  152. if(! $mail_disabled) {
  153. $failed = false;
  154. $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
  155. intval(local_user())
  156. );
  157. if(! count($r)) {
  158. q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
  159. intval(local_user())
  160. );
  161. }
  162. if(strlen($mail_pass)) {
  163. $pass = '';
  164. openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']);
  165. q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1",
  166. dbesc(bin2hex($pass)),
  167. intval(local_user())
  168. );
  169. }
  170. $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
  171. `action` = %d, `movetofolder` = '%s',
  172. `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
  173. dbesc($mail_server),
  174. intval($mail_port),
  175. dbesc($mail_ssl),
  176. dbesc($mail_user),
  177. intval($mail_action),
  178. dbesc($mail_movetofolder),
  179. dbesc($mail_replyto),
  180. intval($mail_pubmail),
  181. intval(local_user())
  182. );
  183. logger("mail: updating mailaccount. Response: ".print_r($r, true));
  184. $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
  185. intval(local_user())
  186. );
  187. if(count($r)) {
  188. $eacct = $r[0];
  189. require_once('include/email.php');
  190. $mb = construct_mailbox_name($eacct);
  191. if(strlen($eacct['server'])) {
  192. $dcrpass = '';
  193. openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
  194. $mbox = email_connect($mb,$mail_user,$dcrpass);
  195. unset($dcrpass);
  196. if(! $mbox) {
  197. $failed = true;
  198. notice( t('Failed to connect with email account using the settings provided.') . EOL);
  199. }
  200. }
  201. }
  202. if(! $failed)
  203. info( t('Email settings updated.') . EOL);
  204. }
  205. }
  206. call_hooks('connector_settings_post', $_POST);
  207. return;
  208. }
  209. if(($a->argc > 1) && ($a->argv[1] === 'features')) {
  210. check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
  211. foreach($_POST as $k => $v) {
  212. if(strpos($k,'feature_') === 0) {
  213. set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0));
  214. }
  215. }
  216. info( t('Features updated') . EOL);
  217. return;
  218. }
  219. if(($a->argc > 1) && ($a->argv[1] === 'display')) {
  220. check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
  221. $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
  222. $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
  223. $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
  224. $infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0);
  225. $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
  226. $browser_update = $browser_update * 1000;
  227. if($browser_update < 10000)
  228. $browser_update = 10000;
  229. $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40);
  230. if($itemspage_network > 100)
  231. $itemspage_network = 100;
  232. $itemspage_mobile_network = ((x($_POST,'itemspage_mobile_network')) ? intval($_POST['itemspage_mobile_network']) : 20);
  233. if($itemspage_mobile_network > 100)
  234. $itemspage_mobile_network = 100;
  235. if($mobile_theme !== '') {
  236. set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
  237. }
  238. set_pconfig(local_user(),'system','update_interval', $browser_update);
  239. set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
  240. set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network);
  241. set_pconfig(local_user(),'system','no_smilies',$nosmile);
  242. set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll);
  243. if ($theme == $a->user['theme']){
  244. // call theme_post only if theme has not been changed
  245. if( ($themeconfigfile = get_theme_config_file($theme)) != null){
  246. require_once($themeconfigfile);
  247. theme_post($a);
  248. }
  249. }
  250. $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d LIMIT 1",
  251. dbesc($theme),
  252. intval(local_user())
  253. );
  254. call_hooks('display_settings_post', $_POST);
  255. goaway($a->get_baseurl(true) . '/settings/display' );
  256. return; // NOTREACHED
  257. }
  258. check_form_security_token_redirectOnErr('/settings', 'settings');
  259. call_hooks('settings_post', $_POST);
  260. if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
  261. $newpass = $_POST['npassword'];
  262. $confirm = $_POST['confirm'];
  263. $oldpass = hash('whirlpool', $_POST['opassword']);
  264. $err = false;
  265. if($newpass != $confirm ) {
  266. notice( t('Passwords do not match. Password unchanged.') . EOL);
  267. $err = true;
  268. }
  269. if((! x($newpass)) || (! x($confirm))) {
  270. notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
  271. $err = true;
  272. }
  273. // check if the old password was supplied correctly before
  274. // changing it to the new value
  275. $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
  276. if( $oldpass != $r[0]['password'] ) {
  277. notice( t('Wrong password.') . EOL);
  278. $err = true;
  279. }
  280. if(! $err) {
  281. $password = hash('whirlpool',$newpass);
  282. $r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d LIMIT 1",
  283. dbesc($password),
  284. intval(local_user())
  285. );
  286. if($r)
  287. info( t('Password changed.') . EOL);
  288. else
  289. notice( t('Password update failed. Please try again.') . EOL);
  290. }
  291. }
  292. $username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
  293. $email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
  294. $timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
  295. $defloc = ((x($_POST,'defloc')) ? notags(trim($_POST['defloc'])) : '');
  296. $openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
  297. $maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
  298. $expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
  299. $def_gid = ((x($_POST,'group-selection')) ? intval($_POST['group-selection']) : 0);
  300. $expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
  301. $expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
  302. $expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
  303. $expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0);
  304. $expire_network_only = ((x($_POST,'expire_network_only'))? intval($_POST['expire_network_only']) : 0);
  305. $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
  306. $publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
  307. $net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
  308. $old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
  309. $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
  310. $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
  311. $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
  312. $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
  313. $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
  314. $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
  315. $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
  316. $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
  317. $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
  318. $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
  319. $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
  320. $notify = 0;
  321. if(x($_POST,'notify1'))
  322. $notify += intval($_POST['notify1']);
  323. if(x($_POST,'notify2'))
  324. $notify += intval($_POST['notify2']);
  325. if(x($_POST,'notify3'))
  326. $notify += intval($_POST['notify3']);
  327. if(x($_POST,'notify4'))
  328. $notify += intval($_POST['notify4']);
  329. if(x($_POST,'notify5'))
  330. $notify += intval($_POST['notify5']);
  331. if(x($_POST,'notify6'))
  332. $notify += intval($_POST['notify6']);
  333. if(x($_POST,'notify7'))
  334. $notify += intval($_POST['notify7']);
  335. if(x($_POST,'notify8'))
  336. $notify += intval($_POST['notify8']);
  337. $email_changed = false;
  338. $err = '';
  339. $name_change = false;
  340. if($username != $a->user['username']) {
  341. $name_change = true;
  342. if(strlen($username) > 40)
  343. $err .= t(' Please use a shorter name.');
  344. if(strlen($username) < 3)
  345. $err .= t(' Name too short.');
  346. }
  347. if($email != $a->user['email']) {
  348. $email_changed = true;
  349. // check for the correct password
  350. $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
  351. $password = hash('whirlpool', $_POST['password']);
  352. if ($password != $r[0]['password']) {
  353. $err .= t('Wrong Password') . EOL;
  354. $email = $a->user['email'];
  355. }
  356. // check the email is valid
  357. if(! valid_email($email))
  358. $err .= t(' Not valid email.');
  359. // ensure new email is not the admin mail
  360. //if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
  361. if(x($a->config,'admin_email')) {
  362. $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
  363. if (in_array(strtolower($email), $adminlist)) {
  364. $err .= t(' Cannot change to that email.');
  365. $email = $a->user['email'];
  366. }
  367. }
  368. }
  369. if(strlen($err)) {
  370. notice($err . EOL);
  371. return;
  372. }
  373. if($timezone != $a->user['timezone']) {
  374. if(strlen($timezone))
  375. date_default_timezone_set($timezone);
  376. }
  377. $str_group_allow = perms2str($_POST['group_allow']);
  378. $str_contact_allow = perms2str($_POST['contact_allow']);
  379. $str_group_deny = perms2str($_POST['group_deny']);
  380. $str_contact_deny = perms2str($_POST['contact_deny']);
  381. $openidserver = $a->user['openidserver'];
  382. $openid = normalise_openid($openid);
  383. // If openid has changed or if there's an openid but no openidserver, try and discover it.
  384. if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
  385. $tmp_str = $openid;
  386. if(strlen($tmp_str) && validate_url($tmp_str)) {
  387. logger('updating openidserver');
  388. require_once('library/openid.php');
  389. $open_id_obj = new LightOpenID;
  390. $open_id_obj->identity = $openid;
  391. $openidserver = $open_id_obj->discover($open_id_obj->identity);
  392. }
  393. else
  394. $openidserver = '';
  395. }
  396. set_pconfig(local_user(),'expire','items', $expire_items);
  397. set_pconfig(local_user(),'expire','notes', $expire_notes);
  398. set_pconfig(local_user(),'expire','starred', $expire_starred);
  399. set_pconfig(local_user(),'expire','photos', $expire_photos);
  400. set_pconfig(local_user(),'expire','network_only', $expire_network_only);
  401. set_pconfig(local_user(),'system','suggestme', $suggestme);
  402. set_pconfig(local_user(),'system','post_newfriend', $post_newfriend);
  403. set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
  404. set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
  405. if($page_flags == PAGE_PRVGROUP) {
  406. $hidewall = 1;
  407. if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
  408. if($def_gid) {
  409. info( t('Private forum has no privacy permissions. Using default privacy group.'). EOL);
  410. $str_group_allow = '<' . $def_gid . '>';
  411. }
  412. else {
  413. notice( t('Private forum has no privacy permissions and no default privacy group.') . EOL);
  414. }
  415. }
  416. }
  417. $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `def_gid` = %d, `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1",
  418. dbesc($username),
  419. dbesc($email),
  420. dbesc($openid),
  421. dbesc($timezone),
  422. dbesc($str_contact_allow),
  423. dbesc($str_group_allow),
  424. dbesc($str_contact_deny),
  425. dbesc($str_group_deny),
  426. intval($notify),
  427. intval($page_flags),
  428. dbesc($defloc),
  429. intval($allow_location),
  430. intval($maxreq),
  431. intval($expire),
  432. dbesc($openidserver),
  433. intval($def_gid),
  434. intval($blockwall),
  435. intval($hidewall),
  436. intval($blocktags),
  437. intval($unkmail),
  438. intval($cntunkmail),
  439. intval(local_user())
  440. );
  441. if($r)
  442. info( t('Settings updated.') . EOL);
  443. $r = q("UPDATE `profile`
  444. SET `publish` = %d,
  445. `name` = '%s',
  446. `net-publish` = %d,
  447. `hide-friends` = %d
  448. WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
  449. intval($publish),
  450. dbesc($username),
  451. intval($net_publish),
  452. intval($hide_friends),
  453. intval(local_user())
  454. );
  455. if($name_change) {
  456. q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
  457. dbesc($username),
  458. dbesc(datetime_convert()),
  459. intval(local_user())
  460. );
  461. }
  462. if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
  463. // Update global directory in background
  464. $url = $_SESSION['my_url'];
  465. if($url && strlen(get_config('system','directory_submit_url')))
  466. proc_run('php',"include/directory.php","$url");
  467. }
  468. require_once('include/profile_update.php');
  469. profile_change();
  470. //$_SESSION['theme'] = $theme;
  471. if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
  472. // FIXME - set to un-verified, blocked and redirect to logout
  473. // Why? Are we verifying people or email addresses?
  474. }
  475. goaway($a->get_baseurl(true) . '/settings' );
  476. return; // NOTREACHED
  477. }
  478. if(! function_exists('settings_content')) {
  479. function settings_content(&$a) {
  480. $o = '';
  481. nav_set_selected('settings');
  482. if(! local_user()) {
  483. notice( t('Permission denied.') . EOL );
  484. return;
  485. }
  486. if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
  487. notice( t('Permission denied.') . EOL );
  488. return;
  489. }
  490. if(($a->argc > 1) && ($a->argv[1] === 'oauth')) {
  491. if(($a->argc > 2) && ($a->argv[2] === 'add')) {
  492. $tpl = get_markup_template("settings_oauth_edit.tpl");
  493. $o .= replace_macros($tpl, array(
  494. '$form_security_token' => get_form_security_token("settings_oauth"),
  495. '$title' => t('Add application'),
  496. '$submit' => t('Submit'),
  497. '$cancel' => t('Cancel'),
  498. '$name' => array('name', t('Name'), '', ''),
  499. '$key' => array('key', t('Consumer Key'), '', ''),
  500. '$secret' => array('secret', t('Consumer Secret'), '', ''),
  501. '$redirect' => array('redirect', t('Redirect'), '', ''),
  502. '$icon' => array('icon', t('Icon url'), '', ''),
  503. ));
  504. return $o;
  505. }
  506. if(($a->argc > 3) && ($a->argv[2] === 'edit')) {
  507. $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d",
  508. dbesc($a->argv[3]),
  509. local_user());
  510. if (!count($r)){
  511. notice(t("You can't edit this application."));
  512. return;
  513. }
  514. $app = $r[0];
  515. $tpl = get_markup_template("settings_oauth_edit.tpl");
  516. $o .= replace_macros($tpl, array(
  517. '$form_security_token' => get_form_security_token("settings_oauth"),
  518. '$title' => t('Add application'),
  519. '$submit' => t('Update'),
  520. '$cancel' => t('Cancel'),
  521. '$name' => array('name', t('Name'), $app['name'] , ''),
  522. '$key' => array('key', t('Consumer Key'), $app['client_id'], ''),
  523. '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''),
  524. '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''),
  525. '$icon' => array('icon', t('Icon url'), $app['icon'], ''),
  526. ));
  527. return $o;
  528. }
  529. if(($a->argc > 3) && ($a->argv[2] === 'delete')) {
  530. check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
  531. $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
  532. dbesc($a->argv[3]),
  533. local_user());
  534. goaway($a->get_baseurl(true)."/settings/oauth/");
  535. return;
  536. }
  537. $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my
  538. FROM clients
  539. LEFT JOIN tokens ON clients.client_id=tokens.client_id
  540. WHERE clients.uid IN (%d,0)",
  541. local_user(),
  542. local_user());
  543. $tpl = get_markup_template("settings_oauth.tpl");
  544. $o .= replace_macros($tpl, array(
  545. '$form_security_token' => get_form_security_token("settings_oauth"),
  546. '$baseurl' => $a->get_baseurl(true),
  547. '$title' => t('Connected Apps'),
  548. '$add' => t('Add application'),
  549. '$edit' => t('Edit'),
  550. '$delete' => t('Delete'),
  551. '$consumerkey' => t('Client key starts with'),
  552. '$noname' => t('No name'),
  553. '$remove' => t('Remove authorization'),
  554. '$apps' => $r,
  555. ));
  556. return $o;
  557. }
  558. if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
  559. $settings_addons = "";
  560. $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
  561. if(! count($r))
  562. $settings_addons = t('No Plugin settings configured');
  563. call_hooks('plugin_settings', $settings_addons);
  564. $tpl = get_markup_template("settings_addons.tpl");
  565. $o .= replace_macros($tpl, array(
  566. '$form_security_token' => get_form_security_token("settings_addon"),
  567. '$title' => t('Plugin Settings'),
  568. '$settings_addons' => $settings_addons
  569. ));
  570. return $o;
  571. }
  572. if(($a->argc > 1) && ($a->argv[1] === 'features')) {
  573. $arr = array();
  574. $features = get_features();
  575. foreach($features as $fname => $fdata) {
  576. $arr[$fname] = array();
  577. $arr[$fname][0] = $fdata[0];
  578. foreach(array_slice($fdata,1) as $f) {
  579. $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
  580. }
  581. }
  582. $tpl = get_markup_template("settings_features.tpl");
  583. $o .= replace_macros($tpl, array(
  584. '$form_security_token' => get_form_security_token("settings_features"),
  585. '$title' => t('Additional Features'),
  586. '$features' => $arr,
  587. '$submit' => t('Submit'),
  588. ));
  589. return $o;
  590. }
  591. if(($a->argc > 1) && ($a->argv[1] === 'connectors')) {
  592. $settings_connectors = "";
  593. call_hooks('connector_settings', $settings_connectors);
  594. $diasp_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('Diaspora'), ((get_config('system','diaspora_enabled')) ? t('enabled') : t('disabled')));
  595. $ostat_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('StatusNet'), ((get_config('system','ostatus_disabled')) ? t('disabled') : t('enabled')));
  596. $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
  597. if(get_config('system','dfrn_only'))
  598. $mail_disabled = 1;
  599. if(! $mail_disabled) {
  600. $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
  601. local_user()
  602. );
  603. }
  604. else {
  605. $r = null;
  606. }
  607. $mail_server = ((count($r)) ? $r[0]['server'] : '');
  608. $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
  609. $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
  610. $mail_user = ((count($r)) ? $r[0]['user'] : '');
  611. $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
  612. $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
  613. $mail_action = ((count($r)) ? $r[0]['action'] : 0);
  614. $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
  615. $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
  616. $tpl = get_markup_template("settings_connectors.tpl");
  617. if(! service_class_allows(local_user(),'email_connect')) {
  618. $mail_disabled_message = upgrade_bool_message();
  619. }
  620. else {
  621. $mail_disabled_message = (($mail_disabled) ? t('Email access is disabled on this site.') : '');
  622. }
  623. $o .= replace_macros($tpl, array(
  624. '$form_security_token' => get_form_security_token("settings_connectors"),
  625. '$title' => t('Connector Settings'),
  626. '$diasp_enabled' => $diasp_enabled,
  627. '$ostat_enabled' => $ostat_enabled,
  628. '$h_imap' => t('Email/Mailbox Setup'),
  629. '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
  630. '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''),
  631. '$mail_disabled' => $mail_disabled_message,
  632. '$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''),
  633. '$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''),
  634. '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( 'notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')),
  635. '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''),
  636. '$mail_pass' => array('mail_pass', t('Email password:'), '', ''),
  637. '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'),
  638. '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
  639. '$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'))),
  640. '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
  641. '$submit' => t('Submit'),
  642. '$settings_connectors' => $settings_connectors
  643. ));
  644. call_hooks('display_settings', $o);
  645. return $o;
  646. }
  647. /*
  648. * DISPLAY SETTINGS
  649. */
  650. if(($a->argc > 1) && ($a->argv[1] === 'display')) {
  651. $default_theme = get_config('system','theme');
  652. if(! $default_theme)
  653. $default_theme = 'default';
  654. $default_mobile_theme = get_config('system','mobile-theme');
  655. if(! $mobile_default_theme)
  656. $mobile_default_theme = 'none';
  657. $allowed_themes_str = get_config('system','allowed_themes');
  658. $allowed_themes_raw = explode(',',$allowed_themes_str);
  659. $allowed_themes = array();
  660. if(count($allowed_themes_raw))
  661. foreach($allowed_themes_raw as $x)
  662. if(strlen(trim($x)) && is_dir("view/theme/$x"))
  663. $allowed_themes[] = trim($x);
  664. $themes = array();
  665. $mobile_themes = array("---" => t('No special theme for mobile devices'));
  666. $files = glob('view/theme/*');
  667. if($allowed_themes) {
  668. foreach($allowed_themes as $th) {
  669. $f = $th;
  670. $is_experimental = file_exists('view/theme/' . $th . '/experimental');
  671. $unsupported = file_exists('view/theme/' . $th . '/unsupported');
  672. $is_mobile = file_exists('view/theme/' . $th . '/mobile');
  673. if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
  674. $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
  675. if($is_mobile) {
  676. $mobile_themes[$f]=$theme_name;
  677. }
  678. else {
  679. $themes[$f]=$theme_name;
  680. }
  681. }
  682. }
  683. }
  684. $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
  685. $mobile_theme_selected = (!x($_SESSION,'mobile-theme')? $default_mobile_theme : $_SESSION['mobile-theme']);
  686. $browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
  687. $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
  688. $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network'));
  689. $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
  690. $itemspage_mobile_network = intval(get_pconfig(local_user(), 'system','itemspage_mobile_network'));
  691. $itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
  692. $nosmile = get_pconfig(local_user(),'system','no_smilies');
  693. $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
  694. $infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll');
  695. $infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0
  696. $theme_config = "";
  697. if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){
  698. require_once($themeconfigfile);
  699. $theme_config = theme_content($a);
  700. }
  701. $tpl = get_markup_template("settings_display.tpl");
  702. $o = replace_macros($tpl, array(
  703. '$ptitle' => t('Display Settings'),
  704. '$form_security_token' => get_form_security_token("settings_display"),
  705. '$submit' => t('Submit'),
  706. '$baseurl' => $a->get_baseurl(true),
  707. '$uid' => local_user(),
  708. '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes, true),
  709. '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false),
  710. '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
  711. '$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')),
  712. '$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')),
  713. '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
  714. '$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
  715. '$theme_config' => $theme_config,
  716. ));
  717. $tpl = get_markup_template("settings_display_end.tpl");
  718. $a->page['end'] .= replace_macros($tpl, array(
  719. '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes)
  720. ));
  721. return $o;
  722. }
  723. /*
  724. * ACCOUNT SETTINGS
  725. */
  726. require_once('include/acl_selectors.php');
  727. $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
  728. intval(local_user())
  729. );
  730. if(count($p))
  731. $profile = $p[0];
  732. $username = $a->user['username'];
  733. $email = $a->user['email'];
  734. $nickname = $a->user['nickname'];
  735. $timezone = $a->user['timezone'];
  736. $notify = $a->user['notify-flags'];
  737. $defloc = $a->user['default-location'];
  738. $openid = $a->user['openid'];
  739. $maxreq = $a->user['maxreq'];
  740. $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
  741. $blockwall = $a->user['blockwall'];
  742. $blocktags = $a->user['blocktags'];
  743. $unkmail = $a->user['unkmail'];
  744. $cntunkmail = $a->user['cntunkmail'];
  745. $expire_items = get_pconfig(local_user(), 'expire','items');
  746. $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1
  747. $expire_notes = get_pconfig(local_user(), 'expire','notes');
  748. $expire_notes = (($expire_notes===false)? '1' : $expire_notes); // default if not set: 1
  749. $expire_starred = get_pconfig(local_user(), 'expire','starred');
  750. $expire_starred = (($expire_starred===false)? '1' : $expire_starred); // default if not set: 1
  751. $expire_photos = get_pconfig(local_user(), 'expire','photos');
  752. $expire_photos = (($expire_photos===false)? '0' : $expire_photos); // default if not set: 0
  753. $expire_network_only = get_pconfig(local_user(), 'expire','network_only');
  754. $expire_network_only = (($expire_network_only===false)? '0' : $expire_network_only); // default if not set: 0
  755. $suggestme = get_pconfig(local_user(), 'system','suggestme');
  756. $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0
  757. $post_newfriend = get_pconfig(local_user(), 'system','post_newfriend');
  758. $post_newfriend = (($post_newfriend===false)? '0': $post_newfriend); // default if not set: 0
  759. $post_joingroup = get_pconfig(local_user(), 'system','post_joingroup');
  760. $post_joingroup = (($post_joingroup===false)? '0': $post_joingroup); // default if not set: 0
  761. $post_profilechange = get_pconfig(local_user(), 'system','post_profilechange');
  762. $post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0
  763. if(! strlen($a->user['timezone']))
  764. $timezone = date_default_timezone_get();
  765. $pageset_tpl = get_markup_template('pagetypes.tpl');
  766. $pagetype = replace_macros($pageset_tpl, array(
  767. '$page_normal' => array('page-flags', t('Normal Account Page'), PAGE_NORMAL,
  768. t('This account is a normal personal profile'),
  769. ($a->user['page-flags'] == PAGE_NORMAL)),
  770. '$page_soapbox' => array('page-flags', t('Soapbox Page'), PAGE_SOAPBOX,
  771. t('Automatically approve all connection/friend requests as read-only fans'),
  772. ($a->user['page-flags'] == PAGE_SOAPBOX)),
  773. '$page_community' => array('page-flags', t('Community Forum/Celebrity Account'), PAGE_COMMUNITY,
  774. t('Automatically approve all connection/friend requests as read-write fans'),
  775. ($a->user['page-flags'] == PAGE_COMMUNITY)),
  776. '$page_freelove' => array('page-flags', t('Automatic Friend Page'), PAGE_FREELOVE,
  777. t('Automatically approve all connection/friend requests as friends'),
  778. ($a->user['page-flags'] == PAGE_FREELOVE)),
  779. '$page_prvgroup' => array('page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP,
  780. t('Private forum - approved members only'),
  781. ($a->user['page-flags'] == PAGE_PRVGROUP)),
  782. ));
  783. $noid = get_config('system','no_openid');
  784. if($noid) {
  785. $openid_field = false;
  786. }
  787. else {
  788. $openid_field = array('openid_url', t('OpenID:'),$openid, t("\x28Optional\x29 Allow this OpenID to login to this account."));
  789. }
  790. $opt_tpl = get_markup_template("field_yesno.tpl");
  791. if(get_config('system','publish_all')) {
  792. $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
  793. }
  794. else {
  795. $profile_in_dir = replace_macros($opt_tpl,array(
  796. '$field' => array('profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], '', array(t('No'),t('Yes'))),
  797. ));
  798. }
  799. if(strlen(get_config('system','directory_submit_url'))) {
  800. $profile_in_net_dir = replace_macros($opt_tpl,array(
  801. '$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
  802. ));
  803. }
  804. else
  805. $profile_in_net_dir = '';
  806. $hide_friends = replace_macros($opt_tpl,array(
  807. '$field' => array('hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', array(t('No'),t('Yes'))),
  808. ));
  809. $hide_wall = replace_macros($opt_tpl,array(
  810. '$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))),
  811. ));
  812. $blockwall = replace_macros($opt_tpl,array(
  813. '$field' => array('blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
  814. ));
  815. $blocktags = replace_macros($opt_tpl,array(
  816. '$field' => array('blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
  817. ));
  818. $suggestme = replace_macros($opt_tpl,array(
  819. '$field' => array('suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', array(t('No'),t('Yes'))),
  820. ));
  821. $unkmail = replace_macros($opt_tpl,array(
  822. '$field' => array('unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', array(t('No'),t('Yes'))),
  823. ));
  824. $invisible = (((! $profile['publish']) && (! $profile['net-publish']))
  825. ? true : false);
  826. if($invisible)
  827. info( t('Profile is <strong>not published</strong>.') . EOL );
  828. $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : '');
  829. $tpl_addr = get_markup_template("settings_nick_set.tpl");
  830. $prof_addr = replace_macros($tpl_addr,array(
  831. '$desc' => t('Your Identity Address is'),
  832. '$nickname' => $nickname,
  833. '$subdir' => $subdir,
  834. '$basepath' => $a->get_hostname()
  835. ));
  836. $stpl = get_markup_template('settings.tpl');
  837. $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
  838. $expire_arr = array(
  839. 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
  840. 'advanced' => t('Advanced expiration settings'),
  841. 'label' => t('Advanced Expiration'),
  842. 'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
  843. 'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'),t('Yes'))),
  844. 'starred' => array('expire_starred', t("Expire starred posts:"), $expire_starred, '', array(t('No'),t('Yes'))),
  845. 'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'),t('Yes'))),
  846. 'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'),t('Yes'))),
  847. );
  848. require_once('include/group.php');
  849. $group_select = mini_group_select(local_user(),$a->user['def_gid']);
  850. // Private/public post links for the non-JS ACL form
  851. $private_post = 1;
  852. if($_REQUEST['public'])
  853. $private_post = 0;
  854. $query_str = $a->query_string;
  855. if(strpos($query_str, 'public=1') !== false)
  856. $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
  857. // I think $a->query_string may never have ? in it, but I could be wrong
  858. // It looks like it's from the index.php?q=[etc] rewrite that the web
  859. // server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
  860. if(strpos($query_str, '?') === false)
  861. $public_post_link = '?public=1';
  862. else
  863. $public_post_link = '&public=1';
  864. $o .= replace_macros($stpl, array(
  865. '$ptitle' => t('Account Settings'),
  866. '$submit' => t('Submit'),
  867. '$baseurl' => $a->get_baseurl(true),
  868. '$uid' => local_user(),
  869. '$form_security_token' => get_form_security_token("settings"),
  870. '$nickname_block' => $prof_addr,
  871. '$h_pass' => t('Password Settings'),
  872. '$password1'=> array('npassword', t('New Password:'), '', ''),
  873. '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
  874. '$password3'=> array('opassword', t('Current Password:'), '', t('Your current password to confirm the changes')),
  875. '$password4'=> array('password', t('Password:'), '', t('Your current password to confirm the changes')),
  876. '$oid_enable' => (! get_config('system','no_openid')),
  877. '$openid' => $openid_field,
  878. '$h_basic' => t('Basic Settings'),
  879. '$username' => array('username', t('Full Name:'), $username,''),
  880. '$email' => array('email', t('Email Address:'), $email, ''),
  881. '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''),
  882. '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''),
  883. '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''),
  884. '$h_prv' => t('Security and Privacy Settings'),
  885. '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), $maxreq ,t("\x28to prevent spam abuse\x29")),
  886. '$permissions' => t('Default Post Permissions'),
  887. '$permdesc' => t("\x28click to open/close\x29"),
  888. '$visibility' => $profile['net-publish'],
  889. '$aclselect' => populate_acl($a->user,$celeb),
  890. '$suggestme' => $suggestme,
  891. '$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''),
  892. '$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''),
  893. // ACL permissions box
  894. '$acl_data' => construct_acl_data($a, $a->user), // For non-Javascript ACL selector
  895. '$group_perms' => t('Show to Groups'),
  896. '$contact_perms' => t('Show to Contacts'),
  897. '$private' => t('Default Private Post'),
  898. '$public' => t('Default Public Post'),
  899. '$is_private' => $private_post,
  900. '$return_path' => $query_str,
  901. '$public_link' => $public_post_link,
  902. '$settings_perms' => t('Default Permissions for New Posts'),
  903. '$group_select' => $group_select,
  904. '$expire' => $expire_arr,
  905. '$profile_in_dir' => $profile_in_dir,
  906. '$profile_in_net_dir' => $profile_in_net_dir,
  907. '$hide_friends' => $hide_friends,
  908. '$hide_wall' => $hide_wall,
  909. '$unkmail' => $unkmail,
  910. '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail ,t("\x28to prevent spam abuse\x29")),
  911. '$h_not' => t('Notification Settings'),
  912. '$activity_options' => t('By default post a status message when:'),
  913. '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, ''),
  914. '$post_joingroup' => array('post_joingroup', t('joining a forum/community'), $post_joingroup, ''),
  915. '$post_profilechange' => array('post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, ''),
  916. '$lbl_not' => t('Send a notification email when:'),
  917. '$notify1' => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''),
  918. '$notify2' => array('notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''),
  919. '$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''),
  920. '$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
  921. '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
  922. '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
  923. '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
  924. '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
  925. '$h_advn' => t('Advanced Account/Page Type Settings'),
  926. '$h_descadvn' => t('Change the behaviour of this account for special situations'),
  927. '$pagetype' => $pagetype,
  928. ));
  929. call_hooks('settings_form',$o);
  930. $o .= '</form>' . "\r\n";
  931. return $o;
  932. }}