File: prefs.php

package info (click to toggle)
turba2 2.1.3-1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 5,740 kB
  • ctags: 1,497
  • sloc: php: 6,641; xml: 998; sql: 180; makefile: 63; sh: 46; perl: 17
file content (69 lines) | stat: -rw-r--r-- 1,921 bytes parent folder | download | duplicates (2)
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
<?php
/**
 * $Horde: turba/lib/prefs.php,v 1.2.10.5 2006/01/01 21:29:16 jan Exp $
 *
 * Copyright 2001-2006 Jon Parise <jon@horde.org>
 * Copyright 2002-2006 Jan Schneider <jan@horde.org>
 *
 * See the enclosed file LICENSE for license information (ASL).  If you
 * did not receive this file, see http://www.horde.org/licenses/asl.php.
 */

function handle_columnselect($updated)
{
    $columns = Util::getFormData('columns');
    if (!empty($columns)) {
        $GLOBALS['prefs']->setValue('columns', $columns);
        return true;
    }

    return false;
}

function handle_addressbookselect($updated)
{
    $addressbooks = Util::getFormData('addressbooks');
    if (!empty($addressbooks)) {
        $GLOBALS['prefs']->setValue('addressbooks', $addressbooks);
        return true;
    }

    return false;
}

function handle_imsp_opt($updated)
{
    global $cfgSources;
    $name = Util::getFormData('imsp_books_delete');
    if ($name != 'none') {
        require_once 'Net/IMSP/Utils.php';
        $result = Net_IMSP_Utils::deleteBook($cfgSources[$name]);
        if (is_a($result, 'PEAR_Error')) {
            return false;
        }
    }
    $name = Util::getFormData('imsp_name');
    if ($name != '') {
        // Get user's default IMSP $cfgSource entry
        foreach ($cfgSources as $key => $params) {
            if ($params['type'] == 'imsp' && $params['params']['is_root']) {
                $default = $key;
                break;
            }
        }
        require_once 'Net/IMSP/Utils.php';
        $result = Net_IMSP_Utils::createBook($cfgSources[$default], $name);
        if (is_a($result, 'PEAR_Error')) {
            return false;
        }
    }
    return true;
}

/* Assign variables for select lists. */
if (!$prefs->isLocked('default_dir')) {
    $default_dir_options = array();
    foreach ($cfgSources as $key => $info) {
        $default_dir_options[$key] = $info['title'];
    }
}