/** * @param array[string]string $arFields * @param int $ID * @return bool */ public static function CheckFields(&$arFields, $ID) { global $APPLICATION; $aMsg = array(); if (array_key_exists("ACTIVE", $arFields)) { $arFields["ACTIVE"] = $arFields["ACTIVE"] === "N" ? "N" : "Y"; } if (array_key_exists("READ_ONLY", $arFields)) { $arFields["READ_ONLY"] = $arFields["READ_ONLY"] === "Y" ? "Y" : "N"; } $arServices = CCloudStorage::GetServiceList(); if (isset($arFields["SERVICE_ID"])) { if (!array_key_exists($arFields["SERVICE_ID"], $arServices)) { $aMsg[] = array("id" => "SERVICE_ID", "text" => GetMessage("CLO_STORAGE_WRONG_SERVICE")); } } if (isset($arFields["BUCKET"])) { $arFields["BUCKET"] = trim($arFields["BUCKET"]); $bBadLength = false; if (strpos($arFields["BUCKET"], ".") !== false) { $arName = explode(".", $arFields["BUCKET"]); $bBadLength = false; foreach ($arName as $str) { if (strlen($str) < 2 || strlen($str) > 63) { $bBadLength = true; } } } if (strlen($arFields["BUCKET"]) <= 0) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_EMPTY_BUCKET")); } if (preg_match("/[^a-z0-9-.]/", $arFields["BUCKET"]) > 0) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_BAD_BUCKET_NAME")); } if (strlen($arFields["BUCKET"]) < 2 || strlen($arFields["BUCKET"]) > 63) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_WRONG_BUCKET_NAME_LENGTH")); } if ($bBadLength) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_WRONG_BUCKET_NAME_LENGTH2")); } if (!preg_match("/^[a-z0-9].*[a-z0-9]\$/", $arFields["BUCKET"])) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_BAD_BUCKET_NAME2")); } if (preg_match("/(-\\.|\\.-)/", $arFields["BUCKET"]) > 0) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_BAD_BUCKET_NAME3")); } if (strlen($arFields["BUCKET"]) > 0) { $rsBucket = self::GetList(array(), array("=SERVICE_ID" => $arFields["SERVICE_ID"], "=BUCKET" => $arFields["BUCKET"])); $arBucket = $rsBucket->Fetch(); if (is_array($arBucket) && $arBucket["ID"] != $ID) { $aMsg[] = array("id" => "BUCKET", "text" => GetMessage("CLO_STORAGE_BUCKET_ALREADY_EXISTS")); } } } if (!empty($aMsg)) { $e = new CAdminException($aMsg); $APPLICATION->ThrowException($e); return false; } return true; }
} ?> ><?php echo htmlspecialcharsex($obService->GetName()); ?> </option><?php if ($arRes["SERVICE_ID"] === $SERVICE_ID) { $bServiceSet = true; } } ?> </select> </td> </tr> <?php foreach (CCloudStorage::GetServiceList() as $SERVICE_ID => $obService) { ?> <tr id="LOCATION_<?php echo htmlspecialcharsbx($SERVICE_ID); ?> " style="display:<?php echo $arRes["SERVICE_ID"] === $SERVICE_ID || !$bServiceSet ? "" : "none"; ?> " class="location-tr"> <td><?php echo GetMessage("CLO_STORAGE_EDIT_LOCATION"); ?> :</td> <td> <select name="LOCATION[<?php echo htmlspecialcharsbx($SERVICE_ID);