/**
  *  createFromTemplate
  *  Generates the final installer file from the template file
  */
 private function createFromTemplate($template)
 {
     global $wpdb;
     DUP_Log::Info("INSTALLER FILE: Preping for use");
     $installer = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP) . "/{$this->Package->NameHash}_installer.php";
     //$tablePrefix = (is_multisite()) ? $wpdb->get_blog_prefix() : $wpdb->prefix;
     //Option values to delete at install time
     $deleteOpts = $GLOBALS['DUPLICATOR_OPTS_DELETE'];
     $replace_items = array("fwrite_url_old" => get_option('siteurl'), "fwrite_package_name" => "{$this->Package->NameHash}_archive.zip", "fwrite_package_notes" => $this->Package->Notes, "fwrite_secure_name" => $this->Package->NameHash, "fwrite_url_new" => $this->Package->Installer->OptsURLNew, "fwrite_dbhost" => $this->Package->Installer->OptsDBHost, "fwrite_dbname" => $this->Package->Installer->OptsDBName, "fwrite_dbuser" => $this->Package->Installer->OptsDBUser, "fwrite_dbpass" => '', "fwrite_ssl_admin" => $this->Package->Installer->OptsSSLAdmin, "fwrite_ssl_login" => $this->Package->Installer->OptsSSLLogin, "fwrite_cache_wp" => $this->Package->Installer->OptsCacheWP, "fwrite_cache_path" => $this->Package->Installer->OptsCachePath, "fwrite_wp_tableprefix" => $wpdb->prefix, "fwrite_opts_delete" => json_encode($deleteOpts), "fwrite_blogname" => esc_html(get_option('blogname')), "fwrite_wproot" => DUPLICATOR_WPROOTPATH, "fwrite_duplicator_version" => DUPLICATOR_VERSION);
     if (file_exists($template) && is_readable($template)) {
         $err_msg = "ERROR: Unable to read/write installer. \nERROR INFO: Check permission/owner on file and parent folder.\nInstaller File = <{$installer}>";
         $install_str = $this->parseTemplate($template, $replace_items);
         empty($install_str) ? DUP_Log::Error("{$err_msg}", "DUP_Installer::createFromTemplate => file-empty-read") : DUP_Log::Info("INSTALLER FILE: Template parsed with new data");
         //INSTALLER FILE
         $fp = !file_exists($installer) ? fopen($installer, 'x+') : fopen($installer, 'w');
         if (!$fp || !fwrite($fp, $install_str, strlen($install_str))) {
             DUP_Log::Error("{$err_msg}", "DUP_Installer::createFromTemplate => file-write-error");
         }
         @fclose($fp);
     } else {
         DUP_Log::Error("Installer Template missing or unreadable.", "Template [{$template}]");
     }
     @unlink($template);
     DUP_Log::Info("INSTALLER FILE: Complete [{$installer}]");
 }
Exemple #2
0
 function duplicator_activate()
 {
     global $wpdb;
     $table_name = $wpdb->prefix . "duplicator_packages";
     //PRIMARY KEY must have 2 spaces before for dbDelta to work
     $sql = "CREATE TABLE `{$table_name}` (\r\n\t\t\t`id`\t\tBIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT  PRIMARY KEY,\r\n\t\t\t`name`\t\tVARCHAR(250)\tNOT NULL,\r\n\t\t\t`hash`\t\tVARCHAR(50)\t\tNOT NULL,\r\n\t\t\t`status`\tINT(11)\t\t\tNOT NULL,\r\n\t\t\t`created`\tDATETIME\t\tNOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t`owner`\t\tVARCHAR(60)\t\tNOT NULL,\r\n\t\t\t`package`\tMEDIUMBLOB\t\tNOT NULL )";
     require_once DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php';
     @dbDelta($sql);
     //WordPress Options Hooks
     update_option('duplicator_version_plugin', DUPLICATOR_VERSION);
     //Setup All Directories
     DUP_Util::InitSnapshotDirectory();
 }
Exemple #3
0
 /** 
  * Saves the state of a UI element via post params
  * @return json result string
  * <code>
  * //JavaScript Ajax Request
  * Duplicator.UI.SaveViewStateByPost('dup-pack-archive-panel', 1);
  * 
  * //Call PHP Code
  * $view_state       = DUP_UI::GetViewStateValue('dup-pack-archive-panel');
  * $ui_css_archive   = ($view_state == 1)   ? 'display:block' : 'display:none';
  * </code>
  */
 public static function SaveViewStateByPost()
 {
     DUP_Util::CheckPermissions('read');
     $post = stripslashes_deep($_POST);
     $key = esc_html($post['key']);
     $value = esc_html($post['value']);
     $success = self::SaveViewState($key, $value);
     //Show Results as JSON
     $json = array();
     $json['key'] = $key;
     $json['value'] = $value;
     $json['update-success'] = $success;
     die(json_encode($json));
 }
