1)))) { error_alert($lang["cannotshareemptythemecategory"], true, 403); exit(); } // Further checks at collection-resource level. Recurse through category's sub FCs if ($subthemes) { $sub_fcs = get_featured_collection_categ_sub_fcs($collection); } else { $sub_fcs = get_featured_collections($collection["ref"], array()); $sub_fcs = array_filter($sub_fcs, function ($fc) { return !is_featured_collection_category($fc); }); $sub_fcs = array_values(array_column($sub_fcs, "ref")); } $collection["sub_fcs"] = $sub_fcs; $collectionstates = false; $sub_fcs_resources_states = array(); $sub_fcs_resources_minaccess = array(); foreach ($collection["sub_fcs"] as $sub_fc) { // Check all featured collections contain only active resources $collectionstates = is_collection_approved($sub_fc); if (!$collection_allow_not_approved_share && $collectionstates === false) { break; } elseif (is_array($collectionstates)) { $sub_fcs_resources_states = array_unique(array_merge($sub_fcs_resources_states, $collectionstates)); } // Check minimum access is restricted or lower and sharing of restricted resources is not allowed $sub_fcs_resources_minaccess[] = collection_min_access($sub_fc); } $collectionstates = (!empty($sub_fcs_resources_states) ? $sub_fcs_resources_states : $collectionstates); if (!empty($sub_fcs_resources_minaccess)) { $minaccess = max(array_unique($sub_fcs_resources_minaccess)); } } $collectionstates = (isset($collectionstates) ? $collectionstates : is_collection_approved($ref)); if (!$collection_allow_not_approved_share && !$collectionstates) { $show_error = true; $error = $lang["notapprovedsharecollection"]; } # Minimum access is restricted or lower and sharing of restricted resources is not allowed. The user cannot share this collection. $minaccess = (isset($minaccess) ? $minaccess : collection_min_access($ref)); if (!$restricted_share && $minaccess >= RESOURCE_ACCESS_RESTRICTED) { $show_error = true; $error = $lang["restrictedsharecollection"]; } if (isset($show_error)) { ?> 0); // Legacy way of working when sharing a FC category. It relies on a list of collections $ref = ($themeshare ? join(",", array_merge(array($collection["ref"]), $collection["sub_fcs"])) : $ref); $errors = ""; if (getval("save", "") != "" && enforcePostRequest(getval("ajax", false))) { # Email / share collection # Build a new list and insert $users = getval("users", ""); $message = getval("message", ""); $add_internal_access = (getval("grant_internal_access", "") != ""); $feedback = getval("request_feedback", ""); if ($feedback == "") { $feedback = false; } else { $feedback = true; } $list_recipients = getval("list_recipients", ""); if ($list_recipients == "") { $list_recipients = false; } else { $list_recipients = true; } $user_email = ""; $from_name = $userfullname; if (getval("ccme", false)) { $cc = $useremail; } else { $cc = ""; } enforceSharePassword($sharepwd); $errors = email_collection($ref, i18n_get_collection_name($collection), $userfullname, $users, $message, $feedback, $access, $expires, $user_email, $from_name, $cc, $themeshare, $themename, "?parent=" . $collection["ref"], $list_recipients, $add_internal_access, $group, $sharepwd); if ($errors == "") { # Log this // fix for bomb on multiple collections, daily stat object ref must be a single number. $crefs = explode(",", $ref); foreach ($crefs as $cref) { daily_stat("E-mailed collection", $cref); } if (!hook("replacecollectionemailredirect")) { redirect($baseurl_short . "pages/done.php?text=collection_email"); } } } include "../include/header.php"; ?>