3 * Copyright 1999-2001 (c) VA Linux Systems
4 * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
5 * http://fusionforge.org
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 $group_id=getIntFromRequest('group_id');
28 $form_grp=getIntFromRequest('form_grp');
32 if (isset($group_id) && is_numeric($group_id) && $group_id) {
34 } elseif (isset($form_grp) && is_numeric($form_grp) && $form_grp) {
36 } elseif (isset($group_name) && $group_name) {
37 $group = group_get_object_by_name($group_name);
39 $log_group=$group->getID();
44 // This is a hack to allow the logger to have a group_id present
45 // for foundry and project summary pages
48 $pos = strpos (getStringFromServer('REQUEST_URI'),
49 normalized_urlprefix ());
50 if (($pos !== false) && ($pos == 0)) {
51 $pathwithoutprefix = substr (getStringFromServer('REQUEST_URI'),
52 strlen (normalized_urlprefix ()) - 1);
54 $pathwithoutprefix_exploded = explode('?', $pathwithoutprefix);
55 $pathwithoutprefix = $pathwithoutprefix_exploded[0];
56 $expl_pathinfo = explode('/',$pathwithoutprefix);
57 if (($expl_pathinfo[1]=='foundry') || ($expl_pathinfo[1]=='projects')) {
58 $group_name = $expl_pathinfo[2];
60 $res_grp = db_query_params ('
63 WHERE unix_group_name=$1
64 AND status IN ($2,$3)',
69 // store subpage id for analyzing later
70 // This will later be used in the www/projects for instance
71 $subpage = isset($expl_pathinfo[3]) ? $expl_pathinfo[3] : '';
72 $subpage2 = isset($expl_pathinfo[4]) ? $expl_pathinfo[4] : '';
74 global $RESTPATH_PROJECTS_GROUP_ID;
75 global $RESTPATH_PROJECTS_PROJECT;
78 $group_id=db_result($res_grp,0,'group_id');
80 //set up a foundry object for reference all over the place
82 $grp = group_get_object($group_id,$res_grp);
84 //this is a project - so set up the project var properly
86 //echo "IS PROJECT: ".$group_id;
90 // This will later be used in the www/projects for instance
91 $RESTPATH_PROJECTS_PROJECT = $project;
92 $RESTPATH_PROJECTS_GROUP_ID = $group_id;
94 global $RESTPATH_PROJECTS_SUBPAGE;
95 $RESTPATH_PROJECTS_SUBPAGE = $subpage;
97 global $RESTPATH_PROJECTS_SUBPAGE2;
98 $RESTPATH_PROJECTS_SUBPAGE2 = $subpage2;
101 $RESTPATH_PROJECTS_GROUP_ID = -1;
106 if ($expl_pathinfo[1]=='wiki') {
107 $group_name = $expl_pathinfo[3];
108 $res_grp=db_query_params ('
111 WHERE unix_group_name=$1
112 AND status IN ($2,$3)
118 //set up the group_id
119 $group_id=db_result($res_grp,0,'group_id');
120 //set up a foundry object for reference all over the place
122 $grp = group_get_object($group_id,$res_grp);
124 //this is a project - so set up the project var properly
126 //echo "IS PROJECT: ".$group_id;
127 $log_group=$group_id;
134 $res_logger = db_query_params ('INSERT INTO activity_log
135 (day,hour,group_id,browser,ver,platform,time,page,type)
136 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)',
137 array(date('Ymd'), date('H'),
138 $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
139 time(), getStringFromServer('PHP_SELF'), '0'));
142 echo "An error occured in the logger.\n";
143 echo htmlspecialchars(db_error());