43 $accessAllowed = $otherHookGrantedAccess;
44 if ($table ===
'sys_file_metadata' && $accessAllowed !== 0) {
46 if ($existingFileMetadataRecord ===
null || (empty($existingFileMetadataRecord[
'file']) && !empty($fileMetadataRecord[
'file']))) {
47 $existingFileMetadataRecord = $fileMetadataRecord;
52 return $accessAllowed;
67 if ($table ===
'sys_file_metadata') {
68 if (isset($parent->cmdmap[$table]) && is_array($parent->cmdmap[$table])) {
69 foreach ($parent->cmdmap[$table] as $id => $command) {
71 throw new \UnexpectedValueException(
72 'Integer expected for data manipulation command.
73 This can only happen in the case of an attack attempt or when something went horribly wrong.
74 To not compromise security, we exit here.',
81 if (!$accessAllowed) {
88 if (isset($parent->datamap[$table]) && is_array($parent->datamap[$table])) {
89 foreach ($parent->datamap[$table] as $id => $data) {
90 $recordAccessAllowed =
false;
92 if (strpos($id,
'NEW') ===
false) {
94 if ($fileMetadataRecord !==
null) {
95 if ($parent->isImporting && empty($fileMetadataRecord[
'file'])) {
97 $recordAccessAllowed =
true;
104 $recordAccessAllowed =
true;
107 if (isset($data[
'file'])) {
108 if ($parent->isImporting && empty($data[
'file'])) {
110 $dataAccessAllowed =
true;
111 } elseif (empty($data[
'file'])) {
112 $dataAccessAllowed =
false;
117 $dataAccessAllowed =
true;
120 if (!$recordAccessAllowed || !$dataAccessAllowed) {
122 $accessAllowed =
false;
138 $table = $parameters[
'table'];
139 $uid = $parameters[
'uid'];
140 $cmd = $parameters[
'cmd'];
141 $accessAllowed = $parameters[
'hasAccess'];
143 if ($accessAllowed && $table ===
'sys_file_metadata' && $cmd ===
'edit') {
147 return $accessAllowed;
158 $accessAllowed =
false;
159 if (is_array($fileMetadataRecord) && !empty($fileMetadataRecord[
'file'])) {
160 $file = $fileMetadataRecord[
'file'];
162 if (strpos($file,
'sys_file_') !==
false) {
163 $file = substr($file, strlen(
'sys_file_'));
168 return $accessAllowed;