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 | |
---|
13 | |
---|
14 | Header('Cache-Control: no-cache'); |
---|
15 | Header('Pragma: no-cache'); |
---|
16 | //Header('Expires: Sat, Jan 01 2000 01:01:01 GMT'); |
---|
17 | |
---|
18 | $phpgw_info = array(); |
---|
19 | $GLOBALS['phpgw_info']['flags']['currentapp'] = 'preferences'; |
---|
20 | include('../header.inc.php'); |
---|
21 | |
---|
22 | if ($GLOBALS['phpgw_info']['user']['permissions']['anonymous']) |
---|
23 | { |
---|
24 | Header('Location: ' . $GLOBALS['phpgw']->link('/')); |
---|
25 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
26 | } |
---|
27 | |
---|
28 | if ($submit) |
---|
29 | { |
---|
30 | if ($picture_size) |
---|
31 | { |
---|
32 | $fh = fopen($picture,'rb'); |
---|
33 | $picture_raw = fread($fh,$picture_size); |
---|
34 | fclose($fh); |
---|
35 | |
---|
36 | $phone_number = addslashes($phone_number); |
---|
37 | $comments = addslashes($comments); |
---|
38 | $title = addslashes($title); |
---|
39 | |
---|
40 | if ($GLOBALS['phpgw_info']['server']['db_type'] == 'mysql') |
---|
41 | { |
---|
42 | $picture_raw = addslashes($picture_raw); |
---|
43 | } |
---|
44 | else |
---|
45 | { |
---|
46 | $picture_raw = base64_encode($picture_raw); |
---|
47 | } |
---|
48 | |
---|
49 | $GLOBALS['phpgw']->db->query("delete from profiles where owner='" . $GLOBALS['phpgw_info']['user']['userid'] . "'"); |
---|
50 | |
---|
51 | $GLOBALS['phpgw']->db->query("insert into profiles (owner,title,phone_number,comments," |
---|
52 | . "picture_format,picture) values ('" . $GLOBALS['phpgw_info']['user']['userid'] . "','" |
---|
53 | . "$title','$phone_number','$comments','$picture_type','$picture_raw')"); |
---|
54 | } |
---|
55 | else |
---|
56 | { |
---|
57 | $phone_number = addslashes($phone_number); |
---|
58 | $picture_raw = addslashes($picture_raw); |
---|
59 | $comments = addslashes($comments); |
---|
60 | $title = addslashes($title); |
---|
61 | |
---|
62 | $GLOBALS['phpgw']->db->query("update profiles set title='$title',phone_number='$phone_number'," |
---|
63 | . "comments='$comments' where owner='" . $GLOBALS['phpgw_info']['user']['userid'] . "'"); |
---|
64 | } |
---|
65 | echo '<center>Your profile has been updated</center>'; |
---|
66 | } |
---|
67 | |
---|
68 | $GLOBALS['phpgw']->db->query("select * from profiles where owner='" . $GLOBALS['phpgw_info']['user']['userid'] . "'"); |
---|
69 | $GLOBALS['phpgw']->db->next_record(); |
---|
70 | ?> |
---|
71 | |
---|
72 | <form method="POST" ENCTYPE="multipart/form-data" action="<?php echo $GLOBALS['phpgw']->link('/preferences/changeprofile.php'); ?>"> |
---|
73 | <table border="0"> |
---|
74 | <tr> |
---|
75 | <td colspan="2"><?php echo $GLOBALS['phpgw']->common->display_fullname($GLOBALS['phpgw_info']['user']['userid'],$GLOBALS['phpgw_info']['user']['firstname'],$GLOBALS['phpgw_info']['user']['lastname']); ?></td> |
---|
76 | <td> </td> |
---|
77 | </tr> |
---|
78 | <tr> |
---|
79 | <td>Title:</td> |
---|
80 | <td><input name="title" value="<?php echo $GLOBALS['phpgw']->db->f('title'); ?>"></td> |
---|
81 | <td rowspan="2"> |
---|
82 | <img src="<?php echo $GLOBALS['phpgw']->link('/hr/view_image.php','con=' . $GLOBALS['phpgw_info']['user']['con']); ?>" width="100" height="120"> |
---|
83 | </td> |
---|
84 | </tr> |
---|
85 | |
---|
86 | <tr> |
---|
87 | <td>Phone number:</td> |
---|
88 | <td><input name="phone_number" value="<?php echo $GLOBALS['phpgw']->db->f('phone_number'); ?>"></td> |
---|
89 | </tr> |
---|
90 | |
---|
91 | <tr> |
---|
92 | <td>Comments:</td> |
---|
93 | <td><textarea cols="60" name="comments" rows="4" wrap="virtual"><?php echo $GLOBALS['phpgw']->db->f('comments'); ?></textarea></td> |
---|
94 | </tr> |
---|
95 | |
---|
96 | <tr> |
---|
97 | <td>Picture:</td> |
---|
98 | <td><input type="file" name="picture"><br>Note: Pictures will be resized to 100x120.</td> |
---|
99 | </tr> |
---|
100 | |
---|
101 | <tr> |
---|
102 | <td colspan="3" align="center"><input type="submit" name="submit" value="Submit"> |
---|
103 | </tr> |
---|
104 | </table> |
---|
105 | |
---|
106 | </form> |
---|
107 | <?php |
---|
108 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
109 | ?> |
---|