home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Plugins / wp-dbmanager / dbmanager / database-uninstall.php < prev    next >
PHP Script  |  2008-02-19  |  5KB  |  129 lines

  1. <?php
  2. /*
  3. +----------------------------------------------------------------+
  4. |                                                                                            |
  5. |    WordPress 2.1 Plugin: WP-DBManager 2.20                                |
  6. |    Copyright (c) 2007 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/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('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=dbmanager/dbmanager.php';
  74.             if(function_exists('wp_nonce_url')) { 
  75.                 $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_dbmanager/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 width="50%"  border="0" cellspacing="3" cellpadding="3">
  105.         <tr class="thead">
  106.             <td align="center"><strong><?php _e('WordPress Options', 'wp-dbmanager'); ?></strong></td>
  107.         </tr>
  108.         <tr>
  109.             <td valign="top" style="background-color: #eee;">
  110.                 <ol>
  111.                 <?php
  112.                     foreach($db_settings as $settings) {
  113.                         echo '<li>'.$settings.'</li>'."\n";
  114.                     }
  115.                 ?>
  116.                 </ol>
  117.             </td>
  118.         </tr>
  119.     </table>
  120.     <p> </p>
  121.     <p style="text-align: center;">
  122.         <input type="checkbox" name="uninstall_db_yes" value="yes" /> <?php _e('Yes', 'wp-dbmanager'); ?><br /><br />
  123.         <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'); ?>')" />
  124.     </p>
  125. </div>
  126. </form>
  127. <?php
  128. } // End switch($mode)
  129. ?>