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.
26 $group_id=getIntFromRequest('group_id');
27 $form_grp=getIntFromRequest('form_grp');
28 if (isset($group_id) && is_numeric($group_id) && $group_id) {
30 } else if (isset($form_grp) && is_numeric($form_grp) && $form_grp) {
32 } else if (isset($group_name) && $group_name) {
33 $group = group_get_object_by_name($group_name);
35 $log_group=$group->getID();
42 // This is a hack to allow the logger to have a group_id present
43 // for foundry and project summary pages
46 $pos = strpos (getStringFromServer('REQUEST_URI'),
47 normalized_urlprefix ());
48 if (($pos !== false) && ($pos == 0)) {
49 $pathwithoutprefix = substr (getStringFromServer('REQUEST_URI'),
50 strlen (normalized_urlprefix ()) - 1);
52 $expl_pathinfo = explode('/',$pathwithoutprefix);
53 if (($expl_pathinfo[1]=='foundry') || ($expl_pathinfo[1]=='projects')) {
54 $res_grp = db_query_params ('
57 WHERE unix_group_name=$1
58 AND status IN ($2,$3)',
59 array ($expl_pathinfo[2],
63 // store subpage id for analyzing later
64 $subpage = isset($expl_pathinfo[3])?$expl_pathinfo[3]:'';
65 $subpage2 = isset($expl_pathinfo[4]) ? $expl_pathinfo[4] : '';
68 $group_id=db_result($res_grp,0,'group_id');
69 //set up a foundry object for reference all over the place
71 $grp = group_get_object($group_id,$res_grp);
73 //this is a project - so set up the project var properly
75 //echo "IS PROJECT: ".$group_id;
85 if ($expl_pathinfo[1]=='wiki') {
86 $group_name = $expl_pathinfo[3];
87 $res_grp=db_query_params ('
90 WHERE unix_group_name=$1
97 // store subpage id for analyzing later
98 $subpage = @$expl_pathinfo[4];
99 $subpage2 = @$expl_pathinfo[5];
101 //set up the group_id
102 $group_id=db_result($res_grp,0,'group_id');
103 //set up a foundry object for reference all over the place
105 $grp = group_get_object($group_id,$res_grp);
107 //this is a project - so set up the project var properly
109 //echo "IS PROJECT: ".$group_id;
110 $log_group=$group_id;
121 $res_logger = db_query_params ('INSERT INTO activity_log
122 (day,hour,group_id,browser,ver,platform,time,page,type)
123 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)',
124 array(date('Ymd'), date('H'),
125 $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
126 time(), getStringFromServer('PHP_SELF'), '0'));
129 echo "An error occured in the logger.\n";
130 echo htmlspecialchars(db_error());