[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 /** 3 * $Horde: imp/fetchmailprefs.php,v 1.39.4.4 2007/01/02 13:54:54 jan Exp $ 4 * 5 * Copyright 2002-2007 Nuno Loureiro <nuno@co.sapo.pt> 6 * Copyright 2004-2007 Michael Slusarz <slusarz@bigworm.colorado.edu> 7 * 8 * See the enclosed file COPYING for license information (GPL). If you 9 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. 10 */ 11 12 @define('IMP_BASE', dirname(__FILE__)); 13 $authentication = OP_HALFOPEN; 14 require_once IMP_BASE . '/lib/base.php'; 15 require_once IMP_BASE . '/lib/Fetchmail.php'; 16 17 /* Initialize Fetchmail libraries. */ 18 $fm_account = &new IMP_Fetchmail_Account(); 19 20 $driver = Util::getFormData('fm_driver'); 21 $fetch_url = Horde::applicationUrl('fetchmailprefs.php'); 22 $prefs_url = Util::addParameter(IMP::prefsURL(true), 'group', 'fetchmail', false); 23 $to_edit = null; 24 25 /* Handle clients without javascript. */ 26 $actionID = Util::getFormData('actionID'); 27 if (is_null($actionID)) { 28 if (Util::getPost('edit')) { 29 $actionID = 'fetchmail_prefs_edit'; 30 } elseif (Util::getPost('save')) { 31 $actionID = 'fetchmail_prefs_save'; 32 } elseif (Util::getPost('delete')) { 33 $actionID = 'fetchmail_prefs_delete'; 34 } elseif (Util::getPost('back')) { 35 header('Location: ' . $prefs_url); 36 exit; 37 } elseif (Util::getPost('select')) { 38 header('Location: ' . $fetch_url); 39 exit; 40 } 41 } 42 43 /* Run through the action handlers */ 44 switch ($actionID) { 45 case 'fetchmail_create': 46 if ($driver) { 47 $fetchmail = &IMP_Fetchmail::factory($driver, array()); 48 } 49 break; 50 51 case 'fetchmail_prefs_edit': 52 $to_edit = Util::getFormData('account'); 53 $driver = $fm_account->getValue('driver', $to_edit); 54 $fetchmail = &IMP_Fetchmail::factory($driver, array()); 55 break; 56 57 case 'fetchmail_prefs_save': 58 $to_edit = Util::getFormData('edit_account'); 59 if ($to_edit == '') { 60 $to_edit = $fm_account->add(); 61 } 62 63 $fetchmail = &IMP_Fetchmail::factory($driver, array()); 64 65 $id = Util::getFormData('fm_id', _("Unnamed")); 66 $fm_account->setValue('id', $id, $to_edit); 67 68 foreach ($fetchmail->getParameterList() as $val) { 69 $fm_account->setValue($val, Util::getFormData('fm_' . $val), $to_edit); 70 } 71 72 $prefs->setValue('fetchmail_login', (array_sum($fm_account->getAll('loginfetch'))) ? true : false); 73 74 $notification->push(sprintf(_("The account \"%s\" has been saved."), $id), 'horde.success'); 75 break; 76 77 case 'fetchmail_prefs_delete': 78 $to_delete = Util::getFormData('edit_account'); 79 if (!is_null($to_delete)) { 80 $deleted_account = $fm_account->delete($to_delete); 81 $notification->push(sprintf(_("The account \"%s\" has been deleted."), $deleted_account['id']), 'horde.success'); 82 $prefs->setValue('fetchmail_login', (array_sum($fm_account->getAll('loginfetch'))) ? true : false); 83 $actionID = null; 84 } else { 85 $notification->push(_("You must select an account to be deleted."), 'horde.warning'); 86 } 87 break; 88 } 89 90 /* Show the header. */ 91 require_once 'Horde/Prefs/UI.php'; 92 require IMP_BASE . '/config/prefs.php'; 93 $app = 'imp'; 94 95 Prefs_UI::generateHeader(); 96 require IMP_TEMPLATES . '/fetchmail/top.inc'; 97 98 if (empty($actionID)) { 99 /* If actionID is still empty, we haven't selected an account 100 * yet. */ 101 $accounts = $fm_account->getAll('id'); 102 require IMP_TEMPLATES . '/fetchmail/account_select.inc'; 103 } elseif (($actionID == 'fetchmail_create') && empty($driver)) { 104 /* We are creating an account and need to select the type. */ 105 require IMP_TEMPLATES . '/fetchmail/driver_select.inc'; 106 } else { 107 $fm_colors = IMP_Fetchmail::listColors(); 108 require IMP_TEMPLATES . '/fetchmail/manage.inc'; 109 } 110 111 require $registry->get('templates', 'horde') . '/common-footer.inc';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |