root/wp-email/trunk/email-uninstall.php

Revision 50002, 5.1 kB (checked in by GamerZ, 4 weeks ago)

Fixed MYSQL Charset Issue

Line 
1 <?php
2 /*
3 +----------------------------------------------------------------+
4 |                                                                                            |
5 |    WordPress 2.5 Plugin: WP-EMail 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-EMail                                                                |
14 |    - wp-content/plugins/wp-email/email-uninstall.php                        |
15 |                                                                                            |
16 +----------------------------------------------------------------+
17 */
18
19
20 ### Check Whether User Can Manage EMail
21 if(!current_user_can('manage_email')) {
22     die('Access Denied');
23 }
24
25
26 ### Variables Variables Variables
27 $base_name = plugin_basename('wp-email/email-manager.php');
28 $base_page = 'admin.php?page='.$base_name;
29 $mode = trim($_GET['mode']);
30 $email_tables = array($wpdb->email);
31 $email_settings = array('email_smtp', 'email_contenttype', 'email_mailer', 'email_template_subject', 'email_template_body', 'email_template_bodyalt', 'email_template_sentsuccess', 'email_template_sentfailed', 'email_template_error', 'email_interval', 'email_snippet', 'email_multiple', 'email_imageverify', 'email_options', 'email_fields', 'email_template_title', 'email_template_subtitle', 'widget_email_most_emailed');
32
33
34 ### Form Processing
35 if(!empty($_POST['do'])) {
36     // Decide What To Do
37     switch($_POST['do']) {
38         //  Uninstall WP-EMail
39         case __('UNINSTALL WP-EMail', 'wp-email') :
40             if(trim($_POST['uninstall_email_yes']) == 'yes') {
41                 echo '<div id="message" class="updated fade">';
42                 echo '<p>';
43                 foreach($email_tables as $table) {
44                     $wpdb->query("DROP TABLE {$table}");
45                     echo '<font style="color: green;">';
46                     printf(__('Table \'%s\' has been deleted.', 'wp-email'), "<strong><em>{$table}</em></strong>");
47                     echo '</font><br />';
48                 }
49                 echo '</p>';
50                 echo '<p>';
51                 foreach($email_settings as $setting) {
52                     $delete_setting = delete_option($setting);
53                     if($delete_setting) {
54                         echo '<font color="green">';
55                         printf(__('Setting Key \'%s\' has been deleted.', 'wp-email'), "<strong><em>{$setting}</em></strong>");
56                         echo '</font><br />';
57                     } else {
58                         echo '<font color="red">';
59                         printf(__('Error deleting Setting Key \'%s\'.', 'wp-email'), "<strong><em>{$setting}</em></strong>");
60                         echo '</font><br />';
61                     }
62                 }
63                 echo '</p>';
64                 echo '</div>';
65                 $mode = 'end-UNINSTALL';
66             }
67             break;
68     }
69 }
70
71
72 ### Determines Which Mode It Is
73 switch($mode) {
74         //  Deactivating WP-EMail
75         case 'end-UNINSTALL':
76             $deactivate_url = 'plugins.php?action=deactivate&amp;plugin=wp-email/wp-email.php';
77             if(function_exists('wp_nonce_url')) {
78                 $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_wp-email/wp-email.php');
79             }
80             echo '<div class="wrap">';
81             echo '<h2>'.__('Uninstall WP-EMail', 'wp-email').'</h2>';
82             echo '<p><strong>'.sprintf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-EMail Will Be Deactivated Automatically.', 'wp-email'), $deactivate_url).'</strong></p>';
83             echo '</div>';
84             break;
85     // Main Page
86     default:
87 ?>
88 <!-- Uninstall WP-EMail -->
89 <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post">
90 <div class="wrap">
91     <h2><?php _e('Uninstall WP-EMail', 'wp-email'); ?></h2>
92     <p style="text-align: left;">
93         <?php _e('Deactivating WP-EMail plugin does not remove any data that may have been created, such as the email options and the email logs. To completely remove this plugin, you can uninstall it here.', 'wp-email'); ?>
94     </p>
95     <p style="text-align: left; color: red">
96         <strong><?php _e('WARNING:', 'wp-email'); ?></strong><br />
97         <?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-email'); ?>
98     </p>
99     <p style="text-align: left; color: red">
100         <strong><?php _e('The following WordPress Options/Tables will be DELETED:', 'wp-email'); ?></strong><br />
101     </p>
102     <table class="widefat">
103         <thead>
104             <tr>
105                 <th><?php _e('WordPress Options', 'wp-email'); ?></th>
106                 <th><?php _e('WordPress Tables', 'wp-email'); ?></th>
107             </tr>
108         </thead>
109         <tr>
110             <td valign="top">
111                 <ol>
112                 <?php
113                     foreach($email_settings as $settings) {
114                         echo '<li>'.$settings.'</li>'."\n";
115                     }
116                 ?>
117                 </ol>
118             </td>
119             <td valign="top" class="alternate">
120                 <ol>
121                 <?php
122                     foreach($email_tables as $tables) {
123                         echo '<li>'.$tables.'</li>'."\n";
124                     }
125                 ?>
126                 </ol>
127             </td>
128         </tr>
129     </table>
130     <p>&nbsp;</p>
131     <p style="text-align: center;">
132         <input type="checkbox" name="uninstall_email_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-email'); ?><br /><br />
133         <input type="submit" name="do" value="<?php _e('UNINSTALL WP-EMail', 'wp-email'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-EMail From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-email'); ?>')" />
134     </p>
135 </div>
136 </form>
137 <?php
138 } // End switch($mode)
139 ?>
Note: See TracBrowser for help on using the browser.