options.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * SquirrelMail List Commands Plugin
  4. * options.php
  5. *
  6. * Shows options page for managing non-RFC-compliant list subscriptions.
  7. *
  8. * @copyright 1999-2025 The SquirrelMail Project Team
  9. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10. * @version $Id$
  11. * @package plugins
  12. * @subpackage listcommands
  13. */
  14. include_once('../../include/init.php');
  15. include_once(SM_PATH . 'plugins/listcommands/functions.php');
  16. global $listcommands_allow_non_rfc_list_management, $data_dir, $username;
  17. // only allow management of non-RFC lists if admin deems necessary
  18. //
  19. @include_once(SM_PATH . 'plugins/listcommands/config.php');
  20. if (!$listcommands_allow_non_rfc_list_management)
  21. return;
  22. $lists = get_non_rfc_lists();
  23. // remove list?
  24. //
  25. if (sqGetGlobalVar('deletelist', $deletelist, SQ_FORM)
  26. && is_array($deletelist) && !empty($deletelist)) {
  27. // interface currently does not support multiple deletions at once
  28. // but we'll support it here anyway -- the index values of this
  29. // array are the only thing we care about and need to be the
  30. // index number of the list to be deleted
  31. //
  32. foreach (array_keys($deletelist) as $index)
  33. unset($lists[$index]);
  34. sort($lists);
  35. $temp_lists = array();
  36. foreach ($lists as $index => $list_addr)
  37. $temp_lists[] = $index . '_' . $list_addr;
  38. setPref($data_dir, $username, 'non_rfc_lists', implode(':', $temp_lists));
  39. }
  40. // add list?
  41. //
  42. if (sqGetGlobalVar('addlist', $ignore, SQ_FORM)
  43. && sqGetGlobalVar('newlist', $newlist, SQ_FORM)) {
  44. $lists[] = $newlist;
  45. sort($lists);
  46. $temp_lists = array();
  47. foreach ($lists as $index => $list_addr)
  48. $temp_lists[] = $index . '_' . $list_addr;
  49. setPref($data_dir, $username, 'non_rfc_lists', implode(':', $temp_lists));
  50. }
  51. displayPageHeader($color);
  52. $oTemplate->assign('lists', $lists);
  53. $oTemplate->display('plugins/listcommands/non_rfc_lists.tpl');
  54. $oTemplate->display('footer.tpl');