take.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * take.php
  4. *
  5. * Copyright (c) 1999-2004 The SquirrelMail Project Team
  6. * Licensed under the GNU GPL. For full terms see the file COPYING.
  7. *
  8. * Address Take -- steals addresses from incoming email messages. Searches
  9. * the To, Cc, From and Reply-To headers.
  10. *
  11. * $Id$
  12. * @package plugins
  13. * @subpackage abook_take
  14. */
  15. /**
  16. * Path for SquirrelMail required files.
  17. * @ignore */
  18. define('SM_PATH','../../');
  19. /* SquirrelMail required files. */
  20. require_once(SM_PATH . 'include/validate.php');
  21. require_once(SM_PATH . 'functions/strings.php');
  22. require_once(SM_PATH . 'config/config.php');
  23. require_once(SM_PATH . 'functions/i18n.php');
  24. require_once(SM_PATH . 'functions/page_header.php');
  25. require_once(SM_PATH . 'functions/addressbook.php');
  26. require_once(SM_PATH . 'include/load_prefs.php');
  27. require_once(SM_PATH . 'functions/html.php');
  28. require_once(SM_PATH . 'functions/forms.php');
  29. displayPageHeader($color, 'None');
  30. /* input form data */
  31. sqgetGlobalVar('email', $email, SQ_POST);
  32. $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify');
  33. $abook = addressbook_init(false, true);
  34. $name = 'addaddr';
  35. $addrs = array();
  36. foreach ($email as $Val) {
  37. if (valid_email($Val, $abook_take_verify)) {
  38. $addrs[$Val] = $Val;
  39. } else {
  40. $addrs[$Val] = 'FAIL - ' . $Val;
  41. }
  42. }
  43. echo addForm(SM_PATH . 'src/addressbook.php', 'POST', 'f_add') . "\n" .
  44. html_tag( 'table',
  45. html_tag( 'tr',
  46. html_tag( 'th', sprintf(_("Add to %s"), $abook->localbackendname), 'center', $color[0] )
  47. ) ,
  48. 'center', '', 'width="100%"' ) . "\n" .
  49. html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"' ) . "\n" .
  50. html_tag( 'tr', "\n" .
  51. html_tag( 'td', _("Nickname") . ':', 'right', $color[4], 'width="50"' ) . "\n" .
  52. html_tag( 'td', addInput($name . '[nickname]', '', 15) .
  53. '&nbsp;<small>' . _("Must be unique") . '</small>',
  54. 'left', $color[4] )
  55. ) . "\n" .
  56. html_tag( 'tr' ) . "\n" .
  57. html_tag( 'td', _("E-mail address") . ':', 'right', $color[4], 'width="50"' ) . "\n" .
  58. html_tag( 'td', '', 'left', $color[4] ) . "\n" .
  59. addSelect($name . '[email]', $addrs, null, true) .
  60. '</td></tr>' . "\n";
  61. if ($squirrelmail_language == 'ja_JP') {
  62. echo html_tag( 'tr', "\n" .
  63. html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) .
  64. html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] )
  65. ) . "\n" .
  66. html_tag( 'tr', "\n" .
  67. html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) .
  68. html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] )
  69. ) . "\n";
  70. } else {
  71. echo html_tag( 'tr', "\n" .
  72. html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) .
  73. html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] )
  74. ) . "\n" .
  75. html_tag( 'tr', "\n" .
  76. html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) .
  77. html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] )
  78. ) . "\n";
  79. }
  80. echo html_tag( 'tr', "\n" .
  81. html_tag( 'td', _("Additional info") . ':', 'right', $color[4], 'width="50"' ) .
  82. html_tag( 'td', addInput($name . '[label]', '', 45), 'left', $color[4] )
  83. ) . "\n" .
  84. html_tag( 'tr', "\n" .
  85. html_tag( 'td',
  86. addSubmit(_("Add address"), $name . '[SUBMIT]'),
  87. 'center', $color[4], 'colspan="2"' )
  88. ) . "\n";
  89. ?>
  90. </table>
  91. </form></body>
  92. </html>