Add 'view_profile' and 'search' actions in logger.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 25 Mar 2008 18:10:31 +0000 (19:10 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 25 Mar 2008 18:12:31 +0000 (19:12 +0100)
  * 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 <florent.bruneau@polytechnique.org>
modules/profile.php
modules/search.php
upgrade/0.9.16/10_logger.sql [new file with mode: 0644]

index fc6bd7d..d8780f2 100644 (file)
@@ -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);
index f74b4f5..8add5af 100644 (file)
@@ -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 (file)
index 0000000..5be5ad2
--- /dev/null
@@ -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: