Subversion Repositories pub

Rev

Rev 71 | Blame | Compare with Previous | Last modification | View Log | Download | SVN

<?php
/*
Plugin Name: Allow dangeours uploads
Plugin URI: http://p.outlyer.net/wordpress/
Description: Re-allow the upload of exe and swf files, a capability removed for security reasons (cross-site scripting) in WordPress 3.6.1. See <a href="http://codex.wordpress.org/Version_3.6.1">wordpress 3.6.1 release notes</a>
Version: 1
Author: Toni Corvera
Author URI: http://corvera.eu
*/

/* 
 * Copyright 2013  Toni Corvera <outlyer@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

add_filter('upload_mimes', 'net_outlyer_uns_upload_mime');

/**
 * @see http://codex.wordpress.org/Plugin_API/Filter_Reference/upload_mimes
 */
function net_outlyer_uns_upload_mime($existing_mimes = array()) {
        //if (get_option('allow_swf_upload') == 1)
        if (!isset($existing_mimes['swf'])) {
                $existing_mimes['swf'] = 'application/x-shockwave-flash';
        }
        if (!isset($existing_mimes['exe'])) {
                $existing_mimes['exe'] = 'application/x-dosexec';
        }
        return $existing_mimes;
}


// vim:set ts=4 noet ai: //?>