5include_once(
"./Services/Object/classes/class.ilObjectAccess.php");
 
    6require_once(
'./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
 
   25    protected function checkAccessToObjectId($obj_id)
 
   28        $ilAccess = 
$DIC[
'ilAccess'];
 
   33            if ($ilAccess->checkAccess(
'read', 
'', $ref_id)) {
 
   51                $re = 
'/\/previews\/[\d\/]{0,}\/preview_([\d]{0,})\//uU';
 
   54        preg_match($re, $ilWACPath->
getPath(), $matches);
 
   56        return $this->checkAccessToObjectId($matches[1]);
 
   93            "permission" => 
"read",
 
   95            "lang_var" => 
"download",
 
   99            "permission" => 
"write",
 
  101            "lang_var" => 
"versions",
 
  104            "permission" => 
"write",
 
  106            "lang_var" => 
"settings",
 
  119        $ilAccess = 
$DIC[
'ilAccess'];
 
  121        $t_arr = explode(
"_", $a_target);
 
  124        if (isset($t_arr[2]) && $t_arr[2] == 
"wsp") {
 
  125            include_once 
"Services/PersonalWorkspace/classes/class.ilSharedResourceGUI.php";
 
  130        if ($t_arr[0] != 
"file" || ((
int) $t_arr[1]) <= 0) {
 
  134        if ($ilAccess->checkAccess(
"visible", 
"", $t_arr[1])
 
  135            || $ilAccess->checkAccess(
"read", 
"", $t_arr[1])
 
  153        $q = 
"SELECT * FROM file_data WHERE file_id = " . 
$ilDB->quote($a_id, 
'integer');
 
  154        $r = 
$ilDB->query($q);
 
  169        $q = 
"SELECT version FROM file_data WHERE file_id = " . 
$ilDB->quote($a_id, 
'integer');
 
  170        $r = 
$ilDB->query($q);
 
  175        return $striped > 0 ? $striped : 1;
 
  188        $q = 
"SELECT file_size FROM file_data WHERE file_id = " . 
$ilDB->quote($a_id, 
'integer');
 
  189        $r = 
$ilDB->query($q);
 
  192        $size = $row->file_size;
 
  209        $q = 
"SELECT * FROM file_data WHERE file_id = " . 
$ilDB->quote($a_id, 
'integer');
 
  210        $r = 
$ilDB->query($q);
 
  213        require_once(
'Modules/File/classes/class.ilFSStorageFile.php');
 
  215        $file = $fss->getAbsolutePath() . 
'/' . $row->file_name;
 
  217        if (@!is_file($file)) {
 
  219            $file = $fss->getAbsolutePath() . 
'/' . $version_subdir . 
'/' . $row->file_name;
 
  222        if (is_file($file)) {
 
  223            $size = filesize($file);
 
  237        include_once(
'Modules/File/classes/class.ilFSStorageFile.php');
 
  243        $q = 
"SELECT * FROM object_data WHERE obj_id = " . 
$ilDB->quote($a_id, 
'integer');
 
  244        $r = 
$ilDB->query($q);
 
  246        require_once 
'Modules/File/classes/class.ilObjFile.php';
 
  261        include_once(
'Modules/File/classes/class.ilFSStorageFile.php');
 
  263        $dir = $fileStorage->getAbsolutePath();
 
  276        if (self::$_inlineFileExtensionsArray
 
  279            require_once 
'Services/Administration/classes/class.ilSetting.php';
 
  280            $settings = 
new ilSetting(
'file_access');
 
  281            self::$_inlineFileExtensionsArray = preg_split(
'/ /', $settings->get(
'inline_file_extensions'), -1, PREG_SPLIT_NO_EMPTY);
 
  285        return in_array($extension, self::$_inlineFileExtensionsArray);
 
  303        if (preg_match(
'/\.([a-z0-9]+)\z/i', $a_file_name, $matches) == 1) {
 
  304            return strtolower($matches[1]);
 
  322        return substr($a_file_name, 0, 1) == 
'.' || substr($a_file_name, -1, 1) == 
'~' 
  323            || substr($a_file_name, 0, 2) == 
'~$' 
  324            || $a_file_name == 
'Thumbs.db';
 
  361        $filenameWithoutExtension = $a_file_name;
 
  364        if ($a_handle_extension) {
 
  367            if (strlen($extension) > 0) {
 
  368                $extension = 
'.' . $extension;
 
  369                $filenameWithoutExtension = substr($a_file_name, 0, -strlen($extension));
 
  377        $nthCopyRegex = preg_replace(
'/([\^$.\[\]|()?*+{}])/', 
'\\\\${1}', 
' ' 
  378            . 
$lng->txt(
'copy_n_of_suffix'));
 
  379        $nthCopyRegex = 
'/' . preg_replace(
'/%1\\\\\$s/', 
'([0-9]+)', $nthCopyRegex) . 
'$/';
 
  383        if (preg_match($nthCopyRegex, $filenameWithoutExtension, $matches)) {
 
  385            $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen($matches[0]));
 
  386            if ($nth_copy == 
null) {
 
  387                $nth_copy = $matches[1] + 1;
 
  390            if (substr($filenameWithoutExtension, -strlen(
' ' . 
$lng->txt(
'copy_of_suffix')))
 
  391                == 
' ' . 
$lng->txt(
'copy_of_suffix')
 
  394                $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen(
' ' 
  395                    . 
$lng->txt(
'copy_of_suffix')));
 
  396                if ($nth_copy == 
null) {
 
  401                $filenameWithoutCopy = $filenameWithoutExtension;
 
  402                if ($nth_copy == 
null) {
 
  411            $newFilename = $filenameWithoutCopy . sprintf(
' ' 
  412                    . 
$lng->txt(
'copy_n_of_suffix'), $nth_copy)
 
  416            $newFilename = $filenameWithoutCopy . 
' ' . 
$lng->txt(
'copy_of_suffix') . $extension;
 
  444        self::$preload_list_gui_data = array();
 
  446        $set = 
$DIC->database()->query(
"SELECT obj_id,max(hdate) latest" . 
" FROM history" 
  447            . 
" WHERE obj_type = " . 
$DIC->database()->quote(
"file", 
"text") . 
" AND " 
  448            . 
$DIC->database()->in(
"obj_id", $a_obj_ids, 
"", 
"integer") . 
" GROUP BY obj_id");
 
  449        while ($row = 
$DIC->database()->fetchAssoc($set)) {
 
  450            self::$preload_list_gui_data[$row[
"obj_id"]][
"date"] = $row[
"latest"];
 
  453        $set = 
$DIC->database()->query(
"SELECT file_size, version, file_id, page_count" . 
" FROM file_data" . 
" WHERE " 
  454            . 
$DIC->database()->in(
"file_id", $a_obj_ids, 
"", 
"integer"));
 
  455        while ($row = 
$DIC->database()->fetchAssoc($set)) {
 
  456            self::$preload_list_gui_data[$row[
"file_id"]][
"size"] = $row[
"file_size"];
 
  457            self::$preload_list_gui_data[$row[
"file_id"]][
"version"] = $row[
"version"];
 
  458            self::$preload_list_gui_data[$row[
"file_id"]][
"page_count"] = $row[
"page_count"];
 
  470        if (isset(self::$preload_list_gui_data[$a_obj_id])) {
 
  471            return self::$preload_list_gui_data[$a_obj_id];
 
An exception for terminatinating execution or to throw for unit testing.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
Access class for file objects.
static _lookupFileSize($a_id)
Quickly looks up the file size from the database and returns the number of bytes.
static _checkGoto($a_target)
check whether goto script will succeed
static _lookupFileSizeFromFilesystem($a_id)
Looks up the file size by retrieving it from the filesystem.
static _getCommands()
get commands
static _lookupVersion($a_id)
lookup version
static _getFileExtension($a_file_name)
Gets the file extension of the specified file name.
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
canBeDelivered(ilWACPath $ilWACPath)
static _isFileInline($a_file_name)
Returns true, if the specified file shall be displayed inline in the browser.
static _lookupFileData($a_id)
looks up the file_data for the file object with the specified object id as an associative array.
static _getPermanentDownloadLink($ref_id)
Gets the permanent download link for the file.
static $preload_list_gui_data
static _preloadData($a_obj_ids, $a_ref_ids)
static getListGUIData($a_obj_id)
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 $_inlineFileExtensionsArray
Contains an array of extensions separated by space.
static _lookupSuffix($a_id)
lookup suffix
static _lookupDiskUsage($a_id)
Returns the number of bytes used on the harddisk by the file object with the specified object id.
static _getAllReferences($a_id)
get all reference ids of object
static hasAccess($a_node_id, $a_is_portfolio=false)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static dirsize($directory)
get size of a directory or a file.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilWACCheckingClass.