41 protected function checkAccessToObjectId(
int $obj_id): bool
44 $ilAccess = $DIC[
'ilAccess'];
49 if ($ilAccess->checkAccess(
'read',
'', $ref_id)) {
79 "permission" => Permissions::READ->value,
80 "cmd" => Capabilities::DOWNLOAD->value,
81 "lang_var" =>
"download",
85 "permission" => Permissions::VISIBLE->value,
86 "cmd" => Capabilities::INFO_PAGE->value,
90 "permission" => Permissions::VISIBLE->value,
91 "cmd" => Capabilities::FORCED_INFO_PAGE->value,
95 "permission" => Permissions::WRITE->value,
96 "cmd" => Capabilities::UNZIP->value,
97 "lang_var" =>
"unzip",
100 "permission" => Permissions::EDIT_CONTENT->value,
101 "cmd" => Capabilities::EDIT_EXTERNAL->value,
102 "lang_var" =>
"open_external_editor",
105 "permission" => Permissions::VIEW_CONTENT->value,
106 "cmd" => Capabilities::VIEW_EXTERNAL->value,
107 "lang_var" =>
"open_external_viewer",
110 "permission" => Permissions::WRITE->value,
111 "cmd" => Capabilities::MANAGE_VERSIONS->value,
112 "lang_var" =>
"versions",
115 "permission" => Permissions::WRITE->value,
116 "cmd" => Capabilities::EDIT_SETTINGS->value,
117 "lang_var" =>
"settings" 130 $ilUser = $DIC[
'ilUser'];
132 $rbacsystem = $DIC[
'rbacsystem'];
133 $ilAccess = $DIC[
'ilAccess'];
140 if (!self::_lookupOnline($obj_id)
141 && !$rbacsystem->checkAccessOfUser(
$user_id,
'write', $ref_id)
149 case Capabilities::INFO_PAGE->value:
150 if (!self::_lookupOnline($obj_id)) {
157 switch ($permission) {
160 if (!self::_lookupOnline($obj_id)
161 && (!$rbacsystem->checkAccessOfUser(
$user_id,
'write', $ref_id))
180 $ilAccess = $DIC[
'ilAccess'];
182 $t_arr = explode(
"_", $a_target);
185 if (isset($t_arr[2]) && $t_arr[2] ===
"wsp") {
188 if ($t_arr[0] !==
"file") {
191 if (((
int) $t_arr[1]) <= 0) {
194 if ($ilAccess->checkAccess(
"visible",
"", $t_arr[1])) {
197 return (
bool) $ilAccess->checkAccess(
"read",
"", $t_arr[1]);
204 $result = $DIC->database()->fetchAssoc(
205 $DIC->database()->queryF(
206 "SELECT on_click_mode FROM file_data WHERE file_id = %s;",
212 if (empty($result)) {
226 $info = $by_reference ? $info_repo->getByRefId($a_id) : $info_repo->getByObjectId($a_id);
228 return (
int)
$info->getFileSize()->inBytes();
243 if (preg_match(
'/\.([a-z0-9]+)\z/i', $a_file_name, $matches) == 1) {
244 return strtolower($matches[1]);
259 return str_starts_with($a_file_name,
'.') || str_ends_with($a_file_name,
'~')
260 || str_starts_with($a_file_name,
'~$')
261 || $a_file_name ===
'Thumbs.db';
289 $filenameWithoutExtension = $a_file_name;
297 $nthCopyRegex = preg_replace(
298 '/([\^$.\[\]|()?*+{}])/',
301 .
$lng->txt(
'copy_n_of_suffix')
303 $nthCopyRegex =
'/' . preg_replace(
'/%1\\\\\$s/',
'(\d+)', (
string) $nthCopyRegex) .
'$/';
307 if (preg_match($nthCopyRegex, (
string) $filenameWithoutExtension, $matches)) {
309 $filenameWithoutCopy = substr((
string) $filenameWithoutExtension, 0, -strlen($matches[0]));
310 if ($nth_copy ==
null) {
311 $nth_copy = $matches[1] + 1;
313 } elseif (str_ends_with((
string) $filenameWithoutExtension,
' ' .
$lng->txt(
'copy_of_suffix'))) {
315 $filenameWithoutCopy = substr(
316 (
string) $filenameWithoutExtension,
320 .
$lng->txt(
'copy_of_suffix')
323 if ($nth_copy ==
null) {
328 $filenameWithoutCopy = $filenameWithoutExtension;
329 if ($nth_copy ==
null) {
337 return $filenameWithoutCopy . sprintf(
339 .
$lng->txt(
'copy_n_of_suffix'),
346 return $filenameWithoutCopy .
' ' .
$lng->txt(
'copy_of_suffix') . $extension;
361 public static function _preloadData(array $obj_ids, array $ref_ids): void
364 $info->preloadData($obj_ids);
370 return LocalDIC::dic()[
'properties.aggregator']->getFor($a_obj_id,
'file')->getPropertyIsOnline()->getIsOnline();
const IL_NO_OBJECT_ACCESS
static array $preload_list_gui_data
static _getAllReferences(int $id)
get all reference ids for object ID
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)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcc...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null)
Appends the text " - Copy" to a filename in the language of the current user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const CLICK_MODE_DOWNLOAD
static _preloadData(array $obj_ids, array $ref_ids)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static hasAccess(int $a_node_id, bool $a_is_portfolio=false)
static _shouldDownloadDirectly(int $obj_id)
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 _lookupOnline(int $a_obj_id)
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