3 * User information page
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2002-2004 (c) GForge Team
7 * Copyright 2010 (c) Franck Villaume - Capgemini
8 * http://fusionforge.org/
10 * This file is part of FusionForge.
12 * FusionForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with FusionForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once 'env.inc.php';
28 require_once $gfcommon.'include/pre.php';
29 require_once $gfcommon.'include/User.class.php';
31 $normalized_urlprefix = normalized_urlprefix();
32 $pathinfo = substr_replace(getStringFromServer('REQUEST_URI'), '', 0, strlen($normalized_urlprefix)-1);
33 $expl_pathinfo = explode('/', $pathinfo);
35 if (!$expl_pathinfo[2]) {
36 exit_error(_('No User Name Provided'));
39 $default_content_type = 'text/html';
41 // Invoke plugins' hooks 'script_accepted_types' to discover which alternate content types they would accept for /users/...
42 $hook_params = array();
43 $hook_params['script'] = 'user_home';
44 $hook_params['accepted_types'] = array();
45 plugin_hook_by_reference('script_accepted_types', $hook_params);
46 if(isset($hook_params['accepted_types'])){
47 // By default, text/html is accepted
48 $accepted_types = array($default_content_type);
49 $new_accepted_types = $hook_params['accepted_types'];
50 $accepted_types = array_merge($accepted_types, $new_accepted_types);
52 // PEAR::HTTP (for negotiateMimeType())
53 require_once('HTTP.php');
55 // negociate accepted content-type depending on the preferred ones declared by client
57 $content_type = $http->negotiateMimeType($accepted_types,'text/html');
60 $content_type = $default_content_type;
63 $username = urldecode($expl_pathinfo[2]);
65 //get the user object based on the user_name in the URL
66 $user =& user_get_object_by_name( $username );
68 if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
70 exit_error(_('That user does not exist.'));
73 // if a custom content-type is selected, then redirect to plugin's rendering
74 if($content_type != $default_content_type) {
75 $hook_params = array();
76 $hook_params['username'] = $username;
77 $hook_params['accept'] = $content_type;
78 $hook_params['return'] = '';
79 plugin_hook_by_reference('content_negociated_user_home', $hook_params);
80 if($hook_params['content_type'] != ''){
81 header('Content-type: '. $hook_params['content_type']);
82 echo $hook_params['content'];
84 } else { // default HTML view
85 $user_id = $user->getID();
87 //now show the user page
88 include $gfwww.'include/user_home.php';
94 // c-file-style: "bsd"