source: trunk/preferences/changepersonaldata.php @ 100

Revision 100, 3.7 KB checked in by wmerlotto, 16 years ago (diff)

Corrigido espaço adicional na string de tradução

  • 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',
42        lang('Observation: This telephone number will apear in the searches for your name, and will be visible for all ExpressoLivre Users.'));
43        $GLOBALS['phpgw']->template->set_var('lang_change',lang('Change'));
44        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
45        $GLOBALS['phpgw']->template->set_var('telephonenumber',$_POST['telephonenumber'] ? $_POST['telephonenumber'] : $GLOBALS['phpgw_info']['user']['telephonenumber']);
46        $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepersonaldata.php'));
47
48        if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap')
49        {
50                $GLOBALS['phpgw']->template->set_var('sql_message',lang('note: This feature is *exclusive* for ldap repository.'));
51        }
52
53        if ($_POST['change'])
54        {
55                if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'])
56                {
57                        $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/';
58                        if (!preg_match($pattern, $_POST['telephonenumber']))
59                        {
60                                $errors[] = lang('Format of telephone number is invalid.');
61                        }
62                        else
63                        {
64                                $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect();
65                                $info['telephonenumber'] = $_POST['telephonenumber'];
66                               
67                                if ($GLOBALS['phpgw_info']['user']['telephonenumber'])
68                                {
69                                        $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info);
70                                }
71                                else
72                                {
73                                        $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info);
74                                }
75                        }
76                       
77                        if(is_array($errors))
78                        {
79                                $GLOBALS['phpgw']->common->phpgw_header();
80                                echo parse_navbar();
81                                $GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors));
82                                $GLOBALS['phpgw']->template->pfp('out','form');
83                                $GLOBALS['phpgw']->common->phpgw_exit(True);
84                        }
85                }
86                $GLOBALS['phpgw']->redirect_link('/preferences/index.php','cd=18');
87        }
88        else
89        {
90                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Change your Personal Data');
91                $GLOBALS['phpgw']->common->phpgw_header();
92                echo parse_navbar();
93
94                $GLOBALS['phpgw']->template->pfp('out','form');
95                $GLOBALS['phpgw']->common->phpgw_footer();
96        }
97?>
Note: See TracBrowser for help on using the repository browser.