$userfullname == "" ? $username : $userfullname, 'href' => $baseurl_short . "pages/user/user_home.php", 'menu' => true], ['title' => $pagetitle] ]; } else { $pagetitle = $lang["manage_shares_title"]; $breadcrumbs = [ ['title' => $lang["teamcentre"], 'href' => $baseurl_short . "pages/team/team_home.php", 'menu' => true], ['title' => $pagetitle] ]; } $ajax = ('true' == getval('ajax', '') ? true : false); $delete_access_key = getval('delete_access_key', ''); $messages = array(); // Process access key deletion if ($delete_access_key != "" && enforcePostRequest($ajax)) { $deleteresource = getval('delete_resource', ''); $deletecollection = getval('delete_collection', ''); $response = array( 'success' => false ); if ($deleteresource != "" && $deleteresource != "-") { delete_resource_access_key($deleteresource, $delete_access_key); $response['success'] = true; } elseif ($deletecollection != "") { delete_collection_access_key($deletecollection, $delete_access_key); $response['success'] = true; } else { delete_collection_access_key(0, $delete_access_key); $response['success'] = true; } exit(json_encode($response)); } $sharefltr = array( "share_group" => $share_group, "share_user" => $share_user, "share_order_by" => $share_orderby, "share_sort" => $share_sort, "share_type" => $share_type, "share_collection" => $share_collection, ); if (getval("purge_expired", '') != '' && enforcePostRequest(true)) { $deleted = purge_expired_shares($sharefltr); $messages[] = str_replace("[deleted_count]", $deleted, $lang["shares_purged_message"]); } $shares = get_external_shares($sharefltr); $allsharedgroups = array("-1" => ($share_group == -1 ? $lang["action-select"] : $lang["all"])); $sharedgroups = array_unique(array_column($shares, "usergroup")); foreach ($sharedgroups as $sharedgroup) { $up_group = get_usergroup($sharedgroup); if ($up_group) { $allsharedgroups[$sharedgroup] = $up_group["name"]; } } $allsharedcols = array("0" => ($share_collection == 0 ? $lang["action-select"] : $lang["all"])); $sharedcols = array_unique(array_column($shares, "collection")); foreach ($sharedcols as $sharedcol) { $coldetails = get_collection($sharedcol); if ($coldetails) { $allsharedcols[$sharedcol] = i18n_get_translated($coldetails["name"]); } } $expiredshares = 0; $per_page = getval("per_page", $default_perpage, true); $per_page = (!in_array($per_page, array_merge($list_display_array, [99999]))) ? $default_perpage_list : $per_page; $sharecount = count($shares); $totalpages = ceil($sharecount / $per_page); $offset = getval("offset", 0, true); if ($offset > $sharecount) { $offset = 0; } $curpage = floor($offset / $per_page) + 1; $curparams = array( "share_user" => $share_user, "share_group" => $share_group, "share_orderby" => $share_orderby, "share_collection" => $share_collection, "share_sort" => $share_sort, "share_type" => $share_type, "per_page" => $per_page, "offset" => $offset, ); $url = generateURL($baseurl . "/pages/manage_external_shares.php", $curparams); $tabledata = array( "class" => "ShareTable", "headers" => array( "deleteshare" => array("name" => $lang["action-delete"],"html" => true,"sortable" => false), "collection" => array("name" => $lang["collectionid"],"html" => true,"sortable" => true), "resource" => array("name" => $lang["columnheader-resource_id"],"sortable" => true), "sharedas" => array("name" => $lang["share_usergroup"],"sortable" => true), "email" => array("name" => $lang["email"],"sortable" => true), "fullname" => array("name" => $lang["user_created_by"],"sortable" => true), "expires" => array("name" => $lang["expires"],"sortable" => true), "date" => array("name" => $lang["created"],"sortable" => true), "lastused" => array("name" => $lang["lastused"],"sortable" => true), "access_key" => array("name" => $lang["accesskey"],"html" => true,"sortable" => true), "upload" => array("name" => $lang["share_type"],"sortable" => true), "tools" => array("name" => $lang["tools"],"sortable" => false) ), "orderbyname" => "share_orderby", "orderby" => $share_orderby, "sortname" => "share_sort", "sort" => $share_sort, "defaulturl" => $baseurl . "/pages/manage_external_shares.php", "params" => $curparams, "pager" => array("current" => $curpage,"total" => $totalpages, "per_page" => $per_page, "break" => false), "data" => array() ); if (!checkperm('a')) { unset($tabledata["headers"]["fullname"]); } $alert_icon_offset = false; for ($n = 0; $n < $sharecount; $n++) { if ($n >= $offset && ($n < $offset + $per_page)) { $colshare = is_int_loose($shares[$n]["collection"]) && $shares[$n]["collection"] > 0; $tableshare = array(); $tableshare["rowid"] = "access_key_" . $shares[$n]["access_key"]; if (checkperm('a') || $shares[$n]["user"] == $userref) { // User is admin or this is the user's own share; allow deletion $tableshare["deleteshare"] = ''; } else { $tableshare["deleteshare"] = ''; // Deletion not permitted } $tableshare["collection"] = "" . $shares[$n]["collection"] . ""; if (checkperm('a')) { // Only required if user can see shares for different users $tableshare["fullname"] = $shares[$n]["fullname"]; } $tableshare["sharedas"] = i18n_get_translated($shares[$n]["sharedas"]); $tableshare["resource"] = $shares[$n]["resource"]; $tableshare["email"] = $shares[$n]["email"]; $tableshare["expires"] = $shares[$n]["expires"] ? nicedate($shares[$n]["expires"]) : $lang["never"]; $tableshare["lastused"] = $shares[$n]["lastused"]; $keylink = $baseurl . "/?"; $keylink .= $colshare ? "c=" . (int)$shares[$n]["collection"] : ((int)$shares[$n]["resource"] > 0 ? "r=" . (int)$shares[$n]["resource"] : ""); $keylink .= "&k=" . $shares[$n]["access_key"]; $tableshare["access_key"] = "" . $shares[$n]["access_key"] . ""; $tableshare["date"] = nicedate($shares[$n]["date"], true, true, true); if ($shares[$n]["expires"] != "" && $shares[$n]["expires"] < date("Y-m-d H:i:s", time())) { $expiredshares++; $tableshare["alerticon"] = "fas fa-exclamation-triangle"; $tableshare["alerticontitle"] = $lang["share_expired_icon_title"]; $alert_icon_offset = true; } $tableshare["upload"] = (bool)$shares[$n]["upload"] ? $lang["share_type_upload"] : $lang["share_type_view"]; $tableshare["tools"] = array(); if (!$colshare || collection_writeable($shares[$n]["collection"])) { $tableshare["tools"][] = array( "icon" => "fa fa-trash", "text" => $lang["action-delete"], "url" => "#", "modal" => false, "onclick" => "delete_access_key(\"" . $shares[$n]["access_key"] . "\",\"" . $shares[$n]["resource"] . "\",\"" . $shares[$n]["collection"] . "\");return false;" ); } if (checkperm('a') || $shares[$n]["user"] == $userref) { if ((bool)$shares[$n]["upload"]) { // Edit an upload share $editlink = generateURL( $baseurl . "/pages/share_upload.php", array( "share_collection" => $shares[$n]["collection"], "uploadkey" => $shares[$n]["access_key"], ) ); } elseif ($colshare) { $editlink = generateURL( $baseurl . "/pages/collection_share.php", array( "ref" => $shares[$n]["collection"], "editaccess" => $shares[$n]["access_key"], "editaccesslevel" => $shares[$n]["access"], "editexpiration" => $shares[$n]["expires"], "editgroup" => $shares[$n]["usergroup"], "password" => $shares[$n]["password_hash"] != "" ? "true" : "", ) ); } else { // Edit a resource share $editlink = generateURL( $baseurl . "/pages/resource_share.php", array( "ref" => $shares[$n]["resource"], "editaccess" => $shares[$n]["access_key"], "editaccesslevel" => $shares[$n]["access"], "editexpiration" => $shares[$n]["expires"], "usergroup" => $shares[$n]["usergroup"], "password" => $shares[$n]["password_hash"] != "" ? "true" : "", ) ); } $tableshare["tools"][] = array( "icon" => "fas fa-edit", "text" => $lang["action-edit"], "url" => $editlink, "modal" => false, "onclick" => "return CentralSpaceLoad(\"" . $editlink . "\");" ); } $tabledata["data"][] = $tableshare; } } include '../include/header.php'; ?>

0) { echo "
" . implode("
", $messages) . "
"; } $introtext = text("introtext"); if ($introtext != "") { echo "

" . text("introtext") . "

"; } if (checkperm('a') && $expiredshares > 0) { echo "

" . LINK_CARET . escape($lang["share_purge_text"]) . "

"; } ?>
($share_type == -1 ? $lang["action-select"] : $lang["all"]), "0" => $lang["share_type_view"], "1" => $lang["share_type_upload"], ); render_dropdown_question($lang["share_type"], "share_type", $sharetypes, $share_type, " class=\"stdwidth\""); if (checkperm('a')) { ?>