Exemplo n.º 1
0
            }
        }
        wpfb_print_json($props);
        exit;
    case 'new-cat':
        if (!WPFB_Core::CurUserCanCreateCat()) {
            die('-1');
        }
        wpfb_loadclass('Admin');
        $result = WPFB_Admin::InsertCategory($_POST);
        if (isset($result['error']) && $result['error']) {
            wpfb_print_json(array('error' => $result['error']));
            exit;
        }
        $cat = $result['cat'];
        $args = WPFB_Output::fileBrowserArgs($_POST['args']);
        $filesel = $args['type'] === 'fileselect';
        $catsel = $args['type'] === 'catselect';
        wpfb_print_json(array('error' => 0, 'id' => $cat->GetId(), 'name' => $cat->GetTitle(), 'id_str' => $args['idp'] . 'cat-' . $cat->cat_id, 'url' => $cat->GetUrl(), 'text' => WPFB_Output::fileBrowserCatItemText($catsel, $filesel, $cat, $args['onselect'], empty($_REQUEST['is_admin']) ? 'filebrowser' : 'filebrowser_admin'), 'classes' => $filesel || $catsel ? 'folder' : null));
        exit;
    case 'change-category':
        wpfb_loadclass('File', 'Admin');
        $item = WPFB_Item::GetById($_POST['id'], $_POST['type']);
        if ($item && $item->CurUserCanEdit()) {
            $res = $item->ChangeCategoryOrName($_POST['new_cat_id']);
            wpfb_print_json($res);
        } else {
            die('-1');
        }
        exit;
}
Exemplo n.º 2
0
 private static function actionChangeCategory($args)
 {
     wpfb_loadclass('File', 'Admin');
     $item = WPFB_Item::GetById($args['id'], $args['type']);
     if ($item && $item->CurUserCanEdit()) {
         $res = $item->ChangeCategoryOrName($args['new_cat_id']);
         wp_send_json($res);
     } else {
         die('-1');
     }
 }