Exemple #4
0
 function duplicator_activate()
 {
     global $wpdb;
     //Only update database on version update
     if (DUPLICATOR_VERSION != get_option("duplicator_version_plugin")) {
         $table_name = $wpdb->prefix . "duplicator_packages";
         //PRIMARY KEY must have 2 spaces before for dbDelta to work
         //see: https://codex.wordpress.org/Creating_Tables_with_Plugins
         $sql = "CREATE TABLE `{$table_name}` (\n\t\t\t   id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t   name VARCHAR(250) NOT NULL,\n\t\t\t   hash VARCHAR(50) NOT NULL,\n\t\t\t   status INT(11) NOT NULL,\n\t\t\t   created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t   owner VARCHAR(60) NOT NULL,\n\t\t\t   package MEDIUMBLOB NOT NULL,\n\t\t\t   PRIMARY KEY  (id),\n\t\t\t   KEY hash (hash))";
         require_once DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php';
         @dbDelta($sql);
     }
     //WordPress Options Hooks
     update_option('duplicator_version_plugin', DUPLICATOR_VERSION);
     //Setup All Directories
     DUP_Util::InitSnapshotDirectory();
 }
 /** 
  * Gets the system checks which are not required
  * @return array   An array of system checks
  */
 public static function GetChecks()
 {
     $checks = array();
     //CHK-SRV-100: PHP SETTINGS
     $php_test1 = ini_get("open_basedir");
     $php_test1 = empty($php_test1) ? true : false;
     $php_test2 = ini_get("max_execution_time");
     $php_test2 = $php_test2 > DUPLICATOR_SCAN_TIMEOUT || strcmp($php_test2, 'Off') == 0 || $php_test2 == 0 ? 'Good' : 'Warn';
     $checks['CHK-SRV-100'] = $php_test1 && $php_test2 ? 'Good' : 'Warn';
     //CHK-SRV-101: WORDPRESS SETTINGS
     //Version
     global $wp_version;
     $version_test = version_compare($wp_version, DUPLICATOR_SCAN_MIN_WP) >= 0 ? true : false;
     //Cache
     $Package = DUP_Package::GetActive();
     $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
     $dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
     $dirSize = DUP_Util::GetDirectorySize($cache_path);
     $cach_filtered = in_array($cache_path, explode(';', $Package->Archive->FilterDirs));
     $cache_test = $cach_filtered || $dirEmpty || $dirSize < DUPLICATOR_SCAN_CACHESIZE ? true : false;
     //Core Files
     $files = array();
     $files['wp-config.php'] = file_exists(DUP_Util::SafePath(DUPLICATOR_WPROOTPATH . '/wp-config.php'));
     $files_test = $files['wp-config.php'];
     $checks['CHK-SRV-101'] = $files_test && $cache_test && $version_test ? 'Good' : 'Warn';
     //CHK-SRV-102: WEB SERVER
     $servers = $GLOBALS['DUPLICATOR_SERVER_LIST'];
     $test = false;
     foreach ($servers as $value) {
         if (stristr($_SERVER['SERVER_SOFTWARE'], $value)) {
             $test = true;
             break;
         }
     }
     $checks['CHK-SRV-102'] = $test ? 'Good' : 'Warn';
     //RESULTS
     $result = in_array('Warn', $checks);
     $checks['Success'] = !$result;
     return $checks;
 }
Exemple #6
0
<?php

require_once DUPLICATOR_PLUGIN_PATH . 'classes/package.php';
global $wpdb;
//POST BACK
$action_updated = null;
if (isset($_POST['action'])) {
    $action_result = DUP_Settings::DeleteWPOption($_POST['action']);
    switch ($_POST['action']) {
        case 'duplicator_package_active':
            $action_response = __('Package settings have been reset.', 'duplicator');
            break;
    }
}
DUP_Util::InitSnapshotDirectory();
$Package = DUP_Package::GetActive();
$package_hash = $Package->MakeHash();
$dup_tests = array();
$dup_tests = DUP_Server::GetRequirements();
$default_name = DUP_Package::GetDefaultName();
$view_state = DUP_UI::GetViewStateArray();
$ui_css_storage = isset($view_state['dup-pack-storage-panel']) && $view_state['dup-pack-storage-panel'] ? 'display:block' : 'display:none';
$ui_css_archive = isset($view_state['dup-pack-archive-panel']) && $view_state['dup-pack-archive-panel'] ? 'display:block' : 'display:none';
$ui_css_installer = isset($view_state['dup-pack-installer-panel']) && $view_state['dup-pack-installer-panel'] ? 'display:block' : 'display:none';
$dup_intaller_files = implode(", ", array_keys(DUP_Server::GetInstallerFiles()));
$dbbuild_mode = DUP_Settings::Get('package_mysqldump') && DUP_Database::GetMySqlDumpPath() ? 'mysqldump' : 'PHP';
?>

<style>
    /* -----------------------------
    REQUIREMENTS*/
Exemple #7
0
:</td>
			<td><?php 
echo strlen($package->Installer->OptsURLNew) ? $package->Installer->OptsURLNew : DUP_Util::__("- not set -");
?>
</td>
		</tr>
	</table>
</div>
</div>

<?php 
if ($debug_on) {
    ?>
	<div style="margin:0">
		<a href="javascript:void(0)" onclick="jQuery(this).parent().find('.dup-pack-debug').toggle()">[<?php 
    DUP_Util::_e("View Package Object");
    ?>
]</a><br/>
		<pre class="dup-pack-debug" style="display:none"><?php 
    @print_r($package);
    ?>
 </pre>
	</div>
<?php 
}
?>
	


<script type="text/javascript">
jQuery(document).ready(function ($) 
 private function dirsToArray_New($path)
 {
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
     $files = iterator_to_array($iterator);
     $items = array();
     foreach ($files as $file) {
         if ($file->isDir()) {
             $items[] = DUP_Util::SafePath($file->getRealPath());
         }
     }
     return $items;
 }
 private function getFiles()
 {
     foreach ($this->Dirs as $key => $val) {
         $files = DUP_Util::ListFiles($val);
         foreach ($files as $filePath) {
             $fileName = basename($filePath);
             if (!is_dir($filePath)) {
                 if (!in_array(@pathinfo($filePath, PATHINFO_EXTENSION), $this->FilterExtsAll)) {
                     //Unreadable
                     if (!is_readable($filePath)) {
                         $this->FilterInfo->Files->Unreadable[] = $filePath;
                         continue;
                     }
                     $fileSize = @filesize($filePath);
                     $fileSize = empty($fileSize) ? 0 : $fileSize;
                     $invalid_test = strlen($filePath) > 250 || preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $fileName) || trim($fileName) == "";
                     if ($invalid_test || preg_match('/[^\\x20-\\x7f]/', $fileName)) {
                         $this->FilterInfo->Files->Warning[] = DUP_Encoding::toUTF8($filePath);
                     } else {
                         $this->Size += $fileSize;
                         $this->Files[] = $filePath;
                     }
                     if ($fileSize > DUPLICATOR_SCAN_WARNFILESIZE) {
                         $this->FilterInfo->Files->Size[] = $filePath . ' [' . DUP_Util::ByteSize($fileSize) . ']';
                     }
                 }
             }
         }
     }
 }
Exemple #10
0
<?php

