Пример #1
0
 static function ajax_get_tree()
 {
     $id = $_REQUEST["node"];
     $sel_folder = folder_build_selfolder($id, "");
     $children = db_get_children($sel_folder);
     foreach ($children as $key => $folder) {
         $children[$key]["text"] = $folder["ftitle"];
         if ($folder["fcount"] != 0) {
             $children[$key]["text"] .= " (" . $children[$key]["fcount"] . ")";
         }
         $children[$key]["qtip"] = $folder["fdescription"];
         $children[$key]["cls"] = "folder";
         $children[$key]["href"] = "#" . $folder["id"];
         if ($folder["icon"] != "") {
             $children[$key]["icon"] = "ext/modules/" . $folder["icon"];
         }
     }
     return $children;
 }
Пример #2
0
function folder_build_folders()
{
    if (empty($_SESSION["folder"])) {
        $tfolder = 1;
    } else {
        $tfolder = $_SESSION["folder"];
    }
    if (empty($_SESSION["view"]["_" . $tfolder])) {
        $tview = "none";
    } else {
        $tview = $_SESSION["view"]["_" . $tfolder];
    }
    $sel_folder = folder_build_selfolder($tfolder, $tview);
    $sel_folder["parents"] = db_get_parents($sel_folder);
    if (count($sel_folder["parents"]) > 0) {
        foreach ($sel_folder["parents"] as $parent) {
            $id = $parent["id"];
            if (!isset($_SESSION["folder_states"][$id]) or !in_array($sel_folder["id"], $_SESSION["folder_states"][$id])) {
                $_SESSION["folder_states"][$id][] = $sel_folder["id"];
            }
        }
        if (!isset($_SESSION["folder_states"][$sel_folder["id"]])) {
            $_SESSION["folder_states"][$sel_folder["id"]] = array(1);
        }
    }
    if (!empty($_REQUEST["folder"]) and empty($_REQUEST["iframe"]) and empty($_REQUEST["preview"])) {
        if ($tview == "none") {
            $v = "";
        } else {
            $v = $tview;
        }
        if (isset($_SESSION["history"][$tfolder . $v])) {
            unset($_SESSION["history"][$tfolder . $v]);
        }
        $last_parent = end($sel_folder["parents"]);
        if (!empty($last_parent["ftitle"])) {
            $last_parent = $last_parent["ftitle"] . " / ";
        }
        $_SESSION["history"][$tfolder . $v] = array($last_parent . $sel_folder["ftitle"], $tfolder, $v);
        if (count($_SESSION["history"]) > 15) {
            array_shift($_SESSION["history"]);
        }
    }
    $sel_folder["children"] = db_get_children($sel_folder);
    $ftype = $sel_folder["ftype"];
    $tfolder = $sel_folder["id"];
    if (isset($_SESSION["disabled_modules"][$ftype])) {
        sys_warning("{t}Module disabled.{/t}");
        $ftype = "blank";
    }
    $GLOBALS["schemafile"] = sys_find_module($ftype);
    $GLOBALS["tname"] = $ftype;
    $GLOBALS["tquota"] = $sel_folder["quota"];
    $GLOBALS["tfolder"] = $tfolder;
    $tfolders = array($tfolder);
    if (!empty($_REQUEST["folders"])) {
        $tfolders = (array) $_REQUEST["folders"];
    } else {
        if ($sel_folder["folders"] != "") {
            $tfolders = explode("|", trim($sel_folder["folders"], "|"));
        }
    }
    $tfolders = _build_merge_folders(array_values($tfolders), $tfolder, $tview);
    $GLOBALS["tfolders"] = $tfolders;
    $GLOBALS["sel_folder"] = $sel_folder;
    $GLOBALS["tview"] = $tview;
    $_SESSION["folder"] = $tfolder;
    $_SESSION["ftype"] = $ftype;
    if (isset($_REQUEST["popup"])) {
        folder_build_tree(false);
    } else {
        if (defined("NOCONTENT") or !$_SESSION["treevisible"] or isset($_REQUEST["iframe"]) or isset($_REQUEST["preview"]) or isset($_REQUEST["export"])) {
            sys::$smarty->assign("tree", array("visible" => false));
        } else {
            folder_build_tree($_SESSION["treevisible"]);
        }
    }
    sys::$smarty->assign("folder", array("id" => $GLOBALS["tfolder"], "name" => $sel_folder["ftitle"], "description" => $sel_folder["fdescription"], "mountpoint" => $sel_folder["fmountpoint"], "type" => $sel_folder["ftype"], "parents" => $sel_folder["parents"], "children" => $sel_folder["children"]));
    sys::$smarty->assign("sys", array("app_title" => APP_TITLE, "version" => CORE_VERSION, "version_str" => CORE_VERSION_STRING, "session_time" => LOGIN_TIMEOUT, "folder_refresh" => FOLDER_REFRESH, "menu_autohide" => (int) MENU_AUTOHIDE, "tree_autohide" => (int) TREE_AUTOHIDE, "fdesc_in_content" => (int) FDESC_IN_CONTENT, "mountpoint_admin" => (int) MOUNTPOINT_REQUIRE_ADMIN, "is_superadmin" => (int) sys_is_super_admin($_SESSION["username"]), "is_guest" => (int) sys_is_guest($_SESSION["username"]), "username" => $_SESSION["username"], "home" => $_SESSION["home_folder"], "history" => $_SESSION["history"], "disabled_modules" => $_SESSION["disabled_modules"], "is_mobile" => sys::$is_mobile));
}
Пример #3
0
 static function tree_open($id)
 {
     if (empty($id) or !self::_tree_open_session($id)) {
         return array();
     }
     $sel_folder = folder_build_selfolder($id, "");
     $children = db_get_children($sel_folder);
     return array("level" => $sel_folder["flevel"], "children" => $children);
 }