source: trunk/preferences/termo_aceite.php @ 549

Revision 549, 2.7 KB checked in by niltonneto, 15 years ago (diff)

resolve #372

Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare - preferences                                               *
4        * http://www.phpgroupware.org                                              *
5        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12        $GLOBALS['phpgw_info']['flags'] = array(
13                'noheader'   => True,
14                'nonavbar'   => True,
15                'currentapp' => 'preferences'
16        );
17
18
19        include('../header.inc.php');
20
21        $GLOBALS['phpgw']->template->set_file(array(
22                'form' => 'termo_aceite.tpl'
23        ));
24       
25        $termo = $GLOBALS['phpgw_info']['server']['agree_term'];
26       
27        $GLOBALS['phpgw']->template->set_var('accept_term',$termo);
28        $GLOBALS['phpgw']->template->set_var('Yes',lang('Yes'));
29        $GLOBALS['phpgw']->template->set_var('No',lang('No'));
30        $GLOBALS['phpgw']->template->set_var('url_accept',lang('Change'));
31        $GLOBALS['phpgw']->template->set_var('url_dont_accept','../logout.php');
32        $GLOBALS['phpgw']->template->set_var('do you agree with the terms?',lang('Do you agree with the terms?'));
33       
34
35
36        if (isset($_POST['pass']))
37        {
38                $common = CreateObject('phpgwapi.common');
39                // For Write operations in LDAP, the ldap master values (from Setup) must be verified.
40                // If you dont use Ldap replication, ignore it.
41                if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) &&
42                     (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) &&
43                     (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw']))) {
44
45                        $ldap =$common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_master_host'],
46                        $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'],
47                        $GLOBALS['phpgw_info']['server']['ldap_master_root_pw'],false);
48                }
49                else
50                // For Write operations in LDAP, use ldapConnect without parameters.
51                        $ldap =$common->ldapConnect();
52               
53                               
54                $ldap_mod_replace['phpgwAgreeTerm'] = 1;
55                $dn = $GLOBALS['phpgw_info']['user']['account_dn'];
56
57                ldap_mod_replace ( $ldap, $dn, $ldap_mod_replace );
58               
59                header("location: ../home.php?cd=yes");
60        }
61        else
62        {
63                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('agree term');
64                $GLOBALS['phpgw']->common->phpgw_header();
65                echo parse_navbar();
66
67                $GLOBALS['phpgw']->template->pfp('out','form');
68                $GLOBALS['phpgw']->common->phpgw_footer();
69        }
70?>
Note: See TracBrowser for help on using the repository browser.