betterawstats-betterawstats-cvs Mailing List for betterawstats (Page 3)
Brought to you by:
tokyoahead
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(66) |
Feb
(324) |
Mar
(92) |
Apr
(58) |
May
(17) |
Jun
(4) |
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Oliver S. <tok...@us...> - 2008-04-21 03:07:21
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6627/core Modified Files: data.inc.php db.inc.php display.inc.php display_helpers.php helpers.inc.php library.inc.php Log Message: caching function Index: db.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/db.inc.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db.inc.php 18 Apr 2008 07:15:50 -0000 1.1 --- db.inc.php 21 Apr 2008 03:07:20 -0000 1.2 *************** *** 115,117 **** --- 115,187 ---- } + function baw_read_cache($settings = array()) { + global $BAW_CONF, $BAW_CURR, $BAW_CONF_DEF, $BAW_MES; + // check if we have content on the DB + baw_debug("reading cache"); + $server_id = baw_get_server_id($BAW_CURR['site_name']); + $site = $BAW_CURR['site_name']; + $baw_version = $BAW_CONF_DEF[$BAW_MES['cfg_advanced_settings']]['version']['default']; + $date = $BAW_CURR['yearmonth']; + $g = baw_data($BAW_CURR['site_name'], 'GENERAL', $BAW_CURR['yearmonth']); + $lastupdate = $g['LastUpdate'][0]; + $conf = md5(serialize($BAW_CONF)); + $set = md5(serialize($settings)); + $sql = "SELECT `cache` FROM `cache` " + . "WHERE `server_id` = $server_id " + . "AND `version` = '$baw_version' " + . "AND `date` = $date " + . "AND `config` = '$conf' " + . "AND `lastupdate` = $lastupdate " + . "AND `settings` = '$set';"; + $result = baw_sql('select', $sql); + if (count($result) == 0) { + baw_debug("no cache found"); + return false; + } else { + $out = stripslashes(bzdecompress($result[0][0])); + baw_debug("read cache, returning"); + return $out; + } + } + + function baw_write_cache($content, $settings = array()) { + global $BAW_CONF, $BAW_CURR, $BAW_CONF_DEF, $BAW_MES; + // check if we have content on the DB + $server_id = baw_get_server_id($BAW_CURR['site_name']); + $site = $BAW_CURR['site_name']; + $baw_version = $BAW_CONF_DEF[$BAW_MES['cfg_advanced_settings']]['version']['default']; + $date = $BAW_CURR['yearmonth']; + $g = baw_data($BAW_CURR['site_name'], 'GENERAL', $BAW_CURR['yearmonth']); + $lastupdate = $g['LastUpdate'][0]; + $conf = md5(serialize($BAW_CONF)); + $set = md5(serialize($settings)); + baw_debug("deleting old cache"); + // delete old versions of the cache + $sql = "DELETE FROM `cache` " + . "WHERE `server_id` = $server_id " + . "AND `date` = $date " + . "AND `settings` = '$set';"; + $del = baw_sql('delete', $sql); + // write new one + $content = addslashes(bzcompress($content)); + baw_debug("inserting new cache into table"); + $sql = "INSERT INTO `cache`" + . "(`server_id`, `date`, `lastupdate`, `version`, `config`, `settings`, `cache`)" + . "VALUES ($server_id, $date, $lastupdate, '$baw_version', '$conf', '$set', '$content')"; + $result = baw_sql('insert', $sql); + return true; + } + + // experimental code to load visitors from DB + /* if ($BAW_CONF['DB_backend']) { // check first for DB_Data + $server_id = baw_get_server_id($BAW_CURR['site_name']); + $val = "SELECT `1`, `2`, `3`, `4`, `3`/`2` AS ratio, `5` FROM VISITOR " + . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`>1 AND `2`>0 " + . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), 1 AS ratio, max(`5`) FROM VISITOR " + . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`=1 GROUP BY `3`/`2` " + . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), '0' AS ratio, max(`5`) FROM VISITOR " + . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `2`=0 GROUP BY `3`/`2` " + . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); + } else {*/ + ?> \ No newline at end of file Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** display.inc.php 18 Apr 2008 07:15:48 -0000 1.162 --- display.inc.php 21 Apr 2008 03:07:20 -0000 1.163 *************** *** 575,668 **** $hashotlinks = false; $hasbots = false; ! if ($val = baw_data($BAW_CURR['site_name'], "VISITOR", $BAW_CURR['yearmonth'], false)) { baw_debug("data loaded"); ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! if ($BAW_CONF['DB_backend']) { // check first for DB_Data ! $server_id = baw_get_server_id($BAW_CURR['site_name']); ! $val = "SELECT `1`, `2`, `3`, `4`, `3`/`2` AS ratio, `5` FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`>1 AND `2`>0 " ! . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), 1 AS ratio, max(`5`) FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`=1 GROUP BY `3`/`2` " ! . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), '0' AS ratio, max(`5`) FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `2`=0 GROUP BY `3`/`2` " ! . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); ! } else { ! foreach ($val as $dns => $data) { ! // $infolink = baw_create_link("?", "javascript:neww('$dns','{$dns}XXX')"); ! // $line[] = array ('data'=> $infolink, 'class' => "aligncenter", 'format' => 'layout_index'); ! //if (!$set['hidebots'] or $data[1] !== $data[2]) { ! $ratio = 0; ! if ($data[0] > 0) { ! $ratio = $data[1] / $data[0]; ! } ! // hotlinks & Bots ! if (!isset($data[3]) || $data[3] =='') { ! $data[3] = 0; ! } ! // $data[3] = settype($data[3], 'int'); ! if ($data[0] == 0 && $data[1] !== 0) { // hotlinks ! $h_data['latest_date'] = 0; //max($data[3], $h_data['latest_date']); ! $h_data[0] += $data[0]; ! $h_data[1] += $data[1]; ! $h_data[2] += $data[2]; ! $hashotlinks = true; ! unset($val[$dns]); ! } else if ($ratio <= $BAW_CONF_DIS['visitors']['assumebot']) { // bots ! $s_data['latest_date'] = max($data[3], $s_data['latest_date']); ! $s_data[0] += $data[0]; ! $s_data[1] += $data[1]; ! $s_data[2] += $data[2]; ! $hasbots = true; ! unset($val[$dns]); ! } else { ! /* GEOIP TEST ! if ($BAW_CONF['module'] == 'drupal') { ! $dns = baw_create_link($dns , "/{$BAW_CONF['drupal_base']}/details/geoip/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $dns = baw_create_link($dns , "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=geoip"); ! }*/ ! unset($val[$dns]); ! $val[] = array( ! $dns, ! $data[0], ! $data[1], ! $data[2], ! baw_num_format($ratio, 2), ! $data[3] ! ); ! } } ! if ($hasbots) { ! $val['script'] = array( ! $ntype, ! $s_data[0], ! $s_data[1], ! $s_data[2], ! $s_data[1] / $s_data[0], ! $s_data['latest_date'] ! ); } ! if ($hashotlinks) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['hotlinks'] = array( ! $ntype, ! $h_data[0], ! $h_data[1], ! $h_data[2], ! 0, ! $h_data['latest_date'] ); } ! $val = baw_array_sorting($val, $set['sort'], $set['sort_dir']); } } else if ($BAW_CONF['hideempty']){ return ''; --- 575,658 ---- $hashotlinks = false; $hasbots = false; ! if ($val = baw_data($BAW_CURR['site_name'], "VISITOR", $BAW_CURR['yearmonth'])) { baw_debug("data loaded"); ! foreach ($val as $dns => $data) { ! // $infolink = baw_create_link("?", "javascript:neww('$dns','{$dns}XXX')"); ! // $line[] = array ('data'=> $infolink, 'class' => "aligncenter", 'format' => 'layout_index'); ! //if (!$set['hidebots'] or $data[1] !== $data[2]) { ! $ratio = 0; ! if ($data[0] > 0) { ! $ratio = $data[1] / $data[0]; } ! // hotlinks & Bots ! if (!isset($data[3]) || $data[3] =='') { ! $data[3] = 0; } ! // $data[3] = settype($data[3], 'int'); ! if ($data[0] == 0 && $data[1] !== 0) { // hotlinks ! $h_data['latest_date'] = max($data[3], $h_data['latest_date']); ! $h_data[0] += $data[0]; ! $h_data[1] += $data[1]; ! $h_data[2] += $data[2]; ! $hashotlinks = true; ! } else if ($ratio <= $BAW_CONF_DIS['visitors']['assumebot']) { // bots ! $s_data['latest_date'] = max($data[3], $s_data['latest_date']); ! $s_data[0] += $data[0]; ! $s_data[1] += $data[1]; ! $s_data[2] += $data[2]; ! $hasbots = true; ! } else { ! /* if ($BAW_CONF['module'] == 'drupal') { ! $dns = baw_create_link($dns , "/{$BAW_CONF['drupal_base']}/details/geoip/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $dns = baw_create_link($dns , "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=geoip"); ! }*/ ! $val[$i] = array( ! $dns, ! $data[0], ! $data[1], ! $data[2], ! baw_num_format($ratio, 2), ! $data[3] ); } ! // try extra to regain the memory here since this is the largest function ! $val[$dns] = NULL; ! unset($val[$dns]); ! $i++; ! } ! if ($hasbots) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['script'] = array( ! $ntype, ! $s_data[0], ! $s_data[1], ! $s_data[2], ! $s_data[1] / $s_data[0], ! $s_data['latest_date'] ! ); ! } ! if ($hashotlinks) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['hotlinks'] = array( ! $ntype, ! $h_data[0], ! $h_data[1], ! $h_data[2], ! 0, ! $h_data['latest_date'] ! ); } + $val = baw_array_sorting($val, $set['sort'], $set['sort_dir']); + baw_debug("data sorted"); } else if ($BAW_CONF['hideempty']){ return ''; *************** *** 966,974 **** $urlalias = baw_urlalias($BAW_CURR['site_name']); } ! if ($BAW_CONF['DB_backend']) { // check first for DB_Data $server_id = baw_get_server_id($BAW_CURR['site_name']); $val = "SELECT `1`,`2`,`3`,`4`,`5` FROM SIDER " . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); ! } else { foreach ($val as $url => $data) { if ($BAW_CONF['url_alias'] && isset($urlalias[$url])) { --- 956,964 ---- $urlalias = baw_urlalias($BAW_CURR['site_name']); } ! /* if ($BAW_CONF['DB_backend']) { // check first for DB_Data $server_id = baw_get_server_id($BAW_CURR['site_name']); $val = "SELECT `1`,`2`,`3`,`4`,`5` FROM SIDER " . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); ! } else {*/ foreach ($val as $url => $data) { if ($BAW_CONF['url_alias'] && isset($urlalias[$url])) { *************** *** 988,992 **** ); } ! } } else if ($BAW_CONF['hideempty']){ return ''; --- 978,982 ---- ); } ! //} } else if ($BAW_CONF['hideempty']){ return ''; Index: helpers.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/helpers.inc.php,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** helpers.inc.php 18 Apr 2008 07:15:50 -0000 1.71 --- helpers.inc.php 21 Apr 2008 03:07:20 -0000 1.72 *************** *** 102,105 **** --- 102,113 ---- } + function baw_get_memory_limit() { + $limit = ini_get('memory_limit'); + $search = array("K","M","G"); + $replace = array('000', '000000', '000000000'); + $limit = str_replace($search, $replace, $limit); + return $limit; + } + /* * Helper Function: debug output with time stamp and memory meter; Index: data.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/data.inc.php,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** data.inc.php 18 Apr 2008 07:15:47 -0000 1.74 --- data.inc.php 21 Apr 2008 03:07:20 -0000 1.75 *************** *** 319,323 **** * */ ! function baw_data($site, $data_type, $date, $get_from_db = false) { global $BAW_CONF, $BAW_LIB, $BAW_CURR, $BAW_DFILES, $XML_VARS, $XML_ARR; $MAP = array(); --- 319,323 ---- * */ ! function baw_data($site, $data_type, $date, $get_from_db = false, $code=false) { global $BAW_CONF, $BAW_LIB, $BAW_CURR, $BAW_DFILES, $XML_VARS, $XML_ARR; $MAP = array(); *************** *** 462,465 **** --- 462,469 ---- } } else { // use array + // check memory + /* if (memory_get_usage() + 100 > ini_get('memory_limit')) { + echo "memory warning! " . memory_get_usage() ." ". $BAW_CURR['memory_limit']. "<br>"; + }*/ // shift first element as array name $first_element = array_shift($line_arr); *************** *** 476,479 **** --- 480,486 ---- } } + if ($code) { + eval($code); + } } } Index: display_helpers.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display_helpers.php,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** display_helpers.php 18 Apr 2008 07:15:50 -0000 1.138 --- display_helpers.php 21 Apr 2008 03:07:20 -0000 1.139 *************** *** 248,257 **** baw_debug("Menu finished"); $finaltime = baw_ptime(); - $memory = ''; - if (function_exists('memory_get_peak_usage')) { - $memory = ", max menory: " . baw_byte_format(memory_get_peak_usage(true)); - } $out = $menubox ! . baw_display_version("<br" . XHTML . "> in $finaltime" . $memory) . $menubox_end . $content . baw_site_footer(); --- 248,253 ---- baw_debug("Menu finished"); $finaltime = baw_ptime(); $out = $menubox ! . baw_display_version("<br" . XHTML . "> in ##FINALTIME## ##MEMORY##") . $menubox_end . $content . baw_site_footer(); *************** *** 259,262 **** --- 255,266 ---- } + function baw_get_max_mem() { + $memory = ''; + if (function_exists('memory_get_peak_usage')) { + $memory = ", max menory: " . baw_byte_format(memory_get_peak_usage(true)); + } + return $memory; + } + /* * Display Helper Function: display the menu bar on the top of the page Index: library.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/library.inc.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** library.inc.php 18 Apr 2008 07:15:50 -0000 1.45 --- library.inc.php 21 Apr 2008 03:07:20 -0000 1.46 *************** *** 165,169 **** ); ! // this is needed now for the DB access. $BAW_LIB['data']['full'] = array( 'GENERAL' => array('Misc ID', 'Pages', 'Hits', 'Bandwidth'), --- 165,169 ---- ); ! /* $BAW_LIB['data']['full'] = array( 'GENERAL' => array('Misc ID', 'Pages', 'Hits', 'Bandwidth'), *************** *** 195,198 **** ); ! ?> \ No newline at end of file --- 195,198 ---- ); ! */ ?> \ No newline at end of file |
From: Oliver S. <tok...@us...> - 2008-04-21 03:07:21
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6627 Modified Files: config.php index.php Log Message: caching function Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** config.php 18 Apr 2008 07:15:47 -0000 1.127 --- config.php 21 Apr 2008 03:07:20 -0000 1.128 *************** *** 111,115 **** // DEFAULT: '' // POSSIBLE VALUES: '0', 'mysql', 'mssql' ! $BAW_CONF['DB_backend'] = '0'; // NAME: --- 111,115 ---- // DEFAULT: '' // POSSIBLE VALUES: '0', 'mysql', 'mssql' ! $BAW_CONF['DB_backend'] = 'mysql'; // NAME: Index: index.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/index.php,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** index.php 18 Apr 2008 07:15:47 -0000 1.77 --- index.php 21 Apr 2008 03:07:20 -0000 1.78 *************** *** 52,56 **** if ($BAW_CONF['debug']) { error_reporting(E_ALL); ! // ini_set('memory_limit','25M'); } --- 52,56 ---- if ($BAW_CONF['debug']) { error_reporting(E_ALL); ! // ini_set('memory_limit','10M'); } *************** *** 92,95 **** --- 92,96 ---- include_once('./core/display_helpers.php'); baw_match_files(); // we read all files here so we have the array for config and normal + $BAW_CURR['memory_limit'] = baw_get_memory_limit(); if (!isset($BAW_MES['e'])) { *************** *** 136,147 **** $action = 'baw_action_' . $_REQUEST['action']; $out = $action(); ! } else if (@$BAW_CURR['site_name'] == 'all_months') { ! $settings['section'] = "months"; ! $out = baw_display_index($settings); ! } else if (@$BAW_CURR['site_name'] == 'all_days') { ! $settings['section'] = "days"; ! $out = baw_display_index($settings); ! } else { ! $out = baw_display_index(); } --- 137,161 ---- $action = 'baw_action_' . $_REQUEST['action']; $out = $action(); ! } else { // render content ! if ($BAW_CURR['site_name'] == 'all_months') { ! $settings['section'] = "months"; ! } else if ($BAW_CURR['site_name'] == 'all_days') { ! $settings['section'] = "days"; ! } else { ! $settings = array(); ! } ! // check if we have a cache, otherwise generate ! $out = baw_read_cache($settings); ! if ($out == false) { ! // since diplay_index is echoing the header, we have to add it here. ! $out = baw_display_index($settings); ! $cache = baw_site_header($BAW_CURR['site_name']) . $out; ! baw_write_cache($cache, $settings); // write newly generated cache ! } ! ! // add final time and final memory usage so its not cached ! $repl_arr = array(baw_ptime(), baw_get_max_mem()); ! $search_arr = array('##FINALTIME##', '##MEMORY##'); ! $out = str_replace($search_arr, $repl_arr, $out); } |
From: Oliver S. <tok...@us...> - 2008-04-18 07:16:12
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28387 Modified Files: config.php index.php Log Message: experimental DB-caching function implemented Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** config.php 16 Apr 2008 01:39:19 -0000 1.126 --- config.php 18 Apr 2008 07:15:47 -0000 1.127 *************** *** 95,99 **** // NAME: Limit to server? ! // INFO: Set this to a simgle server that you want to limit or "false" to // show all. The server name should be the one used for awstats. // DEFAULT: 'show_all' --- 95,99 ---- // NAME: Limit to server? ! // INFO: Set this to a single server that you want to limit or "false" to // show all. The server name should be the one used for awstats. // DEFAULT: 'show_all' *************** *** 104,107 **** --- 104,139 ---- //*********************************************************/ + //* DATABASE SETTINGS + //*********************************************************/ + + // NAME: + // INFO: + // DEFAULT: '' + // POSSIBLE VALUES: '0', 'mysql', 'mssql' + $BAW_CONF['DB_backend'] = '0'; + + // NAME: + // INFO: + // DEFAULT: 'localhost' + $BAW_CONF['DB_server'] = 'localhost'; + + // NAME: + // INFO: + // DEFAULT: 'betterawstats' + $BAW_CONF['DB_name'] = 'betterawstats'; + + // NAME: + // INFO: + // DEFAULT: 'betterawstats' + $BAW_CONF['DB_username'] = 'betterawstats'; + + // NAME: + // INFO: + // DEFAULT: 'betterawstats' + $BAW_CONF['DB_password'] = 'betterawstats'; + + + + //*********************************************************/ //* LAYOUT SETTINGS //*********************************************************/ *************** *** 171,175 **** // NAME: Average Values ! // INFO: Show average values for months, weekdays & time // DEFAULT: true // POSSIBLE VALUES: true, false --- 203,209 ---- // NAME: Average Values ! // INFO: Show average values for months, weekdays & time. It is STRONGLY ! // recommended to enable this to show more realistic data for unfinshed ! // months // DEFAULT: true // POSSIBLE VALUES: true, false Index: index.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/index.php,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** index.php 28 Mar 2008 14:37:49 -0000 1.76 --- index.php 18 Apr 2008 07:15:47 -0000 1.77 *************** *** 46,49 **** --- 46,50 ---- $BAW_URLALIAS = array(); // URL Alias files per site $tmp = null; // Temp variable for all kinds of things + $BAW_DB = null; // DB driver include_once('./config.php'); *************** *** 80,83 **** --- 81,87 ---- include_once('./core/data.inc.php'); include_once('./core/language.inc.php'); + if ($BAW_CONF['DB_backend'] !== false) { + include_once('./core/db.inc.php'); + } baw_language(); // this has to be b/f library & b/f baw_match_files() // find all the data, populate $BAW_DFILES |
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28387/core Modified Files: config_default.inc.php data.inc.php display.inc.php display_helpers.php helpers.inc.php library.inc.php Added Files: db.inc.php Log Message: experimental DB-caching function implemented --- NEW FILE: db.inc.php --- <?php /** * betterawstats - an alternative display for awstats data * * @author Oliver Spiesshofer, support at betterawstats dot com * @copyright 2007 Oliver Spiesshofer * @version 2 * @link http://betterawstats.com * Based on the GPL AWStats Totals script by: * Jeroen de Jong <je...@te...> * copyright 2004-2006 Telartis * version 1.13 (http://www.telartis.nl/xcms/awstats) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // this file can't be used on its own if (strpos ($_SERVER['PHP_SELF'], 'db.inc.php') !== false) { die ('This file can not be used on its own!'); } class baw_db{ private static $instance = NULL; private function __construct() { } public static function getInstance() { global $BAW_CONF; if (!self::$instance) { $db_connect_strings = array( 'mysql' => "mysql:host={$BAW_CONF['DB_server']};dbname={$BAW_CONF['DB_name']}", 'pgsql' => "pgsql:dbname={$BAW_CONF['DB_name']};host={$BAW_CONF['DB_server']}", 'sqlite' => "sqlite:{$BAW_CONF['DB_name']}", 'firebird' => "firebird:dbname={$BAW_CONF['DB_server']}:{$BAW_CONF['DB_name']}", 'informix' => "informix:DSN={$BAW_CONF['DB_server']}", // oracle // ODBC // DBLIB // IBM ); self::$instance = new PDO( $db_connect_strings[$BAW_CONF['DB_backend']], $BAW_CONF['DB_username'], $BAW_CONF['DB_password'], array(PDO::ATTR_PERSISTENT => true) ); self::$instance-> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } return self::$instance; } private function __clone(){ } } function baw_db_sort($dir) { if ($dir == SORT_DESC) { $out = 'DESC'; } else { $out = 'ASC'; } return $out; } function baw_get_server_id($server_name) { $sql = "SELECT servers.id " // check when this table was updated . "FROM servers " . "WHERE name='$server_name' "; $db_srvrs = baw_sql('select', $sql); $server_id = $db_srvrs[0][0]; return $server_id; } function baw_sql($type, $sql) { try { switch ($type) { case 'insert': BAW_DB::getInstance()->beginTransaction(); BAW_DB::getInstance()->exec($sql); $result = BAW_DB::getInstance()->lastInsertId(); BAW_DB::getInstance()->commit(); break; case 'delete': BAW_DB::getInstance()->beginTransaction(); $result = BAW_DB::getInstance()->exec($sql); BAW_DB::getInstance()->commit(); break; case 'select': $stmt = BAW_DB::getInstance()->query($sql); $result = $stmt->fetchAll(PDO::FETCH_NUM); break; case 'query': $result = BAW_DB::getInstance()->query($sql); break; } return $result; } catch (Exception $e) { BAW_DB::getInstance()->rollBack(); echo "Failed: " . $e->getMessage(); return false; } } ?> Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** display.inc.php 16 Apr 2008 01:43:43 -0000 1.161 --- display.inc.php 18 Apr 2008 07:15:48 -0000 1.162 *************** *** 348,351 **** --- 348,352 ---- global $BAW_MES, $BAW_CURR, $BAW_CONF; + $out = ''; if (isset($BAW_CURR['wdays']['count'])) { $format = array( *************** *** 406,410 **** } - $out = ''; if ($set['chart']) { $out .= baw_render_htmlchart($newval, $format, $set['avg'], false, $data_format); --- 407,410 ---- *************** *** 575,658 **** $hashotlinks = false; $hasbots = false; ! if ($val = baw_data($BAW_CURR['site_name'], "VISITOR", $BAW_CURR['yearmonth'])) { baw_debug("data loaded"); ! foreach ($val as $dns => $data) { ! // $infolink = baw_create_link("?", "javascript:neww('$dns','{$dns}XXX')"); ! // $line[] = array ('data'=> $infolink, 'class' => "aligncenter", 'format' => 'layout_index'); ! //if (!$set['hidebots'] or $data[1] !== $data[2]) { ! $ratio = 0; ! if ($data[0] > 0) { ! $ratio = $data[1] / $data[0]; } ! // hotlinks & Bots ! if (!isset($data[3]) || $data[3] =='') { ! $data[3] = 0; } ! // $data[3] = settype($data[3], 'int'); ! if ($data[0] == 0 && $data[1] !== 0) { // hotlinks ! $h_data['latest_date'] = max($data[3], $h_data['latest_date']); ! $h_data[0] += $data[0]; ! $h_data[1] += $data[1]; ! $h_data[2] += $data[2]; ! $hashotlinks = true; ! } else if ($ratio <= $BAW_CONF_DIS['visitors']['assumebot']) { // bots ! $s_data['latest_date'] = max($data[3], $s_data['latest_date']); ! $s_data[0] += $data[0]; ! $s_data[1] += $data[1]; ! $s_data[2] += $data[2]; ! $hasbots = true; ! } else { ! /* if ($BAW_CONF['module'] == 'drupal') { ! $dns = baw_create_link($dns , "/{$BAW_CONF['drupal_base']}/details/geoip/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $dns = baw_create_link($dns , "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=geoip"); ! }*/ ! $val[$i] = array( ! $dns, ! $data[0], ! $data[1], ! $data[2], ! baw_num_format($ratio, 2), ! $data[3] ); } ! // try extra to regain the memory here since this is the largest function ! $val[$dns] = NULL; ! unset($val[$dns]); ! $i++; ! } ! if ($hasbots) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['script'] = array( ! $ntype, ! $s_data[0], ! $s_data[1], ! $s_data[2], ! $s_data[1] / $s_data[0], ! $s_data['latest_date'] ! ); ! } ! if ($hashotlinks) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['hotlinks'] = array( ! $ntype, ! $h_data[0], ! $h_data[1], ! $h_data[2], ! 0, ! $h_data['latest_date'] ! ); } - $val = baw_array_sorting($val, $set['sort'], $set['sort_dir']); - baw_debug("data sorted"); } else if ($BAW_CONF['hideempty']){ return ''; --- 575,668 ---- $hashotlinks = false; $hasbots = false; ! if ($val = baw_data($BAW_CURR['site_name'], "VISITOR", $BAW_CURR['yearmonth'], false)) { baw_debug("data loaded"); ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! if ($BAW_CONF['DB_backend']) { // check first for DB_Data ! $server_id = baw_get_server_id($BAW_CURR['site_name']); ! $val = "SELECT `1`, `2`, `3`, `4`, `3`/`2` AS ratio, `5` FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`>1 AND `2`>0 " ! . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), 1 AS ratio, max(`5`) FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `3`/`2`=1 GROUP BY `3`/`2` " ! . "UNION SELECT '$ntype', sum(`2`), sum(`3`), sum(`4`), '0' AS ratio, max(`5`) FROM VISITOR " ! . "WHERE server_id=$server_id AND date={$BAW_CURR['yearmonth']} AND `2`=0 GROUP BY `3`/`2` " ! . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); ! } else { ! foreach ($val as $dns => $data) { ! // $infolink = baw_create_link("?", "javascript:neww('$dns','{$dns}XXX')"); ! // $line[] = array ('data'=> $infolink, 'class' => "aligncenter", 'format' => 'layout_index'); ! //if (!$set['hidebots'] or $data[1] !== $data[2]) { ! $ratio = 0; ! if ($data[0] > 0) { ! $ratio = $data[1] / $data[0]; ! } ! // hotlinks & Bots ! if (!isset($data[3]) || $data[3] =='') { ! $data[3] = 0; ! } ! // $data[3] = settype($data[3], 'int'); ! if ($data[0] == 0 && $data[1] !== 0) { // hotlinks ! $h_data['latest_date'] = 0; //max($data[3], $h_data['latest_date']); ! $h_data[0] += $data[0]; ! $h_data[1] += $data[1]; ! $h_data[2] += $data[2]; ! $hashotlinks = true; ! unset($val[$dns]); ! } else if ($ratio <= $BAW_CONF_DIS['visitors']['assumebot']) { // bots ! $s_data['latest_date'] = max($data[3], $s_data['latest_date']); ! $s_data[0] += $data[0]; ! $s_data[1] += $data[1]; ! $s_data[2] += $data[2]; ! $hasbots = true; ! unset($val[$dns]); ! } else { ! /* GEOIP TEST ! if ($BAW_CONF['module'] == 'drupal') { ! $dns = baw_create_link($dns , "/{$BAW_CONF['drupal_base']}/details/geoip/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); ! } else { ! $dns = baw_create_link($dns , "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=geoip"); ! }*/ ! unset($val[$dns]); ! $val[] = array( ! $dns, ! $data[0], ! $data[1], ! $data[2], ! baw_num_format($ratio, 2), ! $data[3] ! ); ! } } ! if ($hasbots) { ! $val['script'] = array( ! $ntype, ! $s_data[0], ! $s_data[1], ! $s_data[2], ! $s_data[1] / $s_data[0], ! $s_data['latest_date'] ! ); } ! if ($hashotlinks) { ! if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); ! } ! $val['hotlinks'] = array( ! $ntype, ! $h_data[0], ! $h_data[1], ! $h_data[2], ! 0, ! $h_data['latest_date'] ); } ! $val = baw_array_sorting($val, $set['sort'], $set['sort_dir']); } } else if ($BAW_CONF['hideempty']){ return ''; *************** *** 952,974 **** ); $val = array(); ! if ($val = baw_data($BAW_CURR['site_name'], "SIDER", $BAW_CURR['yearmonth'])) { if ($BAW_CONF['url_alias'] && isset($BAW_URLALIAS[$BAW_CURR['site_name']])) { $urlalias = baw_urlalias($BAW_CURR['site_name']); } ! foreach ($val as $url => $data) { ! if ($BAW_CONF['url_alias'] && isset($urlalias[$url])) { ! $linktext = $urlalias[$url]; ! } else { ! $linktext = $url; } - $link = baw_create_link($linktext, "http://{$BAW_CURR['site_name']}$url", array(), true); - // URL - Pages - Bandwidth - Entry - Exit - $val[$url] = array( - $link, - $data[0], - $data[1]/$data[0], // average size per page instead of sum - $data[2], - $data[3] - ); } } else if ($BAW_CONF['hideempty']){ --- 962,991 ---- ); $val = array(); ! if ($val = baw_data($BAW_CURR['site_name'], "SIDER", $BAW_CURR['yearmonth'], false)) { if ($BAW_CONF['url_alias'] && isset($BAW_URLALIAS[$BAW_CURR['site_name']])) { $urlalias = baw_urlalias($BAW_CURR['site_name']); } ! if ($BAW_CONF['DB_backend']) { // check first for DB_Data ! $server_id = baw_get_server_id($BAW_CURR['site_name']); ! $val = "SELECT `1`,`2`,`3`,`4`,`5` FROM SIDER " ! . "ORDER BY `2` " . baw_db_sort($set['sort_dir']); ! } else { ! foreach ($val as $url => $data) { ! if ($BAW_CONF['url_alias'] && isset($urlalias[$url])) { ! $linktext = $urlalias[$url]; ! } else { ! $linktext = $url; ! } ! $link = baw_create_link($linktext, "http://{$BAW_CURR['site_name']}$url", array(), true); ! // URL - Pages - Bandwidth - Entry - Exit ! unset($val[$url]); ! $val[] = array( ! $link, ! $data[0], ! $data[1]/$data[0], // average size per page instead of sum ! $data[2], ! $data[3] ! ); } } } else if ($BAW_CONF['hideempty']){ Index: helpers.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/helpers.inc.php,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** helpers.inc.php 17 Mar 2008 09:36:26 -0000 1.70 --- helpers.inc.php 18 Apr 2008 07:15:50 -0000 1.71 *************** *** 127,132 **** } $memory = baw_byte_format(memory_get_usage(),4); $time = baw_ptime(); ! echo "<div style=\"text-align:right\">$out | Memory used: $memory | Time: $time</div>\n"; } } --- 127,133 ---- } $memory = baw_byte_format(memory_get_usage(),4); + $peak_memory = baw_byte_format(memory_get_peak_usage(true)); $time = baw_ptime(); ! echo "<div style=\"text-align:right\">$out | Memory used: $memory | Peak Memory: $peak_memory | Time: $time</div>\n"; } } *************** *** 206,211 **** * */ ! function baw_getdate_format($str) { global $BAW_CONF; $out = date($BAW_CONF['date_format'], strtotime($str)); return $out; --- 207,215 ---- * */ ! function baw_getdate_format($str = 0) { global $BAW_CONF; + if ($str == 0) { + return ''; + } $out = date($BAW_CONF['date_format'], strtotime($str)); return $out; *************** *** 289,292 **** --- 293,297 ---- */ function baw_array_sorting($data, $column, $order = SORT_DESC) { + baw_debug("sorting process initiate"); if (count($data) ==0) { return $data; Index: config_default.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/config_default.inc.php,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** config_default.inc.php 9 Apr 2008 02:52:27 -0000 1.80 --- config_default.inc.php 18 Apr 2008 07:15:47 -0000 1.81 *************** *** 95,98 **** --- 95,135 ---- ), ), + $BAW_MES['cfg_db_settings'] => array ( + 'DB_backend' => array ( + 'type' => 'dropdown', + 'name' => $BAW_MES['cfg_db_config'], + 'default' => false, + 'help' => $BAW_MES['cfg_db_config_hlp'], + 'values' => array( + false => $BAW_MES['cfg_disable'], + 'mysql' => 'mysql', + 'mssql' => 'mssql', + ) + ), + 'DB_server' => array ( + 'type' => 'string', + 'name' => $BAW_MES['cfg_DB_server'], + 'default' => "localhost", + 'help' => $BAW_MES['cfg_DB_server_hlp'], + ), + 'DB_name' => array ( + 'type' => 'string', + 'name' => $BAW_MES['cfg_DB_name'], + 'default' => "betterawstats", + 'help' => $BAW_MES['cfg_DB_name_hlp'], + ), + 'DB_username' => array ( + 'type' => 'string', + 'name' => $BAW_MES['cfg_DB_username'], + 'default' => "betterawstats", + 'help' => $BAW_MES['cfg_DB_username_hlp'], + ), + 'DB_password' => array ( + 'type' => 'string', + 'name' => $BAW_MES['cfg_DB_password'], + 'default' => "betterawstats", + 'help' => $BAW_MES['cfg_DB_password_hlp'], + ), + ), $BAW_MES['cfg_layout_settings'] => array ( 'layout_type'=> array ( Index: data.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/data.inc.php,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** data.inc.php 9 Apr 2008 02:52:27 -0000 1.73 --- data.inc.php 18 Apr 2008 07:15:47 -0000 1.74 *************** *** 148,151 **** --- 148,159 ---- // add the sites to another array since we need that for the config editor $BAW_SERVERS[$site] = $site; + // add the same to DB + if ($BAW_CONF['DB_backend']) { + $db_srvrs = baw_sql('select', "SELECT * FROM servers WHERE name='$site'"); + if (count($db_srvrs) == 0) { + $sql = "INSERT INTO servers (name) VALUES ('$site')"; + $result = baw_sql('insert', $sql); + } + } baw_debug("SITE found for month $month and year $year: $file, SITE: {$site}"); } else if (preg_match($pat_urlalias, $file, $match) && $BAW_CONF['url_alias']) { *************** *** 311,318 **** * */ ! function baw_data($site, $data_type, $date) { global $BAW_CONF, $BAW_LIB, $BAW_CURR, $BAW_DFILES, $XML_VARS, $XML_ARR; $MAP = array(); ! baw_debug("reading $site datafile, type $data_type from $date"); // we have to remove the linebreaks otherwise they end up in the data $brs_arr = array("\n", "\r"); --- 319,359 ---- * */ ! function baw_data($site, $data_type, $date, $get_from_db = false) { global $BAW_CONF, $BAW_LIB, $BAW_CURR, $BAW_DFILES, $XML_VARS, $XML_ARR; $MAP = array(); ! // first we find out when the file was updated ! $update_db = false; ! ! if ($get_from_db && $data_type !== 'GENERAL' && $BAW_CONF['DB_backend']) { ! baw_debug("DB Backend $site datafile, Type $data_type, date $date"); ! $g = baw_data($BAW_CURR['site_name'], 'GENERAL', $BAW_CURR['yearmonth']); ! $lastupdate = $g['LastUpdate'][0]; ! // get the latest update ! $server_id = baw_get_server_id($site); ! $sql = "SELECT lastupdate " // check when this table was updated ! . "FROM $data_type " ! . "WHERE server_id = $server_id " ! . "AND `date`=$date " ! . "GROUP BY lastupdate;"; ! $db_srvrs = baw_sql('select', $sql); ! //is it the same? ! if (count($db_srvrs) == 0) { //no, update it ! $update_db = true; ! baw_debug("no DB entry found for $site datafile, date $date"); ! } else if (count($db_srvrs) > 0 && ($db_srvrs[0][0] == $lastupdate)) { ! baw_debug("current DB entry found for $site datafile, date $date"); ! return true; ! } else if (count($db_srvrs) > 0 && ($db_srvrs[0][0] != $lastupdate)) { ! baw_debug("outdated DB entry found for $site datafile, date $date"); ! $sql = "DELETE FROM $data_type " // check when this table was updated ! . "WHERE server_id = $server_id " ! . "AND `date`=$date "; ! $db_srvrs = baw_sql('delete', $sql); ! $update_db = true; ! } else { // yes, get values from the DB instead of file ! baw_debug("DB Backend update is same, skip action", true, true); ! } ! } ! // we have to remove the linebreaks otherwise they end up in the data $brs_arr = array("\n", "\r"); *************** *** 327,338 **** // iterate each data file ! $file = $dataset[$date]['file']; ! $f = fopen($file, 'r'); $map = $dataset[$date]['map']; ! baw_debug("reading site $site datafile, date $date, file $file"); // read the map if required if ($map == null) { ! baw_read_filemap($f, $site, $date); if (!isset($BAW_DFILES[$site][$date]['map'][$data_type])) { return false; --- 368,379 ---- // iterate each data file ! $file_name = $dataset[$date]['file']; ! $file = fopen($file_name, 'r'); $map = $dataset[$date]['map']; ! baw_debug("reading site $site datafile, type $data_type, date $date, file $file_name"); // read the map if required if ($map == null) { ! baw_read_filemap($file, $site, $date); if (!isset($BAW_DFILES[$site][$date]['map'][$data_type])) { return false; *************** *** 374,381 **** $filedata = $XML_ARR; } else {*/ ! fseek($f , $offset, SEEK_SET); while ($check !== 0) { baw_debug("reading aditional line to find data..."); ! $firstline = fgets($f, 20000); $check = strpos($firstline,"BEGIN_$data_type"); } --- 415,422 ---- $filedata = $XML_ARR; } else {*/ ! fseek($file, $offset, SEEK_SET); while ($check !== 0) { baw_debug("reading aditional line to find data..."); ! $firstline = fgets($file, 20000); $check = strpos($firstline,"BEGIN_$data_type"); } *************** *** 391,418 **** $index = explode(' ', $firstline); $lines_count = $index[1]; ! baw_debug("Data $data_type found at offset ". ftell($f) . " instead of $offset (" . (ftell($f) - $offset) . " diff), is $lines_count lines long, reading now:"); for ($i=0; $i<$lines_count;$i++) { baw_debug("reading Line $data_type $i"); ! $str = fgets($f, 20000); if (substr($str,0,4) == 'END_') { // this is a security check since sometimes we are off continue; } // remove linebreaks from string ! $str = str_replace($brs_arr,$brr_arr, $str); if ($BAW_CURR['XML']) { $str = baw_xml_replace($str); } $line_arr = explode(' ', $str); ! // shift first element as array name ! $first_element = array_shift($line_arr); ! // check if one dataset has occurred twice and would ! // overwrite another. SIDER and PAGEREF had this issue for sure. ! if (!isset($filedata[$first_element])) { ! $filedata[$first_element] = $line_arr; ! } else { ! foreach ($line_arr as $no => $line_item) { ! if (is_numeric($line_item)) { ! // this could cause trouble in case this was a date, percentage etc. ! $filedata[$first_element][$no] += $line_item; } } --- 432,477 ---- $index = explode(' ', $firstline); $lines_count = $index[1]; ! baw_debug("Data $data_type found at offset ". ftell($file) . " instead of $offset (" . (ftell($file) - $offset) . " diff), is $lines_count lines long, reading now:"); for ($i=0; $i<$lines_count;$i++) { baw_debug("reading Line $data_type $i"); ! $str = fgets($file, 20000); if (substr($str,0,4) == 'END_') { // this is a security check since sometimes we are off continue; } // remove linebreaks from string ! $str = str_replace($brs_arr,$brr_arr, trim($str)); if ($BAW_CURR['XML']) { $str = baw_xml_replace($str); } $line_arr = explode(' ', $str); ! if ($update_db == true && $get_from_db) { ! // write values to DB ! $insert_sql_values = str_replace(' ', "','", $str); ! // instead of counting the fields we should write the numbe ! $insert_sql_fields = ''; ! $count_fields = count($line_arr); ! for ($f=1; $f<=$count_fields; $f++) { ! $insert_sql_fields .= ",`$f`"; ! } ! $insert_sql_fields = substr($insert_sql_fields, 1); ! $sql = "INSERT INTO $data_type (`server_id`, `date`, `lastupdate`, $insert_sql_fields) " ! . "VALUES ('$server_id', '$date', '$lastupdate', '$insert_sql_values');"; ! $insert = baw_sql('insert', $sql); ! if (!$insert) { ! //echo $sql; ! } ! } else { // use array ! // shift first element as array name ! $first_element = array_shift($line_arr); ! // check if one dataset has occurred twice and would ! // overwrite another. SIDER and PAGEREF had this issue for sure. ! if (!isset($filedata[$first_element])) { ! $filedata[$first_element] = $line_arr; ! } else { ! foreach ($line_arr as $no => $line_item) { ! if (is_numeric($line_item)) { ! // this could cause trouble in case this was a date, percentage etc. ! $filedata[$first_element][$no] += $line_item; ! } } } *************** *** 420,424 **** } //} ! fclose($f); baw_debug("data read, file closed"); return $filedata; --- 479,483 ---- } //} ! fclose($file); baw_debug("data read, file closed"); return $filedata; Index: display_helpers.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display_helpers.php,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** display_helpers.php 9 Apr 2008 02:52:27 -0000 1.137 --- display_helpers.php 18 Apr 2008 07:15:50 -0000 1.138 *************** *** 592,596 **** $out .= "<html$root_dec>\n" ." <head>\n" ! ." <title>$title Better AWstats v{$BAW_CONF_DEF[$BAW_MES['cfg_advanced_settings']]['version']['default']}</title>\n" ." <meta http-equiv=\"Content-Type\" content=\"text/html;charset={$BAW_MES['e']}\"" . XHTML . ">\n" ." <link rel=\"stylesheet\" type=\"text/css\" href=\"{$BAW_CONF['site_url']}/style.css\"" . XHTML . ">\n" --- 592,596 ---- $out .= "<html$root_dec>\n" ." <head>\n" ! ." <title>$title - BetterAWstats v{$BAW_CONF_DEF[$BAW_MES['cfg_advanced_settings']]['version']['default']}</title>\n" ." <meta http-equiv=\"Content-Type\" content=\"text/html;charset={$BAW_MES['e']}\"" . XHTML . ">\n" ." <link rel=\"stylesheet\" type=\"text/css\" href=\"{$BAW_CONF['site_url']}/style.css\"" . XHTML . ">\n" Index: library.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/library.inc.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** library.inc.php 17 Mar 2008 09:36:26 -0000 1.44 --- library.inc.php 18 Apr 2008 07:15:50 -0000 1.45 *************** *** 165,171 **** ); ! /* ! this is obsolete but kept here for ev. future usage ! $BAW_LIB['data']['full'] = array( 'GENERAL' => array('Misc ID', 'Pages', 'Hits', 'Bandwidth'), --- 165,169 ---- ); ! // this is needed now for the DB access. $BAW_LIB['data']['full'] = array( 'GENERAL' => array('Misc ID', 'Pages', 'Hits', 'Bandwidth'), *************** *** 196,200 **** 'EXTRA_1' => array('Extra key','Pages','Hits','Bandwidth','Last access') ); ! */ ?> \ No newline at end of file --- 194,198 ---- 'EXTRA_1' => array('Extra key','Pages','Hits','Bandwidth','Last access') ); ! ?> \ No newline at end of file |
From: Oliver S. <tok...@us...> - 2008-04-18 07:15:49
|
Update of /cvsroot/betterawstats/betterawstats/language In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28387/language Modified Files: lang_en.inc.php Log Message: experimental DB-caching function implemented Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/language/lang_en.inc.php,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** lang_en.inc.php 16 Apr 2008 01:39:19 -0000 1.61 --- lang_en.inc.php 18 Apr 2008 07:15:50 -0000 1.62 *************** *** 158,161 **** --- 158,172 ---- 'cfg_web_config_pw_hlp' => 'This password is needed to access the online ' . 'configuration. It has to be longer than 5 letters.', + 'cfg_db_settings' => 'Database Settings', + 'cfg_db_config' => '', + 'cfg_db_config_hlp' => '', + 'cfg_DB_server' => '', + 'cfg_DB_server_hlp' => '', + 'cfg_DB_name' => '', + 'cfg_DB_name_hlp' => '', + 'cfg_DB_username' => '', + 'cfg_DB_username_hlp' => '', + 'cfg_DB_password' => '', + 'cfg_DB_password_hlp' => '', 'cfg_limit_server' => 'Limit to server?', 'cfg_limit_server_hlp' => 'Set this to a single server that you want to limit ' |
From: Oliver S. <tok...@us...> - 2008-04-18 07:15:49
|
Update of /cvsroot/betterawstats/betterawstats/modules In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28387/modules Modified Files: render_table.inc.php Log Message: experimental DB-caching function implemented Index: render_table.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/modules/render_table.inc.php,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** render_table.inc.php 29 Mar 2008 05:27:35 -0000 1.61 --- render_table.inc.php 18 Apr 2008 07:15:50 -0000 1.62 *************** *** 69,72 **** --- 69,77 ---- global $BAW_CONF, $BAW_LIB, $BAW_MES, $BAW_CONF_DIS; baw_debug("rendering table $section_name"); + $sql = false; + if (!is_array($table)) { + $sql = $table; + $table = baw_sql('select', $sql); + } $out = ''; $theader = "\n<table class=\"datatable\">\n"; *************** *** 120,123 **** --- 125,129 ---- $othercount = 0; $hasothers = false; + foreach ($table as $lineid => $row) { $cell_no = 0; *************** *** 152,156 **** if ($hasothers) { $othercount ++; ! unset($table[$lineid]); } // remove one line from avg-count if data empty --- 158,165 ---- if ($hasothers) { $othercount ++; ! if (!$sql) { ! unset($table[$lineid]); ! } ! } // remove one line from avg-count if data empty *************** *** 160,163 **** --- 169,173 ---- $row_no++; // count to find out if we are ready to do averages } + // add others to the table if ($hasothers) { // we got others, add them to the end *************** *** 194,197 **** --- 204,211 ---- $lastlineid = ''; $rowspan = array(); + if ($sql) { + $table = baw_sql('select', $sql . " LIMIT " . $top_x ); + } + foreach ($table as $lineid => $row) { $cell_no = 0; |
From: Oliver S. <tok...@us...> - 2008-04-16 01:43:37
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4709 Modified Files: display.inc.php Log Message: improving code Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** display.inc.php 16 Apr 2008 01:41:35 -0000 1.160 --- display.inc.php 16 Apr 2008 01:43:43 -0000 1.161 *************** *** 1741,1752 **** ); $newval = array(); ! if ($val = baw_data($BAW_CURR['site_name'], 'MISC', $BAW_CURR['yearmonth'])) { ! if ($val['TotalMisc'][1] > 0) { ! foreach ($BAW_LIB['misc'] as $type => $msg) { ! $percent = $val[$type][1] / ($val['TotalMisc'][1] / 100); ! $newval[$type] = array($BAW_MES[$msg], @$val[$type][1], $percent); ! } ! } else { ! return ''; } } else if ($BAW_CONF['hideempty']){ --- 1741,1749 ---- ); $newval = array(); ! $val = baw_data($BAW_CURR['site_name'], 'MISC', $BAW_CURR['yearmonth']); ! if ($val && ($val['TotalMisc'][1] > 0)) { ! foreach ($BAW_LIB['misc'] as $type => $msg) { ! $percent = $val[$type][1] / ($val['TotalMisc'][1] / 100); ! $newval[$type] = array($BAW_MES[$msg], @$val[$type][1], $percent); } } else if ($BAW_CONF['hideempty']){ |
From: Oliver S. <tok...@us...> - 2008-04-16 01:41:33
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3875 Modified Files: display.inc.php Log Message: fixing condition error Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** display.inc.php 16 Apr 2008 01:39:19 -0000 1.159 --- display.inc.php 16 Apr 2008 01:41:35 -0000 1.160 *************** *** 434,439 **** $newval_table = array(); $newval_chart = array(); ! if ($val = baw_data($BAW_CURR['site_name'], "TIME", $BAW_CURR['yearmonth']) && ! $days = baw_data($BAW_CURR['site_name'], "DAY", $BAW_CURR['yearmonth'])) { // instead of counting days, (one day in the middle might be zero) we should // find the first and the last day --- 434,440 ---- $newval_table = array(); $newval_chart = array(); ! $val = baw_data($BAW_CURR['site_name'], "TIME", $BAW_CURR['yearmonth']); ! $days = baw_data($BAW_CURR['site_name'], "DAY", $BAW_CURR['yearmonth']); ! if ($val && $days) { // instead of counting days, (one day in the middle might be zero) we should // find the first and the last day |
From: Oliver S. <tok...@us...> - 2008-04-16 01:39:18
|
Update of /cvsroot/betterawstats/betterawstats/language In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2768/language Modified Files: lang_en.inc.php Log Message: fixing empty variables notices Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/language/lang_en.inc.php,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** lang_en.inc.php 10 Apr 2008 01:26:06 -0000 1.60 --- lang_en.inc.php 16 Apr 2008 01:39:19 -0000 1.61 *************** *** 299,303 **** . "editor that you can use instead of editing this file here. The link " . "is on the bottom of the menu! To use it, set \$BAW_CONF['online_config']" ! . "= true; and make sure that the file is writable by the server, AND protect" . "the BetterAWStats installation by a .htaccess file!", 'cfg_name' => 'NAME: ', --- 299,303 ---- . "editor that you can use instead of editing this file here. The link " . "is on the bottom of the menu! To use it, set \$BAW_CONF['online_config']" ! . "= true; and make sure that the file is writable by the server, AND protect " . "the BetterAWStats installation by a .htaccess file!", 'cfg_name' => 'NAME: ', |
From: Oliver S. <tok...@us...> - 2008-04-16 01:39:18
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2768/core Modified Files: display.inc.php Log Message: fixing empty variables notices Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** display.inc.php 10 Apr 2008 01:26:05 -0000 1.158 --- display.inc.php 16 Apr 2008 01:39:19 -0000 1.159 *************** *** 156,160 **** } // get the data for that month ! if (isset($BAW_DFILES[$site][$tyear . $tmonth])) { $g = baw_data($site, 'GENERAL', $tyear . $tmonth); $t = baw_data($site, 'TIME', $tyear . $tmonth); --- 156,160 ---- } // get the data for that month ! if (isset($BAW_DFILES[$site][$tyear . $tmonth]) && $days_of_month > 0) { $g = baw_data($site, 'GENERAL', $tyear . $tmonth); $t = baw_data($site, 'TIME', $tyear . $tmonth); *************** *** 432,438 **** 4 => array ('title'=> $BAW_MES[75], 'format' => 'layout_bytes') ); ! $newval = array(); ! if ($val = baw_data($BAW_CURR['site_name'], "TIME", $BAW_CURR['yearmonth'])) { ! $days = baw_data($BAW_CURR['site_name'], "DAY", $BAW_CURR['yearmonth']); // instead of counting days, (one day in the middle might be zero) we should // find the first and the last day --- 432,439 ---- 4 => array ('title'=> $BAW_MES[75], 'format' => 'layout_bytes') ); ! $newval_table = array(); ! $newval_chart = array(); ! if ($val = baw_data($BAW_CURR['site_name'], "TIME", $BAW_CURR['yearmonth']) && ! $days = baw_data($BAW_CURR['site_name'], "DAY", $BAW_CURR['yearmonth'])) { // instead of counting days, (one day in the middle might be zero) we should // find the first and the last day *************** *** 1740,1746 **** $newval = array(); if ($val = baw_data($BAW_CURR['site_name'], 'MISC', $BAW_CURR['yearmonth'])) { ! foreach ($BAW_LIB['misc'] as $type => $msg) { ! @$percent = $val[$type][1] / ($val['TotalMisc'][1] / 100); ! $newval[$type] = array($BAW_MES[$msg], @$val[$type][1], $percent); } } else if ($BAW_CONF['hideempty']){ --- 1741,1751 ---- $newval = array(); if ($val = baw_data($BAW_CURR['site_name'], 'MISC', $BAW_CURR['yearmonth'])) { ! if ($val['TotalMisc'][1] > 0) { ! foreach ($BAW_LIB['misc'] as $type => $msg) { ! $percent = $val[$type][1] / ($val['TotalMisc'][1] / 100); ! $newval[$type] = array($BAW_MES[$msg], @$val[$type][1], $percent); ! } ! } else { ! return ''; } } else if ($BAW_CONF['hideempty']){ |
From: Oliver S. <tok...@us...> - 2008-04-16 01:39:18
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2768 Modified Files: config.php Log Message: fixing empty variables notices Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** config.php 10 Apr 2008 01:26:05 -0000 1.125 --- config.php 16 Apr 2008 01:39:19 -0000 1.126 *************** *** 35,39 **** // instead of editing this file here. The link is on the bottom of the menu! // To use it, set $BAW_CONF['online_config']= true; and make sure that the ! // file is writable by the server, AND protectthe BetterAWStats installation // by a .htaccess file! --- 35,39 ---- // instead of editing this file here. The link is on the bottom of the menu! // To use it, set $BAW_CONF['online_config']= true; and make sure that the ! // file is writable by the server, AND protect the BetterAWStats installation // by a .htaccess file! |
From: Oliver S. <tok...@us...> - 2008-04-10 01:26:03
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10427 Modified Files: config.php Log Message: added chart to visits duration Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** config.php 9 Apr 2008 03:00:50 -0000 1.124 --- config.php 10 Apr 2008 01:26:05 -0000 1.125 *************** *** 479,482 **** --- 479,483 ---- 'total' => false, // Show total Sum? 'table' => true, // Show data table? + 'chart' => true, // Show HTML chart? ); |
From: Oliver S. <tok...@us...> - 2008-04-10 01:26:02
|
Update of /cvsroot/betterawstats/betterawstats/language In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10427/language Modified Files: lang_en.inc.php Log Message: added chart to visits duration Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/language/lang_en.inc.php,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** lang_en.inc.php 9 Apr 2008 03:00:51 -0000 1.59 --- lang_en.inc.php 10 Apr 2008 01:26:06 -0000 1.60 *************** *** 365,369 **** . 'visits with a low hits/pages ratio are most ' . 'likely bots, scripts or other software but not by normal users. ' ! . 'Those are summed up here under "Assumed Scripts & Bots". To change the ratio ' . 'that defines a visit as a script, please change the ' . '$BAW_CONF_DIS[\'visitors\'][\'assumebot\'] value in the configuration.' --- 365,369 ---- . 'visits with a low hits/pages ratio are most ' . 'likely bots, scripts or other software but not by normal users. ' ! . 'Those are summed up here under "Assumed Robots/Spiders". To change the ratio ' . 'that defines a visit as a script, please change the ' . '$BAW_CONF_DIS[\'visitors\'][\'assumebot\'] value in the configuration.' |
From: Oliver S. <tok...@us...> - 2008-04-10 01:26:02
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10427/core Modified Files: display.inc.php Log Message: added chart to visits duration Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** display.inc.php 9 Apr 2008 03:00:51 -0000 1.157 --- display.inc.php 10 Apr 2008 01:26:05 -0000 1.158 *************** *** 838,847 **** --- 838,853 ---- $newval = array(); + $newval_chart = array(); $sum = 0; // sum for "unknown" if ($val = baw_data($BAW_CURR['site_name'], "SESSION", $BAW_CURR['yearmonth'])) { foreach ($BAW_LIB['sessions'] as $timespan) { $newval[$timespan] = array($timespan, 0); + $timespan_short = explode("-", $timespan); + if (isset($timespan_short[1])) { + $newval_chart[$timespan] = array($timespan_short[1], 0); + } if (isset($val[$timespan][0])) { $newval[$timespan][1] = $val[$timespan][0]; + $newval_chart[$timespan][1] = $val[$timespan][0]; $sum += $val[$timespan][0]; } *************** *** 849,852 **** --- 855,859 ---- $unknown = $BAW_CURR['thismonth']['hits'] - $sum; $newval['Unknown'] = array('Unknown', $unknown); + $newval_chart['?'] = array('?', $unknown); } else if ($BAW_CONF['hideempty']){ return ''; *************** *** 854,857 **** --- 861,867 ---- // $newval = baw_array_sorting($newval, 1, SORT_DESC); $out = ''; + if ($set['chart']) { + $out .= baw_render_htmlchart($newval_chart, $format, $set['avg'], false); + } if ($set['table']) { $out .= baw_render_table($set['name'], $newval, $format, $set['avg'], $set['total'], false); |
From: Oliver S. <tok...@us...> - 2008-04-10 01:26:02
|
Update of /cvsroot/betterawstats/betterawstats/docs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10427/docs Modified Files: history.txt Log Message: added chart to visits duration Index: history.txt =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/docs/history.txt,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** history.txt 9 Apr 2008 02:52:28 -0000 1.94 --- history.txt 10 Apr 2008 01:26:06 -0000 1.95 *************** *** 4,7 **** --- 4,8 ---- - added details list for robots/spiders, hotlinks/proxies hosts - added config option to use averages or not + - added chart for visits duration - fixed average values to be shown for months - fixed error in map dsplay for us-related data |
From: Oliver S. <tok...@us...> - 2008-04-09 03:00:48
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25693 Modified Files: config.php Log Message: cosmetics Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** config.php 9 Apr 2008 02:52:27 -0000 1.123 --- config.php 9 Apr 2008 03:00:50 -0000 1.124 *************** *** 170,174 **** $BAW_CONF['url_alias'] = true; ! $BAW_CONF['time_averages'] = false; //*********************************************************/ --- 170,180 ---- $BAW_CONF['url_alias'] = true; ! // NAME: Average Values ! // INFO: Show average values for months, weekdays & time ! // DEFAULT: true ! // POSSIBLE VALUES: true, false ! $BAW_CONF['time_averages'] = true; ! ! //*********************************************************/ *************** *** 308,312 **** ); ! // NAME: Monthly history // INFO: Monthly data $BAW_CONF_DIS['months'] = array( --- 314,318 ---- ); ! // NAME: Monthly history (Averages) // INFO: Monthly data $BAW_CONF_DIS['months'] = array( |
From: Oliver S. <tok...@us...> - 2008-04-09 03:00:48
|
Update of /cvsroot/betterawstats/betterawstats/language In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25693/language Modified Files: lang_en.inc.php Log Message: cosmetics Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/language/lang_en.inc.php,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** lang_en.inc.php 9 Apr 2008 02:52:28 -0000 1.58 --- lang_en.inc.php 9 Apr 2008 03:00:51 -0000 1.59 *************** *** 159,163 **** . 'configuration. It has to be longer than 5 letters.', 'cfg_limit_server' => 'Limit to server?', ! 'cfg_limit_server_hlp' => 'Set this to a simgle server that you want to limit ' . 'or "false" to show all. The server name should be the one used for awstats.', 'cfg_layout_settings' => 'Layout Settings', --- 159,163 ---- . 'configuration. It has to be longer than 5 letters.', 'cfg_limit_server' => 'Limit to server?', ! 'cfg_limit_server_hlp' => 'Set this to a single server that you want to limit ' . 'or "false" to show all. The server name should be the one used for awstats.', 'cfg_layout_settings' => 'Layout Settings', *************** *** 200,204 **** 'cfg_url_alias_hlp' => 'Enable to use the URL-Alias files for AWStats', 'cfg_time_averages' => 'Average Values', ! 'cfg_time_averages_hlp' => 'Show average values for months, weekdays & time', 'cfg_chart_settings' => 'Chart Settings', 'cfg_max_scale_visitors' => 'Max scale for Visitors', --- 200,205 ---- 'cfg_url_alias_hlp' => 'Enable to use the URL-Alias files for AWStats', 'cfg_time_averages' => 'Average Values', ! 'cfg_time_averages_hlp' => 'Show average values for months, weekdays & time. ' ! . 'It is STRONGLY recommended to enable this to show more realistic data for unfinshed months', 'cfg_chart_settings' => 'Chart Settings', 'cfg_max_scale_visitors' => 'Max scale for Visitors', |
From: Oliver S. <tok...@us...> - 2008-04-09 03:00:48
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25693/core Modified Files: display.inc.php Log Message: cosmetics Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** display.inc.php 9 Apr 2008 02:52:27 -0000 1.156 --- display.inc.php 9 Apr 2008 03:00:51 -0000 1.157 *************** *** 435,438 **** --- 435,440 ---- if ($val = baw_data($BAW_CURR['site_name'], "TIME", $BAW_CURR['yearmonth'])) { $days = baw_data($BAW_CURR['site_name'], "DAY", $BAW_CURR['yearmonth']); + // instead of counting days, (one day in the middle might be zero) we should + // find the first and the last day $count_days = count($days); foreach ($val as $hour => $data) { |
From: Oliver S. <tok...@us...> - 2008-04-09 02:52:25
|
Update of /cvsroot/betterawstats/betterawstats/docs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22370/docs Modified Files: history.txt Log Message: averages enabled and fixed for month display Index: history.txt =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/docs/history.txt,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** history.txt 7 Apr 2008 06:09:04 -0000 1.93 --- history.txt 9 Apr 2008 02:52:28 -0000 1.94 *************** *** 3,8 **** --- 3,12 ---- - added XML-Datafile support - added details list for robots/spiders, hotlinks/proxies hosts + - added config option to use averages or not + - fixed average values to be shown for months - fixed error in map dsplay for us-related data - fixed memory_get_peak_usage()-problem with php 5.2.1 + - fixed days & weekdays to not include empty days of first recorded month + - fixed days display to always show 31 days if current month is not finished == 1.0 == |
From: Oliver S. <tok...@us...> - 2008-04-09 02:52:25
|
Update of /cvsroot/betterawstats/betterawstats/language In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22370/language Modified Files: lang_en.inc.php Log Message: averages enabled and fixed for month display Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/language/lang_en.inc.php,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** lang_en.inc.php 7 Apr 2008 06:02:03 -0000 1.57 --- lang_en.inc.php 9 Apr 2008 02:52:28 -0000 1.58 *************** *** 21,28 **** 'by_domains' => '%s by Domains', 'visits' => 'Visits', - 'averages' => ' (Averages)', 'assumedscript' => 'Assumed Robots/Spiders', ! 'weekday_averages' => $BAW_MES[91] . ' (Averages)', ! 'hours_averages' => $BAW_MES[20] . ' (Averages)', 'os_versions' => "{$BAW_MES[59]} (+{$BAW_MES[58]})", 'browser_versions' => "{$BAW_MES[21]} (+{$BAW_MES[58]})", --- 21,26 ---- 'by_domains' => '%s by Domains', 'visits' => 'Visits', 'assumedscript' => 'Assumed Robots/Spiders', ! 'averages' => '%s (Averages)', 'os_versions' => "{$BAW_MES[59]} (+{$BAW_MES[58]})", 'browser_versions' => "{$BAW_MES[21]} (+{$BAW_MES[58]})", *************** *** 201,204 **** --- 199,204 ---- 'cfg_url_alias' => 'URL-Alias', 'cfg_url_alias_hlp' => 'Enable to use the URL-Alias files for AWStats', + 'cfg_time_averages' => 'Average Values', + 'cfg_time_averages_hlp' => 'Show average values for months, weekdays & time', 'cfg_chart_settings' => 'Chart Settings', 'cfg_max_scale_visitors' => 'Max scale for Visitors', *************** *** 342,357 **** . 'Corrupted and Dropped lines.', 'hlp_months' => 'This section shows the history of data several months into ' ! . 'the past. You can change the time span in the configuration.', 'hlp_days' => 'This section shows the daily history of data of the selected month. ' . 'If the current month is not finished, it will show the data of the ' ! . 'past month for the same amount of days that are left within the current month. ', 'hlp_weekdays' => 'This section shows the averages of visits/pages/hits history for ' .'each weekday. Since the each month has a different amount of weekdays, summing ' . 'up the data as AWSTATS is doing it, would distort the data. That is why BetterAWStats ' ! . 'is showing the averages only.', 'hlp_hours' => 'This section shows the averages of visits/pages/hits history for ' .'each hour of the day. In case the current month is not finished, summing ' . 'up the data as AWSTATS is doing it, would distort the data. That is why BetterAWStats ' ! . 'is showing the averages.', 'hlp_domains' => 'This section shows the hits per country (if known). Please note that ' . 'the map-image summs the domains us, mil, edu, gov and arpa into the "us" domain.', --- 342,361 ---- . 'Corrupted and Dropped lines.', 'hlp_months' => 'This section shows the history of data several months into ' ! . 'the past. You can change the time span in the configuration. ' ! . 'BetterAWStats considers if the first month with data and the last month with data is ' ! . 'missing days, if averages are set to be shown in the config.', 'hlp_days' => 'This section shows the daily history of data of the selected month. ' . 'If the current month is not finished, it will show the data of the ' ! . 'past month for last 31 days.', 'hlp_weekdays' => 'This section shows the averages of visits/pages/hits history for ' .'each weekday. Since the each month has a different amount of weekdays, summing ' . 'up the data as AWSTATS is doing it, would distort the data. That is why BetterAWStats ' ! . 'is showing the averages if set in the config. In addition, BetterAWStats shows you the averages over ' ! . 'the last 31 days instead of only the figures for the selected month, ' ! . 'in case the current month is not yet finished.', 'hlp_hours' => 'This section shows the averages of visits/pages/hits history for ' .'each hour of the day. In case the current month is not finished, summing ' . 'up the data as AWSTATS is doing it, would distort the data. That is why BetterAWStats ' ! . 'is showing the averages if set in config.', 'hlp_domains' => 'This section shows the hits per country (if known). Please note that ' . 'the map-image summs the domains us, mil, edu, gov and arpa into the "us" domain.', |
From: Oliver S. <tok...@us...> - 2008-04-09 02:52:25
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22370/core Modified Files: config_default.inc.php data.inc.php display.inc.php display_helpers.php Log Message: averages enabled and fixed for month display Index: data.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/data.inc.php,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** data.inc.php 2 Apr 2008 01:34:10 -0000 1.72 --- data.inc.php 9 Apr 2008 02:52:27 -0000 1.73 *************** *** 137,140 **** --- 137,149 ---- 'map' => null ); + // find out the first month and the last month since they might be incomplete + if (!isset($BAW_DFILES[$site]['firstmonth'])) { + $BAW_DFILES[$site]['firstmonth'] = 999999; + } + $BAW_DFILES[$site]['firstmonth'] = min($BAW_DFILES[$site]['firstmonth'], $year.$month); + if (!isset($BAW_DFILES[$site]['lastmonth'])) { + $BAW_DFILES[$site]['lastmonth'] = 0; + } + $BAW_DFILES[$site]['lastmonth'] = max($BAW_DFILES[$site]['lastmonth'], $year.$month); // add the sites to another array since we need that for the config editor $BAW_SERVERS[$site] = $site; Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** display.inc.php 8 Apr 2008 07:36:08 -0000 1.155 --- display.inc.php 9 Apr 2008 02:52:27 -0000 1.156 *************** *** 118,137 **** foreach ($sites as $site) { $data_format = array(); ! $x = 0; $val = array(); $monthback = $set['top_x'] - 1; ! $chart = array(); ! $val_chart = array(); ! $lastyear = 0; for ($i=$monthback; $i>=0; $i--){ // get the month & Year x month ago $tyear = date("Y", mktime(0, 0, 0, $BAW_CURR['month']-$i, 1, $BAW_CURR['year'])); $tmonth = date("m", mktime(0, 0, 0, $BAW_CURR['month']-$i, 1, $BAW_CURR['year'])); // get the data for that month ! if (isset($BAW_DFILES[$site][$tyear .$tmonth])) { $g = baw_data($site, 'GENERAL', $tyear . $tmonth); $t = baw_data($site, 'TIME', $tyear . $tmonth); $data = baw_calc_monthdata($t, $g); ! $x++; $month_text = $tmonth + 59; $class = ''; --- 118,164 ---- foreach ($sites as $site) { $data_format = array(); ! //$x = 0; $val = array(); $monthback = $set['top_x'] - 1; ! //$chart = array(); ! //$val_chart = array(); ! //$lastyear = 0; for ($i=$monthback; $i>=0; $i--){ // get the month & Year x month ago $tyear = date("Y", mktime(0, 0, 0, $BAW_CURR['month']-$i, 1, $BAW_CURR['year'])); $tmonth = date("m", mktime(0, 0, 0, $BAW_CURR['month']-$i, 1, $BAW_CURR['year'])); + if ($BAW_CONF['time_averages'] == true) { + // if the first month does not have data for the first x days, they should not count + // find if we are in the first month + if ($BAW_DFILES[$site]['firstmonth'] == $tyear . $tmonth) { + // find out at which date the first data starts + $first_month_val = baw_data($site, 'DAY', $tyear . $tmonth); + $data_start = substr(key($first_month_val), -2); + // get the total amount of days for that month + $first_month_days = date("t", mktime(0, 0, 0, $tmonth, 1, $tyear)); + // set how many days we have so we can divide for the average + $days_of_month = abs($data_start - $first_month_days) + 1; + } else if ($BAW_DFILES[$site]['lastmonth'] == $tyear . $tmonth){ // current / last month + // we have to get the data from file instead of taking todays date + // since we do not know when the data was updated last time. + // the server might update the stats not on a daily base etc + $first_month_val = baw_data($site, 'DAY', $tyear . $tmonth); + // find out at which date the first data ends by reversing the array + $first_month_val = array_reverse($first_month_val, true); + // take the first key of reversed array which is our result! + $days_of_month = substr(key($first_month_val), -2); + } else { + $days_of_month = date("t", mktime(0, 0, 0, $BAW_CURR['month']-$i, 1, $BAW_CURR['year'])); + } + } else { + // divide by one to get the same number + $days_of_month = 1; + } // get the data for that month ! if (isset($BAW_DFILES[$site][$tyear . $tmonth])) { $g = baw_data($site, 'GENERAL', $tyear . $tmonth); $t = baw_data($site, 'TIME', $tyear . $tmonth); $data = baw_calc_monthdata($t, $g); ! //$x++; $month_text = $tmonth + 59; $class = ''; *************** *** 141,147 **** $class = "currentday"; } ! for ($j=0; $j<5; $j++) { $chart["{$BAW_MES[$month_text]}|$tyear"][] = array('data' => "$data[$j]", 'class' => "$class", 'format' => $frm_arr[$j]); ! } $class .= baw_even($tyear, ' evenyear', ' oddyear'); --- 168,174 ---- $class = "currentday"; } ! /* for ($j=0; $j<5; $j++) { $chart["{$BAW_MES[$month_text]}|$tyear"][] = array('data' => "$data[$j]", 'class' => "$class", 'format' => $frm_arr[$j]); ! } */ $class .= baw_even($tyear, ' evenyear', ' oddyear'); *************** *** 149,157 **** $tyear, $BAW_MES[$month_text], ! $data[0], ! $data[1], ! $data[2], ! $data[3], ! $data[4], ); if ($class !== '') { --- 176,184 ---- $tyear, $BAW_MES[$month_text], ! $data[0] / $days_of_month, ! $data[1] / $days_of_month, ! $data[2] / $days_of_month, ! $data[3] / $days_of_month, ! $data[4] / $days_of_month, ); if ($class !== '') { *************** *** 182,191 **** $wdcount_arr = array(0,0,0,0,0,0,0); // count the number of sat, sun etc $wdavg_arr = array(); // values of avg ! $daysoflastmonth = 30; - // assemble date $daysofmonth = date("t", strtotime("{$BAW_CURR['year']}{$BAW_CURR['month']}01000000")); - //$thisyear = date("Y", strtotime("-1 month")); - //$lastyear = date("Y", strtotime("-1 month -1 year")); $current_month = date('m'); $current_day = date('d'); --- 209,215 ---- $wdcount_arr = array(0,0,0,0,0,0,0); // count the number of sat, sun etc $wdavg_arr = array(); // values of avg ! $daysoflastmonth = 31; $daysofmonth = date("t", strtotime("{$BAW_CURR['year']}{$BAW_CURR['month']}01000000")); $current_month = date('m'); $current_day = date('d'); *************** *** 194,197 **** --- 218,222 ---- // find how may days we have to go back if ($BAW_CURR['month'] == $current_month) { // if we have the current month, get some data from the last month + $daysofmonth = 31; // if current month called, always go 31 days back $daydiff = abs($current_day - $daysofmonth); // calculate how many days are missing } *************** *** 242,248 **** $newval = array(); $lastmonth = 0; for ($j=0; $j<$daysofmonth; $j++) { $class = ''; - // foreach ($val as $date => $data) { $date = date("Ymd", mktime(0,0,0,$BAW_CURR['month'],1+ $j - $daydiff,$BAW_CURR['year'])); $month = date("m", mktime(0,0,0,$BAW_CURR['month'],1+ $j - $daydiff,$BAW_CURR['year'])); --- 267,275 ---- $newval = array(); $lastmonth = 0; + // set that we do not care for the first empty days in case we have them + $firstdata = false; + // now iterate all days to display for ($j=0; $j<$daysofmonth; $j++) { $class = ''; $date = date("Ymd", mktime(0,0,0,$BAW_CURR['month'],1+ $j - $daydiff,$BAW_CURR['year'])); $month = date("m", mktime(0,0,0,$BAW_CURR['month'],1+ $j - $daydiff,$BAW_CURR['year'])); *************** *** 253,256 **** --- 280,285 ---- if (!isset($val[$date])) { $val[$date] = array(0,0,0,0,0); + } else { + $firstdata = true; } $data = $val[$date]; *************** *** 264,297 **** } // these lines is only for collecting data for weekdays ! $wdcount_arr[$wday]++; // count no of one weekday for avg division ! for ($i=0; $i<=3; $i++) { // iterate data types ! if (!isset($wdsum_arr[$wday][$i])) { ! $wdsum_arr[$wday][$i] = 0; } - $wdsum_arr[$wday][$i] += $data[$i]; - } - - if (!isset($from)) { - $from = $xdate; - } - $BAW_CURR['wdays']['count'] = $wdcount_arr; - $BAW_CURR['wdays']['avg'] = $wdsum_arr; - $BAW_CURR['wdays']['from'] = $from; - $BAW_CURR['wdays']['to'] = $xdate; - if (($j !== $daysofmonth)) { - $newval[$xdate] = array( - date("Y", strtotime($xdate)), - date("M", strtotime($xdate)), - date("d", strtotime($xdate)), - $data[3], - $data[0], - $data[1], - $data[2] - ); - } ! $class .= baw_even($month, ' evenmonth', ' oddmonth'); ! if ($class !== '') { ! $data_format[$xdate] = $class; } } --- 293,328 ---- } // these lines is only for collecting data for weekdays ! // and count them only after the first existing dataset ! if ($firstdata) { ! $wdcount_arr[$wday]++; // count no of one weekday for avg division ! for ($i=0; $i<=3; $i++) { // iterate data types ! if (!isset($wdsum_arr[$wday][$i])) { ! $wdsum_arr[$wday][$i] = 0; ! } ! $wdsum_arr[$wday][$i] += $data[$i]; ! } ! if (!isset($from)) { ! $from = $xdate; ! } ! $BAW_CURR['wdays']['count'] = $wdcount_arr; ! $BAW_CURR['wdays']['sum'] = $wdsum_arr; ! $BAW_CURR['wdays']['from'] = $from; ! $BAW_CURR['wdays']['to'] = $xdate; ! if (($j !== $daysofmonth)) { ! $newval[$xdate] = array( ! date("Y", strtotime($xdate)), ! date("M", strtotime($xdate)), ! date("d", strtotime($xdate)), ! $data[3], ! $data[0], ! $data[1], ! $data[2] ! ); } ! $class .= baw_even($month, ' evenmonth', ' oddmonth'); ! if ($class !== '') { ! $data_format[$xdate] = $class; ! } } } *************** *** 328,332 **** $data_format = array(); $wdcount_arr = $BAW_CURR['wdays']['count']; ! $wdsum_arr = $BAW_CURR['wdays']['avg']; for ($w=0; $w<7; $w++) { // switch for Mo or Su start --- 359,363 ---- $data_format = array(); $wdcount_arr = $BAW_CURR['wdays']['count']; ! $wdsum_arr = $BAW_CURR['wdays']['sum']; for ($w=0; $w<7; $w++) { // switch for Mo or Su start *************** *** 345,366 **** $wdcount_arr[$x] = 1; } ! for ($i=0; $i<=3; $i++) { ! $wavg[$x][$i] = '1'; ! if (!isset($wdsum_arr[$x][$i])) { ! $wdsum_arr[$x][$i] = 0; } ! $wavg[$x][$i] = $wdsum_arr[$x][$i] / $wdcount_arr[$x]; } - $newval[84+$x] = array( - $BAW_MES[84+$x], - $wavg[$x][3], - $wavg[$x][0], - $wavg[$x][1], - $wavg[$x][2] - ); if ($class !== '') { $data_format[84+$x] = $class; } } $out = ''; if ($set['chart']) { --- 376,409 ---- $wdcount_arr[$x] = 1; } ! // option if we take averages or summs ! if ($BAW_CONF['time_averages'] == true) { ! for ($i=0; $i<=3; $i++) { ! $wavg[$x][$i] = '1'; ! if (!isset($wdsum_arr[$x][$i])) { ! $wdsum_arr[$x][$i] = 0; ! } ! $wavg[$x][$i] = $wdsum_arr[$x][$i] / $wdcount_arr[$x]; } ! $newval[84+$x] = array( ! $BAW_MES[84+$x], ! $wavg[$x][3], ! $wavg[$x][0], ! $wavg[$x][1], ! $wavg[$x][2] ! ); ! } else { ! $newval[84+$x] = array( ! $BAW_MES[84+$x], ! $wdsum_arr[$x][3], ! $wdsum_arr[$x][0], ! $wdsum_arr[$x][1], ! $wdsum_arr[$x][2] ! ); } if ($class !== '') { $data_format[84+$x] = $class; } } + $out = ''; if ($set['chart']) { *************** *** 400,406 **** $avgdata = array(); $icon = baw_create_image($BAW_CONF['icons_url'] . "/clock/hr$ihour.png" , array("alt"=>$hour, "title"=>$hour)); ! $avgdata[0] = $data[0] / $count_days; ! $avgdata[1] = $data[1] / $count_days; ! $avgdata[2] = $data[2] / $count_days; $lhour = sprintf('%02d',$hour); $newval_table[$hour] = array( --- 443,455 ---- $avgdata = array(); $icon = baw_create_image($BAW_CONF['icons_url'] . "/clock/hr$ihour.png" , array("alt"=>$hour, "title"=>$hour)); ! if ($BAW_CONF['time_averages'] == true) { ! $avgdata[0] = $data[0] / $count_days; ! $avgdata[1] = $data[1] / $count_days; ! $avgdata[2] = $data[2] / $count_days; ! } else { ! $avgdata[0] = $data[0]; ! $avgdata[1] = $data[1]; ! $avgdata[2] = $data[2]; ! } $lhour = sprintf('%02d',$hour); $newval_table[$hour] = array( *************** *** 550,553 **** --- 599,607 ---- $hasbots = true; } else { + /* if ($BAW_CONF['module'] == 'drupal') { + $dns = baw_create_link($dns , "/{$BAW_CONF['drupal_base']}/details/geoip/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); + } else { + $dns = baw_create_link($dns , "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=geoip"); + }*/ $val[$i] = array( $dns, *************** *** 559,570 **** ); } - /* - if (ip2long($ip_or_name) === false) { - $ip = gethostbyname($ip_or_name); - } else { - $ip = $ip_or_name; - } - $ctry = $geoip->lookupCountryName($ip); - */ // try extra to regain the memory here since this is the largest function $val[$dns] = NULL; --- 613,616 ---- *************** *** 574,580 **** if ($hasbots) { if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link( $BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link( $BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); } $val['script'] = array( --- 620,626 ---- if ($hasbots) { if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link($BAW_MES['assumedscript'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); } $val['script'] = array( *************** *** 589,595 **** if ($hashotlinks) { if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link( $BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link( $BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); } $val['hotlinks'] = array( --- 635,641 ---- if ($hashotlinks) { if ($BAW_CONF['module'] == 'drupal') { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "/{$BAW_CONF['drupal_base']}/details/visitors_spiders/{$BAW_CURR['month']}/{$BAW_CURR['year']}"); } else { ! $ntype = baw_create_link($BAW_MES['hotlinks_proxies'], "{$BAW_CONF['site_url']}/index.php?site={$BAW_CURR['site_name']}&month={$BAW_CURR['month']}&year={$BAW_CURR['year']}&action=get_fulltable&what=visitors_spiders"); } $val['hotlinks'] = array( *************** *** 614,617 **** --- 660,676 ---- return $out; } + /* + function baw_display_geoip($dns) { + global $BAW_CONF; + include_once($BAW_CONF['site_path'] . '/modules/GeoIP.php'); + $geoip = Net_GeoIP::getInstance($BAW_CONF['site_path'] . '/modules/GeoIP/GeoIP.dat', Net_GeoIP::SHARED_MEMORY); + if (ip2long($dns) === false) { + $ip = gethostbyname($dns); + } else { + $ip = $dns; + } + $ctry = $geoip->lookupCountryName($ip); + echo $dns, $ip, $ctry; + }*/ function baw_display_visitors_spiders($set) { Index: display_helpers.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display_helpers.php,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** display_helpers.php 2 Apr 2008 01:34:10 -0000 1.136 --- display_helpers.php 9 Apr 2008 02:52:27 -0000 1.137 *************** *** 336,339 **** --- 336,349 ---- } + function baw_message_averages($id) { + global $BAW_MES, $BAW_CONF; + if ($BAW_CONF['time_averages'] == true) { + $out = sprintf($BAW_MES['averages'],$BAW_MES[$id]); + } else { + $out = $BAW_MES[$id]; + } + return $out; + } + /* * Display Helper Function: display a text including the version and other info Index: config_default.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/config_default.inc.php,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** config_default.inc.php 7 Apr 2008 06:02:03 -0000 1.79 --- config_default.inc.php 9 Apr 2008 02:52:27 -0000 1.80 *************** *** 186,189 **** --- 186,199 ---- ) ), + 'time_averages' => array ( + 'type' => 'dropdown', + 'name' => $BAW_MES['cfg_time_averages'], + 'default' => 'true', + 'help' => $BAW_MES['cfg_time_averages_hlp'], + 'values' => array( + 'true' => $BAW_MES['cfg_enable'], + 'false' => $BAW_MES['cfg_disable'] + ) + ), ), $BAW_MES['cfg_table_settings'] => array( *************** *** 364,368 **** 'months' => array ( 'help' => $BAW_MES['cfg_dis_months'], ! 'name' => $BAW_MES[162], /* 'sorting' => array( 0 => $BAW_MES[5], --- 374,378 ---- 'months' => array ( 'help' => $BAW_MES['cfg_dis_months'], ! 'name' => baw_message_averages(162), // $BAW_MES[162], /* 'sorting' => array( 0 => $BAW_MES[5], *************** *** 387,391 **** 'weekdays' => array ( 'help' => $BAW_MES['cfg_dis_weekdays'], ! 'name' => $BAW_MES['weekday_averages'], /* 'sorting' => array( 0 => $BAW_MES[4], --- 397,401 ---- 'weekdays' => array ( 'help' => $BAW_MES['cfg_dis_weekdays'], ! 'name' => baw_message_averages(91),// $BAW_MES['weekday_averages'], /* 'sorting' => array( 0 => $BAW_MES[4], *************** *** 398,402 **** 'hours' => array ( 'help' => $BAW_MES['cfg_dis_hours'], ! 'name' => $BAW_MES['hours_averages'], 'sorting' => array( 1 => $BAW_MES[20], --- 408,412 ---- 'hours' => array ( 'help' => $BAW_MES['cfg_dis_hours'], ! 'name' => baw_message_averages(20), //$BAW_MES['hours_averages'], 'sorting' => array( 1 => $BAW_MES[20], |
From: Oliver S. <tok...@us...> - 2008-04-09 02:52:24
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22370 Modified Files: config.php Log Message: averages enabled and fixed for month display Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** config.php 7 Apr 2008 06:09:02 -0000 1.122 --- config.php 9 Apr 2008 02:52:27 -0000 1.123 *************** *** 170,174 **** $BAW_CONF['url_alias'] = true; ! //*********************************************************/ --- 170,174 ---- $BAW_CONF['url_alias'] = true; ! $BAW_CONF['time_averages'] = false; //*********************************************************/ |
From: Oliver S. <tok...@us...> - 2008-04-08 07:36:28
|
Update of /cvsroot/betterawstats/betterawstats/modules In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26363/modules Modified Files: render_map.inc.php Log Message: fix map display (wrong sort order introduced at last commit) Index: render_map.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/modules/render_map.inc.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** render_map.inc.php 2 Apr 2008 01:36:04 -0000 1.23 --- render_map.inc.php 8 Apr 2008 07:36:09 -0000 1.24 *************** *** 47,65 **** echo baw_raise_error('mapnotavailable', array($im)); } - // fix data for geography $us_domains =array('us', 'mil', 'edu', 'gov', 'arpa'); foreach ($us_domains as $us_domain) { ! if (isset($data[$us_domain][3])) { if (!isset($data['us'])) { $data['us'] = array(0,0,0,0,0); } ! $data['us'][3] += $data[$us_domain][3]; } ! if (isset($data[$us_domain][4])) { if (!isset($data['us'])) { $data['us'] = array(0,0,0,0,0); } ! $data['us'][4] += $data[$us_domain][4]; } unset($data[$us_domain]); --- 47,64 ---- echo baw_raise_error('mapnotavailable', array($im)); } // fix data for geography $us_domains =array('us', 'mil', 'edu', 'gov', 'arpa'); foreach ($us_domains as $us_domain) { ! if (isset($data[$us_domain][0])) { if (!isset($data['us'])) { $data['us'] = array(0,0,0,0,0); } ! $data['us'][0] += $data[$us_domain][0]; } ! if (isset($data[$us_domain][1])) { if (!isset($data['us'])) { $data['us'] = array(0,0,0,0,0); } ! $data['us'][1] += $data[$us_domain][1]; } unset($data[$us_domain]); *************** *** 74,78 **** break; } ! $new_data .= "&c[$country][0]={$vars[3]}&c[$country][1]={$vars[4]}"; $doms ++; } --- 73,77 ---- break; } ! $new_data .= "&c[$country][0]={$vars[0]}&c[$country][1]={$vars[1]}"; $doms ++; } |
From: Oliver S. <tok...@us...> - 2008-04-08 07:36:28
|
Update of /cvsroot/betterawstats/betterawstats/core In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26363/core Modified Files: display.inc.php Log Message: fix map display (wrong sort order introduced at last commit) Index: display.inc.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/core/display.inc.php,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** display.inc.php 7 Apr 2008 06:02:03 -0000 1.154 --- display.inc.php 8 Apr 2008 07:36:08 -0000 1.155 *************** *** 454,458 **** ); // $format_jp = array($BAW_MES[56], $BAW_MES[57], $BAW_MES[75]); ! $newval = array(); // $jpval = array(); if ($val = baw_data($BAW_CURR['site_name'], "DOMAIN", $BAW_CURR['yearmonth'])) { --- 454,460 ---- ); // $format_jp = array($BAW_MES[56], $BAW_MES[57], $BAW_MES[75]); ! $newval_table = array(); ! $newval_chart = array(); ! $newval_map = array(); // $jpval = array(); if ($val = baw_data($BAW_CURR['site_name'], "DOMAIN", $BAW_CURR['yearmonth'])) { *************** *** 482,487 **** $data[2] ); ! $out = ''; } if ($set['chart']) { $out .= baw_render_htmlchart($newval_chart, $format_chart, $set['avg'], $set['top_x']); --- 484,494 ---- $data[2] ); ! $newval_map[$domain] = array( ! $data[0], ! $data[1], ! $data[2] ! ); } + $out = ''; if ($set['chart']) { $out .= baw_render_htmlchart($newval_chart, $format_chart, $set['avg'], $set['top_x']); *************** *** 489,493 **** if ($set['map']) { // since the map is manipulating the array, we have to sort it again afterwards ! $out .= baw_render_map($newval_table, $set['sort'], $set['sort_dir'], $set['top_x']); } if ($set['table']) { --- 496,500 ---- if ($set['map']) { // since the map is manipulating the array, we have to sort it again afterwards ! $out .= baw_render_map($newval_map, $set['sort'], $set['sort_dir'], $set['top_x']); } if ($set['table']) { *************** *** 552,555 **** --- 559,570 ---- ); } + /* + if (ip2long($ip_or_name) === false) { + $ip = gethostbyname($ip_or_name); + } else { + $ip = $ip_or_name; + } + $ctry = $geoip->lookupCountryName($ip); + */ // try extra to regain the memory here since this is the largest function $val[$dns] = NULL; |
From: Oliver S. <tok...@us...> - 2008-04-07 06:09:33
|
Update of /cvsroot/betterawstats/betterawstats In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11702 Modified Files: config.php Log Message: config/history updates Index: config.php =================================================================== RCS file: /cvsroot/betterawstats/betterawstats/config.php,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** config.php 7 Apr 2008 06:02:03 -0000 1.121 --- config.php 7 Apr 2008 06:09:02 -0000 1.122 *************** *** 397,406 **** ); ! // NAME: Hosts ! // INFO: IP addresses of visitors $BAW_CONF_DIS['visitors_spiders'] = array( 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '7', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? --- 397,406 ---- ); ! // NAME: Hosts (Assumed Robots/Spiders, Hotlinks/Proxies) ! // INFO: IP addresses of assumed spiders/bots visitors $BAW_CONF_DIS['visitors_spiders'] = array( 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '8', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? *************** *** 414,418 **** ); - // NAME: Authenticated users // INFO: Logins for username/password protected pages --- 414,417 ---- *************** *** 420,424 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '8', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 419,423 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '9', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 437,441 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '9', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? --- 436,440 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '10', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? *************** *** 454,458 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '10', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 453,457 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '11', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 470,474 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '11', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 469,473 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '12', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 481,485 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '12', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 480,484 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '13', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 499,503 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '13', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? --- 498,502 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '14', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? *************** *** 515,519 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '14', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? --- 514,518 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '15', // Item Sequence 'avg' => true, // Show averages? 'total' => true, // Show total Sum? *************** *** 531,535 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '15', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 530,534 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '16', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 548,552 **** 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '17', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 547,551 ---- 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '18', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 564,568 **** 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '16', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 563,567 ---- 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '17', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 581,585 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '18', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 580,584 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '19', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 598,602 **** 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '19', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 597,601 ---- 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '20', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 615,619 **** 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '20', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 614,618 ---- 'show' => false, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '21', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 631,635 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '21', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? --- 630,634 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '22', // Item Sequence 'avg' => false, // Show averages? 'total' => false, // Show total Sum? *************** *** 648,652 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '22', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 647,651 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '23', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 665,669 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '23', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 664,668 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '24', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 682,686 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '24', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 681,685 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '25', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 700,704 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '25', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 699,703 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '26', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 717,721 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '26', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 716,720 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '27', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 735,739 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '27', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 734,738 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '28', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 751,755 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '28', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? --- 750,754 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '29', // Item Sequence 'avg' => false, // Show averages? 'total' => true, // Show total Sum? *************** *** 767,771 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '29', // Item Sequence 'table' => true, // Show data table? ); --- 766,770 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '30', // Item Sequence 'table' => true, // Show data table? ); *************** *** 776,780 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '30', // Item Sequence 'total' => true, // Show total Sum? 'table' => true, // Show data table? --- 775,779 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '31', // Item Sequence 'total' => true, // Show total Sum? 'table' => true, // Show data table? *************** *** 791,795 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '31', // Item Sequence 'table' => true, // Show data table? 'total' => true, // Show total Sum? --- 790,794 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '32', // Item Sequence 'table' => true, // Show data table? 'total' => true, // Show total Sum? *************** *** 806,810 **** 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '32', // Item Sequence 'total' => false, // Show total Sum? 'table' => true, // Show data table? --- 805,809 ---- 'show' => true, // Show this Data? 'collapse' => false, // Collapsed? ! 'order' => '33', // Item Sequence 'total' => false, // Show total Sum? 'table' => true, // Show data table? |