From: Nicolas Boisselier
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '.$row['config'].' '.num_format($row['unique']).
+ ' '.num_format($row['visits']).' '.num_format($row['pages']).
+ ' '.num_format($row['hits']).' '.byte_format($row['bandwidth']);
+ if ($NotViewed == 'columns') echo ' '.num_format($row['not_viewed_pages']).
+ ' '.num_format($row['not_viewed_hits']).
+ ' '.byte_format($row['not_viewed_bandwidth']);
+ echo "\n";
+}
+echo ' Total '.num_format($unique_total).
+ ' '.num_format($visits_total).' '.num_format($pages_total).
+ ' '.num_format($hits_total).' '.byte_format($bandwidth_total);
+if ($NotViewed == 'columns') echo ' '.num_format($not_viewed_pages_total).
+ ' '.num_format($not_viewed_hits_total).
+ ' '.byte_format($not_viewed_bandwidth_total);
+echo "\n";
+?>
+
+
+
+
diff --git a/betterawstats/bawstats.info b/betterawstats/bawstats.info
new file mode 100644
index 0000000..1dba338
--- /dev/null
+++ b/betterawstats/bawstats.info
@@ -0,0 +1,5 @@
+; $Id $
+name = BAWstats
+description = Based on betterAWstats and the AWstats web statistics tools.
+version = "6.x-1.1-beta"
+core = 6.x
diff --git a/betterawstats/bawstats.install b/betterawstats/bawstats.install
new file mode 100644
index 0000000..9239733
--- /dev/null
+++ b/betterawstats/bawstats.install
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/betterawstats/bawstats.module b/betterawstats/bawstats.module
new file mode 100644
index 0000000..5ccb24a
--- /dev/null
+++ b/betterawstats/bawstats.module
@@ -0,0 +1,167 @@
+'. t('BAWstats is a drupal interface to "BetterAWstats" by Oliver Spiesshofer. If you run AWstats or have AWstats data, BAWstats can provide a drupal view of the statistics data. The data itself does not need to be in web accessible space, although it must be readable by php (i.e. within the openbasedir setting).') .'
'. t('By default this module only shows statistics for a single site. Which site this is, is not configurable within the module. This is done to prevent administrative users on one site viewing another sites data (the AWstats data directory can hold multiple site data). BAWstats tries to guess the AWstats site name from the drupal site name, but if the guess is wrong it can be set within the settings.php file using the $conf[\'bawstats_defsite\'] variable. For example, $conf[\'bawstats_defsite\'] = \'equivocation.org\'; will generate site statistics from the AWStats data files for the site equivocation.org.') .'
'; + $output .= ''. t('It is possible to view all the site statistics found in the AWstats data directory. By setting $conf[\'bawstats_admin_access\'] = 1; in the settings.php file, access to the statistics for all the sites available is given.') .'
'; + $output .= ''. t('As this module only provides a drupal interface into the non-drupal "Better AWstats" code, limited configuration is available through drupal. Fine configuration of the statistics views may be achieved by editing the Better AWstats config.php file.') .'
'; + break; + case 'admin/settings/bawstats': + $output .= ''. t('BAWstats is based on "BetterAWstats" by Oliver Spiesshofer. This module displays AWstats data within drupal. The location of the AWstats data and the location of auxiliary AWstats libraries can be configured below.') .'
'; + $output .= ''. t('Note, it may be considered important that the AWstats data and library locations reside outside of web file space. This would remove direct access to the data with the only access through AWstats itself (if it is running as a CGI) and/or through this drupal module.') .'
'; + $output .= ''. t('Once the AWstats locations are correctly configured, site statistics can be viewed under the admin reports') . ' (/admin/reports/bawstats).
'; + + } + return $output; +} + +/** + * Implementation of hook_perm(). + */ +function bawstats_perm() { + return array('view site statistics','statistics admin'); +} + +/** + * Implementation of hook_init() + * This hook is run at the beginning of the page request. When this hook + * is called, all modules are already loaded in memory. Here used to + * setup CSS + */ + +function bawstats_init() { + drupal_add_css(drupal_get_path('module', 'bawstats') .'/includes/bawstats.css'); +} + +/** + * Implementation of hook_menu(). + */ + +function bawstats_menu() { + $items = array(); + $includes_path = drupal_get_path('module', 'bawstats') . '/includes'; + + $items['admin/settings/bawstats'] = array( + 'title' => 'BAW Statistics', + 'description' => 'Configure site statistics.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('bawstats_admin_settings'), + 'file' => 'bawstats.admin.inc', + 'file path' => $includes_path, + 'access arguments' => array('statistics admin'), + ); + + $items['admin/reports/bawstats'] = array( + 'title' => 'View Site Statistics', + 'description' => t('View AWStats web statistics.'), + 'page callback' => 'bawstats_view_theform', + 'page arguments' => array(), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => 1, + 'access arguments' => array('view site statistics'), + ); + + $items['admin/reports/bawstats/all/%/%'] = array( + 'title' => 'View Site Statistics', + 'type' => MENU_CALLBACK, + 'page callback' => 'bawstats_view_theform', + 'page arguments' => array(4,5), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => 1, + 'access arguments' => array('view site statistics'), + ); + + // create the sub group menues if requested + if (variable_get('bawstats_page_view',0)>0) { + $statgroups = variable_get('bawstats_groups',array()); + if (count($statgroups)>0) { + $pri = 1; + foreach ($statgroups as $group => $group_details) { + if ($pri==1) { + $items['admin/reports/bawstats/'.$group.'/%/%'] = array( + 'title' => 'View Site Statistics', + 'type' => MENU_CALLBACK, + 'page callback' => 'bawstats_view_theform', + 'page arguments' => array(4,5,$group), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => $pri, + 'access arguments' => array('view site statistics') + ); + } else { + $items['admin/reports/bawstats/'.$group] = array( + 'title' => $group_details, + 'type' => MENU_NORMAL_ITEM, + 'page callback' => 'bawstats_set_section', + 'page arguments' => array($group), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => $pri, + 'access arguments' => array('view site statistics') + ); + $items['admin/reports/bawstats/'.$group.'/%/%'] = array( + 'title' => $group_details, + 'type' => MENU_CALLBACK, + 'page callback' => 'bawstats_view_theform', + 'page arguments' => array(4,5,$group), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => $pri, + 'access arguments' => array('view site statistics') + ); + } + $pri += 1; + } + } + } + + // the "other" more specific things we don't have menus for! + $items['admin/reports/bawstats/details/%/%/%'] = array( + 'title' => $group_details, + 'type' => MENU_CALLBACK, + 'page callback' => 'bawstats_view_theform', + 'page arguments' => array(5,6,4), + 'file' => 'bawstats.stats.inc', + 'file path' => $includes_path, + 'weight' => $pri, + 'access arguments' => array('view site statistics') + ); + + return $items; +} diff --git a/betterawstats/config.php b/betterawstats/config.php new file mode 100644 index 0000000..e0a1cda --- /dev/null +++ b/betterawstats/config.php @@ -0,0 +1,798 @@ + + * 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 - do not change these 3 lines +if (strpos ($_SERVER['PHP_SELF'], 'config.php') !== false) { + die ('This file can not be used on its own!'); +} +// ATTENTION: BetterAWstats has an online config 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 protectthe BetterAWStats installation +// by a .htaccess file! + +//*********************************************************/ +//* SITE SETTINGS +//*********************************************************/ +ini_set("memory_limit","1G"); +set_time_limit(60*3); +$BAW_MES['e'] = 'iso-8859-1'; +// NAME: Script URL +// INFO: The url of BetterAWstats' directory, No trailing slash +// DEFAULT: 'http://awstats.local' +$BAW_CONF['site_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/betterawstats'; + +// NAME: Script path +// INFO: The path of BetterAWstats, No trailing slash +// DEFAULT: '/path/to/betterawstats/' +$BAW_CONF['site_path'] = $_SERVER['DOCUMENT_ROOT'].'/betterawstats'; + +// NAME: Path to AWStats Data +// INFO: Set this value to the directory where AWStats saves its database +// files into. ATTENTION: If you read those files on windows but have +// them created on linux or the other way round, make sure you transfer +// them 'BINARY'. Otherwise they cannot be read properly. No trailing +// slash +// DEFAULT: '/path/to/betterawstats/awstats/data' +$BAW_CONF['path_data'] = '/var/lib/awstats'; + +// NAME: Path to AWStats Libraries +// INFO: Set this value to the directory where AWStats saves its library +// files into. No trailing slash +// DEFAULT: '/path/to/betterawstats/awstats/lib' +$BAW_CONF['path_lib'] = '/usr/share/awstats/lib'; + +// NAME: Path to AWStats Language files +// INFO: Set this value to the directory where AWStats saves its language +// files into. No trailing slash +// DEFAULT: '/path/to/betterawstats/awstats/lang' +$BAW_CONF['path_lang'] = '/usr/share/awstats/lang'; + +// NAME: URL to AWStats Icons +// INFO: The url to the awstats icons, should include the whole http://..., +// no trailing slash. +// DEFAULT: 'http://awstats.local/awstats/icon' +#$BAW_CONF['icons_url'] = $BAW_CONF['site_url'].'/icons'; +$BAW_CONF['icons_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/icon'; + +// NAME: Web Configuration +// INFO: Enable the online configuration editor? WARNING: Your config.php has +// to be writable in order to enable this. This is a BAD idea to use +// unless the folder is password-protected with a .htaccess file or +// similar. +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['online_config'] = false; + +// NAME: Change configuration password? +// INFO: This password is needed to access the online configuration. It has +// to be longer than 5 letters. +// DEFAULT: '' +$BAW_CONF['online_config_password'] = ''; + +// 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' +// POSSIBLE VALUES: 'sitename.org', 'show_all' +$BAW_CONF['limit_server'] = 'show_all'; + + + +//*********************************************************/ +//* LAYOUT SETTINGS +//*********************************************************/ + +// NAME: Layout Type +// INFO: Display page in vertical or horizontal layout? +// DEFAULT: 'vertical' +// POSSIBLE VALUES: 'vertical', 'horizontal' +$BAW_CONF['layout_type'] = 'vertical'; + +// NAME: Language +// INFO: Set your language. Set to "auto" to autodetect from browser +// DEFAULT: 'auto' +// POSSIBLE VALUES: 'auto', 'al', 'ba', 'bg', 'ca', 'tw', 'cn', 'cz', 'dk', 'nl', +// 'en', 'et', 'eu', 'fi', 'fr', 'gl', 'de', 'gr', 'he', 'hu', +// 'is', 'id', 'it', 'jp', 'kr', 'lv', 'nn', 'nb', 'pl', 'pt', +// 'br', 'ro', 'ru', 'sr', 'sk', 'es', 'se', 'tr', 'ua', 'wlk' +$BAW_CONF['lang_setting'] = 'auto'; + +// NAME: Decimal Point +// INFO: Decimal Point Character (99.9) +// DEFAULT: '.' +$BAW_CONF['dec_point'] = '.'; + +// NAME: Thousands separator +// INFO: Thousand Digit separator (1'000) +// DEFAULT: "'" +$BAW_CONF['tho_point'] = "'"; + +// NAME: Date format (2007-31-12) +// INFO: How should a date look like? For formatting, please consult +// http://php.net/manual/en/function.date.php +// DEFAULT: 'Y-M-d' +$BAW_CONF['date_format'] = 'Y-M-d'; + +// NAME: Date & Time format (2007-31-12 23:59) +// INFO: How should a date & time look like? For formatting,please consult +// http://php.net/manual/en/function.date.php +// DEFAULT: 'Y-M-d H:i' +$BAW_CONF['date_time_format'] = 'Y-M-d - H:i'; + +// NAME: Percentage decimals +// INFO: How many decimals for percentage value? (99.9%) +// DEFAULT: '1' +$BAW_CONF['percent_decimals'] = '1'; + +// NAME: Hide Empty data +// INFO: Completely hide graphs with zero entries? (The menu will also be +// hidden) +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['hideempty'] = true; + +// NAME: Submit dropdowns on change +// INFO: If enabled, the site/date dropdowns do not have an "OK"-button. The +// page is refreshed as soon as you choose a new value. Not recommended +// for large sites. +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['auto_submit_form'] = true; + + + +//*********************************************************/ +//* TABLE SETTINGS +//*********************************************************/ + +// NAME: First day of the week +// INFO: Should Sunday be the first day of the week or monday? +// DEFAULT: '1' +// POSSIBLE VALUES: '1', '2' +$BAW_CONF['firstdayofweek'] = '1'; + +// NAME: Field Length +// INFO: What is the max. text length of table fields? (Applies only to +// links) +// DEFAULT: '65' +$BAW_CONF['field_length'] = '50'; + +// NAME: Max. Table Lines +// INFO: What is the max. no. of lines a table can have? Set to "false" to +// disable. If a table reaches this number of lines, The rest is +// summarized into one line. This also applies to the "full list" view +// of a table +// DEFAULT: '10000' +$BAW_CONF['maxlines'] = '10000'; + + + +//*********************************************************/ +//* CHART SETTINGS +//*********************************************************/ + +// NAME: Max scale for Visitors +// INFO: The maximum value of the chosen option will define the maximum +// height of the Visitors bars in the chart +// DEFAULT: 'layout_visits' +// POSSIBLE VALUES: 'layout_visitos', 'layout_visits', 'layout_pages', +// 'layout_hits', 'layout_bytes' +$BAW_CONF['max_visitors'] = 'layout_visits'; + +// NAME: Max scale for Visits +// INFO: The maximum value of the chosen option will define the maximum +// height of the Visits bars in the chart +// DEFAULT: 'layout_visits' +// POSSIBLE VALUES: 'layout_visits', 'layout_pages', 'layout_hits', 'layout_bytes' +$BAW_CONF['max_visits'] = 'layout_visits'; + +// NAME: Max scale for Pages +// INFO: The maximum value of the chosen option will define the maximum +// height of the Pages bars in the chart +// DEFAULT: 'layout_pages' +// POSSIBLE VALUES: 'layout_pages', 'layout_hits', 'layout_bytes' +$BAW_CONF['max_pages'] = 'layout_pages'; + +// NAME: Max scale for Hits +// INFO: The maximum value of the chosen option will define the maximum +// height of the Hits bars in the chart +// DEFAULT: 'layout_hits' +// POSSIBLE VALUES: 'layout_hits', 'layout_bytes' +$BAW_CONF['max_hits'] = 'layout_hits'; + +// NAME: Max no of chart rows +// INFO: When displaying the charts with the full lists, How many items can +// there be displayed? The rest will sum up into "Others". This is done +// to prevent too wide charts +// DEFAULT: '50' +$BAW_CONF['max_chart_items'] = '30'; + +// NAME: Chart Titles? +// INFO: If enabled, it will show a title on top of each chart. +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['chart_titles'] = false; + + + +//*********************************************************/ +//* JPGRAPH SETTINGS +//*********************************************************/ + +// NAME: Enable JPgraph? +// INFO: To use JPGraph, you have to download it from +// http://www.aditus.nu/jpgraph/jpdownload.php. +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['use_jpgraph'] = false; + +// NAME: Path to JPGraph +// INFO: Where is your JPGraph installation? (The folder where jpgraph.php is +// in. No trailing slash) +// DEFAULT: '/path/to/betterawstats/jpgraph/src' +$BAW_CONF['jpgraph_path'] = '/home/www/izideal/share/jpgraph/src'; + + + +//*********************************************************/ +//* ADVANCED SETTINGS +//*********************************************************/ + +// NAME: XHTML/ HTML +// INFO: Do you want output in HTML or XHTML? +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['xhtml'] = false; + +// NAME: Debug +// INFO: Do you want to show debug-output (VERY detailed)? +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['debug'] = false; + +// NAME: Parser Stats +// INFO: Do you want to show log file parsing data below the stats summary? +// DEFAULT: true +// POSSIBLE VALUES: true, false +$BAW_CONF['show_parser_stats'] = true; + +// NAME: Module settings +// INFO: Are you using BetterAWstats as a module for another software? +// (Currently only Drupal is supported) +// DEFAULT: 'none' +// POSSIBLE VALUES: 'none', 'drupal' +$BAW_CONF['module'] = 'none'; + + + +//*********************************************************/ +//* DISPLAY +//*********************************************************/ + +// NAME: Summary +// INFO: General Overview of key figures and dates +$BAW_CONF_DIS['overview'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '1', // Item Sequence +); + +// NAME: Monthly history +// INFO: Monthly data +$BAW_CONF_DIS['months'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '2', // Item Sequence + 'top_x' => '24', // Show how many entries? + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? +); + +// NAME: Days of month +// INFO: Daily data +$BAW_CONF_DIS['days'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '3', // Item Sequence + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? +); + +// NAME: Days of week (Averages) +// INFO: Weekdays +$BAW_CONF_DIS['weekdays'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '4', // Item Sequence + 'avg' => true, // Show averages? + 'total' => false, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? +); + +// NAME: Hours (Averages) +// INFO: Hours of the day +$BAW_CONF_DIS['hours'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '5', // Item Sequence + 'avg' => true, // Show averages? + 'total' => false, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? + 'sort' => '1', // Sort for which column? Possible values are: + // '1'=Hours, '2'=Pages, '3'=Hits, '4'=Bandwidth + 'sort_dir' => SORT_ASC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Visitors domains/countries +// INFO: Domains of visitors +$BAW_CONF_DIS['domains'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '6', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? + 'map' => true, // Show Map Image? + 'top_x' => '10', // Show how many entries? + 'sort' => '0', // Sort for which column? Possible values are: + // 'key'=Visitors domains/countries, '0'=Pages, '1'=Hits, '2'=Bandwidth + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Hosts +// INFO: IP addresses of visitors +$BAW_CONF_DIS['visitors'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '7', // Item Sequence + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Hosts, '1'=Pages, '2'=Hits, '3'=Bandwidth, '4'=Ratio(Hits/Pages), + // '5'=Last visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'assumebot' => '1', // Hits/pages minimum ratio to assume normal user? +); + +// NAME: Authenticated users +// INFO: Logins for username/password protected pages +$BAW_CONF_DIS['logins'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '8', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '5', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // 'key'=Authenticated users, '0'=Pages, '1'=Hits, '2'=Bandwidth, '3'=Last + // visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Robots/Spiders visitors +// INFO: Spiders, Robots of Search engines etc. +$BAW_CONF_DIS['robots'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '9', // Item Sequence + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Robots/Spiders visitors, '1'=Hits, '2'=Hits (robots.txt), + // '3'=Bandwidth, '4'=Last visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Worms +// INFO: Worms searching for security holes +$BAW_CONF_DIS['worms'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '10', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '2', // Sort for which column? Possible values are: + // '0'=Worms, '1'=Sensitive targets, '2'=Hits, '3'=Bandwidth, '4'=Last visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Visits duration +// INFO: How long have people been on the site? +$BAW_CONF_DIS['sessions'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '11', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? +); + +// NAME: File type +// INFO: What filetypes are on the site +$BAW_CONF_DIS['filetype'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '12', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'chart' => true, // Show HTML chart? + 'sort' => '0', // Sort for which column? Possible values are: + // 'key'=File type, '0'=Hits, '1'=Bandwidth, '2'=Compression on, + // '3'=Compression result + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Pages-URL +// INFO: Pages on the site +$BAW_CONF_DIS['urls'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '13', // Item Sequence + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Pages-URL, '1'=Viewed, '2'=Average size, '3'=Entry, '4'=Exit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Files/paths +// INFO: Files/paths on the site +$BAW_CONF_DIS['paths'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '14', // Item Sequence + 'avg' => true, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Files/paths, '1'=Viewed + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Operating Systems +// INFO: Operating system of users +$BAW_CONF_DIS['os'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '15', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'chart' => true, // Show HTML chart? + 'top_x' => '10', // Show how many entries? + 'sort' => '2', // Sort for which column? Possible values are: + // '1'=Operating Systems, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Unknown OS (useragent field) +// INFO: Unknown Operating system +$BAW_CONF_DIS['unknownos'] = array( + 'show' => false, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '17', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '1'=User Agent, '2'=Last visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Operating Systems (+Versions) +// INFO: Operating system of users including versions +$BAW_CONF_DIS['osversions'] = array( + 'show' => false, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '16', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'chart' => true, // Show HTML chart? + 'top_x' => '10', // Show how many entries? + 'sort' => '2', // Sort for which column? Possible values are: + // '1'=Operating Systems, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Browsers +// INFO: User Browser Type +$BAW_CONF_DIS['browsers'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '18', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'chart' => true, // Show HTML chart? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '3', // Sort for which column? Possible values are: + // '1'=Browsers, '2'=Grabber, '3'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Browsers (+Versions) +// INFO: User Browser Type (+Versions) +$BAW_CONF_DIS['browserversions'] = array( + 'show' => false, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '19', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'chart' => false, // Show HTML chart? + 'top_x' => '10', // Show how many entries? + 'sort' => '4', // Sort for which column? Possible values are: + // '2'=Browsers, '3'=Grabber, '4'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Unknown browsers (useragent field) +// INFO: Unknown Browsers +$BAW_CONF_DIS['unknownbrowser'] = array( + 'show' => false, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '20', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '1'=User Agent, '2'=Last visit + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Screen sizes +// INFO: Screensizes of users +$BAW_CONF_DIS['screensizes'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '21', // Item Sequence + 'avg' => false, // Show averages? + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'chart' => true, // Show HTML chart? + 'top_x' => '5', // Show how many entries? + 'sort' => '2', // Sort for which column? Possible values are: + // '1'=Screen sizes, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Referring search engines +// INFO: Referrals from search engines +$BAW_CONF_DIS['se_referers'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '22', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Referring search engines, '1'=Pages, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'favicon' => true, // Retrieve favicons for external URLs? +); + +// NAME: Referring sites +// INFO: Referrals from other sites +$BAW_CONF_DIS['referers'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '23', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Referring sites, '1'=Pages, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'favicon' => false, // Retrieve favicons for external URLs? +); + +// NAME: Referring sites by Domains +// INFO: Referrals from other sites, grouped by 2-nd level domains +$BAW_CONF_DIS['referer_domains'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '24', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Referring sites, '1'=Pages, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'favicon' => false, // Retrieve favicons for external URLs? + 'domain_lvls' => '3', // Shorten URL to how many domain levels? (-1 to disable) +); + +// NAME: Hotlinks +// INFO: Pages linking to images/data on your site +$BAW_CONF_DIS['hotlinks'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '25', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Referring sites, '1'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'favicon' => false, // Retrieve favicons for external URLs? +); + +// NAME: Hotlinks by Domains +// INFO: Domains linking to images/data on your site +$BAW_CONF_DIS['hotlink_domains'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '26', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Referring sites, '1'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending + 'favicon' => false, // Retrieve favicons for external URLs? + 'domain_lvls' => '3', // Shorten URL to how many domain levels? (-1 to disable) +); + +// NAME: Search Keyphrases +// INFO: Search phrases +$BAW_CONF_DIS['searchphrases'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '27', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=different keyphrases, '1'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Search Keywords +// INFO: Search words +$BAW_CONF_DIS['searchwords'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '28', // Item Sequence + 'avg' => false, // Show averages? + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=different keywords, '1'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Miscellaneous +// INFO: User system features +$BAW_CONF_DIS['misc'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '29', // Item Sequence + 'table' => true, // Show data table? +); + +// NAME: HTTP Status codes +// INFO: Acesses to pages that returned errors +$BAW_CONF_DIS['errors'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '30', // Item Sequence + 'total' => true, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '2', // Sort for which column? Possible values are: + // '0'=HTTP Status codes, '2'=Hits, '3'=Average size + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Error Hits +// INFO: Required but not found URLs (HTTP code 404) +$BAW_CONF_DIS['errors404'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '31', // Item Sequence + 'table' => true, // Show data table? + 'total' => true, // Show total Sum? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Error Hits, '1'=Hits, '2'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + +// NAME: Color depth +// INFO: Screen colors of users +$BAW_CONF_DIS['extra_1'] = array( + 'show' => true, // Show this Data? + 'collapse' => false, // Collapsed? + 'order' => '32', // Item Sequence + 'total' => false, // Show total Sum? + 'table' => true, // Show data table? + 'top_x' => '10', // Show how many entries? + 'sort' => '1', // Sort for which column? Possible values are: + // '0'=Color depth in bits, '1'=Hits + 'sort_dir' => SORT_DESC, // Sort direction? Possible values are: + // SORT_ASC=Ascending, SORT_DESC=Descending +); + + +?> diff --git a/betterawstats/core/config.inc.php b/betterawstats/core/config.inc.php new file mode 100644 index 0000000..9ebd521 --- /dev/null +++ b/betterawstats/core/config.inc.php @@ -0,0 +1,441 @@ + + * 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. + */ + + +/** + * File contents: + * + * This file contains only function related to the online config manager. It handles + * editing & saving the config as well as logging the admin in and out. + */ + +// this file can't be used on its own +if (strpos ($_SERVER['PHP_SELF'], 'config_default.php') !== false) { + die ('This file can not be used on its own!'); +} +/* +* Saves the config settings to file +* +*/ +function baw_action_save_config() { + global $BAW_CONF, $BAW_CONF_DEF, $BAW_CONF_DIS_DEF, $BAW_CONF_DIS; + global $BAW_MES, $BAW_CONF_DIS_TYP, $BAW_FILE_HEADER; + @session_start(); + if (!baw_check_user()) { + return baw_site_header() . baw_config_login_form(); + }; + + if (isset($_POST['exit']) && ($_POST['exit'] == $BAW_MES['cfg_exit'])) { + return baw_display_index(); + } + if (isset($_POST['logout']) && ($_POST['logout'] == $BAW_MES['cfg_logout'])) { + baw_logout(); + return baw_display_index(); + } + if (!$BAW_CONF['online_config']) { + return baw_raise_error('configdisabled'); + } + $filename = $BAW_CONF['site_path'].'/config.php'; + if (is_writable($filename)) { + // prepare config for writing + $str = " $sectdata) { + $sect = strtoupper($sect); + $str .= "\r\n\r\n//*********************************************************/\r\n" + . "//* $sect\r\n" + . "//*********************************************************/\r\n\r\n"; + foreach ($sectdata as $setting => $misc) { + if ($misc['type'] !== 'fixed') { + // set standard first + $allowed_values = ''; + $val = $_POST[$setting]; + $default = $misc['default']; + $val_str = "'$val'"; + $default_str = "'$default'"; + // now set the execptions + if ($val == 'true' or $val == 'false') { + $val_str = "$val"; + if ($default == true) { + $default_str = 'true'; + } else { + $default_str = 'false'; + } + $allowed_values = "// POSSIBLE VALUES: true, false\r\n"; + } else if ($val == "'"){ + $val_str = '"\'"'; + } else { + $val_str = "'$val'"; + } + if ($default == "'"){ + $default_str = '"\'"'; + } + + if ($setting == 'limit_server') { // dont print domain names into the config file + $allowed_values = "// POSSIBLE VALUES: 'sitename.org', 'show_all'\r\n";// + } else if ($misc['type'] == 'dropdown' && ($val !== 'true' && $val !== 'false')) { + $allowed_values = implode("', '", array_keys($misc['values'])); + $allowed_values = wordwrap($allowed_values, 60, "\r\n// "); + $allowed_values = "// POSSIBLE VALUES: '$allowed_values'\r\n"; + } else if ($misc['type'] == 'password') { + $val = $_POST[$setting]; + if ($val[0] !== $val[1]) { + echo baw_raise_error('password_match'); + exit; + } else if ($val[0] == '') { // password will not change if empty + $val_str = "'{$BAW_CONF['online_config_password']}'"; + } else if (strlen($val[0]) < 5) { // password too short + echo baw_raise_error('password_short'); + exit; + } else { + $val_str = "'{$val[0]}'"; + } + } + $out_help = wordwrap( + strip_tags(html_entity_decode($misc['help'])), + 68 + , "\r\n// " + ); + $name = html_entity_decode($misc['name']); + $str .= "// {$BAW_MES['cfg_name']} $name\r\n" + . "// {$BAW_MES['cfg_info']} {$out_help}\r\n" + . "// {$BAW_MES['cfg_def']} $default_str\r\n" + . $allowed_values + . "\$BAW_CONF['$setting'] = $val_str;\r\n\r\n"; + } + } + } + $str .= "\r\n\r\n//*********************************************************/\r\n" + . "//* {$BAW_MES['cfg_display']}\r\n" + . "//*********************************************************/\r\n\r\n"; + + foreach ($BAW_CONF_DIS_DEF as $setting => $misc) { + $val_arr = $_POST[$setting]; + $name = html_entity_decode($misc['name']); + $help = html_entity_decode($misc['help']); + $str .= "// {$BAW_MES['cfg_name']} {$name}\r\n" + . "// {$BAW_MES['cfg_info']} {$help}\r\n"; + $this_conf = $BAW_CONF_DIS[$setting]; + $substr =''; + foreach ($this_conf as $name => $oldval) { + $type = $BAW_CONF_DIS_TYP[$name][1]; + $desc = $BAW_CONF_DIS_TYP[$name][0]; + $val = $val_arr[$name]; + if ($type == 'string') { + $val = "'$val'"; + } else if ($type == 'sorting1') { + $desc2 = $BAW_MES['cfg_possible_values'] ."\r\n // "; + foreach ($misc['sorting'] as $key => $value) { + $desc2 .= "'$key'=$value, "; + } + $desc2 = substr($desc2, 0, -2); + $desc2 = wordwrap($desc2, 75, "\r\n // "); + $desc .= $desc2; + $val = "'$val'"; + } else if ($type == 'sorting2') { + $desc .= $BAW_MES['cfg_possible_values'] . "\r\n" + . " // " . $BAW_MES['cfg_type_sort_dir_opts']; + } else { + $val = "$val"; + } + $desc = strip_tags(html_entity_decode($desc)); + $substr .= " '$name' => $val, // $desc\r\n"; + } + $str .= "\$BAW_CONF_DIS['$setting'] = array(\r\n$substr);\r\n\r\n"; + } + $str .= "\r\n?>"; + if (!$handle = fopen($filename, 'w+')) { + return baw_raise_error('configread'); + } + if (fwrite($handle, $str) === FALSE) { + return baw_raise_error('configwrite'); + } + + $out = $BAW_MES['cfg_saved']; + $out = baw_site_header() . "