Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

logdb.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  This program is free software; you can redistribute it and/or
00004  modify it under the terms of the GNU General Public License
00005  as published by the Free Software Foundation; either version 2
00006  of the License, or (at your option) any later version.
00007 
00008  This program is distributed in the hope that it will be useful,
00009  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  GNU General Public License for more details.
00012 
00013  You should have received a copy of the GNU General Public License
00014  along with this program; if not, write to the Free Software
00015  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016  ***************************************************************************/
00017 
00021 class LogDB
00022 {
00023     var $oDB;   
00024     var $oUser; 
00025 
00032     function LogDB ( &$oDB, &$oUser )
00033     {
00034         $this->oDB =& $oDB;
00035         $this->oUser =& $oUser;
00036         return true;
00037     }
00038 
00042     function flag2text( $intFlag )
00043     {
00044         switch( $intFlag )
00045         {
00046             case 1:  return( 'Debug' );         break;
00047             case 2:  return( '' );              break;
00048             case 3:  return( 'User' );          break;
00049             case 4:  return( 'Gilden' );        break;
00050             case 5:  return( 'St&auml;dte' );   break;
00051             case 6:  return( 'Import' );        break;
00052             case 7:  return( 'Gruppe' );        break;
00053             case 10: return( 'Fehler' );        break;
00054             case 11: return( 'Fehler:Config' ); break;
00055             case 12: return( 'Fehler:SQL' );    break;
00056       }
00057       return( '' );
00058     }
00059     /********************************************************
00060      Log - Funktionen (flag + code = optional)
00061 
00062      flag: 0 = unbekannt            Log-Eintraege
00063            1 = Debug
00064            2 = normal
00065            3 = Usermanagement
00066            4 = Gildenmanagement
00067            5 = Staedtemanagement
00068            6 = Import
00069 
00070            10 = normaler Fehler     Fehler-Eintraege
00071            11 = Config-Fehler
00072            12 = SQL-Fehler
00073 
00074       code: Integer - aktuell unbenutzt
00075      ********************************************************/
00076 
00077     function write( $strText, $intFlag = NULL, $intCode = NULL )
00078     {
00079         $strQuery = "INSERT INTO ".$this->oDB->tblActionlog." SET ";
00080 
00081         // Userid feststellen
00082         $strQuery .= "user_id='" . intval($this->oUser->intUserID) . "',";
00083 
00084         // modulname feststellen
00085         $strQuery .= "modul='" . $_SERVER['PHP_SELF'] . "',";
00086 
00087         // ip
00088         $strQuery .= "ip='" . getenv('REMOTE_ADDR') . "',";
00089 
00090         // browser
00091         $strQuery .= "browser='" . $_SERVER['HTTP_USER_AGENT'] . "',";
00092 
00093         // code - Eintrag
00094         if( isset( $intCode ) )
00095         {
00096             $strQuery .= 'code=' . $intCode . ',';
00097         }
00098 
00099         // text - Eintrag
00100         if( isset( $strText ) ) {
00101           $strQuery .= "message='" . $strText . "',";
00102         }
00103 
00104         // flag - Eintrag
00105         $strQuery .= "flag=" . ( ( isset( $intFlag ) ) ? $intFlag : 2 ) . ",";
00106 
00107         // Log-Eintrag schreiben
00108         $strQuery .= "time='".time()."';";
00109         $this->oDB->query( $strQuery );
00110     }
00111 
00112     function setUData ( &$aUData )
00113     {
00114         $this->aUData =& $aUData;
00115     }
00116 }

Generated on Sun May 8 19:29:45 2005 for PhpMap by  doxygen 1.4.2