1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
<?php
# This file is part of BBClone (The PHP web counter on steroids)
# $Header: /cvs/bbclone/constants.php,v 1.96 2005/02/21 00:31:16 olliver Exp $
# Copyright (C) 2001-2005, the BBClone Team (see file doc/authors.txt
# distributed with this library)
# 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.
# See doc/copying.txt for details
$vars = array(
"BBC_ACCESS_FILE", "BBC_CACHE_PATH", "BBC_CONFIG_FILE", "BBC_CONF_PATH", "BBC_COUNTER_COLUMNS", "BBC_COUNTER_FILES",
"BBC_COUNTER_PREFIX", "BBC_COUNTER_SUFFIX", "BBC_CUSTOM_CHARSET", "BBC_DEBUG", "BBC_DETAILED_STAT_FIELDS",
"BBC_IGNORE_AGENT", "BBC_IGNORE_BOTS", "BBC_IGNORE_IP", "BBC_IGNORE_REFER", "BBC_IMAGES_PATH", "BBC_IP2EXT_PATH",
"BBC_KILL_STATS", "BBC_LANGUAGE", "BBC_LANGUAGE_PATH", "BBC_LAST_FILE", "BBC_LIB_PATH", "BBC_LOCK", "BBC_MAINSITE",
"BBC_MAXBROWSER", "BBC_MAXEXTENSION", "BBC_MAXHOST", "BBC_MAXKEY", "BBC_MAXORIGIN", "BBC_MAXOS", "BBC_MAXPAGE",
"BBC_MAXROBOT", "BBC_MAXTIME", "BBC_MAXVISIBLE", "BBC_NO_DNS", "BBC_NO_HITS", "BBC_NUM_SIZE", "BBC_PURGE_SINGLE",
"BBC_ROOT_PATH", "BBC_RULES_PATH", "BBC_SEP", "BBC_SHOW_CONFIG", "BBC_SUBTITLE_SIZE", "BBC_TEXT_SIZE",
"BBC_TIMESTAMP", "BBC_TIME_OFFSET", "BBC_TITLEBAR", "BBC_TITLE_SIZE", "BBC_USE_LOCK", "BBC_VERSION", "access", "a",
"b", "c", "last"
);
# Make sure it's only us who's defining variables
foreach ($vars as $i) if (isset($$i)) unset($$i);
# The version number of BBCLONE
$BBC_VERSION = "0.5.0cvs";
# BBClone's location relative from where it's been called
$BBC_ROOT_PATH = defined("_BBCLONE_DIR") ? _BBCLONE_DIR : "";
# Directory paths
$BBC_CACHE_PATH = $BBC_ROOT_PATH."var/";
$BBC_CONF_PATH = $BBC_ROOT_PATH."conf/";
$BBC_IMAGES_PATH = "images/";
$BBC_IP2EXT_PATH = $BBC_ROOT_PATH."ip2ext/";
$BBC_LANGUAGE_PATH = "language/";
$BBC_LIB_PATH = $BBC_ROOT_PATH."lib/";
# File paths
$BBC_ACCESS_FILE = $BBC_CACHE_PATH."access.php";
$BBC_CONFIG_FILE = $BBC_CONF_PATH."config.php";
$BBC_LAST_FILE = $BBC_CACHE_PATH."last.php";
$BBC_LOCK = $BBC_CACHE_PATH."lock";
# name of the counter files
$BBC_COUNTER_PREFIX = "counter";
$BBC_COUNTER_SUFFIX = ".inc";
# How many columns they contain
$BBC_COUNTER_COLUMNS = 8;
# What titles are assigned to them
$BBC_COUNTER_COLUMN_NAMES = array("time", "prx_ip", "ip", "dns", "agent", "referer", "uri", "page");
# Amount of counter files
$BBC_COUNTER_FILES = 16;
# Global separator
$BBC_SEP = chr(173);
# Timestamp at runtime
$BBC_TIMESTAMP = time();
#####################################################################
# Do not touch the stuff below if you have no clue what it's doing! #
#####################################################################
# PHP version number
define("_BBC_PHP", substr(str_replace(".", "", PHP_VERSION), 0, 3));
# Message handling, needs to be globally available
function bbc_msg($item, $state = "r") {
global $BBC_LOCK;
$begin = "<hr /><b>BBClone debug mode:</b><br />";
$end = "<hr /><i>Set $BBC_DEBUG = ""; in config.php to turn off debug mode again.</i>\n";
switch ($state) {
case "i":
$msg = $begin."BBClone is ignoring this hit because it matches up against an entry in your $BBC_IGNORE_IP "
."list";
break;
case "k":
$msg = $begin."It seems that BBClone has been successfully reset. If you keep getting this message while "
."access.php and last.php remain untouched, it means the file system is denying access and returning a "
."flag PHP doesn't understand. On Windows NT/2k/XP/2k3 the problem will occur with PHP 4.x if the var "
."directory only has read permissions.";
break;
case "l":
$msg = $begin."BBClone isn't able to lock files for writing with its current setting. You may ";
if (extension_loaded("sysvsem")) $msg .= "use $BBC_USE_LOCK = "sem"; in config.php however";
elseif (extension_loaded("dio")) $msg .= "use $BBC_USE_LOCK = "dio"; in config.php however";
elseif (function_exists("flock")) {
$msg .= "use $BBC_USE_LOCK = "flk"; however. If that's your setting already, it means that "
."you cannot use BBClone with your current server settings";
}
else $msg .= "not be able to run BBClone with your current server settings.";
break;
case "o":
$msg = $begin."It seems that BBClone has successfully written to file ".$item.". If you keep getting this "
."message while access.php and last.php remain empty, it means the file system is denying access and "
."returning a flag PHP doesn't understand. On Windows NT/2k/XP/2k3 the problem will occur with PHP 4.x if "
."the var directory only has read permissions.";
break;
default:
$msg = $begin;
if ((substr($item, (strrpos($item, ".") + 1)) == "php") || (substr($item, (strrpos($item, ".") + 1)) == "inc") ||
(basename($item) == basename($BBC_LOCK))) {
$msg .= "File $item is ".(($state == "w") ? "read-only" : "inaccessible").". You may have to check whether it "
."has the right permissions or is even missing.";
}
elseif (empty($item)) {
$msg .= "BBClone isn't able to read its configuration data. This is likely because you embedded BBClone's "
."code snippet into a function. Please use BBClone as suggested in the documentation.";
}
else {
$msg .= "Directory $item is ".(($state == "w") ? "read-only" : "inaccessible").". You may have to check "
."whether it has the right permissions or is missing.";
}
}
return ($msg.$end);
}
?>
|