35 include_once 
'Services/Utilities/classes/class.ilFileUtilsException.php';
 
   56                 include_once(
"Services/Utilities/classes/class.ilUtil.php");
 
   58                 $pathinfo = pathinfo($a_file);
 
   59                 $file = $pathinfo[
"basename"];
 
   64                 move_uploaded_file($a_file, $a_directory . 
"/" . 
$file);
 
   66                 unlink ($a_directory . 
"/" . $file);
 
   73                 if (empty($filearray)) {
 
   79                 foreach ($filearray[
"file"] as $key => $value)
 
   85                                 unlink($filearray[path][$key]);
 
  103                         foreach (array_count_values($filearray[
"file"]) as $key => $value)
 
  112                         if (isset($doublettes))
 
  114                                 throw new ilFileUtilsException($lng->txt(
"exc_upload_error") . 
"<br />" . $lng->txt(
"zip_structure_error") . $doublettes , 
 
  140                 $dirlist = opendir(
$dir);
 
  141                 while (
false !== (
$file = readdir ($dirlist)))
 
  143                         if (!is_file(
$dir . 
"/" .  
$file) && !is_dir(
$dir . 
"/" . $file)) 
 
  148                         if ($file != 
'.' && $file != 
'..')
 
  151                                 $level = explode(
'/',$newpath);
 
  152                                 if (is_dir($newpath))
 
  158                                         $arr[
"path"][] = 
$dir . 
"/";
 
  159                                         $arr[
"file"][] = end($level);
 
  182                 $dirlist = opendir(
$dir);
 
  184                 while (
false !== (
$file = readdir ($dirlist)))
 
  186                         if (!is_file(
$dir . 
"/" . 
$file) && !is_dir(
$dir . 
"/" . $file)) 
 
  190                         if ($file != 
'.' && $file != 
'..')
 
  193                                 $level = explode(
'/',$newpath);
 
  194                                 if (is_dir($newpath))
 
  228                 if ($containerType == 
"Category") 
 
  230                         include_once(
"./Modules/Category/classes/class.ilObjCategory.php");
 
  232                         $newObj->setType(
"cat");
 
  234                 if ($containerType == 
"Folder")
 
  236                         include_once(
"./Modules/Folder/classes/class.ilObjFolder.php");
 
  238                         $newObj->setType(
"fold");               
 
  241                 $newObj->setTitle($name);
 
  243                 $newObj->createReference();
 
  245                 $newObj->setPermissions(
$ref_id);
 
  247                 if ($newObj->getType() == 
"cat") 
 
  250                         $newObj->addTranslation($name,
"", $lng->getLangKey(), $lng->getLangKey());
 
  253                 return $newObj->getRefId();
 
  268                 if ($rbacsystem->checkAccess(
"create", 
$ref_id, 
"file")) {
 
  271                         include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  273                         $fileObj->setType($this->type);
 
  278                         include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  283                         $fileObj->createReference();
 
  286                         $fileObj->setPermissions(
$ref_id);
 
  290                         $fileObj->createDirectory();
 
  295                         $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
 
  310                 return (preg_match(
'%^(?: 
  311                         [\x09\x0A\x0D\x20-\x7E]            # ASCII 
  312                         | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte 
  313                         |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs 
  314                         | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte 
  315                         |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates 
  316                         |  \xF0[\x90-\xBF][\x80-\xBF]{2}     # planes 1-3 
  317                         | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15 
  318                         |  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16 
  319                         )*$%xs', $string))? $string : 
utf8_encode($string);
 
  330                 $fh = fopen($filein, 
'rb');
 
  331                 $fh2= fopen($fileout, 
'wb');
 
  332                 stream_filter_append($fh2, 
'convert.base64-decode');
 
  336                     if ($chunk === 
false)
 
  338                     fwrite ($fh2, $chunk);
 
  352                 $fh = fopen($filein, 
'rb');
 
  353                 $fh2= fopen($fileout, 
'wb');
 
  354                 stream_filter_append($fh2, 
'convert.base64-encode');
 
  357                         $chunk = fgets($fh,76);
 
  358                         if ($chunk === 
false) 
 
  362                         fwrite ($fh2, $chunk);                  
 
  379     if (!file_exists (
$in) || !is_readable (
$in))
 
  381     if ((!file_exists (
$out) && !is_writable (dirname (
$out)) || (file_exists(
$out) && !is_writable(
$out)) ))
 
  384     $in_file = fopen (
$in, 
"rb");
 
  385     if (!$out_file = gzopen (
$out, 
"wb".$param)) {
 
  389     while (!feof ($in_file)) {
 
  390         $buffer = fgets ($in_file, 4096);
 
  391         gzwrite ($out_file, $buffer, 4096);
 
  410     if (!file_exists (
$in) || !is_readable (
$in))
 
  412     if ((!file_exists (
$out) && !is_writable (dirname (
$out)) || (file_exists(
$out) && !is_writable(
$out)) ))
 
  415     $in_file = gzopen (
$in, 
"rb");
 
  416     $out_file = fopen (
$out, 
"wb");
 
  418     while (!gzeof ($in_file)) {
 
  419         $buffer = gzread ($in_file, 4096);
 
  420         fwrite ($out_file, $buffer, 4096);
 
  434                 if(!file_exists($a_file) or !is_readable($a_file))
 
  439                 if(class_exists(
'finfo'))
 
  441                         $finfo = 
new finfo(FILEINFO_MIME);
 
  442                         return $finfo->buffer(file_get_contents($a_file));
 
  444                 if(function_exists(
'mime_content_type'))
 
  446                         return mime_content_type($a_file);
 
  448                 return 'application/octet-stream';