0){$ref=0-$userref;} // Saves manual link creation having to work out user template ref
$use=$ref;
debug(sprintf('$use = %s', $use));
# Fetch search details (for next/back browsing and forwarding of search params)
$search=getval("search","");
$order_by=getval("order_by","relevance");
$offset=getval("offset",0,true);
$restypes=getval("restypes","");
// Do the same as search.php - ignore except for properties search
if (strpos($search,"!")!==false && substr($search,0,11)!="!properties" && !$special_search_honors_restypes) {$restypes="";}
$default_sort_direction="DESC";
if (substr($order_by,0,5)=="field"){$default_sort_direction="ASC";}
$sort=getval("sort",$default_sort_direction);
$modal = (getval("modal", "") == "true");
$single=getval("single","") != "" || getval("forcesingle","") != "";
$disablenavlinks=getval("disablenav","")=="true";
$uploader = getval("uploader","");
$collection = getval('collection', 0, true);
$resetform = (getval("resetform", false) !== false);
$ajax = filter_var(getval("ajax", false), FILTER_VALIDATE_BOOLEAN);
$archive=getval("archive", false); // This is the archive state for searching, NOT the archive state to be set from the form POST which we get later
if($archive !== false)
{
$search_all_workflow_states = false;
}
else
{
$archive = 0;
}
$search_access = getval("search_access", null, true);
$submitted = getval("submitted", "");
$external_upload = upload_share_active();
$redirecturl = getval("redirecturl","");
if ((!url_starts_with($baseurl, $redirecturl) && !hook("modifyredirecturl")) || !is_safe_url($redirecturl)) {
$redirecturl = '';
}
if($terms_upload && $external_upload !== false && (!isset($_COOKIE["acceptedterms"]) || $_COOKIE["acceptedterms"] != true))
{
# Getting to this page without accepting terms means skipping the upload page
# This won't allow uploads without accepting terms but this is the most helpful message to display
error_alert($lang["mustaccept"],false);
exit();
}
if($camera_autorotation)
{
// If enabled and specified in URL then override the default
$autorotate = getval("autorotate","");
if($autorotate == "")
{
$autorotate = (isset($autorotation_preference) ? $autorotation_preference : $camera_autorotation_checked);
}
else
{
$autorotate = true;
}
}
else
{
$autorotate = false;
}
$collection_add = getval('collection_add', '');
if($embedded_data_user_select)
{
$no_exif=getval("exif_option","");
}
else
{
$no_exif=getval("no_exif","");
}
$upload_here = (getval('upload_here', '') != '' ? true : false);
$uploadparams = array();
$uploadparams["relateto"] = getval("relateto","");
$uploadparams["collection_add"] = $collection_add;
$uploadparams["metadatatemplate"] = getval("metadatatemplate","");
$uploadparams["no_exif"] = $no_exif;
$uploadparams["autorotate"] = $autorotate;
$uploadparams["entercolname"] = getval("entercolname","");
$uploadparams["k"] = $k;
$uploadparams["redirecturl"] = $redirecturl;
debug(sprintf('$uploadparams = %s', http_build_query($uploadparams)));
# Upload review mode will be true if we are coming from upload_batch and then editing (config $upload_then_edit)
# or if it's a special collection search where the collection is the negated user reference meaning its resources are to be edited
$upload_review_mode=(getval("upload_review_mode","")!="" || $search=="!collection-" . $userref);
$lastedited = getval('lastedited',0,true);
$locked_fields = (!$resetform && getval("lockedfields","") != "") ? trim_array(explode(",",getval("lockedfields",""))) : array();
$save_auto_next = getval("save_auto_next","") != "";
debug(sprintf('$lastedited = %s', $lastedited));
debug(sprintf('$upload_review_mode = %s', json_encode($upload_review_mode)));
debug(sprintf('$locked_fields = %s', json_encode($locked_fields)));
if ($upload_review_mode)
{
# Set the collection and ref if not already set.
if($external_upload !== false)
{
$rs_session = get_rs_session_id(true);
$ci=get_session_collections($rs_session);
if (count($ci)==0)
{
error_alert($lang["error_no_resources_edit"]);
exit();
}
else
{
$collection=$ci[0];
}
}
else
{
$collection=0-$userref;
}
# Make sure review collection is clear of any resources moved out of users archive status permissions by other users
if (!$edit_access_for_contributor)
{
collection_cleanup_inaccessible_resources($collection);
}
# Start reviewing at the first resource. Need to search all worflow states and remove filters as no data has been set yet
$search_all_workflow_states_cache = $search_all_workflow_states;
$usersearchfilter_cache = $usersearchfilter;
$search_all_workflow_states = true;
$check_edit_checksums = false;
$usersearchfilter = "";
$review_collection_contents = do_search("!collection{$collection}", '', 'resourceid');
# Revert save settings
$search_all_workflow_states = $search_all_workflow_states_cache;
$usersearchfilter = $usersearchfilter_cache;
# Set the resource to the first ref number. If the collection is empty then tagging is complete. Go to the recently added page.
if (isset($review_collection_contents[0]["ref"]))
{
$ref=$review_collection_contents[0]["ref"];
$use=$ref;
debug(sprintf('$use = %s', $use));
}
else
{
if($external_upload)
{
debug("external upload - no resources to review");
// Delete the temporary upload_collection
delete_collection($collection);
external_upload_notify($external_upload, $k, $collection);
$url = generateURL($baseurl . "/pages/done.php",array("text" => "upload_share_complete", "k"=> $k, "collection"=>$external_upload));
}
else
{
// Redirect to recent user uploads
$defaultarchivestate = get_default_archive_state();
$redirectparams = array(
"search"=>"!contributions" . $userref,
"order_by"=>"resourceid",
"sort"=>"DESC",
"archive"=>$defaultarchivestate,
"refreshcollectionframe"=>"true",
"resetlockedfields"=>"true",
"collection_add"=>$collection_add
);
if ($defaultarchivestate == -2 && checkperm("e-1"))
{
$redirectparams["promptsubmit"] = 'true';
}
$url = $redirecturl != "" ? $redirecturl : generateURL($baseurl . "/pages/search.php",$redirectparams);
}
redirect($url);
exit();
}
}
// Reset form (step 1 in upload) should clear all form data, including user template. The desired intention of the user is to clear it and
// have no old metadata values.
if($resetform && $ref < 0 && !$upload_review_mode)
{
clear_resource_data($ref);
}
// Ability to avoid editing conflicts by checking checksums.
// NOTE: this should NOT apply to upload.
$check_edit_checksums = true;
if($ref < 0 || $upload_review_mode)
{
$check_edit_checksums = false;
}
global $merge_filename_with_title, $merge_filename_with_title_default;
if($merge_filename_with_title && $ref < 0)
{
$merge_filename_with_title_option = getval('merge_filename_with_title_option', $merge_filename_with_title_default);
$merge_filename_with_title_include_extensions = getval('merge_filename_with_title_include_extensions', '');
$merge_filename_with_title_spacer = getval('merge_filename_with_title_spacer', '');
if(strtolower($merge_filename_with_title_option) != '')
{
$uploadparams["merge_filename_with_title_option"] = $merge_filename_with_title_option;
}
if($merge_filename_with_title_include_extensions != '')
{
$uploadparams["merge_filename_with_title_include_extensions"] = $merge_filename_with_title_include_extensions;
}
if($merge_filename_with_title_spacer != '')
{
$uploadparams["merge_filename_with_title_spacer"] = $merge_filename_with_title_spacer;
}
}
global $tabs_on_edit;
$collapsible_sections=true;
if($tabs_on_edit || $upload_review_mode){$collapsible_sections=false;}
$errors=array(); # The results of the save operation (e.g. required field messages)
# Disable auto save for upload forms - it's not appropriate.
if ($ref<0 || $upload_review_mode) { $edit_autosave=false; }
# next / previous resource browsing
$go=getval("go","");
if ($go!="")
{
# Re-run the search and locate the next and previous records.
$modified_result_set=hook("modifypagingresult");
if ($modified_result_set)
{
$result=$modified_result_set;
}
else
{
$result=do_search($search,$restypes,$order_by,$archive,240+$offset+1,$sort);
}
if (is_array($result))
{
# Locate this resource
$pos=-1;
$result_count = count($result);
for ($n=0;$n<$result_count;$n++)
{
if (isset($result[$n]["ref"]) && $result[$n]["ref"]==$ref) {$pos=$n;}
}
if ($pos!=-1)
{
if (($go=="previous") && ($pos>0))
{
$ref=$result[$pos-1]["ref"];
}
if (($go=="next") && ($pos<($n-1)))
{
$ref=$result[$pos+1]["ref"];
if (($pos+1)>=($offset+72))
{
$offset=$pos+1;
}
} # move to next page if we've advanced far enough
}
else
{
?>
0)
{
// Update resource data with locked resource data from last edited resource
$resource = copy_locked_data($resource, $locked_fields, $lastedited);
}
// Create metadata resource record without uploading a file e.g. template, text only resource.
$create_record_only = getval("recordonly", "") != "";
// Set initial value for noupload
$noupload = getval("noupload","") != "" || in_array($resource['resource_type'], $data_only_resource_types);
# Allow to specify resource type from url for new resources
$resource_type=getval("resource_type","");
debug(sprintf('$resource_type = %s', json_encode($resource_type)));
if ($ref<0 && !$create_record_only && $resource_type != "" && $resource_type!=$resource["resource_type"] && !checkperm("XU{$resource_type}")) // only if new resource specified and user has permission for that resource type
{
update_resource_type($ref,intval($resource_type));
$resource["resource_type"] = $resource_type;
// Change the noupload as resource type has changed from that requested originally
$noupload = in_array($resource['resource_type'], $data_only_resource_types);
}
if($noupload)
{
$single=true;
$uploadparams["single"] = "true";
}
else
{
$uploadparams["forcesingle"] = '';
$uploadparams["noupload"] = '';
}
$uploadparams["resource_type"] = $resource['resource_type'];
// Resource archive (ie user template - negative resource ID) can be default only when user actually gets to set it otherwise
// makes no sense in using it and we should let the system decide based on configuration and permissions what it should use.
$default_setarchivestate = ($show_status_and_access_on_upload || $resource['ref'] > 0 ? $resource['archive'] : '');
if ($resetform)
{
$setarchivestate = $default_setarchivestate;
}
else
{
$setarchivestate = getval('status', $default_setarchivestate, true);
}
// Validate this is permitted
// If editing own resource with $edit_access_for_contributor, always add the current archive state to display even when blocked by e permission.
if (!($edit_access_for_contributor && $userref == $resource['created_by'] && !$upload_review_mode))
{
$setarchivestate = get_default_archive_state($setarchivestate);
}
$uploadparams["status"] = $setarchivestate;
if (in_array(getval("access", RESOURCE_ACCESS_INVALID_REQUEST, true), RESOURCE_ACCESS_TYPES) && !$resetform)
{
// Preserve selected access values including custom access if form validation returns a missed required field.
$access_submitted = (int) getval("access", RESOURCE_ACCESS_CONFIDENTIAL, true);
if ($access_submitted == RESOURCE_ACCESS_CUSTOM_GROUP)
{
$submitted_access_groups = array();
$custom_access_groups = get_resource_custom_access($ref);
for ($n = 0; $n < count($custom_access_groups); $n++)
{
$access_usergroup = $custom_access_groups[$n]["ref"];
$custom_access_level = getval("custom_" . $access_usergroup, 0);
$submitted_access_groups[$access_usergroup] = (int) $custom_access_level;
}
}
}
# Allow alternative configuration settings for this resource type.
resource_type_config_override($resource["resource_type"]);
# File readonly?
$resource_file_readonly=resource_file_readonly($ref);
# If upload template, check if the user has upload permission.
if ($ref<0 && !(checkperm("c") || checkperm("d")))
{
$error=$lang['error-permissiondenied'];
error_alert($error);
exit();
}
# Check edit permission.
if (!get_edit_access($ref,$resource["archive"],$resource))
{
# The user is not allowed to edit this resource or the resource doesn't exist.
# If this edit request was submitted, then it makes sense to divert to the view page
if($submitted==="true")
{
$redirecturl = generateURL("{$baseurl}/pages/view.php",
array('ref' => $ref,
'search' => $search,
'order_by' => $order_by,
'offset' => $offset,
'restypes' => $restypes,
'archive' => $archive,
'default_sort_direction' => $default_sort_direction,
'sort' => $sort,
'k' => $k
)
);
redirect($redirecturl);
}
# This edit is a request via a link, so show the regular permission error
$error=$lang['error-permissiondenied'];
error_alert($error,!$modal);
exit();
}
if($resource["lock_user"] > 0 && $resource["lock_user"] != $userref)
{
$error = get_resource_lock_message($resource["lock_user"]);
if(getval("autosave","")!="")
{
// Send JSON with error back
http_response_code(403);
exit($error);
}
else
{
error_alert($error,!$modal);
exit();
}
}
if (getval("regen","") != "" && enforcePostRequest($ajax)) {
hook('edit_recreate_previews_extra', '', [$ref]);
$result = start_previews($ref);
set_processing_message(""); // Clear once complete
switch ($result) {
case 2:
$onload_message["text"] = $lang["recreatepreviews_pending"];
break;
case 1:
break;
case 0:
default:
$onload_message["text"] = $lang["error"];
break;
}
}
if (getval("regenexif","")!="" && enforcePostRequest($ajax)) {
extract_exif_comment($ref);
}
# Establish if this is a metadata template resource, so we can switch off certain unnecessary features
$is_template=(isset($metadata_template_resource_type) && $resource["resource_type"]==$metadata_template_resource_type);
debug(sprintf('$is_template = %s', json_encode($is_template)));
# If config option $blank_edit_template is set and form has not yet been submitted, blank the form for user edit templates.
if(0 > $ref && $blank_edit_template && '' == getval('submitted', ''))
{
clear_resource_data($ref);
}
// If using metadata templates, make sure user templates are cleared but not when form is being submitted
if(0 > $ref && '' == getval('submitted', '') && isset($metadata_template_resource_type) && !$multiple)
{
clear_resource_data($ref);
}
// Upload template: always reset to today's date (if configured).
if(0 > $ref && $reset_date_upload_template && isset($reset_date_field) && '' == getval('submitted', ''))
{
update_field($ref, $reset_date_field, $use_native_input_for_date_field ? date('Y-m-d') : date('Y-m-d H:i'));
}
# check for upload disabled due to space limitations...
if ($ref<0 && isset($disk_quota_limit_size_warning_noupload) && overquota())
{
# shut down uploading by redirecting to explanation page
$explain=$baseurl_short."pages/no_uploads.php";
redirect($explain);
}
// Check if upload should be disabled because the filestore location is indexed and browseable
if($ref < 0)
{
$cfb = check_filestore_browseability();
if(!$cfb['index_disabled'])
{
error_alert($lang['error_generic_misconfiguration'], true, 200);
exit();
}
}
$urlparams= array(
'ref' => $ref,
'search' => $search,
'order_by' => $order_by,
'offset' => $offset,
'restypes' => $restypes,
'archive' => $archive,
'default_sort_direction' => $default_sort_direction,
'sort' => $sort,
'uploader' => $uploader,
'single' => ($single ? "true" : ""),
'collection' => $collection,
"collection_add" => $collection_add,
'editsearchresults' => ($editsearch ? "true" : ""),
'k' => $k,
'redirecturl' => $redirecturl,
'search_access' => (!is_null($search_access) ? $search_access : null),
);
check_order_by_in_table_joins($order_by);
hook("editbeforeheader");
if(($embedded_data_user_select && getval("exif_option","")=="custom") || isset($embedded_data_user_select_fields))
{
$exif_override=false;
foreach($_POST as $postname=>$postvar)
{
if (strpos($postname,"exif_option_")!==false)
{
$uploadparams [$postname] = $postvar;
$exif_override=true;
}
}
if($exif_override)
{
$uploadparams["exif_override"] = "true";
}
}
# -----------------------------------
# PERFORM SAVE
# -----------------------------------
if ((getval("autosave","")!="") || (getval("tweak","")=="" && getval("submitted","")!="" && !$resetform && getval("copyfrom","")==""))
{
debug('Perform save...');
hook("editbeforesave");
if(!$multiple)
{
$save_errors = process_edit_form($ref, $resource);
if (($save_errors === true || $is_template) && getval("tweak","")=="")
{
debug('No save errors found');
if ($ref > 0 && getval("save","") != "" && enforcePostRequest($ajax))
{
if ($upload_review_mode)
{
# Drop this resource from the collection and either save all subsequent resources, or redirect thus picking the next resource.
if($external_upload)
{
remove_resource_from_collection($ref,$collection);
}
else
{
remove_resource_from_collection($ref,0-$userref);
refresh_collection_frame();
}
// If the metadata template has been locked it needs to be passed in the redirect
if(in_array("metadatatemplate",$locked_fields))
{
$urlparams['metadatatemplate'] = $metadatatemplate;
}
if($save_auto_next)
{
debug('Process all remaining resources in the collection');
$auto_next_errors_found = false;
$lastedited = $ref;
$restypearr = get_resource_types();
$resource_types = array();
// Sort into array with ids as keys
foreach($restypearr as $restype)
{
$resource_types[$restype["ref"]] = $restype;
}
$review_collection_contents_count = count($review_collection_contents);
for($n=1;$n<$review_collection_contents_count;$n++)
{
$auto_next_errors = array();
$ref = $review_collection_contents[$n]["ref"];
# Fetch resource data.
$resource=get_resource_data($ref);
// If the metadata template has been locked, copy the metadata from this first
if(in_array("metadatatemplate",$locked_fields) && $metadatatemplate > 0)
{
copyAllDataToResource($metadatatemplate, $ref,$resource);
}
// Load resource metadata
$fields=get_resource_field_data($ref,false,!hook("customgetresourceperms"),null,"",$tabs_on_edit);
$all_selected_nodes = get_resource_nodes($ref);
// Update resource data with locked resource data from last edited resource
$resource = copy_locked_data($resource, $locked_fields, $lastedited, true);
// Update $fields and all_selected_nodes with details of the last resource edited for locked fields
// NOTE: $fields and $all_selected_nodes are passed by reference
copy_locked_fields($ref,$fields,$all_selected_nodes,$locked_fields,$lastedited, true);
// Autocomplete any blank fields without overwriting any existing metadata
autocomplete_blank_fields($ref, false);
// Update related resources if required
if(in_array("related_resources",$locked_fields))
{
copyRelatedResources($lastedited, $ref);
}
// Check for any missing fields
$exemptfields =array();
foreach($fields as $field)
{
$fielderror = false;
if($field['required'] == 1
&& $field['hide_when_uploading'] != 1
&& !checkperm('F' . $field["ref"])
&& ($field["global"] == 1
|| in_array($resource["resource_type"],explode(",",$field["resource_types"])))
)
{
$displaycondition = check_display_condition(0, $field, $fields, false, $ref);
if($displaycondition)
{
if(in_array($field['type'], $FIXED_LIST_FIELD_TYPES))
{
$field_nodes = get_resource_nodes($ref, $field['ref']);
if(count($field_nodes) == 0)
{
$fielderror = true;
}
}
else
{
if (trim(strip_leading_comma($field["value"]) == ''))
{
$fielderror = true;
}
}
}
}
# Also check for regular expression match
if (
strlen(trim((string)$field["regexp_filter"])) >= 1
&& trim((string) $field["value"]) !== ""
) {
global $regexp_slash_replace;
if (preg_match("#^" . str_replace($regexp_slash_replace, '\\', $field["regexp_filter"]) . "$#", (string) $field["value"], $matches) <= 0) {
$fielderror = true;
}
}
if($fielderror)
{
$field_visibility_status=getval("field_".$field['ref']."_displayed","");
# Register an error only if the empty required field was actually displayed
if ($field_visibility_status=="block")
{
$auto_next_errors[$field['ref']] = i18n_get_translated($field['title']) . ": {$lang['requiredfield']}";
}
}
}
// If no errors, remove from collection and continue
if(count($auto_next_errors) == 0)
{
debug("edit: autosaved resource " . $ref . ", removing from collection " . (string)(0-$userref));
remove_resource_from_collection($ref,0-$userref);
}
else
{
debug("edit: autosave errors saving resource: " . $ref);
$auto_next_errors_found = true;
}
}
if($auto_next_errors_found)
{
// Errors are still outstanding which require further editing corrections
// Redirect back into upload_review_mode passing in error messages to be rendered
?>
"upload_share_complete", "k"=> $k,"collection"=>$external_upload));
}
else
{
$redirectparams = array(
"search"=>"!contributions" . $userref,
"order_by"=>"resourceid",
"sort"=>"DESC",
"archive"=>$setarchivestate,
"refreshcollectionframe"=>"true",
"resetlockedfields"=>"true",
"collection_add"=>$collection_add
);
if ($setarchivestate == -2 && checkperm("e-1"))
{
$redirectparams["promptsubmit"] = 'true';
}
$url = $redirecturl != "" ? $redirecturl : generateURL($baseurl . "/pages/search.php",$redirectparams);
}
?>
"true")));
}
}
else
{
debug('Upload template');
if (getval("save","")!="")
{
# Save button pressed? Move to next step.
if ($single) // Test if single upload (archived or not).
{
// If noupload is set - create resource without uploading stage
if (getval("noupload","") != "")
{
$ref=copy_resource(0-$userref,$resource_type,$lang["createdfromteamcentre"]);
$urlparams["ref"] = $ref;
$hidden_collection = false;
$relateto = getval("relateto","",true);
if($relateto!="" && !upload_share_active())
{
// This has been added from a related resource upload link
update_related_resource($relateto,$ref);
}
// Create new collection if necessary
if($collection_add=="new")
{
if($uploadparams["entercolname"] == "")
{
$uploadparams["entercolname"] = "Upload " . offset_user_local_timezone(date('YmdHis'), 'YmdHis');
$hidden_collection = true;
}
$collection_add = create_collection($userref,$uploadparams["entercolname"]);
}
if(is_numeric($collection_add))
{
add_resource_to_collection($ref, $collection_add,false,"",$resource_type);
set_user_collection($userref, $collection_add);
if ($hidden_collection)
{
show_hide_collection($collection_add, false, $userref);
}
}
if($redirecturl == "")
{
$redirecturl = generateURL($baseurl_short . "pages/view.php",$urlparams, ["refreshcollectionframe"=>"true"]);
}
exit(json_encode(["redirecturl"=>$redirecturl]));
}
if (!hook('redirectaftersavetemplate')) {redirect($redirecturl != "" ? $redirecturl : generateURL($baseurl_short . "pages/upload_batch.php",array_merge($urlparams,$uploadparams)) . hook("addtouploadurl"));}
}
else
{
// Default
if (!hook('redirectaftersavetemplate'))
{
redirect(generateURL($baseurl_short . "pages/upload_batch.php",array_merge($urlparams,$uploadparams)) . hook("addtouploadurl"));
}
}
}
}
}
elseif (getval("save","")!="")
{
$show_error=true;
}
# If auto-saving, no need to continue as it will only add to bandwidth usage to send the whole edit page back to the client. Send a simple 'SAVED' message instead.
if (getval("autosave","") != "" && enforcePostRequest($ajax))
{
$return=array();
if(!is_array($save_errors))
{
$return["result"] = "SAVED";
if(isset($new_checksums))
{
$return["checksums"] = array();
foreach($new_checksums as $fieldref=>$checksum)
{
$return["checksums"][$fieldref] = $checksum;
}
}
}
else
{
$return["result"] = "ERROR";
$return["errors"] = $save_errors;
}
echo json_encode($return);
exit();
}
}
else
{
debug('Save multiple resources');
// Check if any of the resources have been edited since between the form being loaded and submitted
$form_lastedit = getval("last_resource_edit",date("Y-m-d H:i:s"));
if($last_resource_edit !== false && ($form_lastedit < $last_resource_edit["time"] && getval("ignoreconflict","") == ""))
{
$cfmsg = escape(str_replace("%%USERNAME%%", $last_resource_edit["user"] , $lang["save-conflict-multiple"]));
$cfmsg .= "
" . escape($lang["action-view"]) . "";
?>
"true","search"=>"!collection" . $collection)));
}
}
}
$show_error=true;
}
}
if (getval("tweak","")!="" && !$resource_file_readonly && enforcePostRequest($ajax))
{
$tweak=getval("tweak","");
debug(sprintf('$tweak = %s', json_encode($tweak)));
switch($tweak)
{
case "rotateclock":
tweak_preview_images($ref, 270, 0, $resource["preview_extension"], -1, $resource['file_extension']);
break;
case "rotateanti":
tweak_preview_images($ref, 90, 0, $resource["preview_extension"], -1, $resource['file_extension']);
break;
case "gammaplus":
tweak_preview_images($ref, 0, 1.3, $resource["preview_extension"]);
break;
case "gammaminus":
tweak_preview_images($ref, 0, 0.7, $resource["preview_extension"]);
break;
case "restore":
$result = start_previews($ref);
switch ($result) {
case 2:
$onload_message["text"] = $lang["recreatepreviews_pending"];
break;
case 1:
break;
case 0:
default:
$onload_message["text"] = $lang["error"];
break;
}
break;
}
hook("moretweakingaction", "", array($tweak, $ref, $resource));
# Reload resource data.
$resource=get_resource_data($ref,false);
}
# If requested, refresh the collection frame (for redirects from saves)
if (getval("refreshcollectionframe","")!="")
{
refresh_collection_frame();
}
// Manually set any errors that need to be shown e.g. after saving with locked values
$showextraerrors = getval("showextraerrors","");
if ($showextraerrors != "")
{
$save_errors=json_decode($showextraerrors,true);
if(is_array($save_errors))
{
$show_error = true;
}
else
{
$save_errors = [];
}
}
include "../include/header.php";
?>