require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'include/User.class.php';
-// PEAR::HTTP (for negotiateMimeType())
-require_once('HTTP.php');
-
$normalized_urlprefix = normalized_urlprefix();
$pathinfo = substr_replace(getStringFromServer('REQUEST_URI'), '', 0, strlen($normalized_urlprefix)-1);
$expl_pathinfo = explode('/', $pathinfo);
exit_error(_('No User Name Provided'));
}
-// By default, text/html is accepted
-$accepted_types = array('text/html');
+$default_content_type = 'text/html';
// Invoke plugins' hooks 'script_accepted_types' to discover which alternate content types they would accept for /users/...
$hook_params = array();
$hook_params['script'] = 'user_home';
-$hook_params['accepted_types'] = $accepted_types;
+$hook_params['accepted_types'] = array();
plugin_hook_by_reference('script_accepted_types', $hook_params);
if(isset($hook_params['accepted_types'])){
- $accepted_types = $hook_params['accepted_types'];
-}
+ // By default, text/html is accepted
+ $accepted_types = array($default_content_type);
+ $new_accepted_types = $hook_params['accepted_types'];
+ $accepted_types = array_merge(accepted_types, $new_accepted_types);
+
+ // PEAR::HTTP (for negotiateMimeType())
+ require_once('HTTP.php');
-// negociate accepted content-type depending on the preferred ones declared by client
-$http=new HTTP();
-$content_type = $http->negotiateMimeType($accepted_types,'text/html');
+ // negociate accepted content-type depending on the preferred ones declared by client
+ $http=new HTTP();
+ $content_type = $http->negotiateMimeType($accepted_types,'text/html');
+}
+else {
+ $content_type = $default_content_type;
+}
$username = urldecode($expl_pathinfo[2]);
} else {
// if a custom content-type is selected, then redirect to plugin's rendering
- if($content_type != 'text/html') {
+ if($content_type != $default_content_type) {
$hook_params = array();
$hook_params['username'] = $username;
$hook_params['accept'] = $content_type;