web/wp-content/plugins/duplicator/inc/page.main.php
changeset 195 c7c0fbc09788
child 204 09a1c134465b
equal deleted inserted replaced
194:32102edaa81b 195:c7c0fbc09788
       
     1 <?php
       
     2 	$package_name = date('Ymd') . '_' . sanitize_title(get_bloginfo( 'name', 'display' ));
       
     3 	$package_name = substr(str_replace('-', '', $package_name), 0 , 40);
       
     4 	$package_name = sanitize_file_name($package_name);
       
     5 	
       
     6 	global $wpdb;
       
     7 	$result = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}duplicator` ORDER BY id DESC", ARRAY_A);
       
     8 	$total_elements = count($result);
       
     9 	
       
    10 	//Settings
       
    11 	$email_me_enabled    = $GLOBALS['duplicator_opts']['email-me'] == "0" 	 	 ? false : true;
       
    12 	$duplicator_dbiconv	 = $GLOBALS['duplicator_opts']['dbiconv'] == "0" 		 ? false : true;
       
    13 	$rm_snapshot		 = $GLOBALS['duplicator_opts']['rm_snapshot'] == "0" 	 ? false : true;
       
    14 	
       
    15 	//INLINE DIALOG WINDOWS
       
    16 	require_once('javascript.php'); 
       
    17 	require_once('view.options.php');
       
    18 	require_once('view.system.php');
       
    19 
       
    20 ?>
       
    21 
       
    22 
       
    23 <!-- ==========================================
       
    24 MAIN FORM: Lists all the backups 			-->
       
    25 <div class="wrap">
       
    26 	<form id="form-duplicator" method="post">
       
    27 		<!-- h2 requred here for general system messages -->
       
    28 		<h2 style='display:none'></h2>
       
    29 		<div class="dup-header widget">
       
    30 			<div style='float:left;height:45px'><img src="<?php echo DUPLICATOR_PLUGIN_URL  ?>img/logo.png" style='text-align:top'  /></div> 
       
    31 			<div style='float:left;height:45px; text-align:center;'>
       
    32 				<h2 style='margin:-12px 0px -7px 0px; text-align:center; width:100%;'>Duplicator &raquo;<span style="font-size:18px"> <?php _e("Dashboard", 'wpduplicator') ?></span> </h2>
       
    33 				<i style='font-size:0.8em'><?php _e("By", 'wpduplicator') ?> <a href='http://lifeinthegrid.com/duplicator' target='_blank'>lifeinthegrid.com</a></i>
       
    34 			</div> 
       
    35 			<div style='float:right; padding:5px 0px 0px 0px; white-space:nowrap'>
       
    36 				<input type="button" id="btn-help-dialog" onclick='window.location.href="?page=duplicator_support_page"' title="<?php _e("Support", 'wpduplicator') ?>" />
       
    37 				<input type="button" id="dup-btn-about" onclick='window.location.href="?page=duplicator_about_page"' title="<?php _e("All About", 'wpduplicator') ?>" />
       
    38 			</div>
       
    39 			<br style='clear:both' />
       
    40 		</div>
       
    41 		
       
    42 		<!-- TOOLBAR -->
       
    43 		<table border="0" id="toolbar-table" cellspacing="0">
       
    44 			<tr valign="top">
       
    45 				<td class="toolbar-label"><label><?php _e("Package Name", 'wpduplicator') ?>:</label>&nbsp;</td>
       
    46 				<td class="toolbar-textbox"><input name="package_name" type="text" style="width:250px" value="<?php echo $package_name ?>" maxlength="40" /></td>
       
    47 				<!-- Create/Delete -->
       
    48 				<td><input type="submit" id="btn-create-pack" class="btn-create-pack" value="" name="submit" title="<?php _e("Create Package", 'wpduplicator') ?>" ondblclick="javascript:return void(0);" /></td>
       
    49 				<td><input type="button" id="btn-delete-pack" title="<?php _e("Delete selected package(s)", 'wpduplicator') ?>" onclick="Duplicator.deletePackage()"  ondblclick="javascript:return void(0);"/></td>	
       
    50 				<!-- Options/Logs -->
       
    51 				<td><img src="<?php echo DUPLICATOR_PLUGIN_URL  ?>img/hdivider.png" class="toolbar-divider" /></td>
       
    52 				<td align="center"><input type="button" id="btn-opts-dialog" class="btn-opts-dialog" title="<?php _e("Options", 'wpduplicator') ?>..." onclick="Duplicator.optionsOpen()" /></td>	
       
    53 				<td align="center"><input type="button" id="btn-sys-dialog"  class="btn-sys-dialog" onclick="Duplicator.getSystemCheck()" title="<?php _e("System Check", 'wpduplicator') ?>..." /></td>
       
    54 				<td align="center"><input type="button" id="btn-logs-dialog" class="btn-log-dialog" onclick="Duplicator.openLog()" title="<?php _e("Show Create Log", 'wpduplicator') ?>..." /></td>
       
    55 				<td align="center"></td>
       
    56 			</tr>
       
    57 		</table>
       
    58 
       
    59 		<!-- STATUS BAR
       
    60 		id comes from wp-themes: major-publishing-actions  keeps themeing correct -->
       
    61 		<table width="100%"  class="widefat" cellspacing="0">
       
    62 			<tr>
       
    63 				<td width="100%" style="font-size:14px; vertical-align:middle; height:26px">
       
    64 					<b><?php _e("Status", 'wpduplicator') ?>:</b>
       
    65 					<span id="span-status"><?php _e("Ready to create new package", 'wpduplicator' ) ?>.</span>
       
    66 					<img id="img-status-error" src="<?php echo DUPLICATOR_PLUGIN_URL ?>img/error.png" style="height:16px; width:16px; display:none; margin-top:3px; margin:0px" valign="bottom" />
       
    67 					<img id="img-status-progress" src="<?php echo DUPLICATOR_PLUGIN_URL ?>img/progress.gif" style="height:10px; width:46px; display:none" />
       
    68 					<span id="span-status-post" style="display:inline-block"></span>
       
    69 				</td>
       
    70 			</tr>
       
    71 		</table><div style="height:5px"></div>
       
    72 		
       
    73 		
       
    74 		<!-- TABLE LIST -->
       
    75 		<table class="widefat dup-pack-table">
       
    76 			<thead>
       
    77 				<tr>
       
    78 					<?php if($total_elements == 0)  :	?>
       
    79 						<th colspan="7">&nbsp;</th>
       
    80 					<?php else : ?>	
       
    81 						<th><input type="checkbox" id="select-all"  title="<?php _e("Select all packages", 'wpduplicator') ?>" style="margin:0px;padding:0px 0px 0px 5px;" /></th>
       
    82 						<th><?php _e("Information", 'wpduplicator') ?></th>
       
    83 						<th><?php _e("Owner", 'wpduplicator') ?></th>
       
    84 						<th><?php _e("Created", 'wpduplicator') ?></th>
       
    85 						<th><?php _e("Size", 'wpduplicator') ?></th>
       
    86 						<th><?php _e("Package Name", 'wpduplicator') ?></th>
       
    87 						<th style="width:90%; text-align:right; padding-right:10px" colspan="2">
       
    88 							<?php _e("Package Set",  'wpduplicator')?>
       
    89 							<i style='font-size:10px'><?php _e("(Download Both)",  'wpduplicator')?></i>
       
    90 						</th>
       
    91 					<?php endif; ?>	
       
    92 				</tr>
       
    93 			</thead>
       
    94 			<?php
       
    95 			if($total_elements != 0)  {
       
    96 				$ct = 0;
       
    97 				$total_size = 0;
       
    98 				while($ct < $total_elements) {
       
    99 					$row	   = $result[$ct];
       
   100 					$settings  = unserialize($row['settings']);
       
   101 					$detail_id = "duplicator-detail-row-{$ct}";
       
   102 					$packname  = empty($row['packname']) ? $row['zipname'] : $row['packname'];
       
   103 					$total_size = $total_size + $row['zipsize'];
       
   104 					$plugin_version = empty($settings['plugin_version']) ? 'unknown' : $settings['plugin_version'];
       
   105 					$plugin_compat  = version_compare($plugin_version, '0.3.1');
       
   106 					?>
       
   107 					
       
   108 					
       
   109 					<?php if($plugin_compat >= 0)  :	?>
       
   110 						<?php
       
   111 							//Links
       
   112 							$uniqueid  			= "{$row['token']}_{$row['packname']}";
       
   113 							$sqlfilelink		= duplicator_snapshot_urlpath() . "{$uniqueid}_database.sql";
       
   114 							$packagepath 		= duplicator_snapshot_urlpath() . "{$uniqueid}_package.zip";
       
   115 							$installerpath		= duplicator_snapshot_urlpath() . "{$uniqueid}_installer.php";
       
   116 							$installfilelink	= "{$installerpath}?get=1&file={$uniqueid}_installer.php";
       
   117 						?>
       
   118 						<tr class="dup-pack-info">
       
   119 							<td style="padding-right:20px !important"><input name="delete_confirm" type="checkbox" id="<?php echo $uniqueid ;?>" onclick="Duplicator.rowColor(this)" /></td>
       
   120 							<td><a href="javascript:void(0);" onclick="return Duplicator.toggleDetail('<?php echo $detail_id ;?>');">[<?php echo __("View", 'wpduplicator') . ' ' . $row['id'];?>]</a></td>
       
   121 							<td><?php echo $row['owner'];?></td>
       
   122 							<td><?php echo date( "m-d-y G:i", strtotime($row['created']));?></td>
       
   123 							<td><?php echo duplicator_bytesize($row['zipsize']);?></td>
       
   124 							<td class='pack-name'><?php echo $packname ;?></td>
       
   125 							<td style="width:90%;" class="get-btns">	
       
   126 								<button id="<?php echo "{$uniqueid}_installer.php" ?>" class="dup-installer-btn no-select" onclick="Duplicator.downloadFile('<?php echo $installfilelink; ?>', this); return false;"><?php _e("Installer", 'wpduplicator') ?></button> &nbsp;
       
   127 								<button id="<?php echo "{$uniqueid}_package.zip" ?>" class="dup-installer-btn no-select" onclick="Duplicator.downloadFile('<?php echo $packagepath; ?>', this); return false;"><?php _e("Package", 'wpduplicator') ?></button>
       
   128 							</td>
       
   129 						</tr>
       
   130 						<tr>
       
   131 							<td colspan="8" id="<?php echo $detail_id; ?>" class="dup-pack-details">
       
   132 								<div class="dup-details-area">
       
   133 									<b><?php _e("Version", 'wpduplicator') ?>:</b> <?php echo $plugin_version ?>  &nbsp;
       
   134 									<b><?php _e("Secure Name", 'wpduplicator')?>:</b> <?php echo "{$row['token']}_{$row['packname']}" ;?> <br/>
       
   135 									<button class='dup-dlg-quick-path-database-link no-select' onclick="window.open(<?php echo "'{$sqlfilelink}', '_blank'" ;?>); return false;"><?php _e("Download SQL File", 'wpduplicator')?></button>
       
   136 									<button class='dup-dlg-quick-path-download-link no-select' onclick="Duplicator.showQuickPath(<?php echo "'{$sqlfilelink}', '{$packagepath}', '{$installfilelink}' " ;?>); return false;"><?php _e("Show Download Links", 'wpduplicator')?></button>
       
   137 								</div>
       
   138 							</td>
       
   139 						</tr>	
       
   140 						
       
   141 					<!-- LEGACY PRE 0.3.1 PACKS -->
       
   142 					<?php else : ?>	
       
   143 						<?php
       
   144 							$legacy_package = duplicator_snapshot_urlpath() . "{$row['zipname']}";
       
   145 						?>
       
   146 						<tr class="dup-pack-info">
       
   147 							<td style="padding-right:20px !important"><input name="delete_confirm" type="checkbox" id="<?php echo $row['zipname'] ;?>" onclick="Duplicator.rowColor(this)" /></td>
       
   148 							<td><a href="javascript:void(0);" onclick="return Duplicator.toggleDetail('<?php echo $detail_id ;?>');">[<?php echo __("View", 'wpduplicator') . ' ' . $row['id'];?></a>]</td>
       
   149 							<td><?php echo $row['owner'];?></td>
       
   150 							<td><?php echo date( "m-d-y G:i", strtotime($row['created']));?></td>
       
   151 							<td><?php echo duplicator_bytesize($row['zipsize']);?></td>
       
   152 							<td class='pack-name'><?php echo $packname ;?></td>
       
   153 							<td style="width:90%;" class="get-btns">	
       
   154 								<span style='display:inline-block; padding:7px 10px 0px 0px'>
       
   155 								<a href="javascript:void(0);" onclick="return Duplicator.toggleDetail('<?php echo $detail_id ;?>');">[Not Supported]</a></span>
       
   156 								<button id="<?php echo "{$row['zipname']}" ?>" class="dup-installer-btn no-select" onclick="Duplicator.downloadFile('<?php echo $legacy_package; ?>', this); return false;"><?php _e("Package", 'wpduplicator') ?></button>
       
   157 							</td>
       
   158 						</tr>
       
   159 						<tr>
       
   160 							<td colspan="8" id="<?php echo $detail_id; ?>" class="dup-pack-details">
       
   161 								<div class="dup-details-area ui-state-error">
       
   162 									<b><?php _e("Legacy Version", 'wpduplicator') ?>:</b> <?php echo $plugin_version ?> <br/>
       
   163 									<i style="color:#000"><?php
       
   164 									printf("%s <a href='http://lifeinthegrid.com/duplicator-docs' target='_blank'>%s</a>",
       
   165 									__("This package was built with a version that is no longer supported.  It is highly recommended that this package be deleted.  For more details see the", 'wpduplicator'),
       
   166 									__("Online FAQs", 'wpduplicator')); 
       
   167 									?></i>
       
   168 								</div>
       
   169 							</td>
       
   170 						</tr>	
       
   171 					<?php endif; ?>	
       
   172 					
       
   173 
       
   174 					<?php
       
   175 					$ct++;
       
   176 				}
       
   177 			} else {
       
   178 				$msg1 = __("No packages found", 'wpduplicator');
       
   179 				$msg2 = __("To create a new package, enter a name and click the create button ", 'wpduplicator');
       
   180 				$msg3 = sprintf("%s <a href='javascript:void(0)' onclick='Duplicator.getSystemCheck()'>%s</a> %s",
       
   181 							__("Check your", 'wpduplicator'), 
       
   182 							__("server's compatibility", 'wpduplicator'),
       
   183 							__("with the duplicator", 'wpduplicator'));
       
   184 				$msg4 = __("This process will backup all your files and database", 'wpduplicator');
       
   185 				$msg5 = __("Creating a package may take several minutes if you have a large site", 'wpduplicator');
       
   186 				$msg6 = __("This window should remain open for the process to complete", 'wpduplicator');
       
   187 				$msg7 = __("Please be patient while we work through this Beta version", 'wpduplicator');
       
   188 				$msg8 = __("Please report any issues to", 'wpduplicator');
       
   189 				
       
   190 				echo "<tr>
       
   191 						<td colspan='7'>
       
   192 							<div style='padding:60px 20px;text-align:center'>
       
   193 								<b style='font-size:14px'>{$msg1}.<br/> {$msg2} <input type='submit' class='btn-create-pack'  ondblclick='javascript:return void(0);' value=''  /><br/> {$msg3}.</b><br/><br/>
       
   194 								<i>{$msg4}.<br/> {$msg5}.<br/> {$msg6}. <br/><br/> {$msg7}.<br/> {$msg8} <a href='http://support.lifeinthegrid.com' target='_blank'>support.lifeinthegrid.com</a></i>
       
   195 							</div>
       
   196 							</td>
       
   197 						</tr>";
       
   198 			}
       
   199 			?>
       
   200 			<tfoot>
       
   201 				<tr>
       
   202 					<?php if($total_elements == 0)  :	?>
       
   203 						<th colspan="8">&nbsp;</th>
       
   204 					<?php else : ?>	
       
   205 						<th colspan="8" style='text-align:right; font-size:12px'><?php echo _e("Total Storage Used", 'wpduplicator') . ': ' . duplicator_bytesize($total_size); ?></th>
       
   206 					<?php endif; ?>	
       
   207 				</tr>
       
   208 			</tfoot>
       
   209 		</table>
       
   210 	</form>
       
   211 </div>