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