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.36 a 1.37

verzia 1.36, 2002/07/25 17:28:10 verzia 1.37, 2002/07/27 19:00:42
Riadok 62 
Riadok 62 
  *            - with usage of methods above convert() method for conversion   *            - with usage of methods above convert() method for conversion
  *              from raw log into normal implemented   *              from raw log into normal implemented
  * 25/07/2002 - getAccessesCount() implemeneted on basis of method   * 25/07/2002 - getAccessesCount() implemeneted on basis of method
  *              getSesssionsCount(); redunand code was moved to _getCounts()   *              getSesssionsCount(); redunand code was moved to _getCount()
    * 27/07/2002 - fixed ugly bug in when doing convert(); property values was
    *              cleared by clearAllProperties(), but IDs wasn't
    *            - little method reorganization around manipulation with props
    *            - code cleanup
  */   */
   
 define('WEB_LOG_VALUE_SUBSTR_LENGTH',          255);  define('WEB_LOG_VALUE_SUBSTR_LENGTH',          255);
Riadok 357  class Web_Log {
Riadok 361  class Web_Log {
                 if (empty($session_timeout))                  if (empty($session_timeout))
                         $session_timeout = WEB_LOG_SESSION_TIMEOUT_DEFAULT;                          $session_timeout = WEB_LOG_SESSION_TIMEOUT_DEFAULT;
   
                 $this->_session_timeout   = $session_timeout;                  $this->_session_timeout   = intval($session_timeout);
                 $this->_raw_log           = WEB_LOG_RAW_LOG_DEFAULT;                  $this->_raw_log           = WEB_LOG_RAW_LOG_DEFAULT;
                 $this->_truncate_names    = WEB_LOG_TRUNCATE_NAMES_DEFAULT;                  $this->_truncate_names    = WEB_LOG_TRUNCATE_NAMES_DEFAULT;
                 $this->_truncate_qstrings = WEB_LOG_TRUNCATE_QUERY_STRINGS_DEFAULT;                  $this->_truncate_qstrings = WEB_LOG_TRUNCATE_QUERY_STRINGS_DEFAULT;
Riadok 376  class Web_Log {
Riadok 380  class Web_Log {
                 }                  }
   
                 foreach (array_keys($this->_props) as $prop) {                  foreach (array_keys($this->_props) as $prop) {
                         $this->_props[$prop]['enabled'] = true;                          $this->_props[$prop]['enabled']       = true;
                         $this->_props[$prop]['enabled_cache'] = false;                          $this->_props[$prop]['enabled_cache'] = false;
                 }                  }
         }          }
