Example #1
0
     $info = pathinfo($_FILES['file']['name']);
     // append number
     while (file_exists($targetPath . $info['filename'] . "_" . $i . "." . $extension)) {
         $i++;
     }
     $_FILES['file']['name'] = $info['filename'] . "_" . $i . "." . $extension;
 }
 $targetFile = $targetPath . $_FILES['file']['name'];
 $targetFileThumb = $targetPathThumb . $_FILES['file']['name'];
 // check if image (and supported)
 if (in_array(fix_strtolower($extension), $ext_img)) {
     $is_img = TRUE;
 } else {
     $is_img = FALSE;
 }
 if (!checkresultingsize($_FILES['file']['size'])) {
     response(sprintf(trans('max_size_reached'), $MaxSizeTotal) . AddErrorLocation(), 406)->send();
     exit;
 }
 // upload
 move_uploaded_file($tempFile, $targetFile);
 chmod($targetFile, 0755);
 if ($is_img) {
     $memory_error = FALSE;
     if (!create_img($targetFile, $targetFileThumb, 122, 91)) {
         $memory_error = FALSE;
     } else {
         // TODO something with this long function baaaah...
         if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option)) {
             $memory_error = FALSE;
         } else {
Example #2
0
         break;
     case 'save_text_file':
         $content = $_POST['new_content'];
         // $content = htmlspecialchars($content); not needed
         // $content = stripslashes($content);
         // no file
         if (!file_exists($path)) {
             response(trans('File_Not_Found') . AddErrorLocation())->send();
             exit;
         }
         // not writable or edit not allowed
         if (!is_writable($path) || $edit_text_files === FALSE) {
             response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))) . AddErrorLocation())->send();
             exit;
         }
         if (!checkresultingsize(strlen($content))) {
             response(sprintf(trans('max_size_reached'), $MaxSizeTotal) . AddErrorLocation())->send();
             exit;
         }
         if (@file_put_contents($path, $content) === FALSE) {
             response(trans('File_Save_Error') . AddErrorLocation())->send();
             exit;
         } else {
             response(trans('File_Save_OK'))->send();
             exit;
         }
         break;
     default:
         response(trans('wrong action') . AddErrorLocation())->send();
         exit;
 }
Example #3
0
         list($sizeFolderToCopy, $fileNum, $foldersCount) = folder_info($path, false);
         // size over limit
         if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
             if ($copy_cut_max_size * 1024 * 1024 < $sizeFolderToCopy) {
                 response(sprintf(trans('Copy_Cut_Size_Limit'), $msg_sub_action, $copy_cut_max_size) . AddErrorLocation())->send();
                 exit;
             }
         }
         // file count over limit
         if ($copy_cut_max_count !== false && is_int($copy_cut_max_count)) {
             if ($copy_cut_max_count < $fileNum) {
                 response(sprintf(trans('Copy_Cut_Count_Limit'), $msg_sub_action, $copy_cut_max_count) . AddErrorLocation())->send();
                 exit;
             }
         }
         if (!checkresultingsize($sizeFolderToCopy)) {
             response(sprintf(trans('max_size_reached'), $MaxSizeTotal) . AddErrorLocation())->send();
             exit;
         }
     } else {
         // can't copy/cut files
         if ($copy_cut_files === false) {
             response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Files')) . AddErrorLocation())->send();
             exit;
         }
     }
     $_SESSION['RF']['clipboard']['path'] = $_POST['path'];
     $_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
     break;
 case 'clear_clipboard':
     $_SESSION['RF']['clipboard'] = null;