From 0293203ab96299bd5d2d1a8f835ac6179fd2f47f Mon Sep 17 00:00:00 2001 From: Guido Scialfa Date: Thu, 22 Nov 2018 10:38:19 +0100 Subject: [PATCH] bump 3.6.4 --- assets/css/main.css | 2 +- assets/css/main.css.map | 7 + assets/css/main.min.css | 2 +- assets/css/pro.css.map | 7 + assets/images/backwpupbanner.png | Bin 20302 -> 0 bytes assets/images/inpsyde.png | Bin 20864 -> 0 bytes assets/images/inpsyde.svg | 1 + assets/js/backup-downloader.js | 393 ++ assets/js/backup-downloader.min.js | 2 + assets/js/notice.js | 53 + assets/js/notice.min.js | 1 + assets/js/page_backups.js | 115 - assets/js/page_backups.min.js | 1 - assets/js/page_settings.js | 126 - assets/js/page_settings.min.js | 13 +- backwpup.php | 248 +- changelog.txt | 15 + inc/Helper/MimeType.php | 222 + .../DismissibleNoticeOption.php} | 55 +- inc/Notice/Promoter.php | 146 + inc/Notice/PromoterMessage.php | 70 + inc/Notice/PromoterUpdater.php | 49 + inc/Notice/PromoterView.php | 46 + inc/Settings/SettingTab.php | 11 + inc/Settings/SettingUpdatable.php | 13 + inc/class-admin-notice.php | 140 - inc/class-admin.php | 384 +- inc/class-become-inpsyder-widget.php | 176 - inc/class-create-archive.php | 78 +- inc/class-cron.php | 58 +- inc/class-decrypter.php | 198 - inc/class-destination-downloader-factory.php | 8 +- inc/class-destination-downloader.php | 101 +- inc/class-destination-email.php | 4 +- inc/class-destination-factory.php | 78 - inc/class-destination-folder.php | 168 +- inc/class-destination-msazure.php | 4 +- inc/class-destination-rsc.php | 4 +- inc/class-destination-s3.php | 11 +- inc/class-destination-sugarsync.php | 7 +- inc/class-destinations.php | 26 +- inc/class-download-file-interface.php | 7 - inc/class-download-file.php | 52 +- inc/class-download-handler.php | 16 +- inc/class-install.php | 6 - inc/class-job.php | 1397 ++-- inc/class-jobtype-wpexp.php | 4 - inc/class-jobtype-wpplugin.php | 7 - inc/class-option.php | 226 +- inc/class-page-backups.php | 343 +- inc/class-page-editjob.php | 26 +- inc/class-page-jobs.php | 36 +- inc/class-page-logs.php | 5 +- inc/class-page-settings.php | 1390 ++-- inc/class-system-tests-runner.php | 5 - inc/class-system-tests.php | 10 - languages/backwpup-de_DE.mo | Bin 132178 -> 0 bytes languages/backwpup-de_DE.po | 5060 --------------- languages/backwpup-de_DE_formal.mo | Bin 132818 -> 0 bytes languages/backwpup-de_DE_formal.po | 5060 --------------- languages/backwpup-es_ES.mo | Bin 132833 -> 0 bytes languages/backwpup-es_ES.po | 4933 --------------- languages/backwpup-fr_FR.mo | Bin 68050 -> 0 bytes languages/backwpup-fr_FR.po | 5597 ---------------- languages/backwpup-it_IT.mo | Bin 123458 -> 0 bytes languages/backwpup-it_IT.po | 5062 --------------- languages/backwpup-ja_JP.mo | Bin 71684 -> 0 bytes languages/backwpup-ja_JP.po | 5586 ---------------- languages/backwpup-pt_BR.mo | Bin 17307 -> 0 bytes languages/backwpup-pt_BR.po | 5570 ---------------- languages/backwpup-pt_PT.mo | Bin 107813 -> 0 bytes languages/backwpup-pt_PT.po | 5575 ---------------- languages/backwpup-ru_RU.mo | Bin 78202 -> 0 bytes languages/backwpup-ru_RU.po | 5607 ----------------- languages/backwpup-sv_SE.mo | Bin 82097 -> 0 bytes languages/backwpup-sv_SE.po | 5594 ---------------- languages/backwpup-zh_CN.mo | Bin 76071 -> 0 bytes languages/backwpup-zh_CN.po | 5553 ---------------- languages/backwpup.pot | 4160 ++++++------ vendor/autoload.php | 2 +- vendor/composer/ClassLoader.php | 2 +- vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 12 +- vendor/composer/installed.json | 295 +- vendor/phpseclib/phpseclib/appveyor.yml | 27 - .../phpseclib/phpseclib/Crypt/Base.php | 6 +- .../phpseclib/phpseclib/Crypt/Hash.php | 98 +- .../phpseclib/phpseclib/Crypt/RSA.php | 9 +- .../phpseclib/phpseclib/File/ASN1.php | 12 - .../phpseclib/phpseclib/File/X509.php | 12 +- .../phpseclib/phpseclib/Math/BigInteger.php | 1 + .../phpseclib/phpseclib/Net/SFTP.php | 12 +- .../phpseclib/phpseclib/Net/SSH2.php | 194 +- .../phpseclib/phpseclib/System/SSH/Agent.php | 2 - .../phpseclib/System/SSH/Agent/Identity.php | 12 - .../Catalogue/AbstractOperation.php | 31 +- .../translation/Dumper/CsvFileDumper.php | 2 +- .../translation/Dumper/MoFileDumper.php | 2 +- 98 files changed, 5441 insertions(+), 65234 deletions(-) create mode 100644 assets/css/main.css.map create mode 100644 assets/css/pro.css.map delete mode 100644 assets/images/backwpupbanner.png delete mode 100644 assets/images/inpsyde.png create mode 100644 assets/images/inpsyde.svg create mode 100644 assets/js/backup-downloader.js create mode 100644 assets/js/backup-downloader.min.js create mode 100644 assets/js/notice.js create mode 100644 assets/js/notice.min.js delete mode 100644 assets/js/page_backups.js delete mode 100644 assets/js/page_backups.min.js create mode 100644 inc/Helper/MimeType.php rename inc/{class-dismissible-notice-option.php => Notice/DismissibleNoticeOption.php} (82%) create mode 100644 inc/Notice/Promoter.php create mode 100644 inc/Notice/PromoterMessage.php create mode 100644 inc/Notice/PromoterUpdater.php create mode 100644 inc/Notice/PromoterView.php create mode 100644 inc/Settings/SettingTab.php create mode 100644 inc/Settings/SettingUpdatable.php delete mode 100644 inc/class-admin-notice.php delete mode 100644 inc/class-become-inpsyder-widget.php delete mode 100644 inc/class-decrypter.php delete mode 100644 inc/class-destination-factory.php delete mode 100644 languages/backwpup-de_DE.mo delete mode 100644 languages/backwpup-de_DE.po delete mode 100644 languages/backwpup-de_DE_formal.mo delete mode 100644 languages/backwpup-de_DE_formal.po delete mode 100644 languages/backwpup-es_ES.mo delete mode 100644 languages/backwpup-es_ES.po delete mode 100644 languages/backwpup-fr_FR.mo delete mode 100644 languages/backwpup-fr_FR.po delete mode 100644 languages/backwpup-it_IT.mo delete mode 100644 languages/backwpup-it_IT.po delete mode 100644 languages/backwpup-ja_JP.mo delete mode 100644 languages/backwpup-ja_JP.po delete mode 100644 languages/backwpup-pt_BR.mo delete mode 100644 languages/backwpup-pt_BR.po delete mode 100644 languages/backwpup-pt_PT.mo delete mode 100644 languages/backwpup-pt_PT.po delete mode 100644 languages/backwpup-ru_RU.mo delete mode 100644 languages/backwpup-ru_RU.po delete mode 100644 languages/backwpup-sv_SE.mo delete mode 100644 languages/backwpup-sv_SE.po delete mode 100644 languages/backwpup-zh_CN.mo delete mode 100644 languages/backwpup-zh_CN.po delete mode 100644 vendor/phpseclib/phpseclib/appveyor.yml diff --git a/assets/css/main.css b/assets/css/main.css index bd032907..6312b917 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1 +1 @@ -@charset "UTF-8";.backwpup-max-width{max-width:800px}@font-face{font-family:'backwpup';src:url('../fonts/backwpup.eot');src:url('../fonts/backwpup.eot?#iefix') format('embedded-opentype'), url('../fonts/backwpup.ttf') format('truetype'), url('../fonts/backwpup.woff') format('woff'), url('../fonts/backwpup.svg#backwpup') format('svg');font-weight:normal;font-style:normal;}.error{color:#f00}.warning{color:#ffba00}.success{color:#86cf6f}#wp-admin-bar-backwpup .ab-icon{font:normal 20px/1 'backwpup' !important}#wp-admin-bar-backwpup .ab-icon::before{content:"\e600";top:2px}@media screen and (max-width:48.875em){#wp-admin-bar-backwpup .ab-icon{font:normal 32px/1 'backwpup' !important;display:block;text-indent:0;speak:none;top:7px;width:50px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wp-admin-bar-backwpup::before{top:0}}#adminmenu #toplevel_page_backwpup div.wp-menu-image:before{font:normal 20px/1 'backwpup' !important;content:"\e600"}#adminmenu #toplevel_page_backwpup a[href$="backwpuprestore"]::after{content:'New';font-size:0.55rem;color:#fff;padding:0.18rem 0.33rem;background:#97c24f;border-radius:0.23rem;line-height:1;position:relative;bottom:5px;left:1em}#backwpup-page hr{border:0;border-top:none;border-bottom:1px solid #eee}#backwpup-page .backwpup-floated-postbox{margin:25px 0 0;max-width:100%;overflow:hidden;padding:15px;position:relative}#backwpup-page .backwpup-floated-postbox h3 a{font-size:14px;text-decoration:none;font-weight:600}#backwpup-page .backwpup-cleared-postbox{clear:both;margin:25px 0 0;padding:10px}#backwpup-page .postbox ul{padding-left:10px}#backwpup-page .postbox table{caption-side:top;margin-bottom:25px}#backwpup-page .postbox table caption{color:#222;font-size:14px;font-weight:600;padding:8px 12px;margin:0;line-height:1.4;text-align:left}#backwpup-page .postbox .hndle{cursor:auto}#backwpup-page .postbox .backwpup-bullet-list{list-style:disc;padding-left:16px}#backwpup-page .postbox ol.backwpup-bullet-list{list-style:decimal}#backwpup-page .wizardbox{color:#fff;background:#1d94cf url('../images/hgbox.png') no-repeat right bottom;min-height:20em}#backwpup-page .wizardbox:hover{background-color:#0f79ae}#backwpup-page .wizardbox .wizardbox_name{color:#fff;margin-top:0}#backwpup-page .wizardbox .wizardbox_start{position:absolute;bottom:10px;left:10px}#backwpup-page .wizardbox select{max-width:100%;width:100%}#backwpup-page .button-bwp,#backwpup-page .button-primary-bwp{border-radius:0;-webkit-box-shadow:none;box-shadow:none}#backwpup-page .button-primary-bwp{border:none;background:#38b0eb;color:#fff;min-width:8em}#backwpup-page .button-primary-bwp:hover{background:#064565}#backwpup-page .backwpup-table-wrap{overflow-x:auto}#backwpup-page .backwpup-banner-img{display:block;height:auto;margin:26px auto;max-width:100%}#backwpup-page .backwpup-text-center{text-align:center}#backwpup-page ul.backwpup-text-center{padding-left:0}#backwpup-page .backwpup-message{background-color:#fff;border:none;border-left:4px solid #ccc;box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1);margin:5px 0 15px;padding:1px 12px;-webkit-box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1)}#backwpup-page .backwpup-message p{margin:0.5em 0;padding:2px}#backwpup-page .backwpup-info{border-left:4px solid #38b0eb;}#backwpup-page .backwpup-warning{border-left:4px solid #ffba00;}#backwpup-page .backwpup-full-width{max-width:100%}#backwpup-page .backwpup-full-width.action{margin-bottom:20px}#backwpup-page .notice ul{list-style-type:disc;margin-left:2em}@media screen and (min-width:45em){#backwpup-page .backwpup-floated-postbox{float:left;margin:25px 25px 25px 0;width:290px}#backwpup-page #backwpup-one-click-backup,#backwpup-page #wizard-jobimport,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{margin-right:0}#backwpup-page #backwpup-one-click-backup + .backwpup-floated-postbox,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{clear:left}}@media screen and (min-width:64em){#backwpup-page .backwpup-floated-postbox{width:362px}#backwpup-page .wizardbox{width:225px;min-height:225px}#backwpup-page .backwpup-max-width{max-width:800px}body[class*="_backwpupabout"] #backwpup-page .backwpup-welcome{max-width:none}}.progressbar{margin-top:20px;height:auto;background:#f6f6f6 url('../../assets/images/progressbarhg.jpg')}.progressbar #progresssteps{background-color:#007fb6}.progressbar .bwpu-progress{background-color:#1d94cf;color:#fff;padding:5px 0;text-align:center}#documentation_content p{font-size:14px;line-height:20px;color:#333}#documentation_content h3{padding:7px 0;font-size:22px}#documentation_content h4{padding:7px 0;font-size:18px}#documentation_content img.size-full{border:10px #f6f6f6 solid}#wpfooter #footer-left,#wpfooter #footer-right{overflow:hidden}#wpfooter #footer-left #footer-thankyou{clear:both;display:block;padding-top:0.5em}#wpfooter #footer-left .backwpup-get-pro{display:inline-block;line-height:25px}#wpfooter #footer-upgrade .backwpup-update-footer{display:block;line-height:25px}#wpfooter .inpsyde_logo{background:url('../images/inpsyde.png') no-repeat;display:inline-block;margin-right:15px;margin-top:5px;line-height:25px;height:25px;width:80px;text-indent:-9999em;text-decoration:none} \ No newline at end of file +@charset "UTF-8";.backwpup-max-width{max-width:800px}@font-face{font-family:'backwpup';src:url('../fonts/backwpup.eot');src:url('../fonts/backwpup.eot?#iefix') format('embedded-opentype'), url('../fonts/backwpup.ttf') format('truetype'), url('../fonts/backwpup.woff') format('woff'), url('../fonts/backwpup.svg#backwpup') format('svg');font-weight:normal;font-style:normal;}.error{color:#f00}.warning{color:#ffba00}.success{color:#86cf6f}.notice-inpsyde{border-left-color:#9dc55d}.notice-inpsyde .button--inpsyde{background-color:#9dc55d;color:#fff;border-color:#92be4a;box-shadow:0 1px 0 #92be4a}.notice-inpsyde .button--inpsyde:hover,.notice-inpsyde .button--inpsyde:focus{background-color:#92be4a;border-color:#85b03f;box-shadow:0 1px 0 #92be4a, 0 0 3px #9dc55d;color:#fff}#wp-admin-bar-backwpup .ab-icon{font:normal 20px/1 'backwpup' !important}#wp-admin-bar-backwpup .ab-icon::before{content:"\e600";top:2px}@media screen and (max-width:48.875em){#wp-admin-bar-backwpup .ab-icon{font:normal 32px/1 'backwpup' !important;display:block;text-indent:0;speak:none;top:7px;width:50px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wp-admin-bar-backwpup::before{top:0}}#adminmenu #toplevel_page_backwpup div.wp-menu-image:before{font:normal 20px/1 'backwpup' !important;content:"\e600"}#adminmenu #toplevel_page_backwpup a[href$="backwpuprestore"]::after{content:'New';font-size:0.55rem;color:#fff;padding:0.18rem 0.33rem;background:#85b03f;border-radius:0.23rem;line-height:1;position:relative;bottom:5px;left:1em}#backwpup-page hr{border:0;border-top:none;border-bottom:1px solid #eee}#backwpup-page .backwpup-floated-postbox{margin:25px 0 0;max-width:100%;overflow:hidden;padding:15px;position:relative}#backwpup-page .backwpup-floated-postbox h3 a{font-size:14px;text-decoration:none;font-weight:600}#backwpup-page .backwpup-cleared-postbox{clear:both;margin:25px 0 0;padding:10px}#backwpup-page .postbox ul{padding-left:10px}#backwpup-page .postbox table{caption-side:top;margin-bottom:25px}#backwpup-page .postbox table caption{color:#222;font-size:14px;font-weight:600;padding:8px 12px;margin:0;line-height:1.4;text-align:left}#backwpup-page .postbox .hndle{cursor:auto}#backwpup-page .postbox .backwpup-bullet-list{list-style:disc;padding-left:16px}#backwpup-page .postbox ol.backwpup-bullet-list{list-style:decimal}#backwpup-page .wizardbox{color:#fff;background:#1d94cf url('../images/hgbox.png') no-repeat right bottom;min-height:20em}#backwpup-page .wizardbox:hover{background-color:#0f79ae}#backwpup-page .wizardbox .wizardbox_name{color:#fff;margin-top:0}#backwpup-page .wizardbox .wizardbox_start{position:absolute;bottom:10px;left:10px}#backwpup-page .wizardbox select{max-width:100%;width:100%}#backwpup-page .button-bwp,#backwpup-page .button-primary-bwp{border-radius:0;-webkit-box-shadow:none;box-shadow:none}#backwpup-page .button-primary-bwp{border:none;background:#38b0eb;color:#fff;min-width:8em}#backwpup-page .button-primary-bwp:hover{background:#064565}#backwpup-page .backwpup-table-wrap{overflow-x:auto}#backwpup-page .backwpup-banner-img{display:block;height:auto;margin:26px auto;max-width:100%}#backwpup-page .backwpup-text-center{text-align:center}#backwpup-page ul.backwpup-text-center{padding-left:0}#backwpup-page .backwpup-message{background-color:#fff;border:none;border-left:4px solid #ccc;box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1);margin:5px 0 15px;padding:1px 12px;-webkit-box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1)}#backwpup-page .backwpup-message p{margin:0.5em 0;padding:2px}#backwpup-page .backwpup-info{border-left:4px solid #38b0eb;}#backwpup-page .backwpup-warning{border-left:4px solid #ffba00;}#backwpup-page .backwpup-full-width{max-width:100%}#backwpup-page .backwpup-full-width.action{margin-bottom:20px}#backwpup-page .notice ul{list-style-type:disc;margin-left:2em}@media screen and (min-width:45em){#backwpup-page .backwpup-floated-postbox{float:left;margin:25px 25px 25px 0;width:290px}#backwpup-page #backwpup-one-click-backup,#backwpup-page #wizard-jobimport,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{margin-right:0}#backwpup-page #backwpup-one-click-backup + .backwpup-floated-postbox,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{clear:left}}@media screen and (min-width:64em){#backwpup-page .backwpup-floated-postbox{width:362px}#backwpup-page .wizardbox{width:225px;min-height:225px}#backwpup-page .backwpup-max-width{max-width:800px}body[class*="_backwpupabout"] #backwpup-page .backwpup-welcome{max-width:none}}.progressbar{margin-top:10px;height:auto;background:#f6f6f6 url('../../assets/images/progressbarhg.jpg')}.progressbar #progresssteps{background-color:#007fb6}.progressbar .bwpu-progress{background-color:#1d94cf;color:#fff;padding:5px 0;text-align:center}#documentation_content p{font-size:14px;line-height:20px;color:#333}#documentation_content h3{padding:7px 0;font-size:22px}#documentation_content h4{padding:7px 0;font-size:18px}#documentation_content img.size-full{border:10px #f6f6f6 solid}#wpfooter #footer-left,#wpfooter #footer-right{overflow:hidden}#wpfooter #footer-left #footer-thankyou{clear:both;display:block;padding-top:0.5em}#wpfooter #footer-left .backwpup-get-pro{display:inline-block;line-height:25px}#wpfooter #footer-upgrade .backwpup-update-footer{display:block;line-height:25px}#wpfooter .inpsyde_logo{display:block;margin-right:15px;margin-top:5px;line-height:25px;height:25px;width:80px;text-decoration:none}#wpfooter .inpsyde_logo svg{display:block} \ No newline at end of file diff --git a/assets/css/main.css.map b/assets/css/main.css.map new file mode 100644 index 00000000..ead87393 --- /dev/null +++ b/assets/css/main.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAIA,mBAAoB,CAClB,SAAS,CAAE,KAAK,CCDlB,UASC,CARC,WAAW,CAAE,UAAU,CACvB,GAAG,CAAC,4BAA4B,CAChC,GAAG,CAAC,gNAG4D,CAChE,WAAW,CAAE,MAAM,CACnB,UAAU,CAAE,MAAM,CAGpB,MAAO,CACL,KAAK,CCRK,GAAI,CDWhB,QAAS,CACP,KAAK,CCbQ,OAAO,CDgBtB,QAAS,CACP,KAAK,CCfO,OAAO,CCJrB,eAAgB,CACd,iBAAiB,CDIL,OAAO,CCDnB,gCAAiB,CACf,gBAAgB,CDAN,OAAO,CCCjB,KAAK,CDLK,IAAI,CCMd,YAAY,CATK,OAAwB,CAUzC,UAAU,CAAQ,eAA2B,CAE7C,6EACQ,CACN,gBAAgB,CAdD,OAAwB,CAevC,YAAY,CAAM,OAA+B,CACjD,UAAU,CAAQ,+BAAiD,CACnE,KAAK,CDdG,IAAI,CEDhB,+BAAS,CACP,IAAI,CAAE,mCA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AAiB,CACf,KAAK,CAAQ,IAAI,CACjB,OAAO,CAAM,KAAK,CAClB,WAAW,CAAE,IAAI,CAGnB,wCAAkB,CAChB,OAAO,CAAM,YAAY,CACzB,WAAW,CAAE,IAAI,CAKnB,iDAAwB,CACtB,OAAO,CAAM,KAAK,CAClB,WAAW,CAAE,IAAI,CAIrB,uBAAc,CACZ,OAAO,CAAU,KAAK,CACtB,YAAY,CAAK,IAAI,CACrB,UAAU,CAAO,GAAG,CACpB,WAAW,CAAM,IAAI,CACrB,MAAM,CAAW,IAAI,CACrB,KAAK,CAAY,IAAI,CACrB,eAAe,CAAE,IAAI,CAErB,2BAAI,CACF,OAAO,CAAE,KAAK", +"sources": ["../../resources/scss/utils/_classes.scss","../../resources/scss/core/_typography.scss","../../resources/scss/settings/_colors.scss","../../resources/scss/components/_notice.scss","../../resources/scss/components/_admin-bar.scss","../../resources/scss/components/_admin-menu.scss","../../resources/scss/components/_backwpup-page.scss","../../resources/scss/components/_progress-bar.scss","../../resources/scss/components/_documentation.scss","../../resources/scss/components/_footer.scss"], +"names": [], +"file": "main.css" +} \ No newline at end of file diff --git a/assets/css/main.min.css b/assets/css/main.min.css index 440e55ae..a7bdc32a 100644 --- a/assets/css/main.min.css +++ b/assets/css/main.min.css @@ -1 +1 @@ -@charset "UTF-8";.backwpup-max-width{max-width:800px}@font-face{font-family:'backwpup';src:url('../fonts/backwpup.eot');src:url('../fonts/backwpup.eot?#iefix') format('embedded-opentype'), url('../fonts/backwpup.ttf') format('truetype'), url('../fonts/backwpup.woff') format('woff'), url('../fonts/backwpup.svg#backwpup') format('svg');font-weight:normal;font-style:normal}.error{color:#f00}.warning{color:#ffba00}.success{color:#86cf6f}#wp-admin-bar-backwpup .ab-icon{font:normal 20px/1 'backwpup' !important}#wp-admin-bar-backwpup .ab-icon::before{content:"\e600";top:2px}@media screen and (max-width:48.875em){#wp-admin-bar-backwpup .ab-icon{font:normal 32px/1 'backwpup' !important;display:block;text-indent:0;speak:none;top:7px;width:50px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wp-admin-bar-backwpup::before{top:0}}#adminmenu #toplevel_page_backwpup div.wp-menu-image:before{font:normal 20px/1 'backwpup' !important;content:"\e600"}#adminmenu #toplevel_page_backwpup a[href$="backwpuprestore"]::after{content:'New';font-size:0.55rem;color:#fff;padding:0.18rem 0.33rem;background:#97c24f;border-radius:0.23rem;line-height:1;position:relative;bottom:5px;left:1em}#backwpup-page hr{border:0;border-top:none;border-bottom:1px solid #eee}#backwpup-page .backwpup-floated-postbox{margin:25px 0 0;max-width:100%;overflow:hidden;padding:15px;position:relative}#backwpup-page .backwpup-floated-postbox h3 a{font-size:14px;text-decoration:none;font-weight:600}#backwpup-page .backwpup-cleared-postbox{clear:both;margin:25px 0 0;padding:10px}#backwpup-page .postbox ul{padding-left:10px}#backwpup-page .postbox table{caption-side:top;margin-bottom:25px}#backwpup-page .postbox table caption{color:#222;font-size:14px;font-weight:600;padding:8px 12px;margin:0;line-height:1.4;text-align:left}#backwpup-page .postbox .hndle{cursor:auto}#backwpup-page .postbox .backwpup-bullet-list{list-style:disc;padding-left:16px}#backwpup-page .postbox ol.backwpup-bullet-list{list-style:decimal}#backwpup-page .wizardbox{color:#fff;background:#1d94cf url('../images/hgbox.png') no-repeat right bottom;min-height:20em}#backwpup-page .wizardbox:hover{background-color:#0f79ae}#backwpup-page .wizardbox .wizardbox_name{color:#fff;margin-top:0}#backwpup-page .wizardbox .wizardbox_start{position:absolute;bottom:10px;left:10px}#backwpup-page .wizardbox select{max-width:100%;width:100%}#backwpup-page .button-bwp,#backwpup-page .button-primary-bwp{border-radius:0;-webkit-box-shadow:none;box-shadow:none}#backwpup-page .button-primary-bwp{border:none;background:#38b0eb;color:#fff;min-width:8em}#backwpup-page .button-primary-bwp:hover{background:#064565}#backwpup-page .backwpup-table-wrap{overflow-x:auto}#backwpup-page .backwpup-banner-img{display:block;height:auto;margin:26px auto;max-width:100%}#backwpup-page .backwpup-text-center{text-align:center}#backwpup-page ul.backwpup-text-center{padding-left:0}#backwpup-page .backwpup-message{background-color:#fff;border:none;border-left:4px solid #ccc;box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1);margin:5px 0 15px;padding:1px 12px;-webkit-box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1)}#backwpup-page .backwpup-message p{margin:0.5em 0;padding:2px}#backwpup-page .backwpup-info{border-left:4px solid #38b0eb}#backwpup-page .backwpup-warning{border-left:4px solid #ffba00}#backwpup-page .backwpup-full-width{max-width:100%}#backwpup-page .backwpup-full-width.action{margin-bottom:20px}#backwpup-page .notice ul{list-style-type:disc;margin-left:2em}@media screen and (min-width:45em){#backwpup-page .backwpup-floated-postbox{float:left;margin:25px 25px 25px 0;width:290px}#backwpup-page #backwpup-one-click-backup,#backwpup-page #wizard-jobimport,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{margin-right:0}#backwpup-page #backwpup-one-click-backup + .backwpup-floated-postbox,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{clear:left}}@media screen and (min-width:64em){#backwpup-page .backwpup-floated-postbox{width:362px}#backwpup-page .wizardbox{width:225px;min-height:225px}#backwpup-page .backwpup-max-width{max-width:800px}body[class*="_backwpupabout"] #backwpup-page .backwpup-welcome{max-width:none}}.progressbar{margin-top:20px;height:auto;background:#f6f6f6 url('../../assets/images/progressbarhg.jpg')}.progressbar #progresssteps{background-color:#007fb6}.progressbar .bwpu-progress{background-color:#1d94cf;color:#fff;padding:5px 0;text-align:center}#documentation_content p{font-size:14px;line-height:20px;color:#333}#documentation_content h3{padding:7px 0;font-size:22px}#documentation_content h4{padding:7px 0;font-size:18px}#documentation_content img.size-full{border:10px #f6f6f6 solid}#wpfooter #footer-left,#wpfooter #footer-right{overflow:hidden}#wpfooter #footer-left #footer-thankyou{clear:both;display:block;padding-top:0.5em}#wpfooter #footer-left .backwpup-get-pro{display:inline-block;line-height:25px}#wpfooter #footer-upgrade .backwpup-update-footer{display:block;line-height:25px}#wpfooter .inpsyde_logo{background:url('../images/inpsyde.png') no-repeat;display:inline-block;margin-right:15px;margin-top:5px;line-height:25px;height:25px;width:80px;text-indent:-9999em;text-decoration:none} \ No newline at end of file +@charset "UTF-8";.backwpup-max-width{max-width:800px}@font-face{font-family:'backwpup';src:url('../fonts/backwpup.eot');src:url('../fonts/backwpup.eot?#iefix') format('embedded-opentype'), url('../fonts/backwpup.ttf') format('truetype'), url('../fonts/backwpup.woff') format('woff'), url('../fonts/backwpup.svg#backwpup') format('svg');font-weight:normal;font-style:normal}.error{color:#f00}.warning{color:#ffba00}.success{color:#86cf6f}.notice-inpsyde{border-left-color:#9dc55d}.notice-inpsyde .button--inpsyde{background-color:#9dc55d;color:#fff;border-color:#92be4a;box-shadow:0 1px 0 #92be4a}.notice-inpsyde .button--inpsyde:hover,.notice-inpsyde .button--inpsyde:focus{background-color:#92be4a;border-color:#85b03f;box-shadow:0 1px 0 #92be4a, 0 0 3px #9dc55d;color:#fff}#wp-admin-bar-backwpup .ab-icon{font:normal 20px/1 'backwpup' !important}#wp-admin-bar-backwpup .ab-icon::before{content:"\e600";top:2px}@media screen and (max-width:48.875em){#wp-admin-bar-backwpup .ab-icon{font:normal 32px/1 'backwpup' !important;display:block;text-indent:0;speak:none;top:7px;width:50px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wp-admin-bar-backwpup::before{top:0}}#adminmenu #toplevel_page_backwpup div.wp-menu-image:before{font:normal 20px/1 'backwpup' !important;content:"\e600"}#adminmenu #toplevel_page_backwpup a[href$="backwpuprestore"]::after{content:'New';font-size:0.55rem;color:#fff;padding:0.18rem 0.33rem;background:#85b03f;border-radius:0.23rem;line-height:1;position:relative;bottom:5px;left:1em}#backwpup-page hr{border:0;border-top:none;border-bottom:1px solid #eee}#backwpup-page .backwpup-floated-postbox{margin:25px 0 0;max-width:100%;overflow:hidden;padding:15px;position:relative}#backwpup-page .backwpup-floated-postbox h3 a{font-size:14px;text-decoration:none;font-weight:600}#backwpup-page .backwpup-cleared-postbox{clear:both;margin:25px 0 0;padding:10px}#backwpup-page .postbox ul{padding-left:10px}#backwpup-page .postbox table{caption-side:top;margin-bottom:25px}#backwpup-page .postbox table caption{color:#222;font-size:14px;font-weight:600;padding:8px 12px;margin:0;line-height:1.4;text-align:left}#backwpup-page .postbox .hndle{cursor:auto}#backwpup-page .postbox .backwpup-bullet-list{list-style:disc;padding-left:16px}#backwpup-page .postbox ol.backwpup-bullet-list{list-style:decimal}#backwpup-page .wizardbox{color:#fff;background:#1d94cf url('../images/hgbox.png') no-repeat right bottom;min-height:20em}#backwpup-page .wizardbox:hover{background-color:#0f79ae}#backwpup-page .wizardbox .wizardbox_name{color:#fff;margin-top:0}#backwpup-page .wizardbox .wizardbox_start{position:absolute;bottom:10px;left:10px}#backwpup-page .wizardbox select{max-width:100%;width:100%}#backwpup-page .button-bwp,#backwpup-page .button-primary-bwp{border-radius:0;-webkit-box-shadow:none;box-shadow:none}#backwpup-page .button-primary-bwp{border:none;background:#38b0eb;color:#fff;min-width:8em}#backwpup-page .button-primary-bwp:hover{background:#064565}#backwpup-page .backwpup-table-wrap{overflow-x:auto}#backwpup-page .backwpup-banner-img{display:block;height:auto;margin:26px auto;max-width:100%}#backwpup-page .backwpup-text-center{text-align:center}#backwpup-page ul.backwpup-text-center{padding-left:0}#backwpup-page .backwpup-message{background-color:#fff;border:none;border-left:4px solid #ccc;box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1);margin:5px 0 15px;padding:1px 12px;-webkit-box-shadow:0px 1px 1px 0px rgba(0, 0, 0, 0.1)}#backwpup-page .backwpup-message p{margin:0.5em 0;padding:2px}#backwpup-page .backwpup-info{border-left:4px solid #38b0eb}#backwpup-page .backwpup-warning{border-left:4px solid #ffba00}#backwpup-page .backwpup-full-width{max-width:100%}#backwpup-page .backwpup-full-width.action{margin-bottom:20px}#backwpup-page .notice ul{list-style-type:disc;margin-left:2em}@media screen and (min-width:45em){#backwpup-page .backwpup-floated-postbox{float:left;margin:25px 25px 25px 0;width:290px}#backwpup-page #backwpup-one-click-backup,#backwpup-page #wizard-jobimport,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{margin-right:0}#backwpup-page #backwpup-one-click-backup + .backwpup-floated-postbox,#backwpup-page #backwpup-thank-you,#backwpup-page #backwpup-stats{clear:left}}@media screen and (min-width:64em){#backwpup-page .backwpup-floated-postbox{width:362px}#backwpup-page .wizardbox{width:225px;min-height:225px}#backwpup-page .backwpup-max-width{max-width:800px}body[class*="_backwpupabout"] #backwpup-page .backwpup-welcome{max-width:none}}.progressbar{margin-top:10px;height:auto;background:#f6f6f6 url('../../assets/images/progressbarhg.jpg')}.progressbar #progresssteps{background-color:#007fb6}.progressbar .bwpu-progress{background-color:#1d94cf;color:#fff;padding:5px 0;text-align:center}#documentation_content p{font-size:14px;line-height:20px;color:#333}#documentation_content h3{padding:7px 0;font-size:22px}#documentation_content h4{padding:7px 0;font-size:18px}#documentation_content img.size-full{border:10px #f6f6f6 solid}#wpfooter #footer-left,#wpfooter #footer-right{overflow:hidden}#wpfooter #footer-left #footer-thankyou{clear:both;display:block;padding-top:0.5em}#wpfooter #footer-left .backwpup-get-pro{display:inline-block;line-height:25px}#wpfooter #footer-upgrade .backwpup-update-footer{display:block;line-height:25px}#wpfooter .inpsyde_logo{display:block;margin-right:15px;margin-top:5px;line-height:25px;height:25px;width:80px;text-decoration:none}#wpfooter .inpsyde_logo svg{display:block} \ No newline at end of file diff --git a/assets/css/pro.css.map b/assets/css/pro.css.map new file mode 100644 index 00000000..01cd16b2 --- /dev/null +++ b/assets/css/pro.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAME,6BAAK,CACH,OAAO,CAAE,KAAK,CACd,OAAO,CAAE,GAAG,CAIZ,0CAAM,CACJ,OAAO,CAAQ,KAAK,CACpB,WAAW,CAAI,IAAI,CACnB,aAAa,CAAE,GAAG,CAGpB,gEAA4B,CAC1B,OAAO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AAM,CAAC,CACjB,OAAO,CAAS,CAAC,CACjB,cAAc,CAAE,GAAG", +"sources": ["../../resources/scss/components/_settings-encryption.scss","../../resources/scss/components/_pro-wizard.scss","../../resources/scss/components/_decrypter.scss","../../resources/scss/restore/_commons.scss","../../resources/scss/restore/_drag-drop-area.scss","../../resources/scss/restore/_progress-bar.scss","../../resources/scss/restore/_restore.scss"], +"names": [], +"file": "pro.css" +} \ No newline at end of file diff --git a/assets/images/backwpupbanner.png b/assets/images/backwpupbanner.png deleted file mode 100644 index b80ca2a4c14d32b25e505fa95f21c0e2fe76c363..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20302 zcmagGcQ{<%*EftrqDGVu5=JkH-uvh^jFRXjh#sBjLnL|`ooFMvL`d{5A!3jiU4jsd zj1t7C!{9yR`~Cf%`;Yg29@n`pXU^=i_G)|WwfFw4i8s*Kq$Fb^BOoB4)YeinA|N0F z6A%#IAh`xSak76_0{mn2S2y!F_HyzMwDWZ&P=4ZN@5rj{Vdv~<1%YvJPGzf_C^efk-^gt z6%_zl2>1ni`r8Ewc=~bthk}};pM$Tfx4)~GCo7(!oxN9pzXChJ=|3WPc>kBIr{BM7 z0u&|`Walj;A}EX(=|2ti^#1QnJv{!~+Rxv}@&EAq|4Z2KVX(KOkddRGSAeerU^piZ zd{^GGs=khP{$9Qhy}X|OM~en7UjANwE?(ZOs>Twmrmmh(yaN3$TkGk`YJ2+m+j%-T zYO5)*1MdsEx;~K=mC;aBm6ntcRS}U85mA?vR+m)KP?c6zmR3_0786nV&%0_~4gnsH zp8o%N_sRcxSMq;-7w-rj-ayZ4j=rwX9G__TdU>#33M}jTzw;vYzta2n-6#J$FXI2} zyFvgnLU^SMg5#T%c+y6Q(@ZrC1@8}8mx-a0=rXI}A1O&RDwbhg#2F-32QoiSO z4Bn~Sc<3=@;l4F#aXWgP$*acfLv0Ip6R5aWG=W4bQrXbTDr1*s29_&5w0aG!V(}u! zrT&$B(%QYj`NTllQYn2Djb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OMG3|8v3hw3K^N`~w_*~;;NWFcLOYT)gTQ{?nG0)cXYH2H6~ z5OTuXxHa~wDmIruWNKrQ%LjcOpH%3{D5!T9WC@PTEJQ_2r1A*R>~bHsMK?cb$7GEc zAyi{j)9gY=*iGp#pE-*U7`K|qYc|oW7b3!j@9oK8?o4S*Il+T9*=n@O{(4dEa0#T( zwJ*6>08i*Z?NC2WxhoWavo*AMrHRjeyrZejE(~4>zlm0Q-27-tf-MgL7#65ff@T@i ziv2!589(b#R9Ua_543`UAZyOe%qAYki%F?ikC(9@-DS#<#F(`uy4M{7(RzYB900}0 zv|aJQ`^-K6Q7y~`5*h1LmL19 diff --git a/assets/images/inpsyde.png b/assets/images/inpsyde.png deleted file mode 100644 index 981fbb49fdf470b5c884b6490baae981ad464292..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20864 zcmeI4c|6o@yTE^*%372pYgw{p%#3{oBgR_xC0nIo#+VEYeAD_dVzQGgHjvzOUuJzQ6mrmygegvNShZ!zsiG0Kgg( zV|{Dz-4gr~WM>7xXBy^kfNvaRV@E0gC`vATvG`xs*$)7m76dff($a%OBT+p_WHA#o zT8vB~xf6&u0PugBW`no2dBd+g_2Prxj-#OoJ4n_W*u|{%j)n5YNz03KtlfT8{QQ#* zRyFGk3|0!?$vC>=#EH|9*0Nv4ic@DLS%B#fEv>B*)oix_ z7XOD_>_D|yYBfwGa-L^IFL@VB=nS9%J7{!=3c_H z?K+V0=BfQ8d4Y|=`IF^Oo(v5Rc5koObH+5=2hZVaU8?P8iJwEXzD|97d8>a*n9}Yr zqm|PyYwvw9y)4ppisOjuvsbZ3U(2}WzluJTs5fyfcaY~Bu;TSOp`Q{nsdQN)O7E0h zgVck0Y=5u9%nDSmDp0f!#S#<;$=>a@;?oY9wGOoE{wV;Ms36rml4V~J>T$TQ&2Rpl z&a6>}6cFlea>@q)_ULa>v~9ks)5Hz{`Wa#JMY_TtY6KLjSw(7AJ*(mRx>xOp-j@1W zy|sFr*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v({mTr4LSI;x)@yc}T`!>5{y>dHmaKukv+sE&h-D;Z_^Eo%w zuElPkJ69E3h;uquV^PGS9;920C1WP)BUpHz!`#0l8_pl%LsVSG4ks3^-pp}pQy<~> zh0!51anFxIKIm6MJI!*^>+jxJo%Aw|{j1>PK9>9@0|A50A@-x(cGe$*2qvDQnH>f- zF(a+!w_Un#h1_Wy-(2(+Ju~U~LhY)zJIN@SyY|>fV8EK2bAF!)RXi7SH+xDw3l;uT z_kf8na#OXa)9}FR&J|~DwIh0KM#!x79tdK1wr0Ba_z}`dwQ+SD{WcOmh`@+HKscI$ooo*!d-FpGa!4$ieXN-0M!~ z>I`z7-wVF2*>1-cEYMV^vC5?yabx4|{A#~q{<>+CyZk(xQs2E3J?f`D(P>pNKJFO! z;u`MV8Ef~txBBgHqkO0G2b1Gn`N9E+z80K%LXqV*A!Hf1bHb_McUs-p(4mr<43= z1U2iv*7FWRv^n2yqe7448kAsx+H(Kc5&qkTQV(@feA$kjy4T@5C=`>!kD$!Qa9u0K x9PYI|F6p;cr&eRrhvqkZdn$WKMe~1L78fWhS#|Bn!XL6RF)-IJ)Z2ULzW|G7aLNDx diff --git a/assets/images/inpsyde.svg b/assets/images/inpsyde.svg new file mode 100644 index 00000000..e69b8a90 --- /dev/null +++ b/assets/images/inpsyde.svg @@ -0,0 +1 @@ + diff --git a/assets/js/backup-downloader.js b/assets/js/backup-downloader.js new file mode 100644 index 00000000..c12d0be1 --- /dev/null +++ b/assets/js/backup-downloader.js @@ -0,0 +1,393 @@ +window.BWU = window.BWU || {}; + +( function ( $, _, BWU, ajaxurl, tbRemove ) +{ + var downloader; + var decrypter; + var Downloader; + + BWU.Restore = BWU.Restore || {}; + BWU.Restore.Functions = BWU.Restore.Functions || { + + /** + * Remove previously printed messages + */ + removeMessages: function () + { + $( document.body ) + .find( '#bwu_response' ) + .remove(); + }, + + /** + * Print Error Messages + * + * @param {string} message The message to print. + * + * @return {void} + */ + printMessageError: function ( message, container ) + { + + var $container = $( container ); + + if ( !message ) { + return; + } + + this.removeMessages(); + + $container + .append( '

' + message + '

' ); + }, + + /** + * Print Success Messages + * + * @param {string} message The message to print. + * + * @return {void} + */ + printMessageSuccess: function ( message, container ) + { + var $container = $( container ); + + if ( !message ) { + return; + } + + this.removeMessages(); + + $container + .append( '

' + message + '

' ); + }, + + /** + * Load Site + * + * @param {number} id The step to point to. + * @param {string} nonce The value for the nonce. + */ + loadNextStep: function ( id, nonce ) + { + var search = 'step=' + id; + location.replace( + location.origin + location.pathname + '?' + search + '&page=backwpuprestore&backwpup_action_nonce=' + nonce ); + }, + + /** + * Calculate Percentage + * + * @param {number} index The current index of the file extracted. + * @param {number} total The total count of files to extract. + * + * @returns {number} The percentage value + */ + calculatePercentage: function ( index, total ) + { + var value = index / total; + + return Math.round( value * 100 ); + }, + + /** + * Create a constant property + * @param value + * @returns {{value: *, writable: boolean, configurable: boolean, enumerable: boolean}} + */ + makeConstant: function ( value ) + { + return { + value: value, + writable: false, + configurable: false, + enumerable: false + }; + } + }; + BWU.States = BWU.States || Object.create( {}, { + + DONE: BWU.Restore.Functions.makeConstant( 'done' ), + + DOWNLOADING: BWU.Restore.Functions.makeConstant( 'downloading' ), + + NEED_DECRYPTION_KEY: BWU.Restore.Functions.makeConstant( 'need_decryption_key' ) + } ); + + if ( !ajaxurl ) { + // eslint-disable-line + console.warn( 'Missing ajaxurl value.' ); + + return; + } + if ( !( 'EventSource' in window ) ) { + // eslint-disable-line + console.warn( 'Event Source does not exist in this browser' ); + + return; + } + + function destruct () + { + this.closeEventSource(); + this.cleanUi(); + this.decrypter && this.decrypter.destruct(); + } + + function hideElement ( el ) + { + if ( !el ) { + return; + } + + el.style.display = 'none'; + } + + function showElement ( el ) + { + if ( !el ) { + return; + } + + el.style.display = 'block'; + } + + Downloader = { + + showWaitingMessage: function () + { + showElement( this.waitingUi ); + }, + + showProgressUi: function () + { + showElement( this.progressUi ); + }, + + showSuccessMsg: function () + { + showElement( this.successUi ); + }, + + hideWaitingMessage: function () + { + hideElement( this.waitingUi ); + }, + + hideProgressUi: function () + { + hideElement( this.progressUi ); + }, + + hideNotice: function () + { + BWU.Restore.Functions.removeMessages( this.containerUi ); + }, + + hideSuccessMsg: function () + { + hideElement( this.successUi ); + }, + + cleanUi: function () + { + this.hideWaitingMessage(); + this.hideProgressUi(); + this.hideNotice(); + this.hideSuccessMsg(); + this.decrypter && this.decrypter.hide(); + }, + + done: function () + { + this.showSuccessMsg(); + window.location.href = this.currentTarget.dataset.url; + + setTimeout( tbRemove, 3000 ); + }, + + onMessage: function ( message ) + { + var data; + + try { + data = JSON.parse( message.data ); + + switch ( data.state ) { + case BWU.States.DOWNLOADING: + this.cleanUi(); + this.showProgressUi(); + + $( '#progresssteps' ) + .css( { + width: data.download_percent + '%' + } ) + .text( data.download_percent + '%' ); + break; + + case BWU.States.DONE: + this.done( data.message ); + break; + } + } catch ( exc ) { + BWU.Restore.Functions.printMessageError( + exc.message, + this.containerUi + ); + destruct.call( this ); + } + }, + + onError: function ( message ) + { + var data = JSON.parse( message.data ); + + this.closeEventSource(); + + switch ( data.message ) { + case BWU.States.NEED_DECRYPTION_KEY: + this.cleanUi(); + this.decrypter && this.decrypter.needDecryption( data.status ); + break; + default: + BWU.Restore.Functions.printMessageError( data.message, this.containerUi ); + destruct.call( this ); + break; + } + + return this; + }, + + initializeEventSource: function () + { + if ( !_.isUndefined( this.eventSource ) ) { + return; + } + + this.eventSource = new EventSource( + ajaxurl + + '?action=download_backup_file&destination=' + this.currentTarget.dataset.destination + + '&jobid=' + this.currentTarget.dataset.jobid + + '&file=' + this.currentTarget.dataset.file + + '&local_file=' + this.currentTarget.dataset.localFile + + '&backwpup_action_nonce=' + this.currentTarget.dataset.nonce + ); + + this.eventSource.onmessage = this.onMessage; + this.eventSource.addEventListener( 'log', this.onError ); + }, + + closeEventSource: function () + { + if ( _.isUndefined( this.eventSource ) ) { + return; + } + + this.eventSource.close(); + this.eventSource = undefined; + }, + + startDownload: function ( evt ) + { + evt.preventDefault(); + + this.currentTarget = evt.target; + + this.showWaitingMessage(); + this.initializeEventSource(); + }, + + decrypt: function () + { + this.cleanUi(); + this.decrypter && this.decrypter.decrypt( { + backwpup_action_nonce: this.currentTarget.dataset.nonce, + encrypted_file_path: this.currentTarget.dataset.localFile + } ); + }, + + construct: function ( decrypter ) + { + + var containerUi = document.querySelector( '#tb_container' ); + if ( !containerUi ) { + return false; + } + + _.bindAll( + this, + 'showWaitingMessage', + 'hideWaitingMessage', + 'showProgressUi', + 'hideSuccessMsg', + 'showSuccessMsg', + 'done', + 'onMessage', + 'onError', + 'initializeEventSource', + 'closeEventSource', + 'startDownload', + 'addListeners', + 'decrypt', + 'hideNotice', + 'cleanUi', + 'init' + ); + + this.containerUi = containerUi; + this.waitingUi = this.containerUi.querySelector( '#download-file-waiting' ); + this.progressUi = this.containerUi.querySelector( '.progressbar' ); + this.successUi = this.containerUi.querySelector( '#download-file-success' ); + + this.currentTarget = undefined; + this.eventSource = undefined; + this.decrypter = decrypter; + + return this; + }, + + addListeners: function () + { + _.forEach( document.querySelectorAll( '.backup-download-link' ), function ( downloadLink ) + { + downloadLink.addEventListener( 'click', this.startDownload ); + }.bind( this ) ); + + $( '#submit_decrypt_key' ).on( 'click', this.decrypt ); + $( 'body' ).on( 'thickbox:removed', function () + { + destruct.call( this ); + }.bind( this ) ); + + if ( this.decrypter ) { + $( 'body' ).on( this.decrypter.ACTION_DECRYPTION_SUCCESS, this.done ); + } else { + + } + + return this; + }, + + init: function () + { + this.addListeners(); + + return this; + } + }; + + downloader = Object.create( Downloader ); + + if ( !_.isUndefined( BWU.DecrypterFactory ) ) { + decrypter = BWU.DecrypterFactory( + ajaxurl, + document.querySelector( '#decrypt_key' ), + document.querySelector( '#decryption_key' ) + ); + } + + if ( downloader.construct( decrypter ) ) { + downloader.init(); + } + +}( window.jQuery, window._, window.BWU, window.ajaxurl, window.tb_remove ) ); diff --git a/assets/js/backup-downloader.min.js b/assets/js/backup-downloader.min.js new file mode 100644 index 00000000..7a7db32c --- /dev/null +++ b/assets/js/backup-downloader.min.js @@ -0,0 +1,2 @@ +;window.BWU=window.BWU||{};(function(e,s,t,i,d){var n,a,u;t.Restore=t.Restore||{};t.Restore.Functions=t.Restore.Functions||{removeMessages:function(){e(document.body).find('#bwu_response').remove()},printMessageError:function(t,s){var i=e(s);if(!t){return};this.removeMessages();i.append('

'+t+'

')},printMessageSuccess:function(t,s){var i=e(s);if(!t){return};this.removeMessages();i.append('

'+t+'

')},loadNextStep:function(e,t){var s='step='+e;location.replace(location.origin+location.pathname+'?'+s+'&page=backwpuprestore&backwpup_action_nonce='+t)},calculatePercentage:function(e,t){var s=e/t;return Math.round(s*100)},makeConstant:function(e){return{value:e,writable:!1,configurable:!1,enumerable:!1}}};t.States=t.States||Object.create({},{DONE:t.Restore.Functions.makeConstant('done'),DOWNLOADING:t.Restore.Functions.makeConstant('downloading'),NEED_DECRYPTION_KEY:t.Restore.Functions.makeConstant('need_decryption_key')});if(!i){console.warn('Missing ajaxurl value.');return};if(!('EventSource' in window)){console.warn('Event Source does not exist in this browser');return};function r(){this.closeEventSource();this.cleanUi();this.decrypter&&this.decrypter.destruct()};function o(e){if(!e){return};e.style.display='none'};function c(e){if(!e){return};e.style.display='block'};u={showWaitingMessage:function(){c(this.waitingUi)},showProgressUi:function(){c(this.progressUi)},showSuccessMsg:function(){c(this.successUi)},hideWaitingMessage:function(){o(this.waitingUi)},hideProgressUi:function(){o(this.progressUi)},hideNotice:function(){t.Restore.Functions.removeMessages(this.containerUi)},hideSuccessMsg:function(){o(this.successUi)},cleanUi:function(){this.hideWaitingMessage();this.hideProgressUi();this.hideNotice();this.hideSuccessMsg();this.decrypter&&this.decrypter.hide()},done:function(){this.showSuccessMsg();window.location.href=this.currentTarget.dataset.url;setTimeout(d,3000)},onMessage:function(s){var i;try{i=JSON.parse(s.data);switch(i.state){case t.States.DOWNLOADING:this.cleanUi();this.showProgressUi();e('#progresssteps').css({width:i.download_percent+'%'}).text(i.download_percent+'%');break;case t.States.DONE:this.done(i.message);break}}catch(n){t.Restore.Functions.printMessageError(n.message,this.containerUi);r.call(this)}},onError:function(e){var s=JSON.parse(e.data);this.closeEventSource();switch(s.message){case t.States.NEED_DECRYPTION_KEY:this.cleanUi();this.decrypter&&this.decrypter.needDecryption(s.status);break;default:t.Restore.Functions.printMessageError(s.message,this.containerUi);r.call(this);break};return this},initializeEventSource:function(){if(!s.isUndefined(this.eventSource)){return};this.eventSource=new EventSource(i+'?action=download_backup_file&destination='+this.currentTarget.dataset.destination+'&jobid='+this.currentTarget.dataset.jobid+'&file='+this.currentTarget.dataset.file+'&local_file='+this.currentTarget.dataset.localFile+'&backwpup_action_nonce='+this.currentTarget.dataset.nonce);this.eventSource.onmessage=this.onMessage;this.eventSource.addEventListener('log',this.onError)},closeEventSource:function(){if(s.isUndefined(this.eventSource)){return};this.eventSource.close();this.eventSource=undefined},startDownload:function(e){e.preventDefault();this.currentTarget=e.target;this.showWaitingMessage();this.initializeEventSource()},decrypt:function(){this.cleanUi();this.decrypter&&this.decrypter.decrypt({backwpup_action_nonce:this.currentTarget.dataset.nonce,encrypted_file_path:this.currentTarget.dataset.localFile})},construct:function(e){var t=document.querySelector('#tb_container');if(!t){return!1};s.bindAll(this,'showWaitingMessage','hideWaitingMessage','showProgressUi','hideSuccessMsg','showSuccessMsg','done','onMessage','onError','initializeEventSource','closeEventSource','startDownload','addListeners','decrypt','hideNotice','cleanUi','init');this.containerUi=t;this.waitingUi=this.containerUi.querySelector('#download-file-waiting');this.progressUi=this.containerUi.querySelector('.progressbar');this.successUi=this.containerUi.querySelector('#download-file-success');this.currentTarget=undefined;this.eventSource=undefined;this.decrypter=e;return this},addListeners:function(){s.forEach(document.querySelectorAll('.backup-download-link'),function(e){e.addEventListener('click',this.startDownload)}.bind(this));e('#submit_decrypt_key').on('click',this.decrypt);e('body').on('thickbox:removed',function(){r.call(this)}.bind(this));if(this.decrypter){e('body').on(this.decrypter.ACTION_DECRYPTION_SUCCESS,this.done)} +else{};return this},init:function(){this.addListeners();return this}};n=Object.create(u);if(!s.isUndefined(t.DecrypterFactory)){a=t.DecrypterFactory(i,document.querySelector('#decrypt_key'),document.querySelector('#decryption_key'))};if(n.construct(a)){n.init()}}(window.jQuery,window._,window.BWU,window.ajaxurl,window.tb_remove)); \ No newline at end of file diff --git a/assets/js/notice.js b/assets/js/notice.js new file mode 100644 index 00000000..e8fc1e8c --- /dev/null +++ b/assets/js/notice.js @@ -0,0 +1,53 @@ +( function ( _, $, adminpage ) { + + var PromoterNotice = { + + dismiss: function ( evt ) { + evt.preventDefault(); + evt.stopImmediatePropagation(); + + $.post( $( evt.target ).attr( 'href' ), { isAjax: 1 } ); + this.container.remove(); + }, + + construct: function () { + + var container; + + _.bindAll( + this, + 'dismiss', + 'init', + 'addListeners' + ); + + container = document.querySelector( '#backwpup_notice_promoter_notice', { + useCapture: true + } ); + + if ( !container ) { + return false; + } + + this.container = container; + + return this; + }, + + addListeners: function () { + var dismisser = this.container.querySelector( '#backwpup_notice_promoter_dismiss' ); + dismisser && dismisser.addEventListener( 'click', this.dismiss ); + }, + + init: function () { + this.addListeners(); + + return this; + }, + }; + + if ( adminpage === 'toplevel_page_backwpup' ) { + var promoterNotice = Object.create( PromoterNotice ); + promoterNotice.construct() && promoterNotice.init(); + } +}( window._, window.jQuery, window.adminpage ) ); diff --git a/assets/js/notice.min.js b/assets/js/notice.min.js new file mode 100644 index 00000000..b0eefda4 --- /dev/null +++ b/assets/js/notice.min.js @@ -0,0 +1 @@ +(function(t,i,n){var r={dismiss:function(t){t.preventDefault();t.stopImmediatePropagation();i.post(i(t.target).attr('href'),{isAjax:1});this.container.remove()},construct:function(){var i;t.bindAll(this,'dismiss','init','addListeners');i=document.querySelector('#backwpup_notice_promoter_notice',{useCapture:!0});if(!i){return!1};this.container=i;return this},addListeners:function(){var t=this.container.querySelector('#backwpup_notice_promoter_dismiss');t&&t.addEventListener('click',this.dismiss)},init:function(){this.addListeners();return this},};if(n==='toplevel_page_backwpup'){var e=Object.create(r);e.construct()&&e.init()}}(window._,window.jQuery,window.adminpage)); \ No newline at end of file diff --git a/assets/js/page_backups.js b/assets/js/page_backups.js deleted file mode 100644 index 045ce985..00000000 --- a/assets/js/page_backups.js +++ /dev/null @@ -1,115 +0,0 @@ -( function ( $, ajaxurl, tbRemove ) { - - var link; - var eventsource; - var $waiting; - var $generating; - var $privateKey; - var $done; - var $privateKeyInput; - var $privateKeyInvalid; - var $privateKeySubmit; - - if ( !ajaxurl ) { - console.warn( 'Missing ajaxurl value.' ); // eslint-disable-line - - return; - } - if ( !( 'EventSource' in window ) ) { - console.warn( 'Event Source does not exist in this browser' ); // eslint-disable-line - - return; - } - - window.addEventListener( 'load', function () { - $waiting = $( '#download-file-waiting' ); - $generating = $( '#download-file-generating' ); - $privateKey = $( '#download-file-private-key' ); - $done = $( '#download-file-done' ); - $privateKeyInput = $( '#download-file-private-key-input' ); - $privateKeyInvalid = $( '#download-file-private-key-invalid' ); - $privateKeySubmit = $( '#download-file-private-key-button' ); - - $( '.backup-download-link' ).click( function () { - $waiting.show(); - $generating.hide(); - $privateKey.hide(); - $done.hide(); - - link = this; - eventsource = new EventSource( - ajaxurl - + '?action=download_file&destination=' + $( this ).data( 'destination' ) - + '&jobid=' + $( this ).data( 'jobid' ) - + '&file=' + $( this ).data( 'file' ) - + '&local_file=' + $( this ).data( 'localFile' ) - + '&_wpnonce=' + $( this ).data( 'nonce' ) - ); - - eventsource.onmessage = function ( message ) { - var data = JSON.parse( message.data ); - - if ( 'downloading' === data.state ) { - $waiting.hide(); - $generating.show(); - $privateKey.hide(); - $done.hide(); - - // Progress bar - $( '#progresssteps' ) - .css( { - width: data.download_percent + '%' - } ) - .text( data.download_percent + '%' ); - } - - if ( 'need-private-key' === data.state ) { - $waiting.hide(); - $generating.hide(); - $privateKey.show(); - $done.hide(); - $privateKeyInput.focus(); - - if ( 'invalid' === data.status ) { - $privateKeyInvalid.show(); - - return; - } - - $privateKeyInvalid.hide(); - } - - if ( 'done' === data.state ) { - $waiting.hide(); - $generating.hide(); - $privateKey.hide(); - $done.show(); - - eventsource.close(); - - window.location.href = $( link ).data( 'url' ); - - setTimeout( tbRemove, 3000 ); - } - }; - - } ); - - $privateKeySubmit.click( function () { - var data = { - action: 'send_private_key', - privatekey: $privateKeyInput.val(), - }; - - $.post( ajaxurl, data, function ( response ) { - if ( true === response.success ) { - $privateKeyInput.val( '' ); - $privateKeyInvalid.hide(); - $privateKey.hide(); - $generating.show(); - } - } ); - } ); - } ); - -}( window.jQuery, window.ajaxurl, window.tb_remove ) ); diff --git a/assets/js/page_backups.min.js b/assets/js/page_backups.min.js deleted file mode 100644 index 379a2cac..00000000 --- a/assets/js/page_backups.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e,s,c){var w,l,n,i,o,d,t,a,r;if(!s){console.warn('Missing ajaxurl value.');return};if(!('EventSource' in window)){console.warn('Event Source does not exist in this browser');return};window.addEventListener('load',function(){n=e('#download-file-waiting');i=e('#download-file-generating');o=e('#download-file-private-key');d=e('#download-file-done');t=e('#download-file-private-key-input');a=e('#download-file-private-key-invalid');r=e('#download-file-private-key-button');e('.backup-download-link').click(function(){n.show();i.hide();o.hide();d.hide();w=this;l=new EventSource(s+'?action=download_file&destination='+e(this).data('destination')+'&jobid='+e(this).data('jobid')+'&file='+e(this).data('file')+'&local_file='+e(this).data('localFile')+'&_wpnonce='+e(this).data('nonce'));l.onmessage=function(r){var s=JSON.parse(r.data);if('downloading'===s.state){n.hide();i.show();o.hide();d.hide();e('#progresssteps').css({width:s.download_percent+'%'}).text(s.download_percent+'%')};if('need-private-key'===s.state){n.hide();i.hide();o.show();d.hide();t.focus();if('invalid'===s.status){a.show();return};a.hide()};if('done'===s.state){n.hide();i.hide();o.hide();d.show();l.close();window.location.href=e(w).data('url');setTimeout(c,3000)}}});r.click(function(){var n={action:'send_private_key',privatekey:t.val(),};e.post(s,n,function(e){if(!0===e.success){t.val('');a.hide();o.hide();i.show()}})})})}(window.jQuery,window.ajaxurl,window.tb_remove)); \ No newline at end of file diff --git a/assets/js/page_settings.js b/assets/js/page_settings.js index 04664094..5e267c72 100644 --- a/assets/js/page_settings.js +++ b/assets/js/page_settings.js @@ -66,130 +66,4 @@ jQuery( document ).ready( function ( $ ) { $( '.authentication_user' ).show(); } } ); - - if ( $( '#encryption-symmetric' ).is( ':checked' ) ) { - $( '#encryption-key-row' ).show(); - $( '#public-key-row' ).hide(); - } else if ( $( '#encryption-asymmetric' ).is( ':checked' ) ) { - $( '#encryption-key-row' ).hide(); - $( '#public-key-row' ).show(); - } - - $( 'input:radio[name="encryption"]' ).change( function () { - if ( $( this ).val() === "symmetric" ) { - $( '#encryption-key-row' ).show(); - $( '#public-key-row' ).hide(); - } else if ( $( this ).val() === "asymmetric" ) { - $( '#encryption-key-row' ).hide(); - $( '#public-key-row' ).show(); - } - } ); - - $( '#generate-key-button' ).click( function ( e ) { - e.preventDefault(); - e.stopPropagation(); - - // Only run if key is not already set - if ( $( '#encryptionkey' ).val() !== '' ) { - return; - } - - $( '#generate-key-button' ).attr( 'disabled', 'disabled' ); - - var data = { - action : 'generate_key', - _ajax_nonce: $( '#backwpupajaxnonce' ).val(), - }; - - $.post( ajaxurl, data, function ( response ) { - $( '#encryptionkey' ).val( response ); - $( '#encryptionkey' ).focus(); - $( '#key-generation' ).hide(); - } ); - } ); - - $( '#validate-key-button' ).click( function ( e ) { - if ( $( '#publickey' ).val() === '' ) { - e.preventDefault(); - alert( backwpup_vars.no_public_key ); - $( '#publickey' ).focus(); - return false; - } - - // Put focus on private key field after a time, to give time for opening dialog. - setTimeout( function () { - $( '#privatekey' ).focus(); - }, 100 ); - - } ); - - $( '#do-validate' ).click( function () { - if ( $( '#privatekey' ).val() === '' ) { - alert( backwpup_vars.no_private_key ); - $( '#privatekey' ).focus(); - return false; - } - - var data = { - action : 'validate_key', - publickey : $( '#publickey' ).val(), - privatekey : $( '#privatekey' ).val(), - _ajax_nonce: $( '#backwpupajaxnonce' ).val(), - }; - - $.post( ajaxurl, data, function ( response ) { - if ( response === 'valid' ) { - alert( backwpup_vars.public_key_valid ); - tb_remove(); - $( '#publickey' ).focus(); - } else { - alert( backwpup_vars.public_key_invalid ); - } - $( '#privatekey' ).val( '' ); - } ) - .fail( function ( xhr, status, error ) { - alert( error ); - } ); - } ); - - $( '#generate-key-pair-button' ).click( function () { - $( '#key-pair-generating-progress' ).show(); - $( '#key-pair-generating-done' ).hide(); - - var data = { - action : 'generate_key_pair', - _ajax_nonce: $( '#backwpupajaxnonce' ).val() - }; - - $.post( ajaxurl, data, function ( response ) { - $( '#generated-public-key' ).val( response.public_key ); - $( '#generated-public-key-link' ).attr( 'href', 'data:text/plain;base64,' + btoa( response.public_key ) ); - $( '#generated-private-key' ).val( response.private_key ); - $( '#generated-private-key-link' ).attr( 'href', 'data:text/plain;base64,' + btoa( response.private_key ) ); - $( '#key-pair-generating-progress' ).hide(); - $( '#key-pair-generating-done' ).show(); - $( '#generated-public-key' ).focus(); - } ); - - } ); - - var private_key_downloaded = false; - $( '#generated-private-key-link' ).click( function () { - private_key_downloaded = true; - } ); - - $( '#use-key-pair-button' ).click( function () { - if ( private_key_downloaded === false ) { - alert( backwpup_vars.must_download_private_key ); - return false; - } - $( '#publickey' ).val( $( '#generated-public-key' ).val() ); - tb_remove(); - $( '#publickey' ).focus(); - } ); - - setTimeout( function () { - window.scrollTo( 0, 0 ); - }, 1 ); - } ); diff --git a/assets/js/page_settings.min.js b/assets/js/page_settings.min.js index e65b712f..5360bd6d 100644 --- a/assets/js/page_settings.min.js +++ b/assets/js/page_settings.min.js @@ -1,8 +1,5 @@ -;jQuery(document).ready(function(e){var a=e('input[name="anchor"]'),t=e('.nav-tab-wrapper>a'),i=window.location.hash;if(i!==''){i='#'+i.replace('#','')};if(i!==''){a.val(i)};e('.table').addClass('ui-tabs-hide');e(a.val()).removeClass('ui-tabs-hide');if(a.val()==='#backwpup-tab-information'){e('#submit').hide();e('#default_settings').hide()};t.removeClass('nav-tab-active');t.each(function(){if(e(this).attr('href')===a.val()){e(this).addClass('nav-tab-active')}});t.on('click',function(){var i=e(this).attr('href');t.removeClass('nav-tab-active');e(this).addClass('nav-tab-active');e('.table').addClass('ui-tabs-hide');e(i).removeClass('ui-tabs-hide');e('#message').hide();a.val(i);if(i==='#backwpup-tab-information'){e('#submit').hide();e('#default_settings').hide()} -else{e('#submit').show();e('#default_settings').show()};window.location.hash=i;window.scrollTo(0,0);return!1});e('#authentication_method').change(function(){var a=e('#authentication_method').val();if(''===a){e('.authentication_basic').hide();e('.authentication_query_arg').hide();e('.authentication_user').hide()} -else if('basic'===a){e('.authentication_basic').show();e('.authentication_query_arg').hide();e('.authentication_user').hide()} -else if('query_arg'===a){e('.authentication_basic').hide();e('.authentication_query_arg').show();e('.authentication_user').hide()} -else if('user'===a){e('.authentication_basic').hide();e('.authentication_query_arg').hide();e('.authentication_user').show()}});if(e('#encryption-symmetric').is(':checked')){e('#encryption-key-row').show();e('#public-key-row').hide()} -else if(e('#encryption-asymmetric').is(':checked')){e('#encryption-key-row').hide();e('#public-key-row').show()};e('input:radio[name="encryption"]').change(function(){if(e(this).val()==='symmetric'){e('#encryption-key-row').show();e('#public-key-row').hide()} -else if(e(this).val()==='asymmetric'){e('#encryption-key-row').hide();e('#public-key-row').show()}});e('#generate-key-button').click(function(a){a.preventDefault();a.stopPropagation();if(e('#encryptionkey').val()!==''){return};e('#generate-key-button').attr('disabled','disabled');var i={action:'generate_key',_ajax_nonce:e('#backwpupajaxnonce').val(),};e.post(ajaxurl,i,function(a){e('#encryptionkey').val(a);e('#encryptionkey').focus();e('#key-generation').hide()})});e('#validate-key-button').click(function(a){if(e('#publickey').val()===''){a.preventDefault();alert(backwpup_vars.no_public_key);e('#publickey').focus();return!1};setTimeout(function(){e('#privatekey').focus()},100)});e('#do-validate').click(function(){if(e('#privatekey').val()===''){alert(backwpup_vars.no_private_key);e('#privatekey').focus();return!1};var a={action:'validate_key',publickey:e('#publickey').val(),privatekey:e('#privatekey').val(),_ajax_nonce:e('#backwpupajaxnonce').val(),};e.post(ajaxurl,a,function(a){if(a==='valid'){alert(backwpup_vars.public_key_valid);tb_remove();e('#publickey').focus()} -else{alert(backwpup_vars.public_key_invalid)};e('#privatekey').val('')}).fail(function(e,i,a){alert(a)})});e('#generate-key-pair-button').click(function(){e('#key-pair-generating-progress').show();e('#key-pair-generating-done').hide();var a={action:'generate_key_pair',_ajax_nonce:e('#backwpupajaxnonce').val()};e.post(ajaxurl,a,function(a){e('#generated-public-key').val(a.public_key);e('#generated-public-key-link').attr('href','data:text/plain;base64,'+btoa(a.public_key));e('#generated-private-key').val(a.private_key);e('#generated-private-key-link').attr('href','data:text/plain;base64,'+btoa(a.private_key));e('#key-pair-generating-progress').hide();e('#key-pair-generating-done').show();e('#generated-public-key').focus()})});var n=!1;e('#generated-private-key-link').click(function(){n=!0});e('#use-key-pair-button').click(function(){if(n===!1){alert(backwpup_vars.must_download_private_key);return!1};e('#publickey').val(e('#generated-public-key').val());tb_remove();e('#publickey').focus()});setTimeout(function(){window.scrollTo(0,0)},1)}); \ No newline at end of file +;jQuery(document).ready(function(a){var i=a('input[name="anchor"]'),e=a('.nav-tab-wrapper>a'),t=window.location.hash;if(t!==''){t='#'+t.replace('#','')};if(t!==''){i.val(t)};a('.table').addClass('ui-tabs-hide');a(i.val()).removeClass('ui-tabs-hide');if(i.val()==='#backwpup-tab-information'){a('#submit').hide();a('#default_settings').hide()};e.removeClass('nav-tab-active');e.each(function(){if(a(this).attr('href')===i.val()){a(this).addClass('nav-tab-active')}});e.on('click',function(){var t=a(this).attr('href');e.removeClass('nav-tab-active');a(this).addClass('nav-tab-active');a('.table').addClass('ui-tabs-hide');a(t).removeClass('ui-tabs-hide');a('#message').hide();i.val(t);if(t==='#backwpup-tab-information'){a('#submit').hide();a('#default_settings').hide()} +else{a('#submit').show();a('#default_settings').show()};window.location.hash=t;window.scrollTo(0,0);return!1});a('#authentication_method').change(function(){var i=a('#authentication_method').val();if(''===i){a('.authentication_basic').hide();a('.authentication_query_arg').hide();a('.authentication_user').hide()} +else if('basic'===i){a('.authentication_basic').show();a('.authentication_query_arg').hide();a('.authentication_user').hide()} +else if('query_arg'===i){a('.authentication_basic').hide();a('.authentication_query_arg').show();a('.authentication_user').hide()} +else if('user'===i){a('.authentication_basic').hide();a('.authentication_query_arg').hide();a('.authentication_user').show()}})}); \ No newline at end of file diff --git a/backwpup.php b/backwpup.php index d9a21be3..e564c1e7 100644 --- a/backwpup.php +++ b/backwpup.php @@ -5,7 +5,7 @@ * Description: WordPress Backup Plugin * Author: Inpsyde GmbH * Author URI: http://inpsyde.com - * Version: 3.6.3 + * Version: 3.6.4 * Text Domain: backwpup * Domain Path: /languages/ * Network: true @@ -67,12 +67,12 @@ private function __construct() { $this->set_autoloader(); - self::$is_pro = class_exists('BackWPup_Pro', true); + self::$is_pro = class_exists( 'BackWPup_Pro', true ); // Start upgrade if needed if ( get_site_option( 'backwpup_version' ) !== self::get_plugin_data( 'Version' ) - || ! wp_next_scheduled( 'backwpup_check_cleanup' ) - || ! wp_next_scheduled( 'backwpup_update_message' ) ) { + || ! wp_next_scheduled( 'backwpup_check_cleanup' ) + ) { BackWPup_Install::activate(); } @@ -92,7 +92,6 @@ private function __construct() { // Add cron actions add_action( 'backwpup_cron', array( 'BackWPup_Cron', 'run' ) ); add_action( 'backwpup_check_cleanup', array( 'BackWPup_Cron', 'check_cleanup' ) ); - add_action( 'backwpup_update_message', array( 'BackWPup_Cron', 'update_message' ) ); } // If in cron the rest is not needed @@ -117,14 +116,13 @@ private function __construct() { WP_CLI::add_command( 'backwpup', 'BackWPup_WP_CLI' ); } - // Notices and messages in admin - if ( is_admin() && current_user_can( 'backwpup' ) ) { - - $admin_notice = new BackWPup_Admin_Notice(); - $admin_notice->initiate(); - } - if ( ! self::$is_pro ) { + $promoter = new \Inpsyde\BackWPup\Notice\Promoter( + new \Inpsyde\BackWPup\Notice\PromoterUpdater(), + new \Inpsyde\BackWPup\Notice\PromoterView() + ); + $promoter->init(); + $this->home_phone_client_init(); } } @@ -141,8 +139,11 @@ public static function get_instance() { return self::$instance; } - public static function is_pro() - { + /** + * @return bool + */ + public static function is_pro() { + return self::$is_pro; } @@ -176,47 +177,53 @@ public static function get_plugin_data( $name = null ) { } if ( empty( self::$plugin_data ) ) { - self::$plugin_data = get_file_data( - __FILE__, array( - 'name' => 'Plugin Name', - 'version' => 'Version', - ), 'plugin' + self::$plugin_data = get_file_data( + __FILE__, + array( + 'name' => 'Plugin Name', + 'version' => 'Version', + ), + 'plugin' ); self::$plugin_data['name'] = trim( self::$plugin_data['name'] ); //set some extra vars - self::$plugin_data['basename'] = plugin_basename( dirname( __FILE__ ) ); - self::$plugin_data['mainfile'] = __FILE__; + self::$plugin_data['basename'] = plugin_basename( dirname( __FILE__ ) ); + self::$plugin_data['mainfile'] = __FILE__; self::$plugin_data['plugindir'] = untrailingslashit( dirname( __FILE__ ) ); - self::$plugin_data['hash'] = get_site_option( 'backwpup_cfg_hash' ); + self::$plugin_data['hash'] = get_site_option( 'backwpup_cfg_hash' ); if ( empty( self::$plugin_data['hash'] ) || strlen( self::$plugin_data['hash'] ) < 6 - || strlen( - self::$plugin_data['hash'] - ) > 12 ) { + || strlen( + self::$plugin_data['hash'] + ) > 12 ) { self::$plugin_data['hash'] = substr( md5( md5( __FILE__ ) ), 14, 6 ); update_site_option( 'backwpup_cfg_hash', self::$plugin_data['hash'] ); } if ( defined( 'WP_TEMP_DIR' ) && is_dir( WP_TEMP_DIR ) ) { self::$plugin_data['temp'] = str_replace( - '\\', '/', get_temp_dir() - ) . 'backwpup-' . self::$plugin_data['hash'] . '/'; + '\\', + '/', + get_temp_dir() + ) . 'backwpup-' . self::$plugin_data['hash'] . '/'; } else { - $upload_dir = wp_upload_dir(); + $upload_dir = wp_upload_dir(); self::$plugin_data['temp'] = str_replace( - '\\', '/', $upload_dir['basedir'] - ) . '/backwpup-' . self::$plugin_data['hash'] . '-temp/'; + '\\', + '/', + $upload_dir['basedir'] + ) . '/backwpup-' . self::$plugin_data['hash'] . '-temp/'; } self::$plugin_data['running_file'] = self::$plugin_data['temp'] . 'backwpup-working.php'; - self::$plugin_data['url'] = plugins_url( '', __FILE__ ); - self::$plugin_data['cacert'] = apply_filters( - 'backwpup_cacert_bundle', ABSPATH . WPINC . '/certificates/ca-bundle.crt' + self::$plugin_data['url'] = plugins_url( '', __FILE__ ); + self::$plugin_data['cacert'] = apply_filters( + 'backwpup_cacert_bundle', + ABSPATH . WPINC . '/certificates/ca-bundle.crt' ); //get unmodified WP Versions include ABSPATH . WPINC . '/version.php'; /** @var $wp_version string */ self::$plugin_data['wp_version'] = $wp_version; //Build User Agent - self::$plugin_data['user-agent'] = self::$plugin_data['name'] . '/' . self::$plugin_data['version'] . '; WordPress/' . self::$plugin_data['wp_version'] . '; ' . home_url( - ); + self::$plugin_data['user-agent'] = self::$plugin_data['name'] . '/' . self::$plugin_data['version'] . '; WordPress/' . self::$plugin_data['wp_version'] . '; ' . home_url(); } if ( ! empty( $name ) ) { @@ -280,145 +287,146 @@ public static function get_registered_destinations() { //add BackWPup Destinations // to folder self::$registered_destinations['FOLDER'] = array( - 'class' => 'BackWPup_Destination_Folder', - 'info' => array( - 'ID' => 'FOLDER', - 'name' => __( 'Folder', 'backwpup' ), + 'class' => 'BackWPup_Destination_Folder', + 'info' => array( + 'ID' => 'FOLDER', + 'name' => __( 'Folder', 'backwpup' ), 'description' => __( 'Backup to Folder', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '', - 'functions' => array(), - 'classes' => array(), + 'functions' => array(), + 'classes' => array(), ), 'autoload' => array(), ); // backup with mail self::$registered_destinations['EMAIL'] = array( - 'class' => 'BackWPup_Destination_Email', - 'info' => array( - 'ID' => 'EMAIL', - 'name' => __( 'Email', 'backwpup' ), + 'class' => 'BackWPup_Destination_Email', + 'info' => array( + 'ID' => 'EMAIL', + 'name' => __( 'Email', 'backwpup' ), 'description' => __( 'Backup sent via email', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '', - 'functions' => array(), - 'classes' => array(), + 'functions' => array(), + 'classes' => array(), ), 'autoload' => array(), ); // backup to ftp self::$registered_destinations['FTP'] = array( - 'class' => 'BackWPup_Destination_Ftp', - 'info' => array( - 'ID' => 'FTP', - 'name' => __( 'FTP', 'backwpup' ), + 'class' => 'BackWPup_Destination_Ftp', + 'info' => array( + 'ID' => 'FTP', + 'name' => __( 'FTP', 'backwpup' ), 'description' => __( 'Backup to FTP', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'mphp_version' => '', - 'functions' => array( 'ftp_nb_fput' ), - 'classes' => array(), + 'functions' => array( 'ftp_nb_fput' ), + 'classes' => array(), ), 'autoload' => array(), ); // backup to dropbox self::$registered_destinations['DROPBOX'] = array( - 'class' => 'BackWPup_Destination_Dropbox', - 'info' => array( - 'ID' => 'DROPBOX', - 'name' => __( 'Dropbox', 'backwpup' ), + 'class' => 'BackWPup_Destination_Dropbox', + 'info' => array( + 'ID' => 'DROPBOX', + 'name' => __( 'Dropbox', 'backwpup' ), 'description' => __( 'Backup to Dropbox', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '', - 'functions' => array( 'curl_exec' ), - 'classes' => array(), + 'functions' => array( 'curl_exec' ), + 'classes' => array(), ), 'autoload' => array(), ); // Backup to S3 self::$registered_destinations['S3'] = array( - 'class' => 'BackWPup_Destination_S3', - 'info' => array( - 'ID' => 'S3', - 'name' => __( 'S3 Service', 'backwpup' ), + 'class' => 'BackWPup_Destination_S3', + 'info' => array( + 'ID' => 'S3', + 'name' => __( 'S3 Service', 'backwpup' ), 'description' => __( 'Backup to an S3 Service', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '5.3.3', - 'functions' => array( 'curl_exec' ), - 'classes' => array( 'XMLWriter' ), + 'functions' => array( 'curl_exec' ), + 'classes' => array( 'XMLWriter' ), ), 'autoload' => array( - 'Aws\\Common' => dirname( __FILE__ ) . '/vendor', - 'Aws\\S3' => dirname( __FILE__ ) . '/vendor', + 'Aws\\Common' => dirname( __FILE__ ) . '/vendor', + 'Aws\\S3' => dirname( __FILE__ ) . '/vendor', 'Symfony\\Component\\EventDispatcher' => dirname( __FILE__ ) . '/vendor', - 'Guzzle' => dirname( __FILE__ ) . '/vendor', + 'Guzzle' => dirname( __FILE__ ) . '/vendor', ), ); // backup to MS Azure self::$registered_destinations['MSAZURE'] = array( - 'class' => 'BackWPup_Destination_MSAzure', - 'info' => array( - 'ID' => 'MSAZURE', - 'name' => __( 'MS Azure', 'backwpup' ), + 'class' => 'BackWPup_Destination_MSAzure', + 'info' => array( + 'ID' => 'MSAZURE', + 'name' => __( 'MS Azure', 'backwpup' ), 'description' => __( 'Backup to Microsoft Azure (Blob)', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '5.3.2', - 'functions' => array(), - 'classes' => array(), + 'functions' => array(), + 'classes' => array(), ), 'autoload' => array( 'WindowsAzure' => dirname( __FILE__ ) . '/vendor' ), ); // backup to Rackspace Cloud self::$registered_destinations['RSC'] = array( - 'class' => 'BackWPup_Destination_RSC', - 'info' => array( - 'ID' => 'RSC', - 'name' => __( 'RSC', 'backwpup' ), + 'class' => 'BackWPup_Destination_RSC', + 'info' => array( + 'ID' => 'RSC', + 'name' => __( 'RSC', 'backwpup' ), 'description' => __( 'Backup to Rackspace Cloud Files', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '5.4', - 'functions' => array( 'curl_exec' ), - 'classes' => array(), + 'functions' => array( 'curl_exec' ), + 'classes' => array(), ), 'autoload' => array( 'OpenCloud' => dirname( __FILE__ ) . '/vendor', - 'Guzzle' => dirname( __FILE__ ) . '/vendor', - 'Psr' => dirname( __FILE__ ) . '/vendor', + 'Guzzle' => dirname( __FILE__ ) . '/vendor', + 'Psr' => dirname( __FILE__ ) . '/vendor', ), ); // backup to Sugarsync self::$registered_destinations['SUGARSYNC'] = array( - 'class' => 'BackWPup_Destination_SugarSync', - 'info' => array( - 'ID' => 'SUGARSYNC', - 'name' => __( 'SugarSync', 'backwpup' ), + 'class' => 'BackWPup_Destination_SugarSync', + 'info' => array( + 'ID' => 'SUGARSYNC', + 'name' => __( 'SugarSync', 'backwpup' ), 'description' => __( 'Backup to SugarSync', 'backwpup' ), ), 'can_sync' => false, - 'needed' => array( + 'needed' => array( 'php_version' => '', - 'functions' => array( 'curl_exec' ), - 'classes' => array(), + 'functions' => array( 'curl_exec' ), + 'classes' => array(), ), 'autoload' => array(), ); //Hook for adding Destinations like above self::$registered_destinations = apply_filters( - 'backwpup_register_destination', self::$registered_destinations + 'backwpup_register_destination', + self::$registered_destinations ); //check BackWPup Destinations @@ -426,13 +434,17 @@ public static function get_registered_destinations() { self::$registered_destinations[ $dest_key ]['error'] = ''; // check PHP Version if ( ! empty( $dest['needed']['php_version'] ) - && version_compare( - PHP_VERSION, $dest['needed']['php_version'], '<' - ) ) { + && version_compare( + PHP_VERSION, + $dest['needed']['php_version'], + '<' + ) ) { self::$registered_destinations[ $dest_key ]['error'] .= sprintf( - __( 'PHP Version %1$s is to low, you need Version %2$s or above.', 'backwpup' ), - PHP_VERSION, $dest['needed']['php_version'] - ) . ' '; + __( 'PHP Version %1$s is to low, you need Version %2$s or above.', + 'backwpup' ), + PHP_VERSION, + $dest['needed']['php_version'] + ) . ' '; self::$registered_destinations[ $dest_key ]['class'] = null; } //check functions exists @@ -440,8 +452,10 @@ public static function get_registered_destinations() { foreach ( $dest['needed']['functions'] as $function_need ) { if ( ! function_exists( $function_need ) ) { self::$registered_destinations[ $dest_key ]['error'] .= sprintf( - __( 'Missing function "%s".', 'backwpup' ), $function_need - ) . ' '; + __( 'Missing function "%s".', + 'backwpup' ), + $function_need + ) . ' '; self::$registered_destinations[ $dest_key ]['class'] = null; } } @@ -451,8 +465,10 @@ public static function get_registered_destinations() { foreach ( $dest['needed']['classes'] as $class_need ) { if ( ! class_exists( $class_need ) ) { self::$registered_destinations[ $dest_key ]['error'] .= sprintf( - __( 'Missing class "%s".', 'backwpup' ), $class_need - ) . ' '; + __( 'Missing class "%s".', + 'backwpup' ), + $class_need + ) . ' '; self::$registered_destinations[ $dest_key ]['class'] = null; } } @@ -473,11 +489,11 @@ public static function get_job_types() { return self::$job_types; } - self::$job_types['DBDUMP'] = new BackWPup_JobType_DBDump; - self::$job_types['FILE'] = new BackWPup_JobType_File; - self::$job_types['WPEXP'] = new BackWPup_JobType_WPEXP; + self::$job_types['DBDUMP'] = new BackWPup_JobType_DBDump; + self::$job_types['FILE'] = new BackWPup_JobType_File; + self::$job_types['WPEXP'] = new BackWPup_JobType_WPEXP; self::$job_types['WPPLUGIN'] = new BackWPup_JobType_WPPlugin; - self::$job_types['DBCHECK'] = new BackWPup_JobType_DBCheck; + self::$job_types['DBCHECK'] = new BackWPup_JobType_DBCheck; self::$job_types = apply_filters( 'backwpup_job_types', self::$job_types ); @@ -549,11 +565,11 @@ private function home_phone_client_init() { dirname( __FILE__ ) . '/assets/templates/phpnotice', 'backwpup', array( - Inpsyde_PhoneHome_Configuration::ANONYMIZE => true, + Inpsyde_PhoneHome_Configuration::ANONYMIZE => true, Inpsyde_PhoneHome_Configuration::MINIMUM_CAPABILITY => 'manage_options', - Inpsyde_PhoneHome_Configuration::COLLECT_PHP => true, - Inpsyde_PhoneHome_Configuration::COLLECT_WP => true, - Inpsyde_PhoneHome_Configuration::SERVER_ADDRESS => 'https://backwpup.com/wp-json', + Inpsyde_PhoneHome_Configuration::COLLECT_PHP => true, + Inpsyde_PhoneHome_Configuration::COLLECT_WP => true, + Inpsyde_PhoneHome_Configuration::SERVER_ADDRESS => 'https://backwpup.com/wp-json', ) ); } @@ -562,7 +578,7 @@ private function home_phone_client_init() { require_once __DIR__ . '/inc/class-system-requirements.php'; require_once __DIR__ . '/inc/class-system-tests.php'; $system_requirements = new BackWPup_System_Requirements(); - $system_tests = new BackWPup_System_Tests( $system_requirements ); + $system_tests = new BackWPup_System_Tests( $system_requirements ); // Don't activate on anything less than PHP 5.3 or WordPress 3.9 if ( ! $system_tests->is_php_version_compatible() || ! $system_tests->is_wp_version_compatible() ) { diff --git a/changelog.txt b/changelog.txt index e1f4d906..ded537e3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,19 @@ == Changelog == += Version 3.6.4 = +Release Date: Nov, 22, 2018 + +* Fixed: Encrypted backup must force users to download the encryption keys +* Fixed: Warning mime type when a backup is going to be downloaded +* Fixed: Admin Notice in free version is sometimes empty +* Fixed: Random restore error about SQL syntax when restoring a database +* Fixed: Exclude restore directories to be copied during a restore phase +* Fixed: Standalone App has no encryption support +* Fixed: Open basedir, backup dir is not within the allowed path +* Fixed: Unable to download backup file because of mime_content_type function missing in some enviroment +* Tweak: Encryption Settings UI +* Tweak: Minor translations issues +* Tweak: Remove languages files from the free version, the plugin will use translation.wordpress.org + = Version 3.6.3 = Release Date: Nov, 5, 2018 diff --git a/inc/Helper/MimeType.php b/inc/Helper/MimeType.php new file mode 100644 index 00000000..c40c6d22 --- /dev/null +++ b/inc/Helper/MimeType.php @@ -0,0 +1,222 @@ + 'application/zip', + 'gz' => 'application/gzip', + 'bz2' => 'application/x-bzip', + 'tar' => 'application/x-tar', + '3gp' => 'video/3gpp', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'asc' => 'text/plain', + 'atom' => 'application/atom+xml', + 'au' => 'audio/basic', + 'avi' => 'video/x-msvideo', + 'bcpio' => 'application/x-bcpio', + 'bin' => 'application/octet-stream', + 'bmp' => 'image/bmp', + 'cdf' => 'application/x-netcdf', + 'cgm' => 'image/cgm', + 'class' => 'application/octet-stream', + 'cpio' => 'application/x-cpio', + 'cpt' => 'application/mac-compactpro', + 'csh' => 'application/x-csh', + 'css' => 'text/css', + 'dcr' => 'application/x-director', + 'dif' => 'video/x-dv', + 'dir' => 'application/x-director', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/octet-stream', + 'dmg' => 'application/octet-stream', + 'dms' => 'application/octet-stream', + 'doc' => 'application/msword', + 'dtd' => 'application/xml-dtd', + 'dv' => 'video/x-dv', + 'dvi' => 'application/x-dvi', + 'dxr' => 'application/x-director', + 'eps' => 'application/postscript', + 'etx' => 'text/x-setext', + 'exe' => 'application/octet-stream', + 'ez' => 'application/andrew-inset', + 'flv' => 'video/x-flv', + 'gif' => 'image/gif', + 'gram' => 'application/srgs', + 'grxml' => 'application/srgs+xml', + 'gtar' => 'application/x-gtar', + 'hdf' => 'application/x-hdf', + 'hqx' => 'application/mac-binhex40', + 'htm' => 'text/html', + 'html' => 'text/html', + 'ice' => 'x-conference/x-cooltalk', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'iges' => 'model/iges', + 'igs' => 'model/iges', + 'jnlp' => 'application/x-java-jnlp-file', + 'jp2' => 'image/jp2', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'application/x-javascript', + 'kar' => 'audio/midi', + 'latex' => 'application/x-latex', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'm3u' => 'audio/x-mpegurl', + 'm4a' => 'audio/mp4a-latm', + 'm4p' => 'audio/mp4a-latm', + 'm4u' => 'video/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'mac' => 'image/x-macpaint', + 'man' => 'application/x-troff-man', + 'mathml' => 'application/mathml+xml', + 'me' => 'application/x-troff-me', + 'mesh' => 'model/mesh', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mif' => 'application/vnd.mif', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpga' => 'audio/mpeg', + 'ms' => 'application/x-troff-ms', + 'msh' => 'model/mesh', + 'mxu' => 'video/vnd.mpegurl', + 'nc' => 'application/x-netcdf', + 'oda' => 'application/oda', + 'ogg' => 'application/ogg', + 'ogv' => 'video/ogv', + 'pbm' => 'image/x-portable-bitmap', + 'pct' => 'image/pict', + 'pdb' => 'chemical/x-pdb', + 'pdf' => 'application/pdf', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pic' => 'image/pict', + 'pict' => 'image/pict', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'pnt' => 'image/x-macpaint', + 'pntg' => 'image/x-macpaint', + 'ppm' => 'image/x-portable-pixmap', + 'ppt' => 'application/vnd.ms-powerpoint', + 'ps' => 'application/postscript', + 'qt' => 'video/quicktime', + 'qti' => 'image/x-quicktime', + 'qtif' => 'image/x-quicktime', + 'ra' => 'audio/x-pn-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'ras' => 'image/x-cmu-raster', + 'rdf' => 'application/rdf+xml', + 'rgb' => 'image/x-rgb', + 'rm' => 'application/vnd.rn-realmedia', + 'roff' => 'application/x-troff', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'silo' => 'model/mesh', + 'sit' => 'application/x-stuffit', + 'skd' => 'application/x-koan', + 'skm' => 'application/x-koan', + 'skp' => 'application/x-koan', + 'skt' => 'application/x-koan', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'snd' => 'audio/basic', + 'so' => 'application/octet-stream', + 'spl' => 'application/x-futuresplash', + 'src' => 'application/x-wais-source', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svg' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 't' => 'application/x-troff', + 'tcl' => 'application/x-tcl', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tr' => 'application/x-troff', + 'tsv' => 'text/tab-separated-values', + 'txt' => 'text/plain', + 'ustar' => 'application/x-ustar', + 'vcd' => 'application/x-cdlink', + 'vrml' => 'model/vrml', + 'vxml' => 'application/voicexml+xml', + 'wav' => 'audio/x-wav', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbxml' => 'application/vnd.wap.wbxml', + 'webm' => 'video/webm', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wrl' => 'model/vrml', + 'xbm' => 'image/x-xbitmap', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xls' => 'application/vnd.ms-excel', + 'xml' => 'application/xml', + 'xpm' => 'image/x-xpixmap', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + ); + + public static function from_file_path( $file ) { + + if ( is_dir( $file ) || is_link( $file ) ) { + return self::DEFAULT_MIME_TYPE; + } + if ( ! is_readable( $file ) ) { + return self::DEFAULT_MIME_TYPE; + } + + $filesuffix = pathinfo( $file, PATHINFO_EXTENSION ); + $suffix = strtolower( $filesuffix ); + + if ( isset( self::$mime_types[ $suffix ] ) ) { + return self::$mime_types[ $suffix ]; + } + + $mime_type = ''; + if ( function_exists( 'fileinfo' ) ) { + $finfo = finfo_open( FILEINFO_MIME_TYPE ); + $mime_type = finfo_file( $finfo, $file ); + } + if ( ! $mime_type && function_exists( 'mime_content_type' ) ) { + $mime_type = mime_content_type( $file ); + } + if ( $mime_type ) { + return $mime_type; + } + + return self::DEFAULT_MIME_TYPE; + } +} diff --git a/inc/class-dismissible-notice-option.php b/inc/Notice/DismissibleNoticeOption.php similarity index 82% rename from inc/class-dismissible-notice-option.php rename to inc/Notice/DismissibleNoticeOption.php index 2213be2e..2fd04e89 100644 --- a/inc/class-dismissible-notice-option.php +++ b/inc/Notice/DismissibleNoticeOption.php @@ -1,9 +1,8 @@ array(), 'blog' => array() ); + private static $setup = array( + 'sitewide' => array(), + 'blog' => array(), + ); - private static $all_actions = array( self::FOR_GOOD_ACTION, self::FOR_NOW_ACTION, self::FOR_USER_FOR_GOOD_ACTION ); + private static $all_actions = array( + self::FOR_GOOD_ACTION, + self::FOR_NOW_ACTION, + self::FOR_USER_FOR_GOOD_ACTION, + ); /** * @var bool @@ -21,7 +27,7 @@ class BackWPup_Dismissible_Notice_Option { private $sitewide; /** - * @param bool $sitewide + * @param bool $sitewide * @param string $notice_id * @param string $capability */ @@ -40,7 +46,7 @@ public static function setup_actions( $sitewide, $notice_id, $capability = 'read } if ( self::$setup[ $key ] === array() ) { - $option = new BackWPup_Dismissible_Notice_Option( $sitewide ); + $option = new self( $sitewide ); add_action( 'admin_post_' . self::FOR_GOOD_ACTION, array( $option, 'dismiss' ) ); add_action( 'admin_post_' . self::FOR_NOW_ACTION, array( $option, 'dismiss' ) ); add_action( 'admin_post_' . self::FOR_USER_FOR_GOOD_ACTION, array( $option, 'dismiss' ) ); @@ -63,8 +69,8 @@ public static function dismiss_action_url( $notice_id, $action ) { array( 'action' => $action, 'notice' => $notice_id, - 'blog' => get_current_blog_id(), - $action => wp_create_nonce( $action ), + 'blog' => get_current_blog_id(), + $action => wp_create_nonce( $action ), ), admin_url( 'admin-post.php' ) ); @@ -74,6 +80,7 @@ public static function dismiss_action_url( $notice_id, $action ) { * @param bool $sitewide */ public function __construct( $sitewide = false ) { + $this->sitewide = $sitewide; } @@ -101,7 +108,7 @@ public function is_dismissed( $notice_id ) { // Dismissed for now for user? $transient_name = self::OPTION_PREFIX . $notice_id . get_current_user_id(); - $transient = $this->sitewide ? get_site_transient( $transient_name ) : get_transient( $transient_name ); + $transient = $this->sitewide ? get_site_transient( $transient_name ) : get_transient( $transient_name ); return (bool) $transient; } @@ -116,16 +123,16 @@ public function dismiss() { $end_request = true; switch ( $action ) { - case self::FOR_GOOD_ACTION : + case self::FOR_GOOD_ACTION: $this->dismiss_for_good( $notice_id ); break; - case self::FOR_USER_FOR_GOOD_ACTION : + case self::FOR_USER_FOR_GOOD_ACTION: $this->dismiss_for_user_for_good( $notice_id ); break; - case self::FOR_NOW_ACTION : + case self::FOR_NOW_ACTION: $this->dismiss_for_now( $notice_id ); break; - case self::SKIP : + case self::SKIP: $end_request = false; break; } @@ -170,7 +177,7 @@ private function dismiss_for_user_for_good( $notice_id ) { private function dismiss_for_now( $notice_id ) { $transient_name = self::OPTION_PREFIX . $notice_id . get_current_user_id(); - $expiration = 12 * HOUR_IN_SECONDS; + $expiration = 12 * HOUR_IN_SECONDS; $this->sitewide ? set_site_transient( $transient_name, 1, $expiration ) @@ -209,7 +216,7 @@ private function assert_allowed() { $definition = array( 'action' => FILTER_SANITIZE_STRING, 'notice' => FILTER_SANITIZE_STRING, - 'blog' => FILTER_SANITIZE_NUMBER_INT, + 'blog' => FILTER_SANITIZE_NUMBER_INT, 'isAjax' => FILTER_VALIDATE_BOOLEAN, ); @@ -218,9 +225,9 @@ private function assert_allowed() { array_filter( (array) filter_input_array( INPUT_POST, $definition ) ) ); - $is_ajax = ! empty( $data[ 'isAjax' ] ); - $action = empty( $data[ 'action' ] ) ? '' : $data[ 'action' ]; - $notice = empty( $data[ 'notice' ] ) ? '' : $data[ 'notice' ]; + $is_ajax = ! empty( $data['isAjax'] ); + $action = empty( $data['action'] ) ? '' : $data['action']; + $notice = empty( $data['notice'] ) ? '' : $data['notice']; if ( ! $action @@ -231,8 +238,8 @@ private function assert_allowed() { $this->end_request( $is_ajax ); } - $key = $this->sitewide ? 'sitewide' : 'blog'; - $swap_key = $this->sitewide ? 'blog' : 'sitewide'; + $key = $this->sitewide ? 'sitewide' : 'blog'; + $swap_key = $this->sitewide ? 'blog' : 'sitewide'; $capability = empty( self::$setup[ $key ][ $notice ] ) ? '' : self::$setup[ $key ][ $notice ]; if ( ! $capability && ! empty( self::$setup[ $swap_key ][ $notice ] ) ) { @@ -252,7 +259,7 @@ private function assert_allowed() { if ( ! $this->sitewide - && ( empty( $data[ 'blog' ] ) || (int) get_current_blog_id() !== (int) $data[ 'blog' ] ) + && ( empty( $data['blog'] ) || get_current_blog_id() !== (int) $data['blog'] ) ) { $this->end_request( $is_ajax ); } @@ -260,4 +267,4 @@ private function assert_allowed() { return array( $action, $notice, $is_ajax ); } -} \ No newline at end of file +} diff --git a/inc/Notice/Promoter.php b/inc/Notice/Promoter.php new file mode 100644 index 00000000..3d726eab --- /dev/null +++ b/inc/Notice/Promoter.php @@ -0,0 +1,146 @@ +updater = $updater; + $this->view = $view; + } + + /** + * Initialize + */ + public function init() { + + if ( ! is_admin() || ! current_user_can( self::CAPABILITY ) ) { + return; + } + + add_action( 'backwpup_admin_messages', array( $this, 'notice' ), 20 ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + DismissibleNoticeOption::setup_actions( true, self::ID, self::CAPABILITY ); + } + + /** + * Enqueue Scripts + */ + public function enqueue_scripts() { + + $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; + + wp_enqueue_script( + 'backwpup-notice-promoter', + untrailingslashit( \BackWPup::get_plugin_data( 'URL' ) ) . "/assets/js/notice{$suffix}.js", + array( 'underscore', 'jquery' ), + filemtime( untrailingslashit( \BackWPup::get_plugin_data( 'plugindir' ) . "/assets/js/notice{$suffix}.js" ) ), + true + ); + } + + /** + * Print Notice + */ + public function notice() { + + $screen_id = get_current_screen()->id; + if ( ! in_array( $screen_id, self::$main_admin_page_ids, true ) || ! $this->should_display() ) { + return; + } + + $message = $this->message(); + if ( ! $message->content() ) { + return; + } + + $dismiss_action_url = DismissibleNoticeOption::dismiss_action_url( + Promoter::ID, + DismissibleNoticeOption::FOR_USER_FOR_GOOD_ACTION + ); + + $this->view->notice( $message, $dismiss_action_url ); + } + + /** + * @return bool|string + */ + private function locale_code() { + + return substr( get_locale(), 0, 2 ); + } + + /** + * @return \Inpsyde\BackWPup\Notice\PromoterMessage + */ + private function message() { + + $language = self::DEFAULT_LANGUAGE; + $locale_code = $this->locale_code(); + + $data_message = is_multisite() + ? get_site_transient( self::OPTION_NAME ) + : get_transient( self::OPTION_NAME ); + + $data_message = array_filter( (array) $data_message ); + + if ( ! $data_message ) { + add_action( 'shutdown', array( $this->updater, 'update' ) ); + } + + if ( isset( $data_message[ $locale_code ] ) ) { + $language = $locale_code; + } + + $data_message = isset( $data_message[ $language ] ) ? $data_message[ $language ] : array(); + + return new PromoterMessage( $data_message ); + } + + /** + * @return bool + */ + private function should_display() { + + $option = new DismissibleNoticeOption( true ); + + return false === (bool) $option->is_dismissed( self::ID ); + } +} diff --git a/inc/Notice/PromoterMessage.php b/inc/Notice/PromoterMessage.php new file mode 100644 index 00000000..6e5d4215 --- /dev/null +++ b/inc/Notice/PromoterMessage.php @@ -0,0 +1,70 @@ + '', + 'button-text' => '', + 'url' => '', + ); + } + + /** + * PromoterMessage constructor + * + * @see defaults() + * @param array $data + */ + public function __construct( array $data ) { + + $data = wp_parse_args( $data, self::defaults() ); + + $this->content = $data['content']; + $this->button_label = $data['button-text']; + $this->cta_url = $data['url']; + } + + /** + * @param $name + * @param $args + * + * @return string + */ + public function __call( $name, $args ) { + + if ( ! property_exists( $this, $name ) ) { + return ''; + } + + return $this->$name; + } +} diff --git a/inc/Notice/PromoterUpdater.php b/inc/Notice/PromoterUpdater.php new file mode 100644 index 00000000..41536141 --- /dev/null +++ b/inc/Notice/PromoterUpdater.php @@ -0,0 +1,49 @@ + $remote_data ) { + $data[ $language ] = wp_parse_args( + $remote_data, + PromoterMessage::defaults() + ); + } + + is_multisite() ? + set_site_transient( + Promoter::OPTION_NAME, + $data, + DAY_IN_SECONDS + ) : + set_transient( + Promoter::OPTION_NAME, + $data, + DAY_IN_SECONDS + ); + } +} diff --git a/inc/Notice/PromoterView.php b/inc/Notice/PromoterView.php new file mode 100644 index 00000000..47e8033f --- /dev/null +++ b/inc/Notice/PromoterView.php @@ -0,0 +1,46 @@ + + +
+

+ content() ) ?> +

