File: filterprefs.php

package info (click to toggle)
imp4 4.1.3-4
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 14,988 kB
  • ctags: 3,720
  • sloc: xml: 17,038; php: 16,350; makefile: 64
file content (70 lines) | stat: -rw-r--r-- 2,451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
 * $Horde: imp/filterprefs.php,v 2.16.10.5 2006/02/04 19:02:04 slusarz Exp $
 *
 * Copyright 2003-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

@define('IMP_BASE', dirname(__FILE__));
$authentication = OP_HALFOPEN;
require_once IMP_BASE . '/lib/base.php';
require_once 'Horde/Prefs/UI.php';
require IMP_BASE . '/config/prefs.php';

/* Are preferences locked? */
$login_locked = $prefs->isLocked('filter_on_login') || empty($_SESSION['imp']['filteravail']);
$display_locked = $prefs->isLocked('filter_on_display') || empty($_SESSION['imp']['filteravail']);
$anymailbox_locked = $prefs->isLocked('filter_any_mailbox') || empty($_SESSION['imp']['filteravail']);
$menuitem_locked = $prefs->isLocked('filter_menuitem');

/* Run through the action handlers. */
$actionID = Util::getFormData('actionID');
switch ($actionID) {
case 'update_prefs':
    if (!$login_locked) {
        $prefs->setValue('filter_on_login', Util::getFormData('filter_login'));
    }
    if (!$display_locked) {
        $prefs->setValue('filter_on_display', Util::getFormData('filter_display'));
    }
    if (!$anymailbox_locked) {
        $prefs->setValue('filter_any_mailbox', Util::getFormData('filter_any_mailbox'));
    }
    if (!$menuitem_locked) {
        $prefs->setValue('filter_menuitem', Util::getFormData('filter_menuitem'));
    }
    $notification->push(_("Preferences successfully updated."), 'horde.success');
    break;
}

/* Get filter links. */
if ($registry->hasMethod('mail/showBlacklist')) {
    $blacklist_link = $registry->link('mail/showBlacklist');
}
if ($registry->hasMethod('mail/showWhitelist')) {
    $whitelist_link = $registry->link('mail/showWhitelist');
}
if ($registry->hasMethod('mail/showFilters')) {
    $filters_link = $registry->link('mail/showFilters');
}

/* Show the header. */
require_once 'Horde/Prefs/UI.php';
require IMP_BASE . '/config/prefs.php';
$app = 'imp';
$group = 'filters';

Prefs_UI::generateHeader();

/* If filters are disabled. */
if (empty($blacklist_link) && empty($whitelist_link) && empty($filters_link)) {
    require IMP_TEMPLATES . '/filters/notactive.inc';
} else {
    $selfURL = Horde::applicationUrl('filterprefs.php');
    require IMP_TEMPLATES . '/filters/prefs.inc';
}

require $registry->get('templates', 'horde') . '/common-footer.inc';