mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-10 12:55:17 +08:00
Merge with branch01 + readme update + new version
This commit is contained in:
parent
f57c1ed4b8
commit
3af732a9d0
10 changed files with 1112 additions and 108 deletions
|
@ -11,7 +11,7 @@ include_once(ABSPATH . '/wp-admin/includes/plugin.php');
|
|||
|
||||
class MainWPChild
|
||||
{
|
||||
private $version = '2.0.14';
|
||||
private $version = '2.0.15';
|
||||
private $update_version = '1.2';
|
||||
|
||||
private $callableFunctions = array(
|
||||
|
@ -66,7 +66,8 @@ class MainWPChild
|
|||
'delete_backup' => 'delete_backup',
|
||||
'update_values' => 'update_values',
|
||||
'ithemes' => 'ithemes',
|
||||
'updraftplus' => 'updraftplus'
|
||||
'updraftplus' => 'updraftplus',
|
||||
'backup_wp' => 'backup_wp'
|
||||
);
|
||||
|
||||
private $FTP_ERROR = 'Failed, please add FTP details for automatic upgrades.';
|
||||
|
@ -103,6 +104,11 @@ class MainWPChild
|
|||
add_action('admin_menu', array(&$this, 'admin_menu'));
|
||||
add_action('admin_init', array(&$this, 'admin_init'));
|
||||
add_action('init', array(&$this, 'localization'));
|
||||
|
||||
if (is_admin()) {
|
||||
MainWPHelper::update_option('mainwp_child_plugin_version', $this->version, 'yes');
|
||||
}
|
||||
|
||||
$this->checkOtherAuth();
|
||||
|
||||
MainWPClone::init();
|
||||
|
@ -712,12 +718,17 @@ class MainWPChild
|
|||
$open_location = base64_decode ($open_location);
|
||||
$_vars = MainWPHelper::parse_query($open_location);
|
||||
$_path = parse_url($open_location, PHP_URL_PATH);
|
||||
|
||||
if (isset($_vars['_mwpNoneName']) && isset($_vars['_mwpNoneValue'])) {
|
||||
$_vars[$_vars['_mwpNoneName']] = wp_create_nonce($_vars['_mwpNoneValue']);
|
||||
unset($_vars['_mwpNoneName']);
|
||||
unset($_vars['_mwpNoneValue']);
|
||||
$open_location = "/wp-admin/" . $_path . "?" . http_build_query($_vars);
|
||||
$open_url = "";
|
||||
foreach ($_vars as $key => $value)
|
||||
{
|
||||
$open_url .= $key . '=' . $value . '&';
|
||||
}
|
||||
$open_url = rtrim($open_url, '&');
|
||||
$open_location = "/wp-admin/" . $_path . "?" . $open_url;
|
||||
} else {
|
||||
if (strpos($open_location, "nonce=child_temp_nonce") !== false)
|
||||
$open_location = str_replace ("nonce=child_temp_nonce", "nonce=" . wp_create_nonce('wp-ajax'), $open_location);
|
||||
|
@ -775,7 +786,7 @@ class MainWPChild
|
|||
|
||||
if (!$auth && isset($_POST['mainwpsignature']))
|
||||
{
|
||||
MainWPHelper::error(__('Authentication failed. Reinstall MainWP plugin please','mainwp-child'));
|
||||
MainWPHelper::error(__('Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.','mainwp-child'));
|
||||
}
|
||||
|
||||
//Check if the user exists & is an administrator
|
||||
|
@ -820,6 +831,7 @@ class MainWPChild
|
|||
new MainWPChildIThemesSecurity();
|
||||
|
||||
MainWPChildUpdraftplusBackups::Instance()->updraftplus_init();
|
||||
MainWPChildBackUpWordPress::Instance()->init();
|
||||
|
||||
//Call the function required
|
||||
if (isset($_POST['function']) && isset($this->callableFunctions[$_POST['function']]))
|
||||
|
@ -2496,7 +2508,7 @@ class MainWPChild
|
|||
|
||||
//Directory listings!
|
||||
$information['directories'] = $this->scanDir(ABSPATH, 3);
|
||||
$cats = get_categories(array('hide_empty' => 0, 'name' => 'select_name', 'hierarchical' => true));
|
||||
$cats = get_categories(array('hide_empty' => 0, 'hierarchical' => true));
|
||||
$categories = array();
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
|
@ -2574,6 +2586,12 @@ class MainWPChild
|
|||
$information['syncUpdraftData'] = MainWPChildUpdraftplusBackups::Instance()->syncData();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($othersData['syncBackUpWordPress']) && $othersData['syncBackUpWordPress']) {
|
||||
if (MainWPChildBackUpWordPress::isActivated()) {
|
||||
$information['syncBackUpWordPress'] = MainWPChildBackUpWordPress::Instance()->syncData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$information['faviIcon'] = $this->get_favicon();
|
||||
|
@ -4125,6 +4143,10 @@ class MainWPChild
|
|||
MainWPChildUpdraftplusBackups::Instance()->action();
|
||||
}
|
||||
|
||||
function backup_wp() {
|
||||
MainWPChildBackUpWordPress::Instance()->action();
|
||||
}
|
||||
|
||||
function delete_backup()
|
||||
{
|
||||
$dirs = MainWPHelper::getMainWPDir('backup');
|
||||
|
|
941
class/MainWPChildBackUpWordPress.class.php
Normal file
941
class/MainWPChildBackUpWordPress.class.php
Normal file
|
@ -0,0 +1,941 @@
|
|||
<?php
|
||||
|
||||
class MainWPChildBackUpWordPress
|
||||
{
|
||||
public static $instance = null;
|
||||
|
||||
static function Instance() {
|
||||
if (MainWPChildBackUpWordPress::$instance == null) {
|
||||
MainWPChildBackUpWordPress::$instance = new MainWPChildBackUpWordPress();
|
||||
}
|
||||
return MainWPChildBackUpWordPress::$instance;
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (get_option('mainwp_backupwordpress_ext_enabled') !== "Y")
|
||||
return;
|
||||
|
||||
if (get_option('mainwp_backupwordpress_hide_plugin') === "hide")
|
||||
{
|
||||
add_filter('all_plugins', array($this, 'all_plugins'));
|
||||
add_action('admin_menu', array($this, 'remove_menu'));
|
||||
add_filter('update_footer', array(&$this, 'update_footer'), 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function action() {
|
||||
$information = array();
|
||||
if (!self::isActivated()) {
|
||||
$information['error'] = 'NO_BACKUPWORDPRESS';
|
||||
MainWPHelper::write($information);
|
||||
}
|
||||
if (isset($_POST['mwp_action'])) {
|
||||
switch ($_POST['mwp_action']) {
|
||||
case "set_showhide":
|
||||
$information = $this->set_showhide();
|
||||
break;
|
||||
case "delete_schedule":
|
||||
$information = $this->delete_schedule();
|
||||
break;
|
||||
case "cancel_schedule":
|
||||
$information = $this->hmbkp_request_cancel_backup();
|
||||
break;
|
||||
case "get_backup_status":
|
||||
$information = $this->get_backup_status();
|
||||
break;
|
||||
case "reload_backupslist":
|
||||
$information = $this->reload_backups();
|
||||
break;
|
||||
case "delete_backup":
|
||||
$information = $this->hmbkp_request_delete_backup();
|
||||
break;
|
||||
case "run_schedule":
|
||||
$information = $this->run_schedule();
|
||||
break;
|
||||
case "update_schedule":
|
||||
$information = $this->update_schedule();
|
||||
break;
|
||||
case "get_excluded":
|
||||
$information = $this->get_excluded();
|
||||
break;
|
||||
case "directory_browse":
|
||||
$information = $this->directory_browse();
|
||||
break;
|
||||
case "exclude_add_rule":
|
||||
$information = $this->hmbkp_add_exclude_rule();
|
||||
break;
|
||||
case "exclude_remove_rule":
|
||||
$information = $this->hmbkp_remove_exclude_rule();
|
||||
break;
|
||||
}
|
||||
}
|
||||
MainWPHelper::write($information);
|
||||
}
|
||||
|
||||
|
||||
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');
|
||||
MainWPHelper::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');
|
||||
MainWPHelper::write($information);
|
||||
}
|
||||
}
|
||||
|
||||
return $schedule_id;
|
||||
}
|
||||
|
||||
public function syncData() {
|
||||
if (!self::isActivated())
|
||||
return "";
|
||||
return $this->get_sync_data();
|
||||
}
|
||||
|
||||
private function get_sync_data() {
|
||||
HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
|
||||
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
|
||||
$backups_time = array();
|
||||
foreach($schedules as $sche) {
|
||||
$existing_backup = $sche->get_backups();
|
||||
if (!empty($existing_backup)) {
|
||||
$backups_time = array_merge( $backups_time, array_keys($existing_backup));
|
||||
}
|
||||
}
|
||||
|
||||
$return = array('lasttime_backup' => max($backups_time));
|
||||
return $return;
|
||||
}
|
||||
|
||||
function set_showhide() {
|
||||
MainWPHelper::update_option('mainwp_backupwordpress_ext_enabled', "Y");
|
||||
$hide = isset($_POST['showhide']) && ($_POST['showhide'] === "hide") ? 'hide' : "";
|
||||
MainWPHelper::update_option('mainwp_backupwordpress_hide_plugin', $hide);
|
||||
$information['result'] = 'SUCCESS';
|
||||
return $information;
|
||||
}
|
||||
|
||||
function delete_schedule() {
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
if ($schedule) {
|
||||
$schedule->cancel( true );
|
||||
$information['result'] = 'SUCCESS';
|
||||
} else {
|
||||
$information['result'] = 'NOTFOUND';
|
||||
}
|
||||
return $information;
|
||||
}
|
||||
|
||||
function hmbkp_request_cancel_backup() {
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
// Delete the running backup
|
||||
if ( $schedule->get_running_backup_filename() && file_exists( trailingslashit( hmbkp_path() ) . $schedule->get_running_backup_filename() ) ) {
|
||||
unlink( trailingslashit( hmbkp_path() ) . $schedule->get_running_backup_filename() );
|
||||
}
|
||||
|
||||
if ( $schedule->get_schedule_running_path() && file_exists( $schedule->get_schedule_running_path() ) ) {
|
||||
unlink( $schedule->get_schedule_running_path() );
|
||||
}
|
||||
HM\BackUpWordPress\Path::get_instance()->cleanup();
|
||||
|
||||
$information['scheduleStatus'] = $schedule->get_status();
|
||||
$information['result'] = 'SUCCESS';
|
||||
return $information;
|
||||
}
|
||||
|
||||
function get_backup_status() {
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
HM\BackUpWordPress\Path::get_instance()->cleanup();
|
||||
|
||||
$information['scheduleStatus'] = $schedule->get_status();
|
||||
$information['result'] = 'SUCCESS';
|
||||
return $information;
|
||||
}
|
||||
|
||||
function run_schedule() {
|
||||
$schedule_id = $this->check_schedule();
|
||||
HM\BackUpWordPress\Path::get_instance()->cleanup();
|
||||
// Fixes an issue on servers which only allow a single session per client
|
||||
session_write_close();
|
||||
|
||||
$task = new \HM\Backdrop\Task( 'hmbkp_run_schedule_async', $schedule_id );
|
||||
|
||||
$task->schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
$information['scheduleStatus'] = $schedule->get_status();
|
||||
$information['file_size_text'] = $this->hmbkp_get_site_size_text( $schedule );
|
||||
$information['started_ago'] = human_time_diff( $schedule->get_schedule_running_start_time());
|
||||
return array('result' => 'SUCCESS');
|
||||
}
|
||||
|
||||
function reload_backups() {
|
||||
|
||||
$scheduleIds = isset($_POST['schedule_ids']) ? $_POST['schedule_ids'] : array();
|
||||
HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
|
||||
|
||||
if (empty($scheduleIds)) {
|
||||
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
|
||||
foreach($schedules as $sch) {
|
||||
$scheduleIds[] = $sch->get_id();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($scheduleIds))
|
||||
return array('error' => __("Not found schedules.", 'mainwp-child'));
|
||||
|
||||
foreach ($scheduleIds as $schedule_id ) {
|
||||
if ( ! HM\BackUpWordPress\Schedules::get_instance()->get_schedule( $schedule_id ) )
|
||||
continue;
|
||||
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
$out = array(
|
||||
'b' => $this->get_backupslist_html($schedule),
|
||||
'count' => count($schedule->get_backups()),
|
||||
'file_size_text' => $this->hmbkp_get_site_size_text( $schedule ),
|
||||
'scheduleStatus' => $schedule->get_status(),
|
||||
'started_ago' => human_time_diff( $schedule->get_schedule_running_start_time())
|
||||
);
|
||||
|
||||
$information['backups'][$schedule_id] = $out;
|
||||
}
|
||||
|
||||
$send_back_schedules = array();
|
||||
|
||||
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
|
||||
foreach($schedules as $schedule) {
|
||||
$sch_id = $schedule->get_id();
|
||||
if (!in_array($sch_id, $scheduleIds)) {
|
||||
$current_option = get_option( 'hmbkp_schedule_' . $sch_id );
|
||||
if (is_array($current_option)) {
|
||||
unset($current_option['excludes']); // not send this value
|
||||
$send_back_schedules[$sch_id] = array(
|
||||
'options' => $current_option,
|
||||
'b' => $this->get_backupslist_html($schedule),
|
||||
'count' => count($schedule->get_backups()),
|
||||
'file_size_text' => $this->hmbkp_get_site_size_text( $schedule ),
|
||||
'scheduleStatus' => $schedule->get_status(),
|
||||
'started_ago' => human_time_diff( $schedule->get_schedule_running_start_time())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$information['backups_path'] = str_replace( HM\BackUpWordPress\Backup::get_home_path(), '', hmbkp_path() );
|
||||
$information['send_back_schedules'] = $send_back_schedules;
|
||||
$information['result'] = 'SUCCESS';
|
||||
return $information;
|
||||
}
|
||||
|
||||
function hmbkp_request_delete_backup() {
|
||||
if (!isset($_POST['hmbkp_backuparchive']) || empty($_POST['hmbkp_backuparchive']))
|
||||
return array('error' => __("Error data.", 'mainwp-child'));
|
||||
|
||||
$schedule_id = $this->check_schedule();
|
||||
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
$deleted = $schedule->delete_backup( sanitize_text_field( base64_decode( $_POST['hmbkp_backuparchive'] ) ) );
|
||||
|
||||
if ( is_wp_error( $deleted ) ) {
|
||||
return array( 'error' => $deleted->get_error_message());
|
||||
}
|
||||
|
||||
return array('result' => 'SUCCESS',
|
||||
'b' => $this->get_backupslist_html($schedule),
|
||||
'count' => count($schedule->get_backups()),
|
||||
'file_size_text' => $this->hmbkp_get_site_size_text( $schedule ),
|
||||
'scheduleStatus' => $schedule->get_status(),
|
||||
);
|
||||
}
|
||||
|
||||
function get_backupslist_html($schedule) {
|
||||
ob_start();
|
||||
?>
|
||||
<table class="widefat">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th scope="col"><?php hmbkp_backups_number( $schedule ); ?></th>
|
||||
<th scope="col"><?php _e( 'Size', 'mainwp-backupwordpress-extension' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Type', 'mainwp-backupwordpress-extension' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Actions', 'mainwp-backupwordpress-extension' ); ?></th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php if ( $schedule->get_backups() ) {
|
||||
|
||||
$schedule->delete_old_backups();
|
||||
|
||||
foreach ( $schedule->get_backups() as $file ) {
|
||||
|
||||
if ( ! file_exists( $file ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->hmbkp_get_backup_row( $file, $schedule );
|
||||
|
||||
}
|
||||
|
||||
} else { ?>
|
||||
|
||||
<tr>
|
||||
<td class="hmbkp-no-backups" colspan="4"><?php _e( 'This is where your backups will appear once you have some.', 'mainwp-backupwordpress-extension' ); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function hmbkp_get_site_size_text( HM\BackUpWordPress\Scheduled_Backup $schedule ) {
|
||||
|
||||
if ( ( 'database' === $schedule->get_type() ) || $schedule->is_site_size_cached() ) {
|
||||
|
||||
return sprintf( '(<code title="' . __( 'Backups will be compressed and should be smaller than this.', 'mainwp-backupwordpress-extension' ) . '">%s</code>)', esc_attr( $schedule->get_formatted_site_size() ) );
|
||||
|
||||
} else {
|
||||
|
||||
return sprintf( '(<code class="calculating" title="' . __( 'this shouldn\'t take long…', 'mainwp-backupwordpress-extension' ) . '">' . __( 'calculating the size of your backup…', 'mainwp-backupwordpress-extension' ) . '</code>)' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function hmbkp_get_backup_row( $file, HM\BackUpWordPress\Scheduled_Backup $schedule ) {
|
||||
|
||||
$encoded_file = urlencode( base64_encode( $file ) );
|
||||
$offset = get_option( 'gmt_offset' ) * 3600;
|
||||
|
||||
?>
|
||||
|
||||
<tr class="hmbkp_manage_backups_row">
|
||||
|
||||
<th scope="row">
|
||||
<?php echo esc_html( date_i18n( get_option( 'date_format' ) . ' - ' . get_option( 'time_format' ), @filemtime( $file ) + $offset ) ); ?>
|
||||
</th>
|
||||
|
||||
<td class="code">
|
||||
<?php echo esc_html( size_format( @filesize( $file ) ) ); ?>
|
||||
</td>
|
||||
|
||||
<td><?php echo esc_html( hmbkp_human_get_type( $file, $schedule ) ); ?></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( hmbkp_is_path_accessible( hmbkp_path() ) ) :
|
||||
?>
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_download_backup('<?php echo $encoded_file; ?>', <?php echo $schedule->get_id(); ?>, this);" class="download-action"><?php _e( 'Download', 'backupwordpress' ); ?></a> |
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_delete_backup('<?php echo $encoded_file; ?>', <?php echo $schedule->get_id(); ?>, this);" class="delete-action"><?php _e( 'Delete', 'backupwordpress' ); ?></a>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php }
|
||||
|
||||
function get_excluded($browse_dir = null) {
|
||||
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
<div class="hmbkp-exclude-settings">
|
||||
|
||||
<?php if ( $schedule->get_excludes() ) : ?>
|
||||
|
||||
<h3>
|
||||
<?php _e( 'Currently Excluded', 'backupwordpress' ); ?>
|
||||
</h3>
|
||||
|
||||
<p><?php _e( 'We automatically detect and ignore common <abbr title="Version Control Systems">VCS</abbr> folders and other backup plugin folders.', 'backupwordpress' ); ?></p>
|
||||
|
||||
<table class="widefat">
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ( array_diff( $schedule->get_excludes(), $schedule->backup->default_excludes() ) as $key => $exclude ) :
|
||||
|
||||
$exclude_path = new SplFileInfo( trailingslashit( $schedule->backup->get_root() ) . ltrim( str_ireplace( $schedule->backup->get_root(), '', $exclude ), '/' ) ); ?>
|
||||
|
||||
<tr>
|
||||
|
||||
<th scope="row">
|
||||
|
||||
<?php if ( $exclude_path->isFile() ) { ?>
|
||||
|
||||
<div class="dashicons dashicons-media-default"></div>
|
||||
|
||||
<?php } elseif ( $exclude_path->isDir() ) { ?>
|
||||
|
||||
<div class="dashicons dashicons-portfolio"></div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</th>
|
||||
|
||||
<td>
|
||||
<code><?php echo esc_html( str_ireplace( $schedule->backup->get_root(), '', $exclude ) ); ?></code>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) ) ) : ?>
|
||||
|
||||
<?php _e( 'Default rule', 'backupwordpress' ); ?>
|
||||
|
||||
<?php elseif ( defined( 'HMBKP_EXCLUDE' ) && false !== strpos( HMBKP_EXCLUDE, $exclude ) ) : ?>
|
||||
|
||||
<?php _e( 'Defined in wp-config.php', 'backupwordpress' ); ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_remove_exclude_rule('<?php echo $exclude; ?>', this);" class="delete-action"><?php _e( 'Stop excluding', 'backupwordpress' ); ?></a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 id="directory-listing"><?php _e( 'Directory Listing', 'backupwordpress' ); ?></h3>
|
||||
|
||||
<p><?php _e( 'Here\'s a directory listing of all files on your site, you can browse through and exclude files or folders that you don\'t want included in your backup.', 'backupwordpress' ); ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
// The directory to display
|
||||
$directory = $schedule->backup->get_root();
|
||||
|
||||
if ( isset( $browse_dir ) ) {
|
||||
|
||||
$untrusted_directory = urldecode( $browse_dir) ;
|
||||
|
||||
// Only allow real sub directories of the site root to be browsed
|
||||
if ( false !== strpos( $untrusted_directory, $schedule->backup->get_root() ) && is_dir( $untrusted_directory ) ) {
|
||||
$directory = $untrusted_directory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$exclude_string = $schedule->backup->exclude_string( 'regex' );
|
||||
|
||||
// Kick off a recursive filesize scan
|
||||
$files = $schedule->list_directory_by_total_filesize( $directory );
|
||||
|
||||
if ( $files ) { ?>
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th scope="col"><?php _e( 'Name', 'backupwordpress' ); ?></th>
|
||||
<th scope="col" class="column-format"><?php _e( 'Size', 'backupwordpress' ); ?></th>
|
||||
<th scope="col" class="column-format"><?php _e( 'Permissions', 'backupwordpress' ); ?></th>
|
||||
<th scope="col" class="column-format"><?php _e( 'Type', 'backupwordpress' ); ?></th>
|
||||
<th scope="col" class="column-format"><?php _e( 'Status', 'backupwordpress' ); ?></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th scope="row">
|
||||
<div class="dashicons dashicons-admin-home"></div>
|
||||
</th>
|
||||
|
||||
<th scope="col">
|
||||
|
||||
<?php if ( $schedule->backup->get_root() !== $directory ) {
|
||||
// echo esc_url( remove_query_arg( 'hmbkp_directory_browse' ) );
|
||||
?>
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_directory_browse('', this)"><?php echo esc_html( $schedule->backup->get_root() ); ?></a>
|
||||
<code>/</code>
|
||||
|
||||
<?php $parents = array_filter( explode( '/', str_replace( trailingslashit( $schedule->backup->get_root() ), '', trailingslashit( dirname( $directory ) ) ) ) );
|
||||
|
||||
foreach ( $parents as $directory_basename ) { ?>
|
||||
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_directory_browse('<?php echo urlencode( substr( $directory, 0, strpos( $directory, $directory_basename ) ) . $directory_basename ); ?>', this)" ><?php echo esc_html( $directory_basename ); ?></a>
|
||||
<code>/</code>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php echo esc_html( basename( $directory ) ); ?>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php echo esc_html( $schedule->backup->get_root() ); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</th>
|
||||
|
||||
<td class="column-filesize">
|
||||
|
||||
<?php if ( $schedule->is_site_size_being_calculated() ) { ?>
|
||||
|
||||
<span class="spinner"></span>
|
||||
|
||||
<?php } else {
|
||||
|
||||
$root = new SplFileInfo( $schedule->backup->get_root() );
|
||||
|
||||
$size = $schedule->filesize( $root, true );
|
||||
|
||||
if ( false !== $size ) {
|
||||
|
||||
$size = size_format( $size );
|
||||
|
||||
if ( ! $size ) {
|
||||
$size = '0 B';
|
||||
} ?>
|
||||
|
||||
<code>
|
||||
|
||||
<?php echo esc_html( $size ); ?>
|
||||
|
||||
<a class="dashicons dashicons-update"
|
||||
href="<?php echo wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( $schedule->backup->get_root() ) ), 'hmbkp-recalculate_directory_filesize' ); ?>"><span><?php _e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
|
||||
</code>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<td>
|
||||
<?php echo esc_html( substr( sprintf( '%o', fileperms( $schedule->backup->get_root() ) ), - 4 ) ); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( is_link( $schedule->backup->get_root() ) ) {
|
||||
|
||||
_e( 'Symlink', 'backupwordpress' );
|
||||
|
||||
} elseif ( is_dir( $schedule->backup->get_root() ) ) {
|
||||
|
||||
_e( 'Folder', 'backupwordpress' );
|
||||
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ( $files as $size => $file ) {
|
||||
|
||||
$is_excluded = $is_unreadable = false;
|
||||
|
||||
// Check if the file is excluded
|
||||
if ( $exclude_string && preg_match( '(' . $exclude_string . ')', str_ireplace( trailingslashit( $schedule->backup->get_root() ), '', HM\BackUpWordPress\Backup::conform_dir( $file->getPathname() ) ) ) ) {
|
||||
$is_excluded = true;
|
||||
}
|
||||
|
||||
// Skip unreadable files
|
||||
if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() ) {
|
||||
$is_unreadable = true;
|
||||
} ?>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( $is_unreadable ) { ?>
|
||||
|
||||
<div class="dashicons dashicons-dismiss"></div>
|
||||
|
||||
<?php } elseif ( $file->isFile() ) { ?>
|
||||
|
||||
<div class="dashicons dashicons-media-default"></div>
|
||||
|
||||
<?php } elseif ( $file->isDir() ) { ?>
|
||||
|
||||
<div class="dashicons dashicons-portfolio"></div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( $is_unreadable ) { ?>
|
||||
|
||||
<code class="strikethrough"
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<?php } elseif ( $file->isFile() ) { ?>
|
||||
|
||||
<code
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<?php } elseif ( $file->isDir() ) {
|
||||
//echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) );
|
||||
?>
|
||||
<code title="<?php echo esc_attr( $file->getRealPath() ); ?>"><a
|
||||
href="#" onclick="event.preventDefault(); mainwp_backupwp_directory_browse('<?php echo urlencode( $file->getPathname()); ?>', this)" ><?php echo esc_html( $file->getBasename() ); ?></a></code>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="column-format column-filesize">
|
||||
|
||||
<?php if ( $file->isDir() && $schedule->is_site_size_being_calculated() ) { ?>
|
||||
|
||||
<span class="spinner"></span>
|
||||
|
||||
<?php } else {
|
||||
|
||||
$size = $schedule->filesize( $file );
|
||||
|
||||
if ( false !== $size ) {
|
||||
|
||||
$size = size_format( $size );
|
||||
|
||||
if ( ! $size ) {
|
||||
$size = '0 B';
|
||||
} ?>
|
||||
|
||||
<code>
|
||||
|
||||
<?php echo esc_html( $size ); ?>
|
||||
|
||||
<?php if ( $file->isDir() ) { ?>
|
||||
|
||||
<a title="<?php _e( 'Recalculate the size of this directory', 'backupwordpress' ); ?>"
|
||||
class="dashicons dashicons-update"
|
||||
href="<?php echo wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( $file->getPathname() ) ), 'hmbkp-recalculate_directory_filesize' ); ?>"><span><?php _e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</code>
|
||||
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<code>--</code>
|
||||
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo esc_html( substr( sprintf( '%o', $file->getPerms() ), - 4 ) ); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if ( $file->isLink() ) { ?>
|
||||
|
||||
<span
|
||||
title="<?php echo esc_attr( $file->GetRealPath() ); ?>"><?php _e( 'Symlink', 'backupwordpress' ); ?></span>
|
||||
|
||||
<?php } elseif ( $file->isDir() ) {
|
||||
|
||||
_e( 'Folder', 'backupwordpress' );
|
||||
|
||||
} else {
|
||||
|
||||
_e( 'File', 'backupwordpress' );
|
||||
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="column-format">
|
||||
|
||||
<?php if ( $is_unreadable ) { ?>
|
||||
|
||||
<strong
|
||||
title="<?php _e( 'Unreadable files won\'t be backed up.', 'backupwordpress' ); ?>"><?php _e( 'Unreadable', 'backupwordpress' ); ?></strong>
|
||||
|
||||
<?php } elseif ( $is_excluded ) { ?>
|
||||
|
||||
<strong><?php _e( 'Excluded', 'backupwordpress' ); ?></strong>
|
||||
|
||||
<?php } else {
|
||||
|
||||
$exclude_path = $file->getPathname();
|
||||
|
||||
// Excluded directories need to be trailingslashed
|
||||
if ( $file->isDir() ) {
|
||||
$exclude_path = trailingslashit( $file->getPathname() );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_exclude_add_rule('<?php echo urlencode( $exclude_path ); ?>', this)"
|
||||
class="button-secondary"><?php _e( 'Exclude →', 'backupwordpress' ); ?></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<p class="submit">
|
||||
<a href="#" onclick="event.preventDefault(); mainwp_backupwp_edit_exclude_done()"
|
||||
class="button-primary"><?php _e( 'Done', 'backupwordpress' ); ?></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$output = ob_get_clean();
|
||||
$information['e'] = $output;
|
||||
return $information;
|
||||
|
||||
}
|
||||
|
||||
function directory_browse() {
|
||||
$browse_dir = $_POST['browse_dir'];
|
||||
$out = array();
|
||||
$return = $this->get_excluded($browse_dir);
|
||||
$out['e'] = $return['e'];
|
||||
$out['current_browse_dir'] = $browse_dir;
|
||||
return $out;
|
||||
}
|
||||
|
||||
function hmbkp_add_exclude_rule() {
|
||||
|
||||
if ( ! isset( $_POST['exclude_pathname'] ) || empty( $_POST['exclude_pathname']) ) {
|
||||
return array('error' => __("Error: Empty exclude directory path."));
|
||||
}
|
||||
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( $schedule_id ) );
|
||||
|
||||
$exclude_rule = urldecode($_POST['exclude_pathname']);
|
||||
|
||||
$schedule->set_excludes( $exclude_rule, true );
|
||||
|
||||
$schedule->save();
|
||||
|
||||
$current_path = urldecode($_POST['browse_dir']);
|
||||
|
||||
if (empty($current_path))
|
||||
$current_path = null;
|
||||
|
||||
$return = $this->get_excluded($current_path);
|
||||
$out['e'] = $return['e'];
|
||||
$out['current_browse_dir'] = $_POST['browse_dir'];
|
||||
return $out;
|
||||
|
||||
}
|
||||
|
||||
function hmbkp_remove_exclude_rule() {
|
||||
|
||||
if ( ! isset( $_POST['remove_rule'] ) || empty( $_POST['remove_rule']) ) {
|
||||
return array('error' => __("Error: Empty exclude directory path."));
|
||||
}
|
||||
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( $schedule_id ) );
|
||||
|
||||
$excludes = $schedule->get_excludes();
|
||||
|
||||
$schedule->set_excludes( array_diff( $excludes, (array) stripslashes( sanitize_text_field( $_POST['remove_rule'] ) ) ) );
|
||||
|
||||
$schedule->save();
|
||||
|
||||
$current_path = urldecode($_POST['browse_dir']);
|
||||
|
||||
if (empty($current_path))
|
||||
$current_path = null;
|
||||
|
||||
$return = $this->get_excluded($current_path);
|
||||
|
||||
$out['e'] = $return['e'];
|
||||
$out['current_browse_dir'] = $_POST['browse_dir'];
|
||||
return $out;
|
||||
}
|
||||
|
||||
function update_schedule() {
|
||||
$sch_id = isset($_POST['schedule_id']) ? $_POST['schedule_id'] : 0;
|
||||
$sch_id = sanitize_text_field( urldecode( $sch_id ));
|
||||
$options = isset($_POST['options']) ? unserialize(base64_decode($_POST['options'])) : false;
|
||||
|
||||
if (!is_array($options) || empty($options) || empty($sch_id))
|
||||
return array('error' => 'Error: Schedule data');
|
||||
|
||||
$current_value = get_option( 'hmbkp_schedule_' . $sch_id );
|
||||
if (is_array($current_value) && isset($current_value['excludes'])) {
|
||||
// do not update 'excludes' value
|
||||
$options['excludes'] = $current_value['excludes'];
|
||||
}
|
||||
|
||||
$out = array();
|
||||
if ( is_array($options)) {
|
||||
update_option( 'hmbkp_schedule_' . $sch_id, $options );
|
||||
$out['result'] = 'SUCCESS';
|
||||
} else {
|
||||
$out['result'] = 'NOTCHANGE';
|
||||
}
|
||||
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( $sch_id );
|
||||
|
||||
if ( ! empty( $options['reoccurrence'] ) && ! empty( $options['schedule_start_time'] ) ) {
|
||||
// Calculate the start time depending on the recurrence
|
||||
$start_time = $options['schedule_start_time'];
|
||||
if ( $start_time ) {
|
||||
$schedule->set_schedule_start_time( $start_time );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $options['reoccurrence'] ) ) {
|
||||
$schedule->set_reoccurrence( $options['reoccurrence'] );
|
||||
}
|
||||
$out['next_occurrence'] = $schedule->get_next_occurrence(false);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public static function isActivated() {
|
||||
if (!defined('HMBKP_PLUGIN_PATH') || !class_exists('HM\BackUpWordPress\Plugin'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function all_plugins($plugins) {
|
||||
foreach ($plugins as $key => $value)
|
||||
{
|
||||
$plugin_slug = basename($key, '.php');
|
||||
if ($plugin_slug == 'backupwordpress')
|
||||
unset($plugins[$key]);
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
public function remove_menu() {
|
||||
global $submenu;
|
||||
if (isset($submenu['tools.php'])) {
|
||||
foreach($submenu['tools.php'] as $index => $item) {
|
||||
if ($item[2] == 'backupwordpress') {
|
||||
unset($submenu['tools.php'][$index]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pos = stripos($_SERVER['REQUEST_URI'], 'tools.php?page=backupwordpress');
|
||||
if ($pos !== false) {
|
||||
wp_redirect(get_option('siteurl') . '/wp-admin/index.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
function update_footer($text){
|
||||
if (stripos($_SERVER['REQUEST_URI'], 'update-core.php') !== false) {
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('input[type="checkbox"][value="backupwordpress/backupwordpress.php"]').closest('tr').remove();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
if ($this->check_update_child_plugin()) {
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
var menu_update = jQuery('span.update-plugins');
|
||||
var menu_count = jQuery('span.update-plugins > span.update-count');
|
||||
if (menu_count) {
|
||||
var count = parseInt(menu_count.html());
|
||||
if (count > 1) {
|
||||
jQuery('span.update-plugins > span.update-count').each(function(){
|
||||
jQuery(this).html(count - 1);
|
||||
});
|
||||
jQuery('span.update-plugins > span.plugin-count').each(function(){
|
||||
jQuery(this).html(count - 1);
|
||||
});
|
||||
var title = menu_update.attr('title').replace(count, count - 1);
|
||||
jQuery('span.update-plugins').each(function(){
|
||||
jQuery(this).attr('title', title);
|
||||
});
|
||||
|
||||
} else if (count == 1) {
|
||||
jQuery('span.update-plugins').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function check_update_child_plugin() {
|
||||
if ( $plugins = current_user_can( 'update_plugins' ) ) {
|
||||
$update_plugins = get_site_transient( 'update_plugins' );
|
||||
if (!empty( $update_plugins->response )) {
|
||||
$response = $update_plugins->response;
|
||||
if (is_array($response) && isset($response['backupwordpress/backupwordpress.php']))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ class MainWPChildIThemesSecurity
|
|||
}
|
||||
|
||||
public function admin_init() {
|
||||
remove_meta_box('itsec-dashboard-widget', 'dashboard');
|
||||
remove_meta_box('itsec-dashboard-widget', 'dashboard', 'normal');
|
||||
}
|
||||
|
||||
public function all_plugins($plugins) {
|
||||
|
|
|
@ -286,111 +286,134 @@ class MainWPChildServerInformation
|
|||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Server Configuration','mainwp'); ?></span></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Suggested Value','mainwp'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts mwp-not-generate-row" style="width: 1px;"><?php _e('','mainwp-child'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Server Configuration','mainwp-child'); ?></span></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Required Value','mainwp'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Value','mainwp'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Status','mainwp'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="the-sites-list" class="list:sites">
|
||||
<tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('MAINWP CHILD','mainwp'); ?></td></tr>
|
||||
<tr><td></td><td>MainWP Child Version</td><td><?php echo self::getMainWPVersion(); ?></td><td><?php echo self::getCurrentVersion(); ?></td><td><?php echo self::getMainWPVersionCheck(); ?></td></tr>
|
||||
<?php
|
||||
self::checkDirectoryMainWPDirectory();
|
||||
?><tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('WORDPRESS','mainwp-child'); ?></td></tr><?php
|
||||
self::renderRow('WordPress Version', '>=', '3.4', 'getWordpressVersion');
|
||||
?><tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('PHP SETTINGS','mainwp-child'); ?></td></tr><?php
|
||||
self::renderRow('PHP Version', '>=', '5.2.4', 'getPHPVersion');
|
||||
self::renderRow('MySQL Version', '>=', '5.0', 'getMySQLVersion');
|
||||
self::renderRow('PHP Max Execution Time', '>=', '30', 'getMaxExecutionTime', 'seconds', '=', '0');
|
||||
self::renderRow('PHP Upload Max Filesize', '>=', '2M', 'getUploadMaxFilesize', '(2MB+ best for upload of big plugins)');
|
||||
self::renderRow('PHP Post Max Size', '>=', '2M', 'getPostMaxSize', '(2MB+ best for upload of big plugins)');
|
||||
// self::renderRow('PHP Memory Limit', '>=', '128M', 'getPHPMemoryLimit', '(256M+ best for big backups)');
|
||||
?><tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('MISC','mainwp-child'); ?></td></tr><?php
|
||||
self::renderRow('PCRE Backtracking Limit', '>=', '10000', 'getOutputBufferSize');
|
||||
self::renderRow('SSL Extension Enabled', '=', true, 'getSSLSupport');
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-posts" style="" colspan="4"><span><?php _e('Backup Archive Information','mainwp'); ?></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
?><tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('MySQL SETTINGS','mainwp-child'); ?></td></tr><?php
|
||||
self::renderRow('MySQL Version', '>=', '5.0', 'getMySQLVersion');
|
||||
?><tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('BACKUP ARCHIVE INFORMATION','mainwp-child'); ?></td></tr><?php
|
||||
|
||||
<tbody id="the-sites-list" class="list:sites">
|
||||
<?php
|
||||
self::renderRow('ZipArchive enabled in PHP', '=', true, 'getZipArchiveEnabled');
|
||||
self::renderRow('Tar GZip supported', '=', true, 'getGZipEnabled');
|
||||
self::renderRow('Tar BZip2 supported', '=', true, 'getBZipEnabled');
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Directory name','mainwp'); ?></span></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Path','mainwp'); ?></span></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Check','mainwp'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Result','mainwp'); ?></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><?php _e('Status','mainwp'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
?>
|
||||
|
||||
<tbody id="the-sites-list" class="list:sites">
|
||||
<?php
|
||||
self::checkDirectoryMainWPDirectory();
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Server Info','mainwp'); ?></span></th>
|
||||
<th scope="col" class="manage-column column-posts" style=""><span><?php _e('Value','mainwp'); ?></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-sites-list" class="list:sites">
|
||||
<tr><td><?php _e('WordPress Root Directory','mainwp'); ?></td><td><?php self::getWPRoot(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Name','mainwp'); ?></td><td><?php self::getSeverName(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Sofware','mainwp'); ?></td><td><?php self::getServerSoftware(); ?></td></tr>
|
||||
<tr><td><?php _e('Operating System','mainwp'); ?></td><td><?php self::getOS(); ?></td></tr>
|
||||
<tr><td><?php _e('Architecture','mainwp'); ?></td><td><?php self::getArchitecture(); ?></td></tr>
|
||||
<tr><td><?php _e('Server IP','mainwp'); ?></td><td><?php self::getServerIP(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Protocol','mainwp'); ?></td><td><?php self::getServerProtocol(); ?></td></tr>
|
||||
<tr><td><?php _e('HTTP Host','mainwp'); ?></td><td><?php self::getHTTPHost(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Admin','mainwp'); ?></td><td><?php self::getServerAdmin(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Port','mainwp'); ?></td><td><?php self::getServerPort(); ?></td></tr>
|
||||
<tr><td><?php _e('Getaway Interface','mainwp'); ?></td><td><?php self::getServerGetawayInterface(); ?></td></tr>
|
||||
<tr><td><?php _e('Memory Usage','mainwp'); ?></td><td><?php self::memoryUsage(); ?></td></tr>
|
||||
<tr><td><?php _e('HTTPS','mainwp'); ?></td><td><?php self::getHTTPS(); ?></td></tr>
|
||||
<tr><td><?php _e('User Agent','mainwp'); ?></td><td><?php self::getUserAgent(); ?></td></tr>
|
||||
<tr><td><?php _e('Complete URL','mainwp'); ?></td><td><?php self::getCompleteURL(); ?></td></tr>
|
||||
<tr><td><?php _e('Request Method','mainwp'); ?></td><td><?php self::getServerRequestMethod(); ?></td></tr>
|
||||
<tr><td><?php _e('Request Time','mainwp'); ?></td><td><?php self::getServerRequestTime(); ?></td></tr>
|
||||
<tr><td><?php _e('Query String','mainwp'); ?></td><td><?php self::getServerQueryString(); ?></td></tr>
|
||||
<tr><td><?php _e('Accept Content','mainwp'); ?></td><td><?php self::getServerHTTPAccept(); ?></td></tr>
|
||||
<tr><td><?php _e('Accept-Charset Content','mainwp'); ?></td><td><?php self::getServerAcceptCharset(); ?></td></tr>
|
||||
<tr><td><?php _e('Currently Executing Script Pathname','mainwp'); ?></td><td><?php self::getScriptFileName(); ?></td></tr>
|
||||
<tr><td><?php _e('Server Signature','mainwp'); ?></td><td><?php self::getServerSignature(); ?></td></tr>
|
||||
<tr><td><?php _e('Currently Executing Script','mainwp'); ?></td><td><?php self::getCurrentlyExecutingScript(); ?></td></tr>
|
||||
<tr><td><?php _e('Path Translated','mainwp'); ?></td><td><?php self::getServerPathTranslated(); ?></td></tr>
|
||||
<tr><td><?php _e('Current Script Path','mainwp'); ?></td><td><?php self::getScriptName(); ?></td></tr>
|
||||
<tr><td><?php _e('Current Page URI','mainwp'); ?></td><td><?php self::getCurrentPageURI(); ?></td></tr>
|
||||
<tr><td><?php _e('Remote Address','mainwp'); ?></td><td><?php self::getRemoteAddress(); ?></td></tr>
|
||||
<tr><td><?php _e('Remote Host','mainwp'); ?></td><td><?php self::getRemoteHost(); ?></td></tr>
|
||||
<tr><td><?php _e('Remote Port','mainwp'); ?></td><td><?php self::getRemotePort(); ?></td></tr>
|
||||
<tr><td><?php _e('PHP Safe Mode','mainwp'); ?></td><td><?php self::getPHPSafeMode(); ?></td></tr>
|
||||
<tr><td><?php _e('PHP Allow URL fopen','mainwp'); ?></td><td><?php self::getPHPAllowUrlFopen(); ?></td></tr>
|
||||
<tr><td><?php _e('PHP Exif Support','mainwp'); ?></td><td><?php self::getPHPExif(); ?></td></tr>
|
||||
<tr><td><?php _e('PHP IPTC Support','mainwp'); ?></td><td><?php self::getPHPIPTC(); ?></td></tr>
|
||||
<tr><td><?php _e('PHP XML Support','mainwp'); ?></td><td><?php self::getPHPXML(); ?></td></tr>
|
||||
<tr><td><?php _e('SQL Mode','mainwp'); ?></td><td><?php self::getSQLMode(); ?></td></tr>
|
||||
<tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('SERVER INFORMATION','mainwp'); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('WordPress Root Directory','mainwp'); ?></td><td colspan="3"><?php self::getWPRoot(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Name','mainwp'); ?></td><td colspan="3"><?php self::getSeverName(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Sofware','mainwp'); ?></td><td colspan="3"><?php self::getServerSoftware(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Operating System','mainwp'); ?></td><td colspan="3"><?php self::getOS(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Architecture','mainwp'); ?></td><td colspan="3"><?php self::getArchitecture(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server IP','mainwp'); ?></td><td colspan="3"><?php self::getServerIP(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Protocol','mainwp'); ?></td><td colspan="3"><?php self::getServerProtocol(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('HTTP Host','mainwp'); ?></td><td colspan="3"><?php self::getHTTPHost(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Admin','mainwp'); ?></td><td colspan="3"><?php self::getServerAdmin(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Port','mainwp'); ?></td><td colspan="3"><?php self::getServerPort(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Getaway Interface','mainwp'); ?></td><td colspan="3"><?php self::getServerGetawayInterface(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Memory Usage','mainwp'); ?></td><td colspan="3"><?php self::memoryUsage(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('HTTPS','mainwp'); ?></td><td colspan="3"><?php self::getHTTPS(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('User Agent','mainwp'); ?></td><td colspan="3"><?php self::getUserAgent(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Complete URL','mainwp'); ?></td><td colspan="3"><?php self::getCompleteURL(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Request Method','mainwp'); ?></td><td colspan="3"><?php self::getServerRequestMethod(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Request Time','mainwp'); ?></td><td colspan="3"><?php self::getServerRequestTime(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Query String','mainwp'); ?></td><td colspan="3"><?php self::getServerQueryString(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Accept Content','mainwp'); ?></td><td colspan="3"><?php self::getServerHTTPAccept(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Accept-Charset Content','mainwp'); ?></td><td colspan="3"><?php self::getServerAcceptCharset(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Currently Executing Script Pathname','mainwp'); ?></td><td colspan="3"><?php self::getScriptFileName(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Server Signature','mainwp'); ?></td><td colspan="3"><?php self::getServerSignature(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Currently Executing Script','mainwp'); ?></td><td colspan="3"><?php self::getCurrentlyExecutingScript(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Path Translated','mainwp'); ?></td><td colspan="3"><?php self::getServerPathTranslated(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Current Script Path','mainwp'); ?></td><td colspan="3"><?php self::getScriptName(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Current Page URI','mainwp'); ?></td><td colspan="3"><?php self::getCurrentPageURI(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Remote Address','mainwp'); ?></td><td colspan="3"><?php self::getRemoteAddress(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Remote Host','mainwp'); ?></td><td colspan="3"><?php self::getRemoteHost(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('Remote Port','mainwp'); ?></td><td colspan="3"><?php self::getRemotePort(); ?></td></tr>
|
||||
<tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('PHP INFORMATION','mainwp'); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP Safe Mode Disabled','mainwp'); ?></td><td colspan="3"><?php self::getPHPSafeMode(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP Allow URL fopen','mainwp'); ?></td><td colspan="3"><?php self::getPHPAllowUrlFopen(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP Exif Support','mainwp'); ?></td><td colspan="3"><?php self::getPHPExif(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP IPTC Support','mainwp'); ?></td><td colspan="3"><?php self::getPHPIPTC(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP XML Support','mainwp'); ?></td><td colspan="3"><?php self::getPHPXML(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('PHP Disabled Functions','mainwp'); ?></td><td colspan="3"><?php self::mainwpRequiredFunctions(); ?></td></tr>
|
||||
<tr><td></td><td><?php _e('PHP Loaded Extensions','mainwp'); ?></td><td colspan="3" style="width: 73% !important;"><?php self::getLoadedPHPExtensions(); ?></td></tr>
|
||||
<tr><td style="background: #333; color: #fff;" colspan="5"><?php _e('MySQL INFORMATION','mainwp'); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('MySQL Mode','mainwp'); ?></td><td colspan="3"><?php self::getSQLMode(); ?></td></tr>
|
||||
<tr><td ></td><td><?php _e('MySQL Client Encoding','mainwp'); ?></td><td colspan="3"><?php echo defined( 'DB_CHARSET' ) ? DB_CHARSET : ''; ?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
public static function mainwpRequiredFunctions() {
|
||||
//error_reporting(E_ALL);
|
||||
$disabled_functions = ini_get('disable_functions');
|
||||
if ($disabled_functions != '')
|
||||
{
|
||||
$arr = explode(',', $disabled_functions);
|
||||
sort($arr);
|
||||
for ($i=0; $i<count($arr); $i++)
|
||||
{
|
||||
echo $arr[$i].', ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo __('No functions disabled','mainwp');
|
||||
}
|
||||
}
|
||||
|
||||
protected static function getLoadedPHPExtensions() {
|
||||
$extensions = get_loaded_extensions();
|
||||
sort( $extensions );
|
||||
echo implode( ', ', $extensions);
|
||||
}
|
||||
protected static function getCurrentVersion() {
|
||||
$currentVersion = get_option('mainwp_child_plugin_version');
|
||||
return $currentVersion;
|
||||
}
|
||||
|
||||
protected static function getMainwpVersion() {
|
||||
include_once(ABSPATH . '/wp-admin/includes/plugin-install.php');
|
||||
$api = plugins_api('plugin_information', array('slug' => "mainwp-child", 'fields' => array('sections' => false), 'timeout' => 60));
|
||||
if (is_object($api) && isset($api->version)) {
|
||||
return $api->version;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static function getMainWPVersionCheck() {
|
||||
$current = get_option('mainwp_child_plugin_version');
|
||||
$latest = self::getMainwpVersion();
|
||||
if ($current == $latest) {
|
||||
echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>';
|
||||
} else {
|
||||
echo '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>';
|
||||
}
|
||||
}
|
||||
|
||||
public static function renderCron()
|
||||
{
|
||||
$cron_array = _get_cron_array();
|
||||
|
@ -473,7 +496,7 @@ class MainWPChildServerInformation
|
|||
|
||||
if ($write)
|
||||
{
|
||||
return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', '/', true);
|
||||
return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', 'Writable', true);
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
|
@ -482,11 +505,12 @@ class MainWPChildServerInformation
|
|||
{
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $pName; ?></td>
|
||||
<td><?php echo $pDirectory; ?></td>
|
||||
<td ></td>
|
||||
<td><?php echo $pName; ?><br/><?php echo $pDirectory; ?></td>
|
||||
<!-- <td><?php echo $pDirectory; ?></td>-->
|
||||
<td><?php echo $pCheck; ?></td>
|
||||
<td><?php echo $pResult; ?></td>
|
||||
<td><?php echo ($pPassed ? '<span class="mainwp-pass">Pass</span>' : '<span class="mainwp-warning">Warning</span>'); ?></td>
|
||||
<td><?php echo ($pPassed ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
return true;
|
||||
|
@ -498,10 +522,11 @@ class MainWPChildServerInformation
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<td ></td>
|
||||
<td><?php echo $pConfig; ?></td>
|
||||
<td><?php echo $pCompare; ?> <?php echo ($pVersion === true ? 'true' : $pVersion) . ' ' . $pExtraText; ?></td>
|
||||
<td><?php echo ($currentVersion === true ? 'true' : $currentVersion); ?></td>
|
||||
<td><?php echo (self::check($pCompare, $pVersion, $pGetter, $pExtraCompare, $pExtraVersion) ? '<span class="mainwp-pass">Pass</span>' : '<span class="mainwp-warning">Warning</span>'); ?></td>
|
||||
<td><?php echo (self::check($pCompare, $pVersion, $pGetter, $pExtraCompare, $pExtraVersion) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -184,13 +184,25 @@ class MainWPChildUpdraftplusBackups
|
|||
if (class_exists('UpdraftPlus_Options')) {
|
||||
foreach($keys as $key) {
|
||||
if (isset($settings[$key])) {
|
||||
// if ($key == "updraft_service") {
|
||||
// UpdraftPlus_Options::update_updraft_option($key, $settings[$key]);
|
||||
// } else if ($key == "updraft_s3") {
|
||||
// UpdraftPlus_Options::update_updraft_option($key, $settings[$key]);
|
||||
// } else {
|
||||
if ($key == "updraft_dropbox") {
|
||||
if (isset($settings[$key])) {
|
||||
$opts = UpdraftPlus_Options::get_updraft_option('updraft_dropbox');
|
||||
$opts['appkey'] = $settings[$key]['appkey'];
|
||||
$opts['secret'] = $settings[$key]['secret'];
|
||||
$opts['folder'] = $settings[$key]['folder'];
|
||||
UpdraftPlus_Options::update_updraft_option($key, $opts);
|
||||
}
|
||||
} else if ($key == "updraft_googledrive") {
|
||||
if (isset($settings[$key])) {
|
||||
$opts = UpdraftPlus_Options::get_updraft_option('updraft_googledrive');
|
||||
$opts['clientid'] = $settings[$key]['clientid'];
|
||||
$opts['secret'] = $settings[$key]['secret'];
|
||||
$opts['folder'] = $settings[$key]['folder'];
|
||||
UpdraftPlus_Options::update_updraft_option($key, $opts);
|
||||
}
|
||||
} else {
|
||||
UpdraftPlus_Options::update_updraft_option($key, $settings[$key]);
|
||||
// }
|
||||
}
|
||||
$updated = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ class MainWPChildWordfence
|
|||
}
|
||||
|
||||
public function admin_init() {
|
||||
remove_meta_box('wordfence_activity_report_widget', 'dashboard');
|
||||
remove_meta_box('wordfence_activity_report_widget', 'dashboard', 'normal');
|
||||
}
|
||||
|
||||
public function init_cron() {
|
||||
|
|
|
@ -4,7 +4,8 @@ class MainWPHelper
|
|||
|
||||
static function write($val)
|
||||
{
|
||||
die('<mainwp>' . base64_encode(serialize($val)) . '</mainwp>');
|
||||
$output = serialize($val);
|
||||
die('<mainwp>' . base64_encode($output) . '</mainwp>');
|
||||
}
|
||||
|
||||
static function error($error)
|
||||
|
@ -372,7 +373,8 @@ class MainWPHelper
|
|||
if ($is_post_plus) {
|
||||
$random_privelege = isset($post_custom['_saved_draft_random_privelege']) ? $post_custom['_saved_draft_random_privelege'] : null;
|
||||
$random_privelege = is_array($random_privelege) ? current($random_privelege) : null;
|
||||
$random_privelege = unserialize(base64_decode($random_privelege));
|
||||
$random_privelege_base = base64_decode($random_privelege);
|
||||
$random_privelege = unserialize($random_privelege_base);
|
||||
|
||||
if (is_array($random_privelege) && count($random_privelege) > 0) {
|
||||
$random_post_authors = array();
|
||||
|
@ -667,7 +669,8 @@ class MainWPHelper
|
|||
}
|
||||
else if (preg_match('/<mainwp>(.*)<\/mainwp>/', $data, $results) > 0) {
|
||||
$result = $results[1];
|
||||
$information = unserialize(base64_decode($result));
|
||||
$result_base = base64_decode($result);
|
||||
$information = unserialize($result_base);
|
||||
return $information;
|
||||
}
|
||||
else if ($data == '')
|
||||
|
|
|
@ -257,7 +257,7 @@ class MainWPSecurity
|
|||
return !(((ini_get('display_errors') != 0) && (ini_get('display_errors') != 'off')) || ((ini_get('display_startup_errors') != 0) && (ini_get('display_startup_errors') != 'off')));
|
||||
}
|
||||
|
||||
public static function remove_php_reporting($force)
|
||||
public static function remove_php_reporting($force = false)
|
||||
{
|
||||
if ($force || self::get_security_option('php_reporting'))
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
Description: Child Plugin for MainWP. The plugin is used so the installed blog can be securely managed remotely by your network. Plugin documentation and options can be found here http://docs.mainwp.com
|
||||
Author: MainWP
|
||||
Author URI: http://mainwp.com
|
||||
Version: 2.0.15-alpha
|
||||
Version: 2.0.15
|
||||
*/
|
||||
header('X-Frame-Options: ALLOWALL');
|
||||
//header('X-Frame-Options: GOFORIT');
|
||||
|
|
|
@ -66,6 +66,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](http://do
|
|||
* Updated: Required values on the Server Information page
|
||||
* Updated: Layout of the Server Information page
|
||||
* Removed: Unnecessary checks from the Sever Information page
|
||||
* Enhancement: Reduced page load time by autoloading common options
|
||||
|
||||
= 2.0.14 =
|
||||
* Fixed: Handling of updates when plugins change folder structure or name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue