root/wp-dbmanager/trunk/database-uninstall.php

Revision 52756, 5.1 kB (checked in by GamerZ, 5 days ago)

2.31

Line 
1 <?php
2 /*
3 +----------------------------------------------------------------+
4 |                                                                                            |
5 |    WordPress 2.5 Plugin: WP-DBManager 2.31                                |
6 |    Copyright (c) 2008 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&amp;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 '<h2>'.__('Uninstall WP-DBManager', 'wp-dbmanager').'</h2>';
79             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>';
80             echo '</div>';
81             break;
82     // Main Page
83     default:
84 ?>
85 <!-- Uninstall WP-DBManager -->
86 <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
87     <div class="wrap">
88         <h2><?php _e('Uninstall WP-DBManager', 'wp-dbmanager'); ?></h2>
89         <p style="text-align: left;">
90             <?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'); ?>
91         </p>
92         <p style="text-align: left; color: red">
93             <strong><?php _e('WARNING:', 'wp-dbmanager'); ?></strong><br />
94             <?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'); ?>
95         </p>
96         <p style="text-align: left; color: red">
97             <strong><?php _e('NOTE:', 'wp-dbmanager'); ?></strong><br />
98             <?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 />
99             <?php printf(__('The path to the backup folder is <strong>\'%s\'</strong>.', 'wp-dbmanager'), $backup_options_path); ?>
100         </p>
101         <p style="text-align: left; color: red">
102             <strong><?php _e('The following WordPress Options will be DELETED:', 'wp-dbmanager'); ?></strong><br />
103         </p>
104         <table class="widefat">
105             <thead>
106                 <tr>
107                     <th><?php _e('WordPress Options', 'wp-dbmanager'); ?></th>
108                 </tr>
109             </thead>
110             <tr>
111                 <td valign="top">
112                     <ol>
113                     <?php
114                         foreach($db_settings as $settings) {
115                             echo '<li>'.$settings.'</li>'."\n";
116                         }
117                     ?>
118                     </ol>
119                 </td>
120             </tr>
121         </table>
122         <p>&nbsp;</p>
123         <p style="text-align: center;">
124             <input type="checkbox" name="uninstall_db_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-dbmanager'); ?><br /><br />
125             <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'); ?>')" />
126         </p>
127     </div>
128 </form>
129 <?php
130 } // End switch($mode)
131 ?>
Note: See TracBrowser for help on using the browser.