+

+ + button_label() ) ?> + + + + + +

+
+ has_displayed = false; - $language = substr( get_locale(), 0, 2 ); - - // Check if message exists in given language - if ( ! get_site_option( "backwpup_message_id_$language" ) ) { - // Default to English - $language = 'en'; - } - $this->id = get_site_option( "backwpup_message_id_$language" ); - $this->content = get_site_option( "backwpup_message_content_$language" ); - $this->button_text = get_site_option( "backwpup_message_button_text_$language" ); - $this->button_url = get_site_option( "backwpup_message_url_$language" ); - } - - public function initiate() { - add_action( 'backwpup_admin_messages', array( $this, 'dashboard_message' ), 20 ); - BackWPup_Dismissible_Notice_Option::setup_actions( - false, - $this->id, - 'backwpup' - ); - } - - /** - * Display a notice in BackWPup admin dashboard. - */ - public function dashboard_message() { - - $screen_id = get_current_screen()->id; - if ( ! $this->has_displayed && in_array( $screen_id, self::$main_admin_page_ids, true ) - && $this->should_display() ) { - $done = true; - ?> -
-
- widget_markup() ?> -
-
- should_show ) ) { - if ( class_exists( 'BackWPup_Pro', false ) ) { - $this->should_show = false; - } else { - $option = new BackWPup_Dismissible_Notice_Option( true ); - $this->should_show = ! $option->is_dismissed( $this->id ); - } - } - - return $this->should_show; - } - - /** - * The markup for the admin page message. - * - * @return string - */ - private function widget_markup() { - - $dismiss_url = BackWPup_Dismissible_Notice_Option::dismiss_action_url( - $this->id, - BackWPup_Dismissible_Notice_Option::FOR_USER_FOR_GOOD_ACTION - ); - - ob_start(); - ?>

content ) ?>

