Location: PHPKode > projects > Obsessive Website Statistics > ows/include/default.inc.php
<?php
/*
	$Id: default.inc.php 109 2007-09-27 04:49:13Z randomperson83 $

	Obsessive Web Statistics
    Copyright (C) 2007 Dustin Spicuzza <hide@address.com>

    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 3 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, see <http://www.gnu.org/licenses/>.

	This is the default configuration.. this SHOULD NOT be modified.
	This includes config.inc.php, so you don't have to.

*/

global $cfg;
$cfg = array(); 

require('log_formats.php');

// this value can be 'mysql' or 'postgre'. However, postgre probably does not
// work at this point.. but it may. Its not supported at this time.
$cfg['db_type'] 				= "mysql";
$cfg['db_table_type']			= "InnoDB";	// The MySQL table engine to use. only supported for mysql databases

$cfg['enable_transactions'] 	= 1;		// enable SQL transactions

$cfg['explain_sql']				= false;	// causes SQLSelect to call EXPLAIN
											// on your query and show it in a table. Useful
											// for plugin development

$cfg['debug']					= false;	// set this to true to turn on debug messages
											// should not be set to true in a production environment

$cfg['db_queries'] 				= 0;		// number of queries performed in creating the page

$cfg['db_row_limit']			= 100;		// maximum amount of rows that a plugin should display (per query). This
											// is only enforced for the output of plugins that use OWS
											// output functions.
											

											
$cfg['theme']				= 'default'; 	// theme files are located in the /themes/ directory. This
											// parameter specifies a directory within that directory.
											
$cfg['timezone']			= -1;			// you MUST set this to a valid timezone. Otherwise, it 
											// will yell at you and assume GMT. Examples:
											// http://us.php.net/manual/en/timezones.php
											
$cfg['big_files']			= false;		// set this to true if your site sometimes serves files
											// that are over 2GB in size
					
$cfg['indexsz_text']		= 32;			// number of bytes to index for generic text fields,
											// such as referrer, agent, etc. 32 is default.

// upload related items

$cfg['upload_flush'] 		= 100000;		// number of rows to upload at once without committing the 
											// transaction to the database. 
											
$cfg['upload_lines']		= 150; 			// number of lines to read at once from the logfile

$cfg['analysis_cache_sz']	= 25;			// number of cache entries to have for the analysis cache
											// only used during upload. Total cache entries is something
											// like dimensions * 2 * this_var. Obviously more entries
											// requires more memory.
											
$cfg['cleanup_stale']		= false;		// By default, you should only need this if you are using 
											// iReject plugins. Otherwise, it just wastes time.
											
/*
	File extensions
	
	The more items in the array, the slower your logfile upload will be. Though,
	most of the time the difference should be negligible. Remember, if you change
	these settings, you must reanalyze the existing data for the settings to take
	effect.
*/

// determines whether a filename is a page or not				
$cfg['ext_page'] = array('htm','html','php');
// $cfg['ext_page'] = array('htm','html','xhtml','xml','php','php3','php4','php5','pl','asp','aspx');

// determines whether a filename is an image or not.
$cfg['ext_image'] = array('jpg','gif','png','ico');
//$cfg['ext_image'] = array('jpg','gif','png','ico','bmp','tif','wmf','psd','xpm','svg');

// determines whether a filename is a 'download' or not
$cfg['ext_download'] = array('pdf','zip','rar','tar.gz','tar.bz2','tar','doc','ppt');
//$cfg['ext_download'] = array('pdf','zip','rar','tar.gz','tar.bz2','tar','mov','rm','avi','doc','docx','odf','rtf');


// array of websites and options
$cfg['websites'] = array();
/* 
	Config your website like this:

		$cfg['websites']['domain.com'] = array();		// REQUIRED, domain should not have www. in front of it
		$cfg['websites']['domain.com']['option_name'] = value;
	
	Where option_name can be one of the following site-specific options:
	
		log_format		Specifies the format of the log files for that site
		
		preferred_name	Specify the preferred alias for your site. Typically would be 'www.domain.com'.
						If this is not specified, then the domain name is used.
						
		aliases			An array of aliases for your site.. should almost always have www as one.
						array('www.domain.com','www2.domain.com','etc.domain.com');
						
		lots_of_hits	Set to true if your site will ever have more logfile lines than 2 billion. For comparison,
						a 1GB logfile can generally have 2-4 million lines. Most people won't need to specify this.
						Specifying this will use a bigint for keys instead of an int(10)... ie, it will take more 
						space. Defaults to false. If you ever actually *need* to use this, let me know. :)
*/

if ((@include 'config.inc.php') != 1){
	show_error("Configuration file not found!");
	die;
}

// TODO: Include per-website config files`

// fixup options not specified or improperly specified
// true, we don't HAVE to do this, but it doesn't really affect performance
// and it gives the user less trouble to configure stuff
foreach ($cfg['websites'] as $k => &$v){
	
	if (!array_key_exists('aliases',$v))
		$cfg['websites'][$k]['aliases'] = array();
	else if (!is_array($v['aliases']))
		$cfg['websites'][$k]['aliases'] = array($k['aliases']);

	// add domain to alias list
	if (!array_key_exists($k,$cfg['websites'][$k]['aliases']))
		$cfg['websites'][$k]['aliases'][] = $k;
		
	if (!array_key_exists('preferred_name',$v))
		$cfg['websites'][$k]['preferred_name'] = $k;	
	else if ($v['preferred_name'] != $k && !in_array($v['preferred_name'], $v['aliases']))
		$cfg['websites'][$k]['aliases'][] = $v['preferred_name'];
		
	if (!array_key_exists('lots_of_hits',$v))
		$cfg['websites'][$k]['lots_of_hits'] = false;
}

// we already expect them to have PHP 5, they should have the newest version
if (!function_exists('date_default_timezone_set'))
	echo "Warning: Upgrade your PHP version to >= 5.1.0";
else if ($cfg['timezone'] == -1){
	show_error('You MUST set $cfg[\'timezone\'] in config.inc.php! Defaulting to GMT.');
	if (!date_default_timezone_set('GMT'))
		show_error('Error setting default timezone. This shouldn\'t happen, really');
}else if (!date_default_timezone_set($cfg['timezone']))
	show_error('Your timezone is configured incorrectly in config.inc.php!');

?>
Return current item: Obsessive Website Statistics