Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 23. október 2026

Rozdiely pre phpWebLogAnalyzer/phpWebLogAnalyzer.inc.php medzi verziami 1.28 a 1.29

verzia 1.28, 2002/04/03 20:33:26 verzia 1.29, 2002/04/15 19:47:17
Riadok 347  class Web_Log {
Riadok 347  class Web_Log {
         }          }
   
         /*          /*
            * destroy()
            *
            * Destructor. Must be called.
            */
   
           function destroy()
           {
                   if (isset($this->_db)) {
                           $this->_db->disconnect();
                           unset($this->_db);
                   }
           }
   
           /*
          * setSessionTimeout(), getSessionTimeout()           * setSessionTimeout(), getSessionTimeout()
          *           *
          * Sets/gets session timeout. Session timeout is a maximum delay between           * Sets/gets session timeout. Session timeout is a maximum delay between
Riadok 402  class Web_Log {
Riadok 416  class Web_Log {
         }          }
   
         /*          /*
          * enableShortNames(), disableShortNames()           * enableTruncateNames(), disableTruncateNames()
          *           *
          * Enable/disable of short IP addresses and hostnames usage.           * Enable/disable of short IP addresses and hostnames usage.
          */           */
Riadok 436  class Web_Log {
Riadok 450  class Web_Log {
         }          }
   
         /*          /*
            * getPropertyValue(), setPropertyValue(), clearPropertyValue()
            *
            * Gets/sets specific property value. Property cannot be disabled.
            */
   
           function getPropertyValue($prop_name)
           {
                   if (isset($this->_props[$prop_name])) {
                           if ($this->_props[$prop_name]['disabled'])
                                   return false;
   
                           return $this->_props[$prop_name]['value'];
                   }
   
                   return false;
           }
   
           function setPropertyValue($value)
           {
                   if (isset($this->_props[$prop_name])) {
                           $this->_props[$prop_name]['value'] = $value;
                           return true;
                   }
   
                   return false;
           }
   
           function clearPropertyValue($value)
           {
                   if (isset($this->_props[$prop_name])) {
                           if (isset($this->_props[$prop_name]['value']))
                                   unset($this->_props[$prop_name]['value']);
                           return true;
                   }
   
                   return false;
           }
   
           /*
          * enableAllProperties(), disableAllProperties()           * enableAllProperties(), disableAllProperties()
          *           *
          * Enable/disable loging of all properties.           * Enable/disable loging of all properties.
Riadok 446  class Web_Log {
Riadok 499  class Web_Log {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['disabled'] = false;                          $this->_props[$property]['disabled'] = false;
                 }                  }
   
                   return true;
         }          }
   
         function disableAllProperties()          function disableAllProperties()
Riadok 453  class Web_Log {
Riadok 508  class Web_Log {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['disabled'] = true;                          $this->_props[$property]['disabled'] = true;
                 }                  }
   
                   return true;
         }          }
   
         /*          /*
          * getPropertyValue(), setPropertyValue()           * setAllProperties(), clearAllProperties()
          *           *
          * Gets/sets specific property value. Property cannot be disabled.           * Clear all properties.
          */           */
   
         function getPropertyValue($prop_name)          function setAllProperties()
         {          {
                 if ($this->_props[$prop_name]['disabled']) {                  return $this->setValues();
                         return false;  
                 }  
   
                 return $this->_props[$prop_name]['value'];  
         }          }
   
         function setPropertyValue($value)          function clearAllProperties()
         {          {
                 //if (! $this->_props[$prop_name]['disabled'])                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$prop_name]['value'] = $value;                          if (isset($this->_props[$property]['value']))
                                   unset($this->_props[$property]['value']);
                   }
   
                   return true;
         }          }
   
         /*          /*
Riadok 576  class Web_Log {
Riadok 633  class Web_Log {
         }          }
   
         /*          /*
          * registerAccess()          * _setXxxValues()
          *          *
          * Register access. Insert one record to accesses table.          * Sets properties values.
          * Also insert records into another tables if it is neccessary.          */
          */  
   
         function registerAccess($value = 0)          function _setBasicValues()
         {          {
                 if ($this->_checkDB() == false)  
                         return $this->_db;  
   
                 global $HTTP_SERVER_VARS;                  global $HTTP_SERVER_VARS;
                 global $HTTP_ENV_VARS;                  global $HTTP_ENV_VARS;
   
Riadok 609  class Web_Log {
Riadok 662  class Web_Log {
                         }                          }
                 }                  }
   
                   return true;
           }
   
           function _setHostValues()
           {
                   global $HTTP_SERVER_VARS;
   
                 /*                  /*
                  * IP address & proxy server getting.                   * IP address & proxy server getting.
                  */                   */
Riadok 662  class Web_Log {
Riadok 722  class Web_Log {
                         }                          }
                 }                  }
   
                   return true;
           }
   
           function _setIdentValues()
           {
                   global $HTTP_SERVER_VARS;
   
                   $remote_addr = stripslashes(
                                   ! empty($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])
                                   ? $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]
                                   : $HTTP_SERVER_VARS["REMOTE_ADDR"]
                                   );
   
                   /* if multiple hosts presents, get the first one */
                   if (strchr($remote_addr, ',')) {
                           $remote_addr = explode(',', $remote_addr);
                           $remote_addr = trim($remote_addr[0]);
                   }
   
                 /*                  /*
                  * Ident protocol stuff.                   * Ident protocol stuff.
                  */                   */
