Пример #1
0
    $bb_profile = (string) $_REQUEST["bb_profile"];
} else {
    $bb_profile = "";
}
if (preg_replace('/[^A-Za-z0-9_\\-]/', "", $bb_profile) !== $bb_profile) {
    echo htmlspecialchars(BB_Translate("Invalid cache profile.  Cache profile can only contain alphanumeric (A-Z, 0-9), '_', and '-' characters."));
    exit;
}
// Load widgets.
BB_RunPluginAction("pre_widgets_load");
foreach ($bb_langpage["widgets"] as $id => $data) {
    $bb_widget->SetID($id);
    BB_RunPluginAction("pre_widget_load");
    if ($bb_widget->_m === false && $bb_widget->_a !== false && file_exists(ROOT_PATH . "/" . WIDGET_PATH . "/" . $bb_widget->_file)) {
        require_once ROOT_PATH . "/" . WIDGET_PATH . "/" . $bb_widget->_file;
        BB_InitWidget();
    }
    BB_RunPluginAction("post_widget_load");
}
$bb_widget->SetID("");
BB_RunPluginAction("post_widgets_load");
// Master widget functions.
function BB_MasterWidgetManager($name)
{
    global $bb_account, $bb_mode, $bb_widget, $bb_langpage, $bb_css, $bb_js;
    if ($bb_mode == "head") {
        $bb_css[ROOT_URL . "/" . SUPPORT_PATH . "/css/widgets.css"] = ROOT_PATH . "/" . SUPPORT_PATH . "/css/widgets.css";
        $bb_js[ROOT_URL . "/" . SUPPORT_PATH . "/js/widgets.js"] = ROOT_PATH . "/" . SUPPORT_PATH . "/js/widgets.js";
    } else {
        if ($bb_account["type"] == "dev" || $bb_account["type"] == "design") {
            $widget = $bb_langpage["widgets"][$name];
Пример #2
0
function BB_LoadWidgets()
{
    global $bb_langpage, $bb_widget, $bb_paths;
    foreach ($bb_langpage["widgets"] as $id => $data) {
        $bb_widget->SetID($id);
        if ($bb_widget->_m === false && $bb_widget->_a !== false) {
            $filename = (isset($bb_paths) ? $bb_paths["ROOT_PATH"] . "/" . $bb_paths["WIDGET_PATH"] : ROOT_PATH . "/" . WIDGET_PATH) . "/" . $bb_widget->_file;
            if (file_exists($filename)) {
                require_once $filename;
                BB_InitWidget();
            }
        }
    }
}
Пример #3
0
function BB_AddWidget($widgetdir, $name, $parent, $init = false)
{
    global $bb_langpage, $bb_revision_num, $bb_widget, $bb_widget_id;
    $tempinfo = array($parent, $widgetdir, $name);
    BB_RunPluginActionInfo("pre_bb_addwidget", $tempinfo);
    if (!isset($bb_langpage["widgets"][$parent]) || $bb_langpage["widgets"][$parent]["_m"] === false) {
        return false;
    }
    $data = BB_GetWidgetList();
    if (!count($data)) {
        return false;
    }
    for ($x = 0; $x < count($data) && $data[$x]["_dir"] != $widgetdir; $x++) {
    }
    if ($x == count($data)) {
        return false;
    }
    $name = trim($name);
    if ($name == "") {
        return false;
    }
    $id = BB_CreateWidgetID($data[$x]["_s"] . " " . $name);
    $bb_langpage["widgets"][$id] = array("_f" => $name, "_m" => false, "_a" => $parent, "_id" => $id, "_file" => $widgetdir . "/index.php");
    if (isset($bb_widget) && isset($bb_widget_id) && $bb_widget_id == $parent) {
        $bb_widget->_ids[] = $id;
    } else {
        $bb_langpage["widgets"][$parent]["_ids"][] = $id;
    }
    if ($init) {
        $oldid = $bb_widget_id;
        $bb_widget->SetID($id);
        BB_InitWidget();
        $bb_widget->SetID($oldid);
    }
    BB_RunPluginAction("post_bb_addwidget");
    return BB_SaveLangPage($bb_revision_num);
}