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] : '';
75 global $RESTPATH_PROJECTS_GROUP_ID;
76 global $RESTPATH_PROJECTS_PROJECT;
79 $group_id=db_result($res_grp,0,'group_id');
81 //set up a foundry object for reference all over the place
83 $grp = group_get_object($group_id,$res_grp);
85 //this is a project - so set up the project var properly
87 //echo "IS PROJECT: ".$group_id;
91 // This will later be used in the www/projects for instance
92 $RESTPATH_PROJECTS_PROJECT = $project;
93 $RESTPATH_PROJECTS_GROUP_ID = $group_id;
95 global $RESTPATH_PROJECTS_SUBPAGE;
96 $RESTPATH_PROJECTS_SUBPAGE = $subpage;
98 global $RESTPATH_PROJECTS_SUBPAGE2;
99 $RESTPATH_PROJECTS_SUBPAGE2 = $subpage2;
102 $RESTPATH_PROJECTS_GROUP_ID = -1;
107 if ($expl_pathinfo[1]=='wiki') {
108 $group_name = $expl_pathinfo[3];
109 $res_grp=db_query_params ('
112 WHERE unix_group_name=$1
113 AND status IN ($2,$3)
119 //set up the group_id
120 $group_id=db_result($res_grp,0,'group_id');
121 //set up a foundry object for reference all over the place
123 $grp = group_get_object($group_id,$res_grp);
125 //this is a project - so set up the project var properly
127 //echo "IS PROJECT: ".$group_id;
128 $log_group=$group_id;
135 $res_logger = db_query_params ('INSERT INTO activity_log
136 (day,hour,group_id,browser,ver,platform,time,page,type)
137 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)',
138 array(date('Ymd'), date('H'),
139 $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
140 time(), getStringFromServer('PHP_SELF'), '0'));
143 echo "An error occured in the logger.\n";
144 echo htmlspecialchars(db_error());