source: trunk/preferences/changepersonaldata.php @ 2

Revision 2, 3.7 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * ExpressoLivre - preferences                                              *
4        * http://www.celepar.pr.gov.br                                             *
5        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
6        * Modify by João Alfredo Knopik Junior <jakjr@celepar.pr.gov.br>           *
7        *                                                                                                                                                  *
8        * --------------------------------------------                             *
9        *  This program is free software; you can redistribute it and/or modify it *
10        *  under the terms of the GNU General Public License as published by the   *
11        *  Free Software Foundation; either version 2 of the License, or (at your  *
12        *  option) any later version.                                              *
13        \**************************************************************************/
14
15
16        $GLOBALS['phpgw_info']['flags'] = array(
17                'noheader'   => True,
18                'nonavbar'   => True,
19                'currentapp' => 'preferences'
20        );
21
22        include('../header.inc.php');
23
24        if($_POST['cancel'])
25        {
26                $GLOBALS['phpgw']->redirect_link('/preferences/index.php');
27                $GLOBALS['phpgw']->common->phpgw_exit();
28        }
29
30        if(!@is_object($GLOBALS['phpgw']->js))
31        {
32                $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
33        }
34        $GLOBALS['phpgw']->js->validate_file('jscode','scripts','preferences');#diretorio, arquivo.js, aplicacao
35
36        $GLOBALS['phpgw']->template->set_file(array(
37                'form' => 'changepersonaldata.tpl'
38        ));
39
40        $GLOBALS['phpgw']->template->set_var('lang_commercial_telephonenumber',lang('Commercial Telephone number'));
41        $GLOBALS['phpgw']->template->set_var('lang_ps_commercial_telephonenumber','Observação: Este número de telefone irá aparecer nas buscas por seu nome e será visível por todos os usuários do ExpressoLivre.');
42        $GLOBALS['phpgw']->template->set_var('lang_change',lang('Change'));
43        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
44        $GLOBALS['phpgw']->template->set_var('telephonenumber',$_POST['telephonenumber'] ? $_POST['telephonenumber'] : $GLOBALS['phpgw_info']['user']['telephonenumber']);
45        $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepersonaldata.php'));
46
47        if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap')
48        {
49                $GLOBALS['phpgw']->template->set_var('sql_message',lang('note: This feature is *exclusive* for ldap repository.'));
50        }
51
52        if ($_POST['change'])
53        {
54                if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'])
55                {
56                        $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/';
57                        if (!preg_match($pattern, $_POST['telephonenumber']))
58                        {
59                                $errors[] = lang('Format of telephone number is invalid.');
60                        }
61                        else
62                        {
63                                $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect();
64                                $info['telephonenumber'] = $_POST['telephonenumber'];
65                               
66                                if ($GLOBALS['phpgw_info']['user']['telephonenumber'])
67                                {
68                                        $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info);
69                                }
70                                else
71                                {
72                                        $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info);
73                                }
74                        }
75                       
76                        if(is_array($errors))
77                        {
78                                $GLOBALS['phpgw']->common->phpgw_header();
79                                echo parse_navbar();
80                                $GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors));
81                                $GLOBALS['phpgw']->template->pfp('out','form');
82                                $GLOBALS['phpgw']->common->phpgw_exit(True);
83                        }
84                }
85                $GLOBALS['phpgw']->redirect_link('/preferences/index.php','cd=18');
86        }
87        else
88        {
89                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Change your Personal Data');
90                $GLOBALS['phpgw']->common->phpgw_header();
91                echo parse_navbar();
92
93                $GLOBALS['phpgw']->template->pfp('out','form');
94                $GLOBALS['phpgw']->common->phpgw_footer();
95        }
96?>
Note: See TracBrowser for help on using the repository browser.