summaryrefslogtreecommitdiff
path: root/www/admin/index.php
blob: f5ff5af98134078cf57bdc33f2b462734690f005 (plain)
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
<?php
/*
 *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
 *
 *    Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
 *
 *  This  program is free  software; you can redistribute  it and/or
 *  modify it  under the terms of the GNU  General Public License as
 *  published by the  Free Software Foundation; either version 2, or
 *  (at your option) any later version.
 *
 *  This program is  distributed in the hope that it will be useful,
 *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *
 *  You can view the  GNU General Public License, online, at the GNU
 *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
 */

require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
require_once('admin/include/authenticate.php');

/**** Authentication etc. ***/

require_once('admin/include/menu.php');

function exists_group( $group ) {
  global $ldap;
  $filter = '(&(objectClass=kolabGroupOfNames)(cn='.$ldap->escape($group).'))';
  $res = $ldap->search( $_SESSION['base_dn'], $filter, array( 'dn' ) );
  return ( $ldap->count($res) > 0 );
}

/**** Check for system aliases ****/
$maincontent = 'welcome.tpl';
if( $auth->group() == 'admin' ) {
  if( !exists_group( "hostmaster" ) ||
	  !exists_group( "postmaster" ) ||
	  !exists_group( "abuse" ) ) {
	// Ok, user did not set up system aliases
	$maincontent = 'systemaliasnagscreen.tpl';
  }
}

/**** Insert into template and output ***/
$smarty = new MySmarty();
$smarty->assign( 'topdir', $topdir );
$smarty->assign( 'uid', $auth->uid() );
$smarty->assign( 'group', $auth->group() );
$smarty->assign( 'page_title', 'Kolab' );
$smarty->assign( 'menuitems', $menuitems );
$smarty->assign( 'submenuitems', array() );
$smarty->assign( 'maincontent', $maincontent );
$smarty->display('page.tpl');

/*
  Local variables:
  mode: php
  indent-tabs-mode: t
  tab-width: 4
  buffer-file-coding-system: utf-8
  End:
 */
?>