diogenes.webdav.logger.inc.php

00001 <?php
00002 /*
00003  * Copyright (C) 2003-2004 Polytechnique.org
00004  * http://opensource.polytechnique.org/
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 
00022 require_once 'diogenes/diogenes.core.logger.inc.php';
00023 
00030 class DiogenesWebDAVLogger extends DiogenesCoreLogger {
00031 
00033   var $newsession;
00034 
00036   var $sessionlength = 1800;
00037 
00045   function DiogenesWebDAVLogger($uid,$auth,$username) {
00046     global $globals;
00047 
00048     $this->DiogenesCoreLogger($uid,'',$auth,'');
00049 
00050     if ($this->newsession) {
00051       $this->log("auth_ok","{$username}@WebDAV");
00052     }
00053   }
00054 
00055 
00064   function writeSession($uid,$suid,$auth,$sauth) {
00065     global $globals;
00066 
00067     // we look for a session with the same user, auth and browser that is less
00068     // than $sessionlength seconds old
00069     $browser = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
00070     $stime = date("YmdHis",time()-$this->sessionlength);
00071     $res = $globals->db->query("select id from {$this->table_sessions} where uid='$uid' and auth='$auth' and browser='$browser' and start > $stime");
00072     
00073     if (list($session) = mysql_fetch_row($res)) {
00074        // we have an existing session
00075       $this->newsession = false;
00076     } else {
00077       // we do not have an existing session
00078       $this->newsession = true;
00079       $session = parent::writeSession($uid,$suid,$auth,$sauth);
00080     }
00081     mysql_free_result($res);
00082     return $session;
00083   }
00084 
00085 } 
00086 
00087 ?>

Generated on Fri Jan 11 01:20:08 2008 for Diogenes by  doxygen 1.5.1