-

- - button_text ?> - - - - - -

-
- - settings = new BackWPup_Page_Settings( + $settings_views, + $settings_updaters + ); + //Load text domain BackWPup::load_text_domain(); @@ -118,7 +146,7 @@ public static function init_general() { * Add Message (across site loadings) * * @param string $message string Message test. - * @param bool $error bool ist it a error message. + * @param bool $error bool ist it a error message. */ public static function message( $message, $error = false ) { @@ -162,9 +190,9 @@ public static function display_messages( $echo = true ) { do_action( 'backwpup_admin_messages' ); $message_updated = ''; - $message_error = ''; - $saved_message = self::get_messages(); - $message_id = ' id="message"'; + $message_error = ''; + $saved_message = self::get_messages(); + $message_id = ' id="message"'; if ( empty( $saved_message ) ) { return ''; @@ -185,7 +213,7 @@ public static function display_messages( $echo = true ) { if ( ! empty( $message_updated ) ) { $message_updated = '' . $message_updated . ''; - $message_id = ''; + $message_id = ''; } if ( ! empty( $message_error ) ) { $message_error = '' . $message_error . ''; @@ -203,53 +231,49 @@ public static function display_messages( $echo = true ) { */ public function admin_init() { - //only add action if ajax call - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && defined( 'WP_ADMIN' ) && WP_ADMIN ) { - //ajax calls - add_action( 'wp_ajax_backwpup_working', array( 'BackWPup_Page_Jobs', 'ajax_working' ) ); - add_action( 'wp_ajax_backwpup_cron_text', array( 'BackWPup_Page_Editjob', 'ajax_cron_text' ) ); - //ajax or view logs - add_action( 'wp_ajax_backwpup_view_log', array( 'BackWPup_Page_Logs', 'ajax_view_log' ) ); - // Ajax for encryption - add_action( - 'wp_ajax_generate_key', - array( 'BackWPup_Page_Settings', 'ajax_generate_key' ) - ); - add_action( - 'wp_ajax_validate_key', - array( 'BackWPup_Page_Settings', 'ajax_validate_key' ) - ); - add_action( - 'wp_ajax_generate_key_pair', - array( 'BackWPup_Page_Settings', 'ajax_generate_key_pair' ) - ); - add_action( - 'wp_ajax_download_file', - array( 'BackWPup_Page_Backups', 'ajax_download_file' ) - ); - add_action( - 'wp_ajax_send_private_key', - array( 'BackWPup_Page_Backups', 'ajax_send_private_key' ) - ); - //ajax calls for job types - if ( $jobtypes = BackWPup::get_job_types() ) { - foreach ( $jobtypes as $id => $jobtypeclass ) { - add_action( 'wp_ajax_backwpup_jobtype_' . strtolower( $id ), array( $jobtypeclass, 'edit_ajax' ) ); - } - } - //ajax calls for destinations - if ( $dests = BackWPup::get_registered_destinations() ) { - foreach ( $dests as $id => $dest ) { - if ( ! empty( $dest['class'] ) ) { - add_action( 'wp_ajax_backwpup_dest_' . strtolower( $id ), array( - BackWPup::get_destination( $id ), - 'edit_ajax', - ) ); - } - } + if ( ! is_admin() ) { + return; + } + if ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) { + return; + } + + $jobtypes = BackWPup::get_job_types(); + $destinations = BackWPup::get_registered_destinations(); + + add_action( 'wp_ajax_backwpup_working', array( 'BackWPup_Page_Jobs', 'ajax_working' ) ); + add_action( 'wp_ajax_backwpup_cron_text', array( 'BackWPup_Page_Editjob', 'ajax_cron_text' ) ); + add_action( 'wp_ajax_backwpup_view_log', array( 'BackWPup_Page_Logs', 'ajax_view_log' ) ); + add_action( 'wp_ajax_download_backup_file', array( 'BackWPup_Destination_Downloader', 'download_by_ajax' ) ); + + foreach ( $jobtypes as $id => $jobtypeclass ) { + add_action( 'wp_ajax_backwpup_jobtype_' . strtolower( $id ), array( $jobtypeclass, 'edit_ajax' ) ); + } + + foreach ( $destinations as $id => $dest ) { + if ( ! empty( $dest['class'] ) ) { + add_action( + 'wp_ajax_backwpup_dest_' . strtolower( $id ), + array( + BackWPup::get_destination( $id ), + 'edit_ajax', + ) + ); } } + if ( \BackWPup::is_pro() ) { + $this->admin_init_pro(); + } + } + + private function admin_init_pro() { + + $ajax_encryption_key_handler = new Settings\AjaxEncryptionKeyHandler( + new \phpseclib\Crypt\RSA() + ); + + add_action( 'wp_ajax_encrypt_key_handler', array( $ajax_encryption_key_handler, 'handle' ) ); } /** @@ -264,7 +288,8 @@ public function admin_init() { public function plugin_links( $links, $file ) { if ( $file == plugin_basename( BackWPup::get_plugin_data( 'MainFile' ) ) ) { - $links[] = '' . __( 'Documentation', 'backwpup' ) . ''; + $links[] = '' . __( 'Documentation', + 'backwpup' ) . ''; } return $links; @@ -275,20 +300,31 @@ public function plugin_links( $links, $file ) { */ public function admin_menu() { - add_menu_page( BackWPup::get_plugin_data( 'name' ), BackWPup::get_plugin_data( 'name' ), 'backwpup', 'backwpup', array( - 'BackWPup_Page_BackWPup', - 'page', - ), 'div' ); - $this->page_hooks['backwpup'] = add_submenu_page( 'backwpup', __( 'BackWPup Dashboard', 'backwpup' ), __( 'Dashboard', 'backwpup' ), 'backwpup', 'backwpup', array( - 'BackWPup_Page_BackWPup', - 'page', - ) ); + add_menu_page( BackWPup::get_plugin_data( 'name' ), + BackWPup::get_plugin_data( 'name' ), + 'backwpup', + 'backwpup', + array( + 'BackWPup_Page_BackWPup', + 'page', + ), + 'div' ); + $this->page_hooks['backwpup'] = add_submenu_page( 'backwpup', + __( 'BackWPup Dashboard', 'backwpup' ), + __( 'Dashboard', 'backwpup' ), + 'backwpup', + 'backwpup', + array( + 'BackWPup_Page_BackWPup', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpup'], array( 'BackWPup_Admin', 'init_general' ) ); add_action( 'load-' . $this->page_hooks['backwpup'], array( 'BackWPup_Page_BackWPup', 'load' ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpup'], array( - 'BackWPup_Page_BackWPup', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpup'], + array( + 'BackWPup_Page_BackWPup', + 'admin_print_scripts', + ) ); //Add pages form plugins $this->page_hooks = apply_filters( 'backwpup_admin_pages', $this->page_hooks ); @@ -302,20 +338,27 @@ public function admin_menu() { */ public function admin_page_jobs( $page_hooks ) { - $this->page_hooks['backwpupjobs'] = add_submenu_page( 'backwpup', __( 'Jobs', 'backwpup' ), __( 'Jobs', 'backwpup' ), 'backwpup_jobs', 'backwpupjobs', array( - 'BackWPup_Page_Jobs', - 'page', - ) ); + $this->page_hooks['backwpupjobs'] = add_submenu_page( 'backwpup', + __( 'Jobs', 'backwpup' ), + __( 'Jobs', 'backwpup' ), + 'backwpup_jobs', + 'backwpupjobs', + array( + 'BackWPup_Page_Jobs', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpupjobs'], array( 'BackWPup_Admin', 'init_general' ) ); add_action( 'load-' . $this->page_hooks['backwpupjobs'], array( 'BackWPup_Page_Jobs', 'load' ) ); - add_action( 'admin_print_styles-' . $this->page_hooks['backwpupjobs'], array( - 'BackWPup_Page_Jobs', - 'admin_print_styles', - ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupjobs'], array( - 'BackWPup_Page_Jobs', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_styles-' . $this->page_hooks['backwpupjobs'], + array( + 'BackWPup_Page_Jobs', + 'admin_print_styles', + ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupjobs'], + array( + 'BackWPup_Page_Jobs', + 'admin_print_scripts', + ) ); return $page_hooks; } @@ -327,20 +370,27 @@ public function admin_page_jobs( $page_hooks ) { */ public function admin_page_editjob( $page_hooks ) { - $this->page_hooks['backwpupeditjob'] = add_submenu_page( 'backwpup', __( 'Add new job', 'backwpup' ), __( 'Add new job', 'backwpup' ), 'backwpup_jobs_edit', 'backwpupeditjob', array( - 'BackWPup_Page_Editjob', - 'page', - ) ); + $this->page_hooks['backwpupeditjob'] = add_submenu_page( 'backwpup', + __( 'Add new job', 'backwpup' ), + __( 'Add new job', 'backwpup' ), + 'backwpup_jobs_edit', + 'backwpupeditjob', + array( + 'BackWPup_Page_Editjob', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpupeditjob'], array( 'BackWPup_Admin', 'init_general' ) ); add_action( 'load-' . $this->page_hooks['backwpupeditjob'], array( 'BackWPup_Page_Editjob', 'auth' ) ); - add_action( 'admin_print_styles-' . $this->page_hooks['backwpupeditjob'], array( - 'BackWPup_Page_Editjob', - 'admin_print_styles', - ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupeditjob'], array( - 'BackWPup_Page_Editjob', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_styles-' . $this->page_hooks['backwpupeditjob'], + array( + 'BackWPup_Page_Editjob', + 'admin_print_styles', + ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupeditjob'], + array( + 'BackWPup_Page_Editjob', + 'admin_print_scripts', + ) ); return $page_hooks; } @@ -352,20 +402,27 @@ public function admin_page_editjob( $page_hooks ) { */ public function admin_page_logs( $page_hooks ) { - $this->page_hooks['backwpuplogs'] = add_submenu_page( 'backwpup', __( 'Logs', 'backwpup' ), __( 'Logs', 'backwpup' ), 'backwpup_logs', 'backwpuplogs', array( - 'BackWPup_Page_Logs', - 'page', - ) ); + $this->page_hooks['backwpuplogs'] = add_submenu_page( 'backwpup', + __( 'Logs', 'backwpup' ), + __( 'Logs', 'backwpup' ), + 'backwpup_logs', + 'backwpuplogs', + array( + 'BackWPup_Page_Logs', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpuplogs'], array( 'BackWPup_Admin', 'init_general' ) ); add_action( 'load-' . $this->page_hooks['backwpuplogs'], array( 'BackWPup_Page_Logs', 'load' ) ); - add_action( 'admin_print_styles-' . $this->page_hooks['backwpuplogs'], array( - 'BackWPup_Page_Logs', - 'admin_print_styles', - ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpuplogs'], array( - 'BackWPup_Page_Logs', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_styles-' . $this->page_hooks['backwpuplogs'], + array( + 'BackWPup_Page_Logs', + 'admin_print_styles', + ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpuplogs'], + array( + 'BackWPup_Page_Logs', + 'admin_print_scripts', + ) ); return $page_hooks; } @@ -377,20 +434,27 @@ public function admin_page_logs( $page_hooks ) { */ public function admin_page_backups( $page_hooks ) { - $this->page_hooks['backwpupbackups'] = add_submenu_page( 'backwpup', __( 'Backups', 'backwpup' ), __( 'Backups', 'backwpup' ), 'backwpup_backups', 'backwpupbackups', array( - 'BackWPup_Page_Backups', - 'page', - ) ); + $this->page_hooks['backwpupbackups'] = add_submenu_page( 'backwpup', + __( 'Backups', 'backwpup' ), + __( 'Backups', 'backwpup' ), + 'backwpup_backups', + 'backwpupbackups', + array( + 'BackWPup_Page_Backups', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpupbackups'], array( 'BackWPup_Admin', 'init_general' ) ); add_action( 'load-' . $this->page_hooks['backwpupbackups'], array( 'BackWPup_Page_Backups', 'load' ) ); - add_action( 'admin_print_styles-' . $this->page_hooks['backwpupbackups'], array( - 'BackWPup_Page_Backups', - 'admin_print_styles', - ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupbackups'], array( - 'BackWPup_Page_Backups', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_styles-' . $this->page_hooks['backwpupbackups'], + array( + 'BackWPup_Page_Backups', + 'admin_print_styles', + ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupbackups'], + array( + 'BackWPup_Page_Backups', + 'admin_print_scripts', + ) ); return $page_hooks; } @@ -402,15 +466,19 @@ public function admin_page_backups( $page_hooks ) { */ public function admin_page_settings( $page_hooks ) { - $this->page_hooks['backwpupsettings'] = add_submenu_page( 'backwpup', __( 'Settings', 'backwpup' ), __( 'Settings', 'backwpup' ), 'backwpup_settings', 'backwpupsettings', array( - 'BackWPup_Page_Settings', - 'page', - ) ); + $this->page_hooks['backwpupsettings'] = add_submenu_page( + 'backwpup', + esc_html__( 'Settings', 'backwpup' ), + esc_html__( 'Settings', 'backwpup' ), + 'backwpup_settings', + 'backwpupsettings', + array( $this->settings, 'page' ) + ); add_action( 'load-' . $this->page_hooks['backwpupsettings'], array( 'BackWPup_Admin', 'init_general' ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupsettings'], array( - 'BackWPup_Page_Settings', - 'admin_print_scripts', - ) ); + add_action( + 'admin_print_scripts-' . $this->page_hooks['backwpupsettings'], + array( $this->settings, 'admin_print_scripts' ) + ); return $page_hooks; } @@ -422,19 +490,26 @@ public function admin_page_settings( $page_hooks ) { */ public function admin_page_about( $page_hooks ) { - $this->page_hooks['backwpupabout'] = add_submenu_page( 'backwpup', __( 'About', 'backwpup' ), __( 'About', 'backwpup' ), 'backwpup', 'backwpupabout', array( - 'BackWPup_Page_About', - 'page', - ) ); + $this->page_hooks['backwpupabout'] = add_submenu_page( 'backwpup', + __( 'About', 'backwpup' ), + __( 'About', 'backwpup' ), + 'backwpup', + 'backwpupabout', + array( + 'BackWPup_Page_About', + 'page', + ) ); add_action( 'load-' . $this->page_hooks['backwpupabout'], array( 'BackWPup_Admin', 'init_general' ) ); - add_action( 'admin_print_styles-' . $this->page_hooks['backwpupabout'], array( - 'BackWPup_Page_About', - 'admin_print_styles', - ) ); - add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupabout'], array( - 'BackWPup_Page_About', - 'admin_print_scripts', - ) ); + add_action( 'admin_print_styles-' . $this->page_hooks['backwpupabout'], + array( + 'BackWPup_Page_About', + 'admin_print_styles', + ) ); + add_action( 'admin_print_scripts-' . $this->page_hooks['backwpupabout'], + array( + 'BackWPup_Page_About', + 'admin_print_scripts', + ) ); return $page_hooks; } @@ -444,20 +519,21 @@ public function admin_page_about( $page_hooks ) { */ public function save_post_form() { - //Allowed Pages - if ( ! in_array( $_POST['page'], array( + $allowed_pages = array( 'backwpupeditjob', 'backwpupinformation', 'backwpupsettings', - ), true ) ) { - wp_die( __( 'Cheating, huh?', 'backwpup' ) ); + ); + + if ( ! in_array( $_POST['page'], $allowed_pages, true ) ) { + wp_die( esc_html__( 'Cheating, huh?', 'backwpup' ) ); } //nonce check check_admin_referer( $_POST['page'] . '_page' ); if ( ! current_user_can( 'backwpup' ) ) { - wp_die( __( 'Cheating, huh?', 'backwpup' ) ); + wp_die( esc_html__( 'Cheating, huh?', 'backwpup' ) ); } //build query for redirect @@ -471,21 +547,21 @@ public function save_post_form() { if ( isset( $_POST['tab'] ) ) { $query_args['tab'] = $_POST['tab']; } - if ( isset( $_POST['tab'] ) && isset( $_POST['nexttab'] ) && $_POST['tab'] != $_POST['nexttab'] ) { + if ( isset( $_POST['tab'] ) && isset( $_POST['nexttab'] ) && $_POST['tab'] !== $_POST['nexttab'] ) { $query_args['tab'] = $_POST['nexttab']; } $jobid = null; if ( isset( $_POST['jobid'] ) ) { - $jobid = (int) $_POST['jobid']; + $jobid = (int) $_POST['jobid']; $query_args['jobid'] = $jobid; } - //Call method to save data - if ( $_POST['page'] == 'backwpupeditjob' ) { + // Call method to save data + if ( $_POST['page'] === 'backwpupeditjob' ) { BackWPup_Page_Editjob::save_post_form( $_POST['tab'], $jobid ); - } elseif ( $_POST['page'] == 'backwpupsettings' ) { - BackWPup_Page_Settings::save_post_form(); + } elseif ( $_POST['page'] === 'backwpupsettings' ) { + $this->settings->save_post_form(); } //Back to topic @@ -503,11 +579,17 @@ public function save_post_form() { public function admin_footer_text( $admin_footer_text ) { $default_text = $admin_footer_text; - if ( isset( $_REQUEST['page'] ) && strstr( $_REQUEST['page'], 'backwpup' ) ) { - $admin_footer_text = ''; + + $admin_footer_text = sprintf( + '', + '' + ); + if ( ! class_exists( 'BackWPup_Pro', false ) ) { - $admin_footer_text .= sprintf( __( 'Get BackWPup Pro now.', 'backwpup' ), __( 'http://backwpup.com', 'backwpup' ) ); + $admin_footer_text .= sprintf( __( 'Get BackWPup Pro now.', + 'backwpup' ), + __( 'http://backwpup.com', 'backwpup' ) ); } return $admin_footer_text . $default_text; @@ -528,7 +610,10 @@ public function update_footer( $update_footer_text ) { $default_text = $update_footer_text; if ( isset( $_REQUEST['page'] ) && strstr( $_REQUEST['page'], 'backwpup' ) ) { - $update_footer_text = '' . BackWPup::get_plugin_data( 'Name' ) . ' ' . sprintf( __( 'version %s', 'backwpup' ), BackWPup::get_plugin_data( 'Version' ) ) . ''; + $update_footer_text = '' . BackWPup::get_plugin_data( 'Name' ) . ' ' . sprintf( __( 'version %s', + 'backwpup' ), + BackWPup::get_plugin_data( 'Version' ) ) . ''; return $update_footer_text . $default_text; } @@ -578,10 +663,13 @@ public function user_profile_fields( $user ) { @@ -651,7 +739,7 @@ public function save_profile_update( $user_id ) { } /** - * @param bool $show + * @param bool $show * @param null|WP_Screen $screen * * @return bool diff --git a/inc/class-become-inpsyder-widget.php b/inc/class-become-inpsyder-widget.php deleted file mode 100644 index 91e9a45e..00000000 --- a/inc/class-become-inpsyder-widget.php +++ /dev/null @@ -1,176 +0,0 @@ -should_display() ) { - wp_add_dashboard_widget( - 'backwpup_become_inpsyder', - esc_html__( 'Make BackWPup better!', 'backwpup' ), - array( $this, 'print_widget_markup' ) - ); - } - } - - public function print_plugin_widget_markup() { - - static $done; - $screen_id = get_current_screen()->id; - if ( ! $done && in_array( $screen_id, self::$main_admin_page_ids, true ) && $this->should_display() ) { - $done = true; - ?> -
-

