5 include_once(
"./Services/Object/classes/class.ilObjectAccess.php");
43 $commands[] = array(
"permission" =>
"read",
"cmd" =>
"sendfile",
"lang_var" =>
"download",
"default" =>
true);
44 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"edit",
"lang_var" =>
"edit_content");
45 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"versions",
"lang_var" =>
"versions");
57 $t_arr = explode(
"_", $a_target);
60 if(isset($t_arr[2]) && $t_arr[2] ==
"wsp")
62 include_once
"Services/PersonalWorkspace/classes/class.ilSharedResourceGUI.php";
66 if ($t_arr[0] !=
"file" || ((
int) $t_arr[1]) <= 0)
71 if ($ilAccess->checkAccess(
"visible",
"", $t_arr[1]))
86 $q =
"SELECT * FROM file_data WHERE file_id = ".$ilDB->quote($a_id ,
'integer');
87 $r = $ilDB->query($q);
100 $q =
"SELECT version FROM file_data WHERE file_id = ".$ilDB->quote($a_id ,
'integer');
101 $r = $ilDB->query($q);
115 $q =
"SELECT file_size FROM file_data WHERE file_id = ".$ilDB->quote($a_id ,
'integer');
116 $r = $ilDB->query($q);
134 $q =
"SELECT * FROM file_data WHERE file_id = ".$ilDB->quote($a_id ,
'integer');
135 $r = $ilDB->query($q);
138 require_once(
'Modules/File/classes/class.ilFSStorageFile.php');
140 $file = $fss->getAbsolutePath().
'/'.
$row->file_name;
142 if (@!is_file(
$file))
145 $file = $fss->getAbsolutePath().
'/'.$version_subdir.
'/'.
$row->file_name;
166 include_once(
'Modules/File/classes/class.ilFSStorageFile.php');
171 $q =
"SELECT * FROM object_data WHERE obj_id = ".$ilDB->quote($a_id ,
'integer');
172 $r = $ilDB->query($q);
174 require_once
'Modules/File/classes/class.ilObjFile.php';
186 include_once(
'Modules/File/classes/class.ilFSStorageFile.php');
188 $dir = $fileStorage->getAbsolutePath();
198 if (self::$_inlineFileExtensionsArray === null)
200 require_once
'Services/Administration/classes/class.ilSetting.php';
201 $settings =
new ilSetting(
'file_access');
202 self::$_inlineFileExtensionsArray = preg_split(
'/ /', $settings->get(
'inline_file_extensions'), -1, PREG_SPLIT_NO_EMPTY);
205 return in_array($extension, self::$_inlineFileExtensionsArray);
221 if (preg_match(
'/\.([a-z0-9]+)\z/i',$a_file_name,$matches) == 1)
223 return strtolower($matches[1]);
242 return substr($a_file_name,0,1) ==
'.' ||
243 substr($a_file_name,-1,1) ==
'~' ||
244 substr($a_file_name,0,2) ==
'~$' ||
245 $a_file_name ==
'Thumbs.db';
282 if (strlen($extension) > 0)
284 $extension =
'.'.$extension;
285 $filenameWithoutExtension= substr($a_file_name, 0, -strlen($extension));
289 $filenameWithoutExtension= $a_file_name;
296 $nthCopyRegex = preg_replace(
'/([\^$.\[\]|()?*+{}])/',
'\\\\${1}',
' '.$lng->txt(
'copy_n_of_suffix'));
297 $nthCopyRegex =
'/'.preg_replace(
'/%1\\\\\$s/',
'([0-9]+)', $nthCopyRegex).
'$/';
301 if (preg_match($nthCopyRegex, $filenameWithoutExtension, $matches))
304 $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen($matches[0]));
305 if ($nth_copy == null)
307 $nth_copy = $matches[1]+1;
310 else if (substr($filenameWithoutExtension,-strlen(
' '.$lng->txt(
'copy_of_suffix'))) ==
' '.$lng->txt(
'copy_of_suffix'))
313 $filenameWithoutCopy = substr($filenameWithoutExtension, 0, -strlen(
' '.$lng->txt(
'copy_of_suffix')));
314 if ($nth_copy == null)
322 $filenameWithoutCopy = $filenameWithoutExtension;
323 if ($nth_copy == null)
334 $newFilename = $filenameWithoutCopy.sprintf(
' '.$lng->txt(
'copy_n_of_suffix'), $nth_copy).$extension;
339 $newFilename = $filenameWithoutCopy.
' '.$lng->txt(
'copy_of_suffix').$extension;