예제 #1
0
        if ($res > 0) {
            if (isset($_REQUEST["apply"])) {
                LocalRedirect("/bitrix/admin/clouds_storage_edit.php?ID=" . $res . "&lang=" . LANGUAGE_ID . "&" . $tabControl->ActiveTabParam());
            } else {
                LocalRedirect("/bitrix/admin/clouds_storage_list.php?lang=" . LANGUAGE_ID);
            }
        } else {
            $e = $APPLICATION->GetException();
            if (is_object($e)) {
                $message = new CAdminMessage(GetMessage("CLO_STORAGE_EDIT_SAVE_ERROR"), $e);
            }
            $bVarsFromForm = true;
        }
    } elseif (isset($_REQUEST["delete"]) && $ID > 1) {
        $ob = new CCloudStorageBucket($ID);
        if ($ob->Delete()) {
            LocalRedirect("/bitrix/admin/clouds_storage_list.php?lang=" . LANGUAGE_ID);
        } else {
            $bVarsFromForm = true;
        }
    }
}
if ($bVarsFromForm) {
    $arRes = array("ACTIVE" => (string) $_REQUEST["ACTIVE"], "SORT" => "500", "READ_ONLY" => (string) $_REQUEST["READ_ONLY"], "SERVICE_ID" => (string) $_REQUEST["SERVICE_ID"], "BUCKET" => (string) $_REQUEST["BUCKET"], "LOCATION" => (string) $_REQUEST["LOCATION"], "CNAME" => (string) $_REQUEST["CNAME"], "SETTINGS" => "");
    if (isset($_REQUEST["SETTINGS"]) && is_array($_REQUEST["SETTINGS"])) {
        $arRes["SETTINGS"] = $_REQUEST["SETTINGS"];
    }
} else {
    $arRes = null;
    if ($ID > 0) {
        $rs = CCloudStorageBucket::GetList(array("ID" => "ASC"), array("=ID" => $ID));
예제 #2
0
$oSort = new CAdminSorting($sTableID, "ID", "ASC");
$lAdmin = new CAdminList($sTableID, $oSort);
$bOnTheMove = isset($_GET["themove"]);
$upload_dir = $_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "upload");
$bHasLocalStorage = file_exists($upload_dir) && (is_dir($upload_dir) || is_link($upload_dir)) && is_writable($upload_dir);
$arID = $lAdmin->GroupAction();
$action = isset($_REQUEST["action"]) && is_string($_REQUEST["action"]) ? "{$_REQUEST['action']}" : "";
if (is_array($arID)) {
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0 || intval($ID) <= 0) {
            continue;
        }
        switch ($action) {
            case "delete":
                $ob = new CCloudStorageBucket(intval($ID));
                if (!$ob->Delete()) {
                    $e = $APPLICATION->GetException();
                    $lAdmin->AddUpdateError($e->GetString(), $ID);
                }
                break;
            case "deactivate":
                $ob = new CCloudStorageBucket(intval($ID));
                if ($ob->ACTIVE === "Y") {
                    $ob->Update(array("ACTIVE" => "N"));
                }
                break;
            case "activate":
                $ob = new CCloudStorageBucket(intval($ID));
                if ($ob->ACTIVE === "N") {
                    $ob->Update(array("ACTIVE" => "Y"));
                }