take.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. ** take.php
  4. **
  5. ** Adds a "taken" address to the address book. Takes addresses from
  6. ** incoming mail -- the body, To, From, Cc, or Reply-To.
  7. **/
  8. chdir('..');
  9. require_once('../src/validate.php');
  10. require_once("../functions/strings.php");
  11. require_once("../config/config.php");
  12. require_once("../functions/i18n.php");
  13. require_once("../functions/page_header.php");
  14. require_once("../functions/addressbook.php");
  15. require_once("../src/load_prefs.php");
  16. require_once('../functions/html.php');
  17. displayPageHeader($color, "None");
  18. $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify');
  19. $abook = addressbook_init(false, true);
  20. $name = 'addaddr';
  21. echo '<form action="../../src/addressbook.php" name="f_add" method="post">' ."\n" .
  22. html_tag( 'table',
  23. html_tag( 'tr',
  24. html_tag( 'th', sprintf(_("Add to %s"), $abook->localbackendname), 'center', $color[0] )
  25. ) ,
  26. 'center', '', 'width="100%" cols="1"' ) .
  27. html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"' ) . "\n" .
  28. html_tag( 'tr', "\n" .
  29. html_tag( 'td', _("Nickname") . ':', 'right', $color[4], 'width="50"' ) . "\n" .
  30. html_tag( 'td', '<input name="' . $name . '[nickname]" size="15" value="">' .
  31. '&nbsp;<small>' . _("Must be unique") . '</small>',
  32. 'left', $color[4] )
  33. ) . "\n" .
  34. html_tag( 'tr' ) . "\n" .
  35. html_tag( 'td', _("E-mail address") . ':', 'right', $color[4], 'width="50"' ) . "\n" .
  36. html_tag( 'td', '', 'left', $color[4] ) .
  37. '<select name="' . $name . "[email]\">\n";
  38. foreach ($email as $Val)
  39. {
  40. if (valid_email($Val, $abook_take_verify))
  41. {
  42. echo '<option value="' . htmlspecialchars($Val) .
  43. '">' . htmlspecialchars($Val) . "</option>\n";
  44. }
  45. else
  46. {
  47. echo '<option value="' . htmlspecialchars($Val) .
  48. '">FAIL - ' . htmlspecialchars($Val) . "</option>\n";
  49. }
  50. }
  51. echo '</select></td></tr>' . "\n" .
  52. html_tag( 'tr', "\n" .
  53. html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) .
  54. html_tag( 'td', '<input name="' . $name . '[firstname]" size="45" value="">', 'left', $color[4] )
  55. ) . "\n" .
  56. html_tag( 'tr', "\n" .
  57. html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) .
  58. html_tag( 'td', '<input name="' . $name . '[lastname]" size="45" value="">', 'left', $color[4] )
  59. ) . "\n" .
  60. html_tag( 'tr', "\n" .
  61. html_tag( 'td', _("Additional info") . ':', 'right', $color[4], 'width="50"' ) .
  62. html_tag( 'td', '<input name="' . $name . '[label]" size="45" value="">', 'left', $color[4] )
  63. ) . "\n" .
  64. html_tag( 'tr', "\n" .
  65. html_tag( 'td',
  66. '<input type="submit" name="' . $name . '[SUBMIT]" size="45" value="'. _("Add address") .'">' ,
  67. 'center', $color[4], 'colspan="2"' )
  68. ) . "\n" .
  69. '</table>';
  70. ?>
  71. </form></body>
  72. </html>