Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

76 líneas
2.3KB

  1. <?php
  2. /**
  3. * View for user import
  4. */
  5. require_once("include/uimport.php");
  6. function uimport_post(App $a) {
  7. switch ($a->config['register_policy']) {
  8. case REGISTER_OPEN:
  9. $blocked = 0;
  10. $verified = 1;
  11. break;
  12. case REGISTER_APPROVE:
  13. $blocked = 1;
  14. $verified = 0;
  15. break;
  16. default:
  17. case REGISTER_CLOSED:
  18. if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {
  19. notice(t('Permission denied.') . EOL);
  20. return;
  21. }
  22. $blocked = 1;
  23. $verified = 0;
  24. break;
  25. }
  26. if (x($_FILES, 'accountfile')) {
  27. /// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE
  28. import_account($a, $_FILES['accountfile']);
  29. return;
  30. }
  31. }
  32. function uimport_content(App $a) {
  33. if ((!local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
  34. notice("Permission denied." . EOL);
  35. return;
  36. }
  37. $max_dailies = intval(get_config('system', 'max_daily_registrations'));
  38. if ($max_dailies) {
  39. $r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
  40. if ($r && $r[0]['total'] >= $max_dailies) {
  41. logger('max daily registrations exceeded.');
  42. notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
  43. return;
  44. }
  45. }
  46. if (x($_SESSION, 'theme')) {
  47. unset($_SESSION['theme']);
  48. }
  49. if (x($_SESSION, 'mobile-theme')) {
  50. unset($_SESSION['mobile-theme']);
  51. }
  52. $tpl = get_markup_template("uimport.tpl");
  53. return replace_macros($tpl, array(
  54. '$regbutt' => t('Import'),
  55. '$import' => array(
  56. 'title' => t("Move account"),
  57. 'intro' => t("You can import an account from another Friendica server."),
  58. 'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
  59. 'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),
  60. 'field' => array('accountfile', t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),
  61. ),
  62. ));
  63. }