From e31c1c3e1b5aae164cac8ce6d7d1fdd5f4932d7f Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Tue, 25 Mar 2008 19:10:31 +0100 Subject: [PATCH] Add 'view_profile' and 'search' actions in logger. * view_profile action logged valid profile viewed. * search logged all quick and advanced search with the text (or variables) of the query Signed-off-by: Florent Bruneau --- modules/profile.php | 3 +++ modules/search.php | 6 ++++++ upgrade/0.9.16/10_logger.sql | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 upgrade/0.9.16/10_logger.sql diff --git a/modules/profile.php b/modules/profile.php index fc6bd7d..d8780f2 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -208,6 +208,9 @@ class ProfileModule extends PLModule } return PL_NOT_FOUND; } + if (S::logged()) { + $_SESSION['log']->log('view_profile', $login); + } $new = Env::v('modif') == 'new'; $user = get_user_details($login, S::v('uid'), $view); diff --git a/modules/search.php b/modules/search.php index f74b4f5..8add5af 100644 --- a/modules/search.php +++ b/modules/search.php @@ -89,6 +89,9 @@ class SearchModule extends PLModule if (Env::has('quick') || $action == 'geoloc') { $quick = trim(Env::v('quick')); + if (S::logged() && !Env:has('page')) { + $_SESSION['log']->log('search', 'quick=' . $quick); + } $list = 'profile|prf|fiche|fic|referent|ref|mentor'; if (S::has_perms()) { $list .= '|admin|adm|ax'; @@ -180,6 +183,9 @@ class SearchModule extends PLModule 'school' => array('field' => 'id', 'table' => 'applis_def', 'text' => 'text', 'exact' => false), 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false) ); + if (!Env::has('page')) { + $_SESSION['log']->log('search', 'adv=' . var_export($_GET, true)); + } foreach ($textFields as $field=>&$query) { if (!Env::v($field) && Env::v($field . 'Txt')) { $res = XDB::query("SELECT {$query['field']} diff --git a/upgrade/0.9.16/10_logger.sql b/upgrade/0.9.16/10_logger.sql new file mode 100644 index 0000000..5be5ad2 --- /dev/null +++ b/upgrade/0.9.16/10_logger.sql @@ -0,0 +1,5 @@ +INSERT INTO logger.actions (text, description) + VALUES ('view_profile', 'Consultation d\'une fiche'), + ('search', 'Réalisation d\'une recherche'); + +# vim:set syntax=mysql: -- 2.1.4