| 1 |
<?php |
| 2 |
/* |
| 3 |
+----------------------------------------------------------------+ |
| 4 |
| | |
| 5 |
| WordPress 2.8 Plugin: WP-DBManager 2.50 | |
| 6 |
| Copyright (c) 2009 Lester "GaMerZ" Chan | |
| 7 |
| | |
| 8 |
| File Written By: | |
| 9 |
| - Lester "GaMerZ" Chan | |
| 10 |
| - http://lesterchan.net | |
| 11 |
| | |
| 12 |
| File Information: | |
| 13 |
| - Uninstall WP-DBManager | |
| 14 |
| - wp-content/plugins/wp-dbmanager/dbmanager-uninstall.php | |
| 15 |
| | |
| 16 |
+----------------------------------------------------------------+ |
| 17 |
*/ |
| 18 |
|
| 19 |
|
| 20 |
### Check Whether User Can Manage Database |
| 21 |
if(!current_user_can('manage_database')) { |
| 22 |
die('Access Denied'); |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
### Variables Variables Variables |
| 27 |
$base_name = plugin_basename('wp-dbmanager/database-manager.php'); |
| 28 |
$base_page = 'admin.php?page='.$base_name; |
| 29 |
$mode = trim($_GET['mode']); |
| 30 |
$db_settings = array('dbmanager_options'); |
| 31 |
$backup_options = get_option('dbmanager_options'); |
| 32 |
$backup_options_path = $backup_options['path']; |
| 33 |
|
| 34 |
### Form Processing |
| 35 |
if(!empty($_POST['do'])) { |
| 36 |
// Decide What To Do |
| 37 |
switch($_POST['do']) { |
| 38 |
// Uninstall WP-DBManager |
| 39 |
case __('UNINSTALL WP-DBManager', 'wp-dbmanager') : |
| 40 |
if(trim($_POST['uninstall_db_yes']) == 'yes') { |
| 41 |
echo '<div id="message" class="updated fade">'; |
| 42 |
echo '<p>'; |
| 43 |
foreach($db_settings as $setting) { |
| 44 |
$delete_setting = delete_option($setting); |
| 45 |
if($delete_setting) { |
| 46 |
echo '<font color="green">'; |
| 47 |
printf(__('Setting Key \'%s\' has been deleted.', 'wp-dbmanager'), "<strong><em>{$setting}</em></strong>"); |
| 48 |
echo '</font><br />'; |
| 49 |
} else { |
| 50 |
echo '<font color="red">'; |
| 51 |
printf(__('Error deleting Setting Key \'%s\'.', 'wp-dbmanager'), "<strong><em>{$setting}</em></strong>"); |
| 52 |
echo '</font><br />'; |
| 53 |
} |
| 54 |
} |
| 55 |
echo '</p>'; |
| 56 |
echo '<p style="color: blue;">'; |
| 57 |
_e('The database backup files generated by WP-DBManager <strong>WILL NOT</strong> be deleted. You will have to delete it manually.', 'wp-dbmanager'); |
| 58 |
echo '<br />'; |
| 59 |
printf(__('The path to the backup folder is <strong>\'%s\'</strong>.', 'wp-dbmanager'), $backup_options_path); |
| 60 |
echo '</p>'; |
| 61 |
echo '</div>'; |
| 62 |
$mode = 'end-UNINSTALL'; |
| 63 |
} |
| 64 |
break; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
### Determines Which Mode It Is |
| 70 |
switch($mode) { |
| 71 |
// Deactivating WP-DBManager |
| 72 |
case 'end-UNINSTALL': |
| 73 |
$deactivate_url = 'plugins.php?action=deactivate&plugin=wp-dbmanager/wp-dbmanager.php'; |
| 74 |
if(function_exists('wp_nonce_url')) { |
| 75 |
$deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_wp-dbmanager/wp-dbmanager.php'); |
| 76 |
} |
| 77 |
echo '<div class="wrap">'; |
| 78 |
echo '<div id="icon-wp-dbmanager" class="icon32"><br /></div>'; |
| 79 |
echo '<h2>'.__('Uninstall WP-DBManager', 'wp-dbmanager').'</h2>'; |
| 80 |
echo '<p><strong>'.sprintf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-DBManager Will Be Deactivated Automatically.', 'wp-dbmanager'), $deactivate_url).'</strong></p>'; |
| 81 |
echo '</div>'; |
| 82 |
break; |
| 83 |
// Main Page |
| 84 |
default: |
| 85 |
?> |
| 86 |
<!-- Uninstall WP-DBManager --> |
| 87 |
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>"> |
| 88 |
<div class="wrap"> |
| 89 |
<div id="icon-wp-dbmanager" class="icon32"><br /></div> |
| 90 |
<h2><?php _e('Uninstall WP-DBManager', 'wp-dbmanager'); ?></h2> |
| 91 |
<p> |
| 92 |
<?php _e('Deactivating WP-DBManager plugin does not remove any data that may have been created, such as the database options. To completely remove this plugin, you can uninstall it here.', 'wp-dbmanager'); ?> |
| 93 |
</p> |
| 94 |
<p style="color: red"> |
| 95 |
<strong><?php _e('WARNING:', 'wp-dbmanager'); ?></strong><br /> |
| 96 |
<?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'wp-dbmanager'); ?> |
| 97 |
</p> |
| 98 |
<p style="color: red"> |
| 99 |
<strong><?php _e('NOTE:', 'wp-dbmanager'); ?></strong><br /> |
| 100 |
<?php _e('The database backup files generated by WP-DBManager <strong>WILL NOT</strong> be deleted. You will have to delete it manually.', 'wp-dbmanager'); ?><br /> |
| 101 |
<?php printf(__('The path to the backup folder is <strong>\'%s\'</strong>.', 'wp-dbmanager'), $backup_options_path); ?> |
| 102 |
</p> |
| 103 |
<p style="color: red"> |
| 104 |
<strong><?php _e('The following WordPress Options will be DELETED:', 'wp-dbmanager'); ?></strong><br /> |
| 105 |
</p> |
| 106 |
<table class="widefat"> |
| 107 |
<thead> |
| 108 |
<tr> |
| 109 |
<th><?php _e('WordPress Options', 'wp-dbmanager'); ?></th> |
| 110 |
</tr> |
| 111 |
</thead> |
| 112 |
<tr> |
| 113 |
<td valign="top"> |
| 114 |
<ol> |
| 115 |
<?php |
| 116 |
foreach($db_settings as $settings) { |
| 117 |
echo '<li>'.$settings.'</li>'."\n"; |
| 118 |
} |
| 119 |
?> |
| 120 |
</ol> |
| 121 |
</td> |
| 122 |
</tr> |
| 123 |
</table> |
| 124 |
<p> </p> |
| 125 |
<p style="text-align: center;"> |
| 126 |
<input type="checkbox" name="uninstall_db_yes" value="yes" /> <?php _e('Yes', 'wp-dbmanager'); ?><br /><br /> |
| 127 |
<input type="submit" name="do" value="<?php _e('UNINSTALL WP-DBManager', 'wp-dbmanager'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-DBManager From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-dbmanager'); ?>')" /> |
| 128 |
</p> |
| 129 |
</div> |
| 130 |
</form> |
| 131 |
<?php |
| 132 |
} // End switch($mode) |
| 133 |
?> |