3 * Copyright 1999-2001 (c) VA Linux Systems
4 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
5 * http://fusionforge.org
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with FusionForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 $group_id=getIntFromRequest('group_id');
28 $form_grp=getIntFromRequest('form_grp');
29 if (isset($group_id) && is_numeric($group_id) && $group_id) {
31 } else if (isset($form_grp) && is_numeric($form_grp) && $form_grp) {
33 } else if (isset($group_name) && $group_name) {
34 $group = group_get_object_by_name($group_name);
36 $log_group=$group->getID();
43 // This is a hack to allow the logger to have a group_id present
44 // for foundry and project summary pages
47 $pos = strpos (getStringFromServer('REQUEST_URI'),
48 normalized_urlprefix ());
49 if (($pos !== false) && ($pos == 0)) {
50 $pathwithoutprefix = substr (getStringFromServer('REQUEST_URI'),
51 strlen (normalized_urlprefix ()) - 1);
53 $expl_pathinfo = explode('/',$pathwithoutprefix);
54 if (($expl_pathinfo[1]=='foundry') || ($expl_pathinfo[1]=='projects')) {
55 $res_grp = db_query_params ('
58 WHERE unix_group_name=$1
59 AND status IN ($2,$3)',
60 array ($expl_pathinfo[2],
64 // store subpage id for analyzing later
65 $subpage = isset($expl_pathinfo[3])?$expl_pathinfo[3]:'';
66 $subpage2 = isset($expl_pathinfo[4]) ? $expl_pathinfo[4] : '';
69 $group_id=db_result($res_grp,0,'group_id');
70 //set up a foundry object for reference all over the place
72 $grp = group_get_object($group_id,$res_grp);
74 //this is a project - so set up the project var properly
76 //echo "IS PROJECT: ".$group_id;
86 // Is it a Personal wiki URL (see phpwiki plugin)
87 if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='u')) {
88 // URLs are /wiki/u/<user_name>/<page_name>
89 // Fake group_name which is in fact the user_name.
90 $group_name = $expl_pathinfo[3];
93 // Is it a Project wiki URL (see phpwiki plugin)
94 if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='g')) {
95 // URLs are /wiki/g/<user_name>/<page_name>
96 $group_name = $expl_pathinfo[3];
97 $res_grp=db_query_params ('
100 WHERE unix_group_name=$1
101 AND status IN ($2,$3)
107 // store subpage id for analyzing later
108 $subpage = @$expl_pathinfo[4];
109 $subpage2 = @$expl_pathinfo[5];
111 //set up the group_id
112 $group_id=db_result($res_grp,0,'group_id');
113 //set up a foundry object for reference all over the place
115 $grp = group_get_object($group_id,$res_grp);
117 //this is a project - so set up the project var properly
119 //echo "IS PROJECT: ".$group_id;
120 $log_group=$group_id;
131 $sql = "INSERT INTO activity_log
132 (day,hour,group_id,browser,ver,platform,time,page,type)
133 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);";
135 $res_logger = db_query_params ($sql, array(date('Ymd'), date('H'),
136 $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
137 time(), getStringFromServer('PHP_SELF'), '0'));
142 $sys_db_is_dirty=false;
145 echo "An error occured in the logger.\n";
146 echo htmlspecialchars(db_error());