3 * User information page
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2002-2004 (c) GForge Team
7 * Copyright 2010-2011, Franck Villaume - Capgemini
8 * http://fusionforge.org/
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once 'env.inc.php';
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'include/User.class.php';
30 $normalized_urlprefix = normalized_urlprefix();
31 $pathinfo = substr_replace(getStringFromServer('REQUEST_URI'), '', 0, strlen($normalized_urlprefix)-1);
32 $expl_pathinfo = explode('/', $pathinfo);
34 if (!$expl_pathinfo[2]) {
35 exit_error(_('No User Name Provided'));
38 $default_content_type = 'text/html';
40 $content_type = util_negociate_alternate_content_types($script, $default_content_type);
42 $username = urldecode($expl_pathinfo[2]);
44 // If restricted mode, display only people who are sharing a project with the current user.
45 if (forge_get_config('restrict_users_visibility')) {
46 if (!session_loggedin()) {
47 exit_permission_denied();
50 $s = session_get_user();
53 $user = user_get_object_by_name($username);
54 if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
55 exit_permission_denied();
59 $res = db_query_params('SELECT g1.group_id FROM user_group g1, user_group g2
62 AND g1.group_id=g2.group_id',
64 if (db_numrows($res) < 1) {
65 exit_permission_denied();
69 //get the user object based on the user_name in the URL
70 $user =& user_get_object_by_name($username);
72 if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
74 exit_error(_('That user does not exist.'));
77 // if a custom content-type is selected, then redirect to plugin's rendering
78 if($content_type != $default_content_type) {
79 $hook_params = array();
80 $hook_params['username'] = $username;
81 $hook_params['accept'] = $content_type;
82 $hook_params['return'] = '';
83 plugin_hook_by_reference('content_negociated_user_home', $hook_params);
84 if($hook_params['content_type'] != ''){
85 header('Content-type: '. $hook_params['content_type']);
86 echo $hook_params['content'];
89 header('HTTP/1.1 406 Not Acceptable',true,406);
92 } else { // default HTML view
93 $user_id = $user->getID();
95 //now show the user page
96 include $gfwww.'include/user_home.php';
102 // c-file-style: "bsd"