"Fossies" - the Fresh Open Source Software Archive 
Member "openmailadmin-1.0.1/inc/_prepend.php" (6 Nov 2007, 4856 Bytes) of package /linux/privat/old/openmailadmin-1.0.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "_prepend.php" see the
Fossies "Dox" file reference documentation.
1 <?php
2 ob_start('ob_gzhandler');
3 // For security reasons error messages should not be displayed.
4 ini_set('log_errors', '1');
5 ini_set('display_errors', '0');
6 error_reporting(E_ALL);
7
8 include('./inc/config.inc.php');
9 @(include('./inc/config.local.inc.php'))
10 or die('You have to create an configuration file, first. Try <a href="setup.php">setup.php</a>.');
11 include('./inc/translation.inc.php');
12 include('./inc/exception_handler.php');
13 include('adodb/adodb.inc.php');
14 include('./inc/functions.inc.php');
15
16 if(is_readable('./templates/'.$cfg['theme'].'/__aux.php')) {
17 include('./templates/'.$cfg['theme'].'/__aux.php');
18 }
19
20 // Initialization
21 $input = new HTMLInputTagGenerator();
22
23 if(isset($cfg['max_elements_per_page']))
24 $amount_set = array_unique(array('10', '25', '50', '100', '--', $cfg['max_elements_per_page']));
25 else
26 $amount_set = array('10', '25', '50', '100', '--');
27
28 // MAIN
29 header('Content-type: text/html; charset=utf-8');
30 include('./templates/'.$cfg['theme'].'/common-header.tpl');
31
32 // Authentification
33 include('./inc/miniauth.inc.php');
34
35 if(!isset($cfg['Servers']['IMAP'][$_SESSION['server']]['TYPE'])) {
36 die('You have forgotten to set TYPEs in the configuration files!');
37 }
38
39 // prefix table names
40 $cfg['tablenames'] = array();
41 foreach(array('user', 'domains', 'virtual', 'virtual_regexp', 'imap_demo') as $table) {
42 $cfg['tablenames'][$table] = $cfg['Servers']['DB'][$_SESSION['server']]['PREFIX'].$table;
43 }
44
45 // Objects' initialization
46 User::$db = $db;
47 User::$tablenames = $cfg['tablenames'];
48
49 // IMAP
50 $imap = IMAP_get_instance($cfg['Servers']['IMAP'][$_SESSION['server']],
51 $cfg['Servers']['IMAP'][$_SESSION['server']]['TYPE']);
52
53 // include the backend
54 $oma = new openmailadmin($db, $cfg['tablenames'], $cfg, $imap);
55 $oma->authenticated_user = $authinfo;
56 unset($authinfo);
57 $ErrorHandler = ErrorHandler::getInstance();
58
59 // Query for the current user...
60 if(!(isset($_GET['cuser']) && $_GET['cuser'] != $oma->authenticated_user->mbox)) {
61 $oma->current_user = $oma->authenticated_user;
62 } else try {
63 $oma->current_user = new User($_GET['cuser']);
64 if(!($oma->authenticated_user->is_superuser()
65 || $oma->current_user->pate == $oma->authenticated_user->mbox
66 || $oma->user_is_descendant($oma->current_user->mbox, $oma->authenticated_user->mbox))) {
67 throw new Exception(txt(2));
68 }
69 } catch (Exception $e) {
70 error($e->getMessage());
71 include('./templates/'.$cfg['theme'].'/common-footer_nv.tpl');
72 exit();
73 }
74
75 // ... and his paten.
76 if($oma->current_user->mbox == $oma->current_user->pate) {
77 $cpate = $oma->current_user;
78 } else {
79 try {
80 $cpate = new User($oma->current_user->pate);
81 } catch (Exception $e) {
82 $cpate = $oma->current_user;
83 }
84 }
85
86 // Display navigation menu.
87 $arr_navmenu = array();
88 $arr_navmenu[] = array('link' => 'index.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
89 'caption' => txt('1'),
90 'active' => stristr($_SERVER['PHP_SELF'], 'index.php'));
91 if($oma->current_user->max_alias > 0 || $oma->authenticated_user->a_super >= 1 || $oma->user_get_used_alias($oma->current_user->mbox)) {
92 $arr_navmenu[] = array('link' => 'addresses.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
93 'caption' => txt('17'),
94 'active' => stristr($_SERVER['PHP_SELF'], 'addresses.php'));
95 }
96 if($oma->current_user->mbox == $oma->authenticated_user->mbox) {
97 $arr_navmenu[] = array('link' => 'folders.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
98 'caption' => txt('103'),
99 'active' => stristr($_SERVER['PHP_SELF'], 'folders.php'));
100 }
101 if($oma->current_user->max_regexp > 0 || $oma->authenticated_user->a_super >= 1 || $oma->user_get_used_regexp($oma->current_user->mbox)) {
102 $arr_navmenu[] = array('link' => 'regexp.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
103 'caption' => txt('33'),
104 'active' => stristr($_SERVER['PHP_SELF'], 'regexp.php'));
105 }
106 if($oma->authenticated_user->a_admin_domains >= 1 || $oma->user_get_number_domains($oma->current_user->mbox) > 0) {
107 $arr_navmenu[] = array('link' => 'domains.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
108 'caption' => txt('54'),
109 'active' => stristr($_SERVER['PHP_SELF'], 'domains.php'));
110 }
111 if($oma->authenticated_user->a_admin_user >= 1 || $oma->user_get_number_mailboxes($oma->current_user->mbox) > 0) {
112 $arr_navmenu[] = array('link' => 'mailboxes.php'.($oma->current_user->mbox != $oma->authenticated_user->mbox ? '?cuser='.$oma->current_user->mbox : ''),
113 'caption' => txt('79'),
114 'active' => stristr($_SERVER['PHP_SELF'], 'mailboxes.php'));
115 }
116 include('./templates/'.$cfg['theme'].'/navigation/navigation.tpl');
117
118 ?>