PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
← All changes | app/Services/Libs/FileSystem.php +20 -1 1.7.0 → 2.5.0 View file →
@@ -30,8 +30,27 @@
30 30 return $uploadDir['basedir'] . '/' . $folderName;
31 31 }
32 32
33 33 /**
34 + * Whether a URL points at a file this application uploaded (renamed by _renameFileName)
35 + * @return bool
36 + */
37 + public function _isUploadedFileUrl($url)
38 + {
39 + $name = is_string($url) ? basename((string) wp_parse_url($url, PHP_URL_PATH)) : '';
40 +
41 + // The prefix also rules out the folder's own .htaccess and index.php.
42 + if (!preg_match('/^fluentbooking-[a-f0-9]{32}-fluentbooking-/', $name)) {
43 + return false;
44 + }
45 +
46 + $folderName = apply_filters('fluent_booking/upload_folder_name', 'fluent-booking');
47 + $expected = wp_upload_dir()['baseurl'] . '/' . $folderName . '/' . $name;
48 +
49 + return set_url_scheme($url) === set_url_scheme($expected) && file_exists($this->_getDir() . '/' . $name);
50 + }
51 +
52 + /**
34 53 * Get absolute path of file using custom upload dir name of this application
35 54 * @return string [file path]
36 55 */
37 56 public function _getAbsolutePathOfFile($file)
@@ -119,9 +138,9 @@
119 138
120 139 $param['path'] = $param['basedir'] .'/'. $folderName;
121 140
122 141 if (!is_dir($param['path'])) {
123 - mkdir($param['path'], 0755);
142 + mkdir($param['path'], 0755); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir
124 143 file_put_contents(
125 144 $param['basedir'].'/'.$folderName.'/.htaccess',
126 145 file_get_contents(__DIR__.'/Stubs/htaccess.stub')
127 146 );