3 * Copyright 1999-2001 (c) VA Linux Systems
4 * http://fusionforge.org
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
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
19 * along with FusionForge; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 = @$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 // Is it a Personal wiki URL (see phpwiki plugin)
86 if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='u')) {
87 // URLs are /wiki/u/<user_name>/<page_name>
88 // Fake group_name which is in fact the user_name.
89 $group_name = $expl_pathinfo[3];
92 // Is it a Project wiki URL (see phpwiki plugin)
93 if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='g')) {
94 // URLs are /wiki/g/<user_name>/<page_name>
95 $group_name = $expl_pathinfo[3];
96 $res_grp=db_query_params ('
99 WHERE unix_group_name=$1
100 AND status IN ($2,$3)
106 // store subpage id for analyzing later
107 $subpage = @$expl_pathinfo[4];
108 $subpage2 = @$expl_pathinfo[5];
110 //set up the group_id
111 $group_id=db_result($res_grp,0,'group_id');
112 //set up a foundry object for reference all over the place
114 $grp =& group_get_object($group_id,$res_grp);
116 //this is a project - so set up the project var properly
118 //echo "IS PROJECT: ".$group_id;
119 $log_group=$group_id;
130 $sql = "INSERT INTO activity_log
131 (day,hour,group_id,browser,ver,platform,time,page,type)
132 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);";
134 $res_logger = db_query_params ($sql, array(date('Ymd'), date('H'),
135 $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
136 time(), getStringFromServer('PHP_SELF'), '0'));
141 $sys_db_is_dirty=false;
144 echo "An error occured in the logger.\n";
145 echo htmlspecialchars(db_error());