Server IP : 172.24.0.40 / Your IP : 216.73.216.10 Web Server : Apache System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64 User : apache ( 48) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/pjahs/public_html/wp-content/plugins/ninja-forms/includes/Admin/Processes/ |
Upload File : |
<?php namespace NinjaForms\Includes\Admin\Processes; /** * Deletes a file given file path * * */ class DeleteBatchFile { /** * Delete a file, given a filepath * * @param string $filePath * @return string Result of the attempt to delete file */ public function delete(string $filePath): string { $return = __('File could not be found for deletion', 'ninja-forms'); $dir = wp_get_upload_dir(); $fileinfo = pathinfo($filePath); $allowed_dir = $dir['basedir'] . '/ninja-forms-tmp' === $fileinfo['dirname']; if(!$allowed_dir) { $return = __('Permission denied to delete a file in that directory.', 'ninja-forms'); } else if (\file_exists($filePath)) { \unlink($filePath); $return = __('File was deleted', 'ninja-forms'); if (\file_exists($filePath)) { // couldn't delete file for some reason $return = __('File could not be deleted', 'ninja-forms'); } } return $return; } }