コード例 #1
0
 public function import_settings()
 {
     $file_url = base64_decode($_POST['file_url']);
     $temporary_file = '';
     try {
         include_once ABSPATH . 'wp-admin/includes/file.php';
         //Contains download_url
         $temporary_file = download_url($file_url);
         if (is_wp_error($temporary_file)) {
             throw new Exception('Error: ' . $temporary_file->get_error_message());
         } else {
             if ($this->import_seo_settings($temporary_file)) {
                 $information['success'] = true;
             } else {
                 throw new Exception(__('Settings could not be imported:', 'wordpress-seo'));
             }
         }
     } catch (Exception $e) {
         $information['error'] = $e->getMessage();
     }
     if (file_exists($temporary_file)) {
         unlink($temporary_file);
     }
     MainWP_Helper::write($information);
 }
コード例 #2
0
 public function action()
 {
     $information = array();
     if (!defined('GPI_ACTIVE')) {
         $information['error'] = 'NO_GOOGLEPAGESPEED';
         MainWP_Helper::write($information);
     }
     if (isset($_POST['mwp_action'])) {
         MainWP_Helper::update_option('mainwp_pagespeed_ext_enabled', 'Y', 'yes');
         switch ($_POST['mwp_action']) {
             case 'save_settings':
                 $information = $this->save_settings();
                 break;
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'sync_data':
                 $information = $this->sync_data();
                 break;
             case "check_pages":
                 $information = $this->check_pages();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #3
0
 function mainwp_skeleton_key_handle_fatal_error()
 {
     $error = error_get_last();
     if (isset($error['type']) && in_array($error['type'], array(1, 4, 16, 64, 256)) && isset($error['message'])) {
         MainWP_Helper::write(array('error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file']));
     } else {
         MainWP_Helper::write(MainWP_Child_Skeleton_Key::$information);
     }
 }
コード例 #4
0
 public function action()
 {
     $information = array();
     switch ($_POST['action']) {
         case 'update_branding':
             $information = $this->update_branding();
             break;
     }
     MainWP_Helper::write($information);
 }
コード例 #5
0
 function mainwp_backwpup_handle_fatal_error()
 {
     $error = error_get_last();
     if (isset($error['type']) && E_ERROR === $error['type'] && isset($error['message'])) {
         MainWP_Helper::write(array('error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file']));
     } else {
         if (!empty(MainWP_Child_Back_WP_Up::$information)) {
             MainWP_Helper::write(MainWP_Child_Back_WP_Up::$information);
         } else {
             MainWP_Helper::write(array('error' => 'Missing information array inside fatal_error'));
         }
     }
 }
コード例 #6
0
 public function action()
 {
     $information = array();
     if (!class_exists('WooCommerce')) {
         $information['error'] = 'NO_WOOCOMMERCE';
         MainWP_Helper::write($information);
     }
     $is_ver220 = $this->is_version_220();
     if (isset($_POST['mwp_action'])) {
         switch ($_POST['mwp_action']) {
             case 'sync_data':
                 $information = !$is_ver220 ? $this->sync_data() : $this->sync_data_two();
                 break;
             case 'report_data':
                 $information = !$is_ver220 ? $this->report_data() : $this->report_data_two();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #7
0
 public function action()
 {
     $information = array();
     if (!defined('BLC_ACTIVE') || !function_exists('blc_init')) {
         $information['error'] = 'NO_BROKENLINKSCHECKER';
         MainWP_Helper::write($information);
     }
     blc_init();
     if (isset($_POST['mwp_action'])) {
         switch ($_POST['mwp_action']) {
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'sync_data':
                 $information = $this->sync_data();
                 break;
             case 'edit_link':
                 $information = $this->edit_link();
                 break;
             case 'unlink':
                 $information = $this->unlink();
                 break;
             case 'set_dismiss':
                 $information = $this->set_link_dismissed();
                 break;
             case 'discard':
                 $information = $this->discard();
                 break;
             case 'save_settings':
                 $information = $this->save_settings();
                 break;
             case 'force_recheck':
                 $information = $this->force_recheck();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #8
0
 public function action()
 {
     $information = array();
     self::$mainwpChildReports = false;
     if (function_exists('mainwp_wp_stream_query') && class_exists('MainWP_WP_Stream')) {
         self::$mainwpChildReports = true;
     } else {
         if (function_exists('wp_stream_query') && class_exists('WP_Stream')) {
             self::$streamVersionNumber = 149;
         } else {
             if (function_exists('wp_stream_get_instance') && class_exists('WP_Stream\\Plugin')) {
                 self::$streamVersionNumber = 3;
             } else {
                 $information['error'] = 'NO_STREAM';
                 MainWP_Helper::write($information);
             }
         }
     }
     if (isset($_POST['mwp_action'])) {
         switch ($_POST['mwp_action']) {
             case 'save_sucuri_stream':
                 $information = $this->save_sucuri_stream();
                 break;
             case 'save_backup_stream':
                 $information = $this->save_backup_stream();
                 break;
             case 'get_stream':
                 $information = $this->get_stream();
                 break;
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #9
0
 public function action()
 {
     $information = array();
     if (!class_exists('wordfence') || !class_exists('wfScanEngine')) {
         $information['error'] = 'NO_WORDFENCE';
         MainWP_Helper::write($information);
     }
     if (isset($_POST['mwp_action'])) {
         MainWP_Helper::update_option('mainwp_wordfence_ext_enabled', "Y", 'yes');
         switch ($_POST['mwp_action']) {
             case 'start_scan':
                 $information = $this->start_scan();
                 break;
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'get_log':
                 $information = $this->get_log();
                 break;
             case 'update_log':
                 $information = $this->update_log();
                 break;
             case 'get_summary':
                 $information = $this->get_summary();
                 break;
             case 'load_issues':
                 $information = $this->load_issues();
                 break;
             case 'update_all_issues':
                 $information = $this->update_all_issues();
                 break;
             case 'update_issues_status':
                 $information = $this->update_issues_status();
                 break;
             case 'delete_issues':
                 $information = $this->delete_issues();
                 break;
             case 'bulk_operation':
                 $information = $this->bulk_operation();
                 break;
             case 'delete_file':
                 $information = $this->delete_file();
                 break;
             case 'restore_file':
                 $information = $this->restore_file();
                 break;
             case 'save_setting':
                 $information = $this->save_setting();
                 break;
             case 'ticker':
                 $information = $this->ticker();
                 break;
             case 'reverse_lookup':
                 $information = $this->reverse_lookup();
                 break;
             case 'block_ip':
                 $information = $this->block_ip();
                 break;
             case 'unblock_ip':
                 $information = $this->unblock_ip();
                 break;
             case 'load_static_panel':
                 $information = $this->load_static_panel();
                 break;
             case 'downgrade_license':
                 $information = $this->downgrade_license();
                 break;
             case "import_settings":
                 $information = $this->import_settings();
                 break;
             case "export_settings":
                 $information = $this->export_settings();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #10
0
 function settings_tools()
 {
     if (isset($_POST['action'])) {
         switch ($_POST['action']) {
             case 'force_destroy_sessions':
                 if (0 === get_current_user_id()) {
                     MainWP_Helper::write(array('error' => __('Cannot get user_id', 'mainwp-child')));
                 }
                 wp_destroy_all_sessions();
                 $sessions = wp_get_all_sessions();
                 if (empty($sessions)) {
                     MainWP_Helper::write(array('success' => 1));
                 } else {
                     MainWP_Helper::write(array('error' => __('Cannot destroy sessions', 'mainwp-child')));
                 }
                 break;
             default:
                 MainWP_Helper::write(array('error' => __('Invalid action', 'mainwp-child')));
         }
     } else {
         MainWP_Helper::write(array('error' => __('Missing action', 'mainwp-child')));
     }
 }
コード例 #11
0
 public function action()
 {
     $information = array();
     if (!class_exists('ITSEC_Core')) {
         $information['error'] = 'NO_ITHEME_SECURITY';
         MainWP_Helper::write($information);
     }
     global $itsec_globals, $itsec_modules_path;
     if (is_dir($itsec_globals['plugin_dir'] . '/modules/free')) {
         $itsec_modules_path = $itsec_globals['plugin_dir'] . '/modules/free/';
     } else {
         if (is_dir($itsec_globals['plugin_dir'] . '/core/modules')) {
             $itsec_modules_path = $itsec_globals['plugin_dir'] . '/core/modules/';
         }
     }
     if (isset($_POST['mwp_action'])) {
         switch ($_POST['mwp_action']) {
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'save_settings':
                 $information = $this->save_settings();
                 break;
             case 'whitelist':
                 $information = $this->whitelist();
                 break;
             case 'whitelist_release':
                 $information = $this->whitelist_release();
                 break;
             case 'backup_db':
                 $information = $this->backup_db();
                 break;
             case 'admin_user':
                 $information = $this->admin_user();
                 break;
                 //                case "content_dir":
                 //                    $information = $this->process_directory();
                 //                break;
             //                case "content_dir":
             //                    $information = $this->process_directory();
             //                break;
             case 'database_prefix':
                 $information = $this->process_database_prefix();
                 break;
             case 'api_key':
                 $information = $this->api_key();
                 break;
             case 'reset_api_key':
                 $information = $this->reset_api_key();
                 break;
             case 'malware_scan':
                 $information = $this->malware_scan();
                 break;
             case 'malware_get_scan_results':
                 $information = $this->malware_get_scan_results();
                 break;
             case 'clear_all_logs':
                 $information = $this->purge_logs();
                 break;
             case 'file_check':
                 $information = $this->file_check();
                 break;
             case 'release_lockout':
                 $information = $this->release_lockout();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #12
0
 static function error($error)
 {
     $information['error'] = $error;
     MainWP_Helper::write($information);
 }
コード例 #13
0
 public function action()
 {
     $result = array();
     switch ($_POST['action']) {
         case 'enable_stats':
             $result = $this->enable_stats();
             break;
         case 'refresh_data':
             $result = $this->refresh_data();
             break;
         case 'import_link':
         case 'add_link':
             $result = $this->edit_link();
             break;
         case 'delete_link':
             $result = $this->delete_link();
             break;
         case 'clear_link':
             $result = $this->clear_link();
             break;
         case 'update_config':
             $result = $this->update_config();
             break;
         case 'donotlink_site_blocks':
             $result = $this->donotlink_site_blocks();
             break;
         case 'donotlink_path_blocks':
             $result = $this->donotlink_path_blocks();
             break;
         case 'donotlink_clear':
             $result = $this->donotlink_clear();
             break;
         case 'remove_keywords':
             $result = $this->remove_keywords();
             break;
     }
     MainWP_Helper::write($result);
 }
コード例 #14
0
 public function action()
 {
     $information = array();
     if (!self::isActivated()) {
         $information['error'] = 'NO_WPROCKET';
         MainWP_Helper::write($information);
     }
     if (isset($_POST['mwp_action'])) {
         MainWP_Helper::update_option('mainwp_wprocket_ext_enabled', 'Y');
         switch ($_POST['mwp_action']) {
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'purge_cloudflare':
                 $information = $this->purge_cloudflare();
                 break;
             case 'purge_all':
                 $information = $this->purge_cache_all();
                 break;
             case 'preload_cache':
                 $information = $this->preload_cache();
                 break;
             case 'save_settings':
                 $information = $this->save_settings();
                 break;
             case "load_existing_settings":
                 $information = $this->load_existing_settings();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #15
0
 public function action()
 {
     $information = array();
     if (!self::isActivatedUpdraftplus()) {
         $information['error'] = 'NO_UPDRAFTPLUS';
         MainWP_Helper::write($information);
     }
     global $updraftplus;
     if (empty($updraftplus) && class_exists('UpdraftPlus')) {
         $updraftplus = new UpdraftPlus();
     }
     if (empty($updraftplus)) {
         $information['error'] = 'Error empty object';
         MainWP_Helper::write($information);
     }
     if (isset($_POST['mwp_action'])) {
         if (get_option('mainwp_updraftplus_ext_enabled') !== 'Y') {
             MainWP_Helper::update_option('mainwp_updraftplus_ext_enabled', 'Y', 'yes');
         }
         switch ($_POST['mwp_action']) {
             case 'set_showhide':
                 $information = $this->set_showhide();
                 break;
             case 'save_settings':
                 $information = $this->save_settings();
                 break;
             case 'addons_connect':
                 $information = $this->addons_connect();
                 break;
             case 'backup_now':
                 $information = $this->backup_now();
                 break;
             case 'activejobs_list':
                 $information = $this->activejobs_list();
                 break;
             case 'diskspaceused':
                 $information = $this->diskspaceused();
                 break;
             case 'last_backup_html':
                 $information = $this->last_backup_html();
                 break;
             case 'reload_data':
                 $information = $this->get_updraft_data();
                 break;
             case 'next_scheduled_backups':
                 $information = $this->next_scheduled_backups();
                 break;
                 //                case "rebuildBackupHistory":
                 //                    $information = $this->rebuildBackupHistory();
                 //                break;
             //                case "rebuildBackupHistory":
             //                    $information = $this->rebuildBackupHistory();
             //                break;
             case 'forcescheduledresumption':
                 $information = $this->forceScheduledResumption();
                 break;
             case 'fetch_updraft_log':
                 $information = $this->fetch_updraft_log();
                 break;
             case 'activejobs_delete':
                 $information = $this->activejobs_delete();
                 break;
             case 'historystatus':
                 $information = $this->historystatus();
                 break;
             case 'deleteset':
                 $information = $this->deleteset();
                 break;
             case 'updraft_download_backup':
                 $information = $this->updraft_download_backup();
                 break;
             case 'restore_alldownloaded':
                 $information = $this->restore_alldownloaded();
                 break;
             case 'restorebackup':
                 $information = $this->restoreBackup();
                 break;
             case 'extradbtestconnection':
                 $information = $this->extradb_testconnection();
                 break;
             case 'delete_old_dirs':
                 $information = $this->delete_old_dirs_go();
                 break;
             case 'vault_connect':
                 $information = $this->do_vault_connect();
                 break;
             case 'vault_disconnect':
                 $information = $this->vault_disconnect();
                 break;
         }
     }
     MainWP_Helper::write($information);
 }
コード例 #16
0
 function check_schedule()
 {
     $schedule_id = isset($_POST['schedule_id']) && !empty($_POST['schedule_id']) ? $_POST['schedule_id'] : '';
     if (empty($schedule_id)) {
         $information = array('error' => 'Empty schedule id');
         MainWP_Helper::write($information);
     } else {
         $schedule_id = sanitize_text_field(urldecode($schedule_id));
         HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
         if (!HM\BackUpWordPress\Schedules::get_instance()->get_schedule($schedule_id)) {
             $information = array('result' => 'NOTFOUND');
             MainWP_Helper::write($information);
         }
     }
     return $schedule_id;
 }