$data = BB_GetWidgetList(); if (!count($data)) { BB_PropertyFormLoadError("No widgets found."); } $widgets = array(); foreach ($data as $widget) { $widgets[$widget["_dir"]] = $widget["_n"]; } $options = array("title" => "Delete Widget", "desc" => "Select a widget to delete. Deletion is permanent and may delete all related content!", "fields" => array(array("type" => "select", "name" => "dir", "options" => $widgets)), "submit" => "Delete", "focus" => true); BB_RunPluginAction("bb_main_edit_site_opt_delete_widget_options"); BB_PropertyForm($options); BB_RunPluginAction("post_bb_main_edit_site_opt_delete_widget"); } else { if ($_REQUEST["bb_action"] == "bb_main_edit_site_opt_flush_cache") { BB_RunPluginAction("pre_bb_main_edit_site_opt_flush_cache"); if (!BB_WidgetStatusUpdate()) { BB_PropertyFormLoadError("Unable to flush the cache.", true); } BB_LoadExtensionsCache(); $bb_extensions_info["nextcheck"] = 0; BB_SaveExtensionsCache(); BB_PropertyFormLoadError("Successfully flushed the cache.", true); BB_RunPluginAction("post_bb_main_edit_site_opt_flush_cache"); } else { if ($_REQUEST["bb_action"] == "bb_main_edit_site_opt_logout") { BB_RunPluginAction("pre_bb_main_edit_site_opt_logout"); if (!BB_LogoutUserSession($bb_account["user"], $_REQUEST["bbl"])) { BB_PropertyFormLoadError("Unable to logout. Token mismatch."); } require_once ROOT_PATH . "/" . SUPPORT_PATH . "/cookie.php"; SetCookieFixDomain("bbl", "", 1, ROOT_URL . "/", "", USE_HTTPS, true);
function BB_DeleteWidgetFiles($dir) { global $bb_paths; $widgets = BB_GetWidgetList(); foreach ($widgets as $widget) { if ($widget["_dir"] == $dir) { BB_RunPluginActionInfo("pre_bb_deletewidgetfiles", $dir); if (!BB_RemoveDirectory((isset($bb_paths) ? $bb_paths["ROOT_PATH"] . "/" . $bb_paths["WIDGET_PATH"] : ROOT_PATH . "/" . WIDGET_PATH) . "/" . $dir)) { return false; } BB_RunPluginAction("post_bb_deletewidgetfiles"); return BB_WidgetStatusUpdate(); } } return false; }