function bb2_mediawiki_entry()
{
    global $bb2_timer_total;
    $bb2_mtime = explode(" ", microtime());
    $bb2_timer_start = $bb2_mtime[1] + $bb2_mtime[0];
    if (php_sapi_name() != 'cli') {
        require_once BB2_CWD . "/bad-behavior/core.inc.php";
        bb2_install();
        // FIXME: see above
        $settings = bb2_read_settings();
        bb2_start($settings);
    }
    $bb2_mtime = explode(" ", microtime());
    $bb2_timer_stop = $bb2_mtime[1] + $bb2_mtime[0];
    $bb2_timer_total = $bb2_timer_stop - $bb2_timer_start;
}
Ejemplo n.º 2
0
// if you don't use it.
function bb2_insert_head()
{
    global $bb2_javascript;
    echo $bb2_javascript;
}
// Display stats? This is optional.
function bb2_insert_stats($force = false)
{
    $settings = bb2_read_settings();
    if ($force || $settings['display_stats']) {
        $blocked = bb2_db_query("SELECT COUNT(*) FROM " . $settings['log_table'] . " WHERE `key` NOT LIKE '00000000'");
        if ($blocked !== FALSE) {
            echo sprintf('<p><a href="http://www.bad-behavior.ioerror.us/">%1$s</a> %2$s <strong>%3$s</strong> %4$s</p>', __('Bad Behavior'), __('has blocked'), $blocked[0]["COUNT(*)"], __('access attempts in the last 7 days.'));
        }
    }
}
// Return the top-level relative path of wherever we are (for cookies)
// You should provide in $url the top-level URL for your site.
function bb2_relative_path()
{
    //$url = parse_url(get_bloginfo('url'));
    //return $url['path'] . '/';
    return '/';
}
// Calls inward to Bad Behavor itself.
require_once BB2_CWD . "/bad-behavior/version.inc.php";
require_once BB2_CWD . "/bad-behavior/core.inc.php";
bb2_install();
// FIXME: see above
bb2_start(bb2_read_settings());
Ejemplo n.º 3
0
function bb2_mediawiki_entry()
{
    global $bb2_timer_total;
    $bb2_mtime = explode(" ", microtime());
    $bb2_timer_start = $bb2_mtime[1] + $bb2_mtime[0];
    if (php_sapi_name() != 'cli') {
        bb2_install();
        // FIXME: see above
        $settings = bb2_read_settings();
        // FIXME: Need to make this multi-DB compatible eventually
        $dbr = wfGetDB(DB_SLAVE);
        if (get_class($dbr) != "DatabaseMysql") {
            $settings['logging'] = false;
        }
        bb2_start($settings);
    }
    $bb2_mtime = explode(" ", microtime());
    $bb2_timer_stop = $bb2_mtime[1] + $bb2_mtime[0];
    $bb2_timer_total = $bb2_timer_stop - $bb2_timer_start;
}