<?php
/* This file is part of BBClone (A PHP based Web Counter on Steroids)
 * 
 * SVN FILE $Id: constants.php 325 2014-12-05 09:33:55Z matthys $
 *  
 * Copyright (C) 2001-2015, the BBClone Team (see doc/authors.txt for details)
 *
 * 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.
 *
 * See doc/copying.txt for details
 */

global $BBC_ROOT_PATH, $BBC_VERSION, $BBC_CACHE_PATH, $BBC_CONF_PATH,
  $BBC_CSS_PATH, $BBC_IMAGES_PATH, $BBC_LANGUAGE_PATH, $BBC_LIB_PATH,
  $BBC_PLUGIN_PATH, $BBC_IP2EXT_PATH, $BBC_ACCESS_FILE, $BBC_LAST_FILE,
  $BBC_CONFIG_FILE, $BBC_TIMESTAMP, $BBC_COUNTER_FILES, $BBC_COUNTER_PREFIX,
  $BBC_COUNTER_SUFFIX, $BBC_LOCK, $BBC_SEP, $BBC_COUNTER_COLUMNS,
  $BBC_COUNTER_COLUMN_NAMES, $BBC_LOG_PROCESSOR,$BBC_CSS_FILE, $translation, $BBC_MAX_PAGENAME,$BBC_TIME_OFFSET,$BBC_MAXVISIBLE,$BBC_DETAILED_STAT_FIELDS,$BBC_MAXORIGIN,$BBC_MAXKEY,$BBC_MAXPAGE,$BBC_MAXHOST,$BBC_MAXROBOT,$BBC_MAXEXTENSION,$BBC_MAXOS,$BBC_MAXBROWSER;
$BBC_DEBUG = true;
// BBClone's location relative from where it's been called
$BBC_ROOT_PATH = defined("_BBCLONE_DIR") ? _BBCLONE_DIR : "";

$BBC_CACHE_PATH = defined("_BBC_CACHE_PATH") ? _BBC_CACHE_PATH : "";
if (!file_exists($BBC_CACHE_PATH)) {
    @mkdir($BBC_CACHE_PATH);
}
// BBClone version
$BBC_VERSION = "0.6.3";
// Directory paths
//$BBC_CACHE_PATH  = $BBC_CACHE_PATH."var/";
$BBC_CONF_PATH = $BBC_ROOT_PATH."conf/";
$BBC_CSS_PATH = "/bbclone/css/";
$BBC_CSS_FILE = "bbclone.css";
$BBC_IMAGES_PATH = "/bbclone/images/";
$BBC_LANGUAGE_PATH = $BBC_ROOT_PATH."language/";
$BBC_LIB_PATH = $BBC_ROOT_PATH."lib/";
$BBC_PLUGIN_PATH = $BBC_LIB_PATH."plugin/";
$BBC_IP2EXT_PATH = $BBC_ROOT_PATH."ip2ext/";
// File paths
$BBC_LOCK = $BBC_CACHE_PATH.".htalock";
if (!file_exists($BBC_LOCK)) {
    $handler = fopen($BBC_LOCK, "w");
	fwrite($handler, "");
	fclose($handler);
}
$BBC_ACCESS_FILE = $BBC_CACHE_PATH."access.php";
if (!file_exists($BBC_ACCESS_FILE)) {
    $handler = fopen($BBC_ACCESS_FILE, "w");
	fwrite($handler, "");
	fclose($handler);
}
$BBC_LAST_FILE = $BBC_CACHE_PATH."last.php";
if (!file_exists($BBC_LAST_FILE)) {
    $handler = fopen($BBC_LAST_FILE, "w");
	fwrite($handler, "");
	fclose($handler);
}
$BBC_CONFIG_FILE = $BBC_CONF_PATH."config.php";
// Timestamp at run-time
$BBC_TIMESTAMP = time();
// Amount of counter files
$BBC_COUNTER_FILES = 8;
// Name of the counter files
$BBC_COUNTER_PREFIX = "counter";
$BBC_COUNTER_SUFFIX = ".inc";
$BBC_DETAILED_STAT_FIELDS = "browser,dns,ext,id,ip,os,page,prx_ip,referer,search,time,visits";
// Global separator
$BBC_SEP = chr(173);
// How many columns they contain
$BBC_COUNTER_COLUMNS = 8;
$BBC_MAX_PAGENAME = 100;
$BBC_TIME_OFFSET = 3600;
$BBC_MAXVISIBLE = 30;
// What titles are assigned to them
$BBC_COUNTER_COLUMN_NAMES = array("time", "prx_ip", "ip", "dns", "agent", "referer", "uri", "page");
// File path Log Processor
$BBC_LOG_PROCESSOR = $BBC_ROOT_PATH."log_processor.php";
$BBC_MAXORIGIN = 10;
$BBC_MAXKEY = 10;
$BBC_MAXPAGE = 10;
$BBC_MAXHOST = 10;
$BBC_MAXROBOT = 10;
$BBC_MAXEXTENSION = 10;
$BBC_MAXOS = 10;
$BBC_MAXBROWSER = 10;
///////////////////////////////////////////////////////////////////////
// Do not touch the stuff below if you have no clue what it's doing! //
///////////////////////////////////////////////////////////////////////

// Message handling, needs to be globally available
function bbc_msg($item, $state = "r") {
	return "<div style=\"border: solid 2px red; background-color: yellow; padding: 4px; font-weight: bold;\">Error bbc_msg; item: " . $item . " / state: " . $state . "</div>";
}

// PHP version number
define("_BBC_PHP", substr(str_replace(".", "", PHP_VERSION), 0, 3));
?>