41 protected function checkAccessToObjectId(
int $obj_id): bool
44 $ilAccess = $DIC[
'ilAccess'];
49 if ($ilAccess->checkAccess(
'read',
'', $ref_id)) {
61 preg_match(
'/\/previews\/[\d\/]{0,}\/preview_([\d]{0,})\//uU', $ilWACPath->
getPath(), $matches);
62 $obj_id = (
int) $matches[1];
69 return $this->checkAccessToObjectId($obj_id);
89 "permission" =>
"read",
91 "lang_var" =>
"download",
95 "permission" =>
"write",
97 "lang_var" =>
"unzip",
100 "permission" =>
"write",
102 "lang_var" =>
"versions",
105 "permission" =>
"write",
107 "lang_var" =>
"settings",
119 $access = $DIC[
'ilAccess'];
121 $target_parts = explode(
"_", $a_target);
124 if (isset($target_parts[2]) && $target_parts[2] ===
"wsp") {
128 $type = $target_parts[0]??null;
133 return $access->checkAccess(
"visible",
"",
$ref_id)
134 || $access->checkAccess(
"read",
"",
$ref_id);
146 $info = $info_repo->getByRefId($a_id);
148 $info = $info_repo->getByObjectId($a_id);
151 return (
int) $info->getFileSize()->inBytes();
167 if (preg_match(
'/\.([a-z0-9]+)\z/i', $a_file_name, $matches) == 1) {
168 return strtolower($matches[1]);
184 return substr($a_file_name, 0, 1) ==
'.' || substr($a_file_name, -1, 1) ==
'~' 185 || substr($a_file_name, 0, 2) ==
'~$' 186 || $a_file_name ==
'Thumbs.db';
214 $filenameWithoutExtension = $a_file_name;
217 if ($a_handle_extension) {
220 if (strlen($extension) > 0) {
221 $extension =
'.' . $extension;
222 $filenameWithoutExtension = substr($a_file_name, 0, -strlen($extension));
230 $nthCopyRegex = preg_replace(
'/([\^$.\[\]|()?*+{}])/',
'\\\\${1}',
' ' 231 .
$lng->txt(
'copy_n_of_suffix'));
232 $nthCopyRegex =
'/' . preg_replace(
'/%1\\\\\$s/',
'([0-9]+)', $nthCopyRegex) .
'$/';
236 if (preg_match($nthCopyRegex, $filenameWithoutExtension, $matches)) {
238 $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen($matches[0]));
239 if ($nth_copy == null) {
240 $nth_copy = $matches[1] + 1;
243 if (substr($filenameWithoutExtension, -strlen(
' ' .
$lng->txt(
'copy_of_suffix')))
244 ==
' ' .
$lng->txt(
'copy_of_suffix')
247 $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen(
' ' 248 .
$lng->txt(
'copy_of_suffix')));
249 if ($nth_copy == null) {
254 $filenameWithoutCopy = $filenameWithoutExtension;
255 if ($nth_copy == null) {
264 $newFilename = $filenameWithoutCopy . sprintf(
' ' 265 .
$lng->txt(
'copy_n_of_suffix'), $nth_copy)
269 $newFilename = $filenameWithoutCopy .
' ' .
$lng->txt(
'copy_of_suffix') . $extension;
287 public static function _preloadData(array $obj_ids, array $ref_ids): void
290 $info->preloadData($obj_ids);
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null, $a_handle_extension=false)
Appends the text " - Copy" to a filename in the language of the current user.
static array $preload_list_gui_data
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Access class for file objects.
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
static _getCommands()
get commands this method returns an array of all possible commands/permission combinations example: $...
static _lookupFileSize(int $a_id, bool $by_reference=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _preloadData(array $obj_ids, array $ref_ids)
const CMD_UNZIP_CURRENT_REVISION
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
static hasAccess(int $a_node_id, bool $a_is_portfolio=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array $inline_file_extensions
Contains an array of extensions separated by space.
static _getPermanentDownloadLink(int $ref_id)
Gets the permanent download link for the file.
static _getFileExtension(string $a_file_name)
Gets the file extension of the specified file name.
canBeDelivered(ilWACPath $ilWACPath)
static _checkGoto(string $a_target)
check whether goto script will succeed