[wp-trac] [WordPress Trac] #22634: Plugin Editor ignores &plugin= variable
WordPress Trac
noreply at wordpress.org
Thu Nov 29 14:12:59 UTC 2012
#22634: Plugin Editor ignores &plugin= variable
-----------------------------+--------------------------
Reporter: ZjanPreijde | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Plugins
Version: 3.4.2 | Severity: minor
Keywords: needs-patch |
-----------------------------+--------------------------
When a plugin is chosen and subsequently a file belonging to that plugin,
a link is followed with the ?file=xx/zz&plugin=xx variables.
The plugin has the following code:
{{{
if ( isset($_REQUEST['file']) )
$plugin = stripslashes($_REQUEST['file']);
if ( empty($plugin) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) )
$file = $plugin_files[0];
else
$file = stripslashes($file);
}}}
The result is :
a. The plugin select box is reset to the first plugin
b. The '(active)'/'(inactive)' text does not correspond to the chosen
plugin any more.
I think the code should be changed into the following:
{{{
if ( isset($_REQUEST['plugin']) )
$plugin = stripslashes($_REQUEST['plugin']);
if ( isset($_REQUEST['file']) )
$file = stripslashes($_REQUEST['file']);
if ( empty($plugin) || !in_array($plugin, array_keys($plugins)) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
$file = "";
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) || !in_array($file, $plugin_files) )
$file = $plugin_files[0];
}}}
I'd attach a diff, if I'd only know how to create one :-)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22634>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list