-
- widget_markup( 'left' ) ?> -
-
- should_display() ) { - $done = true; - echo $this->widget_markup(); - } - } - - /** - * We don't display widget if it was dismissed for good. - * - * @return bool - */ - private function should_display() { - - // If already checked, don't check again - if ( is_bool( self::$should_show ) ) { - return self::$should_show; - } - - if ( class_exists( 'BackWPup_Pro', false ) ) { - self::$should_show = false; - } else { - $option = new BackWPup_Dismissible_Notice_Option( false ); - - // If notice is dismissed for good, don't show it - self::$should_show = ! $option->is_dismissed( self::NOTICE_ID ); - } - - return self::$should_show; - } - - /** - * The markup for the admin notice. - * - * @param string $btn_float - * - * @return string - */ - private function widget_markup( $btn_float = 'right' ) { - - $dismiss_url = BackWPup_Dismissible_Notice_Option::dismiss_action_url( - self::NOTICE_ID, - BackWPup_Dismissible_Notice_Option::FOR_USER_FOR_GOOD_ACTION - ); - - $plugin_file = dirname( dirname( __FILE__ ) ) . '/backwpup.php'; - $logo_url = plugins_url( '/assets/images/inpsyde.png', $plugin_file ); - - $job_url = __( - 'https://inpsyde.com/en/jobs/?utm_source=BackWPup&utm_medium=Link&utm_campaign=BecomeAnInpsyder', - 'backwpup' - ); - - ob_start(); - ?> -
-

- -
- - - - -

- - - - -

-
-

- - - - - - - <?php echo esc_attr__( 'Work for Inpsyde', 'backwpup' ) ?> - -

-
- - file = trim( $file ); // TAR.GZ - if ( ! $this->filehandler && '.tar.gz' === strtolower( substr( $this->file, - 7 ) ) ) { + if ( + (! $this->filehandler && '.tar.gz' === strtolower( substr( $this->file, - 7 ) )) + || ( ! $this->filehandler && '.tar.bz2' === strtolower( substr( $this->file, - 8 ) ) ) + ) { if ( ! function_exists( 'gzencode' ) ) { throw new BackWPup_Create_Archive_Exception( __( 'Functions for gz compression not available', 'backwpup' ) @@ -107,19 +110,6 @@ public function __construct( $file ) { $this->filehandler = $this->fopen( $this->file, 'ab' ); } - // TAR.BZ2 - if ( ! $this->filehandler && '.tar.bz2' === strtolower( substr( $this->file, - 8 ) ) ) { - if ( ! function_exists( 'bzcompress' ) ) { - throw new BackWPup_Create_Archive_Exception( - esc_html__( 'Functions for bz2 compression not available.', 'backwpup' ) - ); - } - - $this->method = 'TarBz2'; - $this->handlertype = 'bz'; - $this->filehandler = $this->fopen( $this->file, 'ab' ); - } - // .TAR if ( ! $this->filehandler && '.tar' === strtolower( substr( $this->file, - 4 ) ) ) { $this->method = 'Tar'; @@ -176,7 +166,10 @@ public function __construct( $file ) { } // .GZ - if ( ! $this->filehandler && '.gz' === strtolower( substr( $this->file, - 3 ) ) ) { + if ( + ( ! $this->filehandler && '.gz' === strtolower( substr( $this->file, - 3 ) ) ) + || ( ! $this->filehandler && '.bz2' === strtolower( substr( $this->file, - 4 ) ) ) + ) { if ( ! function_exists( 'gzencode' ) ) { throw new BackWPup_Create_Archive_Exception( __( 'Functions for gz compression not available', 'backwpup' ) @@ -188,19 +181,6 @@ public function __construct( $file ) { $this->filehandler = $this->fopen( $this->file, 'w' ); } - // .BZ2 - if ( ! $this->filehandler && '.bz2' === strtolower( substr( $this->file, - 4 ) ) ) { - if ( ! function_exists( 'bzcompress' ) ) { - throw new BackWPup_Create_Archive_Exception( - __( 'Functions for bz2 compression not available', 'backwpup' ) - ); - } - - $this->method = 'bz2'; - $this->handlertype = 'bz'; - $this->filehandler = $this->fopen( $this->file, 'w' ); - } - if ( '' === $this->method ) { throw new BackWPup_Create_Archive_Exception( sprintf( @@ -275,7 +255,7 @@ public function close() { } // Write tar file end. - if ( in_array( $this->method, array( 'Tar', 'TarGz', 'TarBz2' ), true ) ) { + if ( in_array( $this->method, array( 'Tar', 'TarGz' ), true ) ) { $this->fwrite( pack( 'a1024', '' ) ); } @@ -364,36 +344,8 @@ public function add_file( $file_name, $name_in_archive = '' ) { $this->file_count ++; break; - case 'bz2': - if ( ! is_resource( $this->filehandler ) ) { - return false; - } - - if ( $this->file_count > 0 ) { - trigger_error( - esc_html__( 'This archive method can only add one file', 'backwpup' ), - E_USER_WARNING - ); - - return false; - } - - $fd = fopen( $file_name, 'rb' ); // phpcs:ignore - if ( ! $fd ) { - return false; - } - - while ( ! feof( $fd ) ) { - $this->fwrite( fread( $fd, 8192 ) ); // phpcs:ignore - } - fclose( $fd ); // phpcs:ignore - - $this->file_count ++; - break; - case 'Tar': case 'TarGz': - case 'TarBz2': // Convert chars for archives file names if ( function_exists( 'iconv' ) && stripos( PHP_OS, 'win' ) === 0 ) { $test = @iconv( 'ISO-8859-1', 'UTF-8', $name_in_archive ); @@ -582,18 +534,8 @@ public function add_empty_folder( $folder_name, $name_in_archive ) { return false; break; - case 'bz2': - trigger_error( - esc_html__( 'This archive method can only add one file', 'backwpup' ), - E_USER_ERROR - ); - - return false; - break; - case 'Tar': case 'TarGz': - case 'TarBz2': $this->tar_empty_folder( $folder_name, $name_in_archive ); return false; diff --git a/inc/class-cron.php b/inc/class-cron.php index 8fc4205e..55cd8171 100644 --- a/inc/class-cron.php +++ b/inc/class-cron.php @@ -1,7 +1,5 @@ 'cronrun', + 'run' => 'cronrun', 'jobid' => $arg, ) ); @@ -130,53 +128,6 @@ public static function check_cleanup() { } - /** - * Update the backend message. - * - * @return void - */ - public static function update_message() { - - // Fetch message from API - $api_request = esc_url( 'http://backwpup.com/wp-json/inpsyde-messages/v1/message/' ); - $api_response = wp_remote_get( $api_request ); // phpcs:ignore - $api_data = json_decode( wp_remote_retrieve_body( $api_response ), true ); - - if ( is_wp_error( $api_response ) ) { - return; - } - if ( 200 !== $api_response['response']['code'] ) { - return; - } - - // Add messages to options - foreach ( $api_data as $lang => $value ) { - $content = $value['content']; - $button = $value['button-text']; - $url = $value['url']; - - // Calculate ID based on button text and URL - $id = "$button|$url"; - - // Pad to nearest 5 bytes for base32 - $pad = strlen( $id ); - - if ( $pad % 5 > 0 ) { - $pad += 5 - ( $pad % 5 ); - $id = str_pad( $id, $pad, '|' ); - } - - // Encode $id so it will be unique - $id = Base32::encode( $id ); - - // Save in site options - update_site_option( "backwpup_message_id_$lang", $id ); - update_site_option( "backwpup_message_content_$lang", $content ); - update_site_option( "backwpup_message_button_text_$lang", $button ); - update_site_option( "backwpup_message_url_$lang", $url ); - } - } - /** * Start job if in cron and run query args are set. */ @@ -204,7 +155,7 @@ public static function cron_active( $args = array() ) { } $args = array_merge( array( - 'run' => '', + 'run' => '', 'nonce' => '', 'jobid' => 0, ), @@ -260,7 +211,7 @@ public static function cron_active( $args = array() ) { //check runext is allowed for job if ( $args['run'] === 'runext' ) { - $jobids_link = BackWPup_Option::get_job_ids( 'activetype', 'link' ); + $jobids_link = BackWPup_Option::get_job_ids( 'activetype', 'link' ); $jobids_easycron = BackWPup_Option::get_job_ids( 'activetype', 'easycron' ); $jobids_external = array_merge( $jobids_link, $jobids_easycron ); if ( ! in_array( $args['jobid'], $jobids_external, true ) ) { @@ -282,7 +233,7 @@ public static function cron_active( $args = array() ) { */ public static function cron_next( $cronstring ) { - $cron = array(); + $cron = array(); $cronarray = array(); //Cron string list( $cronstr['minutes'], $cronstr['hours'], $cronstr['mday'], $cronstr['mon'], $cronstr['wday'] ) = explode( ' ', @@ -397,5 +348,4 @@ public static function cron_next( $cronstring ) { return PHP_INT_MAX; } - } diff --git a/inc/class-decrypter.php b/inc/class-decrypter.php deleted file mode 100644 index b403427c..00000000 --- a/inc/class-decrypter.php +++ /dev/null @@ -1,198 +0,0 @@ -local_file_path = $local_file_path; - } - - /** - * @return bool - * @throws \Exception - */ - public function decrypt() { - - $aes = new AES( AES::MODE_CBC ); - $source_file_handler = fopen( $this->local_file_path, 'rb' ); - - if ( ! is_resource( $source_file_handler ) ) { - throw new \Exception( __( 'Cannot open the archive for reading.', 'backwpup' ) ); - } - - // Read first byte to know what encryption method was used - $key = ''; - $type = fread( $source_file_handler, 1 ); - - // Symmetric mode - if ( $type === chr( 0 ) ) { - $key = pack( 'H*', get_site_option( self::ENCRYPTION_KEY_OPTION ) ); - } - // Asymmetric mode - if ( $type === chr( 1 ) ) { - $key = $this->get_rsa_decrypted_key( $source_file_handler ); - } - - if ( $key === '' ) { - return false; - } - - if ( file_exists( $this->local_file_path . '.encrypted' ) ) { - unlink( $this->local_file_path . '.encrypted' ); - } - - $local_file_handler = fopen( $this->local_file_path . '.encrypted', 'a+b' ); - if ( ! is_resource( $local_file_handler ) ) { - throw new \Exception( __( 'Cannot write the encrypted archive.', 'backwpup' ) ); - } - - $aes->setKey( $key ); - $aes->enableContinuousBuffer(); - $aes->disablePadding(); - - $block_size = 128 * 1024; - $bytes_read = 0; - - while ( ! feof( $source_file_handler ) ) { - $data = fread( $source_file_handler, $block_size ); - $packet = $aes->decrypt( $data ); - $bytes_read += strlen( $data ); - - if ( feof( $source_file_handler ) ) { - // This is the last chunk, so strip padding - $padding_length = ord( $packet[ strlen( $packet ) - 1 ] ); - if ( $padding_length <= 16 ) { - $packet = substr( $packet, 0, - $padding_length ); - } - } - fwrite( $local_file_handler, $packet ); - } - - $file_in = null; - $file_out = null; - - unlink( $this->local_file_path ); - rename( $this->local_file_path . '.encrypted', $this->local_file_path ); - - return true; - } - - /** - * @param $source_file_handler - * - * @return bool|string - */ - private function get_rsa_decrypted_key( $source_file_handler ) { - - $rsa = new RSA(); - $private_key = ''; - $verified = false; - $status = self::PRIVATE_KEY_STATUS_NOT_FOUND; - $length = unpack( 'H*', fread( $source_file_handler, 1 ) ); - $length = hexdec( $length[1] ); - $key = fread( $source_file_handler, $length ); - $private_key_file = dirname( $this->local_file_path ) . '/' . self::PRIVATE_RSA_ID_FILE; - - if ( ! file_exists( $private_key_file ) ) { - self::send_message( array( - 'state' => 'need-private-key', - 'status' => $status, - ) ); - - return ''; - } - - if ( file_exists( $private_key_file ) ) { - $private_key = file_get_contents( $private_key_file ); - unlink( $private_key_file ); - - $verified = $this->verify_private_key( $rsa, $private_key ); - } - - if ( ! $verified ) { - self::send_message( array( - 'state' => 'need-private-key', - 'status' => self::PRIVATE_KEY_STATUS_INVALID, - ) ); - - return ''; - } - - $private_key and $rsa->loadKey( $private_key ); - - $key = $rsa->decrypt( $key ); - - if ( $key === '' ) { - throw new \RuntimeException( __( 'Private key invalid.', 'backwpup' ) ); - } - - return $key; - } - - /** - * @param \phpseclib\Crypt\RSA $rsa - * @param $private_key - * - * @return bool - */ - private function verify_private_key( RSA $rsa, $private_key ) { - - $rsa->setSignatureMode( RSA::SIGNATURE_PKCS1 ); - - if ( ! $rsa->loadKey( $private_key ) ) { - return false; - } - - $signature = $rsa->sign( 'test' ); - $rsa->loadKey( get_site_option( self::PUBLIC_KEY_OPTION ) ); - - return $rsa->verify( 'test', $signature ); - } - - /** - * @param $data - * @param string $event - */ - private static function send_message( $data, $event = 'message' ) { - - echo "event: {$event}\n"; - echo "data: " . wp_json_encode( $data ) . "\n\n"; - flush(); - } -} diff --git a/inc/class-destination-downloader-factory.php b/inc/class-destination-downloader-factory.php index 52e29b7d..76040ef0 100644 --- a/inc/class-destination-downloader-factory.php +++ b/inc/class-destination-downloader-factory.php @@ -31,9 +31,9 @@ class BackWPup_Destination_Downloader_Factory { */ public function create( $service_name, $job_id, $source_file_path, $local_file_path, $base_url = '' ) { - $destination = null; + $destination = null; $service_name = ucwords( $service_name ); - $class = self::CLASS_PREFIX . $service_name . self::CLASS_SUFFIX; + $class = self::CLASS_PREFIX . $service_name . self::CLASS_SUFFIX; // If class doesn't exists, try within the Pro directory. if ( BackWPup::is_pro() && ! class_exists( $class ) ) { @@ -57,7 +57,9 @@ public function create( $service_name, $job_id, $source_file_path, $local_file_p } /** @var \BackWPup_Destination_Downloader_Interface $destination */ - ! $destination and $destination = new $class( $data ); + if ( ! $destination ) { + $destination = new $class( $data ); + } return new BackWPup_Destination_Downloader( $data, $destination ); } diff --git a/inc/class-destination-downloader.php b/inc/class-destination-downloader.php index 47bb362f..48ee3495 100644 --- a/inc/class-destination-downloader.php +++ b/inc/class-destination-downloader.php @@ -6,6 +6,9 @@ * @package Inpsyde\BackWPup */ +use Inpsyde\Restore\Api\Controller\DecryptController; +use Inpsyde\Restore\Api\Exception\DecryptException; + /** * Class BackWPup_Destination_Downloader * @@ -17,6 +20,10 @@ class BackWPup_Destination_Downloader { const ARCHIVE_ENCRYPT_OPTION = 'archiveencryption'; const CAPABILITY = 'backwpup_backups_download'; + const STATE_DOWNLOADING = 'downloading'; + const STATE_ERROR = 'error'; + const STATE_DONE = 'done'; + /** * @var \BackWpUp_Destination_Downloader_Data */ @@ -27,10 +34,54 @@ class BackWPup_Destination_Downloader { */ private $destination; + /** + * Download file via ajax + */ + public static function download_by_ajax() { + + $dest = (string) filter_input( INPUT_GET, 'destination', FILTER_SANITIZE_STRING ); + if ( ! $dest ) { + return; + } + + $job_id = (int) filter_input( INPUT_GET, 'jobid', FILTER_SANITIZE_NUMBER_INT ); + if ( ! $job_id ) { + return; + } + + $file = (string) filter_input( INPUT_GET, 'file', FILTER_SANITIZE_STRING ); + $file_local = (string) filter_input( INPUT_GET, 'local_file', FILTER_SANITIZE_STRING ); + if ( ! $file || ! $file_local ) { + return; + } + + set_time_limit( 0 ); + // Set up eventsource headers + header( 'Content-Type: text/event-stream' ); + header( 'Cache-Control: no-cache' ); + header( 'X-Accel-Buffering: no' ); + header( 'Content-Encoding: none' ); + + // 2KB padding for IE + echo ':' . str_repeat( ' ', 2048 ) . "\n\n"; // phpcs:ignore + + // Ensure we're not buffered. + wp_ob_end_flush_all(); + flush(); + + /** @var \BackWPup_Destinations $dest_class */ + $dest_class = BackWPup::get_destination( $dest ); + $dest_class->file_download( + $job_id, + trim( sanitize_text_field( $file ) ), + trim( sanitize_text_field( $file_local ) ) + ); + } + /** * BackWPup_Downloader constructor * - * @param \BackWpUp_Destination_Downloader_Data $data + * @param \BackWpUp_Destination_Downloader_Data $data * @param \BackWPup_Destination_Downloader_Interface $destination */ public function __construct( @@ -38,7 +89,7 @@ public function __construct( BackWPup_Destination_Downloader_Interface $destination ) { - $this->data = $data; + $this->data = $data; $this->destination = $destination; } @@ -49,16 +100,12 @@ public function download_by_chunks() { $this->ensure_user_can_download(); - $decripted = false; - $need_to_be_decripted = BackWPup_Option::get( $this->data->job_id(), self::ARCHIVE_ENCRYPT_OPTION ); - $source_file_path = $this->data->source_file_path(); - $local_file_path = $this->data->local_file_path(); - - $size = $this->destination->calculate_size(); + $local_file_path = $this->data->local_file_path(); + $size = $this->destination->calculate_size(); $start_byte = 0; $chunk_size = 2 * 1024 * 1024; - $end_byte = $start_byte + $chunk_size - 1; + $end_byte = $start_byte + $chunk_size - 1; if ( $end_byte >= $size ) { $end_byte = $size - 1; @@ -69,12 +116,12 @@ public function download_by_chunks() { $this->destination->download_chunk( $start_byte, $end_byte ); self::send_message( array( - 'state' => 'downloading', - 'start_byte' => $start_byte, - 'end_byte' => $end_byte, - 'size' => $size, + 'state' => self::STATE_DOWNLOADING, + 'start_byte' => $start_byte, + 'end_byte' => $end_byte, + 'size' => $size, 'download_percent' => round( ( $end_byte + 1 ) / $size * 100 ), - 'filename' => basename( $source_file_path ), + 'filename' => basename( $source_file_path ), ) ); @@ -83,30 +130,23 @@ public function download_by_chunks() { } $start_byte = $end_byte + 1; - $end_byte = $start_byte + $chunk_size - 1; + $end_byte = $start_byte + $chunk_size - 1; if ( $start_byte < $size && $end_byte >= $size ) { $end_byte = $size - 1; } } - // Decrypt - if ( $need_to_be_decripted ) { - $decrypter = new BackWPup_Decrypter( $local_file_path ); - $decripted = $decrypter->decrypt(); - } - - if ( ! $decripted && $need_to_be_decripted ) { - throw new \BackWPup_Destination_Download_Exception(); + if ( BackWPup::is_pro() ) { + $decrypter = \Inpsyde\BackWPup\Pro\Restore\Functions\restore_container( 'decrypter' ); + if ( $decrypter->maybe_decrypted( $local_file_path ) ) { + throw new DecryptException( DecryptController::STATE_NEED_DECRYPTION_KEY ); + } } - - self::send_message( array( - 'state' => 'done', - ) ); } catch ( \Exception $e ) { self::send_message( array( - 'state' => 'error', + 'state' => self::STATE_ERROR, 'message' => $e->getMessage(), ), 'log' @@ -115,6 +155,11 @@ public function download_by_chunks() { return false; } + self::send_message( array( + 'state' => self::STATE_DONE, + 'message' => esc_html__( 'Your download is being generated …', 'backwpup' ), + ) ); + return true; } diff --git a/inc/class-destination-email.php b/inc/class-destination-email.php index 37336711..d46f85c5 100644 --- a/inc/class-destination-email.php +++ b/inc/class-destination-email.php @@ -3,6 +3,8 @@ // http://swiftmailer.org/ // https://github.com/swiftmailer/swiftmailer +use Inpsyde\BackWPup\Helper; + /** * */ @@ -334,7 +336,7 @@ public function job_run_archive( BackWPup_Job $job_object ) { $message->setFrom( array( $job_object->job['emailsndemail'] => $job_object->job['emailsndemailname'] ) ); $message->setTo( $this->get_email_array( $job_object->job['emailaddress'] ) ); $message->setBody( sprintf( __( 'Backup archive: %s', 'backwpup' ), $job_object->backup_file ), 'text/plain', strtolower( get_bloginfo( 'charset' ) ) ); - $message->attach( Swift_Attachment::fromPath( $job_object->backup_folder . $job_object->backup_file, $job_object->get_mime_type( $job_object->backup_folder . $job_object->backup_file ) ) ); + $message->attach( Swift_Attachment::fromPath( $job_object->backup_folder . $job_object->backup_file, Helper\MimeType::from_file_path( $job_object->backup_folder . $job_object->backup_file ) ) ); // Send the message $result = $emailer->send( $message ); } catch ( Exception $e ) { diff --git a/inc/class-destination-factory.php b/inc/class-destination-factory.php deleted file mode 100644 index ee532d26..00000000 --- a/inc/class-destination-factory.php +++ /dev/null @@ -1,78 +0,0 @@ -destination = $destination; - } - - /** - * Create - * - * Creates the specified destination object - * - * @return BackWPup_Destinations - */ - public function create() { - - // Build the class name. - $class = self::$prefix . $this->destination; - - // If class doesn't exists, try within the Pro directory. - if ( ! class_exists( $class ) ) { - $class = str_replace( self::$prefix, self::$pro_prefix, $class ); - } - - if ( ! class_exists( $class ) ) { - throw new BackWPup_Factory_Exception( - sprintf( - 'No way to instantiate class %s. Class doesn\'t exists.', - $class - ) - ); - } - - return new $class(); - } -} diff --git a/inc/class-destination-folder.php b/inc/class-destination-folder.php index e1128375..b1168527 100644 --- a/inc/class-destination-folder.php +++ b/inc/class-destination-folder.php @@ -10,10 +10,12 @@ class BackWPup_Destination_Folder extends BackWPup_Destinations { */ public function option_defaults() { - $upload_dir = wp_upload_dir( null, false, true ); - $backups_dir = trailingslashit( str_replace( '\\', '/', $upload_dir['basedir'] ) ) . 'backwpup-' . BackWPup::get_plugin_data( 'hash' ) . '-backups/'; + $upload_dir = wp_upload_dir( null, false, true ); + $backups_dir = trailingslashit( str_replace( '\\', + '/', + $upload_dir['basedir'] ) ) . 'backwpup-' . BackWPup::get_plugin_data( 'hash' ) . '-backups/'; $content_path = trailingslashit( str_replace( '\\', '/', WP_CONTENT_DIR ) ); - $backups_dir = str_replace( $content_path, '', $backups_dir ); + $backups_dir = str_replace( $content_path, '', $backups_dir ); return array( 'maxbackups' => 15, 'backupdir' => $backups_dir, 'backupsyncnodelete' => true ); } @@ -25,38 +27,64 @@ public function edit_tab( $jobid ) { ?>

-

- +
-

Warning: Files belonging to this job are now tracked. Old backup archives which are untracked will not be automatically deleted.', 'backwpup' ) ?>

- +

+ Warning: Files belonging to this job are now tracked. Old backup archives which are untracked will not be automatically deleted.', + 'backwpup' + ) + ?> +

+ - +
@@ -68,13 +96,13 @@ class="small-text"/> */ public function edit_form_post_save( $jobid ) { - $_POST['backupdir'] = trailingslashit( str_replace( array( - '//', - '\\', - ), '/', trim( sanitize_text_field( $_POST['backupdir'] ) ) ) ); - BackWPup_Option::update( $jobid, 'backupdir', $_POST['backupdir'] ); + $to_replace = array( '//', '\\' ); + $backup_dir = trim( sanitize_text_field( $_POST['backupdir'] ) ); + $_POST['backupdir'] = trailingslashit( str_replace( $to_replace, '/', $backup_dir ) ); + $max_backups = isset( $_POST['maxbackups'] ) ? absint( $_POST['maxbackups'] ) : 0; - BackWPup_Option::update( $jobid, 'maxbackups', ! empty( $_POST['maxbackups'] ) ? absint( $_POST['maxbackups'] ) : 0 ); + BackWPup_Option::update( $jobid, 'backupdir', $_POST['backupdir'] ); + BackWPup_Option::update( $jobid, 'maxbackups', $max_backups ); BackWPup_Option::update( $jobid, 'backupsyncnodelete', ! empty( $_POST['backupsyncnodelete'] ) ); } @@ -106,10 +134,10 @@ public function file_get_list( $jobdest ) { list( $jobid, $dest ) = explode( '_', $jobdest, 2 ); - $filecounter = 0; - $files = array(); - $backup_folder = BackWPup_Option::get( $jobid, 'backupdir' ); - $backup_folder = BackWPup_File::get_absolute_path( $backup_folder ); + $filecounter = 0; + $files = array(); + $backup_folder = BackWPup_Option::get( $jobid, 'backupdir' ); + $backup_folder = BackWPup_File::get_absolute_path( $backup_folder ); $not_allowed_files = array( 'index.php', '.htaccess', @@ -121,29 +149,32 @@ public function file_get_list( $jobdest ) { $dir = new BackWPup_Directory( $backup_folder ); foreach ( $dir as $file ) { - if ( $file->isDot() - || in_array( $file->getFilename(), $not_allowed_files, true ) - || $file->isDir() - || $file->isLink() + if ( + $file->isDot() + || $file->isDir() + || $file->isLink() + || in_array( $file->getFilename(), $not_allowed_files, true ) ) { continue; } if ( $file->isReadable() ) { //file list for backups - $files[ $filecounter ]['folder'] = $backup_folder; - $files[ $filecounter ]['file'] = str_replace( '\\', '/', $file->getPathname() ); - $files[ $filecounter ]['filename'] = $file->getFilename(); - $files[ $filecounter ]['downloadurl'] = add_query_arg( array( - 'page' => 'backwpupbackups', - 'action' => 'downloadfolder', - 'file' => $file->getFilename(), - 'local_file' => $file->getFilename(), - 'jobid' => $jobid, - ), - network_admin_url( 'admin.php' ) ); - $files[ $filecounter ]['filesize'] = $file->getSize(); - $files[ $filecounter ]['time'] = $file->getMTime() + ( get_option( 'gmt_offset' ) * 3600 ); + $files[ $filecounter ]['folder'] = $backup_folder; + $files[ $filecounter ]['file'] = str_replace( '\\', '/', $file->getPathname() ); + $files[ $filecounter ]['filename'] = $file->getFilename(); + $files[ $filecounter ]['downloadurl'] = add_query_arg( + array( + 'page' => 'backwpupbackups', + 'action' => 'downloadfolder', + 'file' => $file->getFilename(), + 'local_file' => $file->getFilename(), + 'jobid' => $jobid, + ), + network_admin_url( 'admin.php' ) + ); + $files[ $filecounter ]['filesize'] = $file->getSize(); + $files[ $filecounter ]['time'] = $file->getMTime() + ( get_option( 'gmt_offset' ) * 3600 ); $filecounter ++; } } @@ -164,35 +195,45 @@ public function job_run_archive( BackWPup_Job $job_object ) { BackWPup_Option::update( $job_object->job['jobid'], 'lastbackupdownloadurl', - add_query_arg( array( - 'page' => 'backwpupbackups', - 'action' => 'downloadfolder', - 'file' => basename( $job_object->backup_file ), - 'jobid' => $job_object->job['jobid'], - ), - network_admin_url( 'admin.php' ) ) ); + add_query_arg( + array( + 'page' => 'backwpupbackups', + 'action' => 'downloadfolder', + 'file' => basename( $job_object->backup_file ), + 'jobid' => $job_object->job['jobid'], + ), + network_admin_url( 'admin.php' ) + ) + ); } // Delete old Backupfiles. $backupfilelist = array(); - $files = array(); + $files = array(); if ( is_writable( $job_object->backup_folder ) ) { //make file list try { $dir = new BackWPup_Directory( $job_object->backup_folder ); foreach ( $dir as $file ) { - if ( $file->isWritable() && ! $file->isDir() && ! $file->isLink() ) { - //list for deletion - if ( $this->is_backup_archive( $file->getFilename() ) - && $this->is_backup_owned_by_job( $file->getFilename(), $job_object->job['jobid'] ) - ) { - $backupfilelist[ $file->getMTime() ] = clone $file; - } + if ( $file->isDot() || $file->isDir() || $file->isLink() || ! $file->isWritable() ) { + continue; + } + + $is_backup_archive = $this->is_backup_archive( $file->getFilename() ); + $is_owned_by_job = $this->is_backup_owned_by_job( $file->getFilename(), $job_object->job['jobid'] ); + if ( $is_backup_archive && $is_owned_by_job ) { + $backupfilelist[ $file->getMTime() ] = clone $file; } } } catch ( UnexpectedValueException $e ) { - $job_object->log( sprintf( __( "Could not open path: %s", 'backwpup' ), $e->getMessage() ), E_USER_WARNING ); + $job_object->log( + sprintf( + esc_html__( 'Could not open path: %s', 'backwpup' ), + $e->getMessage() + ), + E_USER_WARNING + ); } } @@ -207,7 +248,7 @@ public function job_run_archive( BackWPup_Job $job_object ) { } unlink( $file->getPathname() ); foreach ( $files as $key => $filedata ) { - if ( $filedata['file'] == $file->getPathname() ) { + if ( $filedata['file'] === $file->getPathname() ) { unset( $files[ $key ] ); } } @@ -218,7 +259,8 @@ public function job_run_archive( BackWPup_Job $job_object ) { $job_object->log( sprintf( _n( 'One backup file deleted', '%d backup files deleted', $numdeltefiles, 'backwpup' ), $numdeltefiles - ), E_USER_NOTICE ); + ), + E_USER_NOTICE ); } } } diff --git a/inc/class-destination-msazure.php b/inc/class-destination-msazure.php index db2a298a..beed250d 100644 --- a/inc/class-destination-msazure.php +++ b/inc/class-destination-msazure.php @@ -3,6 +3,8 @@ // http://www.windowsazure.com/en-us/develop/php/ // https://github.com/WindowsAzure/azure-sdk-for-php +use Inpsyde\BackWPup\Helper; + /** * Documentation: http://www.windowsazure.com/en-us/develop/php/how-to-guides/blob-service/ */ @@ -180,7 +182,7 @@ public function file_download( $jobid, $get_file, $local_file_path = null ) { @set_time_limit( 300 ); nocache_headers(); header( 'Content-Description: File Transfer' ); - header( 'Content-Type: ' . BackWPup_Job::get_mime_type( $get_file ) ); + header( 'Content-Type: ' . Helper\MimeType::from_file_path( $get_file ) ); header( 'Content-Disposition: attachment; filename="' . basename( $get_file ) . '"' ); header( 'Content-Transfer-Encoding: binary' ); header( 'Content-Length: ' . $blob->getProperties()->getContentLength() ); diff --git a/inc/class-destination-rsc.php b/inc/class-destination-rsc.php index 164d35fc..c5cd7cd2 100644 --- a/inc/class-destination-rsc.php +++ b/inc/class-destination-rsc.php @@ -3,6 +3,8 @@ // http://www.rackspace.com/cloud/files/ // https://github.com/rackspace/php-opencloud +use Inpsyde\BackWPup\Helper; + /** * */ @@ -226,7 +228,7 @@ public function file_download( $jobid, $get_file, $local_file_path = null ) { @set_time_limit( 300 ); nocache_headers(); header( 'Content-Description: File Transfer' ); - header( 'Content-Type: ' . BackWPup_Job::get_mime_type( $get_file ) ); + header( 'Content-Type: ' . Helper\MimeType::from_file_path( $get_file ) ); header( 'Content-Disposition: attachment; filename="' . basename( $get_file ) . '"' ); header( 'Content-Transfer-Encoding: binary' ); header( 'Content-Length: ' . $backupfile->getContentLength() ); diff --git a/inc/class-destination-s3.php b/inc/class-destination-s3.php index 58f458ad..dae4e5cc 100644 --- a/inc/class-destination-s3.php +++ b/inc/class-destination-s3.php @@ -4,6 +4,8 @@ // https://github.com/aws/aws-sdk-php // http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region +use Inpsyde\BackWPup\Helper; + /** * Documentation: http://docs.amazonwebservices.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html */ @@ -591,7 +593,6 @@ public function file_download( $jobid, $file_path, $local_file_path = null ) { $downloader = new BackWpup_Download_Handler( new BackWPup_Download_File( $filename, - mime_content_type( $filename ), function ( \BackWPup_Download_File_Interface $obj ) use ( $self, $filename, $file_path, $job_id ) { $base_url = $self->get_s3_base_url( @@ -612,9 +613,9 @@ function ( \BackWPup_Download_File_Interface $obj ) use ( $self, $filename, $fil }, $capability ), - "download-backup_{$job_id}", + 'backwpup_action_nonce', $capability, - 'download_file' + 'download_backup_file' ); // Download the file. @@ -859,7 +860,7 @@ public function job_run_archive( BackWPup_Job $job_object ) { $create_args['Body'] = $up_file_handle; $create_args['Key'] = $job_object->job['s3dir'] . $job_object->backup_file; - $create_args['ContentType'] = $job_object->get_mime_type( $job_object->backup_folder . $job_object->backup_file ); + $create_args['ContentType'] = Helper\MimeType::from_file_path( $job_object->backup_folder . $job_object->backup_file ); try { $s3->putObject( $create_args ); @@ -882,7 +883,7 @@ public function job_run_archive( BackWPup_Job $job_object ) { $args = array( 'ACL' => 'private', 'Bucket' => $job_object->job['s3bucket'], - 'ContentType' => $job_object->get_mime_type( $job_object->backup_folder . $job_object->backup_file ), + 'ContentType' => Helper\MimeType::from_file_path( $job_object->backup_folder . $job_object->backup_file ), 'Key' => $job_object->job['s3dir'] . $job_object->backup_file, ); if ( ! empty( $job_object->job['s3ssencrypt'] ) ) { diff --git a/inc/class-destination-sugarsync.php b/inc/class-destination-sugarsync.php index 19e5596c..3560d0b6 100644 --- a/inc/class-destination-sugarsync.php +++ b/inc/class-destination-sugarsync.php @@ -1,4 +1,7 @@ displayName ) ); + header( 'Content-Type: ' . Helper\MimeType::from_file_path( (string) $response->displayName ) ); header( 'Content-Disposition: attachment; filename="' . (string) $response->displayName . '"' ); header( 'Content-Transfer-Encoding: binary' ); header( 'Content-Length: ' . (int) $response->size ); @@ -852,7 +855,7 @@ public function upload( $file, $name = '' ) { $name = basename( $file ); } - $content_type = BackWPup_Job::get_mime_type( $file ); + $content_type = Helper\MimeType::from_file_path( $file ); $xmlrequest = ''; $xmlrequest .= ''; diff --git a/inc/class-destinations.php b/inc/class-destinations.php index a88d3d6b..671191f5 100644 --- a/inc/class-destinations.php +++ b/inc/class-destinations.php @@ -3,10 +3,8 @@ /** * Base class for adding BackWPup destinations. * - * @package BackWPup - * @subpackage BackWPup_Destinations - * @since 3.0.0 - * @access private + * @package BackWPup + * @since 3.0.0 */ abstract class BackWPup_Destinations { @@ -117,18 +115,17 @@ public function file_delete( $jobdest, $backupfile ) { public function file_download( $jobid, $file_path, $local_file_path = null ) { $capability = 'backwpup_backups_download'; - $filename = untrailingslashit( BackWPup::get_plugin_data( 'temp' ) ) . '/' . basename( $local_file_path ?: $file_path ); - $job_id = filter_var( $_GET['jobid'], FILTER_SANITIZE_NUMBER_INT ); + $filename = untrailingslashit( BackWPup::get_plugin_data( 'temp' ) ) . '/' . basename( $local_file_path ?: $file_path ); + $job_id = filter_var( $_GET['jobid'], FILTER_SANITIZE_NUMBER_INT ); // Dynamically get downloader class - $class_name = get_class( $this ); - $parts = explode( '_', $class_name ); + $class_name = get_class( $this ); + $parts = explode( '_', $class_name ); $destination = array_pop( $parts ); $downloader = new BackWpup_Download_Handler( new BackWPup_Download_File( $filename, - mime_content_type( $filename ), function ( \BackWPup_Download_File_Interface $obj ) use ( $filename, $file_path, @@ -137,7 +134,7 @@ function ( \BackWPup_Download_File_Interface $obj ) use ( ) { // Setup Destination service and download file. - $factory = new BackWPup_Destination_Downloader_Factory(); + $factory = new BackWPup_Destination_Downloader_Factory(); $downloader = $factory->create( $destination, $job_id, @@ -149,9 +146,9 @@ function ( \BackWPup_Download_File_Interface $obj ) use ( }, $capability ), - "download-backup_{$job_id}", + 'backwpup_action_nonce', $capability, - 'download_file' + 'download_backup_file' ); // Download the file. @@ -214,12 +211,11 @@ public function is_backup_archive( $file ) { $extensions = array( '.tar.gz', - '.tar.bz2', '.tar', '.zip', ); - $file = trim( basename( $file ) ); + $file = trim( basename( $file ) ); $filename = ''; foreach ( $extensions as $extension ) { @@ -254,7 +250,7 @@ public function is_backup_owned_by_job( $file, $jobid ) { $data = array(); if ( substr( $file, 0, 8 ) == 'backwpup' ) { $parts = explode( '_', $file ); - $data = BackWPup_Option::decode_hash( $parts[1] ); + $data = BackWPup_Option::decode_hash( $parts[1] ); if ( ! $data ) { return false; } diff --git a/inc/class-download-file-interface.php b/inc/class-download-file-interface.php index e4b13dba..cf9c921d 100644 --- a/inc/class-download-file-interface.php +++ b/inc/class-download-file-interface.php @@ -33,11 +33,4 @@ public function clean_ob(); * @return string The file path to download */ public function filepath(); - - /** - * Check File Name - * - * @return $this For concatenation - */ - public function check_filename(); } diff --git a/inc/class-download-file.php b/inc/class-download-file.php index 9eb2fed9..2ea534ab 100644 --- a/inc/class-download-file.php +++ b/inc/class-download-file.php @@ -1,16 +1,11 @@ type = $type; $this->filepath = $filepath; $this->filename = basename( $filepath ); $this->callback = $callback; - - // Calculate the length of the file. $this->length = file_exists( $filepath ) ? filesize( $filepath ) : 0; - - // Set the capability. $this->capability = $capability; } @@ -95,8 +84,7 @@ public function download() { wp_die( 'Cheating Uh?' ); } - $this->check_filename() - ->perform_download_callback(); + $this->perform_download_callback(); } /** @@ -106,7 +94,7 @@ public function clean_ob() { $level = ob_get_level(); if ( $level ) { - for ( $i = 0; $i < $level; $i++ ) { + for ( $i = 0; $i < $level; $i ++ ) { ob_end_clean(); } } @@ -122,30 +110,16 @@ public function filepath() { return $this->filepath; } - /** - * @inheritdoc - */ - public function check_filename() { - - // Sanitize filename, avoid wrong files. - $filename = sanitize_file_name( basename( $this->filename ) ); - - // Die if filename contains invalid characters. - if ( $filename !== $this->filename ) { - wp_die( esc_html__( 'Invalid file name, seems file include invalid characters.', 'backwpup' ) ); - } - - return $this; - } - /** * @inheritdoc */ public function headers() { + $mime = Helper\MimeType::from_file_path( $this->filepath ); + $level = ob_get_level(); if ( $level ) { - for ( $i = 0; $i < $level; $i++ ) { + for ( $i = 0; $i < $level; $i ++ ) { ob_end_clean(); } } @@ -156,7 +130,7 @@ public function headers() { // Set headers. header( 'Content-Description: File Transfer' ); - header( "Content-Type: {$this->type}" ); + header( "Content-Type: {$mime}" ); header( "Content-Disposition: attachment; filename={$this->filename}" ); header( 'Content-Transfer-Encoding: ' . self::$encoding ); header( "Content-Length: {$this->length}" ); diff --git a/inc/class-download-handler.php b/inc/class-download-handler.php index aecd0f42..5b8a9d9e 100644 --- a/inc/class-download-handler.php +++ b/inc/class-download-handler.php @@ -36,17 +36,17 @@ class BackWpup_Download_Handler { /** * DownloadLogHandler constructor * - * @param \BackWPup_Download_File_Interface $downloader The instance used to download the file. - * @param string $nonce_action The nonce to verify. - * @param string $capability The capability needed to download the file. - * @param string $action The action to perform. + * @param \BackWPup_Download_File_Interface $downloader The instance used to download the file. + * @param string $nonce_action The nonce to verify. + * @param string $capability The capability needed to download the file. + * @param string $action The action to perform. */ public function __construct( \BackWPup_Download_File_Interface $downloader, $nonce_action, $capability, $action ) { - $this->downloader = $downloader; + $this->downloader = $downloader; $this->nonce_action = $nonce_action; - $this->capability = $capability; - $this->action = $action; + $this->capability = $capability; + $this->action = $action; } /** @@ -75,7 +75,7 @@ private function verify_request() { return false; } - check_admin_referer( $this->nonce_action ); + check_admin_referer( $this->nonce_action, $this->nonce_action ); if ( ! current_user_can( $this->capability ) ) { wp_die( 'Cheating Uh?' ); diff --git a/inc/class-install.php b/inc/class-install.php index 4d2ea12a..1e7bfd2b 100644 --- a/inc/class-install.php +++ b/inc/class-install.php @@ -65,11 +65,6 @@ public static function activate() { wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' ); } - // Add schedule to update backend message - if ( ! wp_next_scheduled( 'backwpup_update_message' ) ) { - wp_schedule_event( time(), 'twicedaily', 'backwpup_update_message' ); - } - //add capabilities to administrator role $role = get_role( 'administrator' ); if ( is_object( $role ) && method_exists( $role, 'add_cap' ) ) { @@ -324,7 +319,6 @@ public static function deactivate() { } } wp_clear_scheduled_hook( 'backwpup_check_cleanup' ); - wp_clear_scheduled_hook( 'backwpup_update_message' ); $activejobs = BackWPup_Option::get_job_ids( 'activetype', 'easycron' ); if ( ! empty( $activejobs ) ) { diff --git a/inc/class-job.php b/inc/class-job.php index f6d86b34..2edb0bfe 100644 --- a/inc/class-job.php +++ b/inc/class-job.php @@ -5,6 +5,9 @@ */ final class BackWPup_Job { + const ENCRYPTION_SYMMETRIC = 'symmetric'; + const ENCRYPTION_ASYMMETRIC = 'asymmetric'; + /** * @var array of the job settings */ @@ -19,148 +22,120 @@ final class BackWPup_Job { * @var string the logfile */ public $logfile = ''; - /** * @var array for temp values */ public $temp = array(); - /** * @var string Folder where is Backup files in */ public $backup_folder = ''; - /** * @var string the name of the Backup archive file */ public $backup_file = ''; - /** * @var int The size of the Backup archive file */ public $backup_filesize = 0; - /** * @var int PID of script */ public $pid = 0; - /** * @var float Timestamp of last update off .running file */ public $timestamp_last_update = 0; - /** * @var int Number of warnings */ public $warnings = 0; - /** * @var int Number of errors */ public $errors = 0; - /** * @var string the last log notice message */ public $lastmsg = ''; - /** * @var string the last log error/waring message */ public $lasterrormsg = ''; - /** * @var array of steps to do */ public $steps_todo = array( 'CREATE' ); - /** * @var array of done steps */ public $steps_done = array(); - /** * @var array of steps data */ public $steps_data = array(); - /** * @var string working on step */ public $step_working = 'CREATE'; - /** * @var int Number of sub steps must do in step */ public $substeps_todo = 0; - /** * @var int Number of sub steps done in step */ public $substeps_done = 0; - /** * @var int Percent of steps done */ public $step_percent = 1; - /** * @var int Percent of sub steps done */ public $substep_percent = 1; - /** * @var array of files to additional to backup */ public $additional_files_to_backup = array(); - /** * @var array of files/folder to exclude from backup */ public $exclude_from_backup = array(); - /** * @var int count of affected files */ public $count_files = 0; - /** * @var int count of affected file sizes */ public $count_files_size = 0; - /** * @var int count of affected folders */ public $count_folder = 0; - /** * If job aborted from user * * @var bool */ public $user_abort = false; - /** * A uniqid ID uniqid('', true); to identify process * * @var string */ public $uniqid = ''; - /** * @var float Timestamp of script start */ private $timestamp_script_start = 0; - /** * Stores data that will only used in a single run * * @var array */ private $run = array(); - /** * @var string logging level (normal|normal_untranslated|debug|debug_untranslated) */ @@ -184,17 +159,16 @@ public static function start_http( $starttype, $jobid = 0 ) { add_filter( 'override_load_textdomain', '__return_true' ); $GLOBALS['l10n'] = array(); } - if ( $starttype !== 'restart' ) { //check job id exists - if ( $jobid !== BackWPup_Option::get( $jobid, 'jobid' ) ) { + if ( (int) $jobid !== (int) BackWPup_Option::get( $jobid, 'jobid' ) ) { return false; } //check folders - $log_folder = get_site_option( 'backwpup_cfg_logfolder' ); - $folder_message_log = BackWPup_File::check_folder( BackWPup_File::get_absolute_path( $log_folder ) ); + $log_folder = get_site_option( 'backwpup_cfg_logfolder' ); + $folder_message_log = BackWPup_File::check_folder( BackWPup_File::get_absolute_path( $log_folder ) ); $folder_message_temp = BackWPup_File::check_folder( BackWPup::get_plugin_data( 'TEMP' ), true ); if ( ! empty( $folder_message_log ) || ! empty( $folder_message_temp ) ) { BackWPup_Admin::message( $folder_message_log, true ); @@ -274,8 +248,8 @@ public static function get_working_data() { * * This starts or restarts the job working * - * @param string $start_type Start types are 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli' - * @param array|int $job_id The id of job of a job to start + * @param string $start_type Start types are 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli' + * @param array|int $job_id The id of job of a job to start */ private function create( $start_type, $job_id = 0 ) { @@ -294,24 +268,23 @@ private function create( $start_type, $job_id = 0 ) { } $this->start_time = current_time( 'timestamp' ); - $this->lastmsg = __( 'Starting job', 'backwpup' ); + $this->lastmsg = __( 'Starting job', 'backwpup' ); //set Logfile - $log_folder = get_site_option( 'backwpup_cfg_logfolder' ); - $log_folder = BackWPup_File::get_absolute_path( $log_folder ); - $this->logfile = $log_folder . 'backwpup_log_' . BackWPup::get_plugin_data( 'hash' ) . '_' . date( - 'Y-m-d_H-i-s', current_time( 'timestamp' ) - ) . '.html'; + $log_folder = get_site_option( 'backwpup_cfg_logfolder' ); + $log_folder = BackWPup_File::get_absolute_path( $log_folder ); + $this->logfile = $log_folder . 'backwpup_log_' . BackWPup::get_plugin_data( 'hash' ) . '_' . date( 'Y-m-d_H-i-s', + current_time( 'timestamp' ) ) . '.html'; //write settings to job BackWPup_Option::update( $this->job['jobid'], 'lastrun', $this->start_time ); BackWPup_Option::update( $this->job['jobid'], 'logfile', $this->logfile ); //Set current logfile BackWPup_Option::update( $this->job['jobid'], 'lastbackupdownloadurl', '' ); //Set needed job values $this->timestamp_last_update = microtime( true ); - $this->exclude_from_backup = explode( ',', trim( $this->job['fileexclude'] ) ); - $this->exclude_from_backup = array_unique( $this->exclude_from_backup ); + $this->exclude_from_backup = explode( ',', trim( $this->job['fileexclude'] ) ); + $this->exclude_from_backup = array_unique( $this->exclude_from_backup ); //setup job steps $this->steps_data['CREATE']['CALLBACK'] = ''; - $this->steps_data['CREATE']['NAME'] = __( 'Job Start', 'backwpup' ); + $this->steps_data['CREATE']['NAME'] = __( 'Job Start', 'backwpup' ); $this->steps_data['CREATE']['STEP_TRY'] = 0; //ADD Job types file /* @var $job_type_class BackWPup_JobTypes */ @@ -319,20 +292,20 @@ private function create( $start_type, $job_id = 0 ) { if ( $job_types = BackWPup::get_job_types() ) { foreach ( $job_types as $id => $job_type_class ) { if ( in_array( $id, $this->job['type'], true ) && $job_type_class->creates_file() ) { - $this->steps_todo[] = 'JOB_' . $id; - $this->steps_data[ 'JOB_' . $id ]['NAME'] = $job_type_class->info['description']; - $this->steps_data[ 'JOB_' . $id ]['STEP_TRY'] = 0; + $this->steps_todo[] = 'JOB_' . $id; + $this->steps_data[ 'JOB_' . $id ]['NAME'] = $job_type_class->info['description']; + $this->steps_data[ 'JOB_' . $id ]['STEP_TRY'] = 0; $this->steps_data[ 'JOB_' . $id ]['SAVE_STEP_TRY'] = 0; - $job_need_dest = true; + $job_need_dest = true; } } } //add destinations and create archive if a job where files to backup if ( $job_need_dest ) { //Create manifest file - $this->steps_todo[] = 'CREATE_MANIFEST'; - $this->steps_data['CREATE_MANIFEST']['NAME'] = __( 'Creates manifest file', 'backwpup' ); - $this->steps_data['CREATE_MANIFEST']['STEP_TRY'] = 0; + $this->steps_todo[] = 'CREATE_MANIFEST'; + $this->steps_data['CREATE_MANIFEST']['NAME'] = __( 'Creates manifest file', 'backwpup' ); + $this->steps_data['CREATE_MANIFEST']['STEP_TRY'] = 0; $this->steps_data['CREATE_MANIFEST']['SAVE_STEP_TRY'] = 0; //Add archive creation and backup filename on backup type archive if ( $this->job['backuptype'] == 'archive' ) { @@ -341,7 +314,7 @@ private function create( $start_type, $job_id = 0 ) { $this->backup_folder = $this->job['backupdir']; //check backup folder if ( ! empty( $this->backup_folder ) ) { - $this->backup_folder = BackWPup_File::get_absolute_path( $this->backup_folder ); + $this->backup_folder = BackWPup_File::get_absolute_path( $this->backup_folder ); $this->job['backupdir'] = $this->backup_folder; } } @@ -352,15 +325,15 @@ private function create( $start_type, $job_id = 0 ) { //Create backup archive full file name $this->backup_file = $this->generate_filename( $this->job['archivename'], $this->job['archiveformat'] ); //add archive create - $this->steps_todo[] = 'CREATE_ARCHIVE'; - $this->steps_data['CREATE_ARCHIVE']['NAME'] = __( 'Creates archive', 'backwpup' ); - $this->steps_data['CREATE_ARCHIVE']['STEP_TRY'] = 0; + $this->steps_todo[] = 'CREATE_ARCHIVE'; + $this->steps_data['CREATE_ARCHIVE']['NAME'] = __( 'Creates archive', 'backwpup' ); + $this->steps_data['CREATE_ARCHIVE']['STEP_TRY'] = 0; $this->steps_data['CREATE_ARCHIVE']['SAVE_STEP_TRY'] = 0; // Encrypt archive if ( BackWPup_Option::get( $this->job['jobid'], 'archiveencryption' ) ) { - $this->steps_todo[] = 'ENCRYPT_ARCHIVE'; - $this->steps_data['ENCRYPT_ARCHIVE']['NAME'] = __( 'Encrypts the archive', 'backwpup' ); - $this->steps_data['ENCRYPT_ARCHIVE']['STEP_TRY'] = 0; + $this->steps_todo[] = 'ENCRYPT_ARCHIVE'; + $this->steps_data['ENCRYPT_ARCHIVE']['NAME'] = __( 'Encrypts the archive', 'backwpup' ); + $this->steps_data['ENCRYPT_ARCHIVE']['STEP_TRY'] = 0; $this->steps_data['ENCRYPT_ARCHIVE']['SAVE_STEP_TRY'] = 0; } } @@ -374,15 +347,15 @@ private function create( $start_type, $job_id = 0 ) { if ( $dest_class->can_run( $this->job ) ) { if ( $this->job['backuptype'] == 'sync' ) { if ( $dest['can_sync'] ) { - $this->steps_todo[] = 'DEST_SYNC_' . $id; - $this->steps_data[ 'DEST_SYNC_' . $id ]['NAME'] = $dest['info']['description']; - $this->steps_data[ 'DEST_SYNC_' . $id ]['STEP_TRY'] = 0; + $this->steps_todo[] = 'DEST_SYNC_' . $id; + $this->steps_data[ 'DEST_SYNC_' . $id ]['NAME'] = $dest['info']['description']; + $this->steps_data[ 'DEST_SYNC_' . $id ]['STEP_TRY'] = 0; $this->steps_data[ 'DEST_SYNC_' . $id ]['SAVE_STEP_TRY'] = 0; } } else { - $this->steps_todo[] = 'DEST_' . $id; - $this->steps_data[ 'DEST_' . $id ]['NAME'] = $dest['info']['description']; - $this->steps_data[ 'DEST_' . $id ]['STEP_TRY'] = 0; + $this->steps_todo[] = 'DEST_' . $id; + $this->steps_data[ 'DEST_' . $id ]['NAME'] = $dest['info']['description']; + $this->steps_data[ 'DEST_' . $id ]['STEP_TRY'] = 0; $this->steps_data[ 'DEST_' . $id ]['SAVE_STEP_TRY'] = 0; } } @@ -392,77 +365,68 @@ private function create( $start_type, $job_id = 0 ) { if ( $job_types = BackWPup::get_job_types() ) { foreach ( $job_types as $id => $job_type_class ) { if ( in_array( $id, $this->job['type'], true ) && ! $job_type_class->creates_file() ) { - $this->steps_todo[] = 'JOB_' . $id; - $this->steps_data[ 'JOB_' . $id ]['NAME'] = $job_type_class->info['description']; - $this->steps_data[ 'JOB_' . $id ]['STEP_TRY'] = 0; + $this->steps_todo[] = 'JOB_' . $id; + $this->steps_data[ 'JOB_' . $id ]['NAME'] = $job_type_class->info['description']; + $this->steps_data[ 'JOB_' . $id ]['STEP_TRY'] = 0; $this->steps_data[ 'JOB_' . $id ]['SAVE_STEP_TRY'] = 0; } } } - $this->steps_todo[] = 'END'; - $this->steps_data['END']['NAME'] = __( 'End of Job', 'backwpup' ); + $this->steps_todo[] = 'END'; + $this->steps_data['END']['NAME'] = __( 'End of Job', 'backwpup' ); $this->steps_data['END']['STEP_TRY'] = 1; //must write working data $this->write_running_file(); //set log level $this->log_level = get_site_option( 'backwpup_cfg_loglevel', 'normal_translated' ); - if ( ! in_array( - $this->log_level, array( - 'normal_translated', - 'normal', - 'debug_translated', - 'debug', - ), true - ) ) { + if ( ! in_array( $this->log_level, + array( + 'normal_translated', + 'normal', + 'debug_translated', + 'debug', + ), + true ) ) { $this->log_level = 'normal_translated'; } //create log file - $head = ''; - $info = ''; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . sprintf( - __( 'BackWPup log for %1$s from %2$s at %3$s', 'backwpup' ), $this->job['name'], - date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) - ) . "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= "" . PHP_EOL; - $head .= str_pad( '', 100 ) . PHP_EOL; - $head .= str_pad( '', 100 ) . PHP_EOL; - $head .= "job['jobid'] . "\" />" . PHP_EOL; - $head .= "job['name'] - ) . "\" />" . PHP_EOL; - $head .= "job['type'] - ) . "\" />" . PHP_EOL; - $head .= str_pad( '', 100 ) . PHP_EOL; - $head .= str_pad( '', 100 ) . PHP_EOL; - $head .= '' . PHP_EOL; - $head .= '' . PHP_EOL; - $info .= sprintf( - _x( - '[INFO] %1$s %2$s; A project of Inpsyde GmbH', 'Plugin name; Plugin Version; plugin url', 'backwpup' - ), BackWPup::get_plugin_data( 'name' ), BackWPup::get_plugin_data( 'Version' ), - __( 'http://backwpup.com', 'backwpup' ) - ) . '
' . PHP_EOL; - $info .= sprintf( - _x( '[INFO] WordPress %1$s on %2$s', 'WordPress Version; Blog url', 'backwpup' ), - BackWPup::get_plugin_data( 'wp_version' ), esc_attr( site_url( '/' ) ) - ) . '
' . PHP_EOL; - $level = __( 'Normal', 'backwpup' ); + $head = ''; + $info = ''; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . sprintf( __( 'BackWPup log for %1$s from %2$s at %3$s', 'backwpup' ), + $this->job['name'], + date_i18n( get_option( 'date_format' ) ), + date_i18n( get_option( 'time_format' ) ) ) . "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= "" . PHP_EOL; + $head .= str_pad( '', 100 ) . PHP_EOL; + $head .= str_pad( '', 100 ) . PHP_EOL; + $head .= "job['jobid'] . "\" />" . PHP_EOL; + $head .= "job['name'] ) . "\" />" . PHP_EOL; + $head .= "job['type'] ) . "\" />" . PHP_EOL; + $head .= str_pad( '', 100 ) . PHP_EOL; + $head .= str_pad( '', 100 ) . PHP_EOL; + $head .= '' . PHP_EOL; + $head .= '' . PHP_EOL; + $info .= sprintf( _x( '[INFO] %1$s %2$s; A project of Inpsyde GmbH', + 'Plugin name; Plugin Version; plugin url', + 'backwpup' ), + BackWPup::get_plugin_data( 'name' ), + BackWPup::get_plugin_data( 'Version' ), + __( 'http://backwpup.com', 'backwpup' ) ) . '
' . PHP_EOL; + $info .= sprintf( _x( '[INFO] WordPress %1$s on %2$s', 'WordPress Version; Blog url', 'backwpup' ), + BackWPup::get_plugin_data( 'wp_version' ), + esc_attr( site_url( '/' ) ) ) . '
' . PHP_EOL; + $level = __( 'Normal', 'backwpup' ); $translated = ''; if ( $this->is_debug() ) { $level = __( 'Debug', 'backwpup' ); @@ -470,9 +434,7 @@ private function create( $start_type, $job_id = 0 ) { if ( is_textdomain_loaded( 'backwpup' ) ) { $translated = __( '(translated)', 'backwpup' ); } - $info .= sprintf( - __( '[INFO] Log Level: %1$s %2$s', 'backwpup' ), $level, $translated - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Log Level: %1$s %2$s', 'backwpup' ), $level, $translated ) . '
' . PHP_EOL; $job_name = esc_attr( $this->job['name'] ); if ( $this->is_debug() ) { $job_name .= '; ' . implode( '+', $this->job['type'] ); @@ -480,10 +442,9 @@ private function create( $start_type, $job_id = 0 ) { $info .= sprintf( __( '[INFO] BackWPup job: %1$s', 'backwpup' ), $job_name ) . '
' . PHP_EOL; if ( $this->is_debug() ) { $current_user = wp_get_current_user(); - $info .= sprintf( - __( '[INFO] Runs with user: %1$s (%2$d) ', 'backwpup' ), $current_user->user_login, - $current_user->ID - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Runs with user: %1$s (%2$d) ', 'backwpup' ), + $current_user->user_login, + $current_user->ID ) . '
' . PHP_EOL; } if ( $this->job['activetype'] === 'wpcron' ) { //check next run @@ -499,13 +460,13 @@ private function create( $start_type, $job_id = 0 ) { if ( ! $cron_next ) { $cron_next = __( 'Not scheduled!', 'backwpup' ); } else { - $cron_next = date_i18n( - 'D, j M Y @ H:i', $cron_next + ( get_option( 'gmt_offset' ) * 3600 ), true - ); + $cron_next = date_i18n( 'D, j M Y @ H:i', + $cron_next + ( get_option( 'gmt_offset' ) * 3600 ), + true ); } - $info .= sprintf( - __( '[INFO] Cron: %s; Next: %s ', 'backwpup' ), $this->job['cron'], $cron_next - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Cron: %s; Next: %s ', 'backwpup' ), + $this->job['cron'], + $cron_next ) . '
' . PHP_EOL; } } elseif ( $this->job['activetype'] == 'link' && $this->is_debug() ) { $info .= __( '[INFO] BackWPup job start with link is active', 'backwpup' ) . '
' . PHP_EOL; @@ -515,9 +476,9 @@ private function create( $start_type, $job_id = 0 ) { if ( $this->is_debug() ) { $cron_next = BackWPup_Cron::cron_next( $this->job['cron'] ); $cron_next = date_i18n( 'D, j M Y @ H:i', $cron_next + ( get_option( 'gmt_offset' ) * 3600 ), true ); - $info .= sprintf( - __( '[INFO] Cron: %s; Next: %s ', 'backwpup' ), $this->job['cron'], $cron_next - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Cron: %s; Next: %s ', 'backwpup' ), + $this->job['cron'], + $cron_next ) . '
' . PHP_EOL; } } elseif ( $this->is_debug() ) { $info .= __( '[INFO] BackWPup no automatic job start configured', 'backwpup' ) . '
' . PHP_EOL; @@ -530,9 +491,8 @@ private function create( $start_type, $job_id = 0 ) { } elseif ( $start_type == 'runext' ) { $info .= __( '[INFO] BackWPup job started from external url', 'backwpup' ) . '
' . PHP_EOL; } elseif ( $start_type == 'runcli' ) { - $info .= __( - '[INFO] BackWPup job started form commandline interface', 'backwpup' - ) . '
' . PHP_EOL; + $info .= __( '[INFO] BackWPup job started form commandline interface', + 'backwpup' ) . '
' . PHP_EOL; } $bit = ''; if ( PHP_INT_SIZE === 4 ) { @@ -541,40 +501,31 @@ private function create( $start_type, $job_id = 0 ) { if ( PHP_INT_SIZE === 8 ) { $bit = ' (64bit)'; } - $info .= __( - '[INFO] PHP ver.:', 'backwpup' - ) . ' ' . PHP_VERSION . $bit . '; ' . PHP_SAPI . '; ' . PHP_OS . '
' . PHP_EOL; - $info .= sprintf( - __( '[INFO] Maximum PHP script execution time is %1$d seconds', 'backwpup' ), - ini_get( 'max_execution_time' ) - ) . '
' . PHP_EOL; + $info .= __( '[INFO] PHP ver.:', + 'backwpup' ) . ' ' . PHP_VERSION . $bit . '; ' . PHP_SAPI . '; ' . PHP_OS . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Maximum PHP script execution time is %1$d seconds', 'backwpup' ), + ini_get( 'max_execution_time' ) ) . '
' . PHP_EOL; if ( php_sapi_name() != 'cli' ) { $job_max_execution_time = get_site_option( 'backwpup_cfg_jobmaxexecutiontime' ); if ( ! empty( $job_max_execution_time ) ) { - $info .= sprintf( - __( '[INFO] Script restart time is configured to %1$d seconds', 'backwpup' ), - $job_max_execution_time - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Script restart time is configured to %1$d seconds', 'backwpup' ), + $job_max_execution_time ) . '
' . PHP_EOL; } } - $info .= sprintf( - __( '[INFO] MySQL ver.: %s', 'backwpup' ), $wpdb->get_var( "SELECT VERSION() AS version" ) - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] MySQL ver.: %s', 'backwpup' ), + $wpdb->get_var( "SELECT VERSION() AS version" ) ) . '
' . PHP_EOL; if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { - $info .= sprintf( - __( '[INFO] Web Server: %s', 'backwpup' ), $_SERVER['SERVER_SOFTWARE'] - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Web Server: %s', 'backwpup' ), + $_SERVER['SERVER_SOFTWARE'] ) . '
' . PHP_EOL; } if ( function_exists( 'curl_init' ) ) { $curlversion = curl_version(); - $info .= sprintf( - __( '[INFO] curl ver.: %1$s; %2$s', 'backwpup' ), $curlversion['version'], - $curlversion['ssl_version'] - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] curl ver.: %1$s; %2$s', 'backwpup' ), + $curlversion['version'], + $curlversion['ssl_version'] ) . '
' . PHP_EOL; } - $info .= sprintf( - __( '[INFO] Temp folder is: %s', 'backwpup' ), BackWPup::get_plugin_data( 'TEMP' ) - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Temp folder is: %s', 'backwpup' ), + BackWPup::get_plugin_data( 'TEMP' ) ) . '
' . PHP_EOL; } if ( $this->is_debug() ) { $logfile = $this->logfile; @@ -590,9 +541,8 @@ private function create( $start_type, $job_id = 0 ) { } $info .= sprintf( __( '[INFO] Backup file is: %s', 'backwpup' ), $backupfile ) . '
' . PHP_EOL; } else { - $info .= sprintf( - __( '[INFO] Backup type is: %s', 'backwpup' ), $this->job['backuptype'] - ) . '
' . PHP_EOL; + $info .= sprintf( __( '[INFO] Backup type is: %s', 'backwpup' ), + $this->job['backuptype'] ) . '
' . PHP_EOL; } //output info on cli if ( php_sapi_name() == 'cli' && defined( 'STDOUT' ) ) { @@ -612,10 +562,9 @@ private function create( $start_type, $job_id = 0 ) { } } if ( ! $desttest ) { - $this->log( - __( 'No destination correctly defined for backup! Please correct job settings.', 'backwpup' ), - E_USER_ERROR - ); + $this->log( __( 'No destination correctly defined for backup! Please correct job settings.', + 'backwpup' ), + E_USER_ERROR ); $this->steps_todo = array( 'END' ); } } @@ -635,7 +584,7 @@ private function create( $start_type, $job_id = 0 ) { /** * @param $name * @param string $suffix - * @param bool $delete_temp_file + * @param bool $delete_temp_file * * @return string */ @@ -647,11 +596,7 @@ public function generate_filename( $name, $suffix = '', $delete_temp_file = true $name = BackWPup_Option::substitute_date_vars( $name ); $name .= $suffix; - if ( $delete_temp_file && is_writeable( BackWPup::get_plugin_data( 'TEMP' ) . $name ) - && ! is_dir( - BackWPup::get_plugin_data( 'TEMP' ) . $name - ) - && ! is_link( BackWPup::get_plugin_data( 'TEMP' ) . $name ) ) { + if ( $delete_temp_file && is_writeable( BackWPup::get_plugin_data( 'TEMP' ) . $name ) && ! is_dir( BackWPup::get_plugin_data( 'TEMP' ) . $name ) && ! is_link( BackWPup::get_plugin_data( 'TEMP' ) . $name ) ) { unlink( BackWPup::get_plugin_data( 'TEMP' ) . $name ); } @@ -710,7 +655,7 @@ public static function sanitize_file_name( $filename ) { private function write_running_file() { $clone = clone $this; - $data = 'is_debug() ) { if ( empty( $file ) || empty( $line ) ) { $debug_info = debug_backtrace(); - $file = $debug_info[0]['file']; - $line = $debug_info[0]['line']; + $file = $debug_info[0]['file']; + $line = $debug_info[0]['line']; } } - $error = false; + $error = false; $warning = false; switch ( $type ) { @@ -798,7 +742,7 @@ public function log( $message, $type = E_USER_NOTICE, $file = '', $line = 0 ) { case E_COMPILE_ERROR: case E_USER_ERROR: $this->errors ++; - $error = true; + $error = true; $message = __( 'ERROR:', 'backwpup' ) . ' ' . $message; break; case 8192: //E_DEPRECATED comes with php 5.3 @@ -810,7 +754,7 @@ public function log( $message, $type = E_USER_NOTICE, $file = '', $line = 0 ) { break; case E_RECOVERABLE_ERROR: $this->errors ++; - $error = true; + $error = true; $message = __( 'RECOVERABLE ERROR:', 'backwpup' ) . ' ' . $message; break; default: @@ -834,49 +778,41 @@ public function log( $message, $type = E_USER_NOTICE, $file = '', $line = 0 ) { } WP_CLI::line( $output_message ); } elseif ( php_sapi_name() == 'cli' && defined( 'STDOUT' ) ) { - $output_message = str_replace( - array( '…', ' ' ), array( - '...', - ' ', - ), esc_html( $message ) - ) . PHP_EOL; + $output_message = str_replace( array( '…', ' ' ), + array( + '...', + ' ', + ), + esc_html( $message ) ) . PHP_EOL; fwrite( STDOUT, $output_message ); } //timestamp for log file $debug_info = ''; if ( $this->is_debug() ) { - $debug_info = ' title="[Type: ' . $type . '|Line: ' . $line . '|File: ' . $in_file . '|Mem: ' . size_format( - @memory_get_usage( true ), 2 - ) . '|Mem Max: ' . size_format( @memory_get_peak_usage( true ), 2 ) . '|Mem Limit: ' . ini_get( - 'memory_limit' - ) . '|PID: ' . self::get_pid() . ' | UniqID: ' . $this->uniqid . '|Queries: ' . get_num_queries( - ) . ']"'; + $debug_info = ' title="[Type: ' . $type . '|Line: ' . $line . '|File: ' . $in_file . '|Mem: ' . size_format( @memory_get_usage( true ), + 2 ) . '|Mem Max: ' . size_format( @memory_get_peak_usage( true ), + 2 ) . '|Mem Limit: ' . ini_get( 'memory_limit' ) . '|PID: ' . self::get_pid() . ' | UniqID: ' . $this->uniqid . '|Queries: ' . get_num_queries() . ']"'; } - $timestamp = '[' . date( - 'd-M-Y H:i:s', current_time( 'timestamp' ) - ) . '] '; + $timestamp = '[' . date( 'd-M-Y H:i:s', + current_time( 'timestamp' ) ) . '] '; //set last Message if ( $error ) { - $output_message = '' . esc_html( - $message - ) . ''; + $output_message = '' . esc_html( $message ) . ''; $this->lasterrormsg = $output_message; } elseif ( $warning ) { - $output_message = '' . esc_html( - $message - ) . ''; + $output_message = '' . esc_html( $message ) . ''; $this->lasterrormsg = $output_message; } else { $output_message = esc_html( $message ); - $this->lastmsg = $output_message; + $this->lastmsg = $output_message; } //write log file if ( $this->logfile ) { - if ( ! file_put_contents( - $this->logfile, $timestamp . $output_message . '
' . PHP_EOL, FILE_APPEND - ) ) { + if ( ! file_put_contents( $this->logfile, + $timestamp . $output_message . '
' . PHP_EOL, + FILE_APPEND ) ) { $this->logfile = ''; restore_error_handler(); trigger_error( esc_html( $message ), $type ); @@ -890,20 +826,16 @@ public function log( $message, $type = E_USER_NOTICE, $file = '', $line = 0 ) { $line = fgets( $fd ); if ( $error && stripos( $line, '', 100 - ) . PHP_EOL - ); + fwrite( $fd, + str_pad( '', + 100 ) . PHP_EOL ); break; } if ( $warning && stripos( $line, '', 100 - ) . PHP_EOL - ); + fwrite( $fd, + str_pad( '', + 100 ) . PHP_EOL ); break; } $file_pos = ftell( $fd ); @@ -984,10 +916,7 @@ public function update_working_data( $must = false ) { global $wpdb; //to reduce server load - if ( get_site_option( 'backwpup_cfg_jobwaittimems' ) > 0 - && get_site_option( - 'backwpup_cfg_jobwaittimems' - ) <= 500000 ) { + if ( get_site_option( 'backwpup_cfg_jobwaittimems' ) > 0 && get_site_option( 'backwpup_cfg_jobwaittimems' ) <= 500000 ) { usleep( get_site_option( 'backwpup_cfg_jobwaittimems' ) ); } @@ -1064,7 +993,7 @@ public function need_free_memory( $memneed ) { */ public static function convert_hr_to_bytes( $size ) { - $size = strtolower( $size ); + $size = strtolower( $size ); $bytes = (int) $size; if ( strpos( $size, 'k' ) !== false ) { $bytes = intval( $size ) * 1024; @@ -1084,7 +1013,7 @@ public static function convert_hr_to_bytes( $size ) { */ private function end() { - $this->step_working = 'END'; + $this->step_working = 'END'; $this->substeps_todo = 1; if ( ! file_exists( BackWPup::get_plugin_data( 'running_file' ) ) ) { @@ -1094,16 +1023,14 @@ private function end() { //delete old logs if ( get_site_option( 'backwpup_cfg_maxlogs' ) ) { $log_file_list = array(); - $log_folder = trailingslashit( dirname( $this->logfile ) ); + $log_folder = trailingslashit( dirname( $this->logfile ) ); if ( is_readable( $log_folder ) ) { //make file list try { $dir = new BackWPup_Directory( $log_folder ); foreach ( $dir as $file ) { - if ( ! $file->isDot() && strpos( $file->getFilename(), 'backwpup_log_' ) === 0 - && strpos( - $file->getFilename(), '.html' - ) !== false ) { + if ( ! $file->isDot() && strpos( $file->getFilename(), + 'backwpup_log_' ) === 0 && strpos( $file->getFilename(), '.html' ) !== false ) { $log_file_list[ $file->getMTime() ] = clone $file; } } @@ -1114,7 +1041,7 @@ private function end() { if ( count( $log_file_list ) > 0 ) { krsort( $log_file_list, SORT_NUMERIC ); $num_delete_files = 0; - $i = - 1; + $i = - 1; foreach ( $log_file_list as $log_file ) { $i ++; if ( $i < get_site_option( 'backwpup_cfg_maxlogs' ) ) { @@ -1124,71 +1051,56 @@ private function end() { $num_delete_files ++; } if ( $num_delete_files > 0 ) { - $this->log( - sprintf( - _n( 'One old log deleted', '%d old logs deleted', $num_delete_files, 'backwpup' ), - $num_delete_files - ) - ); + $this->log( sprintf( _n( 'One old log deleted', + '%d old logs deleted', + $num_delete_files, + 'backwpup' ), + $num_delete_files ) ); } } } //Display job working time if ( $this->errors > 0 ) { - $this->log( - sprintf( - __( - 'Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', - 'backwpup' - ), current_time( 'timestamp' ) - $this->start_time - ), E_USER_ERROR - ); + $this->log( sprintf( __( 'Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', + 'backwpup' ), + current_time( 'timestamp' ) - $this->start_time ), + E_USER_ERROR ); } elseif ( $this->warnings > 0 ) { - $this->log( - sprintf( - __( - 'Job finished with warnings in %s seconds. Please resolve them for correct execution.', - 'backwpup' - ), current_time( 'timestamp' ) - $this->start_time - ), E_USER_WARNING - ); + $this->log( sprintf( __( 'Job finished with warnings in %s seconds. Please resolve them for correct execution.', + 'backwpup' ), + current_time( 'timestamp' ) - $this->start_time ), + E_USER_WARNING ); } else { - $this->log( - sprintf( __( 'Job done in %s seconds.', 'backwpup' ), current_time( 'timestamp' ) - $this->start_time ) - ); + $this->log( sprintf( __( 'Job done in %s seconds.', 'backwpup' ), + current_time( 'timestamp' ) - $this->start_time ) ); } //Update job options $this->job['lastruntime'] = current_time( 'timestamp' ) - $this->start_time; BackWPup_Option::update( $this->job['jobid'], 'lastruntime', $this->job['lastruntime'] ); + //write header info if ( ! empty( $this->logfile ) ) { if ( $fd = fopen( $this->logfile, 'r+' ) ) { $filepos = ftell( $fd ); - $found = 0; + $found = 0; while ( ! feof( $fd ) ) { $line = fgets( $fd ); if ( stripos( $line, '', - 100 - ) . PHP_EOL - ); + fwrite( $fd, + str_pad( '', + 100 ) . PHP_EOL ); $found ++; } if ( stripos( $line, '', - 100 - ) . PHP_EOL - ); + fwrite( $fd, + str_pad( '', + 100 ) . PHP_EOL ); $found ++; } if ( $found >= 2 ) { @@ -1217,29 +1129,29 @@ private function end() { $status = __( 'ERROR', 'backwpup' ); } - $subject = sprintf( - __( '[%3$s] BackWPup log %1$s: %2$s', 'backwpup' ), - date_i18n( 'd-M-Y H:i', $this->start_time, true ), esc_attr( $this->job['name'] ), $status - ); - $headers = array(); + $subject = sprintf( __( '[%3$s] BackWPup log %1$s: %2$s', 'backwpup' ), + date_i18n( 'd-M-Y H:i', $this->start_time, true ), + esc_attr( $this->job['name'] ), + $status ); + $headers = array(); $headers[] = 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ); if ( $this->job['mailaddresssenderlog'] ) { - $this->job['mailaddresssenderlog'] = str_replace( - array( '<', '>' ), array( - '<', - '>', - ), $this->job['mailaddresssenderlog'] - ); + $this->job['mailaddresssenderlog'] = str_replace( array( '<', '>' ), + array( + '<', + '>', + ), + $this->job['mailaddresssenderlog'] ); $bracket_pos = strpos( $this->job['mailaddresssenderlog'], '<' ); - $at_pos = strpos( $this->job['mailaddresssenderlog'], '@' ); + $at_pos = strpos( $this->job['mailaddresssenderlog'], '@' ); if ( $bracket_pos === false || $at_pos === false ) { - $this->job['mailaddresssenderlog'] = str_replace( - array( - '<', - '>', - ), '', $this->job['mailaddresssenderlog'] - ) . ' <' . get_bloginfo( 'admin_email' ) . '>'; + $this->job['mailaddresssenderlog'] = str_replace( array( + '<', + '>', + ), + '', + $this->job['mailaddresssenderlog'] ) . ' <' . get_bloginfo( 'admin_email' ) . '>'; } $headers[] = 'From: ' . $this->job['mailaddresssenderlog']; @@ -1250,7 +1162,7 @@ private function end() { //set done $this->substeps_done = 1; - $this->steps_done[] = 'END'; + $this->steps_done[] = 'END'; //clean up temp self::clean_temp_folder(); @@ -1273,17 +1185,17 @@ private function end() { */ public static function clean_temp_folder() { - $instance = new self(); - $temp_dir = BackWPup::get_plugin_data( 'TEMP' ); + $instance = new self(); + $temp_dir = BackWPup::get_plugin_data( 'TEMP' ); $do_not_delete_files = array( '.htaccess', 'nginx.conf', 'index.php', '.', '..', '.donotbackup' ); if ( is_writable( $temp_dir ) ) { try { $dir = new BackWPup_Directory( $temp_dir ); foreach ( $dir as $file ) { - if ( in_array( $file->getFilename(), $do_not_delete_files, true ) - || $file->isDir() - || $file->isLink() ) { + if ( in_array( $file->getFilename(), + $do_not_delete_files, + true ) || $file->isDir() || $file->isLink() ) { continue; } if ( $file->isWritable() ) { @@ -1345,7 +1257,7 @@ public function do_restart( $must = false ) { } //do things for a clean restart - $this->pid = 0; + $this->pid = 0; $this->uniqid = ''; $this->write_running_file(); remove_action( 'shutdown', array( $this, 'shutdown' ) ); @@ -1363,28 +1275,25 @@ public function do_restart( $must = false ) { * * @param string $starttype Start types are 'runnow', 'runnowlink', 'cronrun', 'runext', 'restart', 'restartalt', * 'test' - * @param int $jobid The id of job to start else 0 + * @param int $jobid The id of job to start else 0 * * @return array|object [url] is the job url [header] for auth header or object form wp_remote_get() */ public static function get_jobrun_url( $starttype, $jobid = 0 ) { - $authentication = get_site_option( - 'backwpup_cfg_authentication', array( - 'method' => '', - 'basic_user' => '', - 'basic_password' => '', - 'user_id' => 0, - 'query_arg' => '', - ) - ); - $url = site_url( 'wp-cron.php' ); - $header = array( 'Cache-Control' => 'no-cache' ); - $authurl = ''; - $query_args = array( - '_nonce' => substr( - wp_hash( wp_nonce_tick() . 'backwpup_job_run-' . $starttype, 'nonce' ), - 12, 10 - ), + $authentication = get_site_option( 'backwpup_cfg_authentication', + array( + 'method' => '', + 'basic_user' => '', + 'basic_password' => '', + 'user_id' => 0, + 'query_arg' => '', + ) ); + $url = site_url( 'wp-cron.php' ); + $header = array( 'Cache-Control' => 'no-cache' ); + $authurl = ''; + $query_args = array( + '_nonce' => substr( wp_hash( wp_nonce_tick() . 'backwpup_job_run-' . $starttype, 'nonce' ), - 12, 10 ), 'doing_wp_cron' => sprintf( '%.22F', microtime( true ) ), ); @@ -1397,14 +1306,8 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { } if ( ! empty( $authentication['basic_user'] ) && ! empty( $authentication['basic_password'] ) && $authentication['method'] == 'basic' ) { - $header['Authorization'] = 'Basic ' . base64_encode( - $authentication['basic_user'] . ':' . BackWPup_Encryption::decrypt( - $authentication['basic_password'] - ) - ); - $authurl = urlencode( $authentication['basic_user'] ) . ':' . urlencode( - BackWPup_Encryption::decrypt( $authentication['basic_password'] ) - ) . '@'; + $header['Authorization'] = 'Basic ' . base64_encode( $authentication['basic_user'] . ':' . BackWPup_Encryption::decrypt( $authentication['basic_password'] ) ); + $authurl = urlencode( $authentication['basic_user'] ) . ':' . urlencode( BackWPup_Encryption::decrypt( $authentication['basic_password'] ) ) . '@'; } if ( ! empty( $authentication['query_arg'] ) && $authentication['method'] == 'query_arg' ) { @@ -1412,7 +1315,7 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { } if ( $starttype === 'runext' ) { - $query_args['_nonce'] = get_site_option( 'backwpup_cfg_jobrunauthkey' ); + $query_args['_nonce'] = get_site_option( 'backwpup_cfg_jobrunauthkey' ); $query_args['doing_wp_cron'] = null; if ( ! empty( $authurl ) ) { $url = str_replace( 'https://', 'https://' . $authurl, $url ); @@ -1421,26 +1324,24 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { } if ( $starttype === 'runnowlink' && ( ! defined( 'ALTERNATE_WP_CRON' ) || ! ALTERNATE_WP_CRON ) ) { - $url = wp_nonce_url( - network_admin_url( 'admin.php' ), 'backwpup_job_run-' . $starttype - ); - $query_args['page'] = 'backwpupjobs'; - $query_args['action'] = 'runnow'; + $url = wp_nonce_url( network_admin_url( 'admin.php' ), 'backwpup_job_run-' . $starttype ); + $query_args['page'] = 'backwpupjobs'; + $query_args['action'] = 'runnow'; $query_args['doing_wp_cron'] = null; unset( $query_args['_nonce'] ); } if ( $starttype === 'runnowlink' && defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { - $query_args['backwpup_run'] = 'runnowalt'; - $query_args['_nonce'] = substr( - wp_hash( wp_nonce_tick() . 'backwpup_job_run-runnowalt', 'nonce' ), - 12, 10 - ); + $query_args['backwpup_run'] = 'runnowalt'; + $query_args['_nonce'] = substr( wp_hash( wp_nonce_tick() . 'backwpup_job_run-runnowalt', 'nonce' ), + - 12, + 10 ); $query_args['doing_wp_cron'] = null; } if ( $starttype === 'restartalt' && defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { $query_args['backwpup_run'] = 'restart'; - $query_args['_nonce'] = null; + $query_args['_nonce'] = null; } if ( $starttype === 'restart' || $starttype === 'test' ) { @@ -1456,12 +1357,13 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { $wp_admin_user = get_users( array( 'role' => 'backwpup_admin', 'number' => 1 ) ); } if ( ! empty( $wp_admin_user[0]->ID ) ) { - $expiration = time() + ( 2 * DAY_IN_SECONDS ); - $manager = WP_Session_Tokens::get_instance( $wp_admin_user[0]->ID ); - $token = $manager->create( $expiration ); - $cookies[ LOGGED_IN_COOKIE ] = wp_generate_auth_cookie( - $wp_admin_user[0]->ID, $expiration, 'logged_in', $token - ); + $expiration = time() + ( 2 * DAY_IN_SECONDS ); + $manager = WP_Session_Tokens::get_instance( $wp_admin_user[0]->ID ); + $token = $manager->create( $expiration ); + $cookies[ LOGGED_IN_COOKIE ] = wp_generate_auth_cookie( $wp_admin_user[0]->ID, + $expiration, + 'logged_in', + $token ); } set_site_transient( 'backwpup_cookies', $cookies, 2 * DAY_IN_SECONDS ); } @@ -1470,13 +1372,13 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { } $cron_request = array( - 'url' => add_query_arg( $query_args, $url ), - 'key' => $query_args['doing_wp_cron'], + 'url' => add_query_arg( $query_args, $url ), + 'key' => $query_args['doing_wp_cron'], 'args' => array( - 'blocking' => false, - 'sslverify' => false, - 'timeout' => 0.01, - 'headers' => $header, + 'blocking' => false, + 'sslverify' => false, + 'timeout' => 0.01, + 'headers' => $header, 'user-agent' => BackWPup::get_plugin_data( 'User-Agent' ), ), ); @@ -1490,7 +1392,7 @@ public static function get_jobrun_url( $starttype, $jobid = 0 ) { $cron_request = apply_filters( 'cron_request', $cron_request ); if ( $starttype === 'test' ) { - $cron_request['args']['timeout'] = 15; + $cron_request['args']['timeout'] = 15; $cron_request['args']['blocking'] = true; } @@ -1538,7 +1440,7 @@ public function run() { // set timestamp of script start $this->timestamp_script_start = microtime( true ); //set Pid - $this->pid = self::get_pid(); + $this->pid = self::get_pid(); $this->uniqid = uniqid( '', true ); //Early write new working file $this->write_running_file(); @@ -1622,20 +1524,17 @@ public function run() { } //calc step percent if ( count( $this->steps_done ) > 0 ) { - $this->step_percent = min( - round( count( $this->steps_done ) / count( $this->steps_todo ) * 100 ), 100 - ); + $this->step_percent = min( round( count( $this->steps_done ) / count( $this->steps_todo ) * 100 ), + 100 ); } else { $this->step_percent = 1; } // do step tries while ( true ) { - if ( $this->steps_data[ $this->step_working ]['STEP_TRY'] >= get_site_option( - 'backwpup_cfg_jobstepretry' - ) ) { + if ( $this->steps_data[ $this->step_working ]['STEP_TRY'] >= get_site_option( 'backwpup_cfg_jobstepretry' ) ) { $this->log( __( 'Step aborted: too many attempts!', 'backwpup' ), E_USER_ERROR ); - $this->temp = array(); - $this->steps_done[] = $this->step_working; + $this->temp = array(); + $this->steps_done[] = $this->step_working; $this->substeps_done = 0; $this->substeps_todo = 0; $this->do_restart(); @@ -1659,18 +1558,18 @@ public function run() { $done = $job_types[ str_replace( 'JOB_', '', $this->step_working ) ]->job_run( $this ); } elseif ( strstr( $this->step_working, 'DEST_SYNC_' ) ) { $done = BackWPup::get_destination( str_replace( 'DEST_SYNC_', '', $this->step_working ) ) - ->job_run_sync( $this ); + ->job_run_sync( $this ); } elseif ( strstr( $this->step_working, 'DEST_' ) ) { $done = BackWPup::get_destination( str_replace( 'DEST_', '', $this->step_working ) ) - ->job_run_archive( $this ); + ->job_run_archive( $this ); } elseif ( ! empty( $this->steps_data[ $this->step_working ]['CALLBACK'] ) ) { $done = $this->steps_data[ $this->step_working ]['CALLBACK']( $this ); } // set step as done if ( $done === true ) { - $this->temp = array(); - $this->steps_done[] = $this->step_working; + $this->temp = array(); + $this->steps_done[] = $this->step_working; $this->substeps_done = 0; $this->substeps_todo = 0; $this->update_working_data( true ); @@ -1703,20 +1602,14 @@ private function create_archive() { $this->steps_data[ $this->step_working ]['on_folder'] = ''; } - if ( $this->steps_data[ $this->step_working ]['on_folder'] == '' && $this->steps_data[ $this->step_working ]['on_file'] == '' - && is_file( - $this->backup_folder . $this->backup_file - ) ) { + if ( $this->steps_data[ $this->step_working ]['on_folder'] == '' && $this->steps_data[ $this->step_working ]['on_file'] == '' && is_file( $this->backup_folder . $this->backup_file ) ) { unlink( $this->backup_folder . $this->backup_file ); } if ( $this->steps_data[ $this->step_working ]['SAVE_STEP_TRY'] != $this->steps_data[ $this->step_working ]['STEP_TRY'] ) { - $this->log( - sprintf( - __( '%d. Trying to create backup archive …', 'backwpup' ), - $this->steps_data[ $this->step_working ]['STEP_TRY'] - ), E_USER_NOTICE - ); + $this->log( sprintf( __( '%d. Trying to create backup archive …', 'backwpup' ), + $this->steps_data[ $this->step_working ]['STEP_TRY'] ), + E_USER_NOTICE ); } try { @@ -1724,20 +1617,15 @@ private function create_archive() { //show method for creation if ( $this->substeps_done == 0 ) { - $this->log( - sprintf( - _x( - 'Compressing files as %s. Please be patient, this may take a moment.', - 'Archive compression method', 'backwpup' - ), $backup_archive->get_method() - ) - ); + $this->log( sprintf( _x( 'Compressing files as %s. Please be patient, this may take a moment.', + 'Archive compression method', + 'backwpup' ), + $backup_archive->get_method() ) ); } //add extra files if ( $this->substeps_done == 0 ) { if ( ! empty( $this->additional_files_to_backup ) && $this->substeps_done == 0 ) { - $this->log( print_r( $this->additional_files_to_backup, true ) ); if ( $this->is_debug() ) { $this->log( __( 'Adding Extra files to Archive', 'backwpup' ) ); } @@ -1748,12 +1636,10 @@ private function create_archive() { $this->update_working_data(); } else { $backup_archive->close(); - $this->steps_data[ $this->step_working ]['on_file'] = ''; + $this->steps_data[ $this->step_working ]['on_file'] = ''; $this->steps_data[ $this->step_working ]['on_folder'] = ''; - $this->log( - __( 'Cannot create backup archive correctly. Aborting creation.', 'backwpup' ), - E_USER_ERROR - ); + $this->log( __( 'Cannot create backup archive correctly. Aborting creation.', 'backwpup' ), + E_USER_ERROR ); return false; } @@ -1772,7 +1658,7 @@ private function create_archive() { $this->log( sprintf( __( 'Archiving Folder: %s', 'backwpup' ), $folder ) ); } $this->steps_data[ $this->step_working ]['on_folder'] = $folder; - $files_in_folder = $this->get_files_in_folder( $folder ); + $files_in_folder = $this->get_files_in_folder( $folder ); //add empty folders if ( empty( $files_in_folder ) ) { $folder_name_in_archive = trim( ltrim( $this->get_destination_path_replacement( $folder ), '/' ) ); @@ -1791,6 +1677,17 @@ private function create_archive() { continue; } + // Check if the file matches a filename in $this->additional_files_to_backup + // This prevents .sql files from being overwritten, + // as well as manifest.json, etc. + $alreadyAdded = count( array_filter( $this->additional_files_to_backup, + function ( $value ) use ( $file ) { + + return strstr( $value, basename( $file ) ); + } ) ) > 0; + if ( $alreadyAdded ) { + continue; + } $this->steps_data[ $this->step_working ]['on_file'] = $file; //restart if needed $restart_time = $this->get_restart_time(); @@ -1810,18 +1707,15 @@ private function create_archive() { } else { $backup_archive->close(); unset( $backup_archive ); - $this->steps_data[ $this->step_working ]['on_file'] = ''; + $this->steps_data[ $this->step_working ]['on_file'] = ''; $this->steps_data[ $this->step_working ]['on_folder'] = ''; - $this->substeps_done = 0; - $this->backup_filesize = filesize( - $this->backup_folder . $this->backup_file - ); + $this->substeps_done = 0; + $this->backup_filesize = filesize( $this->backup_folder . $this->backup_file ); if ( $this->backup_filesize === false ) { $this->backup_filesize = PHP_INT_MAX; } - $this->log( - __( 'Cannot create backup archive correctly. Aborting creation.', 'backwpup' ), E_USER_ERROR - ); + $this->log( __( 'Cannot create backup archive correctly. Aborting creation.', 'backwpup' ), + E_USER_ERROR ); return false; } @@ -1845,26 +1739,19 @@ private function create_archive() { } if ( $this->backup_filesize >= PHP_INT_MAX ) { - $this->log( - __( - 'The Backup archive will be too large for file operations with this PHP Version. You might want to consider splitting the backup job in multiple jobs with less files each.', - 'backwpup' - ), E_USER_ERROR - ); + $this->log( __( 'The Backup archive will be too large for file operations with this PHP Version. You might want to consider splitting the backup job in multiple jobs with less files each.', + 'backwpup' ), + E_USER_ERROR ); $this->end(); } else { - $this->log( - sprintf( __( 'Archive size is %s.', 'backwpup' ), size_format( $this->backup_filesize, 2 ) ), - E_USER_NOTICE - ); + $this->log( sprintf( __( 'Archive size is %s.', 'backwpup' ), size_format( $this->backup_filesize, 2 ) ), + E_USER_NOTICE ); } - $this->log( - sprintf( - __( '%1$d Files with %2$s in Archive.', 'backwpup' ), $this->count_files, - size_format( $this->count_files_size, 2 ) - ), E_USER_NOTICE - ); + $this->log( sprintf( __( '%1$d Files with %2$s in Archive.', 'backwpup' ), + $this->count_files, + size_format( $this->count_files_size, 2 ) ), + E_USER_NOTICE ); return true; } @@ -1878,8 +1765,9 @@ private function create_archive() { */ private function encrypt_archive() { + $encryptionType = get_site_option( 'backwpup_cfg_encryption' ); // Substeps is number of 128 KB chunks - $block_size = 128 * 1024; + $block_size = 128 * 1024; $this->substeps_todo = ceil( $this->backup_filesize / $block_size ); if ( ! isset( $this->steps_data[ $this->step_working ]['encrypted_filename'] ) ) { @@ -1890,14 +1778,16 @@ private function encrypt_archive() { } if ( ! isset( $this->steps_data[ $this->step_working ]['key'] ) ) { - if ( get_site_option( 'backwpup_cfg_encryption' ) == 'symmetric' ) { - $this->steps_data[ $this->step_working ]['key'] = pack( - 'H*', get_site_option( 'backwpup_cfg_encryptionkey' ) - ); - } elseif ( get_site_option( 'backwpup_cfg_encryption' ) == 'asymmetric' ) { - // Generate random symmetric key - $this->steps_data[ $this->step_working ]['key'] = \phpseclib\Crypt\Random::string( 32 ); + switch ( $encryptionType ) { + case self::ENCRYPTION_SYMMETRIC: + $key = get_site_option( 'backwpup_cfg_encryptionkey' ); + $this->steps_data[ $this->step_working ]['key'] = pack( 'H*', $key ); + break; + case self::ENCRYPTION_ASYMMETRIC: + $this->steps_data[ $this->step_working ]['key'] = \phpseclib\Crypt\Random::string( 32 ); + break; } + if ( empty( $this->steps_data[ $this->step_working ]['key'] ) ) { $this->log( __( 'No encryption key was provided. Aborting encryption.', 'backwpup' ), E_USER_WARNING ); @@ -1907,12 +1797,9 @@ private function encrypt_archive() { if ( $this->steps_data[ $this->step_working ]['SAVE_STEP_TRY'] != $this->steps_data[ $this->step_working ]['STEP_TRY'] ) { // Show initial log message - $this->log( - sprintf( - __( '%d. Trying to encrypt archive …', 'backwpup' ), - $this->steps_data[ $this->step_working ]['STEP_TRY'] - ), E_USER_NOTICE - ); + $this->log( sprintf( __( '%d. Trying to encrypt archive …', 'backwpup' ), + $this->steps_data[ $this->step_working ]['STEP_TRY'] ), + E_USER_NOTICE ); } $aes = new \phpseclib\Crypt\AES( \phpseclib\Crypt\AES::MODE_CBC ); @@ -1934,24 +1821,23 @@ private function encrypt_archive() { return false; } - if ( $this->substeps_done == 0 ) { - // First byte: 0 if symmetric, 1 otherwise - if ( get_site_option( 'backwpup_cfg_encryption' ) == 'symmetric' ) { - fwrite( $file_out, "\x00" ); - } elseif ( get_site_option( 'backwpup_cfg_encryption' ) == 'asymmetric' ) { - fwrite( $file_out, "\x01" ); + if ( $this->substeps_done === 0 ) { + switch ( $encryptionType ) { + case self::ENCRYPTION_SYMMETRIC: + fwrite( $file_out, "\x00" ); + break; + case self::ENCRYPTION_ASYMMETRIC: + fwrite( $file_out, "\x01" ); - // Next, encode random symmetric key - $rsa = new \phpseclib\Crypt\RSA(); - $rsa->loadKey( get_site_option( 'backwpup_cfg_publickey' ) ); - $key = $rsa->encrypt( $this->steps_data[ $this->step_working ]['key'] ); - $length = strlen( $key ); + $rsa = new \phpseclib\Crypt\RSA(); + $rsa->loadKey( get_site_option( 'backwpup_cfg_publickey' ) ); - // Second byte is the length of the encrypted symmetric key - fwrite( $file_out, pack( 'H*', dechex( $length ) ) ); + $key = $rsa->encrypt( $this->steps_data[ $this->step_working ]['key'] ); + $length = strlen( $key ); - // Then write the encrypted symmetric key - fwrite( $file_out, $key ); + fwrite( $file_out, pack( 'H*', dechex( $length ) ) ); + fwrite( $file_out, $key ); + break; } } @@ -1964,7 +1850,7 @@ private function encrypt_archive() { $length = strlen( $data ); if ( $this->substeps_done == $this->substeps_todo - 1 ) { // Pad as necessary - $pad = 16 - ( $length % 16 ); + $pad = 16 - ( $length % 16 ); $data = str_pad( $data, $length + $pad, chr( $pad ) ); } fwrite( $file_out, $aes->encrypt( $data ) ); @@ -1987,9 +1873,8 @@ private function encrypt_archive() { fclose( $file_in ); fclose( $file_out ); - $this->log( - sprintf( __( 'Encrypted %s of data.', 'backwpup' ), size_format( $bytes_read, 2 ) ), E_USER_NOTICE - ); + $this->log( sprintf( __( 'Encrypted %s of data.', 'backwpup' ), size_format( $bytes_read, 2 ) ), + E_USER_NOTICE ); // Remove the original file then rename the encrypted file if ( ! unlink( $this->backup_folder . $this->backup_file ) ) { @@ -1997,9 +1882,8 @@ private function encrypt_archive() { return false; } - if ( ! rename( - $this->steps_data[ $this->step_working ]['encrypted_filename'], $this->backup_folder . $this->backup_file - ) ) { + if ( ! rename( $this->steps_data[ $this->step_working ]['encrypted_filename'], + $this->backup_folder . $this->backup_file ) ) { $this->log( __( 'Unable to rename encrypted archive.', 'backwpup' ) ); return false; @@ -2051,21 +1935,19 @@ public function get_folders_to_backup() { */ public function get_files_in_folder( $folder ) { - $files = array(); + $files = array(); $folder = trailingslashit( $folder ); if ( ! is_dir( $folder ) ) { - $this->log( - sprintf( _x( 'Folder %s does not exist', 'Folder name', 'backwpup' ), $folder ), E_USER_WARNING - ); + $this->log( sprintf( _x( 'Folder %s does not exist', 'Folder name', 'backwpup' ), $folder ), + E_USER_WARNING ); return $files; } if ( ! is_readable( $folder ) ) { - $this->log( - sprintf( _x( 'Folder %s is not readable', 'Folder name', 'backwpup' ), $folder ), E_USER_WARNING - ); + $this->log( sprintf( _x( 'Folder %s is not readable', 'Folder name', 'backwpup' ), $folder ), + E_USER_WARNING ); return $files; } @@ -2084,32 +1966,24 @@ public function get_files_in_folder( $folder ) { continue 2; } } - if ( $this->job['backupexcludethumbs'] - && strpos( - $folder, BackWPup_File::get_upload_dir() - ) !== false - && preg_match( "/\-[0-9]{1,4}x[0-9]{1,4}.+\.(jpg|png|gif)$/i", $file->getFilename() ) ) { + if ( $this->job['backupexcludethumbs'] && strpos( $folder, + BackWPup_File::get_upload_dir() ) !== false && preg_match( "/\-[0-9]{1,4}x[0-9]{1,4}.+\.(jpg|png|gif)$/i", + $file->getFilename() ) ) { continue; } if ( $file->isLink() ) { - $this->log( - sprintf( __( 'Link "%s" not following.', 'backwpup' ), $file->getPathname() ), E_USER_WARNING - ); + $this->log( sprintf( __( 'Link "%s" not following.', 'backwpup' ), $file->getPathname() ), + E_USER_WARNING ); } elseif ( ! $file->isReadable() ) { - $this->log( - sprintf( __( 'File "%s" is not readable!', 'backwpup' ), $file->getPathname() ), E_USER_WARNING - ); + $this->log( sprintf( __( 'File "%s" is not readable!', 'backwpup' ), $file->getPathname() ), + E_USER_WARNING ); } else { $file_size = $file->getSize(); if ( ! is_int( $file_size ) || $file_size < 0 || $file_size > 2147483647 ) { - $this->log( - sprintf( - __( - 'File size of “%s” cannot be retrieved. File might be too large and will not be added to queue.', - 'backwpup' - ), $file->getPathname() . ' ' . $file_size - ), E_USER_WARNING - ); + $this->log( sprintf( __( 'File size of “%s” cannot be retrieved. File might be too large and will not be added to queue.', + 'backwpup' ), + $file->getPathname() . ' ' . $file_size ), + E_USER_WARNING ); continue; } $files[] = BackWPup_Path_Fixer::slashify( realpath( $path ) ); @@ -2161,7 +2035,7 @@ public function do_restart_time( $do_restart_now = false ) { //do restart after signal is send if ( $this->signal !== 0 ) { $this->steps_data[ $this->step_working ]['SAVE_STEP_TRY'] = $this->steps_data[ $this->step_working ]['STEP_TRY']; - $this->steps_data[ $this->step_working ]['STEP_TRY'] -= 1; + $this->steps_data[ $this->step_working ]['STEP_TRY'] -= 1; $this->do_restart( true ); } @@ -2176,7 +2050,7 @@ public function do_restart_time( $do_restart_now = false ) { // do restart 3 sec. before max. execution time if ( $do_restart_now || $execution_time >= ( $job_max_execution_time - 3 ) ) { $this->steps_data[ $this->step_working ]['SAVE_STEP_TRY'] = $this->steps_data[ $this->step_working ]['STEP_TRY']; - $this->steps_data[ $this->step_working ]['STEP_TRY'] -= 1; + $this->steps_data[ $this->step_working ]['STEP_TRY'] -= 1; $this->do_restart( true ); } @@ -2192,37 +2066,33 @@ public function create_manifest() { $this->substeps_todo = 3; - $this->log( - sprintf( - __( '%d. Trying to generate a manifest file …', 'backwpup' ), - $this->steps_data[ $this->step_working ]['STEP_TRY'] - ) - ); + $this->log( sprintf( __( '%d. Trying to generate a manifest file …', 'backwpup' ), + $this->steps_data[ $this->step_working ]['STEP_TRY'] ) ); //build manifest $manifest = array(); // add blog information - $manifest['blog_info']['url'] = home_url(); - $manifest['blog_info']['wpurl'] = site_url(); - $manifest['blog_info']['prefix'] = $GLOBALS['wpdb']->prefix; - $manifest['blog_info']['description'] = get_option( 'blogdescription' ); + $manifest['blog_info']['url'] = home_url(); + $manifest['blog_info']['wpurl'] = site_url(); + $manifest['blog_info']['prefix'] = $GLOBALS['wpdb']->prefix; + $manifest['blog_info']['description'] = get_option( 'blogdescription' ); $manifest['blog_info']['stylesheet_directory'] = get_template_directory_uri(); - $manifest['blog_info']['activate_plugins'] = wp_get_active_and_valid_plugins(); - $manifest['blog_info']['activate_theme'] = wp_get_theme()->get( 'Name' ); - $manifest['blog_info']['admin_email'] = get_option( 'admin_email' ); - $manifest['blog_info']['charset'] = get_bloginfo( 'charset' ); - $manifest['blog_info']['version'] = BackWPup::get_plugin_data( 'wp_version' ); - $manifest['blog_info']['backwpup_version'] = BackWPup::get_plugin_data( 'version' ); - $manifest['blog_info']['language'] = get_bloginfo( 'language' ); - $manifest['blog_info']['name'] = get_bloginfo( 'name' ); - $manifest['blog_info']['abspath'] = ABSPATH; - $manifest['blog_info']['uploads'] = wp_upload_dir( null, false, true ); - $manifest['blog_info']['contents']['basedir'] = WP_CONTENT_DIR; - $manifest['blog_info']['contents']['baseurl'] = WP_CONTENT_URL; - $manifest['blog_info']['plugins']['basedir'] = WP_PLUGIN_DIR; - $manifest['blog_info']['plugins']['baseurl'] = WP_PLUGIN_URL; - $manifest['blog_info']['themes']['basedir'] = get_theme_root(); - $manifest['blog_info']['themes']['baseurl'] = get_theme_root_uri(); + $manifest['blog_info']['activate_plugins'] = wp_get_active_and_valid_plugins(); + $manifest['blog_info']['activate_theme'] = wp_get_theme()->get( 'Name' ); + $manifest['blog_info']['admin_email'] = get_option( 'admin_email' ); + $manifest['blog_info']['charset'] = get_bloginfo( 'charset' ); + $manifest['blog_info']['version'] = BackWPup::get_plugin_data( 'wp_version' ); + $manifest['blog_info']['backwpup_version'] = BackWPup::get_plugin_data( 'version' ); + $manifest['blog_info']['language'] = get_bloginfo( 'language' ); + $manifest['blog_info']['name'] = get_bloginfo( 'name' ); + $manifest['blog_info']['abspath'] = ABSPATH; + $manifest['blog_info']['uploads'] = wp_upload_dir( null, false, true ); + $manifest['blog_info']['contents']['basedir'] = WP_CONTENT_DIR; + $manifest['blog_info']['contents']['baseurl'] = WP_CONTENT_URL; + $manifest['blog_info']['plugins']['basedir'] = WP_PLUGIN_DIR; + $manifest['blog_info']['plugins']['baseurl'] = WP_PLUGIN_URL; + $manifest['blog_info']['themes']['basedir'] = get_theme_root(); + $manifest['blog_info']['themes']['baseurl'] = get_theme_root_uri(); // add job settings $manifest['job_settings'] = $this->job; // add archive info @@ -2234,24 +2104,16 @@ public function create_manifest() { $manifest['archive']['abspath'] = trailingslashit( $this->get_destination_path_replacement( ABSPATH ) ); } if ( $this->job['backupuploads'] ) { - $manifest['archive']['uploads'] = trailingslashit( - $this->get_destination_path_replacement( BackWPup_File::get_upload_dir() ) - ); + $manifest['archive']['uploads'] = trailingslashit( $this->get_destination_path_replacement( BackWPup_File::get_upload_dir() ) ); } if ( $this->job['backupcontent'] ) { - $manifest['archive']['contents'] = trailingslashit( - $this->get_destination_path_replacement( WP_CONTENT_DIR ) - ); + $manifest['archive']['contents'] = trailingslashit( $this->get_destination_path_replacement( WP_CONTENT_DIR ) ); } if ( $this->job['backupplugins'] ) { - $manifest['archive']['plugins'] = trailingslashit( - $this->get_destination_path_replacement( WP_PLUGIN_DIR ) - ); + $manifest['archive']['plugins'] = trailingslashit( $this->get_destination_path_replacement( WP_PLUGIN_DIR ) ); } if ( $this->job['backupthemes'] ) { - $manifest['archive']['themes'] = trailingslashit( - $this->get_destination_path_replacement( get_theme_root() ) - ); + $manifest['archive']['themes'] = trailingslashit( $this->get_destination_path_replacement( get_theme_root() ) ); } } @@ -2262,12 +2124,10 @@ public function create_manifest() { //Create backwpup_readme.txt $readme_text = __( 'You may have noticed the manifest.json file in this archive.', 'backwpup' ) . PHP_EOL; - $readme_text .= __( - 'manifest.json might be needed for later restoring a backup from this archive.', 'backwpup' - ) . PHP_EOL; - $readme_text .= __( - 'Please leave manifest.json untouched and in place. Otherwise it is safe to be ignored.', 'backwpup' - ) . PHP_EOL; + $readme_text .= __( 'manifest.json might be needed for later restoring a backup from this archive.', + 'backwpup' ) . PHP_EOL; + $readme_text .= __( 'Please leave manifest.json untouched and in place. Otherwise it is safe to be ignored.', + 'backwpup' ) . PHP_EOL; if ( ! file_put_contents( BackWPup::get_plugin_data( 'TEMP' ) . 'backwpup_readme.txt', $readme_text ) ) { return false; } @@ -2277,12 +2137,8 @@ public function create_manifest() { if ( is_readable( BackWPup::get_plugin_data( 'TEMP' ) . 'manifest.json' ) ) { $this->additional_files_to_backup[] = BackWPup::get_plugin_data( 'TEMP' ) . 'manifest.json'; $this->additional_files_to_backup[] = BackWPup::get_plugin_data( 'TEMP' ) . 'backwpup_readme.txt'; - $this->log( - sprintf( - __( 'Added manifest.json file with %1$s to backup file list.', 'backwpup' ), - size_format( filesize( BackWPup::get_plugin_data( 'TEMP' ) . 'manifest.json' ), 2 ) - ) - ); + $this->log( sprintf( __( 'Added manifest.json file with %1$s to backup file list.', 'backwpup' ), + size_format( filesize( BackWPup::get_plugin_data( 'TEMP' ) . 'manifest.json' ), 2 ) ) ); } $this->substeps_done = 3; @@ -2372,14 +2228,14 @@ public static function disable_caches() { public static function read_logheader( $logfile ) { $usedmetas = array( - "date" => "logtime", - "backwpup_logtime" => "logtime", //old value of date - "backwpup_errors" => "errors", - "backwpup_warnings" => "warnings", - "backwpup_jobid" => "jobid", - "backwpup_jobname" => "name", - "backwpup_jobtype" => "type", - "backwpup_jobruntime" => "runtime", + "date" => "logtime", + "backwpup_logtime" => "logtime", //old value of date + "backwpup_errors" => "errors", + "backwpup_warnings" => "warnings", + "backwpup_jobid" => "jobid", + "backwpup_jobname" => "name", + "backwpup_jobtype" => "type", + "backwpup_jobruntime" => "runtime", "backwpup_backupfilesize" => "backupfilesize", ); @@ -2424,7 +2280,7 @@ public static function user_abort() { //if job not working currently abort it this way for message $not_worked_time = microtime( true ) - $job_object->timestamp_last_update; - $restart_time = get_site_option( 'backwpup_cfg_jobmaxexecutiontime' ); + $restart_time = get_site_option( 'backwpup_cfg_jobmaxexecutiontime' ); if ( empty( $restart_time ) ) { $restart_time = 60; } @@ -2435,226 +2291,6 @@ public static function user_abort() { } - /** - * - * Get the mime type of a file - * - * @param string $file The full file name - * - * @return bool|string the mime type or false - */ - public static function get_mime_type( $file ) { - - if ( is_dir( $file ) || is_link( $file ) ) { - return 'application/octet-stream'; - } - - $mime_types = array( - 'zip' => 'application/zip', - 'gz' => 'application/gzip', - 'bz2' => 'application/x-bzip', - 'tar' => 'application/x-tar', - '3gp' => 'video/3gpp', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'asc' => 'text/plain', - 'atom' => 'application/atom+xml', - 'au' => 'audio/basic', - 'avi' => 'video/x-msvideo', - 'bcpio' => 'application/x-bcpio', - 'bin' => 'application/octet-stream', - 'bmp' => 'image/bmp', - 'cdf' => 'application/x-netcdf', - 'cgm' => 'image/cgm', - 'class' => 'application/octet-stream', - 'cpio' => 'application/x-cpio', - 'cpt' => 'application/mac-compactpro', - 'csh' => 'application/x-csh', - 'css' => 'text/css', - 'dcr' => 'application/x-director', - 'dif' => 'video/x-dv', - 'dir' => 'application/x-director', - 'djv' => 'image/vnd.djvu', - 'djvu' => 'image/vnd.djvu', - 'dll' => 'application/octet-stream', - 'dmg' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'doc' => 'application/msword', - 'dtd' => 'application/xml-dtd', - 'dv' => 'video/x-dv', - 'dvi' => 'application/x-dvi', - 'dxr' => 'application/x-director', - 'eps' => 'application/postscript', - 'etx' => 'text/x-setext', - 'exe' => 'application/octet-stream', - 'ez' => 'application/andrew-inset', - 'flv' => 'video/x-flv', - 'gif' => 'image/gif', - 'gram' => 'application/srgs', - 'grxml' => 'application/srgs+xml', - 'gtar' => 'application/x-gtar', - 'hdf' => 'application/x-hdf', - 'hqx' => 'application/mac-binhex40', - 'htm' => 'text/html', - 'html' => 'text/html', - 'ice' => 'x-conference/x-cooltalk', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ief' => 'image/ief', - 'ifb' => 'text/calendar', - 'iges' => 'model/iges', - 'igs' => 'model/iges', - 'jnlp' => 'application/x-java-jnlp-file', - 'jp2' => 'image/jp2', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'js' => 'application/x-javascript', - 'kar' => 'audio/midi', - 'latex' => 'application/x-latex', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'm3u' => 'audio/x-mpegurl', - 'm4a' => 'audio/mp4a-latm', - 'm4p' => 'audio/mp4a-latm', - 'm4u' => 'video/vnd.mpegurl', - 'm4v' => 'video/x-m4v', - 'mac' => 'image/x-macpaint', - 'man' => 'application/x-troff-man', - 'mathml' => 'application/mathml+xml', - 'me' => 'application/x-troff-me', - 'mesh' => 'model/mesh', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mif' => 'application/vnd.mif', - 'mov' => 'video/quicktime', - 'movie' => 'video/x-sgi-movie', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpga' => 'audio/mpeg', - 'ms' => 'application/x-troff-ms', - 'msh' => 'model/mesh', - 'mxu' => 'video/vnd.mpegurl', - 'nc' => 'application/x-netcdf', - 'oda' => 'application/oda', - 'ogg' => 'application/ogg', - 'ogv' => 'video/ogv', - 'pbm' => 'image/x-portable-bitmap', - 'pct' => 'image/pict', - 'pdb' => 'chemical/x-pdb', - 'pdf' => 'application/pdf', - 'pgm' => 'image/x-portable-graymap', - 'pgn' => 'application/x-chess-pgn', - 'pic' => 'image/pict', - 'pict' => 'image/pict', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'pnt' => 'image/x-macpaint', - 'pntg' => 'image/x-macpaint', - 'ppm' => 'image/x-portable-pixmap', - 'ppt' => 'application/vnd.ms-powerpoint', - 'ps' => 'application/postscript', - 'qt' => 'video/quicktime', - 'qti' => 'image/x-quicktime', - 'qtif' => 'image/x-quicktime', - 'ra' => 'audio/x-pn-realaudio', - 'ram' => 'audio/x-pn-realaudio', - 'ras' => 'image/x-cmu-raster', - 'rdf' => 'application/rdf+xml', - 'rgb' => 'image/x-rgb', - 'rm' => 'application/vnd.rn-realmedia', - 'roff' => 'application/x-troff', - 'rtf' => 'text/rtf', - 'rtx' => 'text/richtext', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'sh' => 'application/x-sh', - 'shar' => 'application/x-shar', - 'silo' => 'model/mesh', - 'sit' => 'application/x-stuffit', - 'skd' => 'application/x-koan', - 'skm' => 'application/x-koan', - 'skp' => 'application/x-koan', - 'skt' => 'application/x-koan', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'snd' => 'audio/basic', - 'so' => 'application/octet-stream', - 'spl' => 'application/x-futuresplash', - 'src' => 'application/x-wais-source', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'svg' => 'image/svg+xml', - 'swf' => 'application/x-shockwave-flash', - 't' => 'application/x-troff', - 'tcl' => 'application/x-tcl', - 'tex' => 'application/x-tex', - 'texi' => 'application/x-texinfo', - 'texinfo' => 'application/x-texinfo', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'tr' => 'application/x-troff', - 'tsv' => 'text/tab-separated-values', - 'txt' => 'text/plain', - 'ustar' => 'application/x-ustar', - 'vcd' => 'application/x-cdlink', - 'vrml' => 'model/vrml', - 'vxml' => 'application/voicexml+xml', - 'wav' => 'audio/x-wav', - 'wbmp' => 'image/vnd.wap.wbmp', - 'wbxml' => 'application/vnd.wap.wbxml', - 'webm' => 'video/webm', - 'wml' => 'text/vnd.wap.wml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmls' => 'text/vnd.wap.wmlscript', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'wmv' => 'video/x-ms-wmv', - 'wrl' => 'model/vrml', - 'xbm' => 'image/x-xbitmap', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xls' => 'application/vnd.ms-excel', - 'xml' => 'application/xml', - 'xpm' => 'image/x-xpixmap', - 'xsl' => 'application/xml', - 'xslt' => 'application/xslt+xml', - 'xul' => 'application/vnd.mozilla.xul+xml', - 'xwd' => 'image/x-xwindowdump', - 'xyz' => 'chemical/x-xyz', - ); - - $filesuffix = pathinfo( $file, PATHINFO_EXTENSION ); - $suffix = strtolower( $filesuffix ); - if ( isset( $mime_types[ $suffix ] ) ) { - return $mime_types[ $suffix ]; - } - - if ( ! is_readable( $file ) ) { - return 'application/octet-stream'; - } - - if ( function_exists( 'fileinfo' ) ) { - $finfo = finfo_open( FILEINFO_MIME_TYPE ); - $mime = finfo_file( $finfo, $file ); - } - - if ( empty( $mime ) && function_exists( 'mime_content_type' ) ) { - $mime = mime_content_type( $file ); - } - - if ( ! empty( $mime ) ) { - return $mime; - } - - return 'application/octet-stream'; - } - /** * Check whether exec has been disabled. * @@ -2736,7 +2372,7 @@ public static function mysqldump_error_message( $dbdumpmysqlfolder ) { public function __clone() { $this->temp = array(); - $this->run = array(); + $this->run = array(); } /** @@ -2748,134 +2384,116 @@ public function signal_handler( $signal_send ) { //known signals $signals = array( - 'SIGHUP' => array( - 'description' => _x( - 'Hangup detected on controlling terminal or death of controlling process', - 'SIGHUP: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGHUP' => array( + 'description' => _x( 'Hangup detected on controlling terminal or death of controlling process', + 'SIGHUP: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGINT' => array( - 'description' => _x( - 'Interrupt from keyboard', - 'SIGINT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGINT' => array( + 'description' => _x( 'Interrupt from keyboard', + 'SIGINT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGQUIT' => array( - 'description' => _x( - 'Quit from keyboard', - 'SIGQUIT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGQUIT' => array( + 'description' => _x( 'Quit from keyboard', + 'SIGQUIT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGILL' => array( - 'description' => _x( - 'Illegal Instruction', - 'SIGILL: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGILL' => array( + 'description' => _x( 'Illegal Instruction', + 'SIGILL: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGABRT' => array( - 'description' => _x( - 'Abort signal from abort(3)', - 'SIGABRT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_NOTICE, + 'SIGABRT' => array( + 'description' => _x( 'Abort signal from abort(3)', + 'SIGABRT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_NOTICE, ), - 'SIGBUS' => array( - 'description' => _x( - 'Bus error (bad memory access)', - 'SIGBUS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGBUS' => array( + 'description' => _x( 'Bus error (bad memory access)', + 'SIGBUS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGFPE' => array( - 'description' => _x( - 'Floating point exception', - 'SIGFPE: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGFPE' => array( + 'description' => _x( 'Floating point exception', + 'SIGFPE: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGSEGV' => array( - 'description' => _x( - 'Invalid memory reference', - 'SIGSEGV: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGSEGV' => array( + 'description' => _x( 'Invalid memory reference', + 'SIGSEGV: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGTERM' => array( - 'description' => _x( - 'Termination signal', - 'SIGTERM: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_WARNING, + 'SIGTERM' => array( + 'description' => _x( 'Termination signal', + 'SIGTERM: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_WARNING, ), 'SIGSTKFLT' => array( - 'description' => _x( - 'Stack fault on coprocessor', - 'SIGSTKFLT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'description' => _x( 'Stack fault on coprocessor', + 'SIGSTKFLT: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGUSR1' => array( - 'description' => _x( - 'User-defined signal 1', - 'SIGUSR1: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_NOTICE, + 'SIGUSR1' => array( + 'description' => _x( 'User-defined signal 1', + 'SIGUSR1: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_NOTICE, ), - 'SIGUSR2' => array( - 'description' => _x( - 'User-defined signal 2', - 'SIGUSR2: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_NOTICE, + 'SIGUSR2' => array( + 'description' => _x( 'User-defined signal 2', + 'SIGUSR2: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_NOTICE, ), - 'SIGURG' => array( - 'description' => _x( - 'Urgent condition on socket', - 'SIGURG: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_NOTICE, + 'SIGURG' => array( + 'description' => _x( 'Urgent condition on socket', + 'SIGURG: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_NOTICE, ), - 'SIGXCPU' => array( - 'description' => _x( - 'CPU time limit exceeded', - 'SIGXCPU: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGXCPU' => array( + 'description' => _x( 'CPU time limit exceeded', + 'SIGXCPU: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGXFSZ' => array( - 'description' => _x( - 'File size limit exceeded', - 'SIGXFSZ: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGXFSZ' => array( + 'description' => _x( 'File size limit exceeded', + 'SIGXFSZ: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGPWR' => array( - 'description' => _x( - 'Power failure', - 'SIGPWR: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGPWR' => array( + 'description' => _x( 'Power failure', + 'SIGPWR: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), - 'SIGSYS' => array( - 'description' => _x( - 'Bad argument to routine', - 'SIGSYS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', 'backwpup' - ), - 'error' => E_USER_ERROR, + 'SIGSYS' => array( + 'description' => _x( 'Bad argument to routine', + 'SIGSYS: Please see http://man7.org/linux/man-pages/man7/signal.7.html for details', + 'backwpup' ), + 'error' => E_USER_ERROR, ), ); foreach ( $signals as $signal => $config ) { if ( defined( $signal ) && $signal_send === constant( $signal ) ) { - $this->log( - sprintf( - __( 'Signal "%1$s" (%2$s) is sent to script!', 'backwpup' ), $signal, $config['description'] - ), $config['error'] - ); + $this->log( sprintf( __( 'Signal "%1$s" (%2$s) is sent to script!', 'backwpup' ), + $signal, + $config['description'] ), + $config['error'] ); $this->signal = $signal_send; break; } @@ -2937,11 +2555,12 @@ public function shutdown() { */ public function exception_handler( $exception ) { - $this->log( - sprintf( - __( 'Exception caught in %1$s: %2$s', 'backwpup' ), get_class( $exception ), $exception->getMessage() - ), E_USER_ERROR, $exception->getFile(), $exception->getLine() - ); + $this->log( sprintf( __( 'Exception caught in %1$s: %2$s', 'backwpup' ), + get_class( $exception ), + $exception->getMessage() ), + E_USER_ERROR, + $exception->getFile(), + $exception->getLine() ); } /** @@ -2967,7 +2586,7 @@ public function curl_read_callback( $curl_handle, $file_handle, $read_count ) { return $data; } - $length = ( is_numeric( $read_count ) ) ? $read_count : strlen( $read_count ); + $length = ( is_numeric( $read_count ) ) ? $read_count : strlen( $read_count ); $this->substeps_done = $this->substeps_done + $length; $this->update_working_data(); @@ -2978,7 +2597,7 @@ public function curl_read_callback( $curl_handle, $file_handle, $read_count ) { * For storing and getting data in/from a extra temp file * * @param string $storage The name of the storage - * @param array $data data to save in storage + * @param array $data data to save in storage * * @return array|mixed|null data from storage */ @@ -2990,9 +2609,7 @@ public function data_storage( $storage = null, $data = null ) { $storage = strtolower( $storage ); - $file = BackWPup::get_plugin_data( 'temp' ) . 'backwpup-' . BackWPup::get_plugin_data( - 'hash' - ) . '-' . $storage . '.json'; + $file = BackWPup::get_plugin_data( 'temp' ) . 'backwpup-' . BackWPup::get_plugin_data( 'hash' ) . '-' . $storage . '.json'; if ( ! empty( $data ) ) { file_put_contents( $file, json_encode( $data ) ); @@ -3008,7 +2625,7 @@ public function data_storage( $storage = null, $data = null ) { * Add a Folders to Folder list that should be backup * * @param array $folders folder to add - * @param bool $new overwrite existing file + * @param bool $new overwrite existing file */ public function add_folders_to_backup( $folders = array(), $new = false ) { diff --git a/inc/class-jobtype-wpexp.php b/inc/class-jobtype-wpexp.php index fcbe6254..1692b8ee 100644 --- a/inc/class-jobtype-wpexp.php +++ b/inc/class-jobtype-wpexp.php @@ -75,10 +75,6 @@ class="medium-text code"/>.xml echo '
'; else echo '
'; - if ( function_exists( 'bzopen' ) ) - echo '
'; - else - echo '
'; ?> diff --git a/inc/class-jobtype-wpplugin.php b/inc/class-jobtype-wpplugin.php index cefd4989..6b7d17fb 100644 --- a/inc/class-jobtype-wpplugin.php +++ b/inc/class-jobtype-wpplugin.php @@ -60,11 +60,6 @@ class="medium-text code"/>.txt } else { echo '
'; } - if ( function_exists( 'bzopen' ) ) { - echo '
'; - } else { - echo '
'; - } ?> @@ -100,8 +95,6 @@ public function job_run( BackWPup_Job $job_object ) { if ( $job_object->job[ 'pluginlistfilecompression' ] == '.gz' ) $handle = fopen( 'compress.zlib://' . BackWPup::get_plugin_data( 'TEMP' ) . $job_object->temp[ 'pluginlistfile' ], 'w' ); - elseif ( $job_object->job[ 'pluginlistfilecompression' ] == '.bz2' ) - $handle = fopen( 'compress.bzip2://' . BackWPup::get_plugin_data( 'TEMP' ) . $job_object->temp[ 'pluginlistfile' ], 'w' ); else $handle = fopen( BackWPup::get_plugin_data( 'TEMP' ) . $job_object->temp[ 'pluginlistfile' ], 'w' ); diff --git a/inc/class-option.php b/inc/class-option.php index 9bd63233..32d37309 100644 --- a/inc/class-option.php +++ b/inc/class-option.php @@ -1,4 +1,5 @@ id; - $cache_key = "$network_id:backwpup_jobs"; + $cache_key = "$network_id:backwpup_jobs"; wp_cache_delete( $cache_key, 'site-options' ); } else { wp_cache_delete( 'backwpup_jobs', 'options' ); @@ -125,7 +129,7 @@ private static function update_jobs_options( $options ) { */ public static function get( $jobid, $option, $default = null, $use_cache = true ) { - $jobid = (int) $jobid; + $jobid = (int) $jobid; $option = sanitize_key( trim( $option ) ); if ( empty( $jobid ) || empty( $option ) ) { @@ -133,27 +137,49 @@ public static function get( $jobid, $option, $default = null, $use_cache = true } $jobs_options = self::jobs_options( $use_cache ); + if ( isset( $jobs_options[ $jobid ] ) && isset( $jobs_options[ $jobid ]['archivename'] ) ) { $jobs_options[ $jobid ]['archivenamenohash'] = $jobs_options[ $jobid ]['archivename']; } - if ( ! isset( $jobs_options[ $jobid ][ $option ] ) && isset( $default ) ) { + + if ( ! isset( $jobs_options[ $jobid ][ $option ] ) && $default !== null ) { return $default; - } elseif ( ! isset( $jobs_options[ $jobid ][ $option ] ) ) { - if ( $option == 'archivename' ) { + } + + if ( ! isset( $jobs_options[ $jobid ][ $option ] ) ) { + if ( $option === 'archivename' ) { return self::normalize_archive_name( self::defaults_job( $option ), $jobid ); - } else { - return self::defaults_job( $option ); - } - } else { - // Ensure archive name formatted properly - if ( $option == 'archivename' ) { - return self::normalize_archive_name( $jobs_options[ $jobid ][ $option ], $jobid, true ); - } elseif ( $option == 'archivenamenohash' ) { - return self::normalize_archive_name( $jobs_options[ $jobid ]['archivename'], $jobid, false ); - } else { - return $jobs_options[ $jobid ][ $option ]; } + + return self::defaults_job( $option ); + } + + // Ensure archive name formatted properly + if ( $option === 'archivename' ) { + return self::normalize_archive_name( $jobs_options[ $jobid ][ $option ], $jobid, true ); } + + if ( $option === 'archivenamenohash' ) { + return self::normalize_archive_name( $jobs_options[ $jobid ]['archivename'], $jobid, false ); + } + + $option_value = $jobs_options[ $jobid ][ $option ]; + + switch ( $option ) { + case 'archiveformat': + if ( $option_value === '.tar.bz2' ) { + $option_value = '.tar.gz'; + } + break; + case 'pluginlistfilecompression': + case 'wpexportfilecompression': + if ( $option_value === '.bz2' ) { + $option_value = '.gz'; + } + break; + } + + return $option_value; } /** @@ -171,26 +197,26 @@ public static function defaults_job( $key = '' ) { $key = sanitize_key( trim( $key ) ); //set defaults - $default['type'] = array( 'DBDUMP', 'FILE', 'WPPLUGIN' ); - $default['destinations'] = array(); - $default['name'] = __( 'New Job', 'backwpup' ); - $default['activetype'] = ''; - $default['logfile'] = ''; + $default['type'] = array( 'DBDUMP', 'FILE', 'WPPLUGIN' ); + $default['destinations'] = array(); + $default['name'] = __( 'New Job', 'backwpup' ); + $default['activetype'] = ''; + $default['logfile'] = ''; $default['lastbackupdownloadurl'] = ''; - $default['cronselect'] = 'basic'; - $default['cron'] = '0 3 * * *'; - $default['mailaddresslog'] = sanitize_email( get_bloginfo( 'admin_email' ) ); - $default['mailaddresssenderlog'] = 'BackWPup ' . get_bloginfo( 'name' ) . ' <' . sanitize_email( get_bloginfo( 'admin_email' ) ) . '>'; - $default['mailerroronly'] = true; - $default['backuptype'] = 'archive'; - $default['archiveformat'] = '.zip'; - $default['archivename'] = '%Y-%m-%d_%H-%i-%s_%hash%'; - $default['archivenamenohash'] = '%Y-%m-%d_%H-%i-%s_%hash%'; + $default['cronselect'] = 'basic'; + $default['cron'] = '0 3 * * *'; + $default['mailaddresslog'] = sanitize_email( get_bloginfo( 'admin_email' ) ); + $default['mailaddresssenderlog'] = 'BackWPup ' . get_bloginfo( 'name' ) . ' <' . sanitize_email( get_bloginfo( 'admin_email' ) ) . '>'; + $default['mailerroronly'] = true; + $default['backuptype'] = 'archive'; + $default['archiveformat'] = '.zip'; + $default['archivename'] = '%Y-%m-%d_%H-%i-%s_%hash%'; + $default['archivenamenohash'] = '%Y-%m-%d_%H-%i-%s_%hash%'; //defaults vor destinations foreach ( BackWPup::get_registered_destinations() as $dest_key => $dest ) { if ( ! empty( $dest['class'] ) ) { $dest_object = BackWPup::get_destination( $dest_key ); - $default = array_merge( $default, $dest_object->option_defaults() ); + $default = array_merge( $default, $dest_object->option_defaults() ); } } //defaults vor job types @@ -225,13 +251,29 @@ public static function get_job( $id, $use_cache = true ) { return false; } - $id = intval( $id ); + $id = intval( $id ); $jobs_options = self::jobs_options( $use_cache ); if ( isset( $jobs_options[ $id ]['archivename'] ) ) { - $jobs_options[ $id ]['archivename'] = self::normalize_archive_name( $jobs_options[ $id ]['archivename'], $id, true ); + $jobs_options[ $id ]['archivename'] = self::normalize_archive_name( + $jobs_options[ $id ]['archivename'], + $id, + true + ); + } + + $options = wp_parse_args( $jobs_options[ $id ], self::defaults_job() ); + + if ( isset( $options['archiveformat'] ) && $options['archiveformat'] === '.tar.bz2' ) { + $options['archiveformat'] = '.tar.gz'; + } + if ( isset($options['pluginlistfilecompression'] ) && $options['pluginlistfilecompression'] === '.bz2' ) { + $options['pluginlistfilecompression'] = '.gz'; + } + if ( isset($options['wpexportfilecompression'] ) && $options['wpexportfilecompression'] === '.bz2' ) { + $options['wpexportfilecompression'] = '.gz'; } - return wp_parse_args( $jobs_options[ $id ], self::defaults_job() ); + return $options; } @@ -246,7 +288,7 @@ public static function get_job( $id, $use_cache = true ) { */ public static function delete( $jobid, $option ) { - $jobid = (int) $jobid; + $jobid = (int) $jobid; $option = sanitize_key( trim( $option ) ); if ( empty( $jobid ) || empty( $option ) ) { @@ -274,7 +316,7 @@ public static function delete_job( $id ) { return false; } - $id = intval( $id ); + $id = intval( $id ); $jobs_options = self::jobs_options( false ); unset( $jobs_options[ $id ] ); @@ -292,7 +334,7 @@ public static function delete_job( $id ) { */ public static function get_job_ids( $key = null, $value = false ) { - $key = sanitize_key( trim( $key ) ); + $key = sanitize_key( trim( $key ) ); $jobs_options = self::jobs_options( false ); if ( empty( $jobs_options ) ) { @@ -322,8 +364,10 @@ public static function get_job_ids( $key = null, $value = false ) { * @return int */ public static function next_job_id() { + $ids = self::get_job_ids(); sort( $ids ); + return end( $ids ) + 1; } @@ -335,14 +379,15 @@ public static function next_job_id() { * This allows backup files belonging to this job to be tracked. * * @param string $archive_name - * @param int $jobid + * @param int $jobid * * @return string The normalized archive name */ public static function normalize_archive_name( $archive_name, $jobid, $substitute_hash = true ) { + $hash = BackWPup::get_plugin_data( 'hash' ); $generated_hash = self::get_generated_hash( $jobid ); - + // Does the string contain %hash%? if ( strpos( $archive_name, '%hash%' ) !== false ) { if ( $substitute_hash == true ) { @@ -356,12 +401,12 @@ public static function normalize_archive_name( $archive_name, $jobid, $substitut // If name starts with 'backwpup', then we can try to parse if ( substr( $archive_name, 0, 8 ) == 'backwpup' ) { $parts = explode( '_', $archive_name ); - + // Decode hash part if hash not found (from 3.4.2) if ( strpos( $parts[1], $hash ) === false ) { - $parts[1] = base_convert($parts[1], 36, 16); + $parts[1] = base_convert( $parts[1], 36, 16 ); } - + // Search again if ( strpos( $parts[1], $hash ) !== false ) { $parts[1] = '%hash%'; @@ -383,7 +428,7 @@ public static function normalize_archive_name( $archive_name, $jobid, $substitut return $archive_name . '_%hash%'; } } - + } } @@ -394,57 +439,78 @@ public static function normalize_archive_name( $archive_name, $jobid, $substitut * @return string */ public static function get_generated_hash( $jobid ) { - return Base32::encode( pack( 'H*', sprintf( '%02x%06s%02x', mt_rand( 0, 255 ), - BackWPup::get_plugin_data( 'hash' ), mt_rand( 0, 255 ) ) ) ) . - sprintf( '%02d', $jobid ); + + return Base32::encode( pack( 'H*', + sprintf( '%02x%06s%02x', + mt_rand( 0, 255 ), + BackWPup::get_plugin_data( 'hash' ), + mt_rand( 0, 255 ) ) ) ) . + sprintf( '%02d', $jobid ); } - + /** - * Return the decoded hash and the job ID. - * - * If the hash is not found in the given code, then false is returned. - * - * @param string $code The string to decode - * - * @return array|bool An array with hash and job ID, or false otherwise - */ + * Return the decoded hash and the job ID. + * + * If the hash is not found in the given code, then false is returned. + * + * @param string $code The string to decode + * + * @return array|bool An array with hash and job ID, or false otherwise + */ public static function decode_hash( $code ) { + $hash = BackWPup::get_plugin_data( 'hash' ); - + // Try base 32 first $decoded = bin2hex( Base32::decode( substr( $code, 0, 8 ) ) ); if ( substr( $decoded, 2, 6 ) == $hash ) { - return array( substr( $decoded, 2, 6 ), intval( substr( $code, -2 ) ) ); + return array( substr( $decoded, 2, 6 ), intval( substr( $code, - 2 ) ) ); } - + // Try base 36 $decoded = base_convert( $code, 36, 16 ); if ( substr( $decoded, 2, 6 ) == $hash ) { - return array( substr( $decoded, 2, 6 ), intval( substr( $decoded, -2 ) ) ); + return array( substr( $decoded, 2, 6 ), intval( substr( $decoded, - 2 ) ) ); } - + // Check style prior to 3.4.1 if ( substr( $code, 0, 6 ) == $hash ) { - return array( substr( $code, 0, 6 ), intval( substr( $code, -2 ) ) ); + return array( substr( $code, 0, 6 ), intval( substr( $code, - 2 ) ) ); } - + // Tried everything, now return failure return false; } - + /** - * Substitute date variables in archive name. - * - * @param string $archivename The name of the archive. - * - * @return string The archive name with substituted variables. - */ + * Substitute date variables in archive name. + * + * @param string $archivename The name of the archive. + * + * @return string The archive name with substituted variables. + */ public static function substitute_date_vars( $archivename ) { + $current_time = current_time( 'timestamp' ); - $datevars = array( '%d', '%j', '%m', '%n', '%Y', '%y', '%a', '%A', '%B', '%g', '%G', - '%h', '%H', '%i', '%s' ); - $datevalues = array( + $datevars = array( + '%d', + '%j', + '%m', + '%n', + '%Y', + '%y', + '%a', + '%A', + '%B', + '%g', + '%G', + '%h', + '%H', + '%i', + '%s', + ); + $datevalues = array( date( 'd', $current_time ), date( 'j', $current_time ), date( 'm', $current_time ), @@ -459,13 +525,15 @@ public static function substitute_date_vars( $archivename ) { date( 'h', $current_time ), date( 'H', $current_time ), date( 'i', $current_time ), - date( 's', $current_time ) + date( 's', $current_time ), ); // Temporarily replace %hash% with [hash] $archivename = str_replace( '%hash%', '[hash]', $archivename ); - $archivename = str_replace( $datevars, $datevalues, + $archivename = str_replace( $datevars, + $datevalues, $archivename ); $archivename = str_replace( '[hash]', '%hash%', $archivename ); + return BackWPup_Job::sanitize_file_name( $archivename ); } diff --git a/inc/class-page-backups.php b/inc/class-page-backups.php index 671377b0..afed36d7 100644 --- a/inc/class-page-backups.php +++ b/inc/class-page-backups.php @@ -13,9 +13,9 @@ final class BackWPup_Page_Backups extends WP_List_Table { public function __construct() { parent::__construct( array( - 'plural' => 'backups', + 'plural' => 'backups', 'singular' => 'backup', - 'ajax' => true, + 'ajax' => true, ) ); $this->destinations = BackWPup::get_registered_destinations(); @@ -47,8 +47,8 @@ public function prepare_items() { if ( empty( $jobdests ) ) { $jobdests = array( '_' ); } - $jobdest = $jobdests[0]; - $_GET['jobdest-top'] = $jobdests[0]; + $jobdest = $jobdests[0]; + $_GET['jobdest-top'] = $jobdests[0]; $_GET['jobdets-button-top'] = 'empty'; } @@ -67,9 +67,9 @@ public function prepare_items() { } // Sorting. - $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING ) ?: 'desc'; + $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING ) ?: 'desc'; $orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING ) ?: 'time'; - $tmp = array(); + $tmp = array(); if ( $orderby === 'time' ) { if ( $order === 'asc' ) { @@ -123,20 +123,20 @@ public function prepare_items() { $this->set_pagination_args( array( 'total_items' => count( $this->items ), - 'per_page' => $per_page, - 'jobdest' => $jobdest, - 'orderby' => $orderby, - 'order' => $order, + 'per_page' => $per_page, + 'jobdest' => $jobdest, + 'orderby' => $orderby, + 'order' => $order, ) ); // Only display items on page. $start = intval( ( $this->get_pagenum() - 1 ) * $per_page ); - $end = $start + $per_page; + $end = $start + $per_page; if ( $end > count( $this->items ) ) { $end = count( $this->items ); } - $i = - 1; + $i = - 1; $paged_items = array(); foreach ( $this->items as $item ) { $i ++; @@ -164,7 +164,7 @@ public function get_bulk_actions() { return array(); } - $actions = array(); + $actions = array(); $actions['delete'] = __( 'Delete', 'backwpup' ); return $actions; @@ -209,10 +209,37 @@ public function extra_tablenav( $which ) { '; + $posts_columns['time'] = __( 'Time', 'backwpup' ); + $posts_columns['file'] = __( 'File', 'backwpup' ); + $posts_columns['folder'] = __( 'Folder', 'backwpup' ); + $posts_columns['size'] = __( 'Size', 'backwpup' ); + + return $posts_columns; + } + + public function get_sortable_columns() { + + return array( + 'file' => array( 'file', false ), + 'folder' => 'folder', + 'size' => 'size', + 'time' => array( 'time', false ), + ); + } + + public function column_cb( $item ) { + + return ''; + } + public function get_destinations_list() { $jobdest = array(); - $jobids = BackWPup_Option::get_job_ids(); + $jobids = BackWPup_Option::get_job_ids(); foreach ( $jobids as $jobid ) { if ( BackWPup_Option::get( $jobid, 'backuptype' ) === 'sync' ) { @@ -223,7 +250,7 @@ public function get_destinations_list() { if ( ! $this->destinations[ $dest ]['class'] ) { continue; } - $dest_class = BackWPup::get_destination( $dest ); + $dest_class = BackWPup::get_destination( $dest ); $can_do_dest = $dest_class->file_get_list( $jobid . '_' . $dest ); if ( ! empty( $can_do_dest ) ) { $jobdest[] = $jobid . '_' . $dest; @@ -234,63 +261,46 @@ public function get_destinations_list() { return $jobdest; } - public function get_columns() { - - $posts_columns = array(); - $posts_columns['cb'] = ''; - $posts_columns['time'] = __( 'Time', 'backwpup' ); - $posts_columns['file'] = __( 'File', 'backwpup' ); - $posts_columns['folder'] = __( 'Folder', 'backwpup' ); - $posts_columns['size'] = __( 'Size', 'backwpup' ); - - return $posts_columns; - } - - public function get_sortable_columns() { - - return array( - 'file' => array( 'file', false ), - 'folder' => 'folder', - 'size' => 'size', - 'time' => array( 'time', false ), - ); - } - - public function column_cb( $item ) { - - return ''; - } - public function column_file( $item ) { + $actions = array(); + $r = '' . esc_attr( $item['filename'] ) . '
'; if ( ! empty( $item['info'] ) ) { $r .= esc_attr( $item['info'] ) . '
'; } - $actions = array(); + if ( current_user_can( 'backwpup_backups_delete' ) ) { - $actions['delete'] = "jobid . '_' . $this->dest . '&paged=' . $this->get_pagenum() . '&backupfiles[]=' . esc_attr( $item['file'] ), - 'bulk-backups' ) . "\" onclick=\"if ( confirm('" . esc_js( __( "You are about to delete this backup archive. \n 'Cancel' to stop, 'OK' to delete.", - "backwpup" ) ) . "') ) { return true;}return false;\">" . __( 'Delete', 'backwpup' ) . ""; + $actions['delete'] = $this->delete_item_action( $item ); } - if ( current_user_can( 'backwpup_backups_download' ) && ! empty( $item['downloadurl'] ) ) { - // Check if downloader class exists + + if ( ! empty( $item['downloadurl'] ) && current_user_can( 'backwpup_backups_download' ) ) { try { - // If we're still here, the downloader exists - $actions['download'] = "jobid . "\" data-destination=\"" . esc_attr( $this->dest ) . "\" data-file=\"" . esc_attr( $item['file'] ) . "\" data-local-file=\"" . esc_attr( $item['filename'] ) . "\" data-nonce=\"" . wp_create_nonce( 'download-backup_' . $this->jobid ) . "\" data-url=\"" . wp_nonce_url( $item['downloadurl'], - 'download-backup_' . $this->jobid ) . "\" class=\"backup-download-link thickbox\">" . __( 'Download', - 'backwpup' ) . ""; + $actions['download'] = $this->download_item_action( $item ); } catch ( BackWPup_Factory_Exception $e ) { - $actions['download'] = "jobid ) . "\">" . __( 'Download', 'backwpup' ) . ""; + $actions['download'] = sprintf( + '%2$s', + wp_nonce_url( $item['downloadurl'], 'backwpup_action_nonce' ), + __( 'Download', 'backwpup' ) + ); } } // Add restore url to link list if ( current_user_can( 'backwpup_restore' ) && ! empty( $item['restoreurl'] ) ) { - $item['restoreurl'] = add_query_arg( array( 'step' => 1, 'trigger_download' => 1 ), $item['restoreurl'] ); - $actions['restore'] = "jobid ) . "\">" . __( 'Restore', 'backwpup' ) . ""; + + $item['restoreurl'] = add_query_arg( + array( + 'step' => 1, + 'trigger_download' => 1, + ), + $item['restoreurl'] + ); + $actions['restore'] = sprintf( + '%2$s', + wp_nonce_url( $item['restoreurl'], 'restore-backup_' . $this->jobid ), + __( 'Restore', 'backwpup' ) + ); } $r .= $this->row_actions( $actions ); @@ -339,7 +349,7 @@ public static function load() { $jobdest = sanitize_text_field( $_GET['jobdest-top'] ); } - $_GET['jobdest-top'] = $jobdest; + $_GET['jobdest-top'] = $jobdest; $_GET['jobdets-button-top'] = 'submit'; if ( $jobdest === '' ) { @@ -349,7 +359,7 @@ public static function load() { list( $jobid, $dest ) = explode( '_', $jobdest ); /** @var BackWPup_Destinations $dest_class */ $dest_class = BackWPup::get_destination( $dest ); - $files = $dest_class->file_get_list( $jobdest ); + $files = $dest_class->file_get_list( $jobdest ); foreach ( $_GET['backupfiles'] as $backupfile ) { foreach ( $files as $file ) { if ( is_array( $file ) && $file['file'] == $backupfile ) { @@ -368,13 +378,12 @@ public static function load() { if ( ! current_user_can( 'backwpup_backups_download' ) ) { wp_die( __( 'Sorry, you don\'t have permissions to do that.', 'backwpup' ) ); } - check_admin_referer( 'download-backup_' . $jobid ); + check_admin_referer( 'backwpup_action_nonce' ); $filename = untrailingslashit( BackWPup::get_plugin_data( 'temp' ) ) . '/' . basename( isset( $_GET['local_file'] ) ? $_GET['local_file'] : $_GET['file'] ); if ( file_exists( $filename ) ) { $downloader = new BackWPup_Download_File( $filename, - mime_content_type( $filename ), function ( \BackWPup_Download_File_Interface $obj ) use ( $filename ) { $obj->clean_ob() @@ -430,9 +439,9 @@ function ( \BackWPup_Download_File_Interface $obj ) use ( $filename ) { add_screen_option( 'per_page', array( - 'label' => __( 'Backup Files', 'backwpup' ), + 'label' => __( 'Backup Files', 'backwpup' ), 'default' => 20, - 'option' => 'backwpupbackups_per_page', + 'option' => 'backwpupbackups_per_page', ) ); self::$listtable->prepare_items(); @@ -461,24 +470,30 @@ public static function admin_print_styles() { public static function admin_print_scripts() { - wp_enqueue_script( 'backwpupgeneral' ); + $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; + $plugin_url = BackWPup::get_plugin_data( 'url' ); + $plugin_dir = BackWPup::get_plugin_data( 'plugindir' ); + $plugin_scripts_url = "{$plugin_url}/assets/js"; + $plugin_scripts_dir = "{$plugin_dir}/assets/js"; - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { - wp_enqueue_script( - 'backwpuppagebackups', - BackWPup::get_plugin_data( 'URL' ) . '/assets/js/page_backups.js', - array( 'jquery' ), - time(), - true - ); - } else { - wp_enqueue_script( - 'backwpuppagebackups', - BackWPup::get_plugin_data( 'URL' ) . '/assets/js/page_backups.min.js', - array( 'jquery' ), - BackWPup::get_plugin_data( 'Version' ), - true - ); + $dependencies = array( + 'jquery', + 'underscore', + 'backwpupgeneral', + ); + if ( \BackWPup::is_pro() ) { + $dependencies[] = 'decrypter'; + } + wp_enqueue_script( + 'backwpup-backup-downloader', + "{$plugin_scripts_url}/backup-downloader{$suffix}.js", + $dependencies, + filemtime( "{$plugin_scripts_dir}/backup-downloader{$suffix}.js" ), + true + ); + + if ( \BackWPup::is_pro() ) { + self::admin_print_pro_scripts( $suffix, $plugin_url, $plugin_dir ); } } @@ -496,93 +511,115 @@ public static function page() { -