Riadok 684  class Web_Log {
Riadok 763  class Web_Log {
                         }                          }
                 }                  }
   
                 /*                  return true;
                  * Value property processing.          }
                  */  
   
           function _setValueValue($value = 0)
           {
                 if (! $this->_props['value']['disabled'])                  if (! $this->_props['value']['disabled'])
                         $this->_props['value']['value'] = $value;                          $this->_props['value']['value'] = $value;
   
                   return true;
           }
   
           function _setIDs()
           {
                 /*                  /*
                  * Counting IDs according to values.                   * Counting IDs according to values.
                  */                   */
   
                 if (! $this->_raw_log) {                  foreach (array_keys($this->_props) as $prop_name) {
                         foreach (array_keys($this->_props) as $prop_name) {                          if (isset($this->_props[$prop_name]['value'])) {
                                 if (isset($this->_props[$prop_name]['value'])) {  
   
                                         if (! empty($this->_props[$prop_name]['table'])) {                                  if (! empty($this->_props[$prop_name]['table'])) {
                                                 $id = $this->_getID(                                          $id = $this->_getID(
                                                                 $this->_props[$prop_name]['table'],                                                          $this->_props[$prop_name]['table'],
                                                                 $this->_props[$prop_name]['value']);                                                          $this->_props[$prop_name]['value']);
   
                                                 if (DB::isError($id))                                          if (DB::isError($id))
                                                         return $id;                                                  return $id;
   
                                                 if (intval($id))                                          if (intval($id))
                                                         $this->_props[$prop_name]['id'] = $id;                                                  $this->_props[$prop_name]['id'] = $id;
                                         }                                  }
                                         else {                                  else {
                                                 $this->_props[$prop_name]['id'] =                                          $this->_props[$prop_name]['id'] =
                                                         $this->_props[$prop_name]['value'];                                                  $this->_props[$prop_name]['value'];
                                         }  
                                 }                                  }
                         }                          }
                 }                  }
   
                 /*                  return true;
                  * Session property. It is counted according to other IDs,          }
                  * so it must be after others IDs counting loop above.  
                  */  
   
           function _setSessionIDValue()
           {
                 if (! $this->_props['session_id']['disabled']) {                  if (! $this->_props['session_id']['disabled']) {
                         $session_id = $this->_getSessionID();                          $session_id = $this->_getSessionID();
   
Riadok 735  class Web_Log {
Riadok 818  class Web_Log {
                                         $session_id;                                          $session_id;
                 }                  }
   
                 /*                  return true;
                  * Datetime property. It doesn't contain real value,          }
                  * but SQL clausule for getting datetime.  
                  *  
                  * TODO: make it database independent (or sysdate() is?)  
                  */  
   
           function _setDatetimeValue()
           {
                   /* TODO: make this database independent (or sysdate() is?) */
                 if (! $this->_props['datetime']['disabled'])                  if (! $this->_props['datetime']['disabled'])
                         $this->_props['datetime']['id'] =                          $this->_props['datetime']['id'] =
                                 $this->_props['datetime']['value'] =                                  $this->_props['datetime']['value'] =
                                 'SYSDATE()';                                  'SYSDATE()';
           }
   
   
           /*
            * setValues()
            *
            * Set all enabled properties values.
            */
   
           function setValues($value = 0)
           {
                   if ($this->_checkDB() == false)
                           return $this->_db;
   
                   /* Set basic values */
                   $this->_setBasicValues();
   
                   /* Setting basic host values such as remote_host, remote_addr,
                      proxy_host, proxy_addr */
                   $this->_setHostValues();
   
                   /* Setting ident protocol values: ident_username, ident_ostype */
                   $this->_setIdentValues();
   
                   /* Value property */
                   $this->_setValueValue($value);
   
                   /* If raw log is enabled, set appropriate IDs according to values */
                   if (! $this->_raw_log) {
                           $this->_setIDs();
                   }
   
                   /* Session property. It is counted according to other IDs,
                      so it must be after others IDs counting loop above. */
                   $this->_setSessionIDValue();
   
                   /* Datetime property. It doesn't contain real value,
                      but SQL clausule for getting datetime. */
                   $this->_setDatetimeValue();
   
                   return true;
           }
   
           /*
            * registerAccess()
            *
            * Register access. Insert one record to accesses table.
            * Also insert records into another tables if it is neccessary.
            */
   
           function registerAccess($value = 0)
           {
                   /*
                    * Setting values
                    */
                   $this->setValues($value);
   
                 $keys = '';                  $keys = '';
                 $vals = '';                  $vals = '';
Riadok 754  class Web_Log {
Riadok 892  class Web_Log {
                         $sep = ($keys == '' ? '' : ', ');                          $sep = ($keys == '' ? '' : ', ');
                         $val = '';                          $val = '';
   
                         /* commented code is not neccessary */  
                         if ($this->_raw_log) {                          if ($this->_raw_log) {
                                 if (isset($this->_props[$prop_name]['value'])                                  if (isset($this->_props[$prop_name]['value'])
                                                 && ! empty($this->_props[$prop_name]['value'])) {                                                  && ! empty($this->_props[$prop_name]['value'])) {
Riadok 798  class Web_Log {
Riadok 935  class Web_Log {
   
                 if (DB::isError($result = $this->_db->query($query))) {                  if (DB::isError($result = $this->_db->query($query))) {
                         return $result;                          return $result;
                         //$this->_error($result->getMessage());  
                 }                  }
   
                 $this->_db->disconnect();                  return true;
                 unset($this->_db);  
   
                 return;  
         }          }
   
         /*          /*
Riadok 816  class Web_Log {
Riadok 949  class Web_Log {
   
         function _getID($table, $value)          function _getID($table, $value)
         {          {
                 if ($this->_checkDB() == false)  
                         return $this->_db;  
   
                 for ($i = 0; $i < 2; $i++) {                  for ($i = 0; $i < 2; $i++) {
   
                         // TODO: LIMIT is MySQL dependent? Yes it is!                          // TODO: LIMIT is MySQL dependent? Yes it is!
                         // use appropriate PEAR DB method                          // use appropriate PEAR DB method
                         $query = sprintf('SELECT id FROM %s'                          $query = sprintf('SELECT id FROM %s'
                                         .' WHERE value = "%s"'                                          .' WHERE value = "%s"'
                                         .' LIMIT 1',                                          /*.' LIMIT 1'*/,
                                         $table, $this->_db->quoteString(                                          $table, $this->_db->quoteString(
                                                 substr($value, 0, WEB_LOG_VALUE_SUBSTR_LENGTH)));                                                  substr($value, 0, WEB_LOG_VALUE_SUBSTR_LENGTH)));
   
Riadok 897  class Web_Log {
Riadok 1027  class Web_Log {
          */           */
         function _getSessionID()          function _getSessionID()
         {          {
                 if ($this->_checkDB() == false)  
                         return $this->_db;  
   
                 $where = '';                  $where = '';
                 foreach ($this->_session_keys as $session_key) {                  foreach ($this->_session_keys as $session_key) {
                         if (isset($this->_props[$session_key])) {                          if (isset($this->_props[$session_key])) {

Legend:
Odstranené z verzie1.28  
zmenené riadky
  Pridané vo verzii1.29

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok