00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: index.php 4977 2005-11-15 17:38:40Z yeupou $
00006 #
00007 # Copyright 1999-2000 (c) The SourceForge Crew
00008 # Copyright 2000-2003 (c) Free Software Foundation
00009 #
00010 # Copyright 2002-2006 (c) Mathieu Roy <yeupou--gnu.org>
00011 #
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00025
00026 # we need to define the theme before loading the pre.php init script,
00027 # otherwise the page needs to be reloaded for the change to take effect.
00028 # see bug #1987
00029 if ($update and $user_theme != "random" and $user_theme != "rotate")
00030 {
00031 define("SV_THEME", addslashes($user_theme));
00032 }
00033
00034 require "../../include/pre.php";
00035 require "../../include/timezones.php";
00036
00037 register_globals_off();
00038
00039 #######################
00040 ####################### UPDATE DATABASE
00041
00042 session_require(array('isloggedin'=>1));
00043
00044 if (sane_post("update"))
00045 {
00046 # Update theme
00047 $user_theme = sane_post("user_theme");
00048 $theme_rotate_jump = sane_post("theme_rotate_jump");
00049
00050 if ($user_theme == "Default")
00051 { $user_theme = ""; }
00052
00053 if ($theme_rotate_jump == "1")
00054 {
00055 theme_rotate_jump($theme_rotate_numeric);
00056 }
00057 else
00058 {
00059 setcookie("SV_THEME", $user_theme, time() + 60*60*24*365, $GLOBALS['sys_url_topdir']);
00060 }
00061
00062
00063 # Update the rest
00064 $form_email_hide = sane_post("form_email_hide");
00065 $form_timezone = sane_post("form_timezone");
00066 if ($form_timezone == 100)
00067 { $form_timezone = "GMT"; }
00068
00069 $success = db_query("UPDATE user SET "
00070 . "email_hide='" . ($form_email_hide?"1":"0")."', "
00071 . "theme='".$user_theme."', "
00072 . "timezone='".$form_timezone."' WHERE "
00073 . "user_id=" . user_getid());
00074
00075
00076 # Integrated bookmarks
00077 $form_use_bookmarks = sane_post("form_use_bookmarks");
00078
00079 if ($form_use_bookmarks == "1")
00080 { user_set_preference("use_bookmarks", 1); }
00081 else
00082 { user_unset_preference("use_bookmarks"); }
00083
00084
00085 # Reversed comment order
00086 $form_reverse_comments_order = sane_post("form_reverse_comments_order");
00087
00088 if ($form_reverse_comments_order == "1")
00089 { user_set_preference("reverse_comments_order", 1); }
00090 else
00091 { user_unset_preference("reverse_comments_order"); }
00092
00093 # Keep only one session comment order
00094 $form_keep_only_one_session = sane_post("form_keep_only_one_session");
00095
00096 if ($form_keep_only_one_session == "1")
00097 { user_set_preference("keep_only_one_session", 1); }
00098 else
00099 { user_unset_preference("keep_only_one_session"); }
00100
00101
00102 if ($success)
00103 {
00104 fb(_("Database successfully updated"));
00105 }
00106 else
00107 {
00108 fb(_("Failed to update the database"),1);
00109 }
00110 }
00111
00112
00113 #######################
00114 ####################### PRINT FORM + LINKS
00115
00116
00117 site_user_header(array('context'=>'account'));
00118
00119
00120 # get global user vars
00121 $res_user = db_query("SELECT * FROM user WHERE user_id=" . user_getid());
00122 $row_user = db_fetch_array($res_user);
00123
00124 print '<p>'._("You can view/change all of your account features from here.").'</p>';
00125
00126 # we get site-specific content
00127 utils_get_content("account/index_intro");
00128
00129
00130 print '<form action="'.$PHP_SELF.'" method="post">';
00131
00132 #####################################################################
00133 #####################################################################
00134
00135 print '<h3>'._("Significant Arrangements").'</h3>';
00136
00137 print "\n".html_splitpage(1);
00138
00139 ############## Passwd / SSH
00140
00141 print $HTML->box_top(_('Authentication Setup'));
00142 print '<a href="change.php?item=password">'._("Change Password").'</a>';
00143 print '<p class="smaller">'._("This password gives access to the web interface.").'<br />';
00144 utils_get_content("account/index_passwd");
00145 print '</p>';
00146
00147 # get shared key count from db
00148 $expl_keys = explode("###",$row_user['authorized_keys']);
00149
00150 # If the last 'key' is empty, then it is because of a trailing separator;
00151 # so do not count it
00152 $keynum = (sizeof($expl_keys));
00153 if ($expl_keys[$keynum-1] == "")
00154 $keynum--;
00155
00156 unset($i);
00157 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00158 print '<a href="editsshkeys.php">';
00159 if ($keynum > 0)
00160 { printf(ngettext("Edit the %d SSH Public Key registered", "Edit the %d SSH Public Keys registered", $keynum), $keynum); }
00161 else
00162 { print gettext("Register an SSH Public Key"); }
00163
00164 print '</a><p class="smaller">';
00165 utils_get_content("account/index_ssh");
00166 print '</p>';
00167
00168 $i++;
00169 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00170 print '<a href="change.php?item=gpgkey">'._("Edit GPG Key").'</a>';
00171 print '<p class="smaller">';
00172 utils_get_content("account/index_gpg");
00173 print '</p>';
00174
00175
00176 $i++;
00177 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00178 print '<a href="sessions.php">';
00179 printf(ngettext("Manage the %d opened session", "Manage the %d opened sessions", session_count(user_getid())),session_count(user_getid()));
00180 print '</a><br /><br />';
00181
00182 $i++;
00183 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00184
00185 print '<input type="checkbox" name="form_keep_only_one_session" value="1" '.(user_get_preference("keep_only_one_session") ? 'checked="checked"':'').' /> '._("Keep only one session opened at a time");
00186
00187 print '<p class="smaller">'._("By default, you can open as many session concurrently as you want. But you may prefer to allow only one session to be opened at a time, killing previous sessions each time you log in.").'</p>';
00188
00189 print $HTML->box_bottom();
00190 print "<br />\n";
00191
00192
00193 ################### Personal Record
00194 print html_splitpage(2);
00195
00196
00197 print $HTML->box_top(_('Identity Record'));
00198
00199 print sprintf(_("Account #%s"), $row_user['user_id']);
00200 print '<p class="smaller">'.sprintf(_("Your login is %s."), '<strong>'.$row_user['user_name'].'</strong>').' '.sprintf(_("You registered your account on %s."), '<strong>'.format_date($sys_datefmt,$row_user['add_date']).'</strong>').'</p>';
00201
00202 unset($i);
00203 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00204 print '<a href="change.php?item=realname">'._("Change Real Name").'</a>';
00205 print '<p class="smaller">'.sprintf(_("You are %s."), '<strong>'.$row_user['realname'].'</strong>').'</p>';
00206
00207 $i++;
00208 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00209 print '<a href="resume.php">'._("Edit Resume and Skills").'</a>';
00210 print '<p class="smaller">'._("Details about your experience and skills may be of interest to others users or visitors.").'</p>';
00211
00212 $i++;
00213 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00214 print '<a href="'.$GLOBALS['sys_home'].'users/'.$row_user['user_name'].'">'._("View your Public Profile").'</a>';
00215 print '<p class="smaller">'._("Your profile can be viewed by everybody.").'</p>';
00216
00217 print $HTML->box_bottom();
00218 print "<br />\n";
00219
00220 ################### Email Related
00221 print $HTML->box_top(_('Mail Setup'));
00222
00223 print '<a href="change.php?item=email">'._("Change Email Address").'</a>';
00224 print '<p class="smaller">'.sprintf(_("Your current address is %s. It is essential to us that this address remains valid. Keep it up to date."), '<strong>'.$row_user['email'].'</strong>').'</p>';
00225
00226 unset($i);
00227 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00228
00229 print '<a href="change_notifications.php">'._("Edit Personal Notification Settings").'</a>';
00230 print '<p class="smaller">'._("Here is defined when the trackers should send email notifications. It permits also to configure the subject line prefix of sent mails.").'</p>';
00231
00232 print $HTML->box_bottom();
00233 print "<br />\n";
00234
00235 print html_splitpage(3);
00236
00237 #####################################################################
00238 #####################################################################
00239
00240 print '<div class="clearr" /><div class="center"><input type="submit" name="update" value="'._("Update").'" /></div></div>';
00241 print "<br />\n";
00242
00243 print '<h3>'._("Secondary Arrangements").'</h3>';
00244 print html_splitpage(1);
00245
00246 ################### Account Deletion
00247 print $HTML->box_top(_('Account Deletion'));
00248 print '<a href="change.php?item=delete">'._("Delete Account").'</a>';
00249 print '<p class="smaller">'.sprintf(_("If you are no longer member of any project and do not intend to use %s further, you may want to delete your account. This action cannot be undone and your current login will be forever lost."), $GLOBALS['sys_name']).'</strong></p>';
00250
00251 print $HTML->box_bottom();
00252 print "<br />\n";
00253
00254 ################### Optional features
00255 print $HTML->box_top(_('Optional Features'));
00256
00257 print '<input type="checkbox" name="form_use_bookmarks" value="1" '.(user_get_preference("use_bookmarks") ? 'checked="checked"':'').' /> '._("Use integrated bookmarks");
00258
00259 print '<p class="smaller">'._("By default, integrated bookmarks are deactivated to avoid redundancy with the bookmark feature provided by most modern web browsers. However, you may prefer integrated bookmarks if you frequently use different workstations without web browsers bookmarks synchronization.").'</p>';
00260
00261 print $HTML->box_bottom();
00262 print "<br />\n";
00263
00264
00265 print html_splitpage(2);
00266
00267 ################### Prefs
00268
00269 print $HTML->box_top(_('Cosmetics Setup'));
00270
00271 print html_build_select_box_from_arrays($TZs,$TZs,'form_timezone',$row_user['timezone'], true, 'GMT');
00272 print ' '._("Timezone");
00273 print '<p class="smaller">'._("No matter where you live, you can see all dates and times as if it were in your neighborhood.").'</p>';
00274
00275 unset($i);
00276 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00277
00278 html_select_theme_box("user_theme", $row_user['theme']);
00279 print ' '._("Theme");
00280
00281 if ("rotate"==$row_user['theme'])
00282 {
00283 print '<br /><input type="checkbox" name="theme_rotate_jump" value="1" /> '._("Jump to the next theme").'';
00284 print '<input type="hidden" name="theme_rotate_numeric" value="'. $HTTP_COOKIE_VARS["SV_THEME_ROTATE_NUMERIC"] .'" />';
00285 }
00286 print '<p class="smaller">'._("Note: themes use CSS massively and can not be used without aesthetic troubles (worse in some cases) with browsers that do not offer good CSS support (such as Netscape 4.x or MSIE).").' <span class="warn">'._("You are strongly advised to use a browser like Mozilla or Konqueror if you encounter such troubles.").'</span></p>';
00287
00288 if (!theme_guidelines_check(SV_THEME))
00289 {
00290 print '<p class="smaller"><span class="warn">'._("The theme you are currently using does not follow the latest Savane CSS guidelines. As result, page layout may be more or less severely broken. It is not advised to use this theme.").' ';
00291 # If the non-valid theme is the default one, tell users they should fill
00292 # a support request
00293 if (SV_THEME == $GLOBALS['sys_themedefault'])
00294 {
00295 print utils_link($GLOBALS['sys_home'].'support/?group='.$GLOBALS['sys_unix_group_name'],
00296 sprintf(_("%s administrators should be asked to take care of Savane CSS Guidelines, since it is the default theme"), $GLOBALS['sys_name']), "warn");
00297 }
00298 print '</span></p>';
00299 }
00300
00301
00302 $i++;
00303 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00304
00305 print '<input type="checkbox" name="form_reverse_comments_order" value="1" '.(user_get_preference("reverse_comments_order") ? 'checked="checked"':'').' /> '._("Print items comments from the oldest to the latest");
00306
00307 print '<p class="smaller">'._("By default, comments are listed in reverse chronological order. This means that for a given item, comments are printed from the latest to the oldest. If this behavior does not suit you, select this option.").'</p>';
00308
00309 $i++;
00310 print $HTML->box_nextitem(utils_get_alt_row_color($i));
00311
00312 print '<input type="checkbox" name="form_email_hide" value="1" '.($row_user['email_hide'] ? 'checked="checked"':'').' /> '._("Hide email address from your account information");
00313
00314 print '<p class="smaller">'._("When checked, the only way for users to get in touch with you would be to use the form available to logged-in users. It is generally a bad idea to choose this option, especially if you are a project administrator.").'</p>';
00315
00316 print $HTML->box_bottom();
00317 print "<br />\n";
00318
00319 print html_splitpage(3);
00320
00321 print '<div class="clearr" /><div class="center"><input type="submit" name="update" value="'._("Update").'" /></div></div>';
00322
00323
00324 print '</form>';
00325
00326 $HTML->footer(array());
00327 ?>