コード例 #1
0
ファイル: edit.php プロジェクト: harrylongworth/tv-bb
                                                                                                                                                                $dirfile = BB_GetRealPath($_REQUEST["dir"] . "/" . $_REQUEST["file"]);
                                                                                                                                                                $isfile = is_file(ROOT_PATH . "/" . $dirfile);
                                                                                                                                                                $options = array("title" => "File Explorer - Rename " . ($isfile ? "File" : "Directory"), "desc" => BB_Translate("Rename the '%s' " . ($isfile ? "file" : "directory") . " in '%s'.", $_REQUEST["file"], "/" . ($_REQUEST["dir"] == "." ? "" : $_REQUEST["dir"] . "/")), "htmldesc" => $desc, "hidden" => array("dir" => $_REQUEST["dir"], "srcfile" => $_REQUEST["file"]), "fields" => array(array("type" => "text", "name" => "destfile", "value" => $_REQUEST["file"], "desc" => ($isfile ? "Filename" : "Directory name") . " can only contain alphanumeric (A-Z, 0-9), '_', '.', and '-' characters.")), "submit" => "Rename", "focus" => true);
                                                                                                                                                                BB_RunPluginAction("bb_main_edit_site_opt_file_explorer_rename_options");
                                                                                                                                                                BB_PropertyForm($options);
                                                                                                                                                                BB_RunPluginAction("post_bb_main_edit_site_opt_file_explorer_rename");
                                                                                                                                                            } else {
                                                                                                                                                                if ($bb_account["type"] == "dev" && $_REQUEST["bb_action"] == "bb_main_edit_site_opt_file_explorer_delete" && BB_IsSecExtraOpt("dir") && BB_IsSecExtraOpt("file")) {
                                                                                                                                                                    BB_RunPluginAction("pre_bb_main_edit_site_opt_file_explorer_delete");
                                                                                                                                                                    $dirfile = BB_GetRealPath($_REQUEST["dir"] . "/" . $_REQUEST["file"]);
                                                                                                                                                                    if ($dirfile == "") {
                                                                                                                                                                        BB_PropertyFormError("Not allowed to delete root.");
                                                                                                                                                                    }
                                                                                                                                                                    $dirfile = ROOT_PATH . "/" . $dirfile;
                                                                                                                                                                    $isfile = is_file($dirfile);
                                                                                                                                                                    if (!BB_RemoveDirectory($dirfile)) {
                                                                                                                                                                        BB_PropertyFormError("Unable to delete.");
                                                                                                                                                                    }
                                                                                                                                                                    ?>
<div class="success"><?php 
                                                                                                                                                                    echo htmlspecialchars(BB_Translate($isfile ? "File deleted." : "Directory deleted."));
                                                                                                                                                                    ?>
</div>
<script type="text/javascript">
LoadProperties(<?php 
                                                                                                                                                                    echo BB_CreatePropertiesJS("bb_main_edit_site_opt_file_explorer", array("dir" => $_REQUEST["dir"]));
                                                                                                                                                                    ?>
);
</script>
<?php 
                                                                                                                                                                    BB_RunPluginAction("post_bb_main_edit_site_opt_file_explorer_delete");
コード例 #2
0
ファイル: bb_functions.php プロジェクト: harrylongworth/tv-bb
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;
}