0 && $resourcedata["lock_user"] != $userref) { $error = get_resource_lock_message($resourcedata["lock_user"]); http_response_code(403); exit($error); } # Load the configuration for the selected resource type. Allows for alternative notification addresses, etc. resource_type_config_override($resourcedata["resource_type"]); # Not allowed to edit this resource? if ((!get_edit_access($resource, $resourcedata["archive"], $resourcedata) || checkperm('A')) && $resource > 0) { exit("Permission denied."); } # Fetch alternative file data $file = get_alternative_file($resource, $ref); if ($file === false) { exit("Alternative file not found."); } # Tweak images if (getval("tweak", "") != "" && enforcePostRequest(false)) { $tweak = getval("tweak", ""); switch ($tweak) { case "rotateclock": $wait = tweak_preview_images($resource, 270, 0, "jpg", $ref); break; case "rotateanti": $wait = tweak_preview_images($resource, 90, 0, "jpg", $ref); break; case "restore": if ($enable_thumbnail_creation_on_upload) { $wait = create_previews($resource, false, "jpg", false, false, $ref); } break; } } $url_params = [ "ref" => $resource, "search" => $search, "offset" => $offset, "order_by" => $order_by, "sort" => $sort, "archive" => $archive, ]; if ($modal) { $url_params["modal"] = "true"; if ($context == "Modal") { $url_params["context"] = $context; } } $altname = getval("name", ""); if ( $altname !== "" && getval("tweak", "") == "" && enforcePostRequest(false) ) { // Do not do this during a tweak operation! $alt_data = [ "name" => (string) $altname, "description" => (string) getval("description", ""), "alt_type" => (string) getval("alt_type", ""), ]; save_alternative_file($resource, $ref, $alt_data); // Check to see if we need to notify users of this change if ($notify_on_resource_change_days != 0) { notify_resource_change($resource); } if (getval("tweak", "") != '') { $url_params["ref"] = $ref; $url_params = array_merge(["resource" => $resource], $url_params); redirect(generateURL( "{$baseurl_short}pages/alternative_file.php", $url_params )); } else { redirect(generateURL("{$baseurl_short}pages/alternative_files.php", $url_params)); } } include "../include/header.php"; $backtoalternativefilesurl = generateURL("{$baseurl_short}pages/alternative_files.php", $url_params); $backtoalternativefileurl = generateURL("{$baseurl_short}pages/alternative_file.php", $url_params); ?>