Example #1
0
$bb_attachments['status'] = array("ok", "deleted", "failed", "denied extension", "denied mime", "denied size", "denied count", "denied duplicate", "denied dimensions");
$bb_attachments['errors'] = array("ok", "uploaded file exceeds UPLOAD_MAX_FILESIZE in php.ini", "uploaded file exceeds MAX_FILE_SIZE in the HTML form", "uploaded file was only partially uploaded", "no file was uploaded", "temporary folder missing", "failed to write file to disk", "file upload stopped by PHP extension");
$bb_attachments['db'] = "bb_attachments";
//   $bbdb->prefix."attachments";  // database name - force to "bb_attachments" if you need compatibility with an old install
// really stop editing!
add_action('bb_init', 'bb_attachments_init');
add_action('bb_delete_post', 'bb_attachments_recount');
add_filter('post_text', 'bb_attachments_bbcode', 250);
if (isset($_FILES['bb_attachments'])) {
    if (defined('BACKPRESS_PATH')) {
        add_action('bb-post.php', 'bb_attachments_process_post');
    } else {
        add_action('bb_post.php', 'bb_attachments_process_post');
    }
}
bb_register_activation_hook(str_replace(array(str_replace("/", "\\", BB_PLUGIN_DIR), str_replace("/", "\\", BB_CORE_PLUGIN_DIR)), array("user#", "core#"), __FILE__), 'bb_attachments_install');
function bb_attachments_init()
{
    global $bbdb, $bb_attachments;
    if (isset($_GET['bb_attachments_diagnostic']) || isset($_GET['bb_attachments_debug'])) {
        include 'debug.php';
    }
    if (isset($_GET['bbat_delete'])) {
        bb_attachments_delete();
    }
    if (isset($_GET['bb_attachments'])) {
        if (isset($_GET['bbat'])) {
            if (isset($_GET['inline'])) {
                bb_attachments_inline();
            } else {
                bb_attachments_download();
Author URI:  http://bbshowcase.org
Donate: http://bbshowcase.org/donate/
*/
define('BB_LANG_USE_FILE_META', false);
// change to true to scan inside of .mo files for language name, set to 'only' or 'force' to ONLY use file meta
/*  stop editing here  */
bb_language_switcher_set_cookie();
add_filter('locale', 'bb_language_switcher_filter');
add_action('bb_language_switcher', 'bb_language_switcher');
if (defined('BACKPRESS_PATH') && bb_language_switcher_filter()) {
    bb_load_default_textdomain();
}
// admin hooks
if (defined('BB_IS_ADMIN') && BB_IS_ADMIN && (isset($_GET['name']) && strpos(strtolower($_GET['name']), "language+switcher") || isset($_GET['plugin']) && strpos($_GET['plugin'], basename(__FILE__)))) {
    require_once "bb-language-switcher-admin.php";
    bb_register_activation_hook(str_replace(array(str_replace("/", "\\", BB_PLUGIN_DIR), str_replace("/", "\\", BB_CORE_PLUGIN_DIR)), array("user#", "core#"), __FILE__), 'bb_language_switcher_update');
}
if (isset($_GET['bb_language_switcher_update'])) {
    require_once "bb-language-switcher-admin.php";
    add_action('bb_init', 'bb_language_switcher_update');
}
if (isset($_GET['bb_language_switcher_debug'])) {
    require_once "bb-language-switcher-admin.php";
    add_action('bb_init', 'bb_language_switcher_debug');
}
function bb_language_switcher_filter($locale = '')
{
    if (isset($_COOKIE['bblang_' . BB_HASH])) {
        $locale = bb_language_switcher_get_cookie();
    }
    return $locale;