Exemple #1
0
<?php

require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
global $wp_version;
global $wpdb;
ob_start();
phpinfo();
$serverinfo = ob_get_contents();
ob_end_clean();
$serverinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $serverinfo);
$serverinfo = preg_replace('%^.*<title>(.*)</title>.*$%ms', '$1', $serverinfo);
$action_response = null;
$dbvar_maxtime = DUP_Util::MysqlVariableValue('wait_timeout');
$dbvar_maxpacks = DUP_Util::MysqlVariableValue('max_allowed_packet');
$dbvar_maxtime = is_null($dbvar_maxtime) ? __("unknow", 'wpduplicator') : $dbvar_maxtime;
$dbvar_maxpacks = is_null($dbvar_maxpacks) ? __("unknow", 'wpduplicator') : $dbvar_maxpacks;
$space = @disk_total_space(DUPLICATOR_WPROOTPATH);
$space_free = @disk_free_space(DUPLICATOR_WPROOTPATH);
$perc = @round(100 / $space * $space_free, 2);
$mysqldumpPath = DUP_Database::GetMySqlDumpPath();
$mysqlDumpSupport = $mysqldumpPath ? $mysqldumpPath : 'Path Not Found';
$view_state = DUP_UI::GetViewStateArray();
$ui_css_srv_panel = isset($view_state['dup-settings-diag-srv-panel']) && $view_state['dup-settings-diag-srv-panel'] ? 'display:block' : 'display:none';
$ui_css_opts_panel = isset($view_state['dup-settings-diag-opts-panel']) && $view_state['dup-settings-diag-opts-panel'] ? 'display:block' : 'display:none';
//POST BACK
$action_updated = null;
if (isset($_POST['action'])) {
    $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
    switch ($_POST['action']) {
        case 'duplicator_settings':
 /**
  *  Saves the active options associted with the active(latest) package.
  *  @param $_POST $post The Post server object
  *  @see DUP_Package::GetActive
  *  @return void */
 public function SaveActive($post = null)
 {
     global $wp_version;
     if (isset($post)) {
         $post = stripslashes_deep($post);
         $name_chars = array(".", "-");
         $name = isset($post['package-name']) && !empty($post['package-name']) ? $post['package-name'] : self::GetDefaultName();
         $name = substr(sanitize_file_name($name), 0, 40);
         $name = str_replace($name_chars, '', $name);
         $filter_dirs = isset($post['filter-dirs']) ? $this->parseDirectoryFilter($post['filter-dirs']) : '';
         $filter_exts = isset($post['filter-exts']) ? $this->parseExtensionFilter($post['filter-exts']) : '';
         $tablelist = isset($post['dbtables']) ? implode(',', $post['dbtables']) : '';
         $compatlist = isset($post['dbcompat']) ? implode(',', $post['dbcompat']) : '';
         $dbversion = preg_replace('/[^0-9.].*/', '', DUP_Util::MysqlVariableValue('version'));
         $dbversion = is_null($dbversion) ? '- unknown -' : $dbversion;
         //PACKAGE
         $this->Created = date("Y-m-d H:i:s");
         $this->Version = DUPLICATOR_VERSION;
         $this->VersionOS = defined('PHP_OS') ? PHP_OS : 'unknown';
         $this->VersionWP = $wp_version;
         $this->VersionPHP = phpversion();
         $this->VersionDB = $dbversion;
         $this->Name = $name;
         $this->Hash = $this->MakeHash();
         $this->NameHash = "{$this->Name}_{$this->Hash}";
         $this->Notes = esc_html($post['package-notes']);
         //ARCHIVE
         $this->Archive->PackDir = rtrim(DUPLICATOR_WPROOTPATH, '/');
         $this->Archive->Format = 'ZIP';
         $this->Archive->FilterOn = isset($post['filter-on']) ? 1 : 0;
         $this->Archive->FilterDirs = esc_html($filter_dirs);
         $this->Archive->FilterExts = str_replace(array('.', ' '), "", esc_html($filter_exts));
         //INSTALLER
         $this->Installer->OptsDBHost = esc_html($post['dbhost']);
         $this->Installer->OptsDBPort = esc_html($post['dbport']);
         $this->Installer->OptsDBName = esc_html($post['dbname']);
         $this->Installer->OptsDBUser = esc_html($post['dbuser']);
         $this->Installer->OptsSSLAdmin = isset($post['ssl-admin']) ? 1 : 0;
         $this->Installer->OptsSSLLogin = isset($post['ssl-login']) ? 1 : 0;
         $this->Installer->OptsCacheWP = isset($post['cache-wp']) ? 1 : 0;
         $this->Installer->OptsCachePath = isset($post['cache-path']) ? 1 : 0;
         $this->Installer->OptsURLNew = esc_html($post['url-new']);
         //DATABASE
         $this->Database->FilterOn = isset($post['dbfilter-on']) ? 1 : 0;
         $this->Database->FilterTables = esc_html($tablelist);
         $this->Database->Compatible = $compatlist;
         update_option(self::OPT_ACTIVE, $this);
     }
 }