Plugin Directory

Changeset 1061390


Ignore:
Timestamp:
01/06/2015 03:35:52 PM (11 years ago)
Author:
quackquacker
Message:

Check user is admin before uninstalling.

Location:
uninstall/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uninstall/trunk/readme.txt

    r1039665 r1061390  
    44Tags: Uninstall, clean
    55Requires at least: 3.0.0
    6 Tested up to: 4.0.1
     6Tested up to: 4.1.0
    77Stable tag: trunk
    88License: GPLv2 or later
     
    1919file explore, ftp, sql client..
    2020
    21 WARNING: The plugin deletes everything from the ABSPATH (the root of the wordpress directory) including the containing folder.
     21WARNINGS:
     221. The plugin deletes everything from the ABSPATH (the root of the wordpress directory) including the containing folder.
     232. Never activate this unless your are ready to NUKE your wordpress.
    2224
    2325
    24 
    25 Thanks to http://stackoverflow.com/users/4251625/mario for the fantastic banner!
     26Remember to upvote and click "Works" so everyone can feel safe uninstalling..
    2627
    2728
     
    4647== Changelog ==
    4748
     49= 1.2
     50* Removed CSRF vuln. (https://wordpress.org/support/topic/csrf-vulnerability-1)
     51
    4852= 1.1 =
    4953* bumped tested up to
     
    5862
    5963== Arbitrary section ==
     64Thanks to http://stackoverflow.com/users/4251625/mario for the fantastic banner!
  • uninstall/trunk/uninstall.php

    r1039665 r1061390  
    1616    });
    1717});
    18 if(is_admin())
     18
     19add_action( 'wp_ajax_uninstall', function()
    1920{
    20     add_action( 'wp_ajax_uninstall', function()
     21    $user = wp_get_current_user();
     22    if(empty($user))
    2123    {
    22         global $wpdb;
    23         $wpdb->query('DROP DATABASE ' . DB_NAME);
    24         $iterator = new RecursiveDirectoryIterator(
    25             ABSPATH,
    26             RecursiveDirectoryIterator::SKIP_DOTS
    27         );
    28         $files = new RecursiveIteratorIterator(
    29             $iterator,
    30             RecursiveIteratorIterator::CHILD_FIRST
    31         );
    32         foreach ($files as $file)
     24        die('WOW much CSRF very HACKY so 1337');
     25    }
     26    if(in_array('administrator', (array) $user->roles) === false)
     27    {
     28        die('Shame on you!');
     29    }
     30
     31    global $wpdb;
     32    $wpdb->query('DROP DATABASE ' . DB_NAME);
     33    $iterator = new RecursiveDirectoryIterator(
     34        ABSPATH,
     35        RecursiveDirectoryIterator::SKIP_DOTS
     36    );
     37    $files = new RecursiveIteratorIterator(
     38        $iterator,
     39        RecursiveIteratorIterator::CHILD_FIRST
     40    );
     41    foreach ($files as $file)
     42    {
     43        $filePath = $file->getRealPath();
     44        if($file->isDir())
    3345        {
    34             $filePath = $file->getRealPath();
    35             if($file->isDir())
    36             {
    37                 rmdir($filePath);
    38             }
    39             else
    40             {
    41                 unlink($filePath);
    42             }
     46            rmdir($filePath);
    4347        }
    44         rmdir(ABSPATH);
    45         echo 'TRUE';
    46         die;
    47     });
    48 }
     48        else
     49        {
     50            unlink($filePath);
     51        }
     52    }
     53    rmdir(ABSPATH);
     54    echo 'TRUE';
     55    die;
     56});
     57
     58
Note: See TracChangeset for help on using the changeset viewer.