DUP_Util::CheckPermissions('manage_options');
global $wpdb;
//COMMON HEADER DISPLAY
require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'general';
?>

<style>

</style>

<div class="wrap">
	
    <?php 
duplicator_header(__("Settings", 'wpduplicator'));
?>

    <!--h2 class="nav-tab-wrapper">  
        <a href="?page=duplicator-settings&tab=general" class="nav-tab <?php 
echo $current_tab == 'general' ? 'nav-tab-active' : '';
?>
"> <?php 
_e('General', 'wpduplicator');
?>
</a>  
    </h2--> 	

    <?php 
Exemple #11
0
?>
</td>
			 </tr>
			 <tr valign="top">
				 <td><?php 
_e('Free space', 'hyper-cache');
?>
</td>
				 <td><?php 
echo $perc;
?>
% -- <?php 
echo DUP_Util::ByteSize($space_free);
?>
 from <?php 
echo DUP_Util::ByteSize($space);
?>
<br/>
					  <small>
						  <?php 
_e("Note: This value is the physical servers hard-drive allocation.", 'wpduplicator');
?>
 <br/>
						  <?php 
_e("On shared hosts check your control panel for the 'TRUE' disk space quota value.", 'wpduplicator');
?>
					  </small>
				 </td>
			 </tr>	

		</table><br/>
 /**
  *  Creates the snapshot directory if it doesn't already exisit
  */
 public static function InitSnapshotDirectory()
 {
     $path_wproot = DUP_Util::SafePath(DUPLICATOR_WPROOTPATH);
     $path_ssdir = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH);
     $path_plugin = DUP_Util::SafePath(DUPLICATOR_PLUGIN_PATH);
     //--------------------------------
     //CHMOD DIRECTORY ACCESS
     //wordpress root directory
     @chmod($path_wproot, 0755);
     //snapshot directory
     @mkdir($path_ssdir, 0755);
     @chmod($path_ssdir, 0755);
     //snapshot tmp directory
     $path_ssdir_tmp = $path_ssdir . '/tmp';
     @mkdir($path_ssdir_tmp, 0755);
     @chmod($path_ssdir_tmp, 0755);
     //plugins dir/files
     @chmod($path_plugin . 'files', 0755);
     //--------------------------------
     //FILE CREATION
     //SSDIR: Create Index File
     $ssfile = @fopen($path_ssdir . '/index.php', 'w');
     @fwrite($ssfile, '<?php error_reporting(0);  if (stristr(php_sapi_name(), "fcgi")) { $url  =  "http://" . $_SERVER["HTTP_HOST"]; header("Location: {$url}/404.html");} else { header("HTTP/1.1 404 Not Found", true, 404);} exit(); ?>');
     @fclose($ssfile);
     //SSDIR: Create token file in snapshot
     $tokenfile = @fopen($path_ssdir . '/dtoken.php', 'w');
     @fwrite($tokenfile, '<?php error_reporting(0);  if (stristr(php_sapi_name(), "fcgi")) { $url  =  "http://" . $_SERVER["HTTP_HOST"]; header("Location: {$url}/404.html");} else { header("HTTP/1.1 404 Not Found", true, 404);} exit(); ?>');
     @fclose($tokenfile);
     //SSDIR: Create .htaccess
     $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
     if ($storage_htaccess_off) {
         @unlink($path_ssdir . '/.htaccess');
     } else {
         $htfile = @fopen($path_ssdir . '/.htaccess', 'w');
         $htoutput = "Options -Indexes";
         @fwrite($htfile, $htoutput);
         @fclose($htfile);
     }
     //SSDIR: Robots.txt file
     $robotfile = @fopen($path_ssdir . '/robots.txt', 'w');
     @fwrite($robotfile, "User-agent: * \nDisallow: /" . DUPLICATOR_SSDIR_NAME . '/');
     @fclose($robotfile);
     //PLUG DIR: Create token file in plugin
     $tokenfile2 = @fopen($path_plugin . 'installer/dtoken.php', 'w');
     @fwrite($tokenfile2, '<?php @error_reporting(0); @require_once("../../../../wp-admin/admin.php"); global $wp_query; $wp_query->set_404(); header("HTTP/1.1 404 Not Found", true, 404); header("Status: 404 Not Found"); @include(get_template_directory () . "/404.php"); ?>');
     @fclose($tokenfile2);
 }
 /**
  *  CREATE
  *  Creates the zip file and adds the SQL file to the archive
  */
 public static function Create(DUP_Archive $archive)
 {
     try {
         $timerAllStart = DUP_Util::GetMicrotime();
         $package_zip_flush = DUP_Settings::Get('package_zip_flush');
         self::$compressDir = rtrim(DUP_Util::SafePath($archive->PackDir), '/');
         self::$sqlPath = DUP_Util::SafePath("{$archive->Package->StorePath}/{$archive->Package->Database->File}");
         self::$zipPath = DUP_Util::SafePath("{$archive->Package->StorePath}/{$archive->File}");
         self::$zipArchive = new ZipArchive();
         self::$networkFlush = empty($package_zip_flush) ? false : $package_zip_flush;
         $filterDirs = empty($archive->FilterDirs) ? 'not set' : $archive->FilterDirs;
         $filterExts = empty($archive->FilterExts) ? 'not set' : $archive->FilterExts;
         $filterOn = $archive->FilterOn ? 'ON' : 'OFF';
         //LOAD SCAN REPORT
         $json = file_get_contents(DUPLICATOR_SSDIR_PATH_TMP . "/{$archive->Package->NameHash}_scan.json");
         self::$scanReport = json_decode($json);
         DUP_Log::Info("\n********************************************************************************");
         DUP_Log::Info("ARCHIVE (ZIP):");
         DUP_Log::Info("********************************************************************************");
         $isZipOpen = self::$zipArchive->open(self::$zipPath, ZIPARCHIVE::CREATE) === TRUE;
         if (!$isZipOpen) {
             DUP_Log::Error("Cannot open zip file with PHP ZipArchive.", "Path location [" . self::$zipPath . "]");
         }
         DUP_Log::Info("ARCHIVE DIR:  " . self::$compressDir);
         DUP_Log::Info("ARCHIVE FILE: " . basename(self::$zipPath));
         DUP_Log::Info("FILTERS: *{$filterOn}*");
         DUP_Log::Info("DIRS:  {$filterDirs}");
         DUP_Log::Info("EXTS:  {$filterExts}");
         DUP_Log::Info("----------------------------------------");
         DUP_Log::Info("COMPRESSING");
         DUP_Log::Info("SIZE:\t" . self::$scanReport->ARC->Size);
         DUP_Log::Info("STATS:\tDirs " . self::$scanReport->ARC->DirCount . " | Files " . self::$scanReport->ARC->FileCount);
         //ADD SQL
         $isSQLInZip = self::$zipArchive->addFile(self::$sqlPath, "database.sql");
         if ($isSQLInZip) {
             DUP_Log::Info("SQL ADDED: " . basename(self::$sqlPath));
         } else {
             DUP_Log::Error("Unable to add database.sql to archive.", "SQL File Path [" . self::$sqlath . "]");
         }
         self::$zipArchive->close();
         self::$zipArchive->open(self::$zipPath, ZipArchive::CREATE);
         //ZIP DIRECTORIES
         foreach (self::$scanReport->ARC->Dirs as $dir) {
             if (self::$zipArchive->addEmptyDir(ltrim(str_replace(self::$compressDir, '', $dir), '/'))) {
                 self::$countDirs++;
             } else {
                 //Don't warn when dirtory is the root path
                 if (strcmp($dir, rtrim(self::$compressDir, '/')) != 0) {
                     DUP_Log::Info("WARNING: Unable to zip directory: '{$dir}'" . rtrim(self::$compressDir, '/'));
                 }
             }
         }
         /* ZIP FILES: Network Flush
          *  This allows the process to not timeout on fcgi 
          *  setups that need a response every X seconds */
         if (self::$networkFlush) {
             foreach (self::$scanReport->ARC->Files as $file) {
                 if (self::$zipArchive->addFile($file, ltrim(str_replace(self::$compressDir, '', $file), '/'))) {
                     self::$limitItems++;
                     self::$countFiles++;
                 } else {
                     DUP_Log::Info("WARNING: Unable to zip file: {$file}");
                 }
                 //Trigger a flush to the web server after so many files have been loaded.
                 if (self::$limitItems > DUPLICATOR_ZIP_FLUSH_TRIGGER) {
                     $sumItems = self::$countDirs + self::$countFiles;
                     self::$zipArchive->close();
                     self::$zipArchive->open(self::$zipPath);
                     self::$limitItems = 0;
                     DUP_Util::FcgiFlush();
                     DUP_Log::Info("Items archived [{$sumItems}] flushing response.");
                 }
             }
             //Normal
         } else {
             foreach (self::$scanReport->ARC->Files as $file) {
                 if (self::$zipArchive->addFile($file, ltrim(str_replace(self::$compressDir, '', $file), '/'))) {
                     self::$countFiles++;
                 } else {
                     DUP_Log::Info("WARNING: Unable to zip file: {$file}");
                 }
             }
         }
         DUP_Log::Info(print_r(self::$zipArchive, true));
         //--------------------------------
         //LOG FINAL RESULTS
         DUP_Util::FcgiFlush();
         $zipCloseResult = self::$zipArchive->close();
         $zipCloseResult ? DUP_Log::Info("COMPRESSION RESULT: '{$zipCloseResult}'") : DUP_Log::Error("ZipArchive close failure.", "This hosted server may have a disk quota limit.\nCheck to make sure this archive file can be stored.");
         $timerAllEnd = DUP_Util::GetMicrotime();
         $timerAllSum = DUP_Util::ElapsedTime($timerAllEnd, $timerAllStart);
         self::$zipFileSize = @filesize(self::$zipPath);
         DUP_Log::Info("COMPRESSED SIZE: " . DUP_Util::ByteSize(self::$zipFileSize));
         DUP_Log::Info("ARCHIVE RUNTIME: {$timerAllSum}");
         DUP_Log::Info("MEMORY STACK: " . DUP_Server::GetPHPMemory());
     } catch (Exception $e) {
         DUP_Log::Error("Runtime error in package.archive.zip.php constructor.", "Exception: {$e}");
     }
 }
