'That document no longer exists.']); exit; } $client_id = intval($row['document_client_id']); enforceClientAccess(); $can_edit = lookupUserPermission('module_support') >= 2; $document_archived = !empty($row['document_archived_at']); $document_updated_at = $row['document_updated_at'] ?: $row['document_created_at']; $folder_tree = folderTree($client_id); $folder_id = isset($folder_tree[intval($row['document_folder_id'])]) ? intval($row['document_folder_id']) : 0; $folder_label = $folder_id ? implode(' / ', array_column(folderPath($folder_tree, $folder_id), 'folder_name')) : 'Top level'; // Its review, when it has one - its own, or its template's - not for an archived document $review = !$document_archived ? documentReviewState($row) : null; $tags = tagsForRecord('document', $document_id); // Closed to their counts, so a long list doesn't push what it says out of view $linked_html = linkGroupsHtml('document', $document_id, $client_id, $document_archived, true, $linked_total, 0); $csrf = $_SESSION['csrf_token']; $document_url = "document.php?client_id=$client_id&document_id=$document_id"; ob_start(); ?>