3 * User account main page - show settings with means to change them
5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfcommon.'include/timezones.php';
30 session_require_login () ;
32 // get global users vars
33 $u =& user_get_object(user_getid());
34 if (!$u || !is_object($u)) {
35 exit_error('Error','Could Not Get User');
36 } elseif ($u->isError()) {
37 exit_error('Error',$u->getErrorMessage());
40 if (getStringFromRequest('submit')) {
41 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
42 exit_form_double_submit();
46 $firstname = getStringFromRequest('firstname');
47 $lastname = getStringFromRequest('lastname');
48 $language = getIntFromRequest('language');
49 $timezone = getStringFromRequest('timezone');
50 $theme_id = getIntFromRequest('theme_id');
51 $ccode = getStringFromRequest('ccode');
52 $address = getStringFromRequest('address');
53 $address2 = getStringFromRequest('address2');
54 $phone = getStringFromRequest('phone');
55 $fax = getStringFromRequest('fax');
56 $title = getStringFromRequest('title');
57 $jabber_address = getStringFromRequest('jabber');
58 $jabber_only = getStringFromRequest('jabber');
59 $mail_site = getStringFromRequest('mail_site');
60 $mail_va = getStringFromRequest('mail_va');
61 $remember_user = getStringFromRequest('remember_user');
62 $use_ratings = getStringFromRequest('use_ratings');
65 //needs security audit
67 // set cookie, expire in 3 months
68 setcookie("sf_user_hash",$u->getID().'_'.substr($u->getMD5Passwd(),0,16),time()+90*24*60*60,'/');
71 setcookie("sf_user_hash",'',0,'/');
74 // Refresh page if language or theme changed
75 $refresh = ($language != $u->getLanguage() || $theme_id != $u->getThemeID());
77 if (!$u->update($firstname, $lastname, $language, $timezone, $mail_site, $mail_va, $use_ratings,
78 $jabber_address,$jabber_only,$theme_id,$address,$address2,$phone,$fax,$title,$ccode)) {
79 form_release_key(getStringFromRequest('form_key'));
80 $feedback .= $u->getErrorMessage().'<br />';
82 $feedback .= _('Updated').'<br />';
86 session_redirect("/account/?feedback=".urlencode($feedback));
91 site_user_header(array('title'=>_('Account Maintenance')));
93 echo '<form action="'.util_make_url('/account/').'" method="post">';
94 echo '<input type="hidden" name="form_key" value="'.form_generate_key().'"/>';
95 echo $HTML->boxTop(_('Account Maintenance'));
100 <p> <?php echo _('Welcome'); ?> <strong><?php print $u->getRealName(); ?></strong>. </p>
103 <?php echo _('Account options:'); ?>
106 <li><?php echo util_make_link_u ($u->getUnixName(),$u->getId(),'<strong>'._('View My Profile').'</strong>'); ?></li>
107 <?php if(forge_get_config('use_people')) { ?>
108 <li><?php echo util_make_link ('/people/editprofile.php','<strong>'._('Edit My Skills Profile').'</strong>'); ?></li>
111 <?php echo $HTML->boxBottom(); ?>
114 <table width="100%" border="0">
117 <td><?php echo _('Member since:'); ?> </td>
118 <td><strong><?php print date(_('Y-m-d H:i'),$u->getAddDate()); ?></strong></td>
121 <td><?php echo _('User ID:'); ?> </td>
122 <td><strong><?php print $u->getID(); ?></strong></td>
126 <td><?php echo _('Login name:'); ?> </td>
127 <td><strong><?php print $u->getUnixName(); ?></strong>
128 <br /><a href="change_pw.php">[<?php echo _('Change Password'); ?>]</a>
133 <td><?php echo _('First Name:'); ?></td>
135 <input type="text" name="firstname" value="<?php print $u->getFirstName(); ?>" />
140 <td><?php echo _('Last Name:'); ?></td>
142 <input type="text" name="lastname" value="<?php print $u->getLastName(); ?>" />
147 <td><?php echo _('Language:'); ?> </td>
148 <td><?php echo html_get_language_popup ('language',$u->getLanguage()); ?>
153 <td><?php echo _('Timezone:'); ?> </td>
154 <td><?php echo html_get_timezone_popup('timezone', $u->getTimeZone()); ?>
159 <td><?php echo _('Theme:'); ?> </td>
160 <td><?php echo html_get_theme_popup('theme_id', $u->getThemeID()); ?>
165 <td><?php echo _('Country:'); ?> </td>
166 <td><?php echo html_get_ccode_popup('ccode', $u->getCountryCode()); ?>
171 <td><?php echo _('Email Addr:'); ?> </td>
172 <td><strong><?php print $u->getEmail(); ?></strong>
173 <br /><a href="change_email.php">[<?php echo _('Change Email Addr'); ?>]</a>
178 <td><?php echo _('Address:'); ?></td>
180 <input type="text" name="address" value="<?php echo $u->getAddress(); ?>" size="80"/>
185 <td><?php echo _('Address:'); ?></td>
187 <input type="text" name="address2" value="<?php echo $u->getAddress2(); ?>" size="80"/>
192 <td><?php echo _('Phone:'); ?></td>
194 <input type="text" name="phone" value="<?php echo $u->getPhone(); ?>" size="20"/>
199 <td><?php echo _('FAX:'); ?></td>
201 <input type="text" name="fax" value="<?php echo $u->getFax(); ?>" size="20"/>
206 <td><?php echo _('Title:'); ?></td>
208 <input type="text" name="title" value="<?php echo $u->getTitle(); ?>" size="10"/>
213 if (forge_get_config('use_jabber')) {
214 echo '<tr valign="top">
215 <td>'. _('Jabber Address:') .'</td>
217 <input size=30 type="text" name="jabber_address" value="'. $u->getJabberAddress() .'" /><p />
218 <input type="checkbox" name="jabber_only" value="1" '.(($u->getJabberOnly()) ? 'checked="CHECKED"' : '' ).' />
219 '._('Send auto-generated notices only to my Jabber address').'.
229 // ############################# Preferences
230 echo $HTML->boxTop(_('Preferences')); ?>
232 <input type="checkbox" name="mail_site" value="1"<?php
233 if ($u->getMailingsPrefs('site')) print " checked=\"checked\""; ?> />
234 <?php echo _('Receive Email about Site Updates <i>(Very low traffic and includes security notices. Highly Recommended.)</i>'); ?>
236 <p /><input type="checkbox" name="mail_va" value="1"<?php
237 if ($u->getMailingsPrefs('va')) print " checked=\"checked\""; ?> />
238 <?php echo _('Receive additional community mailings. <i>(Low traffic.)</i>'); ?>
240 <p /><input type="checkbox" name="remember_user" value="1"<?php
241 if ($sf_user_hash) print " checked=\"checked\""; ?> />
242 <?php printf(_('"Remember me". <i>(Allows to access your <a href="%s">personal page</a> without being logged in. You will still need to login explicitly before making any changes.)</i>'),util_make_url ('/my/'));
246 <?php if (forge_get_config('use_ratings')) { ?>
247 <input type="checkbox" name="use_ratings" value="1"<?php
248 if ($u->usesRatings()) print ' checked="checked"'; ?> />
249 <?php printf(_('Participate in peer ratings. <i>(Allows you to rate other users using several criteria as well as to be rated by others. More information is available on your <a href="%s">user page</a> if you have chosen to participate in ratings.)</i>'),util_make_url_u ($u->getUnixName(),$u->getId()));
253 $hookParams['user']= user_get_object(user_getid());
254 if (getStringFromRequest('submit')) {//if this is set, then the user has issued an Update
255 plugin_hook("userisactivecheckboxpost", $hookParams);
257 plugin_hook("userisactivecheckbox", $hookParams);
262 <?php echo $HTML->boxBottom();
264 // ############################### Shell Account
266 if (($u->getUnixStatus() == 'A') && (forge_get_config('use_shell'))) {
267 echo $HTML->boxTop(_('Shell Account Information')."");
269 <br />'._('Shell box').': <strong>'.$u->getUnixBox().'</strong>
270 <br />'._('SSH Shared Authorized Keys').': <strong>';
271 // get shared key count from db
272 $expl_keys = explode("\n", $u->getAuthorizedKeys());
274 print (sizeof($expl_keys));
279 print '<br />' . util_make_link ("account/editsshkeys.php",_('Edit Keys')) ;
280 echo $HTML->boxBottom();
290 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" />
291 <input type="reset" name="reset" value="<?php echo _('Reset Changes'); ?>" />
296 site_user_footer(array());
300 // c-file-style: "bsd"