예제 #1
0
파일: h.php 프로젝트: timofonic/kod
<?php

# hunch utils
error_reporting(E_ALL);
date_default_timezone_set(@date_default_timezone_get());
# ------------------------------------------------------------------------------
class h
{
    static $basedir = null;
    static $magicQuotes = false;
}
# derive basedir, given we live in <basedir>/something/h.php
h::$basedir = dirname(dirname(__FILE__));
h::$magicQuotes = !!(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
# autoload classes from the same directory as we live in
@ini_set('include_path', ini_get('include_path') . ':' . h::$basedir . '/lib');
function __autoload($classname)
{
    require $classname . '.php';
}
# ------------------------------------------------------------------------------
class hlog
{
    static $file = null;
    # append |prefix| + |msg| to end of |hlog::$file| using an exclusive flock
    static function append($prefix, $msg = false)
    {
        if (!self::$file) {
            throw new Exception('hlog::$file is not set');
        }
        if ($msg === false) {