Exemple #14
0
<?php

DUP_Util::CheckPermissions('read');
require_once DUPLICATOR_PLUGIN_PATH . '/assets/js/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
?>
<style>
    div.dup-support-all {font-size:13px; line-height:20px}
    div.dup-support-txts-links {width:100%;font-size:14px; font-weight:bold; line-height:26px; text-align:center}
    div.dup-support-hlp-area {width:375px; height:160px; float:left; border:1px solid #dfdfdf; border-radius:4px; margin:10px; line-height:18px;box-shadow: 0 8px 6px -6px #ccc;}
    table.dup-support-hlp-hdrs {border-collapse:collapse; width:100%; border-bottom:1px solid #dfdfdf}
    table.dup-support-hlp-hdrs {background-color:#efefef;}
    div.dup-support-hlp-hdrs {
        font-weight:bold; font-size:17px; height: 35px; padding:5px 5px 5px 10px;
        background-image:-ms-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
        background-image:-moz-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
        background-image:-o-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
        background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #FFFFFF), color-stop(1, #DEDEDE));
        background-image:-webkit-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
        background-image:linear-gradient(to bottom, #FFFFFF 0%, #DEDEDE 100%);
    }
    div.dup-support-hlp-hdrs div {padding:5px; margin:4px 20px 0px -20px;  text-align: center;}
    div.dup-support-hlp-txt{padding:10px 4px 4px 4px; text-align:center}
</style>


<div class="wrap dup-wrap dup-support-all">
	
    <?php 
duplicator_header(__("Help", 'duplicator'));
?>
 private function phpDump()
 {
     global $wpdb;
     $wpdb->query("SET session wait_timeout = " . DUPLICATOR_DB_MAX_TIME);
     $handle = fopen($this->dbStorePath, 'w+');
     $tables = $wpdb->get_col('SHOW TABLES');
     $filterTables = isset($this->FilterTables) ? explode(',', $this->FilterTables) : null;
     $tblAllCount = count($tables);
     $tblFilterOn = $this->FilterOn ? 'ON' : 'OFF';
     $qryLimit = DUP_Settings::Get('package_phpdump_qrylimit');
     if (is_array($filterTables) && $this->FilterOn) {
         foreach ($tables as $key => $val) {
             if (in_array($tables[$key], $filterTables)) {
                 unset($tables[$key]);
             }
         }
     }
     $tblCreateCount = count($tables);
     $tblFilterCount = $tblAllCount - $tblCreateCount;
     DUP_Log::Info("TABLES: total:{$tblAllCount} | filtered:{$tblFilterCount} | create:{$tblCreateCount}");
     DUP_Log::Info("FILTERED: [{$this->FilterTables}]");
     $sql_header = "/* DUPLICATOR MYSQL SCRIPT CREATED ON : " . @date("Y-m-d H:i:s") . " */\n\n";
     $sql_header .= "SET FOREIGN_KEY_CHECKS = 0;\n\n";
     fwrite($handle, $sql_header);
     //BUILD CREATES:
     //All creates must be created before inserts do to foreign key constraints
     foreach ($tables as $table) {
         //$sql_del = ($GLOBALS['duplicator_opts']['dbadd_drop']) ? "DROP TABLE IF EXISTS {$table};\n\n" : "";
         //@fwrite($handle, $sql_del);
         $create = $wpdb->get_row("SHOW CREATE TABLE `{$table}`", ARRAY_N);
         @fwrite($handle, "{$create[1]};\n\n");
     }
     //BUILD INSERTS:
     //Create Insert in 100 row increments to better handle memory
     foreach ($tables as $table) {
         $row_count = $wpdb->get_var("SELECT Count(*) FROM `{$table}`");
         //DUP_Log::Info("{$table} ({$row_count})");
         if ($row_count > $qryLimit) {
             $row_count = ceil($row_count / $qryLimit);
         } else {
             if ($row_count > 0) {
                 $row_count = 1;
             }
         }
         if ($row_count >= 1) {
             fwrite($handle, "\n/* INSERT TABLE DATA: {$table} */\n");
         }
         for ($i = 0; $i < $row_count; $i++) {
             $sql = "";
             $limit = $i * $qryLimit;
             $query = "SELECT * FROM `{$table}` LIMIT {$limit}, {$qryLimit}";
             $rows = $wpdb->get_results($query, ARRAY_A);
             if (is_array($rows)) {
                 foreach ($rows as $row) {
                     $sql .= "INSERT INTO `{$table}` VALUES(";
                     $num_values = count($row);
                     $num_counter = 1;
                     foreach ($row as $value) {
                         if (is_null($value) || !isset($value)) {
                             $num_values == $num_counter ? $sql .= 'NULL' : ($sql .= 'NULL, ');
                         } else {
                             $num_values == $num_counter ? $sql .= '"' . @esc_sql($value) . '"' : ($sql .= '"' . @esc_sql($value) . '", ');
                         }
                         $num_counter++;
                     }
                     $sql .= ");\n";
                 }
                 fwrite($handle, $sql);
             }
         }
         //Flush buffer if enabled
         if ($this->networkFlush) {
             DUP_Util::FcgiFlush();
         }
         $sql = null;
         $rows = null;
     }
     $sql_footer = "\nSET FOREIGN_KEY_CHECKS = 1; \n\n";
     $sql_footer .= "/* Duplicator WordPress Timestamp: " . date("Y-m-d H:i:s") . "*/\n";
     $sql_footer .= "/* " . DUPLICATOR_DB_EOF_MARKER . " */\n";
     fwrite($handle, $sql_footer);
     $wpdb->flush();
     fclose($handle);
 }
Exemple #16
0
<?php

require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$logs = glob(DUPLICATOR_SSDIR_PATH . '/*.log');
if ($logs != false && count($logs)) {
    usort($logs, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
    @chmod(DUP_Util::SafePath($logs[0]), 0644);
}
$logname = isset($_GET['logname']) ? trim($_GET['logname']) : "";
$refresh = isset($_POST['refresh']) && $_POST['refresh'] == 1 ? 1 : 0;
$auto = isset($_POST['auto']) && $_POST['auto'] == 1 ? 1 : 0;
//Check for invalid file
if (isset($_GET['logname'])) {
    $validFiles = array_map('basename', $logs);
    if (validate_file($logname, $validFiles) > 0) {
        unset($logname);
    }
    unset($validFiles);
}
if (!isset($logname) || !$logname) {
    $logname = count($logs) > 0 ? basename($logs[0]) : "";
}
$logurl = get_site_url(null, '', is_ssl() ? 'https' : 'http') . '/' . DUPLICATOR_SSDIR_NAME . '/' . $logname;
$logfound = strlen($logname) > 0 ? true : false;
?>

<style>
	div#dup-refresh-count {display: inline-block}
	table#dup-log-panels {width:100%; }
	td#dup-log-panel-left {width:75%;}
Exemple #17
0
						<?php 
foreach ($phpdump_chunkopts as $value) {
    $selected = $package_phpdump_qrylimit == $value ? "selected='selected'" : '';
    echo "<option {$selected} value='{$value}'>" . number_format($value) . '</option>';
}
?>
					</select>
					 <i style="font-size:12px">(<?php 
_e("higher values speed up build times but uses more memory", 'wpduplicator');
?>
)</i> 
					
				</div><br/>

                <?php 
if (!DUP_Util::IsShellExecAvailable()) {
    ?>
                    <p class="description">
                        <?php 
    _e("This server does not have shell_exec configured to run.", 'wpduplicator');
    echo '<br/>';
    _e("Please contact the server administrator to enable this feature.", 'wpduplicator');
    ?>
                    </p>
                <?php 
} else {
    ?>
                    <input type="radio" name="package_dbmode" value="mysql" id="package_mysqldump" <?php 
    echo $package_mysqldump ? 'checked="checked"' : '';
    ?>
 />
Exemple #18
0
 /** 
  * Get PHP memory useage 
  * @return string   Returns human readable memory useage.
  */
 public static function GetPHPMemory($peak = false)
 {
     if ($peak) {
         $result = 'Unable to read PHP peak memory usage';
         if (function_exists('memory_get_peak_usage')) {
             $result = DUP_Util::ByteSize(memory_get_peak_usage(true));
         }
     } else {
         $result = 'Unable to read PHP memory usage';
         if (function_exists('memory_get_usage')) {
             $result = DUP_Util::ByteSize(memory_get_usage(true));
         }
     }
     return $result;
 }
Exemple #19
0
<?php

DUP_Util::CheckPermissions('export');
global $wpdb;
//COMMON HEADER DISPLAY
require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'list';
?>

<style>
	//TOOLBAR TABLE
	table#dup-toolbar td {padding:0px; white-space:nowrap;}
	table#dup-toolbar td.dup-toolbar-btns {width:100%; text-align: right; vertical-align: bottom}
	table#dup-toolbar td.dup-toolbar-btns a {font-size:16px}
	table#dup-toolbar td.dup-toolbar-btns span {font-size:16px; font-weight: bold}
	table#dup-toolbar {width:100%; border:0px solid red; padding: 0; margin:0 0 10px 0; height: 35px}
	
    /*WIZARD TABS */
    div#dup-wiz {padding:0px; margin:0;  }
    div#dup-wiz-steps {margin:10px 0px 0px 10px; padding:0px;  clear:both; font-size:12px; min-width:350px;}
    div#dup-wiz-title {padding:2px 0px 0px 0px; font-size:18px;}
	div#dup-wiz-steps a span {font-size:10px}
    /* wiz-steps numbers */
    #dup-wiz span {display:block;float:left; text-align:center; width:14px; margin:4px 5px 0px 0px; line-height:13px; color:#ccc; border:1px solid #CCCCCC; border-radius:5px; }
    /* wiz-steps default*/
    #dup-wiz a { position:relative; display:block; width:auto; min-width:55px; height:25px; margin-right:8px; padding:0px 10px 0px 10px; float:left; line-height:24px; color:#000; background:#E4E4E4; border-radius:5px }
	/* wiz-steps active*/
    #dup-wiz .active-step a {color:#fff; background:#BBBBBB;}
    #dup-wiz .active-step span {color:#fff; border:1px solid #fff;}
	/* wiz-steps completed */
Exemple #20
0
 /**
  *  DUPLICATOR_MENU
  *  Loads the menu item into the WP tools section and queues the actions for only this plugin */
 function duplicator_menu()
 {
     $wpfront_caps_translator = 'wpfront_user_role_editor_duplicator_translate_capability';
     //Main Menu
     $perms = 'export';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $main_menu = add_menu_page('Duplicator Plugin', 'Duplicator', $perms, 'duplicator', 'duplicator_get_menu', plugins_url('duplicator/assets/img/create.png'));
     $perms = 'export';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_packages = add_submenu_page('duplicator', DUP_Util::__('Packages'), DUP_Util::__('Packages'), $perms, 'duplicator', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_settings = add_submenu_page('duplicator', DUP_Util::__('Settings'), DUP_Util::__('Settings'), $perms, 'duplicator-settings', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_tools = add_submenu_page('duplicator', DUP_Util::__('Tools'), DUP_Util::__('Tools'), $perms, 'duplicator-tools', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_help = add_submenu_page('duplicator', DUP_Util::__('Help'), DUP_Util::__('Help'), $perms, 'duplicator-help', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_about = add_submenu_page('duplicator', DUP_Util::__('About'), DUP_Util::__('About'), $perms, 'duplicator-about', 'duplicator_get_menu');
     $perms = 'manage_options';
     $go_pro_link = '<span style="color:#f18500">' . DUP_Util::__('Go Pro!') . '</span>';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_gopro = add_submenu_page('duplicator', $go_pro_link, $go_pro_link, $perms, 'duplicator-gopro', 'duplicator_get_menu');
     //Apply Scripts
     add_action('admin_print_scripts-' . $page_packages, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_settings, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_help, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_tools, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_about, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_gopro, 'duplicator_scripts');
     //Apply Styles
     add_action('admin_print_styles-' . $page_packages, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_settings, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_help, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_tools, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_about, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_gopro, 'duplicator_styles');
 }
Exemple #21
0
// If uninstall not called from WordPress, then exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
require_once 'define.php';
require_once 'classes/settings.php';
require_once 'classes/utility.php';
global $wpdb;
$DUP_Settings = new DUP_Settings();
$table_name = $wpdb->prefix . "duplicator_packages";
$wpdb->query("DROP TABLE `{$table_name}`");
delete_option('duplicator_version_plugin');
//Remvoe entire wp-snapshots directory
if (DUP_Settings::Get('uninstall_files')) {
    $ssdir = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH);
    $ssdir_tmp = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP);
    //Sanity check for strange setup
    $check = glob("{$ssdir}/wp-config.php");
    if (count($check) == 0) {
        //PHP sanity check
        foreach (glob("{$ssdir}/*_database.sql") as $file) {
            if (strstr($file, '_database.sql')) {
                @unlink("{$file}");
            }
        }
        foreach (glob("{$ssdir}/*_installer.php") as $file) {
            if (strstr($file, '_installer.php')) {
                @unlink("{$file}");
            }
        }
        foreach (glob("{$ssdir}/*_archive.zip") as $file) {
Exemple #22
0
 /**
  *  DUPLICATOR_MENU
  *  Loads the menu item into the WP tools section and queues the actions for only this plugin */
 function duplicator_menu()
 {
     $wpfront_caps_translator = 'wpfront_user_role_editor_duplicator_translate_capability';
     $icon_svg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQXJ0d29yayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyMy4yNXB4IiBoZWlnaHQ9IjIyLjM3NXB4IiB2aWV3Qm94PSIwIDAgMjMuMjUgMjIuMzc1IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyMy4yNSAyMi4zNzUiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGZpbGw9IiM5Q0ExQTYiIGQ9Ik0xOC4wMTEsMS4xODhjLTEuOTk1LDAtMy42MTUsMS42MTgtMy42MTUsMy42MTRjMCwwLjA4NSwwLjAwOCwwLjE2NywwLjAxNiwwLjI1TDcuNzMzLDguMTg0QzcuMDg0LDcuNTY1LDYuMjA4LDcuMTgyLDUuMjQsNy4xODJjLTEuOTk2LDAtMy42MTUsMS42MTktMy42MTUsMy42MTRjMCwxLjk5NiwxLjYxOSwzLjYxMywzLjYxNSwzLjYxM2MwLjYyOSwwLDEuMjIyLTAuMTYyLDEuNzM3LTAuNDQ1bDIuODksMi40MzhjLTAuMTI2LDAuMzY4LTAuMTk4LDAuNzYzLTAuMTk4LDEuMTczYzAsMS45OTUsMS42MTgsMy42MTMsMy42MTQsMy42MTNjMS45OTUsMCwzLjYxNS0xLjYxOCwzLjYxNS0zLjYxM2MwLTEuOTk3LTEuNjItMy42MTQtMy42MTUtMy42MTRjLTAuNjMsMC0xLjIyMiwwLjE2Mi0xLjczNywwLjQ0M2wtMi44OS0yLjQzNWMwLjEyNi0wLjM2OCwwLjE5OC0wLjc2MywwLjE5OC0xLjE3M2MwLTAuMDg0LTAuMDA4LTAuMTY2LTAuMDEzLTAuMjVsNi42NzYtMy4xMzNjMC42NDgsMC42MTksMS41MjUsMS4wMDIsMi40OTUsMS4wMDJjMS45OTQsMCwzLjYxMy0xLjYxNywzLjYxMy0zLjYxM0MyMS42MjUsMi44MDYsMjAuMDA2LDEuMTg4LDE4LjAxMSwxLjE4OHoiLz48L3N2Zz4=';
     //Main Menu
     $perms = 'export';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $main_menu = add_menu_page('Duplicator Plugin', 'Duplicator', $perms, 'duplicator', 'duplicator_get_menu', $icon_svg);
     //$main_menu = add_menu_page('Duplicator Plugin', 'Duplicator', $perms, 'duplicator', 'duplicator_get_menu', plugins_url('duplicator/assets/img/logo-menu.svg'));
     $perms = 'export';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_packages = add_submenu_page('duplicator', DUP_Util::__('Packages'), DUP_Util::__('Packages'), $perms, 'duplicator', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_settings = add_submenu_page('duplicator', DUP_Util::__('Settings'), DUP_Util::__('Settings'), $perms, 'duplicator-settings', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_tools = add_submenu_page('duplicator', DUP_Util::__('Tools'), DUP_Util::__('Tools'), $perms, 'duplicator-tools', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_help = add_submenu_page('duplicator', DUP_Util::__('Help'), DUP_Util::__('Help'), $perms, 'duplicator-help', 'duplicator_get_menu');
     $perms = 'manage_options';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_about = add_submenu_page('duplicator', DUP_Util::__('About'), DUP_Util::__('About'), $perms, 'duplicator-about', 'duplicator_get_menu');
     $perms = 'manage_options';
     $go_pro_link = '<span style="color:#f18500">' . DUP_Util::__('Go Pro!') . '</span>';
     $perms = apply_filters($wpfront_caps_translator, $perms);
     $page_gopro = add_submenu_page('duplicator', $go_pro_link, $go_pro_link, $perms, 'duplicator-gopro', 'duplicator_get_menu');
     //Apply Scripts
     add_action('admin_print_scripts-' . $page_packages, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_settings, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_help, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_tools, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_about, 'duplicator_scripts');
     add_action('admin_print_scripts-' . $page_gopro, 'duplicator_scripts');
     //Apply Styles
     add_action('admin_print_styles-' . $page_packages, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_settings, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_help, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_tools, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_about, 'duplicator_styles');
     add_action('admin_print_styles-' . $page_gopro, 'duplicator_styles');
 }
Exemple #23
0
			<td class="check-column"><i class="fa fa-check"></i></td>
		</tr>
		<tr>
			<td class="feature-column">Manual Transfers</td>
			<td class="check-column"></td>
			<td class="check-column"><i class="fa fa-check"></i></td>
		</tr>		
		<tr>
			<td class="feature-column">Active Customer Support</td>
			<td class="check-column"></td>
			<td class="check-column"><i class="fa fa-check"></i></td>
		</tr>			
	</table>

	<br style="clear:both" />
	<p style="text-align:center">
		<a href="http://snapcreek.com/duplicator?free-go-pro" target="_blank" class="button button-primary button-large dup-check-it-btn" >
			<?php 
DUP_Util::_e('Check It Out!');
?>
		</a>
	</p>
	<br/><br/>
</div>
<br/><br/>

<script type="text/javascript">
    jQuery(document).ready(function ($) {

    });
</script>
?>
' : html;


		$('#data-arc-names-data').html(html);

		//Large Files
		html = '<?php 
DUP_Util::_e("No large files found.");
?>
';
		if (data.ARC.FilterInfo.Files.Size !== undefined && data.ARC.FilterInfo.Files.Size.length > 0) {
			html = '';
			$.each(data.ARC.FilterInfo.Files.Size, function (key, val) {
				html += '<?php 
DUP_Util::_e("FILE");
?>
 ' + key + ':<br/>' + val + '<br/>';
			});
		}
		$('#data-arc-big-data').html(html);
		$('#dup-msg-success').show();
		
		//Waring Check
		var warnCount = data.RPT.Warnings || 0;
		if (warnCount > 0) {
			$('#dup-scan-warning-continue').show();
			$('#dup-build-button').prop("disabled",true).removeClass('button-primary');
		} else {
			$('#dup-scan-warning-continue').hide();
			$('#dup-build-button').prop("disabled",false).addClass('button-primary');
Exemple #25
0
</a></td>
			<td><?php 
DUP_Util::_e("Removes all legacy data and settings prior to version");
?>
 [<?php 
echo DUPLICATOR_VERSION;
?>
].</td>
		</tr>
		<tr>
			<td><a class="button button-small dup-fixed-btn" href="javascript:void(0)" onclick="Duplicator.Tools.ClearBuildCache()"><?php 
DUP_Util::_e("Clear Build Cache");
?>
</a></td>
			<td><?php 
DUP_Util::_e("Removes all build data from:");
?>
 [<?php 
echo DUPLICATOR_SSDIR_PATH_TMP;
?>
].</td>
		</tr>	
	</table>
</form>

<script>	
jQuery(document).ready(function($) {
   Duplicator.Tools.DeleteLegacy = function () {
	   <?php 
$msg = __('This action will remove all legacy settings prior to version %1$s.  ');
$msg .= __('Legacy settings are only needed if you plan to migrate back to an older version of this plugin.');
Exemple #26
0
        }
        ?>
			<?php 
        $totalSize = $totalSize + $pack_archive_size;
        $rowCount++;
    }
    ?>
	<tfoot>
		<tr>
			<th colspan="8" style='text-align:right; font-size:12px'>						
				<?php 
    echo _e("Packages", 'wpduplicator') . ': ' . $totalElements;
    ?>
 |
				<?php 
    echo _e("Total Size", 'wpduplicator') . ': ' . DUP_Util::ByteSize($totalSize);
    ?>
 
			</th>
		</tr>
	</tfoot>
	</table>
<?php 
}
?>
	
</form>


<!--form id="dup-paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" style="display:none"> 
	<input name="cmd" type="hidden" value="_s-xclick" /> 
                        <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php 
echo rtrim(DUPLICATOR_WPROOTPATH, '/');
?>
')">[<?php 
_e("root path", 'wpduplicator');
?>
]</a>
                        <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php 
echo rtrim($upload_dir, '/');
?>
')">[<?php 
_e("wp-uploads", 'wpduplicator');
?>
]</a>
                        <a href="javascript:void(0)" onclick="Duplicator.Pack.AddExcludePath('<?php 
echo DUP_Util::SafePath(WP_CONTENT_DIR);
?>
/cache')">[<?php 
_e("cache", 'wpduplicator');
?>
]</a>
                        <a href="javascript:void(0)" onclick="jQuery('#filter-dirs').val('')"><?php 
_e("(clear)", 'wpduplicator');
?>
</a>
                    </div>
                    <textarea name="filter-dirs" id="filter-dirs" placeholder="/full_path/exclude_path1;/full_path/exclude_path2;"><?php 
echo str_replace(";", ";\n", esc_textarea($Package->Archive->FilterDirs));
?>
</textarea><br/>
                    <label class="no-select" title="<?php 
Exemple #28
0
/**
 *  DUPLICATOR_PACKAGE_DELETE
 *  Deletes the files and database record entries
 *
 *  @return json   A json message about the action.  
 *				   Use console.log to debug from client
 */
function duplicator_package_delete()
{
    DUP_Util::CheckPermissions('export');
    check_ajax_referer('package_list', 'nonce');
    try {
        global $wpdb;
        $json = array();
        $post = stripslashes_deep($_POST);
        $tblName = $wpdb->prefix . 'duplicator_packages';
        $postIDs = isset($post['duplicator_delid']) ? $post['duplicator_delid'] : null;
        $list = explode(",", $postIDs);
        $delCount = 0;
        if ($postIDs != null) {
            foreach ($list as $id) {
                $getResult = $wpdb->get_results($wpdb->prepare("SELECT name, hash FROM `{$tblName}` WHERE id = %d", $id), ARRAY_A);
                if ($getResult) {
                    $row = $getResult[0];
                    $nameHash = "{$row['name']}_{$row['hash']}";
                    $delResult = $wpdb->query($wpdb->prepare("DELETE FROM `{$tblName}` WHERE id = %d", $id));
                    if ($delResult != 0) {
                        //Perms
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"), 0644);
                        @chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"), 0644);
                        //Remove
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"));
                        @unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"));
                        //Unfinished Zip files
                        $tmpZip = DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*";
                        array_map('unlink', glob($tmpZip));
                        @unlink(DUP_Util::SafePath());
                        $delCount++;
                    }
                }
            }
        }
    } catch (Exception $e) {
        $json['error'] = "{$e}";
        die(json_encode($json));
    }
    $json['ids'] = "{$postIDs}";
    $json['removed'] = $delCount;
    die(json_encode($json));
}
Exemple #29
0
 private function parseExtensionFilter($extensions = "")
 {
     $filter_exts = "";
     if (strlen($extensions) >= 1 && $extensions != ";") {
         $filter_exts = str_replace(array(' ', '.'), '', $extensions);
         $filter_exts = str_replace(",", ";", $filter_exts);
         $filter_exts = DUP_Util::StringAppend($extensions, ";");
     }
     return $filter_exts;
 }
Exemple #30
0
				<li class="tabs"><a href="javascript:void(0)" onclick="Duplicator.Pack.ToggleOptTabs(1, this)"><?php 
_e('Files', 'wpduplicator');
?>
</a></li>
				<li><a href="javascript:void(0)"onclick="Duplicator.Pack.ToggleOptTabs(2, this)"><?php 
_e('Database', 'wpduplicator');
?>
</a></li>
			</ul>

			<!-- TAB1: PACKAGE -->
			<div class="tabs-panel" id="dup-pack-opts-tabs-panel-1">
				<!-- FILTERS -->
				<?php 
$uploads = wp_upload_dir();
$upload_dir = DUP_Util::SafePath($uploads['basedir']);
?>
				<fieldset>
					<legend><b> <i class="fa fa-filter"></i> <?php 
_e("Filters", 'wpduplicator');
?>
</b></legend>
					
					<div class="dup-enable-filters">
						<input type="checkbox" id="filter-on" name="filter-on" onclick="Duplicator.Pack.ToggleFileFilters()" <?php 
echo $Package->Archive->FilterOn ? "checked='checked'" : "";
?>
 />	
						<label for="filter-on"><?php 
_e("Enable Filters", 'wpduplicator');
?>