ENT_QUOTES, "UTF-8");
}
+/**
+ * TODO: Enter description here ...
+ * @param unknown_type $script
+ * @param unknown_type $default_content_type
+ * @return Ambiguous
+ */
+function util_negociate_alternate_content_types($script, $default_content_type) {
+
+ // Invoke plugins' hooks 'script_accepted_types' to discover which alternate content types they would accept for /users/...
+ $hook_params = array();
+ $hook_params['script'] = $script;
+ $hook_params['accepted_types'] = array();
+ plugin_hook_by_reference('script_accepted_types', $hook_params);
+ if (count($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);
+ } else {
+ $content_type = $default_content_type;
+ }
+ return $content_type;
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
Package: @OLDPACKAGE@-web-apache2
Architecture: all
-Depends: @OLDPACKAGE@-common, @OLDPACKAGE@-db-postgresql | @OLDPACKAGE@-db, libapache2-mod-php5, php5-cgi, php5-pgsql, php5-gd, perl, libdbi-perl, libdbd-pg-perl, debianutils (>= 1.7), debconf (>= 1.0.32) | debconf-2.0, ucf, cronolog, python, ssl-cert, libnusoap-php, libphp-simplepie, libjs-yui, libjs-scriptaculous, libjs-jquery, libjs-jquery-tipsy, libphp-jpgraph, ${misc:Depends}
+Depends: @OLDPACKAGE@-common, @OLDPACKAGE@-db-postgresql | @OLDPACKAGE@-db, libapache2-mod-php5, php5-cgi, php5-pgsql, php5-gd, perl, libdbi-perl, libdbd-pg-perl, debianutils (>= 1.7), debconf (>= 1.0.32) | debconf-2.0, ucf, cronolog, python, ssl-cert, libnusoap-php, libphp-simplepie, php-http, libjs-yui, libjs-scriptaculous, libjs-jquery, libjs-jquery-tipsy, libphp-jpgraph, ${misc:Depends}
Recommends: locales | locales-all
Provides: @OLDPACKAGE@-web
Conflicts: @OLDPACKAGE@-web
//
$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'] = 'project_home';
-$hook_params['accepted_types'] = array();
-plugin_hook_by_reference('script_accepted_types', $hook_params);
-if (count($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');
-} else {
- $content_type = $default_content_type;
-}
+$script='project_home';
+$content_type = util_negociate_alternate_content_types($script, $default_content_type);
if (!$group_id || !$project) {
exit_no_group();
$hook_params['groupname'] = $project->getUnixName();
$hook_params['accept'] = $content_type;
$hook_params['return'] = '';
+ $hook_params['content_type'] = '';
plugin_hook_by_reference('content_negociated_project_home', $hook_params);
if($hook_params['content_type'] != ''){
header('Content-type: '. $hook_params['content_type']);
echo $hook_params['content'];
}
+ else {
+ header('HTTP/1.1 406 Not Acceptable',true,406);
+ exit(0);
+ }
} else {
//show the project summary page
include $gfwww.'include/project_home.php';
$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'] = array();
-plugin_hook_by_reference('script_accepted_types', $hook_params);
-if(count($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');
-} else {
- $content_type = $default_content_type;
-}
+$default_content_type = 'text/html';
+$script='user_home';
+$content_type = util_negociate_alternate_content_types($script, $default_content_type);
$username = urldecode($expl_pathinfo[2]);
header('Content-type: '. $hook_params['content_type']);
echo $hook_params['content'];
}
+ else {
+ header('HTTP/1.1 406 Not Acceptable',true,406);
+ exit(0);
+ }
} else { // default HTML view
$user_id = $user->getID();