File: fetchmail.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 (61 lines) | stat: -rw-r--r-- 1,997 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
<?php
/**
 * $Horde: imp/fetchmail.php,v 1.40.8.4 2006/01/01 21:28:50 jan Exp $
 *
 * Copyright 2002-2006 Nuno Loureiro <nuno@co.sapo.pt>
 * Copyright 2004-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__));
require_once IMP_BASE . '/lib/base.php';
require_once IMP_BASE . '/lib/Fetchmail.php';
require_once 'Horde/Prefs/UI.php';

/* Initialize Fetchmail libraries. */
$fm_account = &new IMP_Fetchmail_Account();

/* Run through the action handlers. */
$actionID = Util::getFormData('actionID');
switch ($actionID) {
case 'fetchmail_fetch':
    $fetch_list = Util::getFormData('accounts');
    if (!empty($fetch_list)) {
        IMP_Fetchmail::fetchMail($fetch_list);

        /* Go to the download folder. */
        $lmailbox = $fm_account->getValue('lmailbox', $fetch_list[0]);
        $url = Util::addParameter(Horde::applicationUrl('mailbox.php'), 'mailbox', $lmailbox);
        if ($prefs->getValue('fetchmail_popup')) {
            Util::closeWindowJS('opener.focus();opener.location.href="' . $url . '";');
        } else {
            header('Location: ' . $url);
        }
        exit;
    }
    break;
}

$accounts = $fm_account->getAll('id');
$fetch_url = Horde::applicationUrl('fetchmail.php');
$title = _("Other Mail Accounts");

require IMP_TEMPLATES . '/common-header.inc';

if ($prefs->getValue('fetchmail_popup')) {
    $cancel_js = 'window.close();';
} else {
    require IMP_TEMPLATES . '/menu.inc';

    if (!Util::getFormData('lmailbox')) {
        $mbox = 'INBOX';
    } else {
        $mbox = Util::getFormData('lmailbox');
    }
    $cancel_js = 'window.location = \'' . Util::addParameter(Horde::applicationUrl('mailbox.php'), 'mailbox', $mbox) . '\';';
}

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