Пример #1
0
         }
     }
 }
 // delete thumbnails in destination
 if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
     if (is_file($destDirectory . $EDITOR->thumbnailFolderName . '/' . $file)) {
         $fs->delete($destDirectory . $EDITOR->thumbnailFolderName . '/' . $file);
     } else {
         if (is_file($destDirectory . $EDITOR->thumbnailFolderName . '/' . $file . '.png')) {
             $fs->delete($destDirectory . $EDITOR->thumbnailFolderName . '/' . $file . '.png');
         }
     }
 }
 // move files
 if ($action == 'move') {
     if ($fs->delete($destDirectory . $file) && $fs->rename($srcDirectory . $file, $destDirectory . $file)) {
         // move thumbnail to destination
         if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
             if (is_file($srcDirectory . $EDITOR->thumbnailFolderName . '/' . $file)) {
                 $fs->rename($srcDirectory . $EDITOR->thumbnailFolderName . '/' . $file, $destDirectory . $EDITOR->thumbnailFolderName . '/' . $file);
             } else {
                 if (is_file($srcDirectory . $EDITOR->thumbnailFolderName . '/' . $file . '.png')) {
                     $fs->rename($srcDirectory . $EDITOR->thumbnailFolderName . '/' . $file . '.png', $destDirectory . $EDITOR->thumbnailFolderName . '/' . $file . '.png');
                 }
             }
         }
         array_push($succeeded, $file);
     } else {
         array_push($failed, $file);
     }
     // copy files
Пример #2
0
         $failed3[$old]['reason'] = 'reserved';
         $failed3[$old]['extension'] = $extension;
         $failed3[$old]['name'] = substr($old, 0, strlen($old) - strlen($extension));
         $failed3[$old]['new'] = $new . $extension;
         continue;
     }
     // check a file with this name doesn't already exist
     if (file_exists($directory . $new . $extension)) {
         array_push($failed2, $old);
         $failed3[$old]['reason'] = 'duplicate';
         $failed3[$old]['extension'] = $extension;
         $failed3[$old]['name'] = substr($old, 0, strlen($old) - strlen($extension));
         $failed3[$old]['new'] = $new . $extension;
         continue;
     }
     if ($fs->rename($directory . $old, $directory . $new . $extension)) {
         // rename thumbnails
         if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
             if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $old)) {
                 $fs->rename($directory . $EDITOR->thumbnailFolderName . '/' . $old, $directory . $EDITOR->thumbnailFolderName . '/' . $new . $extension);
             } else {
                 if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $old . '.png')) {
                     $fs->rename($directory . $EDITOR->thumbnailFolderName . '/' . $old . '.png', $directory . $EDITOR->thumbnailFolderName . '/' . $new . $extension . '.png');
                 }
             }
         }
         array_push($succeeded, $new . $extension);
     } else {
         array_push($failed, $old);
     }
 }
Пример #3
0
         $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSFileNameTakenError'));
         $suggestExtension = strrchr(strtolower($file), '.');
         $suggest = $fs->resolveDuplicate($file, $directory);
         $suggest = basename(substr($suggest, 0, strlen($suggest) - strlen($suggestExtension)));
         $response->addScriptCall('showSaveAs', htmlspecialchars($suggest), htmlspecialchars($suggestExtension));
         $response->addScriptCall("dialog.hideLoadMessage", '');
         return $response;
     }
     $file = $options . $extension2;
 } else {
     if ($extension1 != $extension2) {
         $extra = '.png';
     }
     $fs->delete($directory . $file);
 }
 if ($fs->rename($directory . $temp, $directory . $file . $extra)) {
     // delete thumbnails
     if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
         if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $file)) {
             $fs->delete($directory . $EDITOR->thumbnailFolderName . '/' . $file);
         } else {
             if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $file . '.png')) {
                 $fs->delete($directory . $EDITOR->thumbnailFolderName . '/' . $file . '.png');
             }
         }
     }
     if ($task == 'saveAndExit') {
         $this->displayFolderList($folderId, $folderPath, $options['page'], $options['sortBy'], $options['sortDir'], $options['view'], array($file . $extra), false, $response);
         //$response->addScriptCall('closeSubDialog', '');
         unset($WPRO_SESS->data['imageEditor'][$editorID]);
         //$WPRO_SESS->save();
Пример #4
0
     return $response;
 } else {
     foreach ($overwrite as $file) {
         if (isset($WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file])) {
             $temp = $WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file];
             //if ($fs->fileNameOk($file)) {
             if (!($file = $fs->makeFileNameOK($file)) || !($temp = $fs->makeFileNameOK($temp))) {
                 array_push($failed, $file);
                 continue;
             }
             //$isFile = is_file($directory.$file);
             // if it doesn't exist, who cares? we were going to delete it anyway!
             if (!file_exists($directory . $temp)) {
                 continue;
             }
             if ($fs->delete($directory . $file) && $fs->rename($directory . $temp, $directory . $file)) {
                 unset($WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file]);
                 // delete thumbnails
                 if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
                     if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $file)) {
                         $fs->delete($directory . $EDITOR->thumbnailFolderName . '/' . $file);
                     } else {
                         if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $file . '.png')) {
                             $fs->delete($directory . $EDITOR->thumbnailFolderName . '/' . $file . '.png');
                         }
                     }
                 }
                 array_push($succeeded, $file);
             } else {
                 array_push($failed, $file);
             }