Riadok 405  class Web_Log {
Riadok 409  class Web_Log {
   
         function setSessionTimeout($timeout)          function setSessionTimeout($timeout)
         {          {
                 $this->_session_timeout = $timeout;                  $this->_session_timeout = intval($timeout);
         }          }
   
         function getSessionTimeout()          function getSessionTimeout()
Riadok 424  class Web_Log {
Riadok 428  class Web_Log {
         {          {
                 if (is_array($keys)) {                  if (is_array($keys)) {
                         $this->_session_keys = $keys;                          $this->_session_keys = $keys;
                 }                  } elseif (is_string($keys)) {
                 elseif (is_string($keys)) {  
                         // TODO: REMOVE ME!  
                         //$this->_session_keys = array($keys);  
                         array_push($this->_session_keys, $keys);                          array_push($this->_session_keys, $keys);
                 }                  }
         }          }
Riadok 494  class Web_Log {
Riadok 495  class Web_Log {
         {          {
                 if (is_array($keys)) {                  if (is_array($keys)) {
                         $this->_truncate_qstrings_keys = $keys;                          $this->_truncate_qstrings_keys = $keys;
                 }                  } elseif (is_string($keys)) {
                 elseif (is_string($keys)) {  
                         // TODO: REMOVE ME!  
                         //$this->_session_keys = array($keys);  
                         array_push($this->_truncate_qstrings_keys, $keys);                          array_push($this->_truncate_qstrings_keys, $keys);
                 }                  }
         }          }
Riadok 510  class Web_Log {
Riadok 508  class Web_Log {
         /*          /*
          * enablePropertyCache(), disablePropertyCache()           * enablePropertyCache(), disablePropertyCache()
          * TODO: getPropertyCache(), setPropertyCache() - ???           * TODO: getPropertyCache(), setPropertyCache() - ???
          * enableAllPropertiesCaches(), disableAllPropertiesCaches()           * enableAllPropertyCaches(), disableAllPropertyCaches()
          *           *
          * Enable/disable of specific property cache.           * Enable/disable of specific property cache.
          */           */
Riadok 527  class Web_Log {
Riadok 525  class Web_Log {
                         $this->_props[$property]['enabled_cache'] = false;                          $this->_props[$property]['enabled_cache'] = false;
         }          }
   
         function enableAllPropertiesCaches()          function enableAllPropertyCaches()
         {          {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['enabled_cache'] = true;                          $this->_props[$property]['enabled_cache'] = true;
Riadok 536  class Web_Log {
Riadok 534  class Web_Log {
                 return true;                  return true;
         }          }
   
         function disableAllPropertiesCaches()          function disableAllPropertyCaches()
         {          {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['enabled_cache'] = false;                          $this->_props[$property]['enabled_cache'] = false;
Riadok 564  class Web_Log {
Riadok 562  class Web_Log {
         }          }
   
         /*          /*
            * enableAllProperties(), disableAllProperties()
            *
            * Enable/disable loging of all properties.
            */
   
           function enableAllProperties()
           {
                   foreach (array_keys($this->_props) as $property) {
                           $this->_props[$property]['enabled'] = true;
                   }
   
                   return true;
           }
   
           function disableAllProperties()
           {
                   foreach (array_keys($this->_props) as $property) {
                           $this->_props[$property]['enabled'] = false;
                   }
   
                   return true;
           }
   
           /*
          * getPropertyValue(), setPropertyValue(), clearPropertyValue()           * getPropertyValue(), setPropertyValue(), clearPropertyValue()
          *           *
          * Gets/sets specific property value. Property cannot be disabled.           * Gets/sets specific property value. Property cannot be disabled.
Riadok 603  class Web_Log {
Riadok 625  class Web_Log {
         }          }
   
         /*          /*
          * enableAllProperties(), disableAllProperties()           * setAllPropertyValues(), clearAllPropertyValues()
            * setAllPropertyIDs(), clearAllPropertyIDs()
            * setAllProperties(), clearAllProperties()
          *           *
          * Enable/disable loging of all properties.           * Set/clear all properties.
          */           */
   
         function enableAllProperties()          function setAllPropertyValues()
           {
                   /* TODO: this should set only values, not IDs
                      there should exists also:
                      1. setAllPropertyIDs() for setting up IDs
                      2. setAllProperties() for setting up values and than IDs
                    */
   
                   return $this->setValues();
           }
   
           function clearAllPropertyValues()
         {          {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['enabled'] = true;                          if (isset($this->_props[$property]['value']))
                                   unset($this->_props[$property]['value']);
                 }                  }
   
                 return true;                  return true;
         }          }
   
         function disableAllProperties()  /* NOT IMPLEMENTED YET, see comment above
   
           function setAllPropertyIDs()
           {
                   return $this->setValues();
           }
   */
   
           function clearAllPropertyIDs()
         {          {
                 foreach (array_keys($this->_props) as $property) {                  foreach (array_keys($this->_props) as $property) {
                         $this->_props[$property]['enabled'] = false;                          if (isset($this->_props[$property]['id']))
                                   unset($this->_props[$property]['id']);
                 }                  }
   
                 return true;                  return true;
         }          }
   
         /*  
          * setAllProperties(), clearAllProperties()  
          *  
          * Clear all properties.  
          */  
   
         function setAllProperties()          function setAllProperties()
         {          {
                   /* TODO: see comment above */
                 return $this->setValues();                  return $this->setValues();
         }          }
   
         function clearAllProperties()          function clearAllProperties()
         {          {
                 foreach (array_keys($this->_props) as $property) {                  $ret  = true;
                         if (isset($this->_props[$property]['value']))                  $ret &= $this->clearAllPropertyValues();
                                 unset($this->_props[$property]['value']);                  $ret &= $this->clearAllPropertyIDs();
                 }  
   
                 return true;                  return $ret;
         }          }
   
         /*          /*
Riadok 708  class Web_Log {
Riadok 747  class Web_Log {
   
         function _resolveIP($addr)          function _resolveIP($addr)
         {          {
                 $host = '';                  $host     = '';
                 $addr_ar = (strchr($addr, ',') ? explode(',', $addr) : array($addr));                  $addr_ar  = strchr($addr, ',') ? explode(',', $addr) : array($addr);
                 $addr_idx = count($addr_ar);                  $addr_idx = count($addr_ar);
   
                 while ($addr_idx > 0) {                  while ($addr_idx > 0) {
Riadok 741  class Web_Log {
Riadok 780  class Web_Log {
                         if (is_numeric($name_ar[0])) {                          if (is_numeric($name_ar[0])) {
                                 array_pop($name_ar);                                  array_pop($name_ar);
                                 $name = join('.', $name_ar) . '.*';                                  $name = join('.', $name_ar) . '.*';
                         }                          } else {
                         else {  
                                 array_shift($name_ar);                                  array_shift($name_ar);
                                 $name = '*.' . join('.', $name_ar);                                  $name = '*.' . join('.', $name_ar);
                         }                          }
Riadok 804  class Web_Log {
Riadok 842  class Web_Log {
                 }                  }
   
                 if ($this->_truncate_qstrings) {                  if ($this->_truncate_qstrings) {
                         $req_uri_ar = explode('?', $this->_props['request_uri']['value'], 2);                          $req_uri_ar  = explode('?', $this->_props['request_uri']['value'], 2);
                         $http_ref_ar = explode('?', $this->_props['http_referer']['value'], 2);                          $http_ref_ar = explode('?', $this->_props['http_referer']['value'], 2);
   
                         if (count($this->_truncate_qstrings_keys) == 0) {                          if (count($this->_truncate_qstrings_keys) == 0) {
Riadok 815  class Web_Log {
Riadok 853  class Web_Log {
                                 if (! strcasecmp($url_ar['host'],                                  if (! strcasecmp($url_ar['host'],
                                                 $HTTP_SERVER_VARS['HTTP_HOST']))                                                  $HTTP_SERVER_VARS['HTTP_HOST']))
                                 $http_ref_ar[1] = '';                                  $http_ref_ar[1] = '';
                         }                          } else {
                         else {  
                                 $this->_props['query_string']['value'] =                                  $this->_props['query_string']['value'] =
                                         $this->_truncateQueryString($this->_props['query_string']['value']);                                          $this->_truncateQueryString($this->_props['query_string']['value']);
   
Riadok 831  class Web_Log {
Riadok 868  class Web_Log {
                                                 array_pop($http_ref_ar);                                                  array_pop($http_ref_ar);
                         }                          }
   
                         $this->_props['request_uri']['value'] = join('?', $req_uri_ar);                          $this->_props['request_uri']['value']  = join('?', $req_uri_ar);
                         $this->_props['http_referer']['value'] = join('?', $http_ref_ar);                          $this->_props['http_referer']['value'] = join('?', $http_ref_ar);
                 }                  }
   
Riadok 905  class Web_Log {
Riadok 942  class Web_Log {
                 global $HTTP_SERVER_VARS;                  global $HTTP_SERVER_VARS;
   
                 $remote_addr = stripslashes(                  $remote_addr = stripslashes(
                                 ! empty($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])                                  ! empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'])
                                 ? $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]                                  ? $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']
                                 : $HTTP_SERVER_VARS["REMOTE_ADDR"]                                  : $HTTP_SERVER_VARS['REMOTE_ADDR']
                                 );                                  );
   
                 /* if multiple hosts presents, get the first one */                  /* if multiple hosts presents, get the first one */
Riadok 924  class Web_Log {
Riadok 961  class Web_Log {
                                 || $this->_props['ident_username']['enabled']) {                                  || $this->_props['ident_username']['enabled']) {
   
                         $ident = new Net_Ident($remote_addr,                          $ident = new Net_Ident($remote_addr,
                                         stripslashes($HTTP_SERVER_VARS["REMOTE_PORT"]),                                          stripslashes($HTTP_SERVER_VARS['REMOTE_PORT']),
                                         stripslashes($HTTP_SERVER_VARS["SERVER_PORT"]));                                          stripslashes($HTTP_SERVER_VARS['SERVER_PORT']));
   
                         if ($ident->status() == 1) {                          if ($ident->status() == 1) {
                                 // print "Ident query failed: " . $ident->error() . ".<br>\n";                                  // print "Ident query failed: " . $ident->error() . ".<br>\n";
Riadok 971  class Web_Log {
Riadok 1008  class Web_Log {
   
                                         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'];
                                 }                                  }
Riadok 1098  class Web_Log {
Riadok 1134  class Web_Log {
                                                 $val = substr($val, 0, WEB_LOG_VALUE_SUBSTR_LENGTH);                                                  $val = substr($val, 0, WEB_LOG_VALUE_SUBSTR_LENGTH);
                                                 $val = $this->_db->quoteString($val);                                                  $val = $this->_db->quoteString($val);
                                                 $val = "'$val'";                                                  $val = "'$val'";
                                         }                                          } else {
                                         else {  
                                                 $val = $this->_props[$prop_name]['value'];                                                  $val = $this->_props[$prop_name]['value'];
                                         }                                          }
                                 }                                  } else {
                                 else {  
                                         $val = 0;                                          $val = 0;
                                 }                                  }
                         }                          } else {
                         else {  
                                 if (isset($this->_props[$prop_name]['id'])                                  if (isset($this->_props[$prop_name]['id'])
                                                 && ! empty($this->_props[$prop_name]['id'])) {                                                  && ! empty($this->_props[$prop_name]['id'])) {
                                         $val = $this->_props[$prop_name]['id'];                                          $val = $this->_props[$prop_name]['id'];
Riadok 1116  class Web_Log {
Riadok 1149  class Web_Log {
                                                         $this->_props[$prop_name]['value'])) {                                                          $this->_props[$prop_name]['value'])) {
                                                 $val = "'$val'";                                                  $val = "'$val'";
                                         }                                          }
                                 }                                  } else {
                                 else {  
                                         $val = 0;                                          $val = 0;
                                 }                                  }
                         }                          }
Riadok 1204  class Web_Log {
Riadok 1236  class Web_Log {
                                 $this->_db->expectError(DB_ERROR_ALREADY_EXISTS);                                  $this->_db->expectError(DB_ERROR_ALREADY_EXISTS);
                                 $result = $this->_db->query($query);                                  $result = $this->_db->query($query);
                                 $this->_db->popExpect();                                  $this->_db->popExpect();
                         }                          } else {
                         else {  
                                 $result = $this->_db->query($query);                                  $result = $this->_db->query($query);
                         }                          }
   
Riadok 1220  class Web_Log {
Riadok 1251  class Web_Log {
                                 if ($i == 0 && $result->getCode() == DB_ERROR_ALREADY_EXISTS) {                                  if ($i == 0 && $result->getCode() == DB_ERROR_ALREADY_EXISTS) {
                                         /* This is an expected error. If it will be returned                                          /* This is an expected error. If it will be returned
                                            again we will count it seriously. */                                             again we will count it seriously. */
                                 }                                  } else {
                                 else {  
                                         return $result;                                          return $result;
                                 }                                  }
                         }                          } else {
                         else {  
                                 /* No errors, insert succeed. */                                  /* No errors, insert succeed. */
                                 break;                                  break;
                         }                          }
Riadok 1279  class Web_Log {
Riadok 1308  class Web_Log {
   
                 $query = 'SELECT id, session_id,'                  $query = 'SELECT id, session_id,'
                         .' UNIX_TIMESTAMP(SYSDATE()) - UNIX_TIMESTAMP(datetime) AS diff_sec'                          .' UNIX_TIMESTAMP(SYSDATE()) - UNIX_TIMESTAMP(datetime) AS diff_sec'
                         .' FROM ' . "$accesses_table $where"                          .' FROM '.$accesses_table.' '.$where
                         .' ORDER BY datetime DESC'                          .' ORDER BY datetime DESC'
                         .' LIMIT 1';                          .' LIMIT 1';
   
Riadok 1314  class Web_Log {
Riadok 1343  class Web_Log {
                                 return $id;                                  return $id;
                 }                  }
   
                 /* Returns starting session ID (1). */                  /* Returns starting session ID with value of 1. */
                 return 1;                  return 1;
         }          }
   
Riadok 1354  class Web_Log {
Riadok 1383  class Web_Log {
   
                                 if (! $this->_raw_log && isset($this->_props[$key]['table'])) {                                  if (! $this->_raw_log && isset($this->_props[$key]['table'])) {
                                         $list_where .= ($list_where == '' ? '' : ' and ');                                          $list_where .= ($list_where == '' ? '' : ' and ');
                                         $list_where .= "$accesses_table."                                          $list_where .= $accesses_table.'.'
                                                 . $this->_props[$key]['column'] . ' = '                                                  . $this->_props[$key]['column'] . ' = '
                                                 . $this->_props[$key]['table'] . '.id AND '                                                  . $this->_props[$key]['table'] . '.id AND '
                                                 . $this->_props[$key]['table'] . '.value LIKE "'.$val.'"';                                                  . $this->_props[$key]['table'] . '.value LIKE '
                                                   . $this->_db->quote($val);
   
                                         $list_tables .= ($list_tables == '' ? '' : ', ');                                          $list_tables .= ($list_tables == '' ? '' : ', ');
                                         $list_tables .= $this->_props[$key]['table'];                                          $list_tables .= $this->_props[$key]['table'];
                                 }                                  } elseif (isset($this->_props[$key])) {
                                 elseif (isset($this->_props[$key])) {  
                                         $list_where .= ($list_where == '' ? '' : ' and ');                                          $list_where .= ($list_where == '' ? '' : ' and ');
                                         $list_where .= $this->_props[$key]['column'] . " = '$val'";                                          $list_where .= $this->_props[$key]['column'] . ' LIKE '
                                                   . $this->_db->quote($val);
                                 }                                  }
                         }                          }
                 }                  }
Riadok 1387  class Web_Log {
Riadok 1417  class Web_Log {
   
                 if (strlen($list_where) > 0)                  if (strlen($list_where) > 0)
                         $query .= " WHERE $list_where";                          $query .= " WHERE $list_where";
                   //echo '[['.$query . ']]<hr>';
   
                 echo $query . '<hr>';  
                 if (DB::isError($count = $this->_db->getOne($query)))                  if (DB::isError($count = $this->_db->getOne($query)))
                         return $count;                          return $count;
   
Riadok 1399  class Web_Log {
Riadok 1429  class Web_Log {
         }          }
   
         /*          /*
         * getSessions()           * getSessions()
         *           *
         * Returns session IDs.           * Returns session IDs.
         *           *
         * TODO:           * TODO:
         * For $state equal 0 all sessions, -1 for inactive sessions, 1 for active.           * For $state equal 0 all sessions, -1 for inactive sessions, 1 for active.
         */           */
   
         function _getSessions($active = true)          function _getSessions($active = true)
         {          {
Riadok 1423  class Web_Log {
Riadok 1453  class Web_Log {
                                 .' ORDER BY session_id ASC',                                  .' ORDER BY session_id ASC',
                                 $accesses_table,                                  $accesses_table,
                                 $active ? '<' : '>=',                                  $active ? '<' : '>=',
                                 intval($this->_session_timeout));                                  $this->_session_timeout);
   
                 return $this->_db->getCol($query);                  return $this->_db->getCol($query);
         }          }
Riadok 1439  class Web_Log {
Riadok 1469  class Web_Log {
                 if ($this->_raw_log) {                  if ($this->_raw_log) {
                         if (isset($this->_cache_raw_log_active_sessions))                          if (isset($this->_cache_raw_log_active_sessions))
                                 return $this->_cache_active_sessions;                                  return $this->_cache_active_sessions;
                 }                  } else {
                 else {  
                         if (isset($this->_cache_active_sessions))                          if (isset($this->_cache_active_sessions))
                                 return $this->_cache_active_sessions;                                  return $this->_cache_active_sessions;
                 }                  }
Riadok 1449  class Web_Log {
Riadok 1478  class Web_Log {
                 if (DB::isError($active_sessions))                  if (DB::isError($active_sessions))
                         return $active_sessions;                          return $active_sessions;
   
                 if ($this->_raw_log)                  if ($this->_raw_log) {
                         $this->_cache_raw_log_active_sessions = $active_sessions;                          $this->_cache_raw_log_active_sessions = $active_sessions;
                 else                  } else {
                         $this->_cache_active_sessions = $active_sessions;                          $this->_cache_active_sessions = $active_sessions;
                   }
   
                 return $active_sessions;                  return $active_sessions;
         }          }
Riadok 1468  class Web_Log {
Riadok 1498  class Web_Log {
                 if ($this->_raw_log) {                  if ($this->_raw_log) {
                         if (isset($this->_cache_raw_log_inactive_sessions))                          if (isset($this->_cache_raw_log_inactive_sessions))
                                 return $this->_cache_inactive_sessions;                                  return $this->_cache_inactive_sessions;
                 }                  } else {
                 else {  
                         if (isset($this->_cache_inactive_sessions))                          if (isset($this->_cache_inactive_sessions))
                                 return $this->_cache_inactive_sessions;                                  return $this->_cache_inactive_sessions;
                 }                  }
Riadok 1478  class Web_Log {
Riadok 1507  class Web_Log {
                 if (DB::isError($inactive_sessions))                  if (DB::isError($inactive_sessions))
                         return $inactive_sessions;                          return $inactive_sessions;
   
                 if ($this->_raw_log)                  if ($this->_raw_log) {
                         $this->_cache_raw_log_inactive_sessions = $inactive_sessions;                          $this->_cache_raw_log_inactive_sessions = $inactive_sessions;
                 else                  } else {
                         $this->_cache_inactive_sessions = $inactive_sessions;                          $this->_cache_inactive_sessions = $inactive_sessions;
                   }
   
                 return $inactive_sessions;                  return $inactive_sessions;
         }          }
Riadok 1526  class Web_Log {
Riadok 1556  class Web_Log {
                 if ($this->_checkDB() == false)                  if ($this->_checkDB() == false)
                         return $this->_db;                          return $this->_db;
   
                 /* Note: we are selecting all from DB, but probably better will be to                  /* TODO: Note: we are selecting all from DB, but probably better will
                    select only enabled properties. */                     be to select only enabled properties. */
   
                 $query = sprintf('SELECT * FROM %s WHERE id = %s',                  $query = sprintf('SELECT * FROM %s WHERE id = %s',
                                 'weblog_accesses_raw', intval($access_id));                                  'weblog_accesses_raw', intval($access_id));
Riadok 1543  class Web_Log {
Riadok 1573  class Web_Log {
                                 //echo " is set: ";                                  //echo " is set: ";
                                 //echo $this->_props[$prop]['value'];                                  //echo $this->_props[$prop]['value'];
                                 //echo "\n";                                  //echo "\n";
                         }                          } else {
                         else {  
                                 //echo " is NOT set\n";                                  //echo " is NOT set\n";
                         }                          }
                 }                  }

Legend:
Odstranené z verzie1.36  
zmenené riadky
  Pridané vo verzii1.37

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