function SLAM_updateArchiveFileList(&$config, $db, $category, $identifier) { $path = SLAM_getArchivePath($config, $category, $identifier); $files = SLAM_getArchiveFiles($config, $path); if (empty($files)) { return; } /* slam together all the files for the records, separated by newlines */ $s = sql_real_escape(implode("\n", array_keys($files)), $db->link); $q = "UPDATE `{$category}` SET `Files`='{$s}' WHERE (`Identifier`='{$identifier}') LIMIT 1"; if (($result = $db->Query($q)) === false) { $config->errors[] = 'Database error: Could not update asset file list:' . $db->ErrorState(); } return; }
$path = SLAM_getArchivePath($config, $category, $identifier); $access = 0; /* get asset and set the accessibility appropriately */ if (count($result->assets[$category]) == 1) { $asset = array_shift($result->assets[$category]); $access = SLAM_getAssetAccess($user, $asset); } else { $config->errors[] = 'Invalid identifier provided.'; $access = 2; } /* is the current user qualified to make changes to the archive? */ if ($access > 0) { /* attempt to retrieve the asset's archive path*/ if (($path = SLAM_getArchivePath($config, $category, $identifier)) !== false) { /* retrieve info on the files in the archive */ if (($files = SLAM_getArchiveFiles($config, $path)) !== false) { echo "<div id='assetTitle'>{$identifier}</div>\n"; echo "<div id='fileListScrollbox'>\n"; echo "<form name='assetFileRemove' id='assetFileRemove' method='POST' action='delete.php'>\n"; echo "<input type='hidden' name='i' value='{$identifier}' />\n"; echo SLAM_makeArchiveFilesHTML($config, $db, $category, $identifier, $files, $access > 1); echo "</div>\n"; if ($access > 1) { echo "<input type='button' id='deleteButton' value='Delete' onClick=\"delete_submit('assetFileRemove')\" />\n"; } echo "</form>\n"; echo "</div>\n"; } else { echo "<div id='fileEmpty'>No files to show</div>\n"; } } else {