[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 /** 3 * IMP base inclusion file. This file brings in all of the dependencies that 4 * every IMP script will need, and sets up objects that all scripts use. 5 * 6 * The following variables, defined in the script that calls this one, are 7 * used: 8 * $authentication - The type of authentication to use 9 * $no_compress - Controls whether the page should be compressed 10 * $session_control - Sets special session control limitations 11 * 12 * $Horde: imp/lib/base.php,v 1.79.10.15 2007/01/02 13:54:56 jan Exp $ 13 * 14 * Copyright 1999-2007 Chuck Hagenbuch <chuck@horde.org> 15 * 16 * See the enclosed file COPYING for license information (GPL). If you 17 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. 18 */ 19 20 // Check for a prior definition of HORDE_BASE (perhaps by an 21 // auto_prepend_file definition for site customization). 22 if (!defined('HORDE_BASE')) { 23 @define('HORDE_BASE', dirname(__FILE__) . '/../..'); 24 } 25 26 // Load the Horde Framework core, and set up inclusion paths. 27 require_once HORDE_BASE . '/lib/core.php'; 28 29 $session_control = Util::nonInputVar('session_control'); 30 switch ($session_control) { 31 case 'netscape': 32 if ($browser->isBrowser('mozilla')) { 33 session_cache_limiter('private, must-revalidate'); 34 } 35 break; 36 } 37 38 // Registry. 39 if ($session_control == 'none') { 40 $registry = &Registry::singleton(HORDE_SESSION_NONE); 41 } elseif ($session_control == 'readonly') { 42 $registry = &Registry::singleton(HORDE_SESSION_READONLY); 43 } else { 44 $registry = &Registry::singleton(); 45 } 46 47 // We explicitly do not check application permissions for the compose 48 // and recompose pages, since those are handled below and need to fall 49 // through to IMP-specific code. 50 $auth_check = !(defined('AUTH_HANDLER') || strstr($_SERVER['PHP_SELF'], 'compose.php')); 51 if (is_a(($pushed = $registry->pushApp('imp', $auth_check)), 'PEAR_Error')) { 52 if ($pushed->getCode() == 'permission_denied') { 53 Horde::authenticationFailureRedirect(); 54 } 55 Horde::fatal($pushed, __FILE__, __LINE__, false); 56 } 57 $conf = &$GLOBALS['conf']; 58 @define('IMP_TEMPLATES', $registry->get('templates')); 59 60 // Find the base file path of IMP. 61 @define('IMP_BASE', dirname(__FILE__) . '/..'); 62 63 // Notification system. 64 require_once IMP_BASE . '/lib/Notification/Listener/status.php'; 65 $notification = &Notification::singleton(); 66 $notification->attach('status', null, 'Notification_Listener_status_imp'); 67 // BC check. 68 if (@include_once 'Horde/Notification/Listener/audio.php') { 69 $notification->attach('audio'); 70 } 71 72 // IMP base library. 73 require_once IMP_BASE . '/lib/IMP.php'; 74 75 // If IMP isn't responsible for Horde auth, and no one is logged into 76 // Horde, redirect to the login screen. If this is a compose window 77 // that just timed out, give the user a chance to recover their 78 // message. 79 if (!(Auth::isAuthenticated() || (Auth::getProvider() == 'imp'))) { 80 if (strstr($_SERVER['PHP_SELF'], 'recompose.php')) { 81 // Let this fall through; otherwise we create an infinite 82 // inclusion loop. 83 } elseif (strstr($_SERVER['PHP_SELF'], 'compose.php')) { 84 require IMP_BASE . '/recompose.php'; 85 exit; 86 } else { 87 Horde::authenticationFailureRedirect(); 88 } 89 } 90 91 // Horde libraries. 92 require_once 'Horde/Secret.php'; 93 94 // Help. 95 require_once 'Horde/Help.php'; 96 97 // Start compression. 98 if (!Util::nonInputVar('no_compress')) { 99 Horde::compressOutput(); 100 } 101 102 $authentication = Util::nonInputVar('authentication'); 103 if ($authentication === null) { 104 $authentication = 0; 105 } 106 if ($authentication !== 'none') { 107 // If we've gotten to this point and have valid login credentials 108 // but don't actually have an IMP session, then we need to go 109 // through redirect.php to ensure that everything gets set up 110 // properly. Single-signon and transparent authentication setups 111 // are likely to trigger this case. 112 if (empty($_SESSION['imp'])) { 113 if (strstr($_SERVER['PHP_SELF'], 'compose.php')) { 114 require IMP_BASE . '/recompose.php'; 115 } else { 116 require IMP_BASE . '/redirect.php'; 117 } 118 exit; 119 } 120 121 if (strstr($_SERVER['PHP_SELF'], 'compose.php')) { 122 if (!IMP::checkAuthentication($authentication, true)) { 123 require IMP_BASE . '/recompose.php'; 124 exit; 125 } 126 } else { 127 IMP::checkAuthentication($authentication); 128 } 129 } 130 131 if ((IMP::loginTasksFlag() === 2) && 132 !defined('AUTH_HANDLER') && 133 !strstr($_SERVER['PHP_SELF'], 'maintenance.php')) { 134 require_once IMP_BASE . '/lib/Session.php'; 135 IMP_Session::loginTasks(); 136 } 137 138 // Set default message character set, if necessary 139 if (isset($prefs) && ($def_charset = $prefs->getValue('default_msg_charset'))) { 140 $GLOBALS['mime_structure']['default_charset'] = $def_charset; 141 $GLOBALS['mime_headers']['default_charset'] = $def_charset; 142 } 143 144 // Catch c-client errors. 145 register_shutdown_function('imap_errors'); 146 register_shutdown_function('imap_alerts');
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 |
![]() |