#172 new
pixelate

RCCWP_removeFiles.php - Hard Coded Table Names

Reported by pixelate | July 13th, 2009 @ 11:38 PM

Deletion of files will not work if the site doesn't use the default wp_xxx table name strucutre of WordPress as the table names have been hard coded to match that strucutre.

This is easily fixed by using:

<?php

require( dirname(__FILE__) . "/../../../wp-config.php");

//check if the user  is logged in
global $flutter_domain;
if(!(is_user_logged_in() && current_user_can('edit_posts'))){
    die(__('Authentication failed!',$flutter_domain));   
};


if(empty($_GET['action'])){
    exit();
}

switch($_GET['action']){
    case  "delete":
    $file = addslashes($_GET['file']);
    $exists = $wpdb->get_row("select * from {$wpdb->postmeta} where meta_value =  '{$file}'");

    if(!empty($exists->meta_id)){
        $wpdb->query("DELETE FROM  postmeta where meta_id = {$exists->meta_id}");
    } else {
        echo "false";
        exit();

}

    //deleting  file
    unlink(FLUTTER_FILES_PATH.$file);
    echo "true";
    exit();
}

?>

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The WordPress CMS plugin

People watching